close #1825 Fixed: Unable to edit email templates
This commit is contained in:
parent
26cf1f4b70
commit
37cd1a9205
@ -42,6 +42,7 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
editor: null,
|
editor: null,
|
||||||
|
editorValue: this.value,
|
||||||
content: null,
|
content: null,
|
||||||
lastHtmlValue: '',
|
lastHtmlValue: '',
|
||||||
editorId: null,
|
editorId: null,
|
||||||
@ -60,10 +61,10 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.value.length > 0) {
|
if (this.editorValue.length > 0) {
|
||||||
this.value = this.value.replace(new RegExp('<p><br></p>', 'g'), '<p> </p>');
|
this.editorValue = this.editorValue.replace(new RegExp('<p><br></p>', 'g'), '<p> </p>');
|
||||||
|
|
||||||
this.editor.pasteHTML(this.value);
|
this.editor.pasteHTML(this.editorValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
let editorRef = this.$refs.editor;
|
let editorRef = this.$refs.editor;
|
||||||
@ -89,9 +90,9 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.value = this.value.replace(new RegExp('<p><br></p>', 'g'), '<p> </p>');
|
this.editorValue = this.editorValue.replace(new RegExp('<p><br></p>', 'g'), '<p> </p>');
|
||||||
|
|
||||||
this.editor.pasteHTML(this.value);
|
this.editor.pasteHTML(this.editorValue);
|
||||||
},
|
},
|
||||||
|
|
||||||
randomString() {
|
randomString() {
|
||||||
@ -107,7 +108,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async mounted () {
|
async mounted () {
|
||||||
this.content = this.value;
|
this.content = this.editorValue;
|
||||||
|
|
||||||
this.editorId = this.randomString();
|
this.editorId = this.randomString();
|
||||||
this.toolbarId = this.randomString();
|
this.toolbarId = this.randomString();
|
||||||
@ -124,6 +125,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
editorValue (newVal) {
|
||||||
|
if (newVal !== this.content) {
|
||||||
|
this.pasteHTML(newVal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
content (newVal) {
|
content (newVal) {
|
||||||
this.$emit('input', newVal);
|
this.$emit('input', newVal);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user