diff --git a/ftl/core/editing.ftl b/ftl/core/editing.ftl
index d2c5c46b9..8c33782e0 100644
--- a/ftl/core/editing.ftl
+++ b/ftl/core/editing.ftl
@@ -93,6 +93,8 @@ editing-image-occlusion-ellipse-tool = Ellipse
editing-image-occlusion-polygon-tool = Polygon
editing-image-occlusion-text-tool = Text
editing-image-occlusion-toggle-mask-editor = Toggle Mask Editor
+editing-image-occlusion-reset = Reset Image Occlusion
+editing-image-occlusion-confirm-reset = Are you sure you want to reset this image occlusion?
## You don't need to translate these strings, as they will be replaced with different ones soon.
diff --git a/proto/anki/image_occlusion.proto b/proto/anki/image_occlusion.proto
index fdab4e139..01caf00ca 100644
--- a/proto/anki/image_occlusion.proto
+++ b/proto/anki/image_occlusion.proto
@@ -74,6 +74,7 @@ message GetImageOcclusionNoteResponse {
string header = 3;
string back_extra = 4;
repeated string tags = 5;
+ string image_file_name = 6;
}
oneof value {
diff --git a/rslib/src/image_occlusion/imagedata.rs b/rslib/src/image_occlusion/imagedata.rs
index 17613344c..1e354c213 100644
--- a/rslib/src/image_occlusion/imagedata.rs
+++ b/rslib/src/image_occlusion/imagedata.rs
@@ -110,6 +110,12 @@ impl Collection {
if self.is_image_file(&final_path)? {
cloze_note.image_data = read_file(&final_path)?;
+ cloze_note.image_file_name = final_path
+ .file_name()
+ .or_not_found("expected filename")?
+ .to_str()
+ .unwrap()
+ .to_string();
}
Ok(cloze_note)
diff --git a/ts/editor/NoteEditor.svelte b/ts/editor/NoteEditor.svelte
index 17ba6e437..4e7318fa7 100644
--- a/ts/editor/NoteEditor.svelte
+++ b/ts/editor/NoteEditor.svelte
@@ -388,13 +388,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import ImageOcclusionPicker from "image-occlusion/ImageOcclusionPicker.svelte";
import type { IOMode } from "image-occlusion/lib";
import { exportShapesToClozeDeletions } from "image-occlusion/shapes/to-cloze";
- import { hideAllGuessOne, ioMaskEditorVisible } from "image-occlusion/store";
+ import {
+ hideAllGuessOne,
+ ioImageLoadedStore,
+ ioMaskEditorVisible,
+ } from "image-occlusion/store";
import { mathjaxConfig } from "../editable/mathjax-element";
import CollapseLabel from "./CollapseLabel.svelte";
import * as oldEditorAdapter from "./old-editor-adapter";
- let isIOImageLoaded = false;
+ $: isIOImageLoaded = false;
+ $: ioImageLoadedStore.set(isIOImageLoaded);
let imageOcclusionMode: IOMode | undefined;
let ioFields = new ImageOcclusionFieldIndexes({});
@@ -456,6 +461,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
function resetIOImageLoaded() {
isIOImageLoaded = false;
globalThis.canvas.clear();
+ globalThis.canvas = undefined;
const page = document.querySelector(".image-occlusion");
if (page) {
page.remove();
@@ -791,6 +797,7 @@ the AddCards dialog) should be implemented in the user of this component.
}
:global(.top-tool-bar-container .icon-button) {
height: 36px !important;
+ line-height: 1;
}
:global(.image-occlusion .tool-bar-container) {
top: unset !important;
diff --git a/ts/editor/editor-toolbar/ImageOcclusionButton.svelte b/ts/editor/editor-toolbar/ImageOcclusionButton.svelte
index 6f018fe91..72f80e89f 100644
--- a/ts/editor/editor-toolbar/ImageOcclusionButton.svelte
+++ b/ts/editor/editor-toolbar/ImageOcclusionButton.svelte
@@ -7,14 +7,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import ButtonGroup from "components/ButtonGroup.svelte";
import DynamicallySlottable from "components/DynamicallySlottable.svelte";
import IconButton from "components/IconButton.svelte";
- import { ioMaskEditorVisible } from "image-occlusion/store";
+ import { ioImageLoadedStore, ioMaskEditorVisible } from "image-occlusion/store";
import ButtonGroupItem, {
createProps,
setSlotHostContext,
updatePropsList,
} from "../../components/ButtonGroupItem.svelte";
- import { mdiViewDashboard } from "./icons";
+ import { mdiTableRefresh, mdiViewDashboard } from "./icons";
export let api = {};
@@ -39,6 +39,22 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
{@html mdiViewDashboard}
+