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 {
|
import {
|
||||||
computed,
|
computed,
|
||||||
nextTick,
|
nextTick,
|
||||||
|
onActivated,
|
||||||
onBeforeUnmount,
|
onBeforeUnmount,
|
||||||
onDeactivated,
|
onDeactivated,
|
||||||
onMounted,
|
onMounted,
|
||||||
@ -120,9 +121,7 @@ watch(
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
init.value = true;
|
init.value = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// 需要手动设置只读/编辑状态
|
setEditorMode();
|
||||||
const mode = props.options.readonly ? 'readonly' : 'design';
|
|
||||||
editorRef.value?.mode.set(mode);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -220,6 +219,7 @@ onMounted(() => {
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
initEditor();
|
initEditor();
|
||||||
|
setEditorMode();
|
||||||
}, 30);
|
}, 30);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -232,6 +232,18 @@ onDeactivated(() => {
|
|||||||
destroy();
|
destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onActivated(() => {
|
||||||
|
setEditorMode();
|
||||||
|
});
|
||||||
|
|
||||||
|
function setEditorMode() {
|
||||||
|
const editor = unref(editorRef);
|
||||||
|
if (editor) {
|
||||||
|
const mode = props.options.readonly ? 'readonly' : 'design';
|
||||||
|
editor.mode.set(mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function destroy() {
|
function destroy() {
|
||||||
const editor = unref(editorRef);
|
const editor = unref(editorRef);
|
||||||
editor?.destroy();
|
editor?.destroy();
|
||||||
|
Loading…
Reference in New Issue
Block a user