14

I have a a template which displays rich text data. When the user clicks edit I turn the template into an editable Quill editor like so:

  'click #editNote': (e, t) ->
    note = t.find '.container'
    console.log note
    basicEditor = new Quill(note)

Then once the user clicks save I want to be able to disable the Quill editor. How can I do this?

Nearpoint
  • 7,202
  • 13
  • 46
  • 74

7 Answers7

15

quill.disable() should do the trick.

Radonirina Maminiaina
  • 6,958
  • 4
  • 33
  • 60
Shivanshu Goyal
  • 1,374
  • 2
  • 16
  • 22
14

This isn't currently documented but you can do this:

basicEditor.editor.enable(false)
jhchen
  • 14,355
  • 14
  • 63
  • 91
  • 1
    Still works on quilljs.com (the editor variable on the homepage is `quill` not `basicEditor`) – jhchen Aug 20 '15 at 20:20
  • 2
    @jhchen - enable(false) is making the editor.selection.getRange(); to return null. I wanted to have a readonly version of my text with highlighting enabled. I'm using quill 0.20.1 – Rose Sep 07 '16 at 23:51
8

Use this statement

var quill = new Quill('#editor-container');
quill.enable(false);
Nikhil Kumar
  • 173
  • 1
  • 7
3

Just set the property [readOnly]="true"

Example:

<quill-editor format="html" [readOnly]="true" formControlName="editor"></quill-editor>

2

If you are using ngx-quill, use this code:

@ViewChild('quill') quill: QuillEditorComponent;

this.quill.setDisabledState(true);

Work for me

0

You can use this:


let quill = new Quill('#myDiv');
quill.disable();   

kentuckyss
  • 101
  • 1
  • 10
-3

Getting quill undefined, we need to import ngx-quill in component.