mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 05:07:10 -05:00
Preserve initial note load args
This commit is contained in:
parent
224ea3abb1
commit
5e9428cd26
1 changed files with 10 additions and 23 deletions
|
|
@ -102,6 +102,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import { CooldownTimer } from "$lib/editable/cooldown-timer";
|
import { CooldownTimer } from "$lib/editable/cooldown-timer";
|
||||||
|
|
||||||
const loadDebouncer = new CooldownTimer(200);
|
const loadDebouncer = new CooldownTimer(200);
|
||||||
|
let initialLoadArgs: Partial<LoadNoteArgs> | null = null;
|
||||||
let contextMenu: ContextMenu;
|
let contextMenu: ContextMenu;
|
||||||
const [onContextMenu, contextMenuItems] = setupContextMenu();
|
const [onContextMenu, contextMenuItems] = setupContextMenu();
|
||||||
let contextMenuInput: EditingInputAPI | null = null;
|
let contextMenuInput: EditingInputAPI | null = null;
|
||||||
|
|
@ -1175,34 +1176,20 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
triggerChanges();
|
triggerChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadNote({
|
async function loadNote(args: Partial<LoadNoteArgs>) {
|
||||||
nid = note?.id,
|
if(args.initial) {
|
||||||
notetypeId = notetypeMeta ? notetypeMeta.id : null,
|
initialLoadArgs = args;
|
||||||
deckId = null,
|
}
|
||||||
focusTo = focusedFieldIndex,
|
|
||||||
originalNoteId = null,
|
|
||||||
reviewerCardId = reviewerCard ? reviewerCard.id : null,
|
|
||||||
initial = false,
|
|
||||||
copyFromNote = null,
|
|
||||||
stickyFieldsFrom = null,
|
|
||||||
}: Partial<LoadNoteArgs> = {}) {
|
|
||||||
loadDebouncer.schedule(async () => {
|
loadDebouncer.schedule(async () => {
|
||||||
await loadNoteInner({
|
await loadNoteInner(initialLoadArgs ? {
|
||||||
nid,
|
...initialLoadArgs,
|
||||||
notetypeId,
|
...args,
|
||||||
deckId,
|
} as LoadNoteArgs : args as LoadNoteArgs);
|
||||||
focusTo,
|
|
||||||
originalNoteId,
|
|
||||||
reviewerCardId,
|
|
||||||
initial,
|
|
||||||
copyFromNote,
|
|
||||||
stickyFieldsFrom,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function reloadNote() {
|
async function reloadNote() {
|
||||||
await loadNote();
|
await loadNote(initialLoadArgs!);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function reloadNoteIfEmpty(deckId: bigint | null, notetypeId: bigint | null) {
|
async function reloadNoteIfEmpty(deckId: bigint | null, notetypeId: bigint | null) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue