mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-02-03 02:54:40 +08:00
fix(tinymce): fixed multiple editors showing only one (#83)
This commit is contained in:
parent
bc6214cdf3
commit
1093ec3e6e
@ -1,3 +1,9 @@
|
|||||||
|
## Wip
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- 修复多个富文本编辑器只显示一个
|
||||||
|
|
||||||
## 2.0.0-rc.9 (2020-11-9)
|
## 2.0.0-rc.9 (2020-11-9)
|
||||||
|
|
||||||
### ✨ Features
|
### ✨ Features
|
||||||
|
@ -34,7 +34,6 @@ const dynamicImportTransform = function (env: any = {}): Transform {
|
|||||||
export default function (id) {
|
export default function (id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
${files
|
${files
|
||||||
|
|
||||||
.map((p) =>
|
.map((p) =>
|
||||||
` case '${getPath(p)}': return () => import('${p
|
` case '${getPath(p)}': return () => import('${p
|
||||||
.replace('src/views', '/@/views')
|
.replace('src/views', '/@/views')
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="tinymce-container" :style="{ width: containerWidth }">
|
<div class="tinymce-container" :style="{ width: containerWidth }">
|
||||||
<textarea :id="tinymceId" ref="elRef"></textarea>
|
<textarea :id="tinymceId" ref="elRef" :style="{ visibility: 'hidden' }"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -15,7 +15,6 @@
|
|||||||
watch,
|
watch,
|
||||||
onUnmounted,
|
onUnmounted,
|
||||||
onDeactivated,
|
onDeactivated,
|
||||||
watchEffect,
|
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import { basicProps } from './props';
|
import { basicProps } from './props';
|
||||||
import toolbar from './toolbar';
|
import toolbar from './toolbar';
|
||||||
@ -36,12 +35,9 @@
|
|||||||
emits: ['change', 'update:modelValue'],
|
emits: ['change', 'update:modelValue'],
|
||||||
setup(props, { emit, attrs }) {
|
setup(props, { emit, attrs }) {
|
||||||
const editorRef = ref<any>(null);
|
const editorRef = ref<any>(null);
|
||||||
|
const tinymceId = ref<string>(snowUuid('tiny-vue'));
|
||||||
const elRef = ref<Nullable<HTMLElement>>(null);
|
const elRef = ref<Nullable<HTMLElement>>(null);
|
||||||
|
|
||||||
const tinymceId = computed(() => {
|
|
||||||
return snowUuid('tiny-vue');
|
|
||||||
});
|
|
||||||
|
|
||||||
const tinymceContent = computed(() => {
|
const tinymceContent = computed(() => {
|
||||||
return props.modelValue;
|
return props.modelValue;
|
||||||
});
|
});
|
||||||
@ -118,12 +114,18 @@
|
|||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
toPromise().then(() => {
|
toPromise().then(() => {
|
||||||
initEditor();
|
setTimeout(() => {
|
||||||
|
initEditor();
|
||||||
|
}, 0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initEditor() {
|
function initEditor() {
|
||||||
getTinymce().PluginManager.add('lineHeight', lineHeight(getTinymce()));
|
getTinymce().PluginManager.add('lineHeight', lineHeight(getTinymce()));
|
||||||
|
const el = unref(elRef);
|
||||||
|
if (el) {
|
||||||
|
el.style.visibility = '';
|
||||||
|
}
|
||||||
getTinymce().init(unref(initOptions));
|
getTinymce().init(unref(initOptions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user