From cb8f828481fee96635bb90d7b005d2a46bef09b2 Mon Sep 17 00:00:00 2001 From: garrettmills Date: Sat, 9 Apr 2022 11:10:03 -0500 Subject: [PATCH 1/2] Add edit buttom to statement --- src/assets/edit.svg | 40 ++++++++++++++++++++++++++++++++++++ src/components/Statement.vue | 26 ++++++++++++++++++----- 2 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 src/assets/edit.svg diff --git a/src/assets/edit.svg b/src/assets/edit.svg new file mode 100644 index 0000000..b2805a9 --- /dev/null +++ b/src/assets/edit.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/Statement.vue b/src/components/Statement.vue index d7f56b0..214275d 100644 --- a/src/components/Statement.vue +++ b/src/components/Statement.vue @@ -25,16 +25,32 @@ computed(() => value = getValueStatement()) border: 1px solid #ccc; border-radius: 3px; padding: 10px; + display: flex; + flex-direction: row; + } + + .content { + flex: 1; + } + + .sidebar { + padding-left: 10px; } From 97d5ff6ea2ebbaa89c39d17980f35b37da6be553 Mon Sep 17 00:00:00 2001 From: garrettmills Date: Sat, 9 Apr 2022 12:00:45 -0500 Subject: [PATCH 2/2] Fix katex rendering --- package.json | 6 +++--- src/components/Katex.vue | 13 +++++++------ src/main.ts | 3 +++ src/support/parse.ts | 11 +++++++---- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 4ca5c7e..5898796 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,10 @@ "cd": "pnpm run cd:build && pnpm run cd:push && pnpm run cd:rollout" }, "dependencies": { - "@vuetify/vite-plugin": "1.0.0-alpha.10", + "@auth0/auth0-vue": "^1.0.0", "@types/katex": "^0.14.0", "@types/uuid": "^8.3.4", + "@vuetify/vite-plugin": "1.0.0-alpha.10", "dependency-graph": "^0.11.0", "install": "^0.13.0", "katex": "^0.15.3", @@ -26,8 +27,7 @@ "uuid": "^8.3.2", "vue": "^3.2.25", "vue-router": "^4.0.14", - "vuetify": "3.0.0-beta.0", - "@auth0/auth0-vue": "^1.0.0" + "vuetify": "3.0.0-beta.0" }, "devDependencies": { "@braks/revue-draggable": "^0.4.2", diff --git a/src/components/Katex.vue b/src/components/Katex.vue index 420362c..acbc53b 100644 --- a/src/components/Katex.vue +++ b/src/components/Katex.vue @@ -1,5 +1,4 @@ diff --git a/src/main.ts b/src/main.ts index 5dc89ae..0d9c2c5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,6 +4,9 @@ import { DraggablePlugin } from '@braks/revue-draggable' import { createAuth0 } from '@auth0/auth0-vue' import router from './router' +import 'katex/dist/katex.min.css' +import 'katex/dist/contrib/auto-render.min' + const app = createApp(App) diff --git a/src/support/parse.ts b/src/support/parse.ts index f92b28c..6dfdae2 100644 --- a/src/support/parse.ts +++ b/src/support/parse.ts @@ -284,15 +284,18 @@ export class MathStatement { /** Render the statement as HTML string. */ toHTMLString(): HTMLString { return katex.renderToString(this.toLaTeX(), { - output: 'mathml', + output: 'html', }) as HTMLString } /** Render the statement to a DOM element. */ - toDOM(): HTMLSpanElement { - const node = document.createElement('span') + toDOM(node?: HTMLElement): HTMLSpanElement { + if ( !node ) { + node = document.createElement('span') + } + katex.render(this.toLaTeX(), node, { - output: 'mathml', + output: 'html', }) return node }