[英]Enable / disable Quill on demand
I'm using quill to make myDiv editable like this: 我正在使用鹅毛笔使myDiv可编辑,如下所示:
var myQuill = new Quill(myDiv, {
modules: {
toolbar: {
container: myToolbar
}
},
styles: false,
theme: 'snow'
});
I also want Quill to become active or not active (the user cannot edit contents anymore) on demand (eg by pressing a button). 我还希望按需(例如,通过按下按钮)激活或不激活Quill(用户无法再编辑内容)。
Is there something like myQuill.disable()
or myQuill.enable()
? 是否有类似
myQuill.disable()
或myQuill.enable()
?
I didn't see a Quill command for that, but you could use this to disable it : 我没有看到一个Quill命令,但是您可以使用它来禁用它:
$("#DIV_ID .ql-editor").attr('contenteditable', false);
where DIV_ID
is your element id chosen when initializing Quill. 其中
DIV_ID
是初始化Quill时选择的元素ID。
For all editors, use the following : 对于所有编辑器,请使用以下命令:
$(".ql-editor").attr('contenteditable', false);
Change false
to true
to enable back. 将
false
更改为true
以启用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.