Skip to content

Opening a hover editor from my own plugin #279

Answered by pjeby
dcoales asked this question in Q&A
Discussion options

You must be logged in to vote

Have a look at Quick Explorer: https://github.com/pjeby/quick-explorer/blob/master/src/FolderMenu.ts#L345

Basically, you fire an event with the right link and a hoverParent (second arg to trigger) that's an Obsidian HoverParent (i.e. has a hoverPopover property). The object's hoverPopover property will be set to the popover object and you can then call popover.togglePin?.(true); to pin it and leave it open (assuming hover editor is installed, otherwise you'll just get a hover preview at the targeted location). Something like:

const parent = {
    set hoverPopover(popover) {
        if (!popover) return    // it can be null!
        popover.togglePin?.(true);  // pin the popover
        //…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dcoales
Comment options

Answer selected by dcoales
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants