From e14f87ba99a0bd81a45701dda0b05ae437fe2478 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 12 Oct 2022 14:56:38 +1000 Subject: [PATCH] Switch back to clearing MathJax preview on blur This means two clicks are required again, but that's the lesser of two evils: https://forums.ankiweb.net/t/anki-2-1-55-beta-mathjax-preview/23529/8 Better fixes welcome :-) --- ts/editor/mathjax-overlay/MathjaxEditor.svelte | 2 +- ts/editor/mathjax-overlay/MathjaxOverlay.svelte | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/ts/editor/mathjax-overlay/MathjaxEditor.svelte b/ts/editor/mathjax-overlay/MathjaxEditor.svelte index 142985405..ec90c0c65 100644 --- a/ts/editor/mathjax-overlay/MathjaxEditor.svelte +++ b/ts/editor/mathjax-overlay/MathjaxEditor.svelte @@ -99,7 +99,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {configuration} bind:api={codeMirror} on:change={({ detail: mathjaxText }) => code.set(mathjaxText)} - on:tab + on:blur /> diff --git a/ts/editor/mathjax-overlay/MathjaxOverlay.svelte b/ts/editor/mathjax-overlay/MathjaxOverlay.svelte index 677bc9095..281b6752d 100644 --- a/ts/editor/mathjax-overlay/MathjaxOverlay.svelte +++ b/ts/editor/mathjax-overlay/MathjaxOverlay.svelte @@ -192,10 +192,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html placeHandle(true); await resetHandle(); }} - on:tab={async () => { - // Instead of resetting on blur, we reset on tab - // Otherwise, when clicking from Mathjax element to another, - // the user has to click twice (focus is called before blur?) + on:blur={async () => { await resetHandle(); }} let:editor={mathjaxEditor}