shabegom / buttons

Buttons in Obsidian
The Unlicense
478 stars 50 forks source link

links not working #45

Closed mnvwvnm closed 3 years ago

mnvwvnm commented 3 years ago

Your example:

name To the Forum Batman!
type link
command: https://forum.obsidian.md/

It doesn't perform any action. Dev tools:

Uncaught (in promise) TypeError: Cannot read property 'trim' of undefined
    at link (eval at <anonymous> (app.js:1), <anonymous>:1040:25)
    at clickHandler (eval at <anonymous> (app.js:1), <anonymous>:1112:25)
    at HTMLButtonElement.eval (eval at <anonymous> (app.js:1), <anonymous>:1143:21)
    at HTMLButtonElement.s (app.js:1)
link @ buttonTypes.ts:115
clickHandler @ index.ts:55
eval @ index.ts:86
s @ app.js:1

An extra question: Is there a command to open another file? Thanks

shabegom commented 3 years ago

Hey @mnvwvnm! You caught an error in the README that I didn't see before. The syntax should be:

name To the Forum Batman!
type link
action https://forum.obsidian.md/

I don't know why I wrote command 🤦

to your second question, you should be able to use the same link command to open files. If you want to open an external file, you'll just need it's file:// link:

example:

```button name Open File type link action file:///Users/shabegom/my-sweet-file.pdf ```

If you want to open another note in Obsidian, you can use the obsidian uri (you can get this by right clicking on a note in the file explorer)

example:

```button name Open File type link action obsidian://open?vault=my-vault&file=my-file ```

mnvwvnm commented 3 years ago

Thanks for the clarifications. The possibility to link to external files opens great possibilities for interacting with my databases on Devonthink.