diff --git a/ts/components/startup.ts b/ts/components/startup.ts index 3776a3850..c23447b21 100644 --- a/ts/components/startup.ts +++ b/ts/components/startup.ts @@ -327,10 +327,12 @@ export namespace Startup { export function makeTypesetMethods() { MathJax.typeset = (elements: any = null) => { document.options.elements = elements; + document.reset(); document.render(); }; MathJax.typesetPromise = (elements: any = null) => { document.options.elements = elements; + document.reset(); return mathjax.handleRetriesFor(() => { document.render(); }) diff --git a/ts/core/MathDocument.ts b/ts/core/MathDocument.ts index 9f9a1376a..b3a214ad7 100644 --- a/ts/core/MathDocument.ts +++ b/ts/core/MathDocument.ts @@ -516,8 +516,7 @@ export abstract class AbstractMathDocument implements MathDocument }; diff --git a/ts/core/MathItem.ts b/ts/core/MathItem.ts index cb9974d21..b90e9b4a8 100644 --- a/ts/core/MathItem.ts +++ b/ts/core/MathItem.ts @@ -404,7 +404,6 @@ export const STATE: {[state: string]: number} = { RERENDER: 125, TYPESET: 150, INSERTED: 200, - RESET: 500, LAST: 10000 }; diff --git a/ts/input/mathml.ts b/ts/input/mathml.ts index 0df77289f..ff0525fa0 100644 --- a/ts/input/mathml.ts +++ b/ts/input/mathml.ts @@ -128,7 +128,7 @@ export class MathML extends AbstractInputJax { */ public compile(math: MathItem, document: MathDocument) { let mml = math.start.node; - if (!mml || this.options['forceReparse']) { + if (!mml || this.options['forceReparse'] || this.adaptor.kind(mml) === '#text') { let mathml = this.executeFilters(this.preFilters, math, document, math.math || ''); let doc = this.checkForErrors(this.adaptor.parse(mathml, 'text/' + this.options['parseAs'])); let body = this.adaptor.body(doc); diff --git a/ts/ui/menu/Menu.ts b/ts/ui/menu/Menu.ts index aed03cedc..186dd182c 100644 --- a/ts/ui/menu/Menu.ts +++ b/ts/ui/menu/Menu.ts @@ -804,6 +804,7 @@ export class Menu { this.document = startup.document = startup.getDocument(); this.document.menu = this; this.transferMathList(document); + this.document.processed = document.processed; if (!Menu._loadingPromise) { this.rerender(component === 'complexity' || noEnrich ? STATE.COMPILED : STATE.TYPESET); }