Anki/ts/editor
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
..
editor-toolbar Cloze button get disabled outside of cloze field (#3879) 2025-04-24 18:37:41 +10:00
image-overlay Update to stable Svelte 5 release (#3513) 2024-10-26 18:21:45 +10:00
mathjax-overlay Cloze button get disabled outside of cloze field (#3879) 2025-04-24 18:37:41 +10:00
plain-text-input
rich-text-input Cloze button get disabled outside of cloze field (#3879) 2025-04-24 18:37:41 +10:00
base.ts
BrowserEditor.svelte
ClozeButtons.svelte Cloze button get disabled outside of cloze field (#3879) 2025-04-24 18:37:41 +10:00
code-mirror.ts
CodeMirror.svelte
CollapseBadge.svelte
CollapseLabel.svelte
decorated-elements.ts Remove use of createClassComponent in mathjax-element.ts (#3919) 2025-04-13 16:21:22 +10:00
destroyable.ts
DuplicateLink.svelte
EditingArea.svelte Cleanup old TODO (#3903) 2025-04-11 20:38:20 +10:00
editor-base.scss
EditorField.svelte Cloze button get disabled outside of cloze field (#3879) 2025-04-24 18:37:41 +10:00
FieldDescription.svelte
Fields.svelte
FieldState.svelte
HandleBackground.svelte
HandleControl.svelte Update to Svelte 5 (#3292) 2024-09-25 18:49:07 +10:00
HandleLabel.svelte
helpers.ts
index.ts
LabelContainer.svelte
LabelName.svelte
legacy.scss
NoteCreator.svelte
NoteEditor.svelte Cloze button get disabled outside of cloze field (#3879) 2025-04-24 18:37:41 +10:00
Notification.svelte
old-editor-adapter.ts
PlainTextBadge.svelte
PreviewButton.svelte
ReviewerEditor.svelte
RichTextBadge.svelte Fix remaining accessibility warnings (#3241) 2024-07-10 19:55:08 +07:00
StickyBadge.svelte Use tilted (filled and unfilled) sticky icons in the cards editor (#3825) 2025-02-16 22:24:11 +07:00
surround.ts
types.ts