From edbd0fe4f13e06b5a2dd7d33f0086ed9a573fd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sunsonliu=28=E5=88=98=E9=98=B3=29?= Date: Wed, 26 Jul 2023 19:04:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BA=AF=E9=A2=84=E8=A7=88=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E4=B8=8D=E6=8F=90=E4=BE=9B=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E6=89=80=E8=A7=81=E5=8D=B3=E6=89=80=E5=BE=97=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=83=BD=E5=8A=9B=20close=20#513?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/toolbars/PreviewerBubble.js | 10 ++++++++++ src/toolbars/hooks/SwitchModel.js | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/toolbars/PreviewerBubble.js b/src/toolbars/PreviewerBubble.js index 1d36005f..4cdc2dc3 100644 --- a/src/toolbars/PreviewerBubble.js +++ b/src/toolbars/PreviewerBubble.js @@ -112,6 +112,11 @@ export default class PreviewerBubble { if (!this.enablePreviewerBubble) { return; } + const cherryStatus = this.previewer.$cherry.getStatus(); + // 左侧编辑器被隐藏时不再提供后续功能 + if (cherryStatus.editor === 'hide') { + return; + } const { target } = e; if (typeof target.tagName === 'undefined') { return; @@ -133,6 +138,11 @@ export default class PreviewerBubble { if (!this.enablePreviewerBubble) { return; } + const cherryStatus = this.previewer.$cherry.getStatus(); + // 左侧编辑器被隐藏时不再提供后续功能 + if (cherryStatus.editor === 'hide') { + return; + } this.removeHoverBubble(); } diff --git a/src/toolbars/hooks/SwitchModel.js b/src/toolbars/hooks/SwitchModel.js index 7f34d87b..72c573de 100644 --- a/src/toolbars/hooks/SwitchModel.js +++ b/src/toolbars/hooks/SwitchModel.js @@ -43,13 +43,13 @@ export default class SwitchModel extends MenuBase { if (this.editor.previewer.isPreviewerHidden()) { // 从编辑模式切换到预览模式 this.editor.previewer.previewOnly(); - const toolbar = this.dom.parentElement; + const toolbar = this.dom.parentElement.parentElement; toolbar.classList.add('preview-only'); this.dom.textContent = this.locale.switchEdit; } else { // 从预览模式切换到编辑模式 this.editor.previewer.editOnly(true); - const toolbar = this.dom.parentElement; + const toolbar = this.dom.parentElement.parentElement; toolbar.classList.remove('preview-only'); this.dom.textContent = this.locale.switchPreview; }