fix(editor): one history entry per reference edit, focus kept
Final review fixes. « Terminer » and every panel close re-committed the edited field against a stale value, adding a second identical history entry so the first « Défaire » seemed to do nothing: the tile now reads the latest applied value (tests assert the undo-length delta). A tile leaving the search on « Terminer » stays pinned until the next view change and keeps focus; « Ajouter la référence » resets search and sort and focuses the new tile. Also: refused draft dropped on a read-only flip is announced; arrow keys respect a refused tab switch; pinned index kept across read-only; the panel announces « Références citées »; search text inserted literally; « Aller à » names its citer; the edit header's name starts with « Terminer. »; undo removing the focused panel tile moves focus per P20; no-result announced once; docs corrected. Gates: typecheck, lint, test:run (app 1510), build, e2e:ui 251; e2e:shell 16 specs (admin and editor-equine excluded): 117 passed / 108 skipped / 1 failed (crossing:211 stuck on the MFA step-up screen before the editor), rerun alone 11 passed; full-row guard: no pre-existing row changed in any table.
This commit is contained in:
1 parent
2182307c62
commit
1bf27014b3
21 files changed
+677
-136
No files matched your search
@@ -20,8 +20,12 @@ export function useReferenceLibrary(readOnly: boolean, resetSignal: number) {
|
||||
const keys = tileKeys(all)
|
||||
const tiles = useTileState(doc ? keys : null)
|
||||
const citers = doc ? citersOf(doc) : NO_CITERS
|
||||
const editedAt = readOnly ? -1 : keys.indexOf(tiles.editingKey ?? '')
|
||||
const shown = useReferenceView(all, citers, editedAt, resetSignal)
|
||||
const shown = useReferenceView(
|
||||
{ all, keys, citers },
|
||||
tiles.editingKey,
|
||||
readOnly,
|
||||
resetSignal,
|
||||
)
|
||||
return { loaded: doc !== null, all, keys, tiles, citers, shown }
|
||||
}
|
||||
export type ReferenceLibraryState = ReturnType<typeof useReferenceLibrary>
|
||||
@@ -85,13 +89,15 @@ export function useReferenceActions(
|
||||
shown.reset()
|
||||
setDraft((serial) => (serial ?? 0) + 1)
|
||||
},
|
||||
// P24: the new tile is shown whatever was typed meanwhile, so the view is reset.
|
||||
added: (id: string) => {
|
||||
setDraft(null)
|
||||
shown.reset()
|
||||
tiles.reveal(`${id}#0`)
|
||||
later({ kind: 'reference', id })
|
||||
},
|
||||
edit: (position: number) => {
|
||||
if (tiles.startEdit(keys[position])) shown.markEdited(position)
|
||||
if (tiles.startEdit(keys[position])) shown.markEdited(keys[position])
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user