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,22 +76,25 @@ export default {
formats: this.formats
});
this.quill.on('text-change', (delta, source) => {
let html = this.$refs.editorElement.children[0].innerHTML;
if (html === '<p><br></p>') {
html = '';
}
this.$emit('input', html);
this.$emit('text-change', {
htmlValue: html,
textValue: this.quill.getText(),
delta: delta,
source: 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 text = this.quill.getText().trim();
if (html === '<p><br></p>') {
html = '';
}
this.$emit('input', html);
this.$emit('text-change', {
htmlValue: html,
textValue: text,
delta: delta,
source: source
});
}
});
},
methods: {
renderValue(value) {