obsidian-banners icon indicating copy to clipboard operation
obsidian-banners copied to clipboard

[bug]In 0.15.3, the banner height is incorrect under the new window

Open MugenLee opened this issue 2 years ago • 4 comments

In 0.15.3,

This is the Banner under the normal window in Obsidian: image

This is a new window, the banner of the same file, the height is not displayed correctly image

This may be a new problem caused by the new function

Please take the time to take a look, the new window function is very useful~

thanks~ @noatpad

MugenLee avatar Jun 29 '22 01:06 MugenLee

I think the issue is that this function isn't being executed again when a new window is opened; a new window in Obsidian behaves like a new instance, so variables need to be defined again:

https://github.com/noatpad/obsidian-banners/blob/b4601ca5481402e62cc0bc477abc717fddcb099d/src/main.ts#L142-L146

Here's a hacky fix until a change is made to the plug-in.
You can just define the variables in your theme's CSS:

:root
{
    --banner-height: 300px;
    --banner-internal-embed-height: 200px;
    --banner-preview-embed-height: 120px;
}

The issue with this fix is that your changes in the plug-in settings UI will not change the values defined in this CSS. You will need to manually go back here to adjust the heights.

CabbageCanFly avatar Aug 27 '22 04:08 CabbageCanFly

I am randomly getting this error now even without using the new window feature. @CabbageCanFly where do I put that snippet? I don't understand.

Oh interesting, the banner "corrects" itself when I use the new window feature.

craldaz avatar Aug 29 '22 06:08 craldaz

I am randomly getting this error now even without using the new window feature.

@craldaz, if the banner height is incorrect even in a normal view, you may be experiencing a problem that isn't related to this ticket.


where do I put that snippet? I don't understand.

I mentioned that my hacky solution is to explicitly define the variables in the theme's CSS.
This is either done directly in your theme's CSS file or done by using the CSS snippet feature offered by Obsidian.


Oh interesting, the banner "corrects" itself when I use the new window feature.

You may have a conflicting theme or plugin for your specific situation.

CabbageCanFly avatar Aug 29 '22 06:08 CabbageCanFly

@CabbageCanFly The problem did arise when I tried to install some plugins. However, I quickly removed them, furthermore I have my vault version control and I don't see anything changed. When I open my page, it puts the banner at the top then quickly drags it down. not sure why. Idk if I'd describe it as the height is incorrect. it's just translated down.

craldaz avatar Aug 29 '22 06:08 craldaz