From f9aa232d9b90652ac6304191bee868fa41f13933 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 5 Jan 2023 15:58:32 +1000 Subject: [PATCH] Fix cloze buttons not working in MathJax editor Regressed in #2144 --- ts/editor/ClozeButtons.svelte | 5 ++++- ts/editor/mathjax-overlay/MathjaxButtons.svelte | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ts/editor/ClozeButtons.svelte b/ts/editor/ClozeButtons.svelte index 489597b46..07586c0ba 100644 --- a/ts/editor/ClozeButtons.svelte +++ b/ts/editor/ClozeButtons.svelte @@ -16,6 +16,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { context as noteEditorContext } from "./NoteEditor.svelte"; import { editingInputIsRichText } from "./rich-text-input"; + export let alwaysEnabled = false; + const { focusedInput, fields } = noteEditorContext.get(); // Workaround for Cmd+Option+Shift+C not working on macOS. The keyup approach works @@ -67,7 +69,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html }); } - $: disabled = !$focusedInput || !editingInputIsRichText($focusedInput); + $: disabled = + !alwaysEnabled && (!$focusedInput || !editingInputIsRichText($focusedInput)); const incrementKeyCombination = "Control+Shift+C"; const sameKeyCombination = "Control+Alt+Shift+C"; diff --git a/ts/editor/mathjax-overlay/MathjaxButtons.svelte b/ts/editor/mathjax-overlay/MathjaxButtons.svelte index d16737e9c..2857cd04b 100644 --- a/ts/editor/mathjax-overlay/MathjaxButtons.svelte +++ b/ts/editor/mathjax-overlay/MathjaxButtons.svelte @@ -38,7 +38,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - +