@pie-lib/math-toolbar 4.0.8-next.20261103123052 → 4.0.8-next.20261109072207

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,7 +30,7 @@ export declare class EditorAndPad extends React.Component {
30
30
  updateDisable: any;
31
31
  onAnswerBlockClick: any;
32
32
  onEditorChange: any;
33
- /** Only render if the mathquill instance's latex is different
33
+ /** Only render if the editor's latex is different
34
34
  * or the keypad state changed from one state to the other (shown / hidden) */
35
35
  shouldComponentUpdate(nextProps: any, nextState: any): boolean;
36
36
  onEditorTypeChange: any;
@@ -9,7 +9,7 @@ import s from "@mui/material/Select";
9
9
  import { isEqual as c } from "@pie-element/shared-lodash";
10
10
  import l from "@mui/material/FormControl";
11
11
  import u from "@mui/material/InputLabel";
12
- import { HorizontalKeypad as d, mq as f, updateSpans as p } from "@pie-lib/math-input";
12
+ import { HorizontalKeypad as d, mq as f, updateSpans as p } from "@pie-lib/math-input-mathlive";
13
13
  import { color as m } from "@pie-lib/render-ui";
14
14
  import { jsx as h, jsxs as g } from "react/jsx-runtime";
15
15
  //#region src/editor-and-pad.tsx
@@ -196,7 +196,7 @@ var { commonMqFontStyles: _, commonMqKeyboardStyles: v, longdivStyles: y, supsub
196
196
  }
197
197
  onClick = (e) => {
198
198
  let { noDecimal: t, noLatexHandling: n, onChange: r } = this.props, i = M(e);
199
- x("mathChange: ", i), n ? r(i.value) : (!t || i.value !== "." && i.value !== ",") && i && (i.type === "clear" ? (x("call clear..."), this.input.clear()) : i.type === "command" ? this.input.command(i.value) : i.type === "cursor" ? this.input.keystroke(i.value) : i.type === "answer" ? this.input.write("%response%") : this.input.write(i.value));
199
+ x("mathChange: ", i), n ? r(i.value) : (!t || i.value !== "." && i.value !== ",") && i && (i.type === "clear" ? (x("call clear..."), this.input.clear()) : i.type === "command" ? this.input.command(i.value) : i.type === "cursor" ? this.input.keystroke(i.value) : i.type === "answer" ? this.input.write("\\%response\\%") : this.input.write(i.value));
200
200
  };
201
201
  updateDisable = (e) => {
202
202
  let { maxResponseAreas: t } = this.props;
@@ -210,20 +210,10 @@ var { commonMqFontStyles: _, commonMqKeyboardStyles: v, longdivStyles: y, supsub
210
210
  };
211
211
  onEditorChange = (t) => {
212
212
  let { onChange: n, noDecimal: r } = this.props;
213
- if (p(), e(), this.updateDisable(!0), r && (t.indexOf(".") !== -1 || t.indexOf(",") !== -1) && this.input) {
214
- this.input.clear(), this.input.write(t.replace(S, ""));
215
- return;
216
- }
217
- let i = t.match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);
218
- if (this.input && i && i?.length) try {
219
- this.input.mathField.__controller.cursor.insLeftOf(this.input.mathField.__controller.cursor.parent[-1].parent), this.input.mathField.el().dispatchEvent(new KeyboardEvent("keydown", { keyCode: 8 }));
220
- } catch (e) {
221
- console.error(e.toString());
222
- }
223
- else n(t);
213
+ p(), e(), this.updateDisable(!0), r && (t.indexOf(".") !== -1 || t.indexOf(",") !== -1) && this.input ? (this.input.clear(), this.input.write(t.replace(S, ""))) : this.input && /[0-9]\\ \\frac\{[^{}]*\}\{\s*\}/.test(t) && this.input.joinMixedNumber() || n(t);
224
214
  };
225
215
  shouldComponentUpdate(e, t) {
226
- let n = this.input.mathField.latex() !== e.latex;
216
+ let n = !this.input || this.input.latex() !== e.latex;
227
217
  return x("[shouldComponentUpdate] ", "inputIsDifferent: ", n), !c(this.props.error, e.error) || !n && this.props.keypadMode !== e.keypadMode || !n && this.props.noDecimal !== e.noDecimal || !n && this.state.equationEditor !== t.equationEditor ? !0 : !n && this.props.controlledKeypad ? this.props.showKeypad !== e.showKeypad : n;
228
218
  }
229
219
  onEditorTypeChange = (e) => {
@@ -3,7 +3,7 @@ import t from "react";
3
3
  import n from "prop-types";
4
4
  import r from "debug";
5
5
  import { styled as i } from "@mui/material/styles";
6
- import { mq as a } from "@pie-lib/math-input";
6
+ import { mq as a } from "@pie-lib/math-input-mathlive";
7
7
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
8
  //#region src/math-preview.tsx
9
9
  var { commonMqFontStyles: c, longdivStyles: l, supsubStyles: u } = a.CommonMqStyles, d = r("@pie-lib:math-toolbar:math-preview"), f = i("div")(({ theme: e, isSelected: t }) => ({
@@ -14,6 +14,10 @@ var { commonMqFontStyles: c, longdivStyles: l, supsubStyles: u } = a.CommonMqSty
14
14
  ...u,
15
15
  ...l,
16
16
  "& > .mq-math-mode": { border: t ? "solid 0px lightgrey" : "solid 1px lightgrey" },
17
+ "& .ML__latex": {
18
+ border: t ? "solid 0px lightgrey" : "solid 1px lightgrey",
19
+ padding: t ? "0px" : "5px"
20
+ },
17
21
  "& > .mq-focused": {
18
22
  outline: "none",
19
23
  boxShadow: "none",
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@pie-lib/math-toolbar",
3
- "version": "4.0.8-next.20261103123052",
3
+ "version": "4.0.8-next.20261109072207",
4
4
  "description": "Math toolbar for editing math equations",
5
+ "license": "MIT",
5
6
  "repository": {
6
7
  "type": "git",
7
8
  "url": "git+https://github.com/pie-framework/pie-elements-ng.git",
@@ -12,8 +13,8 @@
12
13
  "@emotion/styled": "^11.14.1",
13
14
  "@mui/icons-material": "^7.3.4",
14
15
  "@mui/material": "^7.3.4",
15
- "@pie-lib/math-input": "9.0.8-next.20261103123052",
16
- "@pie-lib/render-ui": "8.0.8-next.20261103123052",
16
+ "@pie-lib/math-input-mathlive": "2.0.1-next.20261109072207",
17
+ "@pie-lib/render-ui": "8.0.8-next.20261106152257",
17
18
  "debug": "^4.1.1",
18
19
  "prop-types": "^15.7.2",
19
20
  "@pie-element/shared-lodash": "0.1.4-next.20261026212738"