Commit 16ed789
fix(forms): refresh CodeMirror when MarkdownEditor becomes visible (#20239)
* fix(forms): refresh CodeMirror when MarkdownEditor becomes visible
* Restore `#20134` state sync fix and only refresh on the hidden-to-visible transition
- Reinstates the current `4.x` change handler and state watcher, which were
accidentally reverted when this patch was authored against an older copy of
`markdown-editor.js`.
- Keeps the `ResizeObserver` and `IntersectionObserver` connected for the whole
lifecycle of the editor, since the state may change while it is hidden and it
can be revealed again, but only calls `refresh()` when the editor transitions
from hidden to visible instead of on every resize or scroll.
- Detects visibility using both `offsetParent` (inactive tabs use
`display: none`) and computed `visibility` (collapsed sections hide content
with `visibility: hidden`).
- Rebuilds the dist output against the latest `4.x`, resolving the merge
conflict.
---------
Co-authored-by: Dan Harrin <git@danharrin.com>1 parent 413d073 commit 16ed789
2 files changed
Lines changed: 55 additions & 1 deletion
0 commit comments