Skip to content

Commit 1093ec3

Browse files
committed
fix(tinymce): fixed multiple editors showing only one (#83)
1 parent bc6214c commit 1093ec3

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

CHANGELOG.zh_CN.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Wip
2+
3+
### 🐛 Bug Fixes
4+
5+
- 修复多个富文本编辑器只显示一个
6+
17
## 2.0.0-rc.9 (2020-11-9)
28

39
### ✨ Features

build/vite/plugin/dynamicImport/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const dynamicImportTransform = function (env: any = {}): Transform {
3434
export default function (id) {
3535
switch (id) {
3636
${files
37-
3837
.map((p) =>
3938
` case '${getPath(p)}': return () => import('${p
4039
.replace('src/views', '/@/views')

src/components/Tinymce/src/Editor.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="tinymce-container" :style="{ width: containerWidth }">
3-
<textarea :id="tinymceId" ref="elRef"></textarea>
3+
<textarea :id="tinymceId" ref="elRef" :style="{ visibility: 'hidden' }"></textarea>
44
</div>
55
</template>
66

@@ -15,7 +15,6 @@
1515
watch,
1616
onUnmounted,
1717
onDeactivated,
18-
watchEffect,
1918
} from 'vue';
2019
import { basicProps } from './props';
2120
import toolbar from './toolbar';
@@ -36,12 +35,9 @@
3635
emits: ['change', 'update:modelValue'],
3736
setup(props, { emit, attrs }) {
3837
const editorRef = ref<any>(null);
38+
const tinymceId = ref<string>(snowUuid('tiny-vue'));
3939
const elRef = ref<Nullable<HTMLElement>>(null);
4040
41-
const tinymceId = computed(() => {
42-
return snowUuid('tiny-vue');
43-
});
44-
4541
const tinymceContent = computed(() => {
4642
return props.modelValue;
4743
});
@@ -118,12 +114,18 @@
118114
119115
function init() {
120116
toPromise().then(() => {
121-
initEditor();
117+
setTimeout(() => {
118+
initEditor();
119+
}, 0);
122120
});
123121
}
124122
125123
function initEditor() {
126124
getTinymce().PluginManager.add('lineHeight', lineHeight(getTinymce()));
125+
const el = unref(elRef);
126+
if (el) {
127+
el.style.visibility = '';
128+
}
127129
getTinymce().init(unref(initOptions));
128130
}
129131

0 commit comments

Comments
 (0)