aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/EquationEditor.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-09-02 09:26:37 -0400
committerbobzel <zzzman@gmail.com>2024-09-02 09:26:37 -0400
commitcda69e48361fce8d71a4dc66edd9dd976a27f52d (patch)
tree82b9a1a5967ae88a9534f89f7eaed3aeb289652f /src/client/views/nodes/formattedText/EquationEditor.tsx
parentc01828308714874589d1f60c33ca59df4c656c0c (diff)
parenta958577d4c27b276aa37484e3f895e196138b17c (diff)
Merge branch 'master' into alyssa-starter
Diffstat (limited to 'src/client/views/nodes/formattedText/EquationEditor.tsx')
-rw-r--r--src/client/views/nodes/formattedText/EquationEditor.tsx17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/client/views/nodes/formattedText/EquationEditor.tsx b/src/client/views/nodes/formattedText/EquationEditor.tsx
index d9b1a2cf8..8bb4a0a26 100644
--- a/src/client/views/nodes/formattedText/EquationEditor.tsx
+++ b/src/client/views/nodes/formattedText/EquationEditor.tsx
@@ -3,15 +3,12 @@ import React, { Component, createRef } from 'react';
// Import JQuery, required for the functioning of the equation editor
import $ from 'jquery';
-
import './EquationEditor.scss';
-// @ts-ignore
-window.jQuery = $;
-
-// @ts-ignore
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+(window as any).jQuery = $;
require('mathquill/build/mathquill');
-
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
(window as any).MathQuill = (window as any).MathQuill.getInterface(1);
type EquationEditorProps = {
@@ -36,17 +33,18 @@ type EquationEditorProps = {
* @extends {Component<EquationEditorProps>}
*/
class EquationEditor extends Component<EquationEditorProps> {
- element: any;
+ element: React.RefObject<HTMLSpanElement>;
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
mathField: any;
ignoreEditEvents: number;
// Element needs to be in the class format and thus requires a constructor. The steps that are run
// in the constructor is to make sure that React can succesfully communicate with the equation
// editor.
- constructor(props: any) {
+ constructor(props: EquationEditorProps) {
super(props);
- this.element = createRef();
+ this.element = createRef<HTMLSpanElement>();
this.mathField = null;
// MathJax apparently fire 2 edit events on startup.
@@ -74,6 +72,7 @@ class EquationEditor extends Component<EquationEditorProps> {
autoOperatorNames,
};
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
this.mathField = (window as any).MathQuill.MathField(this.element.current, config);
this.mathField.latex(value || '');
}