Skip to content

Commit

Permalink
Improved compatibility w/Hover Editor plugin
Browse files Browse the repository at this point in the history
Ensure that stray popovers are closed even if the mouse is over
them, and that a new popover is opened when a different item is
selected (even if the mouse isn't moved).
  • Loading branch information
pjeby committed Mar 13, 2022
1 parent 97c192f commit 62c0f26
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
11 changes: 8 additions & 3 deletions main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "quick-explorer",
"name": "Quick Explorer",
"version": "0.1.14",
"version": "0.1.15",
"description": "Perform file explorer operations (and see your current file path) from the title bar, using the mouse or keyboard",
"minAppVersion": "0.13.23",
"isDesktopOnly": true
Expand Down
13 changes: 11 additions & 2 deletions src/FolderMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ declare module "obsidian" {
interface HoverPopover {
hide(): void
hoverEl: HTMLDivElement
onHover: boolean
}
interface App {
viewRegistry: {
Expand Down Expand Up @@ -290,7 +291,7 @@ export class FolderMenu extends PopupMenu {
}

hidePopover() {
this.hoverPopover?.hide();
this.hoverPopover = null;
}

canShowPopover() {
Expand Down Expand Up @@ -332,7 +333,15 @@ export class FolderMenu extends PopupMenu {
get hoverPopover() { return this._popover; }

set hoverPopover(popover) {
if (popover && !this.canShowPopover()) { popover.hide(); return; }
if (this._popover && popover !== this._popover) {
this._popover.onHover = false; // Force unpinned Hover Editors to close
this._popover.hide();
}
if (popover && !this.canShowPopover()) {
popover.onHover = false; // Force unpinned Hover Editors to close
popover.hide();
popover = null;
}
this._popover = popover;
if (autoPreview && popover && this.currentItem()) {
// Position the popover so it doesn't overlap the menu horizontally (as long as it fits)
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"0.1.14": "0.13.23",
"0.1.15": "0.13.23",
"0.1.9": "0.12.12",
"0.0.5": "0.12.10",
"0.0.1": "0.12.3"
Expand Down

0 comments on commit 62c0f26

Please sign in to comment.