@zzish/math-rich-input 0.1.51 → 0.1.53

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzish/math-rich-input",
3
- "version": "0.1.51",
3
+ "version": "0.1.53",
4
4
  "description": "React component for user to enter rich text with embedded math equations.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,7 +54,7 @@
54
54
  "webpack-cli": "^4.9.2"
55
55
  },
56
56
  "peerDependencies": {
57
- "react": "^16.14.0 || ^17.0.0 || ^18.0.0",
58
- "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0"
57
+ "react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
58
+ "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
59
59
  }
60
60
  }
@@ -14,7 +14,7 @@ import {
14
14
 
15
15
  function getAllTextNodes(node, nodes = null) {
16
16
  if (node === null) {
17
- console.warn("Deverloper supplied a null node. Ignoring");
17
+ console.warn("Developer supplied a null node. Ignoring");
18
18
  return nodes;
19
19
  }
20
20
 
@@ -47,8 +47,10 @@ function getAllTextNodes(node, nodes = null) {
47
47
  }
48
48
 
49
49
  export function renderMathInNode(node) {
50
+ if (node === null || node === undefined) return;
51
+
50
52
  try {
51
- let textNodes = getAllTextNodes(node);
53
+ let textNodes = getAllTextNodes(node, []);
52
54
  for (let i = 0; i < textNodes.length; i++) {
53
55
  try {
54
56
  const text = textNodes[i].nodeValue;
@@ -74,6 +76,7 @@ export function renderMathInNode(node) {
74
76
  }
75
77
 
76
78
  export function renderMathInNodeArray(nodes) {
79
+ if (!nodes) return;
77
80
  for (let i = 0; i < nodes.length; i++) renderMathInNode(nodes[i]);
78
81
  }
79
82