fix: safari 消息输入框焦点溢出的情况

This commit is contained in:
kuaifan 2023-06-09 13:58:43 +08:00
parent a233c492e6
commit ea1c2a34e2

View File

@ -276,6 +276,8 @@ export default {
pasteClean: true,
isSpecVersion: this.checkIOSVersion(),
timer: null,
};
},
mounted() {
@ -710,14 +712,13 @@ export default {
// Mark model as touched if editor lost focus
this.quill.on('selection-change', range => {
if (!range) {
if (!range && document.activeElement) {
//
if (this.quill.hasFocus()) {
this.quill.setSelection(0)
return
}
if (document.activeElement && document.activeElement.className === 'ql-clipboard') {
this.quill.setSelection(this.quill.getLength())
if (['ql-editor', 'ql-clipboard'].includes(document.activeElement.className)) {
this.timer && clearTimeout(this.timer)
this.timer = setTimeout(_ => {
this.quill.setSelection(document.activeElement.className === 'ql-editor' ? 0 : this.quill.getLength())
}, 100)
return
}
}