Formatting

This commit is contained in:
Abdo 2025-10-19 08:41:03 +03:00
parent f9607ce8af
commit 7113648a3f

View file

@ -992,11 +992,21 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
stickyFieldsFrom, stickyFieldsFrom,
}: LoadNoteArgs) { }: LoadNoteArgs) {
// Convert values coming from Python // Convert values coming from Python
if(nid) nid = BigInt(nid); if (nid) {
if(notetypeId) notetypeId = BigInt(notetypeId); nid = BigInt(nid);
if(deckId) deckId = BigInt(deckId); }
if(originalNoteId) originalNoteId = BigInt(originalNoteId); if (notetypeId) {
if(reviewerCardId) reviewerCardId = BigInt(reviewerCardId); notetypeId = BigInt(notetypeId);
}
if (deckId) {
deckId = BigInt(deckId);
}
if (originalNoteId) {
originalNoteId = BigInt(originalNoteId);
}
if (reviewerCardId) {
reviewerCardId = BigInt(reviewerCardId);
}
let homeDeckId = 0n; let homeDeckId = 0n;
if (reviewerCardId) { if (reviewerCardId) {
@ -1012,9 +1022,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
nid: originalNoteId, nid: originalNoteId,
}); });
selectedNotetypeId = originalNote.notetypeId; selectedNotetypeId = originalNote.notetypeId;
selectedDeckId = (await defaultDeckForNotetype({ ntid: originalNote.notetypeId })).did; selectedDeckId = (
} await defaultDeckForNotetype({ ntid: originalNote.notetypeId })
else if (initial) { ).did;
} else if (initial) {
const chooserDefaults = await defaultsForAdding({ const chooserDefaults = await defaultsForAdding({
homeDeckOfCurrentReviewCard: homeDeckId, homeDeckOfCurrentReviewCard: homeDeckId,
}); });
@ -1028,7 +1039,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
if (notetypeId) { if (notetypeId) {
selectedNotetypeId = BigInt(notetypeId); selectedNotetypeId = BigInt(notetypeId);
} }
if(mode === "add") { if (mode === "add") {
deckChooser.select(selectedDeckId!); deckChooser.select(selectedDeckId!);
notetypeChooser.select(selectedNotetypeId!); notetypeChooser.select(selectedNotetypeId!);
} }
@ -1197,17 +1208,21 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
} }
async function loadNote(args: Partial<LoadNoteArgs>) { async function loadNote(args: Partial<LoadNoteArgs>) {
if(args.initial) { if (args.initial) {
initialLoadArgs = args; initialLoadArgs = args;
} }
if(typeof args.focusTo === "undefined") { if (typeof args.focusTo === "undefined") {
args.focusTo = focusedFieldIndex; args.focusTo = focusedFieldIndex;
} }
loadDebouncer.schedule(async () => { loadDebouncer.schedule(async () => {
await loadNoteInner(initialLoadArgs ? { await loadNoteInner(
...initialLoadArgs, initialLoadArgs
...args, ? ({
} as LoadNoteArgs : args as LoadNoteArgs); ...initialLoadArgs,
...args,
} as LoadNoteArgs)
: (args as LoadNoteArgs),
);
}); });
} }