Repository navigation
Commit c297dff
feat(grid): rich-content cells edit in a panel under the cell; related tab pinned (#36278)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XURgXCZHcjPoyo5g9cMEATi)_
Fixes #36023
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
- 列表里的富文本、Markdown、HTML
格子,选中后回车会在格子下面弹出编辑框,记录页子表页签里也一样;以前这些格子不能改,只提示去记录页改。
- 属于「列表页重做」专题,补上格内编辑重做卡里富文本那一项和子表页签那一项,做完这张卡就齐了。
- 出错的话最多是这三种格子的编辑框不好用,记录页和表单的编辑不受影响;整个改动可以直接撤回。
- 无。
## What changes
The last slice of #36023 (S3, S4 and S5 landed as `Part of`): rich text
opens an edit panel under the list cell, and the related tab is pinned
to behave like the list.
- **Rich-content cells edit in a panel under the cell.** A `markdown`,
`html` or `richtext` cell, on Enter / F2 / typing / double-click, opens
the record form's own text box (`RichTextField`) over the stored source
in the below-cell panel S4 built (`GridCellFacts.editor: 'below'`,
`CellOverlay placement="below"`). The cell keeps drawing its value, the
row keeps its height (the panel is a fixed-position popper), and the
panel is at least the column's width (the overlay's anchor-width floor;
the inner box asks for `min-w-80`, as `markdown` already did in
`cellEditorWidthClass`).
- **Keys, per card item 4 and rulings D2 / D4:** Enter is a new line;
Ctrl/Cmd+Enter saves and keeps the cell selected; Esc discards; a click
outside saves. No `data-table.tsx` change was needed: its
injected-editor wrapper already commits a TEXTAREA only on
Ctrl/Cmd+Enter on the select-first grid, discards on Escape and commits
on an outside pointer press. Measured by the tests below, not assumed.
- **The split (cell vs detail), not a widening of the shared set.**
`markdown`, `html` and `richtext` stay in `INLINE_EXCLUDED_FIELD_TYPES`;
`hasFieldEditWidget` and `isInlineExcludedFieldType` answer exactly as
before, so the record page's field editor (`InlineFieldInput`,
`fieldEnrichment`), the required-fields dialogs (grid, kanban, record
path, save bar), `RequiredFieldsDialog` and the timesheet keep them out.
`@object-ui/fields` adds `hasInCellPanelEditWidget(type)` (true for the
three types, false for a retired spelling), and `FieldEditWidget` draws
their editor only when the host passes `inCell`. In `plugin-grid`,
`fieldInlineReadOnlyKind` exempts exactly what
`hasInCellPanelEditWidget` names (the same carve-out shape as
`plugin-detail`'s `DETAIL_ROUTED_INLINE_TYPES`),
`PANEL_EDITOR_FIELD_TYPES` gains the three types, and `renderCellEditor`
accepts either predicate.
- **One list, no second spelling (rework round 1).** The three types are
now read from `RICH_TEXT_FIELD_TYPES`
(`fields/src/widgets/richTextDisplay.tsx`, the keys of
`RICH_TEXT_CELL_RENDERERS`) in all three places that named them by hand:
`IN_CELL_PANEL_EDIT_WIDGETS` in `FieldEditWidget.tsx` is built from it,
`PANEL_EDITOR_FIELD_TYPES` spreads it, and `cellEditorWidthClass` in
`ObjectGrid.tsx` checks it before its switch. A type added to the
display table gets its cell panel, its below placement and its width in
the same commit. Derived rather than pinned only, because the cost is
nil: `richTextDisplay.tsx` is already in the eager `ui-components` chunk
through `getCellRenderer` (and `ObjectGrid.tsx` already imported the
list), so the derivation adds one import of a module that is already
loaded. A pin was added as well (see Tests).
- **Lazy.** The editor is `React.lazy(() =>
import('./widgets/RichTextField.js'))` inside `FieldEditWidget`,
rendered in the same `Suspense` boundary the date pickers use
(`LAZY_EDIT_WIDGETS`). Note: `RichTextField` is already in the eager
`ui-components` chunk (it is statically re-exported by the barrel and
already listed in `scripts/vite-ineffective-dynamic-imports.ts`), so the
`import()` moves no module; the eager-closure reading is in
Verification.
- **`html` is safe to edit as text.** What the cell then draws goes
through `renderSanitizedHtml` (`rehype-sanitize` with
`RICH_TEXT_SANITIZE_SCHEMA`, no `dangerouslySetInnerHTML`), the same
pipeline every other read surface uses. So `html` is enabled with the
other two.
- Multi-line text and address are untouched (ruling D3 A). No form or
record-page editor face changes, and the save model and undo are
unchanged.
## Tests
New pins:
- `fields` `inCellFaces-35688.test.tsx`, describe "in-cell rich-content
panel": the three types answer `hasInCellPanelEditWidget` true while
`hasFieldEditWidget` stays false and `isInlineExcludedFieldType` stays
true; no other type (text, textarea, address, password, secret, object,
file) is a panel; with `inCell` the widget is a TEXTAREA holding the
stored source, typing stages, and Enter reaches the grid's wrapper with
its default intact; without `inCell` the same field gets no editor.
- `plugin-grid` `ObjectGrid.cellSelection-35684.test.tsx`, describe "a
rich-content cell edits in a panel under it": markdown, HTML and rich
text each open `data-placement="below"` with the cell display still
drawn and no read-only reason; Enter writes nothing and keeps the panel;
Ctrl+Enter and Cmd+Enter each save one update and the cell stays
selected; Esc writes nothing; an outside pointer press saves.
- `plugin-grid` `relatedTab.cellEditing-36023.test.tsx` (new file, the
real chain `RelatedList` enlarged → `object-grid` → `data-table`): on
the related tab a select opens its list under the cell with its value
still drawn, Enter saves a text cell and the selection stays, and rich
text opens its panel where Enter is a new line and Ctrl+Enter saves.
Rewritten tests (the card asks for the list):
- `plugin-grid/src/inline-edit-options.test.ts`: "keeps a markdown cell
read-only — the detail row editor (objectui#11541) is not a grid one" is
replaced by "edits the rich-content types in a cell, in a panel under it
(objectstack#36023)", with a control that a `readonly` rich-text field
stays `readonly` and that `password`, `secret`, `object`, `file` stay
`notInline`.
- `plugin-grid/src/objectGridCellFacts-35684.test.ts`: the placement
test now lists `markdown`, `html`, `richtext` among the types that open
below, and a new pin "every rich-content type the display table serves
edits in a panel under the cell" walks `RICH_TEXT_FIELD_TYPES` and
asserts, for every entry, `hasInCellPanelEditWidget(t)` is true,
`inlineEditorPlacement(t)` is `'below'` and `fieldInlineReadOnlyKind({
type: t })` is null (plus a non-empty guard on the list).
- No screenshot baseline is invalidated.
`ObjectGrid.requiredPrompt-35956.test.tsx`'s "a field with no in-place
editor (rich text) asks nothing" still holds unchanged: the
required-fields prompt asks `hasFieldEditWidget`, which this PR does not
move.
## Acceptance notes
**Browser readings (rework round 1), Chromium at 1280 x 900, showcase
field zoo.** Stack: `objectstack dev --seed-admin --fresh` for
`examples/app-showcase` plus the console dev server, both from this
branch's head `bc9b5c23`. The zoo's default list does not show the rich
columns, so `f_markdown`, `f_html` and `f_richtext` were added to its
`columns` for the run only (uncommitted, reverted with `git checkout
HEAD --` afterwards; `git diff HEAD` empty). Row: "Specimen — Full". The
panel was opened by selecting the cell and pressing Enter, and closed
with Esc. Theme set through the console's own theme key; the root
element's class read `light` / `dark` on each pass.
| Type | Theme | Row height before | Row height, panel open | Row after
Esc | Cell (w x h) | Panel (w x h, at x,y) | Panel background |
|---|---|---|---|---|---|---|---|
| markdown | light | 45 | 45 | 45 | 167 x 45 | 330 x 188 at 828,207 |
rgb(255, 255, 255) |
| html | light | 45 | 45 | 45 | 143 x 45 | 330 x 188 at 942,207 |
rgb(255, 255, 255) |
| richtext | light | 45 | 45 | 45 | 143 x 45 | 330 x 188 at 942,207 |
rgb(255, 255, 255) |
| markdown | dark | 45 | 45 | 45 | 167 x 45 | 330 x 188 at 828,207 |
rgb(26, 26, 30) |
| html | dark | 45 | 45 | 45 | 143 x 45 | 330 x 188 at 942,207 | rgb(26,
26, 30) |
| richtext | dark | 45 | 45 | 45 | 143 x 45 | 330 x 188 at 942,207 |
rgb(26, 26, 30) |
- The row height does not move when the panel opens, in either theme,
for any of the three types; the panel starts 2 px under the cell's
bottom edge (cell bottom 205, panel top 207) and is gone after Esc.
- The panel is wider than the column (330 against 167 / 143). For html
and richtext, the two rightmost columns, it is shifted left to x 942 so
its right edge (1272) stays inside the 1280 viewport.
- The textarea holds the stored source, read from its value: the seed's
heading line and two list lines for markdown, and the raw markup (tags
included, not rendered) for html and richtext.
- Dark-theme look at the open panel (markdown and richtext screenshots
read): a dark panel with a violet focus ring, light monospace source
text, the selected cell outlined in violet above it, and the row and the
cell's drawn value unchanged behind it. No light-on-light or clipped
edge. Screenshots were kept local and not committed.
- Out of scope, seen during the reading and NOT fixed here: the markdown
cell draws the seed's `# Heading` at heading size, truncated to
"Headin…", and that row is 45 px against 36 px for the row without rich
values. That is the read-only display pipeline (`MarkdownCellRenderer`),
which this PR does not touch, and it is the same with the panel closed.
Reported to the seat in the os-dev report.
- The required-fields dialogs still do not offer a rich-text editor for
a rich-text field (they ask `hasFieldEditWidget`); unchanged on purpose,
out of this card's scope.
**Adjacent fix.** `ui/packages/plugin-grid/README.md` cited
`isFieldInlineEditable` as `src/inline-edit-options.ts:82`. This PR
edits that file, so the line number would point at other code; the
citation now reads `isFieldInlineEditable` in
`src/inline-edit-options.ts`, with no line number, so it cannot drift
again.
- Carried by #36360: seat 7's contract delta 7076344850 S2 (should-fix,
non-blocking: the plugin-grid and fields READMEs and the plugin-grid
docs page describe the panel and its keys without the select-first scope
the changeset now has) and N1 (nit: the changeset's "Before" sentence
and the `IN_CELL_PANEL_EDIT_WIDGETS` jsdoc). Text only; per the
maintainer's 2026-11-22T07:49Z direction, small later changes go on
their own card rather than another rework round.
## Verification
Two-minute check: open a list with a rich text column, click a rich text
cell, press Enter. Expected: a text box opens under the cell with the
stored source, the row does not grow, Enter adds a line, Ctrl+Enter
(Cmd+Enter) saves and the cell stays selected, Esc closes without
saving.
Read first (by risk):
1. `ui/packages/fields/src/FieldEditWidget.tsx`:
`IN_CELL_PANEL_EDIT_WIDGETS`, `hasInCellPanelEditWidget` and the
one-line `Widget` resolution in `FieldEditWidget` (the only path by
which the three types can reach any host, gated on `inCell`).
2. `ui/packages/plugin-grid/src/inline-edit-options.ts`: the carve-out
in `fieldInlineReadOnlyKind`, ordered after the binary/computed checks
and before the shared exclusion.
3. `ui/packages/plugin-grid/src/objectGridCellFacts.ts`:
`PANEL_EDITOR_FIELD_TYPES`.
The local test, ablation, gate and eager-closure readings are posted
with the os-dev report comments on #36023 (round 0 on `03473f46`; the
rework delta on `bc9b5c23`, with the narrowed test run 5 files / 85
tests passed).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5oY5WCqqqBMtn9qt7m)_
<!-- signed: repo:objectstack#4 · os-project-manager ·
session_01FEkQ5oY5WCqqqBMtn9qt7m -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4101f1f commit c297dff
13 files changed
Lines changed: 466 additions & 19 deletions
File tree
- .changeset
- content/docs/frontend/plugins
- ui/packages
- fields
- src
- __tests__
- plugin-grid
- src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
368 | 373 | | |
369 | 374 | | |
370 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
140 | 148 | | |
141 | 149 | | |
142 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
| |||
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
99 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
100 | 113 | | |
101 | 114 | | |
102 | 115 | | |
| 116 | + | |
103 | 117 | | |
104 | 118 | | |
105 | 119 | | |
| |||
193 | 207 | | |
194 | 208 | | |
195 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
196 | 233 | | |
197 | 234 | | |
198 | 235 | | |
| |||
239 | 276 | | |
240 | 277 | | |
241 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
242 | 290 | | |
243 | 291 | | |
244 | 292 | | |
| |||
377 | 425 | | |
378 | 426 | | |
379 | 427 | | |
380 | | - | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
381 | 432 | | |
382 | 433 | | |
383 | 434 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
458 | 461 | | |
459 | 462 | | |
460 | 463 | | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
994 | 994 | | |
995 | 995 | | |
996 | 996 | | |
997 | | - | |
| 997 | + | |
998 | 998 | | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
999 | 1003 | | |
1000 | 1004 | | |
1001 | 1005 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
803 | 803 | | |
804 | 804 | | |
805 | 805 | | |
| 806 | + | |
| 807 | + | |
806 | 808 | | |
807 | 809 | | |
808 | 810 | | |
809 | 811 | | |
810 | 812 | | |
811 | | - | |
812 | 813 | | |
813 | 814 | | |
814 | 815 | | |
| |||
3627 | 3628 | | |
3628 | 3629 | | |
3629 | 3630 | | |
3630 | | - | |
| 3631 | + | |
| 3632 | + | |
3631 | 3633 | | |
3632 | 3634 | | |
3633 | 3635 | | |
| |||
0 commit comments