diff --git a/ts/editable/BUILD.bazel b/ts/editable/BUILD.bazel index 0b8a417f4..c5eab62ef 100644 --- a/ts/editable/BUILD.bazel +++ b/ts/editable/BUILD.bazel @@ -3,7 +3,7 @@ load("//ts/svelte:svelte.bzl", "compile_svelte", "svelte_check") load("//ts:prettier.bzl", "prettier_test") load("//ts:eslint.bzl", "eslint_test") load("//ts:esbuild.bzl", "esbuild") -load("//ts:vendor.bzl", "copy_bootstrap_icons", "copy_mdi_icons") +load("//ts:vendor.bzl", "copy_mdi_icons") load("//ts:compile_sass.bzl", "compile_sass") svelte_files = glob(["*.svelte"]) @@ -37,6 +37,14 @@ compile_sass( ], ) +copy_mdi_icons( + name = "mdi-icons", + icons = [ + "math-integral-box.svg", + ], + visibility = ["//visibility:public"], +) + ts_library( name = "editable", srcs = glob(["*.ts"]), @@ -65,6 +73,7 @@ esbuild( output_css = "editable-build.css", visibility = ["//visibility:public"], deps = [ + "mdi-icons", "editable", "editable_scss", "svelte_components", diff --git a/ts/editable/icons.ts b/ts/editable/icons.ts new file mode 100644 index 000000000..a85ecc4b3 --- /dev/null +++ b/ts/editable/icons.ts @@ -0,0 +1,4 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + +export { default as mathIcon } from "./math-integral-box.svg"; diff --git a/ts/editable/mathjax.ts b/ts/editable/mathjax.ts index 2f6e8b5db..0a60cf28d 100644 --- a/ts/editable/mathjax.ts +++ b/ts/editable/mathjax.ts @@ -1,14 +1,48 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -export function convertMathjax(input: string): string { - const svg = globalThis.MathJax.tex2svg(input).children[0]; +import { mathIcon } from "./icons"; +const parser = new DOMParser(); +const errorPattern = /