I would like to fully disable images for a Quill editor. It works fine in Chrome and I can't paste images in Chrome at all. I have removed images from the toolbar. However, I would like to find a way to also disallow pasting of images in Internet Explorer. I have been looking into maybe disabling it with using text-change events or an image handler, but I am not entirely sure what would be the best way to disable it or how it would look implementationwise. Since Internet Explorer and Chrome has different behaviour my immediate thought is that is a bug that you can paste pictures.
What should I do if I want to completely disable pictures for all browsers?
<quill-editor [modules]="editorConfig" (focusout)="onBlur()" [(ngModel)]="text"></quill-editor>
I remove it from the toolbar like so, but as mentioned I need pictures to be completely disbled:
public editorConfig: any = {
toolbar: [
['bold', 'italic', 'underline', 'strike'],
[{ align: [] }],
[{ size: ['small', false, 'large', 'huge'] }],
[{ list: 'ordered'}, { list: 'bullet' }],
[{ color: [] }, { background: [] }],
['clean'],
['link']
// ['link', 'image']
],
keyboard: {
bindings: {
tab: {
key: 9,
handler: (range, context) => {
return true;
}
}
}
}
};
https://github.com/quilljs/quill/issues/1108
just do not allow image as a format at all.
The toolbar module is simply a list of buttons to explicit add and remove formats.
But the image format is still allowed.
Ngx-quill allows to set formats in the global config and per Input for the editor component
Thanks! That worked.
For anyone else looking for answers on the internet this is how I did it for now:
<quill-editor [modules]="editorConfig" [formats]="editorFormats" (focusout)="onBlur()" [(ngModel)]="text"></quill-editor>
public editorFormats: string[] = [
'bold',
'italic',
'underline',
'strike',
];
Most helpful comment
Thanks! That worked.
For anyone else looking for answers on the internet this is how I did it for now: