Browse documentation
Docs/Functionality

Customize a rich Document as JSX

Choose Eject to code to create editable JSX from the current acknowledged rich Document. The original !data remains intact; clearing !source restores the native Document editor. The…

Customize a rich Document as JSX

Choose Eject to code to create editable JSX from the current acknowledged rich Document. The original !data remains intact; clearing !source restores the native Document editor. The generated view snapshots authored prose and task states. Inserted cell and bounded range references remain live through the existing Component snapshot subscriptions, including references inside table cells, lists, quotes and callouts. Ejection itself makes no model-value write.

The native editor captures its complete visible document, including styles and review metadata, after its writes have been acknowledged. Pending, failed, uncertain or recovered changes require a save or an explicit recovery choice first; ejection never retries them for you or substitutes an older stored body. Finish or cancel image/Word imports before ejecting. During the source save, typing, formatting, imports and presentation changes pause. A refused generation or source save restores editing; a closed or replaced editor releases only its own capture.

The source retains recursive lists and task lists, numbered starts/formats, headings 1–6, multiple blocks inside table cells, mixed headers, row/column merges and column-width hints. Tables retain their authored cell topology; a header rowspan crossing into later rows stays within one HTML row group. Bold, italic, underline, strike, inline code, highlight, links and typography remain HTML elements/styles. Named styles travel in documentPresentation and are used by documentTextStyle; direct paragraph formatting overrides a named style. Image titles/dimensions, callout tones, code language annotations and initial toggle states also remain in the source.

Markdown uses the same content adapter as the native editor, preserving its supported formatting and nested structure. Raw HTML remains literal text. A Document bound to a text value is still an explicitly labelled snapshot of that text at ejection time; re-eject after changing the bound text. Inserted live cell/range values use selected Component snapshot hooks and the same display adapter as the native Document. Number/currency formats, units, display-only native sidecars and pending/stale/failed labels update with their snapshots. Missing values stay explicit. This display adapter does not evaluate formulas or interpret an exact native sidecar as a JavaScript value. Ordinary scalar source keeps its existing lightweight hooks; Document display loads when selected.

Page size/orientation, margins and explicit page breaks produce print CSS hints. Header/footer text appears once; authored page-number/repeating-header metadata remains inspectable, but the JSX view does not implement Word pagination, repeating headers/footers or page counters. Named print pages keep different ejected Documents' page-size hints separate. Use native Word/PDF publication for those publishing features; browser printing is not a native PDF fidelity claim.

Comments and tracked changes remain a refusal: export a supported Word copy instead. Invalid/unknown stored rich content and unsafe URLs also refuse ejection without falling back to stale seed text or changing the original. Task checkboxes show their authored state and do not save back to !data. Edit the source to customize behavior; source editing is separate from the native rich-document editing/recovery flow.

To add an image while authoring, type /image, choose Image, then enter its URL and description in the existing image dialog. Cancel keeps the typed command and inserts nothing. Confirmation replaces the command with an image as one Undo step; the same URL checks apply to toolbar and slash insertion. Pasting or dropping image files continues to use the existing import and recovery flow.

Follow the rich ejection walkthrough. The implementation checks exercise actual emitted JSX and live subscriptions. Dense native Document opening remains an open performance gap; this change does not hide content or replace its editor.