@cyte-editor/react 1.0.6 → 1.1.0

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.
@@ -1,17 +1,17 @@
1
- import { jsx as c, jsxs as v, Fragment as Ft } from "react/jsx-runtime";
2
- import Ot, { useRef as H, useState as D, useCallback as E, useEffect as _, useMemo as _e, useLayoutEffect as Sn, forwardRef as Mn, useImperativeHandle as cn } from "react";
3
- import { EditorManager as Tn, I18nManager as Ve, toolbarItemDefs as _t, uploadFile as Ln, groupToolbarItems as Rn, getToolbarItemDef as En, adjustMenuPosition as Vt, ScrollSyncManager as Dn, showToast as yt, getHoverLineVisible as An, moveCursorToCell as Ze, restoreTableSelection as jt, clearSavedTableSelection as qt } from "@cyte-editor/core";
1
+ import { jsx as c, jsxs as v, Fragment as Pt } from "react/jsx-runtime";
2
+ import Ht, { useRef as H, useState as D, useCallback as E, useEffect as _, useMemo as _e, useLayoutEffect as Sn, forwardRef as Mn, useImperativeHandle as cn } from "react";
3
+ import { EditorManager as Tn, I18nManager as je, toolbarItemDefs as Mt, uploadFile as Ln, groupToolbarItems as Rn, getToolbarItemDef as En, adjustMenuPosition as jt, ScrollSyncManager as Dn, showToast as yt, getHoverLineVisible as An, moveCursorToCell as Ze, restoreTableSelection as Vt, clearSavedTableSelection as qt } from "@cyte-editor/core";
4
4
  import { getLicenseStatus as In } from "@cyte-editor/license";
5
5
  import { createPortal as tt } from "react-dom";
6
6
  /*!
7
- * CyteEditor React Adapter v1.0.6 (@cyte-editor/react)
7
+ * CyteEditor React Adapter v1.1.0 (@cyte-editor/react)
8
8
  * (c) 2026 CyteEditor — All Rights Reserved.
9
9
  *
10
10
  * Commercial Software — NOT Open Source.
11
11
  * Licensed under the CyteEditor Commercial License.
12
12
  * SEE LICENSE IN ./LICENSE | Full EULA: https://cyteeditor.com/eula
13
13
  *
14
- * Build: 0562285-dirty @ 2026-09-07T11:34:59.286Z
14
+ * Build: 3134734-dirty @ 2026-10-05T08:42:26.368Z
15
15
  * Homepage: https://cyteeditor.com
16
16
  * Contact: legal@cyteeditor.com (legal) / support@cyteeditor.com (support)
17
17
  *
@@ -320,9 +320,9 @@ class Q {
320
320
  }
321
321
  }
322
322
  Q.empty = new Q([], 0);
323
- const Mt = { index: 0, offset: 0 };
323
+ const Tt = { index: 0, offset: 0 };
324
324
  function dt(n, e) {
325
- return Mt.index = n, Mt.offset = e, Mt;
325
+ return Tt.index = n, Tt.offset = e, Tt;
326
326
  }
327
327
  class $n extends Error {
328
328
  }
@@ -569,7 +569,7 @@ class xe {
569
569
  }
570
570
  }
571
571
  xe.empty = new xe([]);
572
- const Tt = /* @__PURE__ */ Object.create(null);
572
+ const Lt = /* @__PURE__ */ Object.create(null);
573
573
  class ye {
574
574
  /**
575
575
  Get the step map that represents the changes made by this step,
@@ -594,7 +594,7 @@ class ye {
594
594
  static fromJSON(e, t) {
595
595
  if (!t || !t.stepType)
596
596
  throw new RangeError("Invalid input for Step.fromJSON");
597
- let r = Tt[t.stepType];
597
+ let r = Lt[t.stepType];
598
598
  if (!r)
599
599
  throw new RangeError(`No step type ${t.stepType} defined`);
600
600
  return r.fromJSON(e, t);
@@ -606,9 +606,9 @@ class ye {
606
606
  that's unlikely to clash with steps from other modules.
607
607
  */
608
608
  static jsonID(e, t) {
609
- if (e in Tt)
609
+ if (e in Lt)
610
610
  throw new RangeError("Duplicate use of step JSON ID " + e);
611
- return Tt[e] = t, t.prototype.jsonID = e, t;
611
+ return Lt[e] = t, t.prototype.jsonID = e, t;
612
612
  }
613
613
  }
614
614
  class ue {
@@ -645,11 +645,11 @@ class ue {
645
645
  }
646
646
  }
647
647
  }
648
- function Pt(n, e, t) {
648
+ function Jt(n, e, t) {
649
649
  let r = [];
650
650
  for (let o = 0; o < n.childCount; o++) {
651
651
  let s = n.child(o);
652
- s.content.size && (s = s.copy(Pt(s.content, e, s))), s.isInline && (s = e(s, t, o)), r.push(s);
652
+ s.content.size && (s = s.copy(Jt(s.content, e, s))), s.isInline && (s = e(s, t, o)), r.push(s);
653
653
  }
654
654
  return Q.fromArray(r);
655
655
  }
@@ -661,7 +661,7 @@ class We extends ye {
661
661
  super(), this.from = e, this.to = t, this.mark = r;
662
662
  }
663
663
  apply(e) {
664
- let t = e.slice(this.from, this.to), r = e.resolve(this.from), o = r.node(r.sharedDepth(this.to)), s = new X(Pt(t.content, (i, l) => !i.isAtom || !l.type.allowsMarkType(this.mark.type) ? i : i.mark(this.mark.addToSet(i.marks)), o), t.openStart, t.openEnd);
664
+ let t = e.slice(this.from, this.to), r = e.resolve(this.from), o = r.node(r.sharedDepth(this.to)), s = new X(Jt(t.content, (i, l) => !i.isAtom || !l.type.allowsMarkType(this.mark.type) ? i : i.mark(this.mark.addToSet(i.marks)), o), t.openStart, t.openEnd);
665
665
  return ue.fromReplace(e, this.from, this.to, s);
666
666
  }
667
667
  invert() {
@@ -700,7 +700,7 @@ class Ke extends ye {
700
700
  super(), this.from = e, this.to = t, this.mark = r;
701
701
  }
702
702
  apply(e) {
703
- let t = e.slice(this.from, this.to), r = new X(Pt(t.content, (o) => o.mark(this.mark.removeFromSet(o.marks)), e), t.openStart, t.openEnd);
703
+ let t = e.slice(this.from, this.to), r = new X(Jt(t.content, (o) => o.mark(this.mark.removeFromSet(o.marks)), e), t.openStart, t.openEnd);
704
704
  return ue.fromReplace(e, this.from, this.to, r);
705
705
  }
706
706
  invert() {
@@ -824,7 +824,7 @@ class De extends ye {
824
824
  super(), this.from = e, this.to = t, this.slice = r, this.structure = o;
825
825
  }
826
826
  apply(e) {
827
- return this.structure && Ht(e, this.from, this.to) ? ue.fail("Structure replace would overwrite content") : ue.fromReplace(e, this.from, this.to, this.slice);
827
+ return this.structure && Bt(e, this.from, this.to) ? ue.fail("Structure replace would overwrite content") : ue.fromReplace(e, this.from, this.to, this.slice);
828
828
  }
829
829
  getMap() {
830
830
  return new xe([this.from, this.to - this.from, this.slice.size]);
@@ -873,7 +873,7 @@ class et extends ye {
873
873
  super(), this.from = e, this.to = t, this.gapFrom = r, this.gapTo = o, this.slice = s, this.insert = i, this.structure = l;
874
874
  }
875
875
  apply(e) {
876
- if (this.structure && (Ht(e, this.from, this.gapFrom) || Ht(e, this.gapTo, this.to)))
876
+ if (this.structure && (Bt(e, this.from, this.gapFrom) || Bt(e, this.gapTo, this.to)))
877
877
  return ue.fail("Structure gap-replace would overwrite content");
878
878
  let t = e.slice(this.gapFrom, this.gapTo);
879
879
  if (t.openStart || t.openEnd)
@@ -920,7 +920,7 @@ class et extends ye {
920
920
  }
921
921
  }
922
922
  ye.jsonID("replaceAround", et);
923
- function Ht(n, e, t) {
923
+ function Bt(n, e, t) {
924
924
  let r = n.resolve(e), o = t - e, s = r.depth;
925
925
  for (; o > 0 && s > 0 && r.indexAfter(s) == r.node(s).childCount; )
926
926
  s--, o--;
@@ -1015,7 +1015,7 @@ ct = function n(e) {
1015
1015
  ct.prototype = Object.create(Error.prototype);
1016
1016
  ct.prototype.constructor = ct;
1017
1017
  ct.prototype.name = "TransformError";
1018
- const Lt = /* @__PURE__ */ Object.create(null);
1018
+ const Rt = /* @__PURE__ */ Object.create(null);
1019
1019
  class ee {
1020
1020
  /**
1021
1021
  Initialize a selection with the head and anchor and ranges. If no
@@ -1151,7 +1151,7 @@ class ee {
1151
1151
  static fromJSON(e, t) {
1152
1152
  if (!t || !t.type)
1153
1153
  throw new RangeError("Invalid input for Selection.fromJSON");
1154
- let r = Lt[t.type];
1154
+ let r = Rt[t.type];
1155
1155
  if (!r)
1156
1156
  throw new RangeError(`No selection type ${t.type} defined`);
1157
1157
  return r.fromJSON(e, t);
@@ -1163,9 +1163,9 @@ class ee {
1163
1163
  clash with classes from other modules.
1164
1164
  */
1165
1165
  static jsonID(e, t) {
1166
- if (e in Lt)
1166
+ if (e in Rt)
1167
1167
  throw new RangeError("Duplicate use of selection JSON ID " + e);
1168
- return Lt[e] = t, t.prototype.jsonID = e, t;
1168
+ return Rt[e] = t, t.prototype.jsonID = e, t;
1169
1169
  }
1170
1170
  /**
1171
1171
  Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
@@ -1299,7 +1299,7 @@ class Le extends ee {
1299
1299
  return { type: "node", anchor: this.anchor };
1300
1300
  }
1301
1301
  getBookmark() {
1302
- return new Jt(this.anchor);
1302
+ return new Wt(this.anchor);
1303
1303
  }
1304
1304
  /**
1305
1305
  @internal
@@ -1325,13 +1325,13 @@ class Le extends ee {
1325
1325
  }
1326
1326
  Le.prototype.visible = !1;
1327
1327
  ee.jsonID("node", Le);
1328
- class Jt {
1328
+ class Wt {
1329
1329
  constructor(e) {
1330
1330
  this.anchor = e;
1331
1331
  }
1332
1332
  map(e) {
1333
1333
  let { deleted: t, pos: r } = e.mapResult(this.anchor);
1334
- return t ? new xt(r, r) : new Jt(r);
1334
+ return t ? new xt(r, r) : new Wt(r);
1335
1335
  }
1336
1336
  resolve(e) {
1337
1337
  let t = e.resolve(this.anchor), r = t.nodeAfter;
@@ -1447,11 +1447,11 @@ new ut("doc", {
1447
1447
  return n.scrolledIntoView ? e + 1 : e;
1448
1448
  }
1449
1449
  });
1450
- const Rt = /* @__PURE__ */ Object.create(null);
1450
+ const Et = /* @__PURE__ */ Object.create(null);
1451
1451
  function zn(n) {
1452
- return n in Rt ? n + "$" + ++Rt[n] : (Rt[n] = 0, n + "$");
1452
+ return n in Et ? n + "$" + ++Et[n] : (Et[n] = 0, n + "$");
1453
1453
  }
1454
- class Wt {
1454
+ class Kt {
1455
1455
  /**
1456
1456
  Create a plugin key.
1457
1457
  */
@@ -1555,7 +1555,7 @@ for (var me = 0; me < 10; me++) He[48 + me] = He[96 + me] = String(me);
1555
1555
  for (var me = 1; me <= 24; me++) He[me + 111] = "F" + me;
1556
1556
  for (var me = 65; me <= 90; me++)
1557
1557
  He[me] = String.fromCharCode(me + 32), bt[me] = String.fromCharCode(me);
1558
- for (var Et in He) bt.hasOwnProperty(Et) || (bt[Et] = He[Et]);
1558
+ for (var Dt in He) bt.hasOwnProperty(Dt) || (bt[Dt] = He[Dt]);
1559
1559
  function Jn(n) {
1560
1560
  var e = Fn && n.metaKey && n.shiftKey && !n.ctrlKey && !n.altKey || Pn && n.shiftKey && n.key && n.key.length == 1 || n.key == "Unidentified", t = !e && n.key || (n.shiftKey ? bt : He)[n.keyCode] || n.key || "Unidentified";
1561
1561
  return t == "Esc" && (t = "Escape"), t == "Del" && (t = "Delete"), t == "Left" && (t = "ArrowLeft"), t == "Up" && (t = "ArrowUp"), t == "Right" && (t = "ArrowRight"), t == "Down" && (t = "ArrowDown"), t;
@@ -1588,24 +1588,24 @@ function _n(n) {
1588
1588
  e[Un(t)] = n[t];
1589
1589
  return e;
1590
1590
  }
1591
- function Dt(n, e, t = !0) {
1591
+ function At(n, e, t = !0) {
1592
1592
  return e.altKey && (n = "Alt-" + n), e.ctrlKey && (n = "Ctrl-" + n), e.metaKey && (n = "Meta-" + n), t && e.shiftKey && (n = "Shift-" + n), n;
1593
1593
  }
1594
- function Vn(n) {
1594
+ function jn(n) {
1595
1595
  let e = _n(n);
1596
1596
  return function(t, r) {
1597
- let o = Jn(r), s, i = e[Dt(o, r)];
1597
+ let o = Jn(r), s, i = e[At(o, r)];
1598
1598
  if (i && i(t.state, t.dispatch, t))
1599
1599
  return !0;
1600
1600
  if (o.length == 1 && o != " ") {
1601
1601
  if (r.shiftKey) {
1602
- let l = e[Dt(o, r, !1)];
1602
+ let l = e[At(o, r, !1)];
1603
1603
  if (l && l(t.state, t.dispatch, t))
1604
1604
  return !0;
1605
1605
  }
1606
1606
  if ((r.altKey || r.metaKey || r.ctrlKey) && // Ctrl-Alt may be used for AltGr on Windows
1607
1607
  !(Kn && r.ctrlKey && r.altKey) && (s = He[r.keyCode]) && s != o) {
1608
- let l = e[Dt(s, r)];
1608
+ let l = e[At(s, r)];
1609
1609
  if (l && l(t.state, t.dispatch, t))
1610
1610
  return !0;
1611
1611
  }
@@ -1613,16 +1613,16 @@ function Vn(n) {
1613
1613
  return !1;
1614
1614
  };
1615
1615
  }
1616
- let Bt, zt;
1616
+ let zt, Ft;
1617
1617
  if (typeof WeakMap < "u") {
1618
1618
  let n = /* @__PURE__ */ new WeakMap();
1619
- Bt = (e) => n.get(e), zt = (e, t) => (n.set(e, t), t);
1619
+ zt = (e) => n.get(e), Ft = (e, t) => (n.set(e, t), t);
1620
1620
  } else {
1621
1621
  const n = [];
1622
1622
  let t = 0;
1623
- Bt = (r) => {
1623
+ zt = (r) => {
1624
1624
  for (let o = 0; o < n.length; o += 2) if (n[o] == r) return n[o + 1];
1625
- }, zt = (r, o) => (t == 10 && (t = 0), n[t++] = r, n[t++] = o);
1625
+ }, Ft = (r, o) => (t == 10 && (t = 0), n[t++] = r, n[t++] = o);
1626
1626
  }
1627
1627
  var Te = class {
1628
1628
  constructor(n, e, t, r) {
@@ -1683,10 +1683,10 @@ var Te = class {
1683
1683
  }
1684
1684
  }
1685
1685
  static get(n) {
1686
- return Bt(n) || zt(n, jn(n));
1686
+ return zt(n) || Ft(n, Vn(n));
1687
1687
  }
1688
1688
  };
1689
- function jn(n) {
1689
+ function Vn(n) {
1690
1690
  if (n.type.spec.tableRole != "table") throw new RangeError("Not a table node: " + n.type.name);
1691
1691
  const e = qn(n), t = n.childCount, r = [];
1692
1692
  let o = 0, s = null;
@@ -1788,7 +1788,7 @@ function Gn(n) {
1788
1788
  for (let t = 0; t < n.colspan; t++) e.push(0);
1789
1789
  return e;
1790
1790
  }
1791
- function Kt(n) {
1791
+ function Ut(n) {
1792
1792
  let e = n.cached.tableNodeTypes;
1793
1793
  if (!e) {
1794
1794
  e = n.cached.tableNodeTypes = {};
@@ -1799,7 +1799,7 @@ function Kt(n) {
1799
1799
  }
1800
1800
  return e;
1801
1801
  }
1802
- new Wt("selectingCells");
1802
+ new Kt("selectingCells");
1803
1803
  function Xn(n) {
1804
1804
  for (let e = n.depth - 1; e > 0; e--) if (n.node(e).type.spec.tableRole == "row") return n.node(0).resolve(n.before(e + 1));
1805
1805
  return null;
@@ -1966,7 +1966,7 @@ var er = class xn {
1966
1966
  return t.parent.type.spec.tableRole == "row" && r.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && r.index() < r.parent.childCount && bn(t, r) ? new Ie(t, r) : ee.near(r, 1);
1967
1967
  }
1968
1968
  };
1969
- new Wt("fix-tables");
1969
+ new Kt("fix-tables");
1970
1970
  function Cn(n) {
1971
1971
  const e = n.selection, t = Zn(n), r = t.node(-1), o = t.start(-1), s = Te.get(r);
1972
1972
  return {
@@ -1980,7 +1980,7 @@ function tr(n) {
1980
1980
  return function(e, t) {
1981
1981
  if (!vn(e)) return !1;
1982
1982
  if (t) {
1983
- const r = Kt(e.schema), o = Cn(e), s = e.tr, i = o.map.cellsInRect(n == "column" ? {
1983
+ const r = Ut(e.schema), o = Cn(e), s = e.tr, i = o.map.cellsInRect(n == "column" ? {
1984
1984
  left: o.left,
1985
1985
  top: 0,
1986
1986
  right: o.right,
@@ -2011,11 +2011,11 @@ function rn(n, e, t) {
2011
2011
  }
2012
2012
  return !0;
2013
2013
  }
2014
- function Ut(n, e) {
2014
+ function _t(n, e) {
2015
2015
  return e = e || { useDeprecatedLogic: !1 }, e.useDeprecatedLogic ? tr(n) : function(t, r) {
2016
2016
  if (!vn(t)) return !1;
2017
2017
  if (r) {
2018
- const o = Kt(t.schema), s = Cn(t), i = t.tr, l = rn("row", s, o), a = rn("column", s, o), d = (n === "column" ? l : n === "row" && a) ? 1 : 0, p = n == "column" ? {
2018
+ const o = Ut(t.schema), s = Cn(t), i = t.tr, l = rn("row", s, o), a = rn("column", s, o), d = (n === "column" ? l : n === "row" && a) ? 1 : 0, p = n == "column" ? {
2019
2019
  left: 0,
2020
2020
  top: d,
2021
2021
  right: 1,
@@ -2034,21 +2034,21 @@ function Ut(n, e) {
2034
2034
  return !0;
2035
2035
  };
2036
2036
  }
2037
- Ut("row", { useDeprecatedLogic: !0 });
2038
- Ut("column", { useDeprecatedLogic: !0 });
2039
- Ut("cell", { useDeprecatedLogic: !0 });
2037
+ _t("row", { useDeprecatedLogic: !0 });
2038
+ _t("column", { useDeprecatedLogic: !0 });
2039
+ _t("cell", { useDeprecatedLogic: !0 });
2040
2040
  function ht(n, e) {
2041
2041
  const t = n.selection;
2042
2042
  if (!(t instanceof Ie)) return !1;
2043
2043
  if (e) {
2044
- const r = n.tr, o = Kt(n.schema).cell.createAndFill().content;
2044
+ const r = n.tr, o = Ut(n.schema).cell.createAndFill().content;
2045
2045
  t.forEachCell((s, i) => {
2046
2046
  s.content.eq(o) || r.replace(r.mapping.map(i + 1), r.mapping.map(i + s.nodeSize - 1), new X(o, 0, 0));
2047
2047
  }), r.docChanged && e(r);
2048
2048
  }
2049
2049
  return !0;
2050
2050
  }
2051
- Vn({
2051
+ jn({
2052
2052
  ArrowLeft: pt("horiz", -1),
2053
2053
  ArrowRight: pt("horiz", 1),
2054
2054
  ArrowUp: pt("vert", -1),
@@ -2109,7 +2109,7 @@ function Nn(n, e, t) {
2109
2109
  }
2110
2110
  return null;
2111
2111
  }
2112
- new Wt("tableColumnResizing");
2112
+ new Kt("tableColumnResizing");
2113
2113
  function nr(n) {
2114
2114
  var m, k;
2115
2115
  const e = H(null), t = H(null), [r, o] = D(!1), [s, i] = D(!1), [l, a] = D(!0), d = H(!1), p = H(n);
@@ -2151,7 +2151,7 @@ function nr(n) {
2151
2151
  const w = t.current;
2152
2152
  w && n.config.readonly !== void 0 && w.setReadonly(n.config.readonly);
2153
2153
  }, [n.config.readonly, n.config.disabled]), _(() => {
2154
- n.config.locale && Ve.getInstance().setLocale(n.config.locale);
2154
+ n.config.locale && je.getInstance().setLocale(n.config.locale);
2155
2155
  }, [n.config.locale]);
2156
2156
  const T = H((m = n.config.license) == null ? void 0 : m.key);
2157
2157
  return _(() => {
@@ -2171,12 +2171,14 @@ function rr(n) {
2171
2171
  const [e, t] = D({}), [r, o] = D({}), s = E(async () => {
2172
2172
  if (!n) return;
2173
2173
  const i = n.getEditor(), l = {}, a = {};
2174
- for (const [T, m] of Object.entries(_t))
2174
+ for (const [T, m] of Object.entries(Mt))
2175
2175
  m.isActive && (l[T] = m.isActive(i)), m.isDisabled && (a[T] = m.isDisabled(i));
2176
2176
  const d = In(), p = d === "valid" || d === "expiring_soon", b = await n.hasSnapshots();
2177
2177
  if (a.compare = !b || !p, !p)
2178
- for (const [T, m] of Object.entries(_t))
2178
+ for (const [T, m] of Object.entries(Mt))
2179
2179
  m.requiredTier && T !== "compare" && (a[T] = !0);
2180
+ for (const [T, m] of Object.entries(Mt))
2181
+ m.requiresPlugin && !n.hasProPlugin(m.requiresPlugin) && (a[T] = !0);
2180
2182
  t(l), o(a);
2181
2183
  }, [n]);
2182
2184
  return _(() => {
@@ -2191,7 +2193,7 @@ function rr(n) {
2191
2193
  };
2192
2194
  }
2193
2195
  function be() {
2194
- const n = Ve.getInstance(), [e, t] = D(0);
2196
+ const n = je.getInstance(), [e, t] = D(0);
2195
2197
  _(() => n.onChange(() => {
2196
2198
  t((s) => s + 1);
2197
2199
  }), [n]);
@@ -2242,7 +2244,9 @@ const or = {
2242
2244
  snapshot: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>',
2243
2245
  fullscreen: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 4H4V8M4 4L10 10"/><path d="M16 4H20V8M20 4L14 10"/><path d="M4 16V20H8M4 20L10 14"/><path d="M20 16V20H16M20 20L14 14"/></svg>',
2244
2246
  import: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3h5a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5"/><polyline points="9 8 14 12 9 16"/><line x1="3" y1="12" x2="14" y2="12"/></svg>',
2245
- export: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h5"/><polyline points="16 8 21 12 16 16"/><line x1="10" y1="12" x2="21" y2="12"/></svg>'
2247
+ export: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h5"/><polyline points="16 8 21 12 16 16"/><line x1="10" y1="12" x2="21" y2="12"/></svg>',
2248
+ formula: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24"><text x="1" y="20" font-size="20" fill="currentColor" stroke="none" font-family="serif" font-weight="bold">Σ</text><text x="14" y="22" font-size="9" fill="currentColor" stroke="none" font-family="serif">x</text></svg>',
2249
+ structure: '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2.5 20 7 20 17 12 21.5 4 17 4 7"/><circle cx="12" cy="12" r="4"/></svg>'
2246
2250
  };
2247
2251
  function Be(n) {
2248
2252
  return or[n] || "";
@@ -2452,7 +2456,7 @@ const sr = ({
2452
2456
  }
2453
2457
  a.current = null, d.current = null, p.current = "", b.current = !1;
2454
2458
  }, S = n.name === "getHTML" || n.name === "getJSON";
2455
- return /* @__PURE__ */ v(Ft, { children: [
2459
+ return /* @__PURE__ */ v(Pt, { children: [
2456
2460
  /* @__PURE__ */ c(
2457
2461
  "button",
2458
2462
  {
@@ -3024,8 +3028,8 @@ const sr = ({
3024
3028
  textAlign: B.textAlign || F.textAlign,
3025
3029
  lineHeight: B.lineHeight || F.lineHeight
3026
3030
  }, p.current = S();
3027
- const V = J.length > 0, q = !!W.color || !!W.fontFamily || !!W.fontSize, re = !!d.current.textAlign || !!d.current.lineHeight;
3028
- return V || q || re || K !== null || p.current !== void 0;
3031
+ const j = J.length > 0, q = !!W.color || !!W.fontFamily || !!W.fontSize, re = !!d.current.textAlign || !!d.current.lineHeight;
3032
+ return j || q || re || K !== null || p.current !== void 0;
3029
3033
  }, [n, w, S]), h = E(() => {
3030
3034
  if (!l.current) return;
3031
3035
  const A = n.chain().focus();
@@ -3051,31 +3055,31 @@ const sr = ({
3051
3055
  if (G) return !1;
3052
3056
  const { schema: J } = A;
3053
3057
  if (l.current ? h() : p.current !== void 0 && x(), d.current) {
3054
- const V = n.chain().focus();
3055
- d.current.textAlign && V.setTextAlign(d.current.textAlign), d.current.lineHeight && V.setLineHeight(d.current.lineHeight), V.run();
3058
+ const j = n.chain().focus();
3059
+ d.current.textAlign && j.setTextAlign(d.current.textAlign), d.current.lineHeight && j.setLineHeight(d.current.lineHeight), j.run();
3056
3060
  }
3057
3061
  A = n.state;
3058
3062
  const K = A.selection;
3059
3063
  if (O = K.from, z = K.to, i.current.length === 0 && !a.current)
3060
3064
  return l.current !== null || d.current !== null || p.current !== void 0;
3061
3065
  const W = A.tr, B = [];
3062
- if (i.current.forEach((V) => {
3063
- const q = V.type.name;
3064
- ["bold", "italic", "underline", "strike", "superscript", "subscript"].includes(q) && B.push(V);
3066
+ if (i.current.forEach((j) => {
3067
+ const q = j.type.name;
3068
+ ["bold", "italic", "underline", "strike", "superscript", "subscript"].includes(q) && B.push(j);
3065
3069
  }), a.current) {
3066
- const { color: V, fontFamily: q, fontSize: re } = a.current, oe = {};
3067
- if (V && (oe.color = V), q && (oe.fontFamily = q), re && (oe.fontSize = re), Object.keys(oe).length > 0 && J.marks.textStyle) {
3070
+ const { color: j, fontFamily: q, fontSize: re } = a.current, oe = {};
3071
+ if (j && (oe.color = j), q && (oe.fontFamily = q), re && (oe.fontSize = re), Object.keys(oe).length > 0 && J.marks.textStyle) {
3068
3072
  const Me = J.marks.textStyle.create(oe);
3069
3073
  B.push(Me);
3070
3074
  }
3071
3075
  }
3072
- const F = i.current.find((V) => V.type.name === "highlight");
3073
- return F && B.push(F), B.length === 0 || (A.doc.nodesBetween(O, z, (V, q) => {
3074
- if (V.isText && q < z && q + V.nodeSize > O) {
3075
- const re = Math.max(q, O), oe = Math.min(q + V.nodeSize, z);
3076
+ const F = i.current.find((j) => j.type.name === "highlight");
3077
+ return F && B.push(F), B.length === 0 || (A.doc.nodesBetween(O, z, (j, q) => {
3078
+ if (j.isText && q < z && q + j.nodeSize > O) {
3079
+ const re = Math.max(q, O), oe = Math.min(q + j.nodeSize, z);
3076
3080
  ["bold", "italic", "underline", "strike", "superscript", "subscript", "textStyle", "highlight"].forEach((se) => {
3077
3081
  const ge = J.marks[se];
3078
- ge && V.marks.some((pe) => pe.type === ge) && W.removeMark(re, oe, ge);
3082
+ ge && j.marks.some((pe) => pe.type === ge) && W.removeMark(re, oe, ge);
3079
3083
  }), B.forEach((se) => {
3080
3084
  W.addMark(re, oe, se);
3081
3085
  });
@@ -3348,11 +3352,11 @@ const Nr = ({
3348
3352
  }
3349
3353
  return /* @__PURE__ */ v("div", { className: "tp-toolbar", children: [
3350
3354
  l,
3351
- k.map((u, h) => /* @__PURE__ */ v(Ot.Fragment, { children: [
3355
+ k.map((u, h) => /* @__PURE__ */ v(Ht.Fragment, { children: [
3352
3356
  h > 0 && /* @__PURE__ */ c(sn, {}),
3353
- u.category !== "content" ? /* @__PURE__ */ c("div", { className: ln(u.category), children: u.items.map(S) }) : /* @__PURE__ */ c(Ft, { children: u.items.map(S) })
3357
+ u.category !== "content" ? /* @__PURE__ */ c("div", { className: ln(u.category), children: u.items.map(S) }) : /* @__PURE__ */ c(Pt, { children: u.items.map(S) })
3354
3358
  ] }, `g-${h}`)),
3355
- w.length > 0 && /* @__PURE__ */ c("div", { className: "tp-toolbar-right", children: w.map((u, h) => /* @__PURE__ */ v(Ot.Fragment, { children: [
3359
+ w.length > 0 && /* @__PURE__ */ c("div", { className: "tp-toolbar-right", children: w.map((u, h) => /* @__PURE__ */ v(Ht.Fragment, { children: [
3356
3360
  h > 0 && /* @__PURE__ */ c(sn, {}),
3357
3361
  /* @__PURE__ */ c("div", { className: ln(u.category), children: u.items.map(S) })
3358
3362
  ] }, `r-${h}`)) }),
@@ -3366,10 +3370,10 @@ const Nr = ({
3366
3370
  onVisibleChange: o,
3367
3371
  onAction: s
3368
3372
  }) => {
3369
- const i = H(null), [l, a] = D({ x: 0, y: 0 }), [d, p] = D(!1), [b, T] = D(!1), m = H({ x: 0, y: 0 }), k = Ve.getInstance(), w = (h) => k.t(h), S = E((h) => {
3373
+ const i = H(null), [l, a] = D({ x: 0, y: 0 }), [d, p] = D(!1), [b, T] = D(!1), m = H({ x: 0, y: 0 }), k = je.getInstance(), w = (h) => k.t(h), S = E((h) => {
3370
3374
  if (!i.current) return h;
3371
3375
  const x = i.current.getBoundingClientRect();
3372
- return x.width === 0 || x.height === 0 ? h : Vt({
3376
+ return x.width === 0 || x.height === 0 ? h : jt({
3373
3377
  x: h.x,
3374
3378
  y: h.y,
3375
3379
  width: x.width,
@@ -3391,7 +3395,7 @@ const Nr = ({
3391
3395
  if (!e || !i.current) return;
3392
3396
  const h = i.current.getBoundingClientRect();
3393
3397
  if (h.width === 0 || h.height === 0) return;
3394
- const x = Vt({
3398
+ const x = jt({
3395
3399
  x: l.x,
3396
3400
  y: l.y,
3397
3401
  width: h.width,
@@ -3517,13 +3521,13 @@ function Lr(n) {
3517
3521
  const e = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);
3518
3522
  return e ? { r: parseInt(e[1], 16), g: parseInt(e[2], 16), b: parseInt(e[3], 16) } : null;
3519
3523
  }
3520
- function At(n, e, t) {
3524
+ function It(n, e, t) {
3521
3525
  return "#" + [n, e, t].map((r) => {
3522
3526
  const o = Math.round(Math.max(0, Math.min(255, r))).toString(16);
3523
3527
  return o.length === 1 ? "0" + o : o;
3524
3528
  }).join("");
3525
3529
  }
3526
- function It(n, e, t) {
3530
+ function $t(n, e, t) {
3527
3531
  n /= 255, e /= 255, t /= 255;
3528
3532
  const r = Math.max(n, e, t), o = Math.min(n, e, t);
3529
3533
  let s = 0, i = 0;
@@ -3544,7 +3548,7 @@ function It(n, e, t) {
3544
3548
  }
3545
3549
  return { h: Math.round(s * 360), s: Math.round(i * 100), l: Math.round(l * 100) };
3546
3550
  }
3547
- function $t(n, e, t) {
3551
+ function Ot(n, e, t) {
3548
3552
  n /= 255, e /= 255, t /= 255;
3549
3553
  const r = Math.max(n, e, t), o = Math.min(n, e, t);
3550
3554
  let s = 0;
@@ -3602,7 +3606,7 @@ function Er(n, e, t) {
3602
3606
  }
3603
3607
  const kt = Mn(
3604
3608
  ({ value: n, onChange: e, placeholder: t, mode: r = "border", beforeOpen: o, onClose: s }, i) => {
3605
- const [l, a] = D(!1), d = H(null), p = H(null), b = H(null), T = H(null), m = H(null), [k, w] = D(-1e4), [S, u] = D(-1e4), [h, x] = D(n), [y, f] = D(n), C = H(n), [$, P] = D("hex"), [N, A] = D({ h: 0, s: 100, v: 100 }), [O, z] = D({ r: 0, g: 0, b: 0 }), [G, J] = D({ h: 0, s: 0, l: 0 }), [K, W] = D(!1), [B, F] = D(!1), [V, q] = D(!1), re = E(() => {
3609
+ const [l, a] = D(!1), d = H(null), p = H(null), b = H(null), T = H(null), m = H(null), [k, w] = D(-1e4), [S, u] = D(-1e4), [h, x] = D(n), [y, f] = D(n), C = H(n), [$, P] = D("hex"), [N, A] = D({ h: 0, s: 100, v: 100 }), [O, z] = D({ r: 0, g: 0, b: 0 }), [G, J] = D({ h: 0, s: 0, l: 0 }), [K, W] = D(!1), [B, F] = D(!1), [j, q] = D(!1), re = E(() => {
3606
3610
  let L = 0;
3607
3611
  const I = 3, te = () => {
3608
3612
  if (L >= I * 2) {
@@ -3619,10 +3623,10 @@ const kt = Mn(
3619
3623
  const oe = _e(() => r === "background" ? Tr : Mr, [r]), Me = y || "#d9d9d9", se = E((L) => {
3620
3624
  x(L), f(L);
3621
3625
  const I = Lr(L);
3622
- I && (z(I), J(It(I.r, I.g, I.b)), A($t(I.r, I.g, I.b)));
3626
+ I && (z(I), J($t(I.r, I.g, I.b)), A(Ot(I.r, I.g, I.b)));
3623
3627
  }, []), ge = E(() => {
3624
- const L = Rr(N.h, N.s, N.v), I = At(L.r, L.g, L.b);
3625
- z(L), J(It(L.r, L.g, L.b)), x(I), f(I);
3628
+ const L = Rr(N.h, N.s, N.v), I = It(L.r, L.g, L.b);
3629
+ z(L), J($t(L.r, L.g, L.b)), x(I), f(I);
3626
3630
  }, [N]);
3627
3631
  _(() => {
3628
3632
  se(n);
@@ -3678,7 +3682,7 @@ const kt = Mn(
3678
3682
  C.current = n, f(n), se(n);
3679
3683
  }
3680
3684
  a(!l);
3681
- }, [l, n, se, o, s]), j = E((L) => {
3685
+ }, [l, n, se, o, s]), V = E((L) => {
3682
3686
  se(L);
3683
3687
  }, [se]), Z = E((L) => {
3684
3688
  const I = L.target.value;
@@ -3686,17 +3690,17 @@ const kt = Mn(
3686
3690
  }, [se]), Ne = E(() => {
3687
3691
  h !== y && (/^#[0-9A-Fa-f]{6}$/.test(h) || /^#[0-9A-Fa-f]{3}$/.test(h) ? se(h) : (x(y), se(y)));
3688
3692
  }, [h, y, se]), nt = E(() => {
3689
- const L = At(O.r, O.g, O.b);
3690
- x(L), f(L), J(It(O.r, O.g, O.b)), A($t(O.r, O.g, O.b));
3693
+ const L = It(O.r, O.g, O.b);
3694
+ x(L), f(L), J($t(O.r, O.g, O.b)), A(Ot(O.r, O.g, O.b));
3691
3695
  }, [O]), Re = E(() => {
3692
- const L = Er(G.h, G.s, G.l), I = At(L.r, L.g, L.b);
3693
- x(I), f(I), z(L), A($t(L.r, L.g, L.b));
3696
+ const L = Er(G.h, G.s, G.l), I = It(L.r, L.g, L.b);
3697
+ x(I), f(I), z(L), A(Ot(L.r, L.g, L.b));
3694
3698
  }, [G]), ze = E((L) => {
3695
3699
  if (!T.current) return;
3696
3700
  const I = T.current.getBoundingClientRect();
3697
3701
  let te = Math.max(0, Math.min(100, (L.clientX - I.left) / I.width * 100)), he = Math.max(0, Math.min(100, (L.clientY - I.top) / I.height * 100));
3698
3702
  A((fe) => ({ ...fe, s: te, v: 100 - he }));
3699
- }, []), je = E((L) => {
3703
+ }, []), Ve = E((L) => {
3700
3704
  W(!0), ze(L.nativeEvent);
3701
3705
  }, [ze]), Fe = E((L) => {
3702
3706
  if (!m.current) return;
@@ -3770,7 +3774,7 @@ const kt = Mn(
3770
3774
  style: {
3771
3775
  background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), hsl(${N.h}, 100%, 50%)`
3772
3776
  },
3773
- onMouseDown: je,
3777
+ onMouseDown: Ve,
3774
3778
  children: /* @__PURE__ */ c(
3775
3779
  "div",
3776
3780
  {
@@ -3796,7 +3800,7 @@ const kt = Mn(
3796
3800
  style: { backgroundColor: L },
3797
3801
  title: L,
3798
3802
  onMouseDown: (I) => I.preventDefault(),
3799
- onClick: () => j(L)
3803
+ onClick: () => V(L)
3800
3804
  },
3801
3805
  L
3802
3806
  )) }),
@@ -3861,8 +3865,8 @@ const kt = Mn(
3861
3865
  /* @__PURE__ */ c("div", { className: "tp-color-preview-label", children: "当前颜色" }),
3862
3866
  /* @__PURE__ */ c("div", { className: "tp-color-preview-box", style: { backgroundColor: Me } }),
3863
3867
  /* @__PURE__ */ v("div", { className: "tp-color-actions", children: [
3864
- /* @__PURE__ */ c("button", { type: "button", className: `tp-color-btn tp-color-btn-cancel${V ? " tp-color-btn-flash" : ""}`, title: "取消", onMouseDown: (L) => L.preventDefault(), onClick: g, children: "✕" }),
3865
- /* @__PURE__ */ c("button", { type: "button", className: `tp-color-btn tp-color-btn-confirm${V ? " tp-color-btn-flash" : ""}`, title: "确认", onMouseDown: (L) => L.preventDefault(), onClick: Ct, children: "✓" })
3868
+ /* @__PURE__ */ c("button", { type: "button", className: `tp-color-btn tp-color-btn-cancel${j ? " tp-color-btn-flash" : ""}`, title: "取消", onMouseDown: (L) => L.preventDefault(), onClick: g, children: "✕" }),
3869
+ /* @__PURE__ */ c("button", { type: "button", className: `tp-color-btn tp-color-btn-confirm${j ? " tp-color-btn-flash" : ""}`, title: "确认", onMouseDown: (L) => L.preventDefault(), onClick: Ct, children: "✓" })
3866
3870
  ] })
3867
3871
  ] })
3868
3872
  ] })
@@ -3871,7 +3875,7 @@ const kt = Mn(
3871
3875
  );
3872
3876
  kt.displayName = "ColorPickerInput";
3873
3877
  const Dr = ({ editor: n, visible: e, onVisibleChange: t }) => {
3874
- const r = Ve.getInstance(), o = (m) => r.t(m), [s, i] = D({ borderColor: "#d9d9d9", borderWidth: 1 }), [l, a] = D("");
3878
+ const r = je.getInstance(), o = (m) => r.t(m), [s, i] = D({ borderColor: "#d9d9d9", borderWidth: 1 }), [l, a] = D("");
3875
3879
  _(() => {
3876
3880
  if (e) {
3877
3881
  document.body.style.overflow = "hidden";
@@ -4007,7 +4011,7 @@ function Or(n, e, t, r, o, s, i, l, a, d) {
4007
4011
  } : { ...n.attrs, backgroundColor: i, textAlign: l, verticalAlign: a };
4008
4012
  }
4009
4013
  const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4010
- const r = Ve.getInstance(), o = (h) => r.t(h), [s, i] = D({
4014
+ const r = je.getInstance(), o = (h) => r.t(h), [s, i] = D({
4011
4015
  borderColor: "#d9d9d9",
4012
4016
  borderWidth: 1,
4013
4017
  backgroundColor: "#ffffff",
@@ -4056,51 +4060,51 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4056
4060
  return;
4057
4061
  const { state: h, dispatch: x } = n.view, { selection: y } = h, f = y, C = h.tr;
4058
4062
  let $ = !1;
4059
- const P = s.borderColor !== l.borderColor || s.borderWidth !== l.borderWidth, N = `${s.borderWidth}px solid ${s.borderColor}`, A = (K, W, B, F, V, q) => {
4060
- const re = V + 1, oe = Or(K, B.row, B.col, F, q, N, s.backgroundColor, s.textAlign, s.verticalAlign, P);
4063
+ const P = s.borderColor !== l.borderColor || s.borderWidth !== l.borderWidth, N = `${s.borderWidth}px solid ${s.borderColor}`, A = (K, W, B, F, j, q) => {
4064
+ const re = j + 1, oe = Or(K, B.row, B.col, F, q, N, s.backgroundColor, s.textAlign, s.verticalAlign, P);
4061
4065
  if (C.setNodeMarkup(W, null, oe), $ = !0, !P) return;
4062
4066
  const Me = K.attrs.colspan || 1, se = K.attrs.rowspan || 1, ge = "1px solid #d9d9d9", pe = /* @__PURE__ */ new Map();
4063
4067
  for (let Y = 0; Y < F.height; Y++)
4064
4068
  for (let ie = 0; ie < F.width; ie++) {
4065
- const j = F.map[Y * F.width + ie];
4066
- pe.has(j) || pe.set(j, { row: Y, col: ie });
4069
+ const V = F.map[Y * F.width + ie];
4070
+ pe.has(V) || pe.set(V, { row: Y, col: ie });
4067
4071
  }
4068
4072
  if (B.col > 0) {
4069
- const Y = F.map[B.row * F.width + B.col - 1], ie = re + Y, j = C.doc.nodeAt(ie);
4070
- if (j && (j.type.name === "tableCell" || j.type.name === "tableHeader")) {
4073
+ const Y = F.map[B.row * F.width + B.col - 1], ie = re + Y, V = C.doc.nodeAt(ie);
4074
+ if (V && (V.type.name === "tableCell" || V.type.name === "tableHeader")) {
4071
4075
  const Z = pe.get(Y);
4072
- if (Z && !Se(Z.row, Z.col, j.attrs.colspan || 1, j.attrs.rowspan || 1, F, "right")) {
4073
- const Ne = mt(j, Z.row, Z.col, F, q, ge, "right", oe.borderLeft);
4076
+ if (Z && !Se(Z.row, Z.col, V.attrs.colspan || 1, V.attrs.rowspan || 1, F, "right")) {
4077
+ const Ne = mt(V, Z.row, Z.col, F, q, ge, "right", oe.borderLeft);
4074
4078
  C.setNodeMarkup(ie, null, Ne);
4075
4079
  }
4076
4080
  }
4077
4081
  }
4078
4082
  if (B.row > 0) {
4079
- const Y = F.map[(B.row - 1) * F.width + B.col], ie = re + Y, j = C.doc.nodeAt(ie);
4080
- if (j && (j.type.name === "tableCell" || j.type.name === "tableHeader")) {
4083
+ const Y = F.map[(B.row - 1) * F.width + B.col], ie = re + Y, V = C.doc.nodeAt(ie);
4084
+ if (V && (V.type.name === "tableCell" || V.type.name === "tableHeader")) {
4081
4085
  const Z = pe.get(Y);
4082
- if (Z && !Se(Z.row, Z.col, j.attrs.colspan || 1, j.attrs.rowspan || 1, F, "bottom")) {
4083
- const Ne = mt(j, Z.row, Z.col, F, q, ge, "bottom", oe.borderTop);
4086
+ if (Z && !Se(Z.row, Z.col, V.attrs.colspan || 1, V.attrs.rowspan || 1, F, "bottom")) {
4087
+ const Ne = mt(V, Z.row, Z.col, F, q, ge, "bottom", oe.borderTop);
4084
4088
  C.setNodeMarkup(ie, null, Ne);
4085
4089
  }
4086
4090
  }
4087
4091
  }
4088
4092
  if (B.col + (K.attrs.colspan || 1) < F.width) {
4089
- const Y = F.map[B.row * F.width + B.col + Me], ie = re + Y, j = C.doc.nodeAt(ie);
4090
- if (j && (j.type.name === "tableCell" || j.type.name === "tableHeader")) {
4093
+ const Y = F.map[B.row * F.width + B.col + Me], ie = re + Y, V = C.doc.nodeAt(ie);
4094
+ if (V && (V.type.name === "tableCell" || V.type.name === "tableHeader")) {
4091
4095
  const Z = pe.get(Y);
4092
- if (Z && !Se(Z.row, Z.col, j.attrs.colspan || 1, j.attrs.rowspan || 1, F, "left")) {
4093
- const Ne = mt(j, Z.row, Z.col, F, q, ge, "left", oe.borderRight);
4096
+ if (Z && !Se(Z.row, Z.col, V.attrs.colspan || 1, V.attrs.rowspan || 1, F, "left")) {
4097
+ const Ne = mt(V, Z.row, Z.col, F, q, ge, "left", oe.borderRight);
4094
4098
  C.setNodeMarkup(ie, null, Ne);
4095
4099
  }
4096
4100
  }
4097
4101
  }
4098
4102
  if (B.row + (K.attrs.rowspan || 1) < F.height) {
4099
- const Y = F.map[(B.row + se) * F.width + B.col], ie = re + Y, j = C.doc.nodeAt(ie);
4100
- if (j && (j.type.name === "tableCell" || j.type.name === "tableHeader")) {
4103
+ const Y = F.map[(B.row + se) * F.width + B.col], ie = re + Y, V = C.doc.nodeAt(ie);
4104
+ if (V && (V.type.name === "tableCell" || V.type.name === "tableHeader")) {
4101
4105
  const Z = pe.get(Y);
4102
- if (Z && !Se(Z.row, Z.col, j.attrs.colspan || 1, j.attrs.rowspan || 1, F, "top")) {
4103
- const Ne = mt(j, Z.row, Z.col, F, q, ge, "top", oe.borderBottom);
4106
+ if (Z && !Se(Z.row, Z.col, V.attrs.colspan || 1, V.attrs.rowspan || 1, F, "top")) {
4107
+ const Ne = mt(V, Z.row, Z.col, F, q, ge, "top", oe.borderBottom);
4104
4108
  C.setNodeMarkup(ie, null, Ne);
4105
4109
  }
4106
4110
  }
@@ -4109,13 +4113,13 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4109
4113
  let G = -1, J = null;
4110
4114
  if (h.doc.nodesBetween(O.pos, z.pos, (K, W) => K.type.name === "table" ? (G = W, J = K, !1) : !0), J && G >= 0) {
4111
4115
  const K = $r(J), W = Te.get(J), B = G + 1, F = /* @__PURE__ */ new Map();
4112
- for (let V = 0; V < W.height; V++)
4116
+ for (let j = 0; j < W.height; j++)
4113
4117
  for (let q = 0; q < W.width; q++) {
4114
- const re = W.map[V * W.width + q];
4115
- F.has(re) || F.set(re, { row: V, col: q });
4118
+ const re = W.map[j * W.width + q];
4119
+ F.has(re) || F.set(re, { row: j, col: q });
4116
4120
  }
4117
4121
  if ("$anchorCell" in y && y.$anchorCell) {
4118
- const V = y.$anchorCell, q = y.$headCell, re = V.pos - B, oe = q.pos - B, Me = W.rectBetween(re, oe);
4122
+ const j = y.$anchorCell, q = y.$headCell, re = j.pos - B, oe = q.pos - B, Me = W.rectBetween(re, oe);
4119
4123
  W.cellsInRect(Me).forEach((ge) => {
4120
4124
  const pe = B + ge, Y = h.doc.nodeAt(pe);
4121
4125
  if (Y && (Y.type.name === "tableCell" || Y.type.name === "tableHeader")) {
@@ -4124,10 +4128,10 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4124
4128
  }
4125
4129
  });
4126
4130
  } else
4127
- h.doc.nodesBetween(O.pos, z.pos, (V, q) => {
4128
- if (V.type.name === "tableCell" || V.type.name === "tableHeader") {
4131
+ h.doc.nodesBetween(O.pos, z.pos, (j, q) => {
4132
+ if (j.type.name === "tableCell" || j.type.name === "tableHeader") {
4129
4133
  const re = q - B, oe = F.get(re);
4130
- oe && A(V, q, oe, W, G, K);
4134
+ oe && A(j, q, oe, W, G, K);
4131
4135
  }
4132
4136
  return !0;
4133
4137
  });
@@ -4241,7 +4245,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4241
4245
  document.body
4242
4246
  ) : null;
4243
4247
  }, Br = ({ manager: n, visible: e, onVisibleChange: t }) => {
4244
- const r = Ve.getInstance(), [o, s] = D([]), [i, l] = D(""), [a, d] = D(null), [p, b] = D(!1), T = H(null), m = H(null), k = H(null), w = E((f, C) => r.t(f, C) || f, [r]), S = E((f) => {
4248
+ const r = je.getInstance(), [o, s] = D([]), [i, l] = D(""), [a, d] = D(null), [p, b] = D(!1), T = H(null), m = H(null), k = H(null), w = E((f, C) => r.t(f, C) || f, [r]), S = E((f) => {
4245
4249
  try {
4246
4250
  const C = new Date(f), P = (/* @__PURE__ */ new Date()).getTime() - C.getTime(), N = Math.floor(P / 6e4), A = Math.floor(P / 36e5), O = Math.floor(P / 864e5);
4247
4251
  return N < 1 ? w("compare.justNow") : N < 60 ? w("compare.minutesAgo", { n: String(N) }) : A < 24 ? w("compare.hoursAgo", { n: String(A) }) : O < 7 ? w("compare.daysAgo", { n: String(O) }) : C.toLocaleDateString() + " " + C.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
@@ -4379,7 +4383,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4379
4383
  /* @__PURE__ */ c("div", { className: "cyte-compare-empty__hint", children: w("compare.noVersionsHint") }),
4380
4384
  /* @__PURE__ */ c("button", { className: "cyte-compare-btn cyte-compare-btn--primary cyte-compare-snapshot-btn", onClick: x, children: w("compare.createSnapshot") })
4381
4385
  ] }),
4382
- a && /* @__PURE__ */ v(Ft, { children: [
4386
+ a && /* @__PURE__ */ v(Pt, { children: [
4383
4387
  /* @__PURE__ */ v("div", { ref: T, className: "cyte-compare-pane", children: [
4384
4388
  /* @__PURE__ */ c("div", { className: "cyte-compare-pane__header", children: (() => {
4385
4389
  const f = o.findIndex((C) => C.id === i);
@@ -4497,7 +4501,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4497
4501
  ] }) }),
4498
4502
  document.body
4499
4503
  ) : null;
4500
- }, Pr = Ot.forwardRef((n, e) => {
4504
+ }, Pr = Ht.forwardRef((n, e) => {
4501
4505
  const {
4502
4506
  html: t,
4503
4507
  json: r,
@@ -4522,7 +4526,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4522
4526
  onToolbarClick: C,
4523
4527
  onFullscreenChange: $,
4524
4528
  toolbarRender: P
4525
- } = n, [N, A] = D("normal"), O = H(""), z = H(null), [G, J] = D(!1), [K, W] = D({ x: 0, y: 0 }), [B, F] = D(null), [V, q] = D(!1), [re, oe] = D(!1), [Me, se] = D(!1), [ge, pe] = D(!1), [Y, ie] = D("document"), [j, Z] = D(!1), [Ne, nt] = D("document"), [Re, ze] = D(!1), je = Ve.getInstance(), Fe = E((M) => je.t(M) || M, [je]), rt = _e(() => {
4529
+ } = n, [N, A] = D("normal"), O = H(""), z = H(null), [G, J] = D(!1), [K, W] = D({ x: 0, y: 0 }), [B, F] = D(null), [j, q] = D(!1), [re, oe] = D(!1), [Me, se] = D(!1), [ge, pe] = D(!1), [Y, ie] = D("document"), [V, Z] = D(!1), [Ne, nt] = D("document"), [Re, ze] = D(!1), Ve = je.getInstance(), Fe = E((M) => Ve.t(M) || M, [Ve]), rt = _e(() => {
4526
4530
  const R = { ...o || {} };
4527
4531
  return s !== void 0 && (R.height = s), i !== void 0 && (R.minHeight = i), l !== void 0 && (R.maxHeight = l), a !== void 0 && (R.autoHeight = a), d !== void 0 && (R.placeholder = d), p !== void 0 && (R.toolbar = p), b !== void 0 && (R.readonly = b), T !== void 0 && (R.disabled = T), m !== void 0 && (R.autofocus = m), k !== void 0 && (R.locale = k), w !== void 0 && (R.paste = { ...R.paste, mode: w }), S !== void 0 && (R.upload = { ...R.upload, url: S }), R;
4528
4532
  }, [o, s, i, l, a, d, p, b, T, m, k, w, S]), Ct = _e(() => rt.toolbar || [
@@ -4559,6 +4563,8 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4559
4563
  "insertTable",
4560
4564
  "imageUpload",
4561
4565
  "video",
4566
+ "formula",
4567
+ "structure",
4562
4568
  "|",
4563
4569
  // F: 块级元素
4564
4570
  "blockquote",
@@ -4673,7 +4679,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4673
4679
  Je || Ze(R, le), W({ x: U.clientX, y: U.clientY }), F(le), J(!0);
4674
4680
  return;
4675
4681
  }
4676
- jt(R) || Ze(R, le);
4682
+ Vt(R) || Ze(R, le);
4677
4683
  const de = G;
4678
4684
  de && J(!1), setTimeout(() => {
4679
4685
  W({ x: U.clientX, y: U.clientY }), F(le), J(!0);
@@ -4684,7 +4690,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4684
4690
  }, [G]), Nt = E((M) => {
4685
4691
  if (C == null || C(M), M === "snapshot") {
4686
4692
  g == null || g.createSnapshot().then((R) => {
4687
- R ? yt(je.t("compare.snapshotCreated", { time: R.label || R.timestamp })) : yt({ message: je.t("compare.snapshotFailed"), type: "error" });
4693
+ R ? yt(Ve.t("compare.snapshotCreated", { time: R.label || R.timestamp })) : yt({ message: Ve.t("compare.snapshotFailed"), type: "error" });
4688
4694
  });
4689
4695
  return;
4690
4696
  }
@@ -4708,7 +4714,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4708
4714
  }, [C, g]), Ge = E((M) => {
4709
4715
  if (!g) return;
4710
4716
  const R = g.getEditor();
4711
- switch ("$anchorCell" in R.state.selection || (jt(R), qt()), M) {
4717
+ switch ("$anchorCell" in R.state.selection || (Vt(R), qt()), M) {
4712
4718
  case "addRowBefore":
4713
4719
  g.addTableRowBefore();
4714
4720
  break;
@@ -4893,7 +4899,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4893
4899
  Dr,
4894
4900
  {
4895
4901
  editor: g.getEditor(),
4896
- visible: V,
4902
+ visible: j,
4897
4903
  onVisibleChange: q
4898
4904
  }
4899
4905
  ),
@@ -4925,7 +4931,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
4925
4931
  /* @__PURE__ */ c(
4926
4932
  Fr,
4927
4933
  {
4928
- visible: j,
4934
+ visible: V,
4929
4935
  defaultFilename: Ne,
4930
4936
  onConfirm: (M) => g == null ? void 0 : g.exportMarkdownFile(M),
4931
4937
  onClose: () => Z(!1)