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