mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 12:47:11 -05:00
Fix: Respect autoplay setting
This commit is contained in:
parent
d47cb1bd55
commit
cf9c265570
3 changed files with 19 additions and 11 deletions
|
|
@ -305,17 +305,18 @@ message NextCardDataResponse {
|
|||
string back = 4;
|
||||
string css = 5;
|
||||
string body_class = 6;
|
||||
bool autoplay = 7;
|
||||
|
||||
repeated card_rendering.AVTag question_av_tags = 7;
|
||||
repeated card_rendering.AVTag answer_av_tags = 8;
|
||||
repeated card_rendering.AVTag question_av_tags = 8;
|
||||
repeated card_rendering.AVTag answer_av_tags = 9;
|
||||
|
||||
// TODO: We can probably make this a little faster by using oneof and
|
||||
// preventing the partial_front and back being sent to svelte where it isn't
|
||||
// used. Alternatively we can use a completely different message for both
|
||||
// Rust -> Python and the Python -> Svelte though this would be more
|
||||
// complicated to implement.
|
||||
repeated card_rendering.RenderedTemplateNode partial_front = 9;
|
||||
repeated card_rendering.RenderedTemplateNode partial_back = 10;
|
||||
repeated card_rendering.RenderedTemplateNode partial_front = 10;
|
||||
repeated card_rendering.RenderedTemplateNode partial_back = 11;
|
||||
}
|
||||
|
||||
optional NextCardData next_card = 1;
|
||||
|
|
|
|||
|
|
@ -409,22 +409,25 @@ impl crate::services::SchedulerService for Collection {
|
|||
})
|
||||
.collect();
|
||||
|
||||
let config = self.deck_config_for_card(&next_card.card)?;
|
||||
|
||||
Ok(NextCardDataResponse {
|
||||
next_card: Some(NextCardData {
|
||||
queue: Some(queue.into()),
|
||||
|
||||
css: render.css.clone(),
|
||||
partial_front: rendered_nodes_to_proto(render.qnodes),
|
||||
partial_back: rendered_nodes_to_proto(render.anodes),
|
||||
|
||||
answer_buttons,
|
||||
autoplay: !config.inner.disable_autoplay,
|
||||
|
||||
// Filled by python
|
||||
front: "".to_string(),
|
||||
back: "".to_string(),
|
||||
body_class: "".to_string(),
|
||||
question_av_tags: vec![],
|
||||
answer_av_tags: vec![],
|
||||
|
||||
partial_front: rendered_nodes_to_proto(render.qnodes),
|
||||
partial_back: rendered_nodes_to_proto(render.anodes),
|
||||
|
||||
answer_buttons,
|
||||
}),
|
||||
})
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -110,7 +110,9 @@ export class ReviewerState {
|
|||
|
||||
const question = resp.nextCard?.front || "";
|
||||
this.updateHtml(question, resp?.nextCard?.css, resp?.nextCard?.bodyClass);
|
||||
if (this._cardData?.autoplay) {
|
||||
playAvtags({ tags: this._cardData!.questionAvTags });
|
||||
}
|
||||
|
||||
this.beginAnsweringMs = Date.now();
|
||||
}
|
||||
|
|
@ -121,7 +123,9 @@ export class ReviewerState {
|
|||
|
||||
public showAnswer() {
|
||||
this.answerShown.set(true);
|
||||
if (this._cardData?.autoplay) {
|
||||
playAvtags({ tags: this._cardData!.answerAvTags });
|
||||
}
|
||||
this.updateHtml(this._cardData?.back || "");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue