Making "args" accessible in the context for buttons with action type "inlineJS" #477
Closed
3 tasks done
Labels
feature request
New feature or request
Please fill out these Check-boxes
Is your Feature Request related to a Problem or Annoyance?
No response
Describe the Feature you'd like
Previously, I had stand-alone JS script files inside my vault notes which were run for the button action type
js
with theargs
option to pass an additional parameter to the script.Now, I moved everything inside a custom plugin, so instead of a stand-alone script, I have exposed public api and added Obsidian commands registered by the plugin.
For the former, I understand there is still no straightforward way to pass any custom parameters to Obsidian commands.
As for the option of calling a function defined in the plugin api, I have the following button action definition:
Unfortunately, the
args
config option is not currently supported forinlineJS
action type (https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/buttonactions/inlinejs/).May I kindly request adding support for the
args
configuration option forinlineJS
button action, so that the existing logic in the function could still be used without modifications, similar to what is described here:https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/buttonactions/runjavascript/
Alternatives
There is an opportunity to register additional Obsidian commands specifically for the variations of the arguments in question. This is not a good workaround, as the combinations even of 2 arguments with each having only 2 variations will make it necessary to register 4 additional Obsidian commands.
The more realistic workaround is to change the function definition and introduce an additional argument for
args
.Before:
After:
Additional Context
As discussed before, I would not like a standalone script file (i.e., the one processing the button action of type "js", which can currently accept the "args" in the context) to live in the vault, as my intention is to make plugin updates as easy as possible, and for that I don't want to have to update potentially numerous additional standalone script files, while the logic can be hidden inside the plugin API wrapper.
The text was updated successfully, but these errors were encountered: