|
@@ -110,6 +110,35 @@
|
|
|
editorRef.value = editor; // 记录 editor 实例,重要!
|
|
|
};
|
|
|
|
|
|
+ // 清空编辑器内容
|
|
|
+ const clear = () => {
|
|
|
+ const editor = editorRef.value;
|
|
|
+ if (editor == null) return;
|
|
|
+ editor.clear()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 取消禁用,取消只读
|
|
|
+ const enable = () => {
|
|
|
+ const editor = editorRef.value;
|
|
|
+ if (editor == null) return;
|
|
|
+ editor.enable()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 禁用编辑器,设置为只读
|
|
|
+ const disable = () => {
|
|
|
+ const editor = editorRef.value;
|
|
|
+ if (editor == null) return;
|
|
|
+ editor.disable()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 强制更新视图
|
|
|
+ const updateView = () => {
|
|
|
+ const editor = editorRef.value;
|
|
|
+ if (editor == null) return;
|
|
|
+ editor.updateView()
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
return {
|
|
|
editorRef,
|
|
|
valueHtml,
|
|
@@ -117,6 +146,10 @@
|
|
|
toolbarConfig,
|
|
|
editorConfig,
|
|
|
handleCreated,
|
|
|
+ clear,
|
|
|
+ enable,
|
|
|
+ disable,
|
|
|
+ updateView
|
|
|
};
|
|
|
},
|
|
|
};
|