close #1825 Fixed: Unable to edit email templates
This commit is contained in:
parent
26cf1f4b70
commit
37cd1a9205
@ -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('<p><br></p>', 'g'), '<p> </p>');
|
||||
if (this.editorValue.length > 0) {
|
||||
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;
|
||||
@ -89,9 +90,9 @@ export default {
|
||||
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() {
|
||||
@ -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);
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user