Skip to content

[docs-infra] replace live editing engine back to textarea#1691

Draft
brijeshb42 wants to merge 14 commits into
masterfrom
docs-infra-live-code-editing
Draft

[docs-infra] replace live editing engine back to textarea#1691
brijeshb42 wants to merge 14 commits into
masterfrom
docs-infra-live-code-editing

Conversation

@brijeshb42

@brijeshb42 brijeshb42 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Replaces the docs-infra live editing stack with a lazy react-simple-code-editor textarea implementation, as discussed in code-infra meetings. The runtime functionality is in parity with what we have on current core docs site while keeping improvements from the current docs-infra like no need of separate preview files, no js files for ts file, etc.

  • Removes the contentEditable-based editing engine, related state machines, transition logic, and obsolete tests. I'll revisit it separately to move back to content-editable based editor.
  • Lets collapsed code blocks edit only their visible lines while applying changes to the full source file.
  • Preserves live preview builds, source transforms, reset behavior, copy/export actions, syntax highlighting, worker parsing, and controller integration, in parity with core-docs.
  • Updates CodeProvider lazy loading to preload the editor only for editable code blocks.
  • Refreshes docs-infra demos, styles, API docs, and live-editing examples for the new editor behavior.
  • Converts applicable production React.createElement usage to JSX and renames JSX-bearing modules to .tsx. Just minor housekeeping.
  • Removes the internal useCrossTabState / useCrossTabMirror API, tests, demo, package export, and documentation. This wasn't being used anywhere and I doubt we'll need it for any future feature.

Companion PR commits to review in material-ui migration.

@code-infra-dashboard

code-infra-dashboard Bot commented Jul 21, 2026

Copy link
Copy Markdown

Deploy preview

Bundle size

Total Size Change: ▼-145KB(-4.03%) - Total Gzip Change: ▼-44.5KB(-4.90%)
Files: 75 total (6 added, 2 removed, 19 changed)

Show details for 75 more bundles

CodeHighlighterClientparsed: 🔺+481B(+0.82%) gzip: 🔺+196B(+0.97%)
@mui/internal-docs-infra/useDemoControllerparsed: 🔺+413B(+7.65%) gzip: 🔺+113B(+4.99%)
rolldown-runtimeparsed: 🔺+390B(+56.20%) gzip: 🔺+199B(+47.16%)
loadIsomorphicCodeVariantparsed: 🔺+333B(+1.29%) gzip: 🔺+154B(+1.73%)
TransformEngineparsed: 🔺+268B(+1.36%) gzip: 🔺+70B(+1.10%)
@mui/internal-docs-infra/abstractCreateDemoparsed: 🔺+188B(+3.15%) gzip: 🔺+41B(+1.70%)
CodeHighlighterChunkparsed: 🔺+107B(+1.55%) gzip: 🔺+29B(+1.12%)
@mui/internal-docs-infra/createDemoDataparsed: 🔺+33B(+1.35%) gzip: 🔺+10B(+0.92%)
hastUtilsparsed: 🔺+45.6KB(new) gzip: 🔺+16.7KB(new)
CodeEditorparsed: 🔺+13.3KB(new) gzip: 🔺+5.4KB(new)
SourceEditingEngineparsed: 🔺+2.94KB(new) gzip: 🔺+1.25KB(new)
grammarMapsparsed: 🔺+1.83KB(new) gzip: 🔺+887B(new)
useGrammarsReadyparsed: 🔺+1.63KB(new) gzip: 🔺+779B(new)
grammarCacheparsed: 🔺+797B(new) gzip: 🔺+419B(new)
@mui/internal-docs-infra/useCodeparsed: ▼-67.4KB(-61.58%) gzip: ▼-22.7KB(-62.40%)
@mui/internal-docs-infra/useDemoparsed: ▼-67KB(-52.28%) gzip: ▼-22.5KB(-52.85%)
@mui/internal-docs-infra/CodeHighlighterparsed: ▼-28.9KB(-87.29%) gzip: ▼-9.69KB(-84.97%)
@mui/internal-docs-infra/CodeProviderparsed: ▼-24KB(-15.11%) gzip: ▼-7.39KB(-15.81%)
embedTransformsparsed: ▼-477B(-4.77%) gzip: ▼-47B(-1.30%)
parseSourceparsed: ▼-320B(-0.37%) gzip: ▼-248B(-0.97%)
findExpandingRangesparsed: ▼-179B(-1.11%) gzip: ▼-52B(-1.02%)
@mui/internal-docs-infra/abstractCreateDemoClientparsed: ▼-122B(-14.35%) gzip: ▼-16B(-3.49%)
BuildEngineparsed: ▼-24B(-0.32%) gzip: ▼-2B(-0.07%)
@mui/internal-docs-infra/abstractCreateTypesparsed: ▼-23B(-0.02%) gzip: ▼-6B(-0.02%)
grammarLoadersparsed: ▼-5B(-0.58%) gzip: ▼-4B(-1.60%)
EditingEngineparsed: ▼-23.6KB(removed) gzip: ▼-7.61KB(removed)
@mui/internal-docs-infra/useCrossTabStateparsed: ▼-924B(removed) gzip: ▼-488B(removed)
@mui/internal-docs-infra/abstractCreateStreamparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/ChunkProviderparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/cliparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/CodeControllerContextparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/CodeExternalsContextparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/CodeHighlighter/errorsparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/CodeHighlighter/typesparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/CoordinatedLazyparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/CoordinatedLazy/typesparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/createDemoData/typesparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/createSitemapparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/createSitemap/typesparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/useCodeWindowparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/useCoordinatedparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/useCopierparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/useErrorsparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/useLocalStorageStateparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/usePreferenceparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/useScrollAnchorparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/useSearchparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/useSearch/typesparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/useStreamparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/useStream/typesparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/useTypeparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/useTypesparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/useUrlHashStateparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/internal-docs-infra/withDocsInfraparsed: 0B(0.00%) gzip: 0B(0.00%)
addLineGuttersparsed: 0B(0.00%) gzip: 0B(0.00%)
CodeInitialSourceLoaderparsed: 0B(0.00%) gzip: 0B(0.00%)
CodeSourceLoaderparsed: 0B(0.00%) gzip: 0B(0.00%)
compileCssWithPostcssparsed: 0B(0.00%) gzip: 0B(0.00%)
createFrameparsed: 0B(0.00%) gzip: 0B(0.00%)
createParseSourceWorkerClientparsed: 0B(0.00%) gzip: 0B(0.00%)
enhanceCodeEmphasisparsed: 0B(0.00%) gzip: 0B(0.00%)
getHastTextContentparsed: 0B(0.00%) gzip: 0B(0.00%)
grammarsparsed: 0B(0.00%) gzip: 0B(0.00%)
isFrameSpanparsed: 0B(0.00%) gzip: 0B(0.00%)
source.cssparsed: 0B(0.00%) gzip: 0B(0.00%)
source.jsparsed: 0B(0.00%) gzip: 0B(0.00%)
source.jsonparsed: 0B(0.00%) gzip: 0B(0.00%)
source.mdxparsed: 0B(0.00%) gzip: 0B(0.00%)
source.shellparsed: 0B(0.00%) gzip: 0B(0.00%)
source.tsparsed: 0B(0.00%) gzip: 0B(0.00%)
source.tsxparsed: 0B(0.00%) gzip: 0B(0.00%)
source.yamlparsed: 0B(0.00%) gzip: 0B(0.00%)
text.html.basicparsed: 0B(0.00%) gzip: 0B(0.00%)
text.mdparsed: 0B(0.00%) gzip: 0B(0.00%)
transpileSourceparsed: 0B(0.00%) gzip: 0B(0.00%)

Details of bundle changes

Performance

Total duration: 13.80 ms -1.58 ms(-10.3%) | Renders: 5 (+0) | Paint: 53.87 ms -3.44 ms(-6.0%)

Test Duration Renders
HeavyList mount 5.40 ms ▼-1.77 ms(-24.7%, p=0.001) 1 (+0)

6 tests within noise — details


Check out the code infra dashboard for more information about this PR.

@Janpot

Janpot commented Jul 22, 2026

Copy link
Copy Markdown
Member

@claude review

(testing the new action)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants