Skip to content

Commit

Permalink
add restorePopover
Browse files Browse the repository at this point in the history
  • Loading branch information
wish5115 committed Jun 23, 2024
1 parent 7a5bb25 commit 5f55825
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ module.exports = class extends Plugin {
app.setting.activeTab.navEl.scrollIntoView({ behavior: 'smooth', block: 'center' });
}

// popover标题点击和拖动事件
// popover标题点击事件
lastPopover.titleEl.addEventListener('click', () => {
this.activePopover(leaf, lastPopover);
});
Expand All @@ -342,7 +342,10 @@ module.exports = class extends Plugin {
});
} else {
//激活弹窗
if(this.popoverLeaf && this.popover) this.activePopover(this.popoverLeaf, this.popover);
if(this.popoverLeaf && this.popover) {
this.activePopover(this.popoverLeaf, this.popover);
this.restorePopover(this.popover);
}
}
}

Expand All @@ -363,6 +366,7 @@ module.exports = class extends Plugin {
}
//document.body.classList.remove("with-plugin-market-hide");
this.activePopover(this.lastMarketPopoverLeaf, this.lastMarketPopover);
this.restorePopover(this.lastMarketPopover);
return;
}
// 创建leaf和视图
Expand Down Expand Up @@ -479,6 +483,14 @@ module.exports = class extends Plugin {
await sleep(100);
this.isActivating = false;
}

// 恢复popover窗口
restorePopover(popover) {
if(!popover) return;
if(popover.hoverEl?.classList.contains("is-minimized")) {
popover.toggleMinimized();
}
}
}

///////////////////////////////// 悬浮设置面板 ///////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "floating-settings",
"name": "Floating Settings",
"version": "0.0.1",
"version": "0.0.11",
"minAppVersion": "1.5.8",
"description": "Open the Floating Settings panel or replace the default settings modal with a floating panel. Depends on the Hover Editor.",
"author": "Wilson",
Expand Down

0 comments on commit 5f55825

Please sign in to comment.