|
@@ -9,7 +9,8 @@ const props = defineProps({
|
9
|
9
|
modelValue: {
|
10
|
10
|
type: String,
|
11
|
11
|
default: '',
|
12
|
|
- }
|
|
12
|
+ },
|
|
13
|
+ disabled: Boolean,
|
13
|
14
|
})
|
14
|
15
|
|
15
|
16
|
const emit = defineEmits(['update:modelValue', 'save'])
|
|
@@ -22,16 +23,24 @@ watch(() => props.modelValue, (newVal) => {
|
22
|
23
|
}
|
23
|
24
|
}, { immediate: true })
|
24
|
25
|
|
|
26
|
+watch(() => props.disabled, (newVal) => {
|
|
27
|
+ if (!editorRef.value) return;
|
|
28
|
+ const mode = newVal ? 'readonly' : 'design'
|
|
29
|
+ editorRef.value.mode.set(mode);
|
|
30
|
+ console.log('-----editorRef.value.mode------?', editorRef.value.mode)
|
|
31
|
+})
|
|
32
|
+
|
25
|
33
|
onMounted(() => {
|
26
|
34
|
window.tinymce.init({
|
27
|
35
|
selector: '#noteEditor',
|
28
|
36
|
plugins: 'save',
|
29
|
37
|
menubar: false,
|
30
|
|
- language: 'zh_CN',
|
|
38
|
+ readonly: props.disabled,
|
|
39
|
+ language: 'zh-Hans',
|
31
|
40
|
plugins: ['image', 'save'],
|
32
|
41
|
image_description: false, // 禁用图片描述
|
33
|
42
|
image_dimensions: false, // 禁用图片宽高设置
|
34
|
|
- toolbar: 'blocks fontfamily fontsize bold italic backcolor alignleft aligncenter alignright alignjustify image outdent indent undo redo removeformat',
|
|
43
|
+ toolbar: 'save | blocks fontfamily fontsize | bold italic | forecolor backcolor | alignleft aligncenter alignright alignjustify | outdent indent | undo redo | removeformat',
|
35
|
44
|
setup: (editor) => {
|
36
|
45
|
if (props.modelValue) {
|
37
|
46
|
editor.setContent(props.modelValue)
|