diff --git a/qt/aqt/browser/browser.py b/qt/aqt/browser/browser.py
index b122e5240..9e42e70ec 100644
--- a/qt/aqt/browser/browser.py
+++ b/qt/aqt/browser/browser.py
@@ -386,13 +386,12 @@ class Browser(QMainWindow):
editor._links["preview"] = lambda _editor: self.onTogglePreview()
editor.web.eval(
f"""
-$editorToolbar.addButton({{
- component: editorToolbar.LabelButton,
+$editorToolbar.addButton(editorToolbar.labelButton({{
label: `{tr.actions_preview()}`,
tooltip: `{tr.browsing_preview_selected_card(val=shortcut(preview_shortcut))}`,
onClick: () => bridgeCommand("preview"),
disables: false,
-}}, "notetype");
+}}), "notetype", -1);
"""
)
diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py
index 808cdf86c..1db017bb1 100644
--- a/qt/aqt/editor.py
+++ b/qt/aqt/editor.py
@@ -155,7 +155,7 @@ class Editor:
gui_hooks.editor_did_init_left_buttons(lefttopbtns, self)
lefttopbtns_defs = [
- f"$editorToolbar.addButton({{ component: editorToolbar.RawButton, html: `{button}` }}, 'notetype');"
+ f"$editorToolbar.addButton(editorToolbar.rawButton({{ html: `{button}` }}), 'notetype', -1);"
for button in lefttopbtns
]
lefttopbtns_js = "\n".join(lefttopbtns_defs)
@@ -167,16 +167,16 @@ class Editor:
righttopbtns_defs = "\n".join(
[
- f"{{ component: editorToolbar.RawButton, html: `{button}` }},"
+ f"editorToolbar.rawButton({{ html: `{button}` }}),"
for button in righttopbtns
]
)
righttopbtns_js = (
f"""
-$editorToolbar.addButtonGroup({{
+$editorToolbar.addButton(editorToolbar.buttonGroup({{
id: "addons",
- buttons: [ {righttopbtns_defs} ]
-}});
+ items: [ {righttopbtns_defs} ]
+}}), -1);
"""
if righttopbtns_defs
else ""
@@ -1277,13 +1277,9 @@ 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"); '
- )
+ editor.web.eval('$editorToolbar.showButton("template", "cloze"); ')
else:
- editor.web.eval(
- 'document.getElementById("editorToolbar").hideButton("template", "cloze"); '
- )
+ editor.web.eval('$editorToolbar.hideButton("template", "cloze"); ')
gui_hooks.editor_did_load_note.append(set_cloze_button)
diff --git a/ts/editor-toolbar/ButtonDropdown.d.ts b/ts/editor-toolbar/ButtonDropdown.d.ts
index ad869013e..2b3cdb70f 100644
--- a/ts/editor-toolbar/ButtonDropdown.d.ts
+++ b/ts/editor-toolbar/ButtonDropdown.d.ts
@@ -5,5 +5,5 @@ import type { ToolbarItem } from "./types";
export interface ButtonDropdownProps {
id: string;
className?: string;
- buttons: ToolbarItem[];
+ items: ToolbarItem[];
}
diff --git a/ts/editor-toolbar/ButtonDropdown.svelte b/ts/editor-toolbar/ButtonDropdown.svelte
index 0db3df397..a1585c12f 100644
--- a/ts/editor-toolbar/ButtonDropdown.svelte
+++ b/ts/editor-toolbar/ButtonDropdown.svelte
@@ -10,10 +10,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
export let className = "";
function extendClassName(className: string): string {
- return `dropdown-menu btn-dropdown-menu py-1 mb-0 ${className}`;
+ return `dropdown-menu btn-dropdown-menu ${className}`;
}
- export let buttons: ToolbarItem[];
+ export let items: ToolbarItem[];
-