6

It would be great if we could disabled the primeNG editor box with the disabled attribute, similar to what's available with a textarea :

<textarea rows="3" cols="10" disabled="disabled">
This textarea is grayed out and disabled for interaction.
</textarea>

But sadly that don't work. Do you have an idea on how can I do this with p-editor (the primeNG editor)?

Naella
  • 425
  • 2
  • 6
  • 17

3 Answers3

2

p-editor is using quill editor under the hood, you can use the disable() method: http://beta.quilljs.com/docs/api/#disable

You can get the reference to quill editor from the component with:

@ViewChild(Editor)
editor:Editor; // "Editor" is the prime-ng class definition

And create a method like:

myMethod() {
    this.editor.quill.disable();
}
Sergio
  • 3,317
  • 5
  • 32
  • 51
2

I know the OP has asked for disabled, but if anyone is looking for readonly the editor acceptes [readonly] attribute.

eg:

<p-editor formControlName="desctiption" [style]="{'height':'120px'}" [readonly]="disable"></p-editor>
Happy Coder
  • 4,255
  • 13
  • 75
  • 152
2

you can use [readonly] attribute of p-editor and force it by true . example:

 <p-editor formControlName="desctiption" [style]="{'height':'120px'}"
 [readonly]="true"></p-editor>