Is possible insert image without uploading? Just put image link, and display it in tag.
custom handler + insertEmbed. why don't you read the guides first?
Logged in just to down vote this comment.
Its kind of lazy that the developers left out such a crucial part of wysiwyg editing.
also here is some actually useful code
```
var toolbarOptions = [
['bold', 'italic', 'underline', 'strike'], // toggled buttons
['blockquote', 'code-block'],
[{ 'header': 1 }, { 'header': 2 }], // custom button values
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
[{ 'script': 'sub' }, { 'script': 'super' }], // superscript/subscript
[{ 'indent': '-1' }, { 'indent': '+1' }], // outdent/indent
[{ 'direction': 'rtl' }], // text direction
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
[{ 'font': [] }],
[{ 'align': [] }],
['clean'], // remove formatting button
['image']
];
var quill = new Quill('#editor', {
theme: 'snow',
modules: {
toolbar: {
container: toolbarOptions,
handlers: {
image: imageHandler
}
}
},
});
function imageHandler() {
var range = this.quill.getSelection();
var value = prompt('What is the image URL');
if(value){
this.quill.insertEmbed(range.index, 'image', value, Quill.sources.USER);
}
}
@Gibigbig Hi! I am using Markdown with nix-quill. I've tried inserting your part of the code in the app module, but apparently Quill is not packed there. May you help me fixing this?
@Gibigbig Hi! I am using Markdown with
nix-quill. I've tried inserting your part of the code in the app module, but apparently Quill is not packed there. May you help me fixing this?
I'm also using ngx-quill. I managed to get this to work in Angular by:
import { QuillModules, defaultModules } from 'ngx-quill';
export class MyComponent {
quillModules: QuillModules = {
toolbar: {
container: defaultModules.toolbar,
handlers: {
image: imageHandler
}
}
};
}
imageHandler(this: any) {
const tooltip = this.quill.theme.tooltip;
const originalSave = tooltip.save;
const originalHide = tooltip.hide;
tooltip.save = function(this: any) {
const range = this.quill.getSelection(true);
const value = this.textbox.value;
if (value) {
this.quill.insertEmbed(range.index, 'image', value, 'user');
}
};
// Called on hide and save.
tooltip.hide = function (this: any) {
tooltip.save = originalSave;
tooltip.hide = originalHide;
tooltip.hide();
};
tooltip.edit('image');
tooltip.textbox.placeholder = "Embed URL";
}
<quill-editor [modules]="quillModules"></quill-editor>
@chrisbmoore Hi, you have to update you tooltip.save funtion .
You can change your code like this:
const value = this.textbox.value to const value = tooltip.textbox.value
Most helpful comment
Logged in just to down vote this comment.
Its kind of lazy that the developers left out such a crucial part of wysiwyg editing.
also here is some actually useful code
```
var toolbarOptions = [
['bold', 'italic', 'underline', 'strike'], // toggled buttons
['blockquote', 'code-block'],