Added: Edit shortcut

This commit is contained in:
Luc Mcgrady 2025-11-10 21:42:12 +00:00
parent 5b35fd7bc3
commit 40d7ce88aa
No known key found for this signature in database
GPG key ID: 4F3D7A0B17CC3D9C
2 changed files with 18 additions and 3 deletions

View file

@ -10,7 +10,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import type { ReviewerState } from "../reviewer";
import Remaining from "./Remaining.svelte";
import More from "./More.svelte";
import { displayEditMenu } from "@generated/backend";
export let state: ReviewerState;
@ -26,7 +25,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<div class="disappearing edit">
<button
title={tr.actionsShortcutKey({ val: "E" })}
on:click={() => displayEditMenu({ cid: state.currentCard?.card?.id })}
on:click={() => state.displayEditMenu()}
>
{tr.studyingEdit()}
</button>

View file

@ -1,7 +1,16 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { CardAnswer, type NextCardDataResponse_NextCardData } from "@generated/anki/scheduler_pb";
import { compareAnswer, getConfigJson, nextCardData, playAvtags, redo, setConfigJson, undo } from "@generated/backend";
import {
compareAnswer,
displayEditMenu,
getConfigJson,
nextCardData,
playAvtags,
redo,
setConfigJson,
undo,
} from "@generated/backend";
import { derived, get, writable } from "svelte/store";
import type { InnerReviewerRequest } from "../reviewer-inner/innerReviewerRequest";
import type { ReviewerRequest } from "./reviewerRequest";
@ -82,6 +91,10 @@ export class ReviewerState {
this.showQuestion(null);
}
public displayEditMenu() {
displayEditMenu({ cid: this.currentCard?.card?.id });
}
async handleKeyPress(key: string, ctrl: boolean, shift: boolean) {
key = key.toLowerCase();
switch (key) {
@ -121,6 +134,9 @@ export class ReviewerState {
}
break;
}
case "e": {
this.displayEditMenu();
}
}
}