mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-15 05:12:49 +00:00
perf: 优化输入空换行时的兼容问题
This commit is contained in:
parent
f411f17386
commit
fa9c3b4f2f
@ -405,11 +405,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
editorStyle() {
|
editorStyle() {
|
||||||
const {wrapperWidth, editorHeight, value} = this;
|
const {wrapperWidth, editorHeight} = this;
|
||||||
const style = {};
|
const style = {};
|
||||||
if (value.length < 10) {
|
|
||||||
style.height = '30px';
|
|
||||||
}
|
|
||||||
if (wrapperWidth > 0
|
if (wrapperWidth > 0
|
||||||
&& editorHeight > 0
|
&& editorHeight > 0
|
||||||
&& (wrapperWidth < 280 || editorHeight > 40)) {
|
&& (wrapperWidth < 280 || editorHeight > 40)) {
|
||||||
@ -515,7 +512,7 @@ export default {
|
|||||||
this.quill.setText('')
|
this.quill.setText('')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.$store.dispatch("saveDialogDraft", {id: this.dialogId, extra_draft_content: val})
|
this.$store.dispatch("saveDialogDraft", {id: this.dialogId, extra_draft_content: this.filterInvalidLine(val)})
|
||||||
},
|
},
|
||||||
|
|
||||||
// Watch disabled change
|
// Watch disabled change
|
||||||
@ -752,8 +749,6 @@ export default {
|
|||||||
this.quill.deleteText(this.maxlength, this.quill.getLength());
|
this.quill.deleteText(this.maxlength, this.quill.getLength());
|
||||||
}
|
}
|
||||||
let html = this.$refs.editor.firstChild.innerHTML
|
let html = this.$refs.editor.firstChild.innerHTML
|
||||||
html = html.replace(/^(<p>\s*<\/p>)+|(<p>\s*<\/p>)+$/gi, '')
|
|
||||||
html = html.replace(/^(<p><br\/*><\/p>)+|(<p><br\/*><\/p>)+$/gi, '')
|
|
||||||
this.updateEmojiQuick(html)
|
this.updateEmojiQuick(html)
|
||||||
this._content = html
|
this._content = html
|
||||||
this.$emit('input', this._content)
|
this.$emit('input', this._content)
|
||||||
@ -1071,6 +1066,9 @@ export default {
|
|||||||
|
|
||||||
onSend(type) {
|
onSend(type) {
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
|
if (this.filterInvalidLine(this.value) === '') {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.hidePopover('send')
|
this.hidePopover('send')
|
||||||
this.rangeIndex = 0
|
this.rangeIndex = 0
|
||||||
this.clearSearchKey()
|
this.clearSearchKey()
|
||||||
@ -1659,6 +1657,11 @@ export default {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
|
|
||||||
|
filterInvalidLine(content) {
|
||||||
|
let value = (content + '').replace(/^(<p>\s*<\/p>)+|(<p>\s*<\/p>)+$/gi, '')
|
||||||
|
return value.replace(/^(<p><br\/*><\/p>)+|(<p><br\/*><\/p>)+$/gi, '')
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user