mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22: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 { 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 type { IOMode } from "../lib";
|
||||||
import { hideAllGuessOne } from "../store";
|
import { hideAllGuessOne } from "../store";
|
||||||
import type { PageLoad } from "./$types";
|
import type { PageLoad } from "./$types";
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { addImageOcclusionNote, updateImageOcclusionNote } from "@generated/back
|
||||||
import * as tr from "@generated/ftl";
|
import * as tr from "@generated/ftl";
|
||||||
import { get } from "svelte/store";
|
import { get } from "svelte/store";
|
||||||
|
|
||||||
|
import { mount } from "svelte";
|
||||||
import type { IOMode } from "./lib";
|
import type { IOMode } from "./lib";
|
||||||
import { exportShapesToClozeDeletions } from "./shapes/to-cloze";
|
import { exportShapesToClozeDeletions } from "./shapes/to-cloze";
|
||||||
import { notesDataStore, tagsWritable } from "./store";
|
import { notesDataStore, tagsWritable } from "./store";
|
||||||
|
@ -52,19 +53,24 @@ export const addOrUpdateNote = async function(
|
||||||
|
|
||||||
// show toast message
|
// show toast message
|
||||||
const showResult = (noteId: number | null, result: OpChanges, count: number) => {
|
const showResult = (noteId: number | null, result: OpChanges, count: number) => {
|
||||||
const toastComponent = new Toast({
|
const props = $state({
|
||||||
|
message: "",
|
||||||
|
type: "error" as "error" | "success",
|
||||||
|
showToast: true,
|
||||||
|
});
|
||||||
|
mount(Toast, {
|
||||||
target: document.body,
|
target: document.body,
|
||||||
props: {
|
props,
|
||||||
message: "",
|
|
||||||
type: "error",
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.note) {
|
if (result.note) {
|
||||||
const msg = noteId ? tr.browsingCardsUpdated({ count: count }) : tr.importingCardsAdded({ count: count });
|
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 {
|
} else {
|
||||||
const msg = tr.notetypesErrorGeneratingCloze();
|
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 { checkNightMode } from "@tslib/nightmode";
|
||||||
import { get } from "svelte/store";
|
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 ImageOcclusionPage from "./ImageOcclusionPage.svelte";
|
||||||
import type { IOMode } from "./lib";
|
import type { IOMode } from "./lib";
|
||||||
import { hideAllGuessOne } from "./store";
|
import { hideAllGuessOne } from "./store";
|
||||||
|
|
Loading…
Reference in a new issue