mirror of
https://github.com/ankitects/anki.git
synced 2026-01-07 02:53:54 -05:00
Added: More menu mark note
This commit is contained in:
parent
8dd34ba9ff
commit
9cee2887a2
6 changed files with 36 additions and 2 deletions
|
|
@ -311,6 +311,7 @@ message NextCardDataResponse {
|
|||
string css = 5;
|
||||
string body_class = 6;
|
||||
bool autoplay = 7;
|
||||
bool marked = 13;
|
||||
optional TypedAnswer typed_answer = 12;
|
||||
|
||||
repeated card_rendering.AVTag question_av_tags = 8;
|
||||
|
|
|
|||
|
|
@ -769,6 +769,8 @@ exposed_backend_list = [
|
|||
"get_field_names",
|
||||
"get_note",
|
||||
"remove_notes",
|
||||
"add_note_tags",
|
||||
"remove_note_tags",
|
||||
# NotetypesService
|
||||
"get_notetype_names",
|
||||
"get_change_notetype_info",
|
||||
|
|
|
|||
|
|
@ -404,6 +404,7 @@ impl crate::services::SchedulerService for Collection {
|
|||
if let Some(next_card) = next_card {
|
||||
let cid = next_card.card.id;
|
||||
let deck_config = self.deck_config_for_card(&next_card.card)?;
|
||||
let note = self.get_note(next_card.card.note_id.into())?;
|
||||
|
||||
let render = self.render_existing_card(cid, false, true)?;
|
||||
let show_due = self.get_config_bool(BoolKey::ShowIntervalsAboveAnswerButtons);
|
||||
|
|
@ -454,7 +455,6 @@ impl crate::services::SchedulerService for Collection {
|
|||
|
||||
let typed_answer = typed_answer_parent_node
|
||||
.map(|field| -> Result<(String, String)> {
|
||||
let note = self.get_note(next_card.card.note_id.into())?;
|
||||
let notetype = self
|
||||
.get_notetype(note.notetype_id.into())?
|
||||
.or_not_found(note.notetype_id)?;
|
||||
|
|
@ -468,6 +468,8 @@ impl crate::services::SchedulerService for Collection {
|
|||
})
|
||||
.transpose()?;
|
||||
|
||||
let marked = note.tags.contains(&"marked".to_string());
|
||||
|
||||
Ok(NextCardDataResponse {
|
||||
next_card: Some(NextCardData {
|
||||
queue: Some(queue.into()),
|
||||
|
|
@ -482,6 +484,7 @@ impl crate::services::SchedulerService for Collection {
|
|||
text: answer.1,
|
||||
args: answer.0,
|
||||
}),
|
||||
marked,
|
||||
|
||||
// Filled by python
|
||||
front: "".to_string(),
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
});
|
||||
$: cardData = state.cardData;
|
||||
$: flag = $cardData?.queue?.cards[0].card?.flags;
|
||||
$: marked = $cardData?.marked;
|
||||
</script>
|
||||
|
||||
<div>
|
||||
|
|
@ -31,6 +32,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
<div id="_flag" style:color={`var(--flag-${flag})`}>⚑</div>
|
||||
{/if}
|
||||
|
||||
{#if marked}
|
||||
<div id="_mark">★</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
div {
|
||||
height: 100vh;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
|
||||
"hr",
|
||||
// Notes
|
||||
{ name: tr.studyingMarkNote(), shortcut: "*", onClick: todo },
|
||||
{
|
||||
name: tr.studyingMarkNote(),
|
||||
shortcut: "*",
|
||||
onClick: state.toggleMarked.bind(state),
|
||||
},
|
||||
{
|
||||
name: tr.studyingBuryNote(),
|
||||
shortcut: "=",
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {
|
|||
type NextCardDataResponse_NextCardData,
|
||||
} from "@generated/anki/scheduler_pb";
|
||||
import {
|
||||
addNoteTags,
|
||||
buryOrSuspendCards,
|
||||
compareAnswer,
|
||||
getConfigJson,
|
||||
|
|
@ -14,6 +15,7 @@ import {
|
|||
playAvtags,
|
||||
redo,
|
||||
removeNotes,
|
||||
removeNoteTags,
|
||||
setConfigJson,
|
||||
undo,
|
||||
} from "@generated/backend";
|
||||
|
|
@ -129,6 +131,23 @@ export class ReviewerState {
|
|||
this.displayMenu("Options");
|
||||
}
|
||||
|
||||
public toggleMarked() {
|
||||
if (this._cardData && this.currentCard?.card?.noteId) {
|
||||
const noteIds = [this.currentCard.card.noteId];
|
||||
if (this._cardData.marked) {
|
||||
removeNoteTags({ noteIds, tags: "marked" });
|
||||
} else {
|
||||
addNoteTags({ noteIds, tags: "marked" });
|
||||
}
|
||||
this.cardData.update($cardData => {
|
||||
if ($cardData) {
|
||||
$cardData.marked = !$cardData.marked;
|
||||
}
|
||||
return $cardData;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public showTooltip(message: string) {
|
||||
clearTimeout(this.tooltipMessageTimeout);
|
||||
this.tooltipMessage.set(message);
|
||||
|
|
|
|||
Loading…
Reference in a new issue