From e272308b0c39cbe9de8eef9627e3e209b0a1e97f Mon Sep 17 00:00:00 2001 From: danshihao Date: Thu, 19 Sep 2024 09:26:57 +0800 Subject: [PATCH] =?UTF-8?q?[update=2089966]=20=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=EF=BC=9A=E8=A7=A3=E5=86=B3=E7=81=AB=E7=8B=90?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E6=A0=BC=E5=BC=8F=E5=88=B7=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/uEditor/UEditor.vue | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/uEditor/UEditor.vue b/src/components/uEditor/UEditor.vue index 2d57af4..7cb6171 100644 --- a/src/components/uEditor/UEditor.vue +++ b/src/components/uEditor/UEditor.vue @@ -38,13 +38,12 @@ export default { }, // 解决火狐浏览器失去焦点后,下次获取焦点,会保留上次光标位置导致格式刷异常 editorBlur (e) { - // e.preventDefault() - e.target.blur() - this.$refs.editorBoxRef.querySelector('iframe').contentDocument.body.blur() - setTimeout(() => { - this.$refs.editorBoxRef.querySelector('iframe').contentDocument.body.blur() - this.$refs.editorBoxRef.querySelector('iframe').contentDocument.body.focus() - }, 100) + this.$nextTick(() => { + setTimeout(() => { + UE.getEditor(this.id).body.blur() + UE.getEditor(this.id).body.focus() + }, 1) + }) } }, props: { @@ -110,7 +109,7 @@ export default { }) }, beforeDestroy () { - UE.getEditor(this.id).removeEventListener('blur', this.editorBlur) + UE.getEditor(this.id).body.removeEventListener('blur', this.editorBlur) }, destoryed () { this.editor.destory()