-
-
Notifications
You must be signed in to change notification settings - Fork 71
Description
Please fill out these Check-boxes
- I checked for existing similar issues
- I checked that the plugin is up to date
- The issue persists with all other plugins and themes disabled
Plugin Version
1.3.4
This Issue Occurs on
- Windows
- Linux
- macOS
- Android
- iOS
Debug Info
SYSTEM INFO:
Obsidian version: v1.8.7
Installer version: v1.8.7
Operating system: Windows 10 Pro 10.0.19045
Login status: not logged in
Language: fr
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: Minimal
Snippets enabled: 0
Restricted mode: off
Plugins installed: 14
Plugins enabled: 2
1: Meta Bind v1.3.4
2: JS Engine v0.3.0
RECOMMENDATIONS:
Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.
Describe the Issue
Hi, I hope you're doing well and thank you for developing Meta Bind 👋
First of all I want to point out that I'm not sure why the debug info mentions Community theme: Minimal, since I don't have Minimal installed at all in this vault:
Anyway, it's all in the title: buttons which run JS don't seem to work in a canvas. Clicking on them makes a bubble appear on the top right corner of Obsidian, stating that an error occurred while running the button's action and that there may be more to it in the console.
I went and tried to pull the thread, and the issue occurs in JSEngine, whose function InternalAPI.getFileWithExtension(...) gets called with "" as the path argument. Going up the call stack, this seems to occur because the button's onclick event is somehow invoked when this is undefined, causing this.filePath to evaluate to "", which then gets passed around until it blows up in JSEngine. I haven't been able to push further, since I'm not that acquainted with common practices in front-end stuff (or web-related stuff at all really)
Steps to Reproduce
- Create a canvas
- Create a card in the canvas
- Create a button in the card:
//```meta-bind-button
label: This is a button
icon: ""
style: default
class: ""
cssStyle: ""
backgroundImage: ""
tooltip: ""
id: ""
hidden: false
actions:
- type: inlineJS
code: console.log("Hello world")
args: {}
//```- Click on it
The same happens with a JS action which calls a script
Expected Behavior
A click on the button should perform the associated action without error
