question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FR] Inject cMenuModalBar in .mod-vertical.mod-root instead of body child.

See original GitHub issue

Hi, I just discovered the plugin and love the idea,

I noticed the plugin’s bar doesn’t self adjust to side panels (open/closed and their size) I tried on my side to change (https://github.com/chetachiezikeuzor/cMenu-Plugin/blob/master/main.ts#L73) document.body.appendChild(cMenuModalBar); to document.body.querySelector(".mod-root .view-content").appendChild(cMenuModalBar); and it work like a charm (for me, at least), the bar will always stay centered in the .view-content, where the “writing content” actually is.

PS : I’m not sure about Obsidian’s rules as to what are bests practices so maybe what I propose isn’t recommended at all.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
chetachiezikeuzorcommented, Aug 6, 2021

Lol, no reason to feel bummed! I’m literally a beginner developer so my knowledge is super limited. I think the best option for now would be to have a toggle-able setting “Append to Body/Append to Workspace.” That way, Sliding Panes users can just toggle to fit their needs

1reaction
Writecommented, Aug 2, 2021

Cool ! It seems injecting the bar as last element in .mod-vertical.mod-root create a resizing handle on the right, even when there’s only one note open. The workaround I found for now is to instead inject the bar directly at the top of .mod-vertical.mod-root with insertAdjacentElement() instead of appendChild()

Like so

document.body
    .querySelector(".mod-vertical.mod-root")
    .insertAdjacentElement('afterbegin', cMenuModalBar)

Thanks to this post

DOM Structure would then look like that : image

Where #cMenuModalBar div will always be above first <hr class="workspace-leaf-resize-handle"> and first <div class="workspace-leaf [...]"> instead of being last element (at least at the moment it’s injected injected in the DOM).

Read more comments on GitHub >

github_iconTop Results From Across the Web

christophersw/Food-Systems-Strategies - Change ... - The Nest
The most flexible form of aid for local food access providers is direct financial grants. This form of funding allows food access providers...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found