ngx-quill-editor icon indicating copy to clipboard operation
ngx-quill-editor copied to clipboard

Changing options.readOnly doesn't enable/disable quill

Open damianaiamad opened this issue 7 years ago • 1 comments
trafficstars

The problem is here:

 ngOnChanges(changes: SimpleChanges) {
    if (changes['readOnly'] && this.quillEditor) {
      this.quillEditor.enable(!changes['readOnly'].currentValue);
    }
  }

This solution works for me:

  ngOnChanges(changes: SimpleChanges) {
    if (!changes.options || changes.options.firstChange || !this.quillEditor)
      return

    this.quillEditor.enable(!changes.options.currentValue.readOnly);
  }

damianaiamad avatar Jul 02 '18 07:07 damianaiamad

it might be safer to directly use quill's isEnabled function here to check, not sure how tightly aligned the readOnly value is with the enabled/disabled state

padraigfl avatar Mar 04 '20 11:03 padraigfl