Ngx-quill: Internet Explorer allows pasting images while Chrome does not

Created on 3 Oct 2019  路  2Comments  路  Source: KillerCodeMonkey/ngx-quill

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;
          }
        }
      }
    }
  };

Most helpful comment

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',
  ];

All 2 comments

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',
  ];
Was this page helpful?
0 / 5 - 0 ratings

Related issues

tonychangcheng picture tonychangcheng  路  29Comments

carlhussey picture carlhussey  路  21Comments

bMil21 picture bMil21  路  16Comments

ShaneJohnsonCC picture ShaneJohnsonCC  路  18Comments

m41n picture m41n  路  18Comments