How to get rid of funky Prosemirror overlap
Hi. I'm getting some overlap with Prosemirror (see image) any ideas how to avoid that?
It's like the Prosemirror component doesn't expand the height of it's container while editing. It's fine after the edit, i.e. the rendered content doesn't overflow the container once the content is saved and the editor closed.
Looking at the prosemirror npm repo it looks like it has been discontinued. What includes prosemirror anyway? Is that a foundry thing. Am I asking this in the wrong server? I'll ask in Foundry too just in case.
I think this probably is a TJS thing as I'm using this:
I get similar behaviour with TinyMCE btw except that the overflow-y seems to be handled with a scroll, although the wrapping element still does not expand, so the layout is awkward.
10 Replies
I tried it with a new application modelled on the one from
essential-svelte-esm
With similar results
This CSS solved the problem:
I assume you are changing the layout of the containing elements to something other than a flexbox. Not that this is bad. I definitely need to review the editor components and make them a bit more configurable for different layout constraints.
IE the
article
element is likely just block
. It might work if you change article to a flexbox without CSS changes to the component.Tx. I tried your suggestion and while it's not as extreme, the overflow problem still occurs, and the article won't expand while editing content, instead you get a tiny scrollable area in which to type your content.
My feeling at this stage is that it might be better not to include CSS for the prosemirror component and leave that up to the implementer entirely. It's not hard to target since the css class-structure is good. CSS vars will always still constrain you in some way that can't cater for every potential use-case and it just doesn't seem necessary to include styles for this component.
I've still not managed to get an editor that grows with its content, haha
Though I'm trying from the MCE editor
I have the main body of my sheet as a section with the flexcol class and then I have a div with role ="tabpanel" that actually contains the editor and that causes the editor to fill the available space for me
Pls ingore the complete lack of any styling atm
Things should work fine in a flexbox layout; though if you wrap the RTE components in any given other element that containing element should also be a flexbox. @geoidesic the attached pict. By containing things in an
article
element that is a block layout by default. If you add the following then things should work:
In the future I can certainly take a look at offering more finite control in other display / layouts, but it definitely works now w/ flexbox.There are a bunch of CSS variables you can adjust too.. width and height are
--tjs-editor-width
/ --tjs-editor-height
and set to 100%
by default hence why things play nice in a flex layout. There is a styles
option you can use to set inline styles for the CSS vars. This does bring up the possibility though of adding min / max height CSS vars for the editors though you can technically pass those in as the styles themselves; there just isn't CSS vars that could be applied over a group of editors right now.