fix: Tinymce切换菜单会造成disabled失效 https://gitee.com/dapppp/ruoyi-plus-vben5/issues/IAL8BD
This commit is contained in:
parent
9056f6a543
commit
5c569939c6
@ -5,6 +5,7 @@ import type { Editor as EditorType } from 'tinymce/tinymce';
|
||||
import {
|
||||
computed,
|
||||
nextTick,
|
||||
onActivated,
|
||||
onBeforeUnmount,
|
||||
onDeactivated,
|
||||
onMounted,
|
||||
@ -120,9 +121,7 @@ watch(
|
||||
nextTick(() => {
|
||||
init.value = true;
|
||||
setTimeout(() => {
|
||||
// 需要手动设置只读/编辑状态
|
||||
const mode = props.options.readonly ? 'readonly' : 'design';
|
||||
editorRef.value?.mode.set(mode);
|
||||
setEditorMode();
|
||||
});
|
||||
});
|
||||
},
|
||||
@ -220,6 +219,7 @@ onMounted(() => {
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
initEditor();
|
||||
setEditorMode();
|
||||
}, 30);
|
||||
});
|
||||
});
|
||||
@ -232,6 +232,18 @@ onDeactivated(() => {
|
||||
destroy();
|
||||
});
|
||||
|
||||
onActivated(() => {
|
||||
setEditorMode();
|
||||
});
|
||||
|
||||
function setEditorMode() {
|
||||
const editor = unref(editorRef);
|
||||
if (editor) {
|
||||
const mode = props.options.readonly ? 'readonly' : 'design';
|
||||
editor.mode.set(mode);
|
||||
}
|
||||
}
|
||||
|
||||
function destroy() {
|
||||
const editor = unref(editorRef);
|
||||
editor?.destroy();
|
||||
|
Loading…
Reference in New Issue
Block a user