[docs-infra] Replace the contentEditable editor with a textarea editor - #1779
[docs-infra] Replace the contentEditable editor with a textarea editor#1779brijeshb42 wants to merge 6 commits into
Conversation
Deploy previewBundle sizeℹ️ Using snapshot from parent commit 76408ea (fallback from merge base bf6ed6d). Total Size Change: ▼-39.7KB(-1.16%) - Total Gzip Change: ▼-11.7KB(-1.28%) Show details for 71 more bundlesCodeEditor parsed: 🔺+3.77KB(new) gzip: 🔺+1.7KB(new) Performanceℹ️ Using benchmark from parent commit 76408ea (fallback from merge base bf6ed6d). Total duration: 17.08 ms -0.71 ms(-4.0%) | Renders: 5 (+0) | Paint: 63.91 ms +0.48 ms(+0.8%)
5 tests within noise — details Metric alarms
Check out the code infra dashboard for more information about this PR. |
3c07936 to
74cce13
Compare
The generated `types.md` escapes the colon, and the escaped form breaks the Markdown parser eslint runs over the docs — the only lint error in the repository.
76a3f28 to
bf6ed6d
Compare
dcf13d1 to
7e52522
Compare
Replaces the
contentEditableediting engine with a textarea laid over the highlighted<pre>.The textarea owns the text, so selection, undo/redo, IME, and spellcheck are native. It paints nothing: an edit goes out through
setSource, the host re-parses, and<Pre>re-renders from the new tree — so emphasis frames, collapse placeholders, and intersection-driven frame hydration keep working while editing.Net −8,800 lines.
EditingEngineis narrowed to the edit-time source manipulationuseSourceEditingstill needs; the editing surface moves to its owncodeEditorLoaderchunk, so a block that only commits programmatic edits no longer pulls the editor in.No new dependency.
Notes
document.execCommand('insertText')to stay on the native undo stack. jsdom has noexecCommand, so unit tests cover the fallback andPre.browser.tsxcovers the real path.<code>'s font metrics and the frame spans' horizontal padding. Inheriting from<pre>is not enough —<code>and.framecarry their own metrics, and a fraction of a pixel per line compounds into visible drift.EditableSourceProjectionand lands separately. Until then, focusing a collapsed block expands it.