From 9cfd8af34e96dd956aa4bf6484c03d690e04ecd2 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 24 Apr 2025 15:26:46 +1000 Subject: [PATCH] Fix add-on buttons not working in the editor (#3941) * Fix add-on buttons not working in the editor * Ensure old listeners are cleaned up Thanks to iamllama: https://github.com/ankitects/anki/pull/3941#discussion_r2057066283 (cherry picked from commit 1e74e8e86e6d1190052ebf6d62a496ac6d6dda6b) --- qt/aqt/editor.py | 7 ++-- ts/editor/editor-toolbar/AddonButtons.svelte | 36 +++++++++++++++++++- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index 9627f5fc7..334e35079 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -320,7 +320,6 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too label_element = cmd title_attribute = shortcut(title_attribute) - cmd_to_toggle_button = "toggleEditorButton(this);" if toggleable else "" id_attribute_assignment = f"id={id}" if id else "" class_attribute = "linkb" if rightside else "rounded" if not disables: @@ -328,11 +327,11 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too return f"""