From bcf163f176ff2dd21c803c5ac610ac227bd422b8 Mon Sep 17 00:00:00 2001
From: wangjiahao <1522128093@qq.com>
Date: Mon, 22 Aug 2022 21:47:36 +0800
Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?=
=?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E8=A7=86=E5=9B=BE=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=95=B4=E4=BD=93=E8=AE=BE=E7=BD=AE=E6=A0=B7?=
=?UTF-8?q?=E5=BC=8F=E6=95=B4=E4=BD=93=E5=88=A0=E9=99=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../custom-component/DeRichTextView.vue | 20 +++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/frontend/src/components/canvas/custom-component/DeRichTextView.vue b/frontend/src/components/canvas/custom-component/DeRichTextView.vue
index bff97e2b8b..a9694dcc87 100644
--- a/frontend/src/components/canvas/custom-component/DeRichTextView.vue
+++ b/frontend/src/components/canvas/custom-component/DeRichTextView.vue
@@ -33,6 +33,8 @@ import 'tinymce/plugins/nonbreaking'
import 'tinymce/plugins/pagebreak'
import { mapState } from 'vuex'
import bus from '@/utils/bus'
+import { uuid } from 'vue-uuid'
+
export default {
name: 'DeRichTextView',
components: {
@@ -146,17 +148,27 @@ export default {
if (on) {
on.forEach(itm => {
const ele = itm.slice(1, -1)
- content = content.replace(itm, _this.dataRowNameSelect[ele] ? _this.dataRowNameSelect[ele] : '[字段已经删除]')
+ content = content.replace(itm, _this.dataRowNameSelect[ele] ? _this.dataRowNameSelect[ele] : '[无法获取字段值]')
})
}
return content
},
fieldSelect(field) {
- const value = '[' + field.name + ']'
- tinymce.editors['tinymce-view-' + this.element.id].insertContent(value)
+ const ed = tinymce.editors[this.tinymceId]
+ const fieldId = 'changeText-'+uuid.v1()
+ const value = '[' + field.name + ']'
+ const attachValue = ' '
+ ed.insertContent(value)
+ ed.insertContent(attachValue)
},
onClick(e) {
- this.$emit('onClick', e, tinymce)
+ const edInner = tinymce.get(this.tinymceId);
+ const node = tinymce.activeEditor.selection.getNode()
+ const pNode = node.parentElement
+ if(pNode && pNode.id&& pNode.id.indexOf('changeText')>-1){
+ const innerId = '#'+pNode.id
+ edInner.selection.select(edInner.dom.select(innerId)[0])
+ }
},
setEdit() {
if (this.editStatus) {