mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 05:07:10 -05:00
Fix notetype changing after changes to fields
This commit is contained in:
parent
12769460ba
commit
3a0c3ef4e7
1 changed files with 8 additions and 13 deletions
|
|
@ -314,10 +314,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
let notetypeChooser: NotetypeChooser;
|
let notetypeChooser: NotetypeChooser;
|
||||||
let deckChooser: DeckChooser;
|
let deckChooser: DeckChooser;
|
||||||
|
|
||||||
async function onNotetypeChange(notetypeId: bigint, updateDeck: boolean = true) {
|
async function onNotetypeChange(notetypeId: bigint) {
|
||||||
loadNote({ notetypeId, copyFromNote: note });
|
loadNote({ notetypeId, copyFromNote: note });
|
||||||
if (
|
if (
|
||||||
updateDeck &&
|
|
||||||
!(
|
!(
|
||||||
await getConfigBool({
|
await getConfigBool({
|
||||||
key: ConfigKey_Bool.ADDING_DEFAULTS_TO_CURRENT_DECK,
|
key: ConfigKey_Bool.ADDING_DEFAULTS_TO_CURRENT_DECK,
|
||||||
|
|
@ -1034,10 +1033,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (deckId) {
|
if (deckId) {
|
||||||
selectedDeckId = BigInt(deckId);
|
selectedDeckId = deckId;
|
||||||
}
|
}
|
||||||
if (notetypeId) {
|
if (notetypeId) {
|
||||||
selectedNotetypeId = BigInt(notetypeId);
|
selectedNotetypeId = notetypeId;
|
||||||
|
}
|
||||||
|
if(!selectedNotetypeId && copyFromNote) {
|
||||||
|
selectedNotetypeId = copyFromNote?.notetypeId;
|
||||||
}
|
}
|
||||||
if (mode === "add") {
|
if (mode === "add") {
|
||||||
deckChooser.select(selectedDeckId!);
|
deckChooser.select(selectedDeckId!);
|
||||||
|
|
@ -1253,15 +1255,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
async function onOperationDidExecute(changes: Partial<OpChanges>) {
|
async function onOperationDidExecute(changes: Partial<OpChanges>) {
|
||||||
if (mode === "add" && (changes.notetype || changes.deck)) {
|
if (mode === "add" && (changes.notetype || changes.deck)) {
|
||||||
let homeDeckId = 0n;
|
loadNote({ copyFromNote: note });
|
||||||
if (reviewerCard) {
|
lastAddedNote = null;
|
||||||
homeDeckId = reviewerCard.originalDeckId || reviewerCard.deckId;
|
|
||||||
}
|
|
||||||
const chooserDefaults = await defaultsForAdding({
|
|
||||||
homeDeckOfCurrentReviewCard: homeDeckId,
|
|
||||||
});
|
|
||||||
notetypeChooser.select(chooserDefaults.notetypeId);
|
|
||||||
onNotetypeChange(chooserDefaults.notetypeId, false);
|
|
||||||
} else if (mode !== "add" && changes.noteText) {
|
} else if (mode !== "add" && changes.noteText) {
|
||||||
reloadNote();
|
reloadNote();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue