Skip to content

Commit

Permalink
Hoverlink support for sidepane
Browse files Browse the repository at this point in the history
  • Loading branch information
TfTHacker committed May 22, 2022
1 parent 7411c3c commit 7d36fa7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
16 changes: 13 additions & 3 deletions src/sidepane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ export class SidePaneView extends ItemView {
document.querySelectorAll('.snw-sidepane-link').forEach(el => {
el.addEventListener('click', (e: PointerEvent) => {
e.preventDefault();
console.log("click",e)
const target = e.target as HTMLElement;
const filePath = target.getAttribute("data-href");
const LineNu = Number(target.getAttribute("data-line-number"));
Expand All @@ -141,9 +140,20 @@ export class SidePaneView extends ItemView {
this.thePlugin.app.workspace.activeLeaf.view.setEphemeralState({line: LineNu })
}, 500);
}
})
});
el.addEventListener('mouseover', (e: PointerEvent) => {
const target = e.target as HTMLElement;
const filePath = target.getAttribute("data-href");
app.workspace.trigger("hover-link", {
event: e,
source: 'source',
hoverParent: document.querySelector(".markdown-preview-view"),
targetEl: null,
linktext: filePath,
});
});
});
}, 200);
}, 500);

}

Expand Down
1 change: 0 additions & 1 deletion todo.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

Enable hover view on links

Shift+click will open link in new pane

file rename causes error

0 comments on commit 7d36fa7

Please sign in to comment.