chrisgurney / obsidian-note-toolbar

Plugin for Obsidian providing a flexible way to context-aware toolbars for your notes.
https://github.com/chrisgurney/obsidian-note-toolbar/wiki
Apache License 2.0
197 stars 0 forks source link

Unable to open a link in a new tab/window by Ctrl/Cmd-clicking #91

Closed chrisgurney closed 21 hours ago

chrisgurney commented 1 week ago

Discussed in https://github.com/chrisgurney/obsidian-note-toolbar/discussions/81

Originally posted by CptMonac June 6, 2024

I'm using the toolbar with the Daily Notes plugin and have added links to other pages in my vault on the toolbar. I can't seem to figure out how to get these pages to open in a new tab or window when I click on them though - the pages always replace the current active page and ideally I'd like to have them side-by-side.

chrisgurney commented 1 week ago

Potential solution

I believe what will work is to conditionally use span only if the current platform is Android, and use an anchor otherwise. I'm not 100% certain if this will fix the problem, as there's a click handler that takes action on the link depending on what type it is.

In any event, this will take some testing to make sure I don't introduce any major regressions.

chrisgurney commented 2 days ago

Update

I tried changing links back to anchors temporarily, and it's not working as I thought it might.

Instead it looks like I have to capture the keys that are pressed at click time and take action per Obsidian's docs. Hopefully I can figure out another approach that's easier to maintain.

chrisgurney commented 2 days ago

@CptMonac This should now be fixed in v1.8.2 per how modifier keys should affect links when clicked, per Obsidian's docs.

I've tested on macOS but don't have access to Windows. Please give it a test and let me know if it works for you. Thanks!