fix: use raw Markdown editor instance when refreshing - #20320
Conversation
|
@people-sea, thanks for taking a look at this issue! I noticed a couple of things that might be worth discussing:
For example, if you put a MarkdownEditor inside a collapsed Section and load the page — CodeMirror will still fire up immediately and try to call getBoundingClientRect() on elements that have zero dimensions. That's where the TypeError comes from, and Alpine.raw() alone doesn't prevent that from happening. In #20314, I took a different approach: the editor simply doesn't initialize until its container is actually visible. This way CodeMirror never runs into the measurement problem in the first place. Happy to discuss if you see it differently! |
Description
Fixes: #20313
Supersedes: #20314
The CodeMirror instance was refreshed through Alpine's reactive proxy.
Use
Alpine.raw()to refresh the underlying editor instance.Visual changes
Before
before.mov
After
after.mov
Functional changes
composer cscommand.