forked from github/dataease
fix: 更新富文本
This commit is contained in:
parent
fb4903e887
commit
106cdf920b
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { formatDataEaseBi } from '@/utils/url'
|
import { formatDataEaseBi } from '@/utils/url'
|
||||||
import tinymce from 'tinymce/tinymce' // tinymce默认hidden,不引入不显示
|
import deTinymce from 'tinymce/tinymce' // tinymce默认hidden,不引入不显示
|
||||||
import Editor from '@tinymce/tinymce-vue' // 编辑器引入
|
import Editor from '@tinymce/tinymce-vue' // 编辑器引入
|
||||||
import 'tinymce/themes/silver/theme' // 编辑器主题
|
import 'tinymce/themes/silver/theme' // 编辑器主题
|
||||||
import 'tinymce/icons/default' // 引入编辑器图标icon,不引入则不显示对应图标
|
import 'tinymce/icons/default' // 引入编辑器图标icon,不引入则不显示对应图标
|
||||||
@ -48,7 +48,7 @@ import 'tinymce/plugins/directionality'
|
|||||||
import 'tinymce/plugins/nonbreaking'
|
import 'tinymce/plugins/nonbreaking'
|
||||||
import 'tinymce/plugins/pagebreak'
|
import 'tinymce/plugins/pagebreak'
|
||||||
import '@npkg/tinymce-plugins/letterspacing'
|
import '@npkg/tinymce-plugins/letterspacing'
|
||||||
import './plugins' //自定义插件
|
import '@/custom-component/rich-text/plugins' //自定义插件
|
||||||
import { computed, nextTick, reactive, ref, toRefs, watch, onMounted, PropType } from 'vue'
|
import { computed, nextTick, reactive, ref, toRefs, watch, onMounted, PropType } from 'vue'
|
||||||
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
|
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
|
||||||
import eventBus from '@/utils/eventBus'
|
import eventBus from '@/utils/eventBus'
|
||||||
@ -153,7 +153,7 @@ watch(
|
|||||||
() => active.value,
|
() => active.value,
|
||||||
val => {
|
val => {
|
||||||
if (!val) {
|
if (!val) {
|
||||||
const ed = tinymce.editors[tinymceId]
|
const ed = deTinymce.editors[tinymceId]
|
||||||
if (canEdit.value) {
|
if (canEdit.value) {
|
||||||
element.value.propValue.textValue = ed.getContent()
|
element.value.propValue.textValue = ed.getContent()
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ watch(
|
|||||||
() => myValue.value,
|
() => myValue.value,
|
||||||
() => {
|
() => {
|
||||||
if (canEdit.value) {
|
if (canEdit.value) {
|
||||||
const ed = tinymce.editors[tinymceId]
|
const ed = deTinymce.editors[tinymceId]
|
||||||
element.value.propValue.textValue = ed.getContent()
|
element.value.propValue.textValue = ed.getContent()
|
||||||
}
|
}
|
||||||
if (initReady.value && canEdit.value) {
|
if (initReady.value && canEdit.value) {
|
||||||
@ -207,7 +207,7 @@ const viewInit = () => {
|
|||||||
fieldSelect(val)
|
fieldSelect(val)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
tinymce.init({})
|
deTinymce.init({})
|
||||||
myValue.value = assignment(element.value.propValue.textValue)
|
myValue.value = assignment(element.value.propValue.textValue)
|
||||||
}
|
}
|
||||||
const initCurFieldsChange = () => {
|
const initCurFieldsChange = () => {
|
||||||
@ -250,7 +250,7 @@ const assignment = content => {
|
|||||||
return content
|
return content
|
||||||
}
|
}
|
||||||
const fieldSelect = field => {
|
const fieldSelect = field => {
|
||||||
const ed = tinymce.editors[tinymceId]
|
const ed = deTinymce.editors[tinymceId]
|
||||||
const fieldId = 'changeText-' + guid()
|
const fieldId = 'changeText-' + guid()
|
||||||
const value =
|
const value =
|
||||||
'<span id="' +
|
'<span id="' +
|
||||||
@ -267,12 +267,12 @@ const fieldSelect = field => {
|
|||||||
}
|
}
|
||||||
const onClick = () => {
|
const onClick = () => {
|
||||||
if (canEdit.value) {
|
if (canEdit.value) {
|
||||||
const node = tinymce.activeEditor.selection.getNode()
|
const node = deTinymce.activeEditor.selection.getNode()
|
||||||
resetSelect(node)
|
resetSelect(node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const resetSelect = (node?) => {
|
const resetSelect = (node?) => {
|
||||||
const edInner = tinymce.get(tinymceId)
|
const edInner = deTinymce.get(tinymceId)
|
||||||
if (edInner?.dom) {
|
if (edInner?.dom) {
|
||||||
const nodeArray = edInner.dom.select('.base-selected')
|
const nodeArray = edInner.dom.select('.base-selected')
|
||||||
if (nodeArray) {
|
if (nodeArray) {
|
||||||
@ -321,7 +321,7 @@ const setEdit = () => {
|
|||||||
canEdit.value = true
|
canEdit.value = true
|
||||||
element.value['editing'] = true
|
element.value['editing'] = true
|
||||||
myValue.value = element.value.propValue.textValue
|
myValue.value = element.value.propValue.textValue
|
||||||
const ed = tinymce.editors[tinymceId]
|
const ed = deTinymce.editors[tinymceId]
|
||||||
ed.setContent(myValue.value)
|
ed.setContent(myValue.value)
|
||||||
reShow()
|
reShow()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user