dominiclet / obsidian-note-definitions

Obsidian plugin for seamless viewing of personal definitions
MIT License
79 stars 4 forks source link

Handling links better / option to not show aliases #51

Closed Aetherinox closed 3 months ago

Aetherinox commented 3 months ago

I created a hover definition, which is also a link. The only way to get the definition to work was to actually paste the entire link in the alias exactly how it shows on the page:

WfiWjdc3q7

The problem with this is that links that appear in the definition popup are not formatted. It shows the actual markdown code for the link, so one of two options would be awesome.

If I try to add just an alias that is mysql plugin, it doesn't recognize it.

  1. Definition popup with the ability to render links as a link / clickable
  2. Add an option to the settings which disables aliases appearing in the definition popup.

Something else I noticed with the popup position. If the word is on the upper half of the screen and you hover, it's alright. The popup shows below the cursor.

But if you have the word on the lower half of the screen, instead of the popup finding some space above the cursor, it puts it right over the cursor.

smtaVxgkrv

dominiclet commented 3 months ago

Hi, thanks for the feedback.

Adding an option to disable aliases appearing is doable, I'll add it in a subsequent release. I wouldn't encourage adding anything other than plaintext to the alias section as markdown syntax may possibly interfere with the definition file parser. Although I see why you need to add the markdown code for the link in your particular case.

As for the issue with the popover that you mentioned, could you let me know more about your editor configurations? Such as your font size, whether other plugins are being used, etc. So I can try to replicate the issue.

If the word is on the lower half of the screen, the popover should, if working correctly, appear above the word, like this: image

Aetherinox commented 3 months ago

Theme: Blue Topaz Font Size: 14px Obsidian: 1.5.12


However, I did set my theme back to default, unloaded my custom CSS files, and disabled all plugins except this definition plugin, which gave me the result:

Nj75T5AVq7

I also restarted obsidian after turning everything off just to ensure nothing was left behind cached in the program.

If I turn all CSS files back on, plugins, and my theme, I get:

sFKNo7rmdr

dominiclet commented 3 months ago

Hmm I tried using the theme you mentioned, as well as setting the font size with varying zoom levels, all seem to work as expected. Perhaps you could test with a fresh vault with no plugins installed and see if the problem persists? It may be possible that some other plugins did not cleanup properly even after disabling, but I can't be sure.

Aetherinox commented 3 months ago

Loaded up a fresh sandbox. Dark default theme is all I changed, only because the white was blinding me.

CjHvZl53cU

This video is trying both locations. Was trying to see if the link in the alias somehow messed it up. vid

I tested it out with a tool. It messed up if the link / definition is on the bottom half 50% of the screen. If I scroll to 51% at the top half, it works fine.

dominiclet commented 3 months ago

Okay I've managed to reproduce this issue. I've been using Obsidian with the "Hidden" window frame style. Using the window frame will cause the popover to mount at a wrong position, likely due to the offset added by the frame. Thanks for bringing this up, I'll open another issue to track this bug.

dominiclet commented 3 months ago

I've fixed that bug in the 0.16.2 update, the popover should appear in the correct position for you now.

Aetherinox commented 3 months ago

oh, damn. I didn't even think about the fact of me having the window frame showing. I just do that because it makes some of the menu options easier to see.

Appreciate it. I'm a developer and that idea wouldn't even have popped up. But it makes sense now.

It appears to work fine now in a sandbox, but I have a slight issue with my normal version. Either the theme, or a plugin, so I'll have to do the elimination game again and see which one is borking it.

Edit: I found the issue with Blue Topaz. It's a setting.

Import the code:

{
  "blue-topaz-theme@@bt-status-on": true
}

Save.

OR with Style Settings Plugin, enable Full Width Status Bar (see gif below).

The property bt-status-on is causing some type of misalignment

j3f9mlkcnp

Vc0f6E2QQw




After turning bt-status-on off, it's pretty good. There's this weird thing where it wants to pop up sometimes on the far left, but maybe that's just another setting I have

o6yCEeLc13




Other than that, maybe a way to disable the alias appearing in the box, and I think we're good (if possible).

I need to hunt down what setting is making the definition box pop up on the far left. On the default theme it's pretty aligned. But on my theme, it goes into my sidebar file explorer.

Then again, it's odd that a simple thing like Enable/Disable statusbar would cause such a big difference in alignment. But I've never messed with the Obsidian code in regards to page viewing.

dominiclet commented 3 months ago

Ooh thanks for bringing up and debugging the misalignment issue. I'll fix the issue.

With regards to the popup position, to maximise the space available for the popup, I've made it popup towards the left if the word is beyond 50% of the viewport width. But yes, it probably needs some improvement if it goes into your sidebar file explorer.

dominiclet commented 3 months ago

For disabling alias, I'll add an option for it

dominiclet commented 3 months ago

Released a fix in 0.17.1, which should hopefully fix all the positioning issues you mentioned. The definition popover also shouldn't eat into your file explorer anymore.

Aetherinox commented 3 months ago

Yeah, that works better. Appreciate all the fixes. Hopefully it'll fix other themes as well, since there's a few themes that enable full-width bars. Would be a pain if there has to be a individual fix for each theme.

M9Ma6qVAy3

dominiclet commented 3 months ago

Great! No worries. Yeah I hope so too.

dominiclet commented 3 months ago

Added the option to hide alias display in 0.18.0.