feat(inspector): insert rows and confirm data-bearing deletes in the CSV editor#1939
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f95836905
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| registerUndo { document in | ||
| document.removeRow(at: index, suppressUndo: false) | ||
| } | ||
| setUndoActionName(String(localized: "Add Row")) |
There was a problem hiding this comment.
When rows are pasted, handlePasteRows opens an undo group and sets its action name to Paste, but each pasted row now calls appendRow(). This assignment overwrites the enclosing group's name, so a multi-row paste is presented to users as “Undo Add Row” rather than “Undo Paste”; restore the group name after the append operations or avoid setting an action name from appendRow while a caller owns the group.
Useful? React with 👍 / 👎.
| case #selector(saveDocument(_:)), #selector(saveDocumentAs(_:)), | ||
| #selector(toggleInspectorFilter(_:)), #selector(inspectorAddRow(_:)): | ||
| #selector(toggleInspectorFilter(_:)), #selector(inspectorAddRow(_:)), | ||
| #selector(inspectorInsertRowAbove(_:)), #selector(inspectorInsertRowBelow(_:)): | ||
| return nsDocument != nil |
There was a problem hiding this comment.
Require a selected row for Edit-menu insertion
The Edit-menu insert commands validate whenever an inspector document exists, even with no selected row. In that state insertStoreIndex falls back to index 0 for Above and rowCount for Below, so invoking commands documented to act on the selected row silently inserts at the beginning or end instead. Disable these actions unless a row is selected (or make the empty-table behavior explicit).
Useful? React with 👍 / 👎.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1f8e5a5ff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| document.reinsertRow(removed, at: index) | ||
| document.reinsertRow(removed, at: index, actionName: actionName) | ||
| } | ||
| setUndoActionName(actionName) |
There was a problem hiding this comment.
Preserve Paste name when generating redo
The initial undo label is now restored after the paste loop, but undoing a multi-row paste executes each appendRow undo handler, which calls this method and changes the redo group's action name to Add Row. Consequently, after Undo Paste, the Edit menu presents the next action as “Redo Add Row” rather than “Redo Paste”; the enclosing paste group needs to retain or restore its name while its inverse actions are registered.
Useful? React with 👍 / 👎.
|
Addressed a code review of this PR. Findings and fixes:
|
Part 1 of 4 toward #1469 (CSV structural editing). Focused on rows.
What
Why
The CSV inspector (from #1259, extended by #1913/#1932) can edit cells and add/remove columns, but the only way to add a row was the toolbar Add Row button, which always appends. There was no way to insert at a position, and deletes had no guard for data-bearing rows. This closes the row half of #1469.
How (native / HIG)
dataGridRowStructureMenuItems(forRow:)delegate seam, mirroring the column seam feat(inspector): add column header context menu to rename, insert, and delete columns #1932 added. Only the CSV inspector implements it, so database grids are unaffected.NSApp.sendAction(_:to:nil)) to the focused inspector, gated onkeyWindowIsInspector, matching the existing Undo/Redo/Find routing.CSVDocument.insertRow(at:)(already undoable); delete adds a confirm-when-non-empty gate. Per Apple's HIG, undoable deletes normally don't need a prompt, so the prompt is scoped to data-bearing rows and its copy does not claim the action is irreversible.displayToStore, respecting the filtered/sorted-view invariant (a display row is not a store row).Tests
CSVRowStore.insertRowat a middle index, at the top, clamped past the end, and padding a short row.InspectorRowMenuBuilderitem order, action wiring, and row tagging.InspectorDeleteConfirmation.rowsContainData/rowDeleteTitledecision logic.Docs / changelog
docs/features/csv-inspector.mdxEditing section updated.[Unreleased].Needs a local Xcode build to confirm compilation (CI lints
TablePro/only, which passes--strict).