Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header embed has code block item that overflows outside the bound of the Pane and adds a horizontal scroll bar #74

Closed
GitMurf opened this issue Sep 10, 2021 · 4 comments

Comments

@GitMurf
Copy link

GitMurf commented Sep 10, 2021

Somewhat related to #71 this issue seems to be tied to Header embeds that have a Search "query" code block with a string that spans longer than the window size. On first load it is expanded out within the Pane which adds a horizontal scroll bar on the pane itself. If you simply update the ![[embed]] by adding a space for example after it to "re-render" it, then it will adjust and put the scroll bar within the rendered element itself and not make the pane itself horizontally scroll. See video for demonstration.

Note this is with the default theme and zero custom CSS so that isn't the issue.

wib8UKoXol.mp4
@ozntel
Copy link
Owner

ozntel commented Oct 10, 2021

Do you have the sample block, which causes this issue? I would need to try with custom CSS.
Or if you have a chance, you can try overflow-x: scroll on available widget classes and let me know which one solves. I will then include in the plugin css.

@GitMurf
Copy link
Author

GitMurf commented Oct 10, 2021

I will give it a try when I get back to my computer later today. Thanks.

@GitMurf
Copy link
Author

GitMurf commented Oct 11, 2021

Ok so first off, adding the following "fixes" the issue... kind of. It gets the job done but ultimately I don't think is the right solution as I think something just is happening weird on initial load with your plugin that isn't rendering as you'd expect. See below for more details.

Here is the css that "fixes" the issue by stopping it from horizontally scrolling the entire pane (I don't think its the "right" solution though based on my further details explained below):

div.oz-transclusion-widget pre {
    overflow-x: scroll;
}

Here is what is on my [[Weekly Review]] page: *Note below I used single quotes instead of back ticks for the query code block so that it didn't render oddly here on github.

### TODO Items for Friday [[2021-10-08]]

'''query
(file:TASK_2021_10_08 task-todo:"[ ]") OR ((--/Due Date: .*\[\[2021-10-08\]\].*/ OR --/due date: \[[0-9, -]*2021-10-08[0-9, -]*\]/) task-todo:"[ ]") OR (file:2021-10-08 task-todo:"[ ]") OR (task-todo:"2021-10-08")
'''

Here is what is on my daily note page that transcludes my header embed from the [[weekly review]] page: ![[Weekly Review#TODO Items for Friday 2021-10-08]]

What is I think causing the issue is that on initial loading of Obsidian to my daily notes page here is the HTML structure of your transclusion for a code block. See how the pre element has no class. Also note how the code element has the "line-numbers" class.

image

Now look at it after I simply add and remove a "space" after the ![[embed]] text to force your plugin to re-render it. This fixes the scrollbar issue and you'll notice the pre element now has classes and that the "line-numbers" class moved from the code element up into the pre element.

image

Here is what it renders like on startup BEFORE editing the ![[embed]] line to force it to re-render. Notice the line number is missing.

image

Here is how it renders AFTER editing the ![[embed]] line:

image

@ozntel
Copy link
Owner

ozntel commented Oct 13, 2021

I included the CSS for overflow to ensure that it doesn't break the preview.

The issue you mentioned shouldn't have an effect on renders. Especially queries won't be included in the transclusion renders.

@ozntel ozntel closed this as completed Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants