mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Preserve focused field
This commit is contained in:
parent
e3bd3eda4f
commit
06d322aca4
1 changed files with 4 additions and 1 deletions
|
@ -1151,7 +1151,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
nid = note?.id,
|
nid = note?.id,
|
||||||
notetypeId = notetypeMeta ? notetypeMeta.id : null,
|
notetypeId = notetypeMeta ? notetypeMeta.id : null,
|
||||||
deckId = null,
|
deckId = null,
|
||||||
focusTo = 0,
|
focusTo = focusedFieldIndex,
|
||||||
originalNoteId = null,
|
originalNoteId = null,
|
||||||
reviewerCardId = reviewerCard ? reviewerCard.id : null,
|
reviewerCardId = reviewerCard ? reviewerCard.id : null,
|
||||||
initial = false,
|
initial = false,
|
||||||
|
@ -1287,6 +1287,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
const hoveredField: NoteEditorAPI["hoveredField"] = writable(null);
|
const hoveredField: NoteEditorAPI["hoveredField"] = writable(null);
|
||||||
const focusedField: NoteEditorAPI["focusedField"] = writable(null);
|
const focusedField: NoteEditorAPI["focusedField"] = writable(null);
|
||||||
const focusedInput: NoteEditorAPI["focusedInput"] = writable(null);
|
const focusedInput: NoteEditorAPI["focusedInput"] = writable(null);
|
||||||
|
let focusedFieldIndex = 0;
|
||||||
|
|
||||||
const api: NoteEditorAPI = {
|
const api: NoteEditorAPI = {
|
||||||
...apiPartial,
|
...apiPartial,
|
||||||
|
@ -1401,11 +1402,13 @@ components and functionality for general note editing.
|
||||||
api={fields[index]}
|
api={fields[index]}
|
||||||
on:focusin={() => {
|
on:focusin={() => {
|
||||||
$focusedField = fields[index];
|
$focusedField = fields[index];
|
||||||
|
focusedFieldIndex = index;
|
||||||
setAddonButtonsDisabled(false);
|
setAddonButtonsDisabled(false);
|
||||||
bridgeCommand(`focus:${index}`);
|
bridgeCommand(`focus:${index}`);
|
||||||
}}
|
}}
|
||||||
on:focusout={async () => {
|
on:focusout={async () => {
|
||||||
$focusedField = null;
|
$focusedField = null;
|
||||||
|
focusedFieldIndex = 0;
|
||||||
setAddonButtonsDisabled(true);
|
setAddonButtonsDisabled(true);
|
||||||
if (isLegacy) {
|
if (isLegacy) {
|
||||||
bridgeCommand(
|
bridgeCommand(
|
||||||
|
|
Loading…
Reference in a new issue