Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add overrideFile to avoid calling getActiveFile #1

Open
wants to merge 2 commits into
base: feat/additional-arguments
Choose a base branch
from

Conversation

matthewturk
Copy link

I would like to call this plugin from a meta-bind button inside a sidecar-panel file. It turns out that for reasons related to how I need to render the meta-bind embeds, the getActiveFile() function won't produce anything useful. So I added this argument to try to make it optional, so that I can call it like this:

 ```meta-bind-button
 label: Export to PDF
 icon: ""
 hidden: false
 class: ""
 tooltip: ""
 id: ""
 style: primary
 actions:
   - type: inlineJS
     code: >
       const sidecar = app.plugins.plugins["contextual-sidecar"];
       const pandoc = app.plugins.plugins["obsidian-pandoc"];
       const currentFile = await sidecar.getCurrentFile();
       const fullPath = app.vault.adapter.getFullPath(currentFile.path);
       const v = await pandoc.startPandocExport(fullPath, "pdf", "pdf", "PDF", currentFile);

I think this is the minimally invasive solution to it -- what do you think?

@matthewturk
Copy link
Author

I've added a return value that is the actual generated filename. This lets it also utilize app.vault.resolveFilePath to grab the right path, and with meta-bind can embed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant