Anki/ts/editor/editor-toolbar
Arthur Milchior efaaae8ce4
Cloze button get disabled outside of cloze field (#3879)
* NF: replace `disabled` by `enabled`

This allows to remove the negations and, in my opinion, make the code
easier to understand and edit.

* Cloze button get disabled outside of cloze field

More specifically, if the user focus in a field that is not a cloze
field, the button are still there but appear as disabled. The shortcut
instead of adding the cloze context shows an alert explaining why this
can't be done.

While this message is already displayed when the user tries to add a
note with cloze in non-cloze field, I suspect it will save time to
stop the user as soon as possible from making mistake. This should
make very clear what is authorized and what is not.

It'll also be a reminder of whether the current field is a cloze or
not.

In order to do this, I added a back-end method (that I expect we may
reuse in ankidroid) to get the index of the fields used in cloze. This
set is sent to the note editor, which propagates it where needed.

In mathjax, the cloze symbol is removed when the selected field is not
a cloze field.
2025-04-24 18:37:41 +10:00
..
AddonButtons.svelte Fix add-on buttons not working in the editor (#3941) 2025-04-24 15:26:46 +10:00
BlockButtons.svelte Svg icon (#3135) 2024-04-24 02:37:31 +01:00
BoldButton.svelte Revert "Decide if element is bold by getComputedStyle (#2453) (#2579)" 2024-10-11 23:34:50 +10:00
ColorPicker.svelte Switch to SvelteKit (#3077) 2024-03-31 09:16:31 +01:00
CommandIconButton.svelte Fix editor loses focus when toggling list if list item empty (#3483) 2024-10-16 00:38:35 +10:00
EditorToolbar.svelte Switch to SvelteKit (#3077) 2024-03-31 09:16:31 +01:00
HighlightColorButton.svelte Svg icon (#3135) 2024-04-24 02:37:31 +01:00
ImageOcclusionButton.svelte Add keyboard shortcuts for empty cards and toggle mask on image occlusion (#3136) 2024-04-25 17:19:38 +10:00
index.ts Refactor how toolbar buttons get to surround within editor fields (#1931) 2022-08-15 13:34:16 +10:00
InlineButtons.svelte Switch to SvelteKit (#3077) 2024-03-31 09:16:31 +01:00
ItalicButton.svelte Revert "Decide if element is bold by getComputedStyle (#2453) (#2579)" 2024-10-11 23:34:50 +10:00
LatexButton.svelte Remove use of createClassComponent in mathjax-element.ts (#3919) 2025-04-13 16:21:22 +10:00
NotetypeButtons.svelte Switch to SvelteKit (#3077) 2024-03-31 09:16:31 +01:00
OptionsButton.svelte Remove use of createClassComponent in mathjax-element.ts (#3919) 2025-04-13 16:21:22 +10:00
OptionsButtons.svelte Switch to SvelteKit (#3077) 2024-03-31 09:16:31 +01:00
RemoveFormatButton.svelte Svg icon (#3135) 2024-04-24 02:37:31 +01:00
RichTextClozeButtons.svelte Cloze button get disabled outside of cloze field (#3879) 2025-04-24 18:37:41 +10:00
SubscriptButton.svelte Svg icon (#3135) 2024-04-24 02:37:31 +01:00
SuperscriptButton.svelte Svg icon (#3135) 2024-04-24 02:37:31 +01:00
TemplateButtons.svelte Svg icon (#3135) 2024-04-24 02:37:31 +01:00
TextAttributeButton.svelte Switch to SvelteKit (#3077) 2024-03-31 09:16:31 +01:00
TextColorButton.svelte Svg icon (#3135) 2024-04-24 02:37:31 +01:00
UnderlineButton.svelte Svg icon (#3135) 2024-04-24 02:37:31 +01:00
WithColorHelper.svelte Svg icon (#3135) 2024-04-24 02:37:31 +01:00