mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
Fix inability to save occlusions on mobile
This commit is contained in:
parent
bf46a5f08c
commit
740d95d53f
3 changed files with 15 additions and 9 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
import { get } from "svelte/store";
|
||||
|
||||
import { addOrUpdateNote } from "../add-or-update-note";
|
||||
import { addOrUpdateNote } from "../add-or-update-note.svelte";
|
||||
import type { IOMode } from "../lib";
|
||||
import { hideAllGuessOne } from "../store";
|
||||
import type { PageLoad } from "./$types";
|
||||
|
|
|
@ -6,6 +6,7 @@ import { addImageOcclusionNote, updateImageOcclusionNote } from "@generated/back
|
|||
import * as tr from "@generated/ftl";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
import { mount } from "svelte";
|
||||
import type { IOMode } from "./lib";
|
||||
import { exportShapesToClozeDeletions } from "./shapes/to-cloze";
|
||||
import { notesDataStore, tagsWritable } from "./store";
|
||||
|
@ -52,19 +53,24 @@ export const addOrUpdateNote = async function(
|
|||
|
||||
// show toast message
|
||||
const showResult = (noteId: number | null, result: OpChanges, count: number) => {
|
||||
const toastComponent = new Toast({
|
||||
target: document.body,
|
||||
props: {
|
||||
const props = $state({
|
||||
message: "",
|
||||
type: "error",
|
||||
},
|
||||
type: "error" as "error" | "success",
|
||||
showToast: true,
|
||||
});
|
||||
mount(Toast, {
|
||||
target: document.body,
|
||||
props,
|
||||
});
|
||||
|
||||
if (result.note) {
|
||||
const msg = noteId ? tr.browsingCardsUpdated({ count: count }) : tr.importingCardsAdded({ count: count });
|
||||
toastComponent.$set({ message: msg, type: "success", showToast: true });
|
||||
props.message = msg;
|
||||
props.type = "success";
|
||||
props.showToast = true;
|
||||
} else {
|
||||
const msg = tr.notetypesErrorGeneratingCloze();
|
||||
toastComponent.$set({ message: msg, showToast: true });
|
||||
props.message = msg;
|
||||
props.showToast = true;
|
||||
}
|
||||
};
|
|
@ -7,7 +7,7 @@ import { ModuleName, setupI18n } from "@tslib/i18n";
|
|||
import { checkNightMode } from "@tslib/nightmode";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
import { addOrUpdateNote } from "./add-or-update-note";
|
||||
import { addOrUpdateNote } from "./add-or-update-note.svelte";
|
||||
import ImageOcclusionPage from "./ImageOcclusionPage.svelte";
|
||||
import type { IOMode } from "./lib";
|
||||
import { hideAllGuessOne } from "./store";
|
||||
|
|
Loading…
Reference in a new issue