[update 89966] 富文本组件:解决火狐浏览器格式刷异常

This commit is contained in:
danshihao
2024-09-19 09:26:57 +08:00
parent 4b063ce99b
commit e272308b0c
+7 -8
View File
@@ -38,13 +38,12 @@ export default {
}, },
// 解决火狐浏览器失去焦点后,下次获取焦点,会保留上次光标位置导致格式刷异常 // 解决火狐浏览器失去焦点后,下次获取焦点,会保留上次光标位置导致格式刷异常
editorBlur (e) { editorBlur (e) {
// e.preventDefault() this.$nextTick(() => {
e.target.blur() setTimeout(() => {
this.$refs.editorBoxRef.querySelector('iframe').contentDocument.body.blur() UE.getEditor(this.id).body.blur()
setTimeout(() => { UE.getEditor(this.id).body.focus()
this.$refs.editorBoxRef.querySelector('iframe').contentDocument.body.blur() }, 1)
this.$refs.editorBoxRef.querySelector('iframe').contentDocument.body.focus() })
}, 100)
} }
}, },
props: { props: {
@@ -110,7 +109,7 @@ export default {
}) })
}, },
beforeDestroy () { beforeDestroy () {
UE.getEditor(this.id).removeEventListener('blur', this.editorBlur) UE.getEditor(this.id).body.removeEventListener('blur', this.editorBlur)
}, },
destoryed () { destoryed () {
this.editor.destory() this.editor.destory()