diff --git a/nezha-fronted/src/components/chart/chartHeader.vue b/nezha-fronted/src/components/chart/chartHeader.vue index 9f583d324..6051ff878 100644 --- a/nezha-fronted/src/components/chart/chartHeader.vue +++ b/nezha-fronted/src/components/chart/chartHeader.vue @@ -28,7 +28,7 @@
{{chartInfo.name}}
- + {{chartInfo.name}}
diff --git a/nezha-fronted/src/components/charts/richTextEditor.vue b/nezha-fronted/src/components/charts/richTextEditor.vue index 60f60bc01..041ea332b 100644 --- a/nezha-fronted/src/components/charts/richTextEditor.vue +++ b/nezha-fronted/src/components/charts/richTextEditor.vue @@ -59,10 +59,11 @@ export default { $self.maxLength = $self.quill.getText().length $self.tooLong = false } + $self.$emit('textChange', $self.quill.root.innerHTML) }) this.$nextTick(() => { this.$emit('after-init') - this.$emit('textChange') + // this.$emit('textChange') }) } }, @@ -84,19 +85,11 @@ export default { return (S4() + S4() + '-' + S4() + '-' + S4() + '-' + S4() + '-' + S4() + S4() + S4()) } }, - watch: { - editData: { - immediate: true, - handler (n, o) { - this.$nextTick(() => { - this.initEditor() - this.quill.clipboard.dangerouslyPasteHTML(null, this.editData, 'api') - }) - } - } - }, mounted () { this.initEditor() + if (this.editData) { + this.quill.clipboard.dangerouslyPasteHTML(null, this.editData, 'api') + } }, beforeDestroy () { this.quill.off('selection-change') diff --git a/nezha-fronted/src/components/common/rightBox/chart/otherChartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/otherChartConfig.vue index 41cf2b946..2d09b51a9 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/otherChartConfig.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/otherChartConfig.vue @@ -139,11 +139,12 @@ export default { richTextEditor }, watch: { - 'chartConfig.param.text': { - handler (n) { - this.change() - } - } + // 'chartConfig.param.text': { + // handler (n) { + // console.log(n) + // this.change() + // } + // } }, data () { return { @@ -218,8 +219,10 @@ export default { this.change() } }, - textChange () { - this.chartConfig.param.text = this.$refs.richTextEditor.getContent() + textChange (val) { + const html = `
${val}
` + this.chartConfig.param.text = html + this.change() } }, created () {