diff --git a/frontend/src/components/canvas/customComponent/DeRichText.vue b/frontend/src/components/canvas/customComponent/DeRichText.vue index 195a4bc263..4e5a76ab38 100644 --- a/frontend/src/components/canvas/customComponent/DeRichText.vue +++ b/frontend/src/components/canvas/customComponent/DeRichText.vue @@ -37,7 +37,6 @@ import 'tinymce/plugins/nonbreaking' import 'tinymce/plugins/pagebreak' import { mapState } from 'vuex' import Vue from 'vue' -import xssCheck from 'xss' export default { name: 'DeRichText', @@ -78,7 +77,7 @@ export default { canEdit: false, // 初始化配置 tinymceId: 'tinymce-' + this.element.id, - myValue: xssCheck(this.propValue), + myValue: this.propValue, init: { selector: '#tinymce-' + this.element.id, toolbar_items_size: 'small', diff --git a/frontend/src/components/canvas/customComponent/DeRichTextView.vue b/frontend/src/components/canvas/customComponent/DeRichTextView.vue index fe66736ee2..3baa877b3d 100644 --- a/frontend/src/components/canvas/customComponent/DeRichTextView.vue +++ b/frontend/src/components/canvas/customComponent/DeRichTextView.vue @@ -38,7 +38,6 @@ import 'tinymce/plugins/pagebreak' import { mapState } from 'vuex' import bus from '@/utils/bus' import { uuid } from 'vue-uuid' -import xssCheck from 'xss' export default { name: 'DeRichTextView', @@ -140,6 +139,10 @@ export default { } }, myValue(newValue) { + if (this.canEdit) { + const ed = tinymce.editors[this.tinymceId] + this.element.propValue.textValue = ed.getContent() + } this.initReady && this.$store.commit('canvasChange') } }, @@ -153,7 +156,7 @@ export default { viewInit() { bus.$on('fieldSelect-' + this.element.propValue.viewId, this.fieldSelect) tinymce.init({}) - this.myValue = xssCheck(this.assignment(this.element.propValue.textValue)) + this.myValue = this.assignment(this.element.propValue.textValue) bus.$on('initCurFields-' + this.element.id, this.initCurFieldsChange) this.$nextTick(() => { this.initReady = true diff --git a/frontend/src/components/canvas/utils/utils.js b/frontend/src/components/canvas/utils/utils.js index c39fd6efa2..11b0a94811 100644 --- a/frontend/src/components/canvas/utils/utils.js +++ b/frontend/src/components/canvas/utils/utils.js @@ -10,6 +10,7 @@ import { uuid } from 'vue-uuid' import store from '@/store' import { AIDED_DESIGN, MOBILE_SETTING, PAGE_LINE_DESIGN, PANEL_CHART_INFO, TAB_COMMON_STYLE } from '@/views/panel/panel' import html2canvas from 'html2canvasde' +import xssCheck from 'xss' export function deepCopy(target) { if (typeof target === 'object' && target !== null) { @@ -101,6 +102,9 @@ export function panelDataPrepare(componentData, componentStyle, callback) { componentStyle.chartCommonStyle = deepCopy(COMMON_BACKGROUND) } componentData.forEach((item, index) => { + if (item.component && item.component === 'v-text') { + item.propValue = xssCheck(item.propValue) + } if (item.component && item.component === 'de-date') { const widget = ApplicationContext.getService(item.serviceName) if (item.options.attrs &&