diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index f55eef4e3..c4b84f6cd 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -533,7 +533,8 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too setNoteId({}); setColorButtons({}); setTags({}); - setMathjaxEnabled({}); + setMathjaxEnabled({}); + setReducedMotion({}); """.format( json.dumps(data), json.dumps(collapsed), @@ -545,6 +546,7 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too json.dumps([text_color, highlight_color]), json.dumps(self.note.tags), json.dumps(self.mw.col.get_config("renderMathjax", True)), + json.dumps(self.mw.pm.reduced_motion()), ) if self.addMode: diff --git a/ts/components/Collapsible.svelte b/ts/components/Collapsible.svelte index 71b1e31b2..8901fbaff 100644 --- a/ts/components/Collapsible.svelte +++ b/ts/components/Collapsible.svelte @@ -7,6 +7,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { tweened } from "svelte/motion"; export let duration = 200; + export let animated = true; function dynamicDuration(height: number, factor: number): number { return 100 + Math.pow(height, 1 / 4) * factor; @@ -33,7 +34,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html await new Promise(requestAnimationFrame); expandHeight = collapsibleElement.clientHeight; - animating = true; + transitioning = true; size.set(1, { duration: duration || dynamicDuration(expandHeight, 25), easing: cubicIn, @@ -42,24 +43,29 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } $: if (collapsibleElement) { - doCollapse(collapse); + if (animated) { + doCollapse(collapse); + } else { + collapsed = collapse; + } } let collapsibleElement: HTMLElement; $: collapsed = $size === 0; $: expanded = $size === 1; - $: animating = $size > 0 && !(collapsed || expanded); + $: transitioning = $size > 0 && !(collapsed || expanded); $: height = $size * expandHeight; - $: measuring = !(collapsed || animating || expanded); + $: measuring = !(collapsed || transitioning || expanded);