obsidian-meta-bind-plugin icon indicating copy to clipboard operation
obsidian-meta-bind-plugin copied to clipboard

Ability to provide a callback function to metabind button

Open vitalybe opened this issue 6 months ago • 0 comments

Please fill out these Check-boxes

  • [x] I checked for existing similar feature requests
  • [x] I have read the docs and checked that the feature I am requesting is not already implemented
  • [x] My feature request consists of only one feature

Is your Feature Request related to a Problem or Annoyance?

Metabind buttons are great when you use them from markdown but if I want to use them from API then the fact that I can't connect them to a simple javascript callback is very annoying. Sure I can use evaluate or give them source file path, but I am already in code, it'd be much simpler to just give it a callback.

Describe the Feature you'd like

Give me a simple way to invoke callback, e.g.:

{
          type: ButtonActionType.JS_CALLBACK,
          value: () => { console.log("Hello world!")
}

Alternatives

The following types are as close as we can get:

  • inlineJS
  • js

Which is not ideal, especially if you want to share some context between your code and the button callback

Additional Context

No response

vitalybe avatar May 14 '25 07:05 vitalybe