mProjectsCode / obsidian-meta-bind-plugin

A plugin for Obsidian to make your notes interactive with inline input fields, metadata displays, and buttons.
https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/
GNU General Public License v3.0
534 stars 42 forks source link

Add example for Button action type "JS" and "args" #452

Closed MathiasAugstein closed 3 days ago

MathiasAugstein commented 2 weeks ago

Please fill out these Check-boxes

Is your Feature Request related to a Problem or Annoyance?

I am struggling to pass arguments to an external JS function. context.args is always undefined, and I cannot find an example.

Describe the Feature you'd like

In exampleVault -> Buttons -> "Button Example.md", please add an example how an external JS function can receive arguments using the actions.args property.

Alternatives

In my case, I try to add a task with the title specified in an input. As I want to reuse the JS code I wrote it in a separate file. This use case might be popular among other people (use a button as "add" or "replace" of whatever is inserted in the input), so it might be worth writing an "Advanced Example".

But this would be second priority for me, clear example where people search it would be better.

Additional Context

No response

mProjectsCode commented 3 days ago

I added an example to the docs, here