diff --git a/ts/editable/editable-base.scss b/ts/editable/editable-base.scss index 360c9d83c..2c1323d6b 100644 --- a/ts/editable/editable-base.scss +++ b/ts/editable/editable-base.scss @@ -10,6 +10,10 @@ anki-editable { outline: none; } + &:focus { + outline: none; + } + * { max-width: 100%; } diff --git a/ts/editable/mathjax-component.ts b/ts/editable/mathjax-component.ts index cb4af2b74..f3d137ceb 100644 --- a/ts/editable/mathjax-component.ts +++ b/ts/editable/mathjax-component.ts @@ -87,7 +87,7 @@ export const Mathjax: DecoratedElementConstructor = class Mathjax } static get observedAttributes(): string[] { - return ["block"]; + return ["block", "data-mathjax"]; } connectedCallback(): void { @@ -99,9 +99,14 @@ export const Mathjax: DecoratedElementConstructor = class Mathjax this.disconnect(); } - attributeChangedCallback(_name: string, _old: string, newValue: string): void { - this.block = newValue !== "false"; - this.component?.$set({ block: this.block }); + attributeChangedCallback(name: string, _old: string, newValue: string): void { + switch (name) { + case "block": + this.block = newValue !== "false"; + this.component?.$set({ block: this.block }); + case "data-mathjax": + this.component?.$set({ mathjax: newValue }); + } } decorate(): void { diff --git a/ts/editor/BUILD.bazel b/ts/editor/BUILD.bazel index 58091e799..aa5d1d298 100644 --- a/ts/editor/BUILD.bazel +++ b/ts/editor/BUILD.bazel @@ -33,8 +33,9 @@ compile_sass( visibility = ["//visibility:public"], deps = [ "//ts/sass:base_lib", - "//ts/sass:buttons_lib", "//ts/sass:scrollbar_lib", + "//ts/sass:buttons_lib", + "//ts/sass:button_mixins_lib", ], ) diff --git a/ts/editor/MathjaxHandle.svelte b/ts/editor/MathjaxHandle.svelte index bdbcda1b4..e6dd3d626 100644 --- a/ts/editor/MathjaxHandle.svelte +++ b/ts/editor/MathjaxHandle.svelte @@ -5,18 +5,21 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html createDropdown(event.detail.selection)} > - event.stopPropagation()} /> + event.stopPropagation()} + on:dblclick={() => (edit = true)} + /> - -
{ - updateSelection(); - dropdownObject.update(); - }} - > - - - -
-
+ {#if !edit} + + + + {:else} + +
{ + updateSelection(); + dropdownObject.update(); + }} + > + + + +
+
+ {/if} {/if}
diff --git a/ts/editor/MathjaxHandleEditor.svelte b/ts/editor/MathjaxHandleEditor.svelte new file mode 100644 index 000000000..fc996d89e --- /dev/null +++ b/ts/editor/MathjaxHandleEditor.svelte @@ -0,0 +1,57 @@ + + + + +
+