Skip to content

Extend chevron expand + diff view to text / longtext cells #207

@NewtTheWolf

Description

@NewtTheWolf

Context

In the data grid, JSON / JSONB cells now have two affordances:

  • A chevron that expands the row inline with an editor pane.
  • A Diff toggle (in the expansion editor, in the JSON viewer window, and in the row-editor sidebar) that shows a Monaco unified diff between the original cell value and the pending edit.

This was added in PR #181 / the feat/json-jsonb-editor-viewer work.

Problem

The same affordances would be just as useful — arguably more so — for plain text cells, especially text / longtext / varchar(max) columns that frequently hold long multi-line content (markdown, code snippets, notes, comments). Today these are stuck with the small inline edit input or the sidebar's plain textarea, and there is no way to see what changed before committing.

Proposal

Treat any string-typed column whose value is long enough to be cumbersome inline as eligible for:

  1. Chevron expand — opens an inline expansion editor below the row, identical UX to the JSON case but backed by a plain Monaco text editor (no JSON parsing / validation).
  2. Diff view — same Monaco DiffEditor (inline / unified), comparing the original cell value against the pending edit. Default-on in the inline expansion, off-with-toggle in the editor window and sidebar, matching JSON behavior.

Implementation pointers:

  • The cell-render branch in src/components/ui/DataGrid.tsx currently gates on isJsonCellTarget(colType, value). A parallel `isLongTextCellTarget` (column is text-like AND value length above a threshold, e.g. > 80 chars or contains a newline) could route to a sibling `TextCell` component mirroring `JsonCell`.
  • `JsonExpansionEditor` could be generalized into a `CellExpansionEditor` that takes a language prop ("json" | "plaintext"), reusing the existing Diff toggle plumbing.
  • The window-open path (`open_json_viewer_window` / `JsonViewerPage`) could be renamed / extended to a generic cell viewer, or a parallel text-viewer command added — either way the `JsonViewerSession.original_value` plumbing is the same shape.
  • Sidebar `FieldEditor` already receives `originalValue`; it would just need to pass it through to whatever text-input component handles long strings, plus the Diff toggle option.

Out of scope

  • Markdown / code rendering inside the diff (use plain Monaco).
  • BLOB columns (already routed to BlobInput with its own affordance).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions