diff --git a/resources/assets/js/components/AkauntingHtmlEditor.vue b/resources/assets/js/components/AkauntingHtmlEditor.vue index 95bf0af08..98bbe9c66 100644 --- a/resources/assets/js/components/AkauntingHtmlEditor.vue +++ b/resources/assets/js/components/AkauntingHtmlEditor.vue @@ -42,6 +42,7 @@ export default { data () { return { editor: null, + editorValue: this.value, content: null, lastHtmlValue: '', editorId: null, @@ -60,10 +61,10 @@ export default { } }); - if (this.value.length > 0) { - this.value = this.value.replace(new RegExp('


', 'g'), '

 

'); + if (this.editorValue.length > 0) { + this.editorValue = this.editorValue.replace(new RegExp('


', 'g'), '

 

'); - this.editor.pasteHTML(this.value); + this.editor.pasteHTML(this.editorValue); } let editorRef = this.$refs.editor; @@ -89,9 +90,9 @@ export default { return; } - this.value = this.value.replace(new RegExp('


', 'g'), '

 

'); + this.editorValue = this.editorValue.replace(new RegExp('


', 'g'), '

 

'); - this.editor.pasteHTML(this.value); + this.editor.pasteHTML(this.editorValue); }, randomString() { @@ -107,7 +108,7 @@ export default { }, async mounted () { - this.content = this.value; + this.content = this.editorValue; this.editorId = this.randomString(); this.toolbarId = this.randomString(); @@ -124,6 +125,12 @@ export default { } }, + editorValue (newVal) { + if (newVal !== this.content) { + this.pasteHTML(newVal); + } + }, + content (newVal) { this.$emit('input', newVal); },