@ryzeup/richtexteditor 1.0.32 → 1.0.33

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.es.js CHANGED
@@ -303,20 +303,20 @@ const an = [
303
303
  style: N
304
304
  }) => {
305
305
  var B, Y;
306
- const S = X(null), $ = X(null), b = X(null), [A, F] = H(!1), [j, O] = H({
306
+ const S = X(null), $ = X(null), C = X(null), [A, F] = H(!1), [j, O] = H({
307
307
  x: 0,
308
308
  y: 0
309
309
  });
310
310
  V(() => {
311
- const f = (w) => {
311
+ const p = (w) => {
312
312
  !w.target.closest(".rte-emoji-popup") && !w.target.closest("button[title='Emoji']") && F(!1);
313
313
  };
314
- return document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
314
+ return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
315
315
  }, []);
316
- const I = (f) => {
316
+ const I = (p) => {
317
317
  var Z;
318
- f.preventDefault();
319
- const w = f.currentTarget.dataset.command;
318
+ p.preventDefault();
319
+ const w = p.currentTarget.dataset.command;
320
320
  if (w)
321
321
  switch (w) {
322
322
  case "bold":
@@ -336,10 +336,10 @@ const an = [
336
336
  default:
337
337
  console.warn("Unknown command:", w);
338
338
  }
339
- }, K = (f) => {
340
- l("foreColor", f.target.value);
341
- }, W = (f) => {
342
- l("backColor", f.target.value);
339
+ }, K = (p) => {
340
+ l("foreColor", p.target.value);
341
+ }, W = (p) => {
342
+ l("backColor", p.target.value);
343
343
  }, [x, D] = H({
344
344
  bold: !1,
345
345
  italic: !1,
@@ -358,7 +358,7 @@ const an = [
358
358
  highlight: !1
359
359
  }), q = X(null), P = X(null);
360
360
  return V(() => {
361
- const f = () => {
361
+ const p = () => {
362
362
  const w = window.getSelection();
363
363
  if (!w || !w.anchorNode) return;
364
364
  let Z = w.anchorNode.nodeType === Node.ELEMENT_NODE ? w.anchorNode : w.anchorNode.parentElement;
@@ -370,9 +370,9 @@ const an = [
370
370
  }
371
371
  P.current && (P.current.value = String(de));
372
372
  };
373
- return document.addEventListener("selectionchange", f), () => document.removeEventListener("selectionchange", f);
373
+ return document.addEventListener("selectionchange", p), () => document.removeEventListener("selectionchange", p);
374
374
  }, []), V(() => {
375
- const f = () => {
375
+ const p = () => {
376
376
  D({
377
377
  bold: document.queryCommandState("bold"),
378
378
  italic: document.queryCommandState("italic"),
@@ -391,7 +391,7 @@ const an = [
391
391
  highlight: document.queryCommandState("backColor")
392
392
  });
393
393
  };
394
- return document.addEventListener("selectionchange", f), () => document.removeEventListener("selectionchange", f);
394
+ return document.addEventListener("selectionchange", p), () => document.removeEventListener("selectionchange", p);
395
395
  }, []), /* @__PURE__ */ r.createElement("div", {
396
396
  className: `rte-toolbar ${R || ""}`,
397
397
  style: N
@@ -441,8 +441,8 @@ const an = [
441
441
  }, /* @__PURE__ */ r.createElement(Xt, null)), E.removeFormat && /* @__PURE__ */ r.createElement("button", {
442
442
  "data-command": "Remove format",
443
443
  title: "removeFormat",
444
- onMouseDown: (f) => {
445
- f.preventDefault(), d(), z();
444
+ onMouseDown: (p) => {
445
+ p.preventDefault(), d(), z();
446
446
  },
447
447
  className: x.removeFormat ? "rte-active" : ""
448
448
  }, /* @__PURE__ */ r.createElement(rn, null)), E.image && /* @__PURE__ */ r.createElement("button", {
@@ -464,9 +464,9 @@ const an = [
464
464
  }
465
465
  }, /* @__PURE__ */ r.createElement("button", {
466
466
  title: "Emoji",
467
- onMouseDown: (f) => {
468
- f.preventDefault(), d();
469
- const w = f.currentTarget.getBoundingClientRect();
467
+ onMouseDown: (p) => {
468
+ p.preventDefault(), d();
469
+ const w = p.currentTarget.getBoundingClientRect();
470
470
  O({
471
471
  x: w.left,
472
472
  y: w.bottom + 8
@@ -480,7 +480,7 @@ const an = [
480
480
  top: j.y,
481
481
  left: j.x
482
482
  }
483
- }, an.map((f, w) => /* @__PURE__ */ r.createElement("span", {
483
+ }, an.map((p, w) => /* @__PURE__ */ r.createElement("span", {
484
484
  key: w,
485
485
  style: {
486
486
  fontSize: "20px",
@@ -488,17 +488,17 @@ const an = [
488
488
  textAlign: "center"
489
489
  },
490
490
  onMouseDown: (Z) => {
491
- Z.preventDefault(), L(f), F(!1);
491
+ Z.preventDefault(), L(p), F(!1);
492
492
  }
493
- }, f))), document.body)), E.color && /* @__PURE__ */ r.createElement("div", {
493
+ }, p))), document.body)), E.color && /* @__PURE__ */ r.createElement("div", {
494
494
  style: {
495
495
  position: "relative"
496
496
  }
497
497
  }, /* @__PURE__ */ r.createElement("button", {
498
498
  title: "Text Color",
499
- onMouseDown: (f) => {
499
+ onMouseDown: (p) => {
500
500
  var w;
501
- f.preventDefault(), d(), (w = $.current) == null || w.click();
501
+ p.preventDefault(), d(), (w = $.current) == null || w.click();
502
502
  },
503
503
  style: {
504
504
  display: "flex",
@@ -512,9 +512,9 @@ const an = [
512
512
  ref: $,
513
513
  type: "color",
514
514
  defaultValue: "#000000",
515
- onChange: (f) => {
515
+ onChange: (p) => {
516
516
  var w;
517
- K(f), ((w = f.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = f.target.value;
517
+ K(p), ((w = p.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = p.target.value;
518
518
  },
519
519
  style: {
520
520
  position: "absolute",
@@ -529,24 +529,24 @@ const an = [
529
529
  }
530
530
  }, /* @__PURE__ */ r.createElement("button", {
531
531
  title: "Highlight",
532
- onMouseDown: (f) => {
532
+ onMouseDown: (p) => {
533
533
  var w;
534
- f.preventDefault(), d(), (w = b.current) == null || w.click();
534
+ p.preventDefault(), d(), (w = C.current) == null || w.click();
535
535
  },
536
536
  style: {
537
537
  display: "flex",
538
538
  alignItems: "center",
539
539
  justifyContent: "center",
540
- color: ((Y = b.current) == null ? void 0 : Y.value) || "#000",
540
+ color: ((Y = C.current) == null ? void 0 : Y.value) || "#000",
541
541
  fontSize: "18px"
542
542
  },
543
543
  className: x.highlight ? "rte-active" : ""
544
544
  }, /* @__PURE__ */ r.createElement(Wt, null)), /* @__PURE__ */ r.createElement("input", {
545
- ref: b,
545
+ ref: C,
546
546
  type: "color",
547
- onChange: (f) => {
547
+ onChange: (p) => {
548
548
  var w;
549
- W(f), ((w = f.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = f.target.value;
549
+ W(p), ((w = p.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = p.target.value;
550
550
  },
551
551
  defaultValue: "#000000",
552
552
  style: {
@@ -558,22 +558,22 @@ const an = [
558
558
  }
559
559
  })), E.align && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("button", {
560
560
  title: "Align Left",
561
- onMouseDown: (f) => f.preventDefault(),
561
+ onMouseDown: (p) => p.preventDefault(),
562
562
  onClick: () => l("justifyLeft"),
563
563
  className: x.alignLeft ? "rte-active" : ""
564
564
  }, /* @__PURE__ */ r.createElement(Ut, null)), /* @__PURE__ */ r.createElement("button", {
565
565
  title: "Align Center",
566
- onMouseDown: (f) => f.preventDefault(),
566
+ onMouseDown: (p) => p.preventDefault(),
567
567
  onClick: () => l("justifyCenter"),
568
568
  className: x.alignCenter ? "rte-active" : ""
569
569
  }, /* @__PURE__ */ r.createElement(It, null)), /* @__PURE__ */ r.createElement("button", {
570
570
  title: "Align Right",
571
- onMouseDown: (f) => f.preventDefault(),
571
+ onMouseDown: (p) => p.preventDefault(),
572
572
  onClick: () => l("justifyRight"),
573
573
  className: x.alignRight ? "rte-active" : ""
574
574
  }, /* @__PURE__ */ r.createElement(qt, null))), E.table && /* @__PURE__ */ r.createElement("button", {
575
575
  title: "Insert Dynamic Table",
576
- onMouseDown: (f) => f.preventDefault(),
576
+ onMouseDown: (p) => p.preventDefault(),
577
577
  onClick: () => l("insertTable"),
578
578
  className: x.table ? "rte-active" : "",
579
579
  style: {
@@ -581,7 +581,7 @@ const an = [
581
581
  }
582
582
  }, /* @__PURE__ */ r.createElement(en, null)), E.table && /* @__PURE__ */ r.createElement("button", {
583
583
  title: "Insert Static Table",
584
- onMouseDown: (f) => f.preventDefault(),
584
+ onMouseDown: (p) => p.preventDefault(),
585
585
  onClick: () => l("insertStaticTable"),
586
586
  className: x.table ? "rte-active" : "",
587
587
  style: {
@@ -617,10 +617,10 @@ const an = [
617
617
  disabled: !0
618
618
  }, "Font Size"), Array.from({
619
619
  length: 16
620
- }, (f, w) => 10 + w).map((f) => /* @__PURE__ */ r.createElement("option", {
621
- key: f,
622
- value: f
623
- }, f, "px"))));
620
+ }, (p, w) => 10 + w).map((p) => /* @__PURE__ */ r.createElement("option", {
621
+ key: p,
622
+ value: p
623
+ }, p, "px"))));
624
624
  }, on = ({
625
625
  show: l,
626
626
  position: d,
@@ -667,7 +667,7 @@ const an = [
667
667
  name: R,
668
668
  value: N
669
669
  }, S) => {
670
- const $ = R.toLowerCase(), b = L.toLowerCase(), A = $.indexOf(b);
670
+ const $ = R.toLowerCase(), C = L.toLowerCase(), A = $.indexOf(C);
671
671
  let F = R;
672
672
  if (A !== -1 && L.length > 0) {
673
673
  const j = A + L.length;
@@ -699,7 +699,7 @@ const an = [
699
699
  }
700
700
  }, "No matches")) : null;
701
701
  };
702
- function fe(l) {
702
+ function pe(l) {
703
703
  return k({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: { id: "Circle_Minus" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { d: "M15,11.5h0a.5.5,0,0,1,0,1H9a.5.5,0,0,1,0-1Z" }, child: [] }, { tag: "path", attr: { d: "M12,21.934A9.933,9.933,0,1,1,21.932,12,9.945,9.945,0,0,1,12,21.934ZM12,3.068A8.933,8.933,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.068Z" }, child: [] }] }] }] })(l);
704
704
  }
705
705
  function ie(l) {
@@ -731,11 +731,11 @@ const cn = ({
731
731
  onClick: () => g("insertColRight")
732
732
  }, /* @__PURE__ */ r.createElement(ie, null), " Insert col right"), /* @__PURE__ */ r.createElement("button", {
733
733
  onClick: () => g("deleteRow")
734
- }, /* @__PURE__ */ r.createElement(fe, null), " Delete row"), /* @__PURE__ */ r.createElement("button", {
734
+ }, /* @__PURE__ */ r.createElement(pe, null), " Delete row"), /* @__PURE__ */ r.createElement("button", {
735
735
  onClick: () => g("deleteCol")
736
- }, /* @__PURE__ */ r.createElement(fe, null), " Delete column"), /* @__PURE__ */ r.createElement("button", {
736
+ }, /* @__PURE__ */ r.createElement(pe, null), " Delete column"), /* @__PURE__ */ r.createElement("button", {
737
737
  onClick: () => g("deleteTable")
738
- }, /* @__PURE__ */ r.createElement(fe, null), " Delete table"));
738
+ }, /* @__PURE__ */ r.createElement(pe, null), " Delete table"));
739
739
  };
740
740
  function Ve(l) {
741
741
  return k({ attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M885.9 490.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h129.3l85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zM184 456V172h81v284h-81zm627.2 160.4H496.8l9.6 198.4c.6 11.9-4.7 23.1-14.6 30.5-6.1 4.5-13.6 6.8-21.1 6.7a44.28 44.28 0 0 1-42.2-32.3L329 459.2V172h415.4a56.85 56.85 0 0 1 33.6 51.8c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-14 25.5 21.9 19a56.76 56.76 0 0 1 19.6 43c0 19.1-11 37.5-28.8 48.4z" }, child: [] }] })(l);
@@ -811,16 +811,16 @@ const sn = ({
811
811
  width: 480,
812
812
  height: 1040
813
813
  }
814
- }, E = (b) => {
815
- const A = b.target;
814
+ }, E = (C) => {
815
+ const A = C.target;
816
816
  if (A.tagName === "A") {
817
- b.preventDefault();
817
+ C.preventDefault();
818
818
  const F = A.href;
819
819
  F && window.open(F, "_blank", "noopener,noreferrer");
820
820
  }
821
- }, R = (b) => b === "rgb(0, 0, 0)" || b === "rgba(0, 0, 0, 1)" || b === "#000" || b === "#000000" || b === "black", N = (b) => {
821
+ }, R = (C) => C === "rgb(0, 0, 0)" || C === "rgba(0, 0, 0, 1)" || C === "#000" || C === "#000000" || C === "black", N = (C) => {
822
822
  const A = document.createElement("div");
823
- A.innerHTML = b;
823
+ A.innerHTML = C;
824
824
  const F = document.createTreeWalker(A, NodeFilter.SHOW_TEXT, null), j = [];
825
825
  for (; F.nextNode(); ) {
826
826
  const O = F.currentNode;
@@ -850,14 +850,14 @@ const sn = ({
850
850
  }
851
851
  const D = document.createDocumentFragment();
852
852
  let q = 0;
853
- I.replace(/{{\s*([\s\S]*?)\s*}}/g, (B, Y, f) => {
854
- if (f > q && D.appendChild(document.createTextNode(I.slice(q, f))), x)
853
+ I.replace(/{{\s*([\s\S]*?)\s*}}/g, (B, Y, p) => {
854
+ if (p > q && D.appendChild(document.createTextNode(I.slice(q, p))), x)
855
855
  D.appendChild(document.createTextNode(B));
856
856
  else {
857
857
  const w = document.createElement("span");
858
858
  w.style.color = "blue", w.textContent = B, D.appendChild(w);
859
859
  }
860
- return q = f + B.length, B;
860
+ return q = p + B.length, B;
861
861
  }), q < I.length && D.appendChild(document.createTextNode(I.slice(q))), K.replaceChild(D, O);
862
862
  }), A.innerHTML = A.innerHTML.replace(/{{#arrayData}}/g, "").replace(/{{\/arrayData}}/g, ""), A.innerHTML;
863
863
  }, S = () => (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
@@ -882,10 +882,10 @@ const sn = ({
882
882
  className: "rte-preview-device-picker"
883
883
  }, /* @__PURE__ */ r.createElement("select", {
884
884
  value: L,
885
- onChange: (b) => _(b.target.value)
886
- }, Object.entries(z).map(([b, A]) => /* @__PURE__ */ r.createElement("option", {
887
- key: b,
888
- value: b
885
+ onChange: (C) => _(C.target.value)
886
+ }, Object.entries(z).map(([C, A]) => /* @__PURE__ */ r.createElement("option", {
887
+ key: C,
888
+ value: C
889
889
  }, A.label)))), L === "web" && /* @__PURE__ */ r.createElement("div", {
890
890
  className: "rte-preview-web-wrapper"
891
891
  }, /* @__PURE__ */ r.createElement("div", {
@@ -958,18 +958,18 @@ const sn = ({
958
958
  }
959
959
  }, "Enter Attribute Values"), /* @__PURE__ */ r.createElement("div", {
960
960
  className: "rte-attr-list"
961
- }, Object.keys(g).map((b) => /* @__PURE__ */ r.createElement("div", {
962
- key: b,
961
+ }, Object.keys(g).map((C) => /* @__PURE__ */ r.createElement("div", {
962
+ key: C,
963
963
  className: "rte-attr-row"
964
964
  }, /* @__PURE__ */ r.createElement("div", {
965
965
  className: "rte-attr-name"
966
- }, `{{${b}}}`), /* @__PURE__ */ r.createElement("span", null, " : "), /* @__PURE__ */ r.createElement("input", {
966
+ }, `{{${C}}}`), /* @__PURE__ */ r.createElement("span", null, " : "), /* @__PURE__ */ r.createElement("input", {
967
967
  className: "rte-attr-input",
968
- value: g[b] || "",
968
+ value: g[C] || "",
969
969
  onChange: (A) => {
970
970
  const F = A.target.value;
971
971
  v((j) => ae(re({}, j), {
972
- [b]: F
972
+ [C]: F
973
973
  }));
974
974
  },
975
975
  placeholder: "Enter value"
@@ -1004,23 +1004,23 @@ const sn = ({
1004
1004
  className: "rte-link-modal__input",
1005
1005
  placeholder: "URL",
1006
1006
  value: v,
1007
- onChange: (b) => L(b.target.value)
1007
+ onChange: (C) => L(C.target.value)
1008
1008
  }), /* @__PURE__ */ r.createElement("input", {
1009
1009
  type: "text",
1010
1010
  className: "rte-link-modal__input",
1011
1011
  placeholder: "Text to Display",
1012
1012
  value: _,
1013
- onChange: (b) => z(b.target.value)
1013
+ onChange: (C) => z(C.target.value)
1014
1014
  }), /* @__PURE__ */ r.createElement("input", {
1015
1015
  type: "text",
1016
1016
  className: "rte-link-modal__input",
1017
1017
  placeholder: "Title",
1018
1018
  value: E,
1019
- onChange: (b) => R(b.target.value)
1019
+ onChange: (C) => R(C.target.value)
1020
1020
  }), /* @__PURE__ */ r.createElement("select", {
1021
1021
  className: "rte-link-modal__select",
1022
1022
  value: N,
1023
- onChange: (b) => S(b.target.value)
1023
+ onChange: (C) => S(C.target.value)
1024
1024
  }, /* @__PURE__ */ r.createElement("option", {
1025
1025
  value: "_self"
1026
1026
  }, "Same tab"), /* @__PURE__ */ r.createElement("option", {
@@ -1075,14 +1075,14 @@ const gn = ({
1075
1075
  }
1076
1076
  }) => {
1077
1077
  var Ne, Me, Ae, Te, ke, ze, De, He, Oe, _e, Pe, Fe;
1078
- const S = X(null), [$, b] = H(E != null && E.length ? E : " "), [A, F] = H(""), [j, O] = H(!1), [I, K] = H({
1078
+ const S = X(null), [$, C] = H(E != null && E.length ? E : " "), [A, F] = H(""), [j, O] = H(!1), [I, K] = H({
1079
1079
  x: 0,
1080
1080
  y: 0
1081
1081
  }), [W, x] = H([]), D = X(null), q = X(null), [P, B] = H({
1082
1082
  visible: !1,
1083
1083
  x: 0,
1084
1084
  y: 0
1085
- }), [Y, f] = H(!1), w = X(null), [Z, J] = H({
1085
+ }), [Y, p] = H(!1), w = X(null), [Z, J] = H({
1086
1086
  url: "",
1087
1087
  text: "",
1088
1088
  title: "",
@@ -1105,13 +1105,13 @@ const gn = ({
1105
1105
  fontFamily: (_e = g.fontFamily) != null ? _e : !1,
1106
1106
  fontSize: (Pe = g.fontSize) != null ? Pe : !1,
1107
1107
  highlight: (Fe = g.fontSize) != null ? Fe : !1
1108
- }, [de, ee] = H(""), [oe, ue] = H([]), [pe, ve] = H({}), U = () => S.current, M = () => {
1108
+ }, [de, ee] = H(""), [oe, ue] = H([]), [fe, ve] = H({}), U = () => S.current, M = () => {
1109
1109
  const e = Xe(), t = /^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(e.trim());
1110
1110
  let n = e;
1111
1111
  t || (n = `<div style="font-size: 12px;">${e}</div>`), n = n.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g, (o, y, h) => {
1112
1112
  if (/list-type=["']static["']/.test(h) || o.includes("data-hidden-array-start") || o.includes("data-hidden-array-end")) return o;
1113
- const u = `<${y}${h}>`, c = '<span data-hidden-array-start="true" style="display:none">{{#arrayData}}</span>', p = '<span data-hidden-array-end="true" style="display:none">{{/arrayData}}</span>', C = `</${y}>`, T = o.replace(new RegExp(`^${u}`), "").replace(new RegExp(`${C}$`), "");
1114
- return `${u}${c}${T}${p}${C}`;
1113
+ const u = `<${y}${h}>`, c = '<span data-hidden-array-start="true" style="display:none">{{#arrayData}}</span>', f = '<span data-hidden-array-end="true" style="display:none">{{/arrayData}}</span>', b = `</${y}>`, T = o.replace(new RegExp(`^${u}`), "").replace(new RegExp(`${b}$`), "");
1114
+ return `${u}${c}${T}${f}${b}`;
1115
1115
  }), F(n), _ == null || _(n);
1116
1116
  const a = gt(e);
1117
1117
  z(a);
@@ -1212,7 +1212,7 @@ const gn = ({
1212
1212
  const h = document.createRange();
1213
1213
  h.setStart(i, 0), h.collapse(!0), n.removeAllRanges(), n.addRange(h), (u = U()) == null || u.focus(), M();
1214
1214
  }, me = (e, t) => {
1215
- e === "insertOrderedList" || e === "insertStaticOrderedList" ? ye("ol", e) : e === "insertUnorderedList" || e === "insertStaticUnorderedList" ? ye("ul", e) : e.startsWith("justify") ? ft(e) : Ee(e, t), e === "insertTable" && Ce(), e === "insertStaticTable" && Ce("insertStaticTable");
1215
+ e === "insertOrderedList" || e === "insertStaticOrderedList" ? ye("ol", e) : e === "insertUnorderedList" || e === "insertStaticUnorderedList" ? ye("ul", e) : e.startsWith("justify") ? pt(e) : Ee(e, t), e === "insertTable" && Ce(), e === "insertStaticTable" && Ce("insertStaticTable");
1216
1216
  }, Qe = (e) => {
1217
1217
  const t = document.createElement("span");
1218
1218
  t.textContent = "​", e.insertNode(t), e.setStartAfter(t), e.collapse(!0);
@@ -1307,15 +1307,15 @@ const gn = ({
1307
1307
  h == null || h.removeChild(o);
1308
1308
  const c = document.createElement("p");
1309
1309
  c.innerHTML = "<br />", (a = u.parentElement) == null || a.insertBefore(c, u.nextSibling);
1310
- const p = document.createRange();
1311
- p.setStart(c, 0), p.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(p);
1310
+ const f = document.createRange();
1311
+ f.setStart(c, 0), f.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(f);
1312
1312
  } else {
1313
1313
  const c = o.closest("ul, ol");
1314
1314
  if (c) {
1315
- const p = document.createElement("p");
1316
- p.innerHTML = "<br />", (s = c.parentElement) == null || s.insertBefore(p, c.nextSibling), c.removeChild(o);
1317
- const C = document.createRange();
1318
- C.setStart(p, 0), C.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(C);
1315
+ const f = document.createElement("p");
1316
+ f.innerHTML = "<br />", (s = c.parentElement) == null || s.insertBefore(f, c.nextSibling), c.removeChild(o);
1317
+ const b = document.createRange();
1318
+ b.setStart(f, 0), b.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(b);
1319
1319
  }
1320
1320
  }
1321
1321
  M();
@@ -1381,8 +1381,8 @@ const gn = ({
1381
1381
  if (!t) return;
1382
1382
  const n = new FileReader();
1383
1383
  n.onload = (s) => {
1384
- var C;
1385
- const i = (C = s.target) == null ? void 0 : C.result;
1384
+ var b;
1385
+ const i = (b = s.target) == null ? void 0 : b.result;
1386
1386
  G();
1387
1387
  const o = window.getSelection();
1388
1388
  let y = o && o.rangeCount ? o.getRangeAt(0) : null;
@@ -1400,8 +1400,8 @@ const gn = ({
1400
1400
  y.deleteContents(), y.insertNode(h);
1401
1401
  const c = document.createTextNode(" ");
1402
1402
  h.after(c);
1403
- const p = document.createRange();
1404
- p.setStartAfter(c), p.collapse(!0), o.removeAllRanges(), o.addRange(p), u.focus(), M(), e.target.value = "";
1403
+ const f = document.createRange();
1404
+ f.setStartAfter(c), f.collapse(!0), o.removeAllRanges(), o.addRange(f), u.focus(), M(), e.target.value = "";
1405
1405
  }, n.readAsDataURL(t);
1406
1406
  }, ot = (e) => {
1407
1407
  var s;
@@ -1423,11 +1423,11 @@ const gn = ({
1423
1423
  v.tr && s.classList.add(v.tr);
1424
1424
  const i = document.createElement("tr");
1425
1425
  v.tr && i.classList.add(v.tr);
1426
- for (let p = 0; p < 2; p++) {
1427
- const C = document.createElement("th");
1428
- C.textContent = "", C.style.border = "1px solid #999", C.style.padding = "4px", C.style.position = "relative", C.style.backgroundColor = "lightgray", C.style.height = "20px", v.th && C.classList.add(v.th);
1426
+ for (let f = 0; f < 2; f++) {
1427
+ const b = document.createElement("th");
1428
+ b.textContent = "", b.style.border = "1px solid #999", b.style.padding = "4px", b.style.position = "relative", b.style.backgroundColor = "lightgray", b.style.height = "20px", b.style.whiteSpace = "normal", b.style.wordBreak = "break-word", b.style.overflowWrap = "anywhere", b.style.lineHeight = "20px", b.style.minWidth = "20px", v.th && b.classList.add(v.th);
1429
1429
  const T = document.createElement("td");
1430
- T.textContent = "", T.style.border = "1px solid #999", T.style.padding = "4px", T.style.position = "relative", T.style.backgroundColor = "#fff", T.style.minHeight = "20px", T.style.height = "20px", T.style.whiteSpace = "normal", T.style.wordBreak = "break-word", T.style.overflowWrap = "anywhere", T.style.lineHeight = "20px", T.style.minWidth = "20px", v.td && T.classList.add(v.td), te(C), te(T), s.appendChild(C), i.appendChild(T);
1430
+ T.textContent = "", T.style.border = "1px solid #999", T.style.padding = "4px", T.style.position = "relative", T.style.backgroundColor = "#fff", T.style.minHeight = "20px", T.style.height = "20px", T.style.whiteSpace = "normal", T.style.wordBreak = "break-word", T.style.overflowWrap = "anywhere", T.style.lineHeight = "20px", T.style.minWidth = "20px", v.td && T.classList.add(v.td), te(b), te(T), s.appendChild(b), i.appendChild(T);
1431
1431
  }
1432
1432
  n.appendChild(s), a.appendChild(i), t.appendChild(n), t.appendChild(a), ge(t);
1433
1433
  const o = window.getSelection();
@@ -1498,11 +1498,11 @@ const gn = ({
1498
1498
  c.preventDefault(), s = c.clientY, o = e.offsetHeight, document.addEventListener("mousemove", h), document.addEventListener("mouseup", u);
1499
1499
  });
1500
1500
  const y = (c) => {
1501
- const p = i + (c.clientX - a);
1502
- e.style.width = `${Math.max(30, p)}px`, M();
1501
+ const f = i + (c.clientX - a);
1502
+ e.style.width = `${Math.max(30, f)}px`, M();
1503
1503
  }, h = (c) => {
1504
- const p = o + (c.clientY - s);
1505
- e.style.height = `${Math.max(20, p)}px`, M();
1504
+ const f = o + (c.clientY - s);
1505
+ e.style.height = `${Math.max(20, f)}px`, M();
1506
1506
  }, u = () => {
1507
1507
  document.removeEventListener("mousemove", y), document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", u), M();
1508
1508
  };
@@ -1583,7 +1583,7 @@ const gn = ({
1583
1583
  text: "",
1584
1584
  title: "",
1585
1585
  target: "_self"
1586
- }), f(!0);
1586
+ }), p(!0);
1587
1587
  }, ut = (e) => {
1588
1588
  const t = window.getSelection();
1589
1589
  if (!t || !w.current) return;
@@ -1597,7 +1597,7 @@ const gn = ({
1597
1597
  const i = document.createTextNode(" ");
1598
1598
  a.after(i);
1599
1599
  const o = document.createRange();
1600
- o.setStartAfter(i), o.collapse(!0), t.removeAllRanges(), t.addRange(o), f(!1), M();
1600
+ o.setStartAfter(i), o.collapse(!0), t.removeAllRanges(), t.addRange(o), p(!1), M();
1601
1601
  }, mt = (e) => {
1602
1602
  const t = e.target;
1603
1603
  if (t.tagName === "A") {
@@ -1613,7 +1613,7 @@ const gn = ({
1613
1613
  text: n.textContent || n.href,
1614
1614
  title: n.title,
1615
1615
  target: n.target
1616
- }), f(!0);
1616
+ }), p(!0);
1617
1617
  }
1618
1618
  }, ht = () => {
1619
1619
  const e = U();
@@ -1631,14 +1631,14 @@ const gn = ({
1631
1631
  i.appendChild(s);
1632
1632
  const o = document.createTreeWalker(i, NodeFilter.SHOW_ELEMENT, null), y = [];
1633
1633
  for (; o.nextNode(); ) {
1634
- const c = o.currentNode, p = c.tagName.toUpperCase(), C = c.getAttribute && c.getAttribute("data-mention") !== null;
1635
- p !== "A" && !C && y.push(c);
1634
+ const c = o.currentNode, f = c.tagName.toUpperCase(), b = c.getAttribute && c.getAttribute("data-mention") !== null;
1635
+ f !== "A" && !b && y.push(c);
1636
1636
  }
1637
1637
  for (let c = y.length - 1; c >= 0; c--) {
1638
- const p = y[c], C = p.parentNode;
1639
- if (C) {
1640
- for (; p.firstChild; ) C.insertBefore(p.firstChild, p);
1641
- C.removeChild(p);
1638
+ const f = y[c], b = f.parentNode;
1639
+ if (b) {
1640
+ for (; f.firstChild; ) b.insertBefore(f.firstChild, f);
1641
+ b.removeChild(f);
1642
1642
  }
1643
1643
  }
1644
1644
  i.querySelectorAll("[style]").forEach((c) => c.removeAttribute("style")), a.deleteContents();
@@ -1680,7 +1680,7 @@ const gn = ({
1680
1680
  return o.selectNodeContents(i), t.compareBoundaryPoints(Range.END_TO_START, o) < 0 && t.compareBoundaryPoints(Range.START_TO_END, o) > 0;
1681
1681
  });
1682
1682
  }
1683
- function ft(e) {
1683
+ function pt(e) {
1684
1684
  const t = Se();
1685
1685
  if (t.length === 0) {
1686
1686
  Ee(e);
@@ -1691,7 +1691,7 @@ const gn = ({
1691
1691
  a.style.textAlign = n;
1692
1692
  }), M();
1693
1693
  }
1694
- const pt = () => {
1694
+ const ft = () => {
1695
1695
  const e = window.getSelection();
1696
1696
  if (!e || !e.anchorNode) return !1;
1697
1697
  let t = e.anchorNode.nodeType === Node.ELEMENT_NODE ? e.anchorNode : e.anchorNode.parentElement;
@@ -1701,18 +1701,18 @@ const gn = ({
1701
1701
  }
1702
1702
  return !1;
1703
1703
  }, vt = (e) => {
1704
- if (pt()) {
1704
+ if (ft()) {
1705
1705
  e.preventDefault();
1706
1706
  const u = e.clipboardData.getData("text/plain");
1707
1707
  if (!u) return;
1708
1708
  const c = window.getSelection();
1709
1709
  if (!c || !c.rangeCount) return;
1710
- const p = c.getRangeAt(0);
1711
- p.deleteContents();
1712
- const C = u.split(/\r?\n/);
1713
- C.forEach((T, ne) => {
1714
- p.insertNode(document.createTextNode(T)), ne < C.length - 1 && p.insertNode(document.createElement("br"));
1715
- }), p.collapse(!1), c.removeAllRanges(), c.addRange(p), M();
1710
+ const f = c.getRangeAt(0);
1711
+ f.deleteContents();
1712
+ const b = u.split(/\r?\n/);
1713
+ b.forEach((T, ne) => {
1714
+ f.insertNode(document.createTextNode(T)), ne < b.length - 1 && f.insertNode(document.createElement("br"));
1715
+ }), f.collapse(!1), c.removeAllRanges(), c.addRange(f), M();
1716
1716
  return;
1717
1717
  }
1718
1718
  const t = e.clipboardData.getData("text/html") || "";
@@ -1727,11 +1727,11 @@ const gn = ({
1727
1727
  a.innerHTML = t;
1728
1728
  const s = (u) => {
1729
1729
  u.hasAttribute("data-has-resize-handle") || (u.style.borderCollapse = "collapse", u.style.width = "100%", u.style.border = "1px solid #ccc", u.style.margin = "8px 0", u.style.position = "relative", u.style.textAlign = "center", u.querySelectorAll("th").forEach((c) => {
1730
- const p = c;
1731
- p.style.border = "1px solid #999", p.style.padding = "4px", p.style.position = "relative", p.style.backgroundColor = "lightgray", p.style.height = "20px";
1730
+ const f = c;
1731
+ f.style.border = "1px solid #999", f.style.padding = "4px", f.style.position = "relative", f.style.backgroundColor = "lightgray", f.style.height = "20px", f.style.whiteSpace = "normal", f.style.wordBreak = "break-word", f.style.overflowWrap = "anywhere", f.style.lineHeight = "20px", f.style.minWidth = "20px";
1732
1732
  }), u.querySelectorAll("td").forEach((c) => {
1733
- const p = c;
1734
- p.style.border = "1px solid #999", p.style.padding = "4px", p.style.position = "relative", p.style.backgroundColor = "#fff", p.style.height = "20px";
1733
+ const f = c;
1734
+ f.style.border = "1px solid #999", f.style.padding = "4px", f.style.position = "relative", f.style.backgroundColor = "#fff", f.style.height = "20px", f.style.minHeight = "20px", f.style.whiteSpace = "normal", f.style.wordBreak = "break-word", f.style.overflowWrap = "anywhere", f.style.lineHeight = "20px", f.style.minWidth = "20px";
1735
1735
  }));
1736
1736
  };
1737
1737
  a.querySelectorAll("table").forEach((u) => s(u));
@@ -1745,9 +1745,9 @@ const gn = ({
1745
1745
  const h = S.current;
1746
1746
  h && (h.querySelectorAll("table").forEach((u) => {
1747
1747
  const c = u;
1748
- c.hasAttribute("data-has-resize-handle") || (ge(c), c.querySelectorAll("th, td").forEach((p) => {
1749
- const C = p;
1750
- C.dataset.hasResizeHandles || te(C);
1748
+ c.hasAttribute("data-has-resize-handle") || (ge(c), c.querySelectorAll("th, td").forEach((f) => {
1749
+ const b = f;
1750
+ b.dataset.hasResizeHandles || te(b);
1751
1751
  }));
1752
1752
  }), M());
1753
1753
  }, Et = (e) => {
@@ -1827,7 +1827,7 @@ const gn = ({
1827
1827
  });
1828
1828
  }, Lt = () => {
1829
1829
  let e = A;
1830
- return Object.entries(pe).forEach(([t, n]) => {
1830
+ return Object.entries(fe).forEach(([t, n]) => {
1831
1831
  if (n.trim()) {
1832
1832
  const a = new RegExp(`{{\\s*${t}\\s*}}`, "g");
1833
1833
  e = e.replace(a, n);
@@ -1911,13 +1911,13 @@ const gn = ({
1911
1911
  }), /* @__PURE__ */ r.createElement(dn, {
1912
1912
  visible: Y,
1913
1913
  linkData: Z,
1914
- onClose: () => f(!1),
1914
+ onClose: () => p(!1),
1915
1915
  onInsert: ut
1916
1916
  })), m ? /* @__PURE__ */ r.createElement(sn, {
1917
1917
  className: v.preview,
1918
1918
  style: L.preview,
1919
1919
  html: Lt(),
1920
- attributes: pe,
1920
+ attributes: fe,
1921
1921
  setAttributes: ve
1922
1922
  }) : null);
1923
1923
  };