Keep the keyboard on the grid after the formula bar; editor uses cell colours
- Enter/Escape in the formula bar (and a jump via the Name Box) hand the focus back to the table of the selection, so the arrow keys move the active cell again instead of doing nothing. - The in-cell editor takes the cell's own text/fill colour and bold/ italic, so a light-on-dark cell no longer turns into dark text on a dark fill while editing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -66,7 +66,7 @@ function onNameInput() {
|
||||
* in this app. */
|
||||
function jumpTo(text: string) {
|
||||
if (store.jumpToNameInput(text)) {
|
||||
(document.activeElement as HTMLElement)?.blur();
|
||||
backToGrid();
|
||||
} else {
|
||||
toast.error(`„${text}" ist kein gültiger Bezug oder Name.`);
|
||||
nextTick(() => nameEl.value?.select());
|
||||
@@ -102,6 +102,15 @@ function onNameKeydown(e: KeyboardEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
/** Leave the bar and hand the keyboard back to the grid of the selected
|
||||
* table, so the arrow keys move the active cell again (just blurring
|
||||
* would leave nothing focused). */
|
||||
function backToGrid() {
|
||||
(document.activeElement as HTMLElement)?.blur();
|
||||
const tableId = store.doc.selection?.tableId;
|
||||
if (tableId) window.dispatchEvent(new CustomEvent('numolus:focus-grid', { detail: tableId }));
|
||||
}
|
||||
|
||||
function commit() {
|
||||
const sel = store.doc.selection;
|
||||
if (sel) store.setCellInput(sel.tableId, sel.anchor.col, sel.anchor.row, draft.value);
|
||||
@@ -134,7 +143,7 @@ function onFocus() {
|
||||
}
|
||||
function onEnter() {
|
||||
commit();
|
||||
(document.activeElement as HTMLElement)?.blur();
|
||||
backToGrid();
|
||||
}
|
||||
function onBlur() {
|
||||
focused.value = false;
|
||||
@@ -144,7 +153,7 @@ function onBlur() {
|
||||
}
|
||||
function onEscape() {
|
||||
draft.value = store.activeCellInput.value;
|
||||
(document.activeElement as HTMLElement)?.blur();
|
||||
backToGrid();
|
||||
}
|
||||
/** Actual typing (not a point-mode click inserting a reference programmatically)
|
||||
* ends the "next click replaces the last reference" window. */
|
||||
|
||||
Reference in New Issue
Block a user