reactjs-tiptap-editor 0.0.27 → 0.0.30

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,41 +1,125 @@
1
- var E = Object.defineProperty;
2
- var I = (e, t, o) => t in e ? E(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
- var p = (e, t, o) => I(e, typeof t != "symbol" ? t + "" : t, o);
4
- import { useMemo as z, useEffect as W } from "react";
5
- import { a0 as B, v as O } from "./components-DqT7-cFp.js";
6
- import { p as P, u as $, al as b, bT as N, bU as U } from "./vendor-uVk9OL1t.js";
7
- import { $ as j, a0 as h } from "./tiptap-BEIRLff8.js";
8
- import { M as A, C as L } from "./extensions-BUtdRI-5.js";
9
- let y;
10
- function k() {
11
- return y === void 0 && (y = navigator.platform.includes("Mac")), y;
12
- }
13
- function q(e) {
14
- return `${e}`.toLowerCase() === "mod" ? k() ? "⌘" : "Ctrl" : `${e}`.toLowerCase() === "alt" ? k() ? "⌥" : "Alt" : `${e}`.toLowerCase() === "shift" ? k() ? "⇧" : "Shift" : e;
15
- }
16
- function Ae(e) {
17
- return e.map(q).join(" ");
18
- }
19
- function Le(e, t) {
20
- const { state: o } = t, i = o.selection.$anchor;
21
- let r = !1;
22
- if (i.depth)
23
- for (let n = i.depth; n > 0; n--)
24
- i.node(n).type.name === e && (t.dispatchTransaction && t.dispatchTransaction(o.tr.delete(i.before(n), i.after(n)).scrollIntoView()), r = !0);
25
- else {
26
- const n = o.selection.node;
27
- n && n.type.name === e && (t.chain().deleteSelection().run(), r = !0);
28
- }
29
- if (!r) {
30
- const n = i.pos;
31
- if (n) {
32
- const l = o.tr.doc.nodeAt(n);
33
- l && l.type.name === e && (t.dispatchTransaction && t.dispatchTransaction(o.tr.delete(n, n + l.nodeSize)), r = !0);
34
- }
35
- }
36
- return r;
37
- }
38
- const K = {
1
+ var p = Object.defineProperty;
2
+ var s = (e, t, o) => t in e ? p(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
+ var n = (e, t, o) => s(e, typeof t != "symbol" ? t + "" : t, o);
4
+ import { useMemo as g, useEffect as m } from "react";
5
+ import { proxy as u, useSnapshot as c } from "valtio";
6
+ import { m as h } from "./utils-DrrJak96.js";
7
+ const b = "en", f = 200, B = f - 80, w = 20, I = 1e5, R = 16, z = 10, N = 10, U = 2, M = [
8
+ "#000000",
9
+ "#262626",
10
+ "#595959",
11
+ "#8C8C8C",
12
+ "#BFBFBF",
13
+ "#D9D9D9",
14
+ "#E9E9E9",
15
+ "#F5F5F5",
16
+ "#FAFAFA",
17
+ "#FFFFFF",
18
+ "#F5222D",
19
+ "#FA541C",
20
+ "#FA8C16",
21
+ "#FADB14",
22
+ "#52C41A",
23
+ "#13C2C2",
24
+ "#1890FF",
25
+ "#2F54EB",
26
+ "#722ED1",
27
+ "#EB2F96",
28
+ "#FFE8E6",
29
+ "#FFECE0",
30
+ "#FFEFD1",
31
+ "#FCFCCA",
32
+ "#E4F7D2",
33
+ "#D3F5F0",
34
+ "#D4EEFC",
35
+ "#DEE8FC",
36
+ "#EFE1FA",
37
+ "#FAE1EB",
38
+ "#FFA39E",
39
+ "#FFBB96",
40
+ "#FFD591",
41
+ "#FFFB8F",
42
+ "#B7EB8F",
43
+ "#87E8DE",
44
+ "#91D5FF",
45
+ "#ADC6FF",
46
+ "#D3ADF7",
47
+ "#FFADD2",
48
+ "#FF4D4F",
49
+ "#FF7A45",
50
+ "#FFA940",
51
+ "#FFEC3D",
52
+ "#73D13D",
53
+ "#36CFC9",
54
+ "#40A9FF",
55
+ "#597EF7",
56
+ "#9254DE",
57
+ "#F759AB",
58
+ "#CF1322",
59
+ "#D4380D",
60
+ "#D46B08",
61
+ "#D4B106",
62
+ "#389E0D",
63
+ "#08979C",
64
+ "#096DD9",
65
+ "#1D39C4",
66
+ "#531DAB",
67
+ "#C41D7F",
68
+ "#820014",
69
+ "#871400",
70
+ "#873800",
71
+ "#614700",
72
+ "#135200",
73
+ "#00474F",
74
+ "#003A8C",
75
+ "#061178",
76
+ "#22075E",
77
+ "#780650"
78
+ ], H = [
79
+ "Inter",
80
+ "Comic Sans MS, Comic Sans",
81
+ "serif",
82
+ "monospace",
83
+ "cursive"
84
+ ], W = [
85
+ "html",
86
+ "css",
87
+ "js",
88
+ "ts"
89
+ ], P = {
90
+ html: "HTML",
91
+ css: "CSS",
92
+ js: "JavaScript",
93
+ ts: "TypeScript"
94
+ }, O = [
95
+ "10px",
96
+ "11px",
97
+ "12px",
98
+ "14px",
99
+ "16px",
100
+ "18px",
101
+ "20px",
102
+ "22px",
103
+ "24px",
104
+ "26px",
105
+ "28px",
106
+ "36px",
107
+ "48px",
108
+ "72px"
109
+ ], G = "default";
110
+ var F = /* @__PURE__ */ ((e) => (e[e["size-small"] = 200] = "size-small", e[e["size-medium"] = 500] = "size-medium", e["size-large"] = "100%", e))(F || {}), T = /* @__PURE__ */ ((e) => (e[e["size-small"] = 480] = "size-small", e[e["size-medium"] = 640] = "size-medium", e["size-large"] = "100%", e))(T || {});
111
+ const j = ["100%", "115%", "150%", "200%", "250%", "300%"], X = "1", q = [
112
+ "bold",
113
+ "italic",
114
+ "underline",
115
+ "strike",
116
+ "code",
117
+ "link",
118
+ "divider",
119
+ "color",
120
+ "highlight",
121
+ "textAlign"
122
+ ], k = {
39
123
  "editor.remove": "Remove",
40
124
  "editor.copy": "Copy",
41
125
  "editor.words": "WORDS",
@@ -182,7 +266,7 @@ const K = {
182
266
  "editor.exportPdf.tooltip": "Export PDF",
183
267
  "editor.exportWord.tooltip": "Export Word",
184
268
  "editor.importWrod.tooltip": "Import Word"
185
- }, G = K, V = {
269
+ }, C = k, _ = {
186
270
  "editor.remove": "Xóa",
187
271
  "editor.copy": "Sao chép",
188
272
  "editor.words": "TỪ",
@@ -329,7 +413,7 @@ const K = {
329
413
  "editor.exportPdf.tooltip": "Xuất PDF",
330
414
  "editor.exportWord.tooltip": "Xuất Word",
331
415
  "editor.importWrod.tooltip": "Nhập Word"
332
- }, X = V, J = {
416
+ }, A = _, x = {
333
417
  "editor.remove": "移除",
334
418
  "editor.copy": "复制",
335
419
  "editor.words": "字数",
@@ -476,86 +560,38 @@ const K = {
476
560
  "editor.exportPdf.tooltip": "导出 PDF",
477
561
  "editor.exportWord.tooltip": "导出 Word",
478
562
  "editor.importWrod.tooltip": "导入 Word"
479
- }, Q = J;
480
- function Y(e) {
481
- return e = e || /* @__PURE__ */ new Map(), {
482
- /**
483
- * A Map of event names to registered handler functions.
484
- */
485
- all: e,
486
- /**
487
- * Register an event handler for the given type.
488
- * @param {string|symbol} type Type of event to listen for, or `'*'` for all events
489
- * @param {Function} handler Function to call in response to given event
490
- * @memberOf mitt
491
- */
492
- on(t, o) {
493
- const i = e.get(t);
494
- i ? i.push(o) : e.set(t, [o]);
495
- },
496
- /**
497
- * Remove an event handler for the given type.
498
- * If `handler` is omitted, all handlers of the given type are removed.
499
- * @param {string|symbol} type Type of event to unregister `handler` from (`'*'` to remove a wildcard handler)
500
- * @param {Function} [handler] Handler function to remove
501
- * @memberOf mitt
502
- */
503
- off(t, o) {
504
- const i = e.get(t);
505
- i && (o ? i.splice(i.indexOf(o) >>> 0, 1) : e.set(t, []));
506
- },
507
- /**
508
- * Invoke all handlers for the given type.
509
- * If present, `'*'` handlers are invoked after type-matched handlers.
510
- *
511
- * Note: Manually firing '*' handlers is not supported.
512
- *
513
- * @param {string|symbol} type The event type to invoke
514
- * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
515
- * @memberOf mitt
516
- */
517
- emit(t, o) {
518
- let i = e.get(t);
519
- i && [...i].map((r) => {
520
- r(o);
521
- }), i = e.get("*"), i && [...i].map((r) => {
522
- r(t, o);
523
- });
524
- }
525
- };
526
- }
527
- const g = {
528
- lang: B,
563
+ }, L = x, i = {
564
+ lang: b,
529
565
  message: {
530
- en: G,
531
- vi: X,
532
- zh_CN: Q
566
+ en: C,
567
+ vi: A,
568
+ zh_CN: L
533
569
  }
534
570
  };
535
- class Z {
571
+ class D {
536
572
  constructor() {
537
- p(this, "emitter");
538
- this.emitter = Y();
573
+ n(this, "emitter");
574
+ this.emitter = h();
539
575
  }
540
576
  // Getter and setter for current language
541
577
  get lang() {
542
- return g.lang;
578
+ return i.lang;
543
579
  }
544
580
  set lang(t) {
545
581
  if (!this.isLangSupported(t)) {
546
582
  console.warn(
547
- `Can't find the current language "${t}", Using language "${g.lang}" by default`
583
+ `Can't find the current language "${t}", Using language "${i.lang}" by default`
548
584
  );
549
585
  return;
550
586
  }
551
- g.lang = t, this.emitter.emit("lang", t);
587
+ i.lang = t, this.emitter.emit("lang", t);
552
588
  }
553
589
  // Getter and setter for messages
554
590
  get message() {
555
- return g.message;
591
+ return i.message;
556
592
  }
557
593
  set message(t) {
558
- g.message = t;
594
+ i.message = t;
559
595
  }
560
596
  // Load messages for a specific language
561
597
  loadLangMessage(t) {
@@ -585,19 +621,19 @@ class Z {
585
621
  buildLocalesHandler(t) {
586
622
  t || (t = this.lang);
587
623
  const o = this.loadLangMessage(t);
588
- return function(r) {
589
- return o[r] || r;
624
+ return function(a) {
625
+ return o[a] || a;
590
626
  };
591
627
  }
592
628
  }
593
- const f = new Z(), T = P({
594
- lang: g.lang
629
+ const l = new D(), r = u({
630
+ lang: i.lang
595
631
  });
596
- function Re() {
597
- const e = $(T), t = z(() => f.buildLocalesHandler(e.lang), [e.lang]);
598
- return W(() => {
599
- const o = f.registerWatchLang((i) => {
600
- T.lang = i;
632
+ function K() {
633
+ const e = c(r), t = g(() => l.buildLocalesHandler(e.lang), [e.lang]);
634
+ return m(() => {
635
+ const o = l.registerWatchLang((d) => {
636
+ r.lang = d;
601
637
  });
602
638
  return () => {
603
639
  o.unsubscribe();
@@ -607,428 +643,32 @@ function Re() {
607
643
  t
608
644
  };
609
645
  }
610
- const Fe = {
611
- t: (e) => f.buildLocalesHandler(T.lang)(e)
612
- }, Me = f, ee = (e) => typeof e == "number", te = (e) => typeof e == "string", He = (e) => typeof e == "function";
613
- function De(e, t = "px") {
614
- if (!e)
615
- return e;
616
- const o = ee(e) ? String(e) : e, i = Number.parseFloat(o), r = o.match(/[a-z%]+$/i), n = r ? r[0] : t;
617
- return Number.isNaN(i) ? e : i + n;
618
- }
619
- function Ee(e, t) {
620
- if (!e)
621
- return !1;
622
- const { extensions: o = [] } = (e == null ? void 0 : e.extensionManager) ?? {};
623
- return !!o.find((r) => r.name === t);
624
- }
625
- function Ie(e) {
626
- return e.map((t) => te(t) ? { value: t, name: t } : t);
627
- }
628
- const w = "data-rc-order", _ = "data-rc-priority", oe = "rc-util-key", x = /* @__PURE__ */ new Map();
629
- function ie(e, t) {
630
- if (!e)
631
- return !1;
632
- if (e.contains)
633
- return e.contains(t);
634
- let o = t;
635
- for (; o; ) {
636
- if (o === e)
637
- return !0;
638
- o = o.parentNode;
639
- }
640
- return !1;
641
- }
642
- function R({ mark: e } = {}) {
643
- return e ? e.startsWith("data-") ? e : `data-${e}` : oe;
644
- }
645
- function v(e) {
646
- return e.attachTo ? e.attachTo : document.querySelector("head") || document.body;
647
- }
648
- function ne(e) {
649
- return e === "queue" ? "prependQueue" : e ? "prepend" : "append";
650
- }
651
- function F(e) {
652
- return [...(x.get(e) || e).children].filter(
653
- (t) => t.tagName === "STYLE"
654
- );
655
- }
656
- function M(e, t = {}) {
657
- const { csp: o, prepend: i, priority: r = 0 } = t, n = ne(i), l = n === "prependQueue", d = document.createElement("style");
658
- d.setAttribute(w, n), l && r && d.setAttribute(_, `${r}`), o != null && o.nonce && (d.nonce = o == null ? void 0 : o.nonce), d.innerHTML = e;
659
- const a = v(t), { firstChild: c } = a;
660
- if (i) {
661
- if (l) {
662
- const s = F(a).filter((m) => {
663
- if (!["prepend", "prependQueue"].includes(m.getAttribute(w)))
664
- return !1;
665
- const u = Number(m.getAttribute(_) || 0);
666
- return r >= u;
667
- });
668
- if (s.length > 0)
669
- return a.insertBefore(d, s.at(-1).nextSibling), d;
670
- }
671
- c.before(d);
672
- } else
673
- a.append(d);
674
- return d;
675
- }
676
- function H(e, t = {}) {
677
- const o = v(t);
678
- return F(o).find((i) => i.getAttribute(R(t)) === e);
679
- }
680
- function ze(e, t = {}) {
681
- const o = H(e, t);
682
- o && o.remove();
683
- }
684
- function re(e, t) {
685
- const o = x.get(e);
686
- if (!o || !ie(document, o)) {
687
- const i = M("", t), { parentNode: r } = i;
688
- x.set(e, r), i.remove();
689
- }
690
- }
691
- function We(e, t, o = {}) {
692
- var l, d, a;
693
- const i = v(o);
694
- re(i, o);
695
- const r = H(t, o);
696
- if (r)
697
- return (l = o.csp) != null && l.nonce && r.nonce !== ((d = o.csp) == null ? void 0 : d.nonce) && (r.nonce = (a = o.csp) == null ? void 0 : a.nonce), r.innerHTML !== e && (r.innerHTML = e), r;
698
- const n = M(e, o);
699
- return n.setAttribute(R(o), t), n;
700
- }
701
- var le = /* @__PURE__ */ ((e) => (e[e.max = 7] = "max", e[e.min = 0] = "min", e[e.more = 1] = "more", e[e.less = -1] = "less", e))(le || {});
702
- function de(e, t, o) {
703
- return e < t ? t : e > o ? o : e;
704
- }
705
- function ae(e, t, o, i) {
706
- const { doc: r, selection: n } = e;
707
- if (!r || !n || !(n instanceof b || n instanceof N))
708
- return e;
709
- const { from: l, to: d } = n;
710
- return r.nodesBetween(l, d, (a, c) => {
711
- const s = a.type;
712
- return o.includes(s.name) ? (e = se(e, c, t), !1) : !j(a.type.name, i.extensionManager.extensions);
713
- }), e;
714
- }
715
- function se(e, t, o) {
716
- if (!e.doc)
717
- return e;
718
- const i = e.doc.nodeAt(t);
719
- if (!i)
720
- return e;
721
- const l = de((i.attrs.indent || 0) + o, 0, 7);
722
- if (l === i.attrs.indent)
723
- return e;
724
- const d = {
725
- ...i.attrs,
726
- indent: l
727
- };
728
- return e.setNodeMarkup(t, i.type, d, i.marks);
729
- }
730
- function Be({ delta: e, types: t }) {
731
- return ({ state: o, dispatch: i, editor: r }) => {
732
- const { selection: n } = o;
733
- let { tr: l } = o;
734
- return l = l.setSelection(n), l = ae(l, e, t, r), l.docChanged ? (i && i(l), !0) : !1;
735
- };
736
- }
737
- function ce(e, t, o = null) {
738
- return o ? e.createChecked({ index: t }, o) : e.createAndFill({ index: t });
739
- }
740
- function ue(e) {
741
- if (e.cached.columnsNodeTypes)
742
- return e.cached.columnsNodeTypes;
743
- const t = {
744
- columns: e.nodes.columns,
745
- column: e.nodes.column
746
- };
747
- return e.cached.columnsNodeTypes = t, t;
748
- }
749
- function Oe(e, t, o = null) {
750
- const i = ue(e), r = [];
751
- for (let n = 0; n < t; n += 1) {
752
- const l = ce(i.column, n, o);
753
- l && r.push(l);
754
- }
755
- return i.columns.createChecked({ cols: t }, r);
756
- }
757
- function Pe({
758
- state: e,
759
- dispatch: t,
760
- type: o
761
- }) {
762
- const i = h((n) => n.type.name === A.name)(e.selection), r = h((n) => n.type.name === L.name)(e.selection);
763
- if (t && i && r) {
764
- const n = i.node, l = r.node.attrs.index, d = n.toJSON();
765
- let a = l;
766
- o === "delete" ? (a = l - 1, d.content.splice(l, 1)) : (a = o === "addBefore" ? l : l + 1, d.content.splice(a, 0, {
767
- type: "column",
768
- attrs: {
769
- index: l
770
- },
771
- content: [
772
- {
773
- type: "paragraph"
774
- }
775
- ]
776
- })), d.attrs.cols = d.content.length, d.content.forEach((u, S) => {
777
- u.attrs.index = S;
778
- });
779
- const c = U.fromJSON(e.schema, d);
780
- let s = i.pos;
781
- c.content.forEach((u, S, D) => {
782
- D < a && (s += u.nodeSize);
783
- });
784
- const m = e.tr.setTime(Date.now());
785
- m.replaceWith(i.pos, i.pos + i.node.nodeSize, c).setSelection(
786
- b.near(m.doc.resolve(s))
787
- ), t(m);
788
- }
789
- return !0;
790
- }
791
- function $e({ state: e, dispatch: t, type: o }) {
792
- const i = h((n) => n.type.name === A.name)(e.selection), r = h((n) => n.type.name === L.name)(e.selection);
793
- if (t && i && r) {
794
- const n = i.node, l = r.node.attrs.index;
795
- let d = 0;
796
- o === "before" ? d = (l - 1 + n.attrs.cols) % n.attrs.cols : d = (l + 1) % n.attrs.cols;
797
- let a = i.pos;
798
- n.content.forEach((s, m, u) => {
799
- u < d && (a += s.nodeSize);
800
- });
801
- const c = e.tr.setTime(Date.now());
802
- return c.setSelection(b.near(c.doc.resolve(a))), t(c), !0;
803
- }
804
- return !1;
805
- }
806
- const pe = ["paragraph", "heading", "list_item", "todo_item"];
807
- function me(e, t) {
808
- const { selection: o, doc: i } = e;
809
- if (!o || !i || !(o instanceof b || o instanceof N))
810
- return e;
811
- const { from: r, to: n } = o, l = [], d = t && t !== O ? t : null;
812
- if (i.nodesBetween(r, n, (a, c) => {
813
- const s = a.type;
814
- return pe.includes(s.name) ? ((a.attrs.lineHeight || null) !== d && l.push({
815
- node: a,
816
- pos: c,
817
- nodeType: s
818
- }), s.name !== "list_item" && s.name !== "todo_item") : !0;
819
- }), l.length === 0)
820
- return e;
821
- for (const a of l) {
822
- const { node: c, pos: s, nodeType: m } = a;
823
- let { attrs: u } = c;
824
- u = {
825
- ...u,
826
- lineHeight: d
827
- }, e = e.setNodeMarkup(s, m, u, c.marks);
828
- }
829
- return e;
830
- }
831
- function Ue(e) {
832
- return ({ state: t, dispatch: o }) => {
833
- const { selection: i } = t;
834
- let { tr: r } = t;
835
- return r = r.setSelection(i), r = me(r, e), r.docChanged ? (o && o(r), !0) : !1;
836
- };
837
- }
838
- const ge = /(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i, he = /CrOS/, fe = /android|ipad|playbook|silk/i;
839
- function je(e = {}) {
840
- let t = e.ua || typeof navigator < "u" && navigator.userAgent;
841
- return t && typeof t == "object" && t.headers && typeof t.headers["user-agent"] == "string" && (t = t.headers["user-agent"]), typeof t != "string" ? !1 : !!(ge.test(t) && !he.test(t) || e.tablet && fe.test(t) || e.tablet && e.featureDetect && navigator && navigator.maxTouchPoints > 1 && t.includes("Macintosh") && t.includes("Safari"));
842
- }
843
- function be(e, t = "{}") {
844
- try {
845
- return JSON.stringify(e);
846
- } catch {
847
- return t;
848
- }
849
- }
850
- function ye(e, t = null) {
851
- if (typeof window > "u")
852
- throw new Error();
853
- const o = localStorage.getItem(e);
854
- if (!o)
855
- return t;
856
- try {
857
- return JSON.parse(o);
858
- } catch {
859
- return o;
860
- }
861
- }
862
- function ke(e, t) {
863
- window.localStorage.setItem(e, `${t}`);
864
- }
865
- class C {
866
- constructor(t, o) {
867
- p(this, "key");
868
- p(this, "value");
869
- p(this, "prev");
870
- p(this, "next");
871
- this.key = t, this.value = o, this.prev = null, this.next = null;
872
- }
873
- }
874
- class Ce {
875
- constructor(t) {
876
- p(this, "capacity");
877
- p(this, "usedCapacity");
878
- p(this, "head");
879
- p(this, "tail");
880
- p(this, "store");
881
- this.capacity = t || 20, this.usedCapacity = 0, this.store = {}, this.head = new C("fakeHeadNode", "fakeHeadNode"), this.tail = new C("fakeTailNode", "fakeTailNode"), this.head.next = this.tail, this.tail.prev = this.head;
882
- }
883
- removeNode(t) {
884
- t.prev.next = t.next, t.next.prev = t.prev;
885
- }
886
- addToHead(t) {
887
- t.prev = this.head, t.next = this.head.next, this.head.next.prev = t, this.head.next = t;
888
- }
889
- moveToHead(t) {
890
- this.removeNode(t), this.addToHead(t);
891
- }
892
- removeTail() {
893
- const t = this.tail.prev;
894
- return this.removeNode(t), t;
895
- }
896
- get(t) {
897
- if (t in this.store) {
898
- const o = this.store[t];
899
- return this.moveToHead(o), o.value;
900
- }
901
- return -1;
902
- }
903
- put(t, o) {
904
- if (t in this.store) {
905
- const i = this.store[t];
906
- i.value = o, this.moveToHead(i);
907
- } else {
908
- const i = new C(t, o);
909
- if (this.addToHead(i), this.store[t] = i, this.usedCapacity += 1, this.usedCapacity > this.capacity) {
910
- const r = this.removeTail();
911
- delete this.store[r.key], this.usedCapacity -= 1;
912
- }
913
- }
914
- }
915
- keys() {
916
- const t = [];
917
- let o = this.head;
918
- for (; o; )
919
- t.push(o.key), o = o.next;
920
- return t.slice(1, -1);
921
- }
922
- values() {
923
- const t = [];
924
- let o = this.head;
925
- for (; o; )
926
- t.push(o.value), o = o.next;
927
- return t.slice(1, -1);
928
- }
929
- toJSON() {
930
- return this.store;
931
- }
932
- }
933
- function qe(e, t) {
934
- const o = new Ce(t);
935
- return {
936
- syncFromStorage() {
937
- (ye(e) || []).slice().reverse().forEach((n) => {
938
- o.put(n, n);
939
- });
940
- },
941
- syncToStorage() {
942
- ke(e, be(o.keys()));
943
- },
944
- put(r) {
945
- o.put(r, r), this.syncToStorage();
946
- },
947
- get(r) {
948
- return r ? o.get(r) : o.keys();
949
- }
950
- };
951
- }
952
- function Ke(e, t = 1) {
953
- let o = 0, i = 0, r = 0;
954
- if (e.startsWith("rgb")) {
955
- const n = e.replace(/\s/g, "").match(/rgb\((.*)\)$/)[1].split(",");
956
- o = +n[0], i = +n[1], r = +n[2];
957
- } else if (e.startsWith("#")) {
958
- let n = e.replace("#", "");
959
- n.length === 3 && (n = `${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`), o = Number.parseInt(n.substring(0, 2), 16), i = Number.parseInt(n.substring(2, 4), 16), r = Number.parseInt(n.substring(4, 6), 16);
960
- } else
961
- return e;
962
- return t > 1 && t <= 100 && (t = t / 100), `rgba(${o},${i},${r},${t})`;
963
- }
964
- function Te(e) {
965
- const o = Array.from(document.querySelectorAll("style, link")).reduce(
966
- (d, a) => d + a.outerHTML,
967
- ""
968
- ) + e.outerHTML, i = document.createElement("iframe");
969
- i.setAttribute("style", "position: absolute; width: 0; height: 0; top: 0; left: 0;"), document.body.appendChild(i);
970
- const r = i.contentWindow, n = i.contentDocument || i.contentWindow && i.contentWindow.document, l = document.createElement("link");
971
- l.rel = "stylesheet", l.href = "https://cdn.jsdelivr.net/npm/reactjs-tiptap-editor/lib/style.css", n.head.appendChild(l), n && (n.open(), n.write(o), n.close()), r && (i.onload = function() {
972
- try {
973
- setTimeout(() => {
974
- r.focus();
975
- try {
976
- r.document.execCommand("print", !1) || r.print();
977
- } catch {
978
- r.print();
979
- }
980
- r.close();
981
- }, 10);
982
- } catch (d) {
983
- console.error(d);
984
- }
985
- setTimeout(() => {
986
- document.body.removeChild(i);
987
- }, 100);
988
- });
989
- }
990
- function Ge(e) {
991
- const t = e.dom.closest(".ProseMirror");
992
- return t ? (Te(t), !0) : !1;
993
- }
994
- function Ve(e) {
995
- return e && e.type.name === "title";
996
- }
997
- function Xe(e, t) {
998
- const i = [e.getJSON()], r = [];
999
- for (; i.length; ) {
1000
- const n = i.shift();
1001
- n.type === t && r.push(n), n.content && n.content.length && i.push(...n.content);
1002
- }
1003
- return r;
1004
- }
646
+ const $ = {
647
+ t: (e) => l.buildLocalesHandler(r.lang)(e)
648
+ }, V = l;
1005
649
  export {
1006
- Q as A,
1007
- le as I,
1008
- We as a,
1009
- q as b,
1010
- Oe as c,
1011
- Le as d,
1012
- Ie as e,
1013
- Pe as f,
1014
- Ae as g,
1015
- Ee as h,
1016
- He as i,
1017
- $e as j,
1018
- Be as k,
1019
- Fe as l,
1020
- Ue as m,
1021
- De as n,
1022
- je as o,
1023
- qe as p,
1024
- Ke as q,
1025
- ze as r,
1026
- se as s,
1027
- Ge as t,
1028
- Re as u,
1029
- Xe as v,
1030
- Ve as w,
1031
- Me as x,
1032
- G as y,
1033
- X as z
650
+ q as B,
651
+ M as C,
652
+ W as D,
653
+ B as E,
654
+ F as I,
655
+ P as M,
656
+ N as T,
657
+ T as V,
658
+ H as a,
659
+ O as b,
660
+ G as c,
661
+ X as d,
662
+ j as e,
663
+ I as f,
664
+ R as g,
665
+ w as h,
666
+ z as i,
667
+ U as j,
668
+ V as k,
669
+ $ as l,
670
+ C as m,
671
+ K as u,
672
+ A as v,
673
+ L as z
1034
674
  };