Skip to content

Commit

Permalink
fix: 纯预览模式下不提供表格所见即所得编辑能力 close #513
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsonliu committed Jul 26, 2023
1 parent 7a4d5d2 commit edbd0fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/toolbars/PreviewerBubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}

Expand Down
4 changes: 2 additions & 2 deletions src/toolbars/hooks/SwitchModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit edbd0fe

Please sign in to comment.