ozntel/file-tree-alternative

External API

Closed this issue · 1 comments

I want to make context menu using this plugin's features: NomarCub/obsidian-copy-url-in-preview#29
How would I go about it?

ozntel commented

Not sure if I understood correctly but if you want to dispatch a reveal active file event from the Context menu you have from the plugin:

let fileToReveal = app.vault.getAbstractFileByPath(ANYFILEPATH); // or you don't need it if you already have TFile or TAbstractFile variable
let revealFileEvent = new CustomEvent({
    'fta-reveal-file',
    detail: {
        file: fileToReveal,
    },
});
window.dispatchEvent(revealFileEvent);