ozntel / file-tree-alternative

This Obsidian Plugin allows users to have a different file explorer experience.
437 stars 31 forks source link

External API #174

Closed NomarCub closed 11 months ago

NomarCub commented 11 months ago

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

ozntel commented 11 months ago

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);