Show/Hide Cloze button depending on whether cloze type
This commit is contained in:
parent
fe4ba87490
commit
eceb98f8e6
@ -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(remove_null_bytes)
|
||||
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];
|
||||
}
|
||||
|
||||
function hideComponent(component: Hideable) {
|
||||
function showComponent(component: Hideable) {
|
||||
component.hidden = false;
|
||||
}
|
||||
|
||||
function showComponent(component: Hideable) {
|
||||
function hideComponent(component: Hideable) {
|
||||
component.hidden = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user