diff --git a/frontend/src/mathjax-unification.ts b/frontend/src/mathjax-unification.ts index d0d667e..fc14ce7 100644 --- a/frontend/src/mathjax-unification.ts +++ b/frontend/src/mathjax-unification.ts @@ -13,9 +13,7 @@ class MathjaxUnification extends MathjaxAdapter { } } - protected showStep(_n: number): void { - this.requestTypeset(null); - } + protected showStep(_n: number): void {} protected calculateSteps(_extraData: any) { const root = this.shadowRoot!; @@ -37,6 +35,16 @@ class MathjaxUnification extends MathjaxAdapter { prooftree.handleHoverEvent(e as MouseEvent, false); }); } + + protected showLatex(code: string): void { + let el = this.shadowRoot!.getElementById("tc-content"); + if (!el) { + setTimeout(() => this.showLatex(code), 50); + return; + } + el.innerHTML = code; + this.requestTypeset(null); + } } customElements.define('tc-unification', MathjaxUnification); diff --git a/frontend/styles/view/type-inference.css b/frontend/styles/view/type-inference.css index 01209f8..4d1d7e5 100644 --- a/frontend/styles/view/type-inference.css +++ b/frontend/styles/view/type-inference.css @@ -41,7 +41,7 @@ } tc-explanation { - max-width: 40em; + width: 100em; padding-left: 1em; padding-right: 1em; overflow-y: auto; diff --git a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/MathjaxUnification.java b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/MathjaxUnification.java index 9c36f28..81ec872 100644 --- a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/MathjaxUnification.java +++ b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/MathjaxUnification.java @@ -43,12 +43,7 @@ public class MathjaxUnification extends LitTemplate implements MathjaxAdapter { @Override public void showStep(int n) { - if (n < latex.length) { - content.removeAll(); - // add latex as HTML because
is used in the latex code - content.add(new Html("
" + latex[n] + "
")); - } - getElement().callJsFunction("showStep", n); + getElement().callJsFunction("showLatex", latex[n]); } }