diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index 0d68fc19b..857d94b18 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -544,6 +544,7 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too setMathjaxEnabled({json.dumps(self.mw.col.get_config("renderMathjax", True))}); setShrinkImages({json.dumps(self.mw.col.get_config("shrinkEditorImages", True))}); setCloseHTMLTags({json.dumps(self.mw.col.get_config("closeHTMLTags", True))}); + triggerChanges(); """ if self.addMode: diff --git a/ts/components/Collapsible.svelte b/ts/components/Collapsible.svelte index b09cd53b5..0e8e3c0e2 100644 --- a/ts/components/Collapsible.svelte +++ b/ts/components/Collapsible.svelte @@ -16,19 +16,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html function dynamicDuration(height: number): number { return 100 + Math.pow(height, 1 / 4) * 25; } - // If we don't transition, the editor actually takes considerably longer to create all - // the fields. Because of that, we're using an imperceptible duration for the animation - // when reduced motion is enabled. - $: duration = animated ? dynamicDuration(contentHeight) : 0.01; + $: duration = dynamicDuration(contentHeight); const size = tweened(0); async function transition(collapse: boolean): Promise { - // We need to ensure collapsibleElement still exists - if (!collapsibleElement) { - return; - } - if (collapse) { contentHeight = collapsibleElement.clientHeight; size.set(0, { @@ -49,7 +41,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } $: if (collapsibleElement) { - window.requestAnimationFrame(() => transition(collapse)); + if (animated) { + transition(collapse); + } else { + collapsed = collapse; + } } let collapsibleElement: HTMLElement; @@ -71,6 +67,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-{#if measuring} +{#if animated && measuring}
{/if}