mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Show/Hide Cloze button depending on whether cloze type
This commit is contained in:
parent
fe4ba87490
commit
eceb98f8e6
2 changed files with 12 additions and 2 deletions
|
@ -1351,3 +1351,13 @@ gui_hooks.editor_will_use_font_for_field.append(fontMungeHack)
|
||||||
gui_hooks.editor_will_munge_html.append(munge_html)
|
gui_hooks.editor_will_munge_html.append(munge_html)
|
||||||
gui_hooks.editor_will_munge_html.append(remove_null_bytes)
|
gui_hooks.editor_will_munge_html.append(remove_null_bytes)
|
||||||
gui_hooks.editor_will_munge_html.append(reverse_url_quoting)
|
gui_hooks.editor_will_munge_html.append(reverse_url_quoting)
|
||||||
|
|
||||||
|
|
||||||
|
def set_cloze_button(editor: Editor) -> None:
|
||||||
|
if editor.note.model()["type"] == MODEL_CLOZE:
|
||||||
|
editor.web.eval('document.getElementById("editorToolbar").showButton("template", "cloze"); ')
|
||||||
|
else:
|
||||||
|
editor.web.eval('document.getElementById("editorToolbar").hideButton("template", "cloze"); ')
|
||||||
|
|
||||||
|
|
||||||
|
gui_hooks.editor_did_load_note.append(set_cloze_button)
|
||||||
|
|
|
@ -36,11 +36,11 @@ function searchByIdOrIndex<T extends { id?: string }>(
|
||||||
: values[idOrIndex];
|
: values[idOrIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideComponent(component: Hideable) {
|
function showComponent(component: Hideable) {
|
||||||
component.hidden = false;
|
component.hidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showComponent(component: Hideable) {
|
function hideComponent(component: Hideable) {
|
||||||
component.hidden = true;
|
component.hidden = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue