Fixed #204 - Editor infinite loop with some specific values

pull/213/head
cagataycivici 2020-02-27 11:56:57 +03:00
parent 10b08d12bc
commit 98414b7cec
1 changed files with 18 additions and 15 deletions

View File

@ -76,8 +76,12 @@ export default {
formats: this.formats formats: this.formats
}); });
this.quill.on('text-change', (delta, source) => { this.renderValue(this.value);
this.quill.on('text-change', (delta, oldContents, source) => {
if (source === 'user') {
let html = this.$refs.editorElement.children[0].innerHTML; let html = this.$refs.editorElement.children[0].innerHTML;
let text = this.quill.getText().trim();
if (html === '<p><br></p>') { if (html === '<p><br></p>') {
html = ''; html = '';
} }
@ -85,13 +89,12 @@ export default {
this.$emit('input', html); this.$emit('input', html);
this.$emit('text-change', { this.$emit('text-change', {
htmlValue: html, htmlValue: html,
textValue: this.quill.getText(), textValue: text,
delta: delta, delta: delta,
source: source source: source
}); });
}
}); });
this.renderValue(this.value);
}, },
methods: { methods: {
renderValue(value) { renderValue(value) {