diff --git a/.changeset/witty-hounds-melt.md b/.changeset/witty-hounds-melt.md new file mode 100644 index 0000000000..7e053ccfd7 --- /dev/null +++ b/.changeset/witty-hounds-melt.md @@ -0,0 +1,5 @@ +--- +"@khanacademy/perseus": patch +--- + +Removal of unused MathJax2 initialization diff --git a/packages/perseus/src/__tests__/init.test.ts b/packages/perseus/src/__tests__/init.test.ts index 6d9676ae71..349abe8845 100644 --- a/packages/perseus/src/__tests__/init.test.ts +++ b/packages/perseus/src/__tests__/init.test.ts @@ -3,7 +3,7 @@ import {getWidget} from "../widgets"; describe("init", () => { it("should correctly replace the transformer widget", async () => { - await init({skipMathJax: true}); + await init(); expect(getWidget("transformer")).not.toBeNull(); }); diff --git a/packages/perseus/src/index.ts b/packages/perseus/src/index.ts index df9290e37b..26461c363c 100644 --- a/packages/perseus/src/index.ts +++ b/packages/perseus/src/index.ts @@ -159,7 +159,6 @@ export {default as WIDGET_PROP_DENYLIST} from "./mixins/widget-prop-denylist"; /** * Types */ -export type {PerseusOptions} from "./init"; export type {ILogger, LogErrorOptions} from "./logging/log"; export type {ServerItemRenderer as ServerItemRendererComponent} from "./server-item-renderer"; export type { diff --git a/packages/perseus/src/init.ts b/packages/perseus/src/init.ts index 8708b8fb4f..be79cf4c6d 100644 --- a/packages/perseus/src/init.ts +++ b/packages/perseus/src/init.ts @@ -2,57 +2,16 @@ import basicWidgets from "./basic-widgets"; import extraWidgets from "./extra-widgets"; import * as Widgets from "./widgets"; -declare const MathJax: any; - -export type PerseusOptions = { - // TODO(LEMS-1608): remove skipMathJax once we have completely removed the - // legacy MathJax 2 renderer from webapp. - skipMathJax: boolean; -}; - /** * This should be called by all clients, specifying whether extra widgets are * needed via `loadExtraWidgets`. It is idempotent, so it's not a problem to * call it multiple times. - * - * skipMathJax: - * If false/undefined, MathJax will be configured, and the - * promise will wait for MathJax to load (if it hasn't already). */ -const init = function (options: PerseusOptions): Promise { +const init = function () { Widgets.registerWidgets(basicWidgets); Widgets.registerWidgets(extraWidgets); Widgets.replaceDeprecatedWidgets(); - - // Pass skipMathJax: true if MathJax is already loaded and configured. - const skipMathJax = options.skipMathJax; - - if (skipMathJax) { - // @ts-expect-error - TS2322 - Type 'Promise' is not assignable to type 'Promise'. - return Promise.resolve(); - } - - return new Promise( - ( - resolve: (result: Promise) => void, - reject: (error?: any) => void, - ) => { - MathJax.Hub.Config({ - messageStyle: "none", - skipStartupTypeset: "none", - "HTML-CSS": { - availableFonts: ["TeX"], - imageFont: null, - scale: 100, - showMathMenu: false, - }, - }); - - MathJax.Hub.Configured(); - MathJax.Hub.Queue(resolve); - }, - ); }; export default init; diff --git a/packages/perseus/src/widgets/explanation/explanation.cypress.ts b/packages/perseus/src/widgets/explanation/explanation.cypress.ts index 4126300358..9c66e6ddf8 100644 --- a/packages/perseus/src/widgets/explanation/explanation.cypress.ts +++ b/packages/perseus/src/widgets/explanation/explanation.cypress.ts @@ -16,7 +16,7 @@ describe("Explanation Widget", () => { beforeEach(() => { Dependencies.setDependencies(cypressTestDependencies); - Perseus.init({skipMathJax: true}); + Perseus.init(); }); it("prevents interacting with actionable items within content when COLLAPSED (initial state)", () => { diff --git a/packages/perseus/src/widgets/grapher/grapher.cypress.ts b/packages/perseus/src/widgets/grapher/grapher.cypress.ts index 4baeff3b69..636b69b4dc 100644 --- a/packages/perseus/src/widgets/grapher/grapher.cypress.ts +++ b/packages/perseus/src/widgets/grapher/grapher.cypress.ts @@ -25,7 +25,7 @@ const LINES = "[data-interactive-kind-for-testing=movable-line] > svg > path"; describe("Grapher widget", () => { beforeEach(() => { - Perseus.init({skipMathJax: true}); + Perseus.init(); Perseus.Dependencies.setDependencies(cypressTestDependencies); });