Use json.dumps instead of backticks in editor.py

This commit is contained in:
Henrik Giesel 2021-05-07 14:22:06 +02:00
parent 49745e1282
commit 6a804f6775

View File

@ -145,7 +145,7 @@ class Editor:
gui_hooks.editor_did_init_left_buttons(lefttopbtns, self) gui_hooks.editor_did_init_left_buttons(lefttopbtns, self)
lefttopbtns_defs = [ 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 for button in lefttopbtns
] ]
lefttopbtns_js = "\n".join(lefttopbtns_defs) lefttopbtns_js = "\n".join(lefttopbtns_defs)
@ -155,7 +155,7 @@ class Editor:
# legacy filter # legacy filter
righttopbtns = runFilter("setupEditorButtons", righttopbtns, self) 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 = ( righttopbtns_js = (
f""" f"""
$editorToolbar.then(({{ toolbar }}) => toolbar.appendGroup({{ $editorToolbar.then(({{ toolbar }}) => toolbar.appendGroup({{