如果我们可以使用禁用属性来禁用 primeNG 编辑器框,那就太好了,类似于 textarea 的功能:
<textarea rows="3" cols="10" disabled="disabled">
This textarea is grayed out and disabled for interaction.
</textarea>
Run Code Online (Sandbox Code Playgroud)
但遗憾的是这不起作用。您知道如何使用 p-editor(primeNG 编辑器)执行此操作吗?
p-editor在后台使用 quill 编辑器,您可以使用以下disable()方法: http: //beta.quilljs.com/docs/api/#disable
quill您可以通过以下方式从组件获取对编辑器的引用:
@ViewChild(Editor)
editor:Editor; // "Editor" is the prime-ng class definition
Run Code Online (Sandbox Code Playgroud)
并创建一个如下方法:
myMethod() {
this.editor.quill.disable();
}
Run Code Online (Sandbox Code Playgroud)