Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
629270d
docs: add approved inline text editing design spec
DavidBabinec Jun 10, 2026
f975e9a
feat(module-engine): add inlineTextEdit contract, declare on text/but…
DavidBabinec Jun 10, 2026
a0a7f24
feat(editor-store): add inline text edit session slice with coalesced…
DavidBabinec Jun 10, 2026
6bfcbf6
feat(editor-store): force-close inline edit sessions on deletion and …
DavidBabinec Jun 11, 2026
20edb1d
feat(canvas): add inline-edit typography mirroring helpers
DavidBabinec Jun 11, 2026
6bad4b7
feat(canvas): add InlineTextEditOverlay, mounted per breakpoint frame
DavidBabinec Jun 11, 2026
ee59e9f
feat(canvas): wire double-click inline editing and hide doubled text
DavidBabinec Jun 11, 2026
41b2575
docs: document canvas inline text editing (parent-doc overlay)
DavidBabinec Jun 11, 2026
a617084
docs: fix remaining stale slice counts in editor.md (11 -> 12)
DavidBabinec Jun 11, 2026
83bf384
docs: fix stale slice count in adminUi header comment (11 -> 12)
DavidBabinec Jun 11, 2026
7447335
Merge origin/main into feat/inline-text-editing
DavidBabinec Jun 11, 2026
6cfeb1a
fix(canvas): render canvas + inline-edit field in the site's fonts, n…
DavidBabinec Jun 11, 2026
61b3457
fix(canvas): stop inline-edit field scroll-shifting multi-line text
DavidBabinec Jun 11, 2026
b7b265a
fix(canvas): remove inline-edit open flash by positioning in a layout…
DavidBabinec Jun 11, 2026
a23853d
feat(canvas): rewrite inline text editing to edit the real element in…
DavidBabinec Jun 11, 2026
84b59ea
fix(canvas): stop React clobbering the inline-edit caret every keystroke
DavidBabinec Jun 11, 2026
4fe6f20
fix(canvas): let the spacebar type a space during inline editing
DavidBabinec Jun 11, 2026
3486ff0
fix(canvas): finalize inline editing — keyboard-forward guard, select…
DavidBabinec Jun 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(editor-store): force-close inline edit sessions on deletion and …
…doc switch

clearCanvasSelectionDraft (page/VC/document switches) and
pruneCanvasSelectionDraft (node deletion, incl. swept descendants) now
clear activeInlineEdit, funnelling every stale-session path through the
same helpers the selection already uses.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
  • Loading branch information
DavidBabinec and claude committed Jun 11, 2026
commit 6bfcbf6545a490067387ce4bfa34972b05e62ec3
39 changes: 39 additions & 0 deletions src/__tests__/editor-store/inlineEditSlice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,42 @@ describe('cancelInlineEdit', () => {
expect(nodeText(nodeId)).toBe('Hello')
})
})

describe('force-close', () => {
it('clears the session when the edited node is deleted', () => {
const { nodeId } = setupSiteWithTextNode()
useEditorStore.getState().startInlineEdit(nodeId, 'bp')
useEditorStore.getState().deleteNode(nodeId)
expect(useEditorStore.getState().activeInlineEdit).toBeNull()
})

it('clears the session when the edited node is swept with a deleted ancestor', () => {
const store = useEditorStore.getState()
const site = store.createSite('Inline Edit Test Site')
const rootId = site.pages[0].rootNodeId
const containerId = useEditorStore.getState().insertNode('base.container', {}, rootId)
const textId = useEditorStore.getState().insertNode('base.text', { text: 'Hi' }, containerId)
useEditorStore.getState().startInlineEdit(textId, 'bp')
expect(useEditorStore.getState().activeInlineEdit).not.toBeNull()
useEditorStore.getState().deleteNode(containerId)
expect(useEditorStore.getState().activeInlineEdit).toBeNull()
})

it('clears the session on page switch', () => {
const { nodeId, pageId } = setupSiteWithTextNode()
// addPage activates the new page — hop back before starting the session.
const pageB = useEditorStore.getState().addPage('Second', 'second')
useEditorStore.getState().openPageInCanvas(pageId)
useEditorStore.getState().startInlineEdit(nodeId, 'bp')
expect(useEditorStore.getState().activeInlineEdit).not.toBeNull()
useEditorStore.getState().openPageInCanvas(pageB.id)
expect(useEditorStore.getState().activeInlineEdit).toBeNull()
})

it('clears the session on active-document switch', () => {
const { nodeId } = setupSiteWithTextNode()
useEditorStore.getState().startInlineEdit(nodeId, 'bp')
useEditorStore.getState().setActiveDocument({ kind: 'visualComponent', vcId: 'vc-x' })
expect(useEditorStore.getState().activeInlineEdit).toBeNull()
})
})
10 changes: 10 additions & 0 deletions src/admin/pages/site/store/slices/selectionSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ export function clearCanvasSelectionDraft(state: EditorStore): void {
state.hoveredNodeId = null
state.hoveredBreakpointId = null
state.activeClassId = null
// A document/page switch invalidates any inline text-edit session — the
// node it points at is no longer on the canvas. Live keystrokes already
// committed; clearing here is the spec's "force-close without committing".
state.activeInlineEdit = null
}

/**
Expand All @@ -209,6 +213,12 @@ export function clearCanvasSelectionDraft(state: EditorStore): void {
*/
export function pruneCanvasSelectionDraft(state: EditorStore): void {
const tree = getActiveTree(state)
// Inline edit prunes by tree-membership too — the edited node may be a
// descendant swept away with a deleted subtree, and it may not be part of
// the selection at all, so this must run before the early return below.
if (state.activeInlineEdit && !tree?.nodes[state.activeInlineEdit.nodeId]) {
state.activeInlineEdit = null
}
const surviving = tree
? state.selectedNodeIds.filter((id) => Boolean(tree.nodes[id]))
: []
Expand Down