erl-mathtextx-editor 0.1.2 → 0.1.3

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.
@@ -9677,7 +9677,7 @@ function Sc(n) {
9677
9677
  ...i,
9678
9678
  ...d
9679
9679
  };
9680
- typeof (f == null ? void 0 : f.default) == "function" && (f.default = f.default()), f != null && f.isRequired && (f == null ? void 0 : f.default) === void 0 && delete f.default, e.push({
9680
+ typeof f?.default == "function" && (f.default = f.default()), f?.isRequired && f?.default === void 0 && delete f.default, e.push({
9681
9681
  type: o.name,
9682
9682
  name: u,
9683
9683
  attribute: f
@@ -9789,7 +9789,7 @@ function Sh(n, e) {
9789
9789
  isolating: I(T(c, "isolating", d)),
9790
9790
  attrs: Object.fromEntries(u.map((y) => {
9791
9791
  var k;
9792
- return [y.name, { default: (k = y == null ? void 0 : y.attribute) === null || k === void 0 ? void 0 : k.default }];
9792
+ return [y.name, { default: (k = y?.attribute) === null || k === void 0 ? void 0 : k.default }];
9793
9793
  }))
9794
9794
  }), p = I(T(c, "parseHTML", d));
9795
9795
  p && (h.parseDOM = p.map((y) => tl(y, u)));
@@ -9821,7 +9821,7 @@ function Sh(n, e) {
9821
9821
  code: I(T(c, "code", d)),
9822
9822
  attrs: Object.fromEntries(u.map((g) => {
9823
9823
  var y;
9824
- return [g.name, { default: (y = g == null ? void 0 : g.attribute) === null || y === void 0 ? void 0 : y.default }];
9824
+ return [g.name, { default: (y = g?.attribute) === null || y === void 0 ? void 0 : y.default }];
9825
9825
  }))
9826
9826
  }), p = I(T(c, "parseHTML", d));
9827
9827
  p && (h.parseDOM = p.map((g) => tl(g, u)));
@@ -10044,9 +10044,9 @@ class he {
10044
10044
  const { tr: r } = e.state, s = e.state.selection.$from;
10045
10045
  if (s.pos === s.end()) {
10046
10046
  const o = s.marks();
10047
- if (!!!o.find((c) => (c == null ? void 0 : c.type.name) === t.name))
10047
+ if (!!!o.find((c) => c?.type.name === t.name))
10048
10048
  return !1;
10049
- const a = o.find((c) => (c == null ? void 0 : c.type.name) === t.name);
10049
+ const a = o.find((c) => c?.type.name === t.name);
10050
10050
  return a && r.removeStoredMark(a), r.insertText(" ", s.pos), e.view.dispatch(r), !0;
10051
10051
  }
10052
10052
  return !1;
@@ -10156,7 +10156,7 @@ function vh(n) {
10156
10156
  drop: (d, f) => {
10157
10157
  if (i = r === d.dom.parentElement, l = f, !i) {
10158
10158
  const h = Bn;
10159
- h != null && h.isEditable && setTimeout(() => {
10159
+ h?.isEditable && setTimeout(() => {
10160
10160
  const p = h.state.selection;
10161
10161
  p && h.commands.deleteRange({ from: p.from, to: p.to });
10162
10162
  }, 10);
@@ -10166,7 +10166,7 @@ function vh(n) {
10166
10166
  paste: (d, f) => {
10167
10167
  var h;
10168
10168
  const p = (h = f.clipboardData) === null || h === void 0 ? void 0 : h.getData("text/html");
10169
- return o = f, s = !!(p != null && p.includes("data-pm-slice")), !1;
10169
+ return o = f, s = !!p?.includes("data-pm-slice"), !1;
10170
10170
  }
10171
10171
  }
10172
10172
  },
@@ -10409,7 +10409,7 @@ function Cc(n, e, t) {
10409
10409
  return n.nodesBetween(r, s, (a, c, u, d) => {
10410
10410
  var f;
10411
10411
  a.isBlock && c > r && (l += i);
10412
- const h = o == null ? void 0 : o[a.type.name];
10412
+ const h = o?.[a.type.name];
10413
10413
  if (h)
10414
10414
  return u && (l += h({
10415
10415
  node: a,
@@ -10418,7 +10418,7 @@ function Cc(n, e, t) {
10418
10418
  index: d,
10419
10419
  range: e
10420
10420
  })), !1;
10421
- a.isText && (l += (f = a == null ? void 0 : a.text) === null || f === void 0 ? void 0 : f.slice(Math.max(r, c) - c, s - c));
10421
+ a.isText && (l += (f = a?.text) === null || f === void 0 ? void 0 : f.slice(Math.max(r, c) - c, s - c));
10422
10422
  }), l;
10423
10423
  }
10424
10424
  function wc(n) {
@@ -10449,7 +10449,7 @@ const Rh = U.create({
10449
10449
  }
10450
10450
  }), Dh = () => ({ editor: n, view: e }) => (requestAnimationFrame(() => {
10451
10451
  var t;
10452
- n.isDestroyed || (e.dom.blur(), (t = window == null ? void 0 : window.getSelection()) === null || t === void 0 || t.removeAllRanges());
10452
+ n.isDestroyed || (e.dom.blur(), (t = window?.getSelection()) === null || t === void 0 || t.removeAllRanges());
10453
10453
  }), !0), Ih = (n = !1) => ({ commands: e }) => e.setContent("", n), Lh = () => ({ state: n, tr: e, dispatch: t }) => {
10454
10454
  const { selection: r } = e, { ranges: s } = r;
10455
10455
  return t && s.forEach(({ $from: i, $to: o }) => {
@@ -10795,7 +10795,7 @@ const ap = (n) => ({ editor: e, view: t, tr: r, dispatch: s }) => {
10795
10795
  }), a = e.captureTransaction(() => {
10796
10796
  t.someProp("handleKeyDown", (c) => c(t, l));
10797
10797
  });
10798
- return a == null || a.steps.forEach((c) => {
10798
+ return a?.steps.forEach((c) => {
10799
10799
  const u = c.map(r.mapping);
10800
10800
  u && s && r.maybeStep(u);
10801
10801
  }), !0;
@@ -10983,7 +10983,7 @@ function Vi(n, e, t) {
10983
10983
  ...o
10984
10984
  });
10985
10985
  }) : t.nodesBetween(n, e, (s, i) => {
10986
- !s || (s == null ? void 0 : s.nodeSize) === void 0 || r.push(...s.marks.map((o) => ({
10986
+ !s || s?.nodeSize === void 0 || r.push(...s.marks.map((o) => ({
10987
10987
  from: i,
10988
10988
  to: i + s.nodeSize,
10989
10989
  mark: o
@@ -11129,7 +11129,7 @@ const Ip = (n, e = {}) => ({ tr: t, state: r, dispatch: s }) => {
11129
11129
  function ll(n, e) {
11130
11130
  const t = n.storedMarks || n.selection.$to.parentOffset && n.selection.$from.marks();
11131
11131
  if (t) {
11132
- const r = t.filter((s) => e == null ? void 0 : e.includes(s.type.name));
11132
+ const r = t.filter((s) => e?.includes(s.type.name));
11133
11133
  n.tr.ensureMarks(r);
11134
11134
  }
11135
11135
  }
@@ -11222,7 +11222,7 @@ const Fp = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
11222
11222
  if (r === void 0)
11223
11223
  return !0;
11224
11224
  const s = n.doc.nodeAt(r);
11225
- return t.node.type === (s == null ? void 0 : s.type) && ct(n.doc, t.pos) && n.join(t.pos), !0;
11225
+ return t.node.type === s?.type && ct(n.doc, t.pos) && n.join(t.pos), !0;
11226
11226
  }, ks = (n, e) => {
11227
11227
  const t = $i((o) => o.type === e)(n.selection);
11228
11228
  if (!t)
@@ -11231,7 +11231,7 @@ const Fp = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
11231
11231
  if (r === void 0)
11232
11232
  return !0;
11233
11233
  const s = n.doc.nodeAt(r);
11234
- return t.node.type === (s == null ? void 0 : s.type) && ct(n.doc, r) && n.join(r), !0;
11234
+ return t.node.type === s?.type && ct(n.doc, r) && n.join(r), !0;
11235
11235
  }, Vp = (n, e, t, r = {}) => ({ editor: s, tr: i, state: o, dispatch: l, chain: a, commands: c, can: u }) => {
11236
11236
  const { extensions: d, splittableMarks: f } = s.extensionManager, h = X(n, o.schema), p = X(e, o.schema), { selection: m, storedMarks: g } = o, { $from: y, $to: k } = m, C = y.blockRange(k), E = g || m.$to.parentOffset && m.$from.marks();
11237
11237
  if (!C)
@@ -11916,7 +11916,7 @@ class am extends gh {
11916
11916
  im,
11917
11917
  Zp,
11918
11918
  sm
11919
- ].filter((i) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[i.name] !== !1 : !0) : [], ...this.options.extensions].filter((i) => ["extension", "node", "mark"].includes(i == null ? void 0 : i.type));
11919
+ ].filter((i) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[i.name] !== !1 : !0) : [], ...this.options.extensions].filter((i) => ["extension", "node", "mark"].includes(i?.type));
11920
11920
  this.extensionManager = new _t(s, this);
11921
11921
  }
11922
11922
  /**
@@ -12594,7 +12594,7 @@ class ym extends J.Component {
12594
12594
  J.Fragment,
12595
12595
  null,
12596
12596
  J.createElement("div", { ref: pm(t, this.editorContentRef), ...r }),
12597
- (e == null ? void 0 : e.contentComponent) && J.createElement(mm, { contentComponent: e.contentComponent })
12597
+ e?.contentComponent && J.createElement(mm, { contentComponent: e.contentComponent })
12598
12598
  );
12599
12599
  }
12600
12600
  }
@@ -13013,7 +13013,7 @@ class Im {
13013
13013
  const t = this.component, r = this.props, s = this.editor, i = Dm(), o = Rm(t), l = { ...r };
13014
13014
  l.ref && !(i || o) && delete l.ref, !l.ref && (i || o) && (l.ref = (a) => {
13015
13015
  this.ref = a;
13016
- }), this.reactElement = J.createElement(t, { ...l }), (e = s == null ? void 0 : s.contentComponent) === null || e === void 0 || e.setRenderer(this.id, this);
13016
+ }), this.reactElement = J.createElement(t, { ...l }), (e = s?.contentComponent) === null || e === void 0 || e.setRenderer(this.id, this);
13017
13017
  }
13018
13018
  /**
13019
13019
  * Re-renders the React component with new props.
@@ -13030,7 +13030,7 @@ class Im {
13030
13030
  destroy() {
13031
13031
  var e;
13032
13032
  const t = this.editor;
13033
- (e = t == null ? void 0 : t.contentComponent) === null || e === void 0 || e.removeRenderer(this.id);
13033
+ (e = t?.contentComponent) === null || e === void 0 || e.removeRenderer(this.id);
13034
13034
  }
13035
13035
  /**
13036
13036
  * Update the attributes of the element that holds the React component.
@@ -13503,7 +13503,7 @@ const Pm = /^\s*>\s$/, Bm = j.create({
13503
13503
  handlePaste: (n, e) => {
13504
13504
  if (!e.clipboardData || this.editor.isActive(this.type.name))
13505
13505
  return !1;
13506
- const t = e.clipboardData.getData("text/plain"), r = e.clipboardData.getData("vscode-editor-data"), s = r ? JSON.parse(r) : void 0, i = s == null ? void 0 : s.mode;
13506
+ const t = e.clipboardData.getData("text/plain"), r = e.clipboardData.getData("vscode-editor-data"), s = r ? JSON.parse(r) : void 0, i = s?.mode;
13507
13507
  if (!t || !i)
13508
13508
  return !1;
13509
13509
  const { tr: o, schema: l } = n.state, a = l.text(t.replace(/\r\n?/g, `
@@ -14788,7 +14788,7 @@ const Bc = Pc(!1, !0), zc = Pc(!0, !0), Sg = U.create({
14788
14788
  return !1;
14789
14789
  const p = f.doc.nodeAt(h);
14790
14790
  return f.setNodeMarkup(h, void 0, {
14791
- ...p == null ? void 0 : p.attrs,
14791
+ ...p?.attrs,
14792
14792
  checked: d
14793
14793
  }), !0;
14794
14794
  }).run(), !r.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(n, d) || (l.checked = !l.checked));
@@ -15047,7 +15047,7 @@ var Wc = /* @__PURE__ */ Object.freeze({
15047
15047
  WORD: Fe,
15048
15048
  WS: ui
15049
15049
  });
15050
- const ze = /[a-z]/, Xt = new RegExp("\\p{L}", "u"), As = new RegExp("\\p{Emoji}", "u"), He = /\d/, vs = /\s/, wl = "\r", Ns = `
15050
+ const ze = /[a-z]/, Xt = /\p{L}/u, As = /\p{Emoji}/u, He = /\d/, vs = /\s/, wl = "\r", Ns = `
15051
15051
  `, Vg = "️", _g = "‍", Rs = "";
15052
15052
  let Fn = null, $n = null;
15053
15053
  function Wg(n = []) {
@@ -15604,7 +15604,7 @@ function ry(n) {
15604
15604
  l.push(o), o = o.parentNode;
15605
15605
  if (!l.find((f) => f.nodeName === "A"))
15606
15606
  return !1;
15607
- const a = Nc(e.state, n.type.name), c = r.target, u = (s = c == null ? void 0 : c.href) !== null && s !== void 0 ? s : a.href, d = (i = c == null ? void 0 : c.target) !== null && i !== void 0 ? i : a.target;
15607
+ const a = Nc(e.state, n.type.name), c = r.target, u = (s = c?.href) !== null && s !== void 0 ? s : a.href, d = (i = c?.target) !== null && i !== void 0 ? i : a.target;
15608
15608
  return c && u ? (window.open(u, d), !0) : !1;
15609
15609
  }
15610
15610
  }
@@ -16449,7 +16449,7 @@ function Zc(n, { map: e, tableStart: t, table: r }, s) {
16449
16449
  }), c += f.colspan - 1;
16450
16450
  } else {
16451
16451
  var a;
16452
- const d = l == null ? le(r.type.schema).cell : (a = r.nodeAt(e.map[u + l * e.width])) === null || a === void 0 ? void 0 : a.type, f = d == null ? void 0 : d.createAndFill();
16452
+ const d = l == null ? le(r.type.schema).cell : (a = r.nodeAt(e.map[u + l * e.width])) === null || a === void 0 ? void 0 : a.type, f = d?.createAndFill();
16453
16453
  f && o.push(f);
16454
16454
  }
16455
16455
  return n.insert(i, le(r.type.schema).row.create(null, o)), n;
@@ -17143,7 +17143,7 @@ function Qy(n, e, t, r) {
17143
17143
  function c(d) {
17144
17144
  i.removeEventListener("mouseup", c), i.removeEventListener("mousemove", u);
17145
17145
  const f = me.getState(n.state);
17146
- f != null && f.dragging && (Zy(n, f.activeHandle, Hl(f.dragging, d, t)), n.dispatch(n.state.tr.setMeta(me, { setDragging: null })));
17146
+ f?.dragging && (Zy(n, f.activeHandle, Hl(f.dragging, d, t)), n.dispatch(n.state.tr.setMeta(me, { setDragging: null })));
17147
17147
  }
17148
17148
  function u(d) {
17149
17149
  if (!d.which) return c(d);
@@ -17351,7 +17351,7 @@ const Kn = ({ editor: n }) => {
17351
17351
  return !1;
17352
17352
  let t = 0;
17353
17353
  const r = vc(e.ranges[0].$from, (i) => i.type.name === "table");
17354
- return r == null || r.node.descendants((i) => {
17354
+ return r?.node.descendants((i) => {
17355
17355
  if (i.type.name === "table")
17356
17356
  return !1;
17357
17357
  ["tableCell", "tableHeader"].includes(i.type.name) && (t += 1);
@@ -11581,7 +11581,7 @@ class Gt {
11581
11581
  */
11582
11582
  parseAtom(e) {
11583
11583
  var t = this.parseGroup("atom", e);
11584
- if ((t == null ? void 0 : t.type) === "internal" || this.mode === "text")
11584
+ if (t?.type === "internal" || this.mode === "text")
11585
11585
  return t;
11586
11586
  for (var a, n; ; ) {
11587
11587
  this.consumeSpaces();
package/dist/viewer.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as r } from "./ContentViewer-DcvxXP9t.js";
1
+ import { C as r } from "./ContentViewer-COGXSiwX.js";
2
2
  export {
3
3
  r as ContentViewer
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "erl-mathtextx-editor",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Visual math editor component for solutest.id — CKEditor replacement with zero-LaTeX approach",
5
5
  "type": "module",
6
6
  "main": "./dist/erl-mathtextx-editor.umd.cjs",
@@ -60,12 +60,12 @@
60
60
  "@tiptap/extension-strike": "^2.11.0",
61
61
  "@tiptap/extension-subscript": "^2.11.0",
62
62
  "@tiptap/extension-superscript": "^2.11.0",
63
- "@tiptap/extension-task-item": "^2.11.0",
64
- "@tiptap/extension-task-list": "^2.11.0",
65
63
  "@tiptap/extension-table": "^2.11.0",
66
64
  "@tiptap/extension-table-cell": "^2.11.0",
67
65
  "@tiptap/extension-table-header": "^2.11.0",
68
66
  "@tiptap/extension-table-row": "^2.11.0",
67
+ "@tiptap/extension-task-item": "^2.11.0",
68
+ "@tiptap/extension-task-list": "^2.11.0",
69
69
  "@tiptap/extension-text": "^2.11.0",
70
70
  "@tiptap/extension-text-align": "^2.27.2",
71
71
  "@tiptap/extension-text-style": "^2.27.2",
@@ -84,6 +84,7 @@
84
84
  },
85
85
  "devDependencies": {
86
86
  "@eslint/js": "^9.39.2",
87
+ "@fullhuman/postcss-purgecss": "^8.0.0",
87
88
  "@types/dompurify": "^3.0.5",
88
89
  "@types/react": "^18.2.0",
89
90
  "@types/react-dom": "^18.2.0",