Closed jgm closed 1 year ago
Implemented left->right sync. Would also be good to have right->left sync.
I can't seem to be able to input line breaks in the editor now, not sure if it's related to this change. Pressing the enter key just generates a space 🤔. This happens only on Firefox, but not in (Chromium-based) Brave.
Also, I get double scrollbars in the preview pane (on both browsers) as soon as the rendered content is longer than the container's height.
Right, I just noticed these odd differences.
When I paste a document in, Safari puts in two blank lines for every one. Firefox collapses all of them. Chrome looks right.
The weird behavior seems linked to my adding the whitespace-nowrap
tailwind class.
But I don't want auto-wrapping because it defeats the scrollsync calculations.
It's fixed now, I think.
It's fixed now, I think.
Not quite, I'm afraid :(
Here's what I see in Firefox:
And in Brave:
Sorry, what's the problem you see there? There are slight differences in rendering, but the lines on the left look right.
Apologies, I assumed it would be more evident. The issue is the rendered content being cut off at around 182px of height (note the scrollbars).
It seems that this is due to the div wrapping the iframe not having height:100%
, so it settles on the default iframe height (150px) plus the 1rem padding. The iframe then gets 100% of the available (182px) height.
OK, thanks. Try it now.
Looks better indeed. But the <pre id="result">
is shown under the <iframe>
with a non-zero height (it seems to be roughly the same size as the iframe), which makes scrolling around in the page a little awkward. Shouldn't it be set to display:none
if the output selection is set to "Preview"?
Done.
Nice! The linked-scrolling behavior isn't fully reliable on Firefox, and is a bit jerky on both Firefox and Brave, but it works, and there aren't any layout issues now.
We can copy what commonmark.js's dingus does.