react-tiptap-base-editor 1.2.0 → 1.2.2

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/dist/index.js CHANGED
@@ -11276,12 +11276,12 @@ function kC(t) {
11276
11276
  SC(S, i.find, s).forEach((N) => {
11277
11277
  if (N.index === void 0)
11278
11278
  return;
11279
- const B = E + N.index + 1, j = B + N[0].length, U = {
11279
+ const B = E + N.index + 1, U = B + N[0].length, W = {
11280
11280
  from: n.tr.mapping.map(B),
11281
- to: n.tr.mapping.map(j)
11281
+ to: n.tr.mapping.map(U)
11282
11282
  }, $ = i.handler({
11283
11283
  state: n,
11284
- range: U,
11284
+ range: W,
11285
11285
  match: N,
11286
11286
  commands: a,
11287
11287
  chain: c,
@@ -12737,18 +12737,18 @@ function BC(t) {
12737
12737
  const N = S.exec(M);
12738
12738
  if (N === null)
12739
12739
  break;
12740
- const B = N.index, j = N[1];
12740
+ const B = N.index, U = N[1];
12741
12741
  if (!((p = N[2]) != null && p.endsWith(":::"))) {
12742
- if (j)
12742
+ if (U)
12743
12743
  x += 1;
12744
12744
  else if (x -= 1, x === 0) {
12745
- const U = M.slice(0, B);
12746
- k = U.trim();
12745
+ const W = M.slice(0, B);
12746
+ k = W.trim();
12747
12747
  const $ = d.slice(0, E + B + N[0].length);
12748
12748
  let I = [];
12749
12749
  if (k)
12750
12750
  if (l === "block")
12751
- for (I = h.blockTokens(U), I.forEach((H) => {
12751
+ for (I = h.blockTokens(W), I.forEach((H) => {
12752
12752
  H.text && (!H.tokens || H.tokens.length === 0) && (H.tokens = h.inlineTokens(H.text));
12753
12753
  }); I.length > 0; ) {
12754
12754
  const H = I[I.length - 1];
@@ -15120,7 +15120,7 @@ function Xw({
15120
15120
  G(E, e, E), G(E, n, k), G(k, e, E), G(k, n, k), O(C, ct, E), O(x, ct, E);
15121
15121
  const S = O(l, Yt), M = O(a, Yt), N = O(M, ct), B = O(N, ct);
15122
15122
  G(l, t.domain, s), O(l, at, b), O(l, Ye, y), G(a, t.domain, s), O(a, at, b), O(a, Ye, y), G(S, t.domain, E), O(S, ct, E), O(S, Nr, E), G(B, t.domain, E), G(B, e, E), O(B, ct, E);
15123
- const j = [
15123
+ const U = [
15124
15124
  [Ar, Rr],
15125
15125
  // {}
15126
15126
  [li, ai],
@@ -15138,8 +15138,8 @@ function Xw({
15138
15138
  [bi, Ci]
15139
15139
  // <>
15140
15140
  ];
15141
- for (let U = 0; U < j.length; U++) {
15142
- const [$, I] = j[U], H = O(E, $);
15141
+ for (let W = 0; W < U.length; W++) {
15142
+ const [$, I] = U[W], H = O(E, $);
15143
15143
  O(k, $, H), O(H, I, E);
15144
15144
  const F = Je(To);
15145
15145
  G(H, e, F);
@@ -17685,11 +17685,11 @@ var D4 = Q.create({
17685
17685
  [u]: k
17686
17686
  }), b[x + 1] = k, S.node.attrs[u])
17687
17687
  return;
17688
- const j = d({ node: C, pos: w });
17688
+ const U = d({ node: C, pos: w });
17689
17689
  return a.setNodeMarkup(w, void 0, {
17690
17690
  ...C.attrs,
17691
- [u]: j
17692
- }), b[x] = j, a;
17691
+ [u]: U
17692
+ }), b[x] = U, a;
17693
17693
  }
17694
17694
  const M = L4(b), { deleted: N } = h.invert().mapResult(w);
17695
17695
  N && M.includes(k) && a.setNodeMarkup(w, void 0, {
@@ -18738,7 +18738,7 @@ const U5 = (t) => ({
18738
18738
  }, h = gc(o), p = mc(h), m = await s.getDimensions(c), y = h === "y", b = y ? "top" : "left", C = y ? "bottom" : "right", w = y ? "clientHeight" : "clientWidth", x = i.reference[p] + i.reference[h] - f[h] - i.floating[p], E = f[h] - i.reference[h], k = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c));
18739
18739
  let S = k ? k[w] : 0;
18740
18740
  (!S || !await (s.isElement == null ? void 0 : s.isElement(k))) && (S = l.floating[w] || i.floating[p]);
18741
- const M = x / 2 - E / 2, N = S / 2 - m[p] / 2 - 1, B = fn(d[b], N), j = fn(d[C], N), U = B, $ = S - m[p] - j, I = S / 2 - m[p] / 2 + M, H = sa(U, I, $), F = !a.arrow && hr(o) != null && I !== H && i.reference[p] / 2 - (I < U ? B : j) - m[p] / 2 < 0, L = F ? I < U ? I - U : I - $ : 0;
18741
+ const M = x / 2 - E / 2, N = S / 2 - m[p] / 2 - 1, B = fn(d[b], N), U = fn(d[C], N), W = B, $ = S - m[p] - U, I = S / 2 - m[p] / 2 + M, H = sa(W, I, $), F = !a.arrow && hr(o) != null && I !== H && i.reference[p] / 2 - (I < W ? B : U) - m[p] / 2 < 0, L = F ? I < W ? I - W : I - $ : 0;
18742
18742
  return {
18743
18743
  [h]: f[h] + L,
18744
18744
  data: {
@@ -18787,8 +18787,8 @@ const U5 = (t) => ({
18787
18787
  placement: o,
18788
18788
  overflows: N
18789
18789
  }], !N.every((I) => I <= 0)) {
18790
- var j, U;
18791
- const I = (((j = i.flip) == null ? void 0 : j.index) || 0) + 1, H = S[I];
18790
+ var U, W;
18791
+ const I = (((U = i.flip) == null ? void 0 : U.index) || 0) + 1, H = S[I];
18792
18792
  if (H && (!(d === "alignment" ? C !== ft(H) : !1) || // We leave the current main axis only if every placement on that axis
18793
18793
  // overflows the main axis.
18794
18794
  B.every((T) => ft(T.placement) === C ? T.overflows[0] > 0 : !0)))
@@ -18801,7 +18801,7 @@ const U5 = (t) => ({
18801
18801
  placement: H
18802
18802
  }
18803
18803
  };
18804
- let F = (U = B.filter((L) => L.overflows[0] <= 0).sort((L, T) => L.overflows[1] - T.overflows[1])[0]) == null ? void 0 : U.placement;
18804
+ let F = (W = B.filter((L) => L.overflows[0] <= 0).sort((L, T) => L.overflows[1] - T.overflows[1])[0]) == null ? void 0 : W.placement;
18805
18805
  if (!F)
18806
18806
  switch (h) {
18807
18807
  case "bestFit": {
@@ -18814,7 +18814,7 @@ const U5 = (t) => ({
18814
18814
  R === "y";
18815
18815
  }
18816
18816
  return !0;
18817
- }).map((T) => [T.placement, T.overflows.filter((R) => R > 0).reduce((R, W) => R + W, 0)]).sort((T, R) => T[1] - R[1])[0]) == null ? void 0 : $[0];
18817
+ }).map((T) => [T.placement, T.overflows.filter((R) => R > 0).reduce((R, j) => R + j, 0)]).sort((T, R) => T[1] - R[1])[0]) == null ? void 0 : $[0];
18818
18818
  L && (F = L);
18819
18819
  break;
18820
18820
  }
@@ -19057,8 +19057,8 @@ const q5 = function(t) {
19057
19057
  const C = m - u.top - u.bottom, w = p - u.left - u.right, x = fn(m - u[y], C), E = fn(p - u[b], w), k = !e.middlewareData.shift;
19058
19058
  let S = x, M = E;
19059
19059
  if ((n = e.middlewareData.shift) != null && n.enabled.x && (M = w), (r = e.middlewareData.shift) != null && r.enabled.y && (S = C), k && !f) {
19060
- const B = Ue(u.left, 0), j = Ue(u.right, 0), U = Ue(u.top, 0), $ = Ue(u.bottom, 0);
19061
- h ? M = p - 2 * (B !== 0 || j !== 0 ? B + j : Ue(u.left, u.right)) : S = m - 2 * (U !== 0 || $ !== 0 ? U + $ : Ue(u.top, u.bottom));
19060
+ const B = Ue(u.left, 0), U = Ue(u.right, 0), W = Ue(u.top, 0), $ = Ue(u.bottom, 0);
19061
+ h ? M = p - 2 * (B !== 0 || U !== 0 ? B + U : Ue(u.left, u.right)) : S = m - 2 * (W !== 0 || $ !== 0 ? W + $ : Ue(u.top, u.bottom));
19062
19062
  }
19063
19063
  await a({
19064
19064
  ...e,
@@ -19532,7 +19532,7 @@ function Dm(t) {
19532
19532
  T !== k.current && (k.current = T, m(T));
19533
19533
  }, []), w = g.useCallback((T) => {
19534
19534
  T !== S.current && (S.current = T, b(T));
19535
- }, []), x = i || p, E = s || y, k = g.useRef(null), S = g.useRef(null), M = g.useRef(u), N = a != null, B = ul(a), j = ul(o), U = ul(c), $ = g.useCallback(() => {
19535
+ }, []), x = i || p, E = s || y, k = g.useRef(null), S = g.useRef(null), M = g.useRef(u), N = a != null, B = ul(a), U = ul(o), W = ul(c), $ = g.useCallback(() => {
19536
19536
  if (!k.current || !S.current)
19537
19537
  return;
19538
19538
  const T = {
@@ -19540,20 +19540,20 @@ function Dm(t) {
19540
19540
  strategy: n,
19541
19541
  middleware: f
19542
19542
  };
19543
- j.current && (T.platform = j.current), b3(k.current, S.current, T).then((R) => {
19544
- const W = {
19543
+ U.current && (T.platform = U.current), b3(k.current, S.current, T).then((R) => {
19544
+ const j = {
19545
19545
  ...R,
19546
19546
  // The floating element's position may be recomputed while it's closed
19547
19547
  // but still mounted (such as when transitioning out). To ensure
19548
19548
  // `isPositioned` will be `false` initially on the next open, avoid
19549
19549
  // setting it to `true` when `open === false` (must be specified).
19550
- isPositioned: U.current !== !1
19550
+ isPositioned: W.current !== !1
19551
19551
  };
19552
- I.current && !$i(M.current, W) && (M.current = W, wa.flushSync(() => {
19553
- d(W);
19552
+ I.current && !$i(M.current, j) && (M.current = j, wa.flushSync(() => {
19553
+ d(j);
19554
19554
  }));
19555
19555
  });
19556
- }, [f, e, n, j, U]);
19556
+ }, [f, e, n, U, W]);
19557
19557
  Wo(() => {
19558
19558
  c === !1 && M.current.isPositioned && (M.current.isPositioned = !1, d((T) => ({
19559
19559
  ...T,
@@ -19586,17 +19586,17 @@ function Dm(t) {
19586
19586
  };
19587
19587
  if (!F.floating)
19588
19588
  return T;
19589
- const R = Jd(F.floating, u.x), W = Jd(F.floating, u.y);
19589
+ const R = Jd(F.floating, u.x), j = Jd(F.floating, u.y);
19590
19590
  return l ? {
19591
19591
  ...T,
19592
- transform: "translate(" + R + "px, " + W + "px)",
19592
+ transform: "translate(" + R + "px, " + j + "px)",
19593
19593
  ...Lm(F.floating) >= 1.5 && {
19594
19594
  willChange: "transform"
19595
19595
  }
19596
19596
  } : {
19597
19597
  position: n,
19598
19598
  left: R,
19599
- top: W
19599
+ top: j
19600
19600
  };
19601
19601
  }, [n, l, F.floating, u.x, u.y]);
19602
19602
  return g.useMemo(() => ({
@@ -19759,7 +19759,7 @@ function B3(t, e) {
19759
19759
  restMs: d = 0,
19760
19760
  move: f = !0
19761
19761
  } = e, h = Cc(), p = bc(), m = No(c), y = No(a), b = No(n), C = No(d), w = g.useRef(), x = g.useRef(-1), E = g.useRef(), k = g.useRef(-1), S = g.useRef(!0), M = g.useRef(!1), N = g.useRef(() => {
19762
- }), B = g.useRef(!1), j = ut(() => {
19762
+ }), B = g.useRef(!1), U = ut(() => {
19763
19763
  var L;
19764
19764
  const T = (L = o.current.openEvent) == null ? void 0 : L.type;
19765
19765
  return T?.includes("mouse") && T !== "mousedown";
@@ -19778,17 +19778,17 @@ function B3(t, e) {
19778
19778
  }, [l, i]), g.useEffect(() => {
19779
19779
  if (!l || !m.current || !n) return;
19780
19780
  function L(R) {
19781
- j() && r(!1, R, "hover");
19781
+ U() && r(!1, R, "hover");
19782
19782
  }
19783
19783
  const T = ht(s.floating).documentElement;
19784
19784
  return T.addEventListener("mouseleave", L), () => {
19785
19785
  T.removeEventListener("mouseleave", L);
19786
19786
  };
19787
- }, [s.floating, n, r, l, m, j]);
19788
- const U = g.useCallback(function(L, T, R) {
19787
+ }, [s.floating, n, r, l, m, U]);
19788
+ const W = g.useCallback(function(L, T, R) {
19789
19789
  T === void 0 && (T = !0), R === void 0 && (R = "hover");
19790
- const W = dl(y.current, "close", w.current);
19791
- W && !E.current ? (Ze(x), x.current = window.setTimeout(() => r(!1, L, R), W)) : T && (Ze(x), r(!1, L, R));
19790
+ const j = dl(y.current, "close", w.current);
19791
+ j && !E.current ? (Ze(x), x.current = window.setTimeout(() => r(!1, L, R), j)) : T && (Ze(x), r(!1, L, R));
19792
19792
  }, [y, r]), $ = ut(() => {
19793
19793
  N.current(), E.current = void 0;
19794
19794
  }), I = ut(() => {
@@ -19821,7 +19821,7 @@ function B3(t, e) {
19821
19821
  x: K.clientX,
19822
19822
  y: K.clientY,
19823
19823
  onClose() {
19824
- I(), $(), H() || U(K, !0, "safe-polygon");
19824
+ I(), $(), H() || W(K, !0, "safe-polygon");
19825
19825
  }
19826
19826
  });
19827
19827
  const le = E.current;
@@ -19830,7 +19830,7 @@ function B3(t, e) {
19830
19830
  };
19831
19831
  return;
19832
19832
  }
19833
- (w.current === "touch" ? !cr(s.floating, K.relatedTarget) : !0) && U(K);
19833
+ (w.current === "touch" ? !cr(s.floating, K.relatedTarget) : !0) && W(K);
19834
19834
  }
19835
19835
  function R(K) {
19836
19836
  H() || o.current.floatingContext && (m.current == null || m.current({
@@ -19839,40 +19839,40 @@ function B3(t, e) {
19839
19839
  x: K.clientX,
19840
19840
  y: K.clientY,
19841
19841
  onClose() {
19842
- I(), $(), H() || U(K);
19842
+ I(), $(), H() || W(K);
19843
19843
  }
19844
19844
  })(K));
19845
19845
  }
19846
- function W() {
19846
+ function j() {
19847
19847
  Ze(x);
19848
19848
  }
19849
19849
  function ee(K) {
19850
- H() || U(K, !1);
19850
+ H() || W(K, !1);
19851
19851
  }
19852
19852
  if (oe(s.domReference)) {
19853
19853
  const K = s.domReference, Z = s.floating;
19854
19854
  return n && K.addEventListener("mouseleave", R), f && K.addEventListener("mousemove", L, {
19855
19855
  once: !0
19856
- }), K.addEventListener("mouseenter", L), K.addEventListener("mouseleave", T), Z && (Z.addEventListener("mouseleave", R), Z.addEventListener("mouseenter", W), Z.addEventListener("mouseleave", ee)), () => {
19857
- n && K.removeEventListener("mouseleave", R), f && K.removeEventListener("mousemove", L), K.removeEventListener("mouseenter", L), K.removeEventListener("mouseleave", T), Z && (Z.removeEventListener("mouseleave", R), Z.removeEventListener("mouseenter", W), Z.removeEventListener("mouseleave", ee));
19856
+ }), K.addEventListener("mouseenter", L), K.addEventListener("mouseleave", T), Z && (Z.addEventListener("mouseleave", R), Z.addEventListener("mouseenter", j), Z.addEventListener("mouseleave", ee)), () => {
19857
+ n && K.removeEventListener("mouseleave", R), f && K.removeEventListener("mousemove", L), K.removeEventListener("mouseenter", L), K.removeEventListener("mouseleave", T), Z && (Z.removeEventListener("mouseleave", R), Z.removeEventListener("mouseenter", j), Z.removeEventListener("mouseleave", ee));
19858
19858
  };
19859
19859
  }
19860
- }, [s, l, t, u, f, U, $, I, r, n, b, h, y, m, o, H, C]), st(() => {
19860
+ }, [s, l, t, u, f, W, $, I, r, n, b, h, y, m, o, H, C]), st(() => {
19861
19861
  var L;
19862
- if (l && n && (L = m.current) != null && (L = L.__options) != null && L.blockPointerEvents && j()) {
19862
+ if (l && n && (L = m.current) != null && (L = L.__options) != null && L.blockPointerEvents && U()) {
19863
19863
  M.current = !0;
19864
19864
  const R = s.floating;
19865
19865
  if (oe(s.domReference) && R) {
19866
19866
  var T;
19867
- const W = ht(s.floating).body;
19868
- W.setAttribute(ef, "");
19867
+ const j = ht(s.floating).body;
19868
+ j.setAttribute(ef, "");
19869
19869
  const ee = s.domReference, K = h == null || (T = h.nodesRef.current.find((Z) => Z.id === p)) == null || (T = T.context) == null ? void 0 : T.elements.floating;
19870
- return K && (K.style.pointerEvents = ""), W.style.pointerEvents = "none", ee.style.pointerEvents = "auto", R.style.pointerEvents = "auto", () => {
19871
- W.style.pointerEvents = "", ee.style.pointerEvents = "", R.style.pointerEvents = "";
19870
+ return K && (K.style.pointerEvents = ""), j.style.pointerEvents = "none", ee.style.pointerEvents = "auto", R.style.pointerEvents = "auto", () => {
19871
+ j.style.pointerEvents = "", ee.style.pointerEvents = "", R.style.pointerEvents = "";
19872
19872
  };
19873
19873
  }
19874
19874
  }
19875
- }, [l, n, p, s, h, m, j]), st(() => {
19875
+ }, [l, n, p, s, h, m, U]), st(() => {
19876
19876
  n || (w.current = void 0, B.current = !1, $(), I());
19877
19877
  }, [n, $, I]), g.useEffect(() => () => {
19878
19878
  $(), Ze(x), Ze(k), I();
@@ -19888,10 +19888,10 @@ function B3(t, e) {
19888
19888
  const {
19889
19889
  nativeEvent: R
19890
19890
  } = T;
19891
- function W() {
19891
+ function j() {
19892
19892
  !S.current && !b.current && r(!0, R, "hover");
19893
19893
  }
19894
- u && !da(w.current) || n || fl(C.current) === 0 || B.current && T.movementX ** 2 + T.movementY ** 2 < 2 || (Ze(k), w.current === "touch" ? W() : (B.current = !0, k.current = window.setTimeout(W, fl(C.current))));
19894
+ u && !da(w.current) || n || fl(C.current) === 0 || B.current && T.movementX ** 2 + T.movementY ** 2 < 2 || (Ze(k), w.current === "touch" ? j() : (B.current = !0, k.current = window.setTimeout(j, fl(C.current))));
19895
19895
  }
19896
19896
  };
19897
19897
  }, [u, r, n, b, C]);
@@ -20113,8 +20113,8 @@ function W3(t, e) {
20113
20113
  if (!w && (I.stopPropagation(), L.length > 0)) {
20114
20114
  let T = !0;
20115
20115
  if (L.forEach((R) => {
20116
- var W;
20117
- if ((W = R.context) != null && W.open && !R.context.dataRef.current.__escapeKeyBubbles) {
20116
+ var j;
20117
+ if ((j = R.context) != null && j.open && !R.context.dataRef.current.__escapeKeyBubbles) {
20118
20118
  T = !1;
20119
20119
  return;
20120
20120
  }
@@ -20136,7 +20136,7 @@ function W3(t, e) {
20136
20136
  const L = C.current;
20137
20137
  if (C.current = !1, c === "click" && L || F || typeof b == "function" && !b(I))
20138
20138
  return;
20139
- const T = Xn(I), R = "[" + io("inert") + "]", W = ht(o.floating).querySelectorAll(R);
20139
+ const T = Xn(I), R = "[" + io("inert") + "]", j = ht(o.floating).querySelectorAll(R);
20140
20140
  let ee = oe(T) ? T : null;
20141
20141
  for (; ee && !It(ee); ) {
20142
20142
  const le = Lt(ee);
@@ -20144,10 +20144,10 @@ function W3(t, e) {
20144
20144
  break;
20145
20145
  ee = le;
20146
20146
  }
20147
- if (W.length && oe(T) && !R5(T) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
20147
+ if (j.length && oe(T) && !R5(T) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
20148
20148
  !cr(T, o.floating) && // If the target root element contains none of the markers, then the
20149
20149
  // element was injected after the floating element rendered.
20150
- Array.from(W).every((le) => !cr(ee, le)))
20150
+ Array.from(j).every((le) => !cr(ee, le)))
20151
20151
  return;
20152
20152
  if (Ke(T) && $) {
20153
20153
  const le = It(T), ye = rt(T), Y = /auto|scroll/, te = le || Y.test(ye.overflowX), Ge = le || Y.test(ye.overflowY), wt = te && T.clientWidth > 0 && T.scrollWidth > T.clientWidth, Vn = Ge && T.clientHeight > 0 && T.scrollHeight > T.clientHeight, Ms = ye.direction === "rtl", zn = Vn && (Ms ? I.offsetX <= T.offsetWidth - T.clientWidth : I.offsetX > T.clientWidth), P0 = wt && I.offsetY > T.clientHeight;
@@ -20173,7 +20173,7 @@ function W3(t, e) {
20173
20173
  return;
20174
20174
  }
20175
20175
  r(!1, I, "outside-press");
20176
- }), j = ut((I) => {
20176
+ }), U = ut((I) => {
20177
20177
  var H;
20178
20178
  const F = () => {
20179
20179
  var L;
@@ -20186,8 +20186,8 @@ function W3(t, e) {
20186
20186
  return;
20187
20187
  i.current.__escapeKeyBubbles = w, i.current.__outsidePressBubbles = x;
20188
20188
  let I = -1;
20189
- function H(W) {
20190
- r(!1, W, "ancestor-scroll");
20189
+ function H(j) {
20190
+ r(!1, j, "ancestor-scroll");
20191
20191
  }
20192
20192
  function F() {
20193
20193
  window.clearTimeout(I), S.current = !0;
@@ -20203,24 +20203,24 @@ function W3(t, e) {
20203
20203
  );
20204
20204
  }
20205
20205
  const T = ht(o.floating);
20206
- l && (T.addEventListener("keydown", E ? N : M, E), T.addEventListener("compositionstart", F), T.addEventListener("compositionend", L)), b && T.addEventListener(c, k ? j : B, k);
20206
+ l && (T.addEventListener("keydown", E ? N : M, E), T.addEventListener("compositionstart", F), T.addEventListener("compositionend", L)), b && T.addEventListener(c, k ? U : B, k);
20207
20207
  let R = [];
20208
- return f && (oe(o.domReference) && (R = ln(o.domReference)), oe(o.floating) && (R = R.concat(ln(o.floating))), !oe(o.reference) && o.reference && o.reference.contextElement && (R = R.concat(ln(o.reference.contextElement)))), R = R.filter((W) => {
20208
+ return f && (oe(o.domReference) && (R = ln(o.domReference)), oe(o.floating) && (R = R.concat(ln(o.floating))), !oe(o.reference) && o.reference && o.reference.contextElement && (R = R.concat(ln(o.reference.contextElement)))), R = R.filter((j) => {
20209
20209
  var ee;
20210
- return W !== ((ee = T.defaultView) == null ? void 0 : ee.visualViewport);
20211
- }), R.forEach((W) => {
20212
- W.addEventListener("scroll", H, {
20210
+ return j !== ((ee = T.defaultView) == null ? void 0 : ee.visualViewport);
20211
+ }), R.forEach((j) => {
20212
+ j.addEventListener("scroll", H, {
20213
20213
  passive: !0
20214
20214
  });
20215
20215
  }), () => {
20216
- l && (T.removeEventListener("keydown", E ? N : M, E), T.removeEventListener("compositionstart", F), T.removeEventListener("compositionend", L)), b && T.removeEventListener(c, k ? j : B, k), R.forEach((W) => {
20217
- W.removeEventListener("scroll", H);
20216
+ l && (T.removeEventListener("keydown", E ? N : M, E), T.removeEventListener("compositionstart", F), T.removeEventListener("compositionend", L)), b && T.removeEventListener(c, k ? U : B, k), R.forEach((j) => {
20217
+ j.removeEventListener("scroll", H);
20218
20218
  }), window.clearTimeout(I);
20219
20219
  };
20220
- }, [i, o, l, b, c, n, r, f, s, w, x, M, E, N, B, k, j]), g.useEffect(() => {
20220
+ }, [i, o, l, b, c, n, r, f, s, w, x, M, E, N, B, k, U]), g.useEffect(() => {
20221
20221
  i.current.insideReactTree = !1;
20222
20222
  }, [i, b, c]);
20223
- const U = g.useMemo(() => ({
20223
+ const W = g.useMemo(() => ({
20224
20224
  onKeyDown: M,
20225
20225
  ...u && {
20226
20226
  [z3[d]]: (I) => {
@@ -20245,9 +20245,9 @@ function W3(t, e) {
20245
20245
  }
20246
20246
  }), [M, c, i]);
20247
20247
  return g.useMemo(() => s ? {
20248
- reference: U,
20248
+ reference: W,
20249
20249
  floating: $
20250
- } : {}, [s, U, $]);
20250
+ } : {}, [s, W, $]);
20251
20251
  }
20252
20252
  function j3(t) {
20253
20253
  const {
@@ -21473,36 +21473,36 @@ const Gm = () => /* @__PURE__ */ P(
21473
21473
  });
21474
21474
  }, [t.attrs.width, t.attrs.height]);
21475
21475
  const d = Ml(
21476
- (y) => {
21477
- y.preventDefault(), y.stopPropagation(), o(!0);
21478
- const b = y.clientX, C = typeof i.width == "number" ? i.width : 300, w = l.current;
21479
- let x = 1;
21480
- w && w.naturalWidth && w.naturalHeight && (x = w.naturalWidth / w.naturalHeight);
21481
- const E = (S) => {
21482
- const M = S.clientX - b, N = Math.max(50, C + M);
21483
- c.current = N;
21484
- const B = i.height === "auto" ? "auto" : Math.max(30, N / x);
21476
+ (C) => {
21477
+ C.preventDefault(), C.stopPropagation(), o(!0);
21478
+ const w = C.clientX, x = typeof i.width == "number" ? i.width : 300, E = l.current;
21479
+ let k = 1;
21480
+ E && E.naturalWidth && E.naturalHeight && (k = E.naturalWidth / E.naturalHeight);
21481
+ const S = (N) => {
21482
+ const B = N.clientX - w, U = Math.max(50, x + B);
21483
+ c.current = U;
21484
+ const W = i.height === "auto" ? "auto" : Math.max(30, U / k);
21485
21485
  s({
21486
- width: N,
21487
- height: B
21488
- }), a.current && (a.current.style.width = `${N}px`, B !== "auto" && (a.current.style.height = `${B}px`));
21489
- }, k = () => {
21486
+ width: U,
21487
+ height: W
21488
+ }), a.current && (a.current.style.width = `${U}px`, W !== "auto" && (a.current.style.height = `${W}px`));
21489
+ }, M = () => {
21490
21490
  o(!1);
21491
- const S = Math.round(c.current);
21491
+ const N = Math.round(c.current);
21492
21492
  e({
21493
- width: S
21494
- }), document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", k);
21493
+ width: N
21494
+ }), document.removeEventListener("mousemove", S), document.removeEventListener("mouseup", M);
21495
21495
  };
21496
- document.addEventListener("mousemove", E), document.addEventListener("mouseup", k);
21496
+ document.addEventListener("mousemove", S), document.addEventListener("mouseup", M);
21497
21497
  },
21498
21498
  [i, e]
21499
21499
  ), f = Ml(() => {
21500
- i.height === "auto" && l.current && s((y) => ({
21501
- ...y,
21500
+ i.height === "auto" && l.current && s((C) => ({
21501
+ ...C,
21502
21502
  height: "auto"
21503
21503
  // 保持 auto,讓 CSS 處理
21504
21504
  }));
21505
- }, [i.width, i.height]), h = {
21505
+ }, [i.width, i.height]), h = t.attrs.textAlign || "left", p = h === "center" ? "center" : h === "right" ? "flex-end" : "flex-start", m = {
21506
21506
  position: "relative",
21507
21507
  display: "inline-block",
21508
21508
  width: i.width,
@@ -21511,12 +21511,12 @@ const Gm = () => /* @__PURE__ */ P(
21511
21511
  userSelect: r ? "none" : "auto",
21512
21512
  outline: n ? "2px solid #007bff" : "none",
21513
21513
  outlineOffset: "2px"
21514
- }, p = {
21514
+ }, y = {
21515
21515
  width: "100%",
21516
21516
  height: i.height === "auto" ? "auto" : "100%",
21517
21517
  display: "block",
21518
21518
  objectFit: "contain"
21519
- }, m = {
21519
+ }, b = {
21520
21520
  position: "absolute",
21521
21521
  bottom: -5,
21522
21522
  right: -5,
@@ -21531,77 +21531,85 @@ const Gm = () => /* @__PURE__ */ P(
21531
21531
  zIndex: 10,
21532
21532
  boxShadow: "0 2px 4px rgba(0,0,0,0.2)"
21533
21533
  };
21534
- return /* @__PURE__ */ v(Pp, { className: "resizable-image-wrapper", "data-drag-handle": "", children: /* @__PURE__ */ P(
21535
- "div",
21534
+ return /* @__PURE__ */ v(
21535
+ Pp,
21536
21536
  {
21537
- ref: a,
21538
- id: `resizable-image-${u}`,
21539
- style: h,
21540
- onMouseEnter: () => {
21541
- if (a.current) {
21542
- const y = a.current.querySelector(
21543
- ".resize-handle"
21544
- );
21545
- y && (y.style.opacity = "1");
21546
- }
21547
- },
21548
- onMouseLeave: () => {
21549
- if (!r && !n && a.current) {
21550
- const y = a.current.querySelector(
21551
- ".resize-handle"
21552
- );
21553
- y && (y.style.opacity = "0");
21537
+ className: "resizable-image-wrapper",
21538
+ "data-drag-handle": "",
21539
+ style: { display: "flex", justifyContent: p },
21540
+ children: /* @__PURE__ */ P(
21541
+ "div",
21542
+ {
21543
+ ref: a,
21544
+ id: `resizable-image-${u}`,
21545
+ style: m,
21546
+ onMouseEnter: () => {
21547
+ if (a.current) {
21548
+ const C = a.current.querySelector(
21549
+ ".resize-handle"
21550
+ );
21551
+ C && (C.style.opacity = "1");
21552
+ }
21553
+ },
21554
+ onMouseLeave: () => {
21555
+ if (!r && !n && a.current) {
21556
+ const C = a.current.querySelector(
21557
+ ".resize-handle"
21558
+ );
21559
+ C && (C.style.opacity = "0");
21560
+ }
21561
+ },
21562
+ children: [
21563
+ /* @__PURE__ */ v(
21564
+ "img",
21565
+ {
21566
+ ref: l,
21567
+ src: t.attrs.src,
21568
+ alt: t.attrs.alt || "",
21569
+ title: t.attrs.title || "",
21570
+ style: y,
21571
+ onLoad: f,
21572
+ draggable: !1
21573
+ }
21574
+ ),
21575
+ /* @__PURE__ */ v(
21576
+ "div",
21577
+ {
21578
+ className: "resize-handle",
21579
+ style: b,
21580
+ onMouseDown: d,
21581
+ title: "拖拽調整圖片大小"
21582
+ }
21583
+ ),
21584
+ (n || r) && /* @__PURE__ */ P(
21585
+ "div",
21586
+ {
21587
+ style: {
21588
+ position: "absolute",
21589
+ top: -25,
21590
+ left: 0,
21591
+ background: "rgba(0, 0, 0, 0.8)",
21592
+ color: "white",
21593
+ padding: "2px 6px",
21594
+ borderRadius: "3px",
21595
+ fontSize: "12px",
21596
+ whiteSpace: "nowrap",
21597
+ zIndex: 11
21598
+ },
21599
+ children: [
21600
+ typeof i.width == "number" ? Math.round(i.width) : i.width,
21601
+ " ",
21602
+ "×",
21603
+ " ",
21604
+ i.height === "auto" ? "auto" : typeof i.height == "number" ? Math.round(i.height) : i.height
21605
+ ]
21606
+ }
21607
+ )
21608
+ ]
21554
21609
  }
21555
- },
21556
- children: [
21557
- /* @__PURE__ */ v(
21558
- "img",
21559
- {
21560
- ref: l,
21561
- src: t.attrs.src,
21562
- alt: t.attrs.alt || "",
21563
- title: t.attrs.title || "",
21564
- style: p,
21565
- onLoad: f,
21566
- draggable: !1
21567
- }
21568
- ),
21569
- /* @__PURE__ */ v(
21570
- "div",
21571
- {
21572
- className: "resize-handle",
21573
- style: m,
21574
- onMouseDown: d,
21575
- title: "拖拽調整圖片大小"
21576
- }
21577
- ),
21578
- (n || r) && /* @__PURE__ */ P(
21579
- "div",
21580
- {
21581
- style: {
21582
- position: "absolute",
21583
- top: -25,
21584
- left: 0,
21585
- background: "rgba(0, 0, 0, 0.8)",
21586
- color: "white",
21587
- padding: "2px 6px",
21588
- borderRadius: "3px",
21589
- fontSize: "12px",
21590
- whiteSpace: "nowrap",
21591
- zIndex: 11
21592
- },
21593
- children: [
21594
- typeof i.width == "number" ? Math.round(i.width) : i.width,
21595
- " ",
21596
- "×",
21597
- " ",
21598
- i.height === "auto" ? "auto" : typeof i.height == "number" ? Math.round(i.height) : i.height
21599
- ]
21600
- }
21601
- )
21602
- ]
21610
+ )
21603
21611
  }
21604
- ) });
21612
+ );
21605
21613
  }, bx = _e.create({
21606
21614
  name: "resizableImage",
21607
21615
  addOptions() {
@@ -21640,6 +21648,11 @@ const Gm = () => /* @__PURE__ */ P(
21640
21648
  height: "auto"
21641
21649
  } : {}
21642
21650
  },
21651
+ textAlign: {
21652
+ default: "left",
21653
+ parseHTML: (t) => t.getAttribute("data-text-align") || "left",
21654
+ renderHTML: (t) => !t.textAlign || t.textAlign === "left" ? {} : { "data-text-align": t.textAlign }
21655
+ },
21643
21656
  // 使用唯一 ID 來識別每張圖片
21644
21657
  imageId: {
21645
21658
  default: null,
@@ -22711,11 +22724,11 @@ var Tc = "PopperContent", [tS, nS] = h1(Tc), v1 = g.forwardRef(
22711
22724
  updatePositionStrategy: h = "optimized",
22712
22725
  onPlaced: p,
22713
22726
  ...m
22714
- } = t, y = p1(Tc, n), [b, C] = g.useState(null), w = Ne(e, (Y) => C(Y)), [x, E] = g.useState(null), k = Qx(x), S = k?.width ?? 0, M = k?.height ?? 0, N = r + (i !== "center" ? "-" + i : ""), B = typeof u == "number" ? u : { top: 0, right: 0, bottom: 0, left: 0, ...u }, j = Array.isArray(c) ? c : [c], U = j.length > 0, $ = {
22727
+ } = t, y = p1(Tc, n), [b, C] = g.useState(null), w = Ne(e, (Y) => C(Y)), [x, E] = g.useState(null), k = Qx(x), S = k?.width ?? 0, M = k?.height ?? 0, N = r + (i !== "center" ? "-" + i : ""), B = typeof u == "number" ? u : { top: 0, right: 0, bottom: 0, left: 0, ...u }, U = Array.isArray(c) ? c : [c], W = U.length > 0, $ = {
22715
22728
  padding: B,
22716
- boundary: j.filter(oS),
22729
+ boundary: U.filter(oS),
22717
22730
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
22718
- altBoundary: U
22731
+ altBoundary: W
22719
22732
  }, { refs: I, floatingStyles: H, placement: F, isPositioned: L, middlewareData: T } = Dm({
22720
22733
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
22721
22734
  strategy: "fixed",
@@ -22746,7 +22759,7 @@ var Tc = "PopperContent", [tS, nS] = h1(Tc), v1 = g.forwardRef(
22746
22759
  iS({ arrowWidth: S, arrowHeight: M }),
22747
22760
  f && E3({ strategy: "referenceHidden", ...$ })
22748
22761
  ]
22749
- }), [R, W] = w1(F), ee = Bt(p);
22762
+ }), [R, j] = w1(F), ee = Bt(p);
22750
22763
  hn(() => {
22751
22764
  L && ee?.();
22752
22765
  }, [L, ee]);
@@ -22790,7 +22803,7 @@ var Tc = "PopperContent", [tS, nS] = h1(Tc), v1 = g.forwardRef(
22790
22803
  Ae.div,
22791
22804
  {
22792
22805
  "data-side": R,
22793
- "data-align": W,
22806
+ "data-align": j,
22794
22807
  ...m,
22795
22808
  ref: w,
22796
22809
  style: {
@@ -23012,7 +23025,7 @@ var mS = g.forwardRef((t, e) => {
23012
23025
  if (M.target === M.currentTarget && N && !b) {
23013
23026
  const B = new CustomEvent(vl, uS);
23014
23027
  if (M.currentTarget.dispatchEvent(B), !B.defaultPrevented) {
23015
- const j = x().filter((F) => F.focusable), U = j.find((F) => F.active), $ = j.find((F) => F.id === m), H = [U, $, ...j].filter(
23028
+ const U = x().filter((F) => F.focusable), W = U.find((F) => F.active), $ = U.find((F) => F.id === m), H = [W, $, ...U].filter(
23016
23029
  Boolean
23017
23030
  ).map((F) => F.ref.current);
23018
23031
  O1(H, u);
@@ -23744,14 +23757,14 @@ var nt = "MenuContent", [yk, Lc] = $n(nt), K1 = g.forwardRef(
23744
23757
  onDismiss: h,
23745
23758
  disableOutsideScroll: p,
23746
23759
  ...m
23747
- } = t, y = Fn(nt, n), b = co(nt, n), C = vs(n), w = z1(n), x = dk(n), [E, k] = g.useState(null), S = g.useRef(null), M = Ne(e, S, y.onContentChange), N = g.useRef(0), B = g.useRef(""), j = g.useRef(0), U = g.useRef(null), $ = g.useRef("right"), I = g.useRef(0), H = p ? Oc : g.Fragment, F = p ? { as: Ck, allowPinchZoom: !0 } : void 0, L = (R) => {
23748
- const W = B.current + R, ee = x().filter((Y) => !Y.disabled), K = document.activeElement, Z = ee.find((Y) => Y.ref.current === K)?.textValue, qe = ee.map((Y) => Y.textValue), le = Ik(qe, W, Z), ye = ee.find((Y) => Y.textValue === le)?.ref.current;
23760
+ } = t, y = Fn(nt, n), b = co(nt, n), C = vs(n), w = z1(n), x = dk(n), [E, k] = g.useState(null), S = g.useRef(null), M = Ne(e, S, y.onContentChange), N = g.useRef(0), B = g.useRef(""), U = g.useRef(0), W = g.useRef(null), $ = g.useRef("right"), I = g.useRef(0), H = p ? Oc : g.Fragment, F = p ? { as: Ck, allowPinchZoom: !0 } : void 0, L = (R) => {
23761
+ const j = B.current + R, ee = x().filter((Y) => !Y.disabled), K = document.activeElement, Z = ee.find((Y) => Y.ref.current === K)?.textValue, qe = ee.map((Y) => Y.textValue), le = Ik(qe, j, Z), ye = ee.find((Y) => Y.textValue === le)?.ref.current;
23749
23762
  (function Y(te) {
23750
23763
  B.current = te, window.clearTimeout(N.current), te !== "" && (N.current = window.setTimeout(() => Y(""), 1e3));
23751
- })(W), ye && setTimeout(() => ye.focus());
23764
+ })(j), ye && setTimeout(() => ye.focus());
23752
23765
  };
23753
23766
  g.useEffect(() => () => window.clearTimeout(N.current), []), u1();
23754
- const T = g.useCallback((R) => $.current === U.current?.side && Dk(R, U.current?.area), []);
23767
+ const T = g.useCallback((R) => $.current === W.current?.side && Dk(R, W.current?.area), []);
23755
23768
  return /* @__PURE__ */ v(
23756
23769
  yk,
23757
23770
  {
@@ -23775,9 +23788,9 @@ var nt = "MenuContent", [yk, Lc] = $n(nt), K1 = g.forwardRef(
23775
23788
  },
23776
23789
  [T]
23777
23790
  ),
23778
- pointerGraceTimerRef: j,
23791
+ pointerGraceTimerRef: U,
23779
23792
  onPointerGraceIntentChange: g.useCallback((R) => {
23780
- U.current = R;
23793
+ W.current = R;
23781
23794
  }, []),
23782
23795
  children: /* @__PURE__ */ v(H, { ...F, children: /* @__PURE__ */ v(
23783
23796
  Ec,
@@ -23839,8 +23852,8 @@ var nt = "MenuContent", [yk, Lc] = $n(nt), K1 = g.forwardRef(
23839
23852
  onPointerMove: J(
23840
23853
  t.onPointerMove,
23841
23854
  Xr((R) => {
23842
- const W = R.target, ee = I.current !== R.clientX;
23843
- if (R.currentTarget.contains(W) && ee) {
23855
+ const j = R.target, ee = I.current !== R.clientX;
23856
+ if (R.currentTarget.contains(j) && ee) {
23844
23857
  const K = R.clientX > I.current ? "right" : "left";
23845
23858
  $.current = K, I.current = R.clientX;
23846
23859
  }
@@ -27646,24 +27659,24 @@ function aM() {
27646
27659
  return u.Date.now();
27647
27660
  };
27648
27661
  function y(k, S, M) {
27649
- var N, B, j, U, $, I, H = 0, F = !1, L = !1, T = !0;
27662
+ var N, B, U, W, $, I, H = 0, F = !1, L = !1, T = !0;
27650
27663
  if (typeof k != "function")
27651
27664
  throw new TypeError(t);
27652
- S = E(S) || 0, C(M) && (F = !!M.leading, L = "maxWait" in M, j = L ? h(E(M.maxWait) || 0, S) : j, T = "trailing" in M ? !!M.trailing : T);
27665
+ S = E(S) || 0, C(M) && (F = !!M.leading, L = "maxWait" in M, U = L ? h(E(M.maxWait) || 0, S) : U, T = "trailing" in M ? !!M.trailing : T);
27653
27666
  function R(te) {
27654
27667
  var Ge = N, wt = B;
27655
- return N = B = void 0, H = te, U = k.apply(wt, Ge), U;
27668
+ return N = B = void 0, H = te, W = k.apply(wt, Ge), W;
27656
27669
  }
27657
- function W(te) {
27658
- return H = te, $ = setTimeout(Z, S), F ? R(te) : U;
27670
+ function j(te) {
27671
+ return H = te, $ = setTimeout(Z, S), F ? R(te) : W;
27659
27672
  }
27660
27673
  function ee(te) {
27661
27674
  var Ge = te - I, wt = te - H, Vn = S - Ge;
27662
- return L ? p(Vn, j - wt) : Vn;
27675
+ return L ? p(Vn, U - wt) : Vn;
27663
27676
  }
27664
27677
  function K(te) {
27665
27678
  var Ge = te - I, wt = te - H;
27666
- return I === void 0 || Ge >= S || Ge < 0 || L && wt >= j;
27679
+ return I === void 0 || Ge >= S || Ge < 0 || L && wt >= U;
27667
27680
  }
27668
27681
  function Z() {
27669
27682
  var te = m();
@@ -27672,23 +27685,23 @@ function aM() {
27672
27685
  $ = setTimeout(Z, ee(te));
27673
27686
  }
27674
27687
  function qe(te) {
27675
- return $ = void 0, T && N ? R(te) : (N = B = void 0, U);
27688
+ return $ = void 0, T && N ? R(te) : (N = B = void 0, W);
27676
27689
  }
27677
27690
  function le() {
27678
27691
  $ !== void 0 && clearTimeout($), H = 0, N = I = B = $ = void 0;
27679
27692
  }
27680
27693
  function ye() {
27681
- return $ === void 0 ? U : qe(m());
27694
+ return $ === void 0 ? W : qe(m());
27682
27695
  }
27683
27696
  function Y() {
27684
27697
  var te = m(), Ge = K(te);
27685
27698
  if (N = arguments, B = this, I = te, Ge) {
27686
27699
  if ($ === void 0)
27687
- return W(I);
27700
+ return j(I);
27688
27701
  if (L)
27689
27702
  return $ = setTimeout(Z, S), R(I);
27690
27703
  }
27691
- return $ === void 0 && ($ = setTimeout(Z, S)), U;
27704
+ return $ === void 0 && ($ = setTimeout(Z, S)), W;
27692
27705
  }
27693
27706
  return Y.cancel = le, Y.flush = ye, Y;
27694
27707
  }
@@ -27980,7 +27993,7 @@ function EM(t) {
27980
27993
  }
27981
27994
  }),
27982
27995
  yx,
27983
- X7.configure({ types: ["heading", "paragraph"] }),
27996
+ X7.configure({ types: ["heading", "paragraph", "resizableImage"] }),
27984
27997
  om,
27985
27998
  rm.configure({ nested: !0 }),
27986
27999
  k4.configure({ multicolor: !0 }),