silverbulletmd / silverbullet

The knowledge hacker's notebook
https://silverbullet.md
MIT License
2.31k stars 167 forks source link

Inconsistent and often changing link behavior when clicked #640

Closed JordanPaoletti closed 7 months ago

JordanPaoletti commented 8 months ago

Browser native functionality (at least Chromium based and FF) has the following behavior for clicking a web link:

Button Behavior
left open up link in current tab
middle open up link in a new background tab
right open up the context menu, doesn't open the link from click itself

In silver bullet, I've noticed that these link types often change between version and often don't hold consistent behavior with each other:

  1. wikilinks
  2. external links
  3. links rendered through live queries/templates
Currently (based on running the app locally on the latest commit to main) it appears that external links (not within a live query) are no longer behaving correctly. Specifically, the behavior is: Button Behavior
left open up link in a focused new tab (this may be desirable? however external links rendered in a live template have native functionality)
middle moves the text cursor into the link and pastes (at least on linux, this doesn't occur in previous versions)
right open up the link context menu if the cursor hasn't expanded the markdown, otherwise opens up a non-link context menu

This issue currently is mainly to address the external link behavior. That said, it would be nice to have tests that could pick up these changes as various versions often are all over the place with how links respond to the mouse.

JordanPaoletti commented 8 months ago

Should be noted that adding contenteditable = false to the link plugin will fix the unexpanded middle click behavior of external links

zefhemel commented 8 months ago

Thanks for reporting! I tweaked/fixed some of this already on my development branch (which I'll merge in the next few days). Let's review again once that's in.

zefhemel commented 7 months ago

Ok, I don't have a middle mouse button to try with, but the other reported issues should be fixed. Let me know if you still encounter issues!