From 6a804f6775852c4c25151c24c44dd1c13e3925e9 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Fri, 7 May 2021 14:22:06 +0200 Subject: [PATCH] Use json.dumps instead of backticks in editor.py --- qt/aqt/editor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index bc1ba2ac2..3ce48651f 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -145,7 +145,7 @@ class Editor: gui_hooks.editor_did_init_left_buttons(lefttopbtns, self) lefttopbtns_defs = [ - f"$editorToolbar.then(({{ notetypeButtons }}) => notetypeButtons.appendButton({{ component: editorToolbar.Raw, props: {{ html: `{button}` }} }}, -1));" + f"$editorToolbar.then(({{ notetypeButtons }}) => notetypeButtons.appendButton({{ component: editorToolbar.Raw, props: {{ html: {json.dumps(button)} }} }}, -1));" for button in lefttopbtns ] lefttopbtns_js = "\n".join(lefttopbtns_defs) @@ -155,7 +155,7 @@ class Editor: # legacy filter righttopbtns = runFilter("setupEditorButtons", righttopbtns, self) - righttopbtns_defs = ", ".join([f"`{button}`" for button in righttopbtns]) + righttopbtns_defs = ", ".join([json.dumps(button) for button in righttopbtns]) righttopbtns_js = ( f""" $editorToolbar.then(({{ toolbar }}) => toolbar.appendGroup({{