reactjs-tiptap-editor 0.0.27 → 0.0.28

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,156 @@
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 { m as u } from "./utils-B4dNn5Nv.js";
6
+ import { p as c, u as h } from "./vendor-CCqRdwcC.js";
7
+ const b = "en", f = 200, B = f - 80, w = 20, I = 1e5, z = 16, R = 10, N = 10, U = 2, H = "#262626", 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
+ ], P = [
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
+ ], O = {
90
+ html: "HTML",
91
+ css: "CSS",
92
+ js: "JavaScript",
93
+ ts: "TypeScript"
94
+ }, G = [
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
+ ], j = "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 X = ["100%", "115%", "150%", "200%", "250%", "300%"], q = 1.7, K = "1", $ = {
112
+ image: [
113
+ "divider",
114
+ "image-size-small",
115
+ "image-size-medium",
116
+ "image-size-large",
117
+ "divider",
118
+ "image-left",
119
+ "image-center",
120
+ "image-right",
121
+ "divider",
122
+ "image-aspect-ratio",
123
+ "remove"
124
+ ],
125
+ text: [
126
+ "divider",
127
+ "text-bubble",
128
+ "divider",
129
+ "bold",
130
+ "italic",
131
+ "underline",
132
+ "strike",
133
+ "code",
134
+ "link",
135
+ "divider",
136
+ "color",
137
+ "highlight",
138
+ "textAlign"
139
+ ],
140
+ video: ["video-size-small", "video-size-medium", "video-size-large", "divider", "remove"],
141
+ table: ["removeTable"]
142
+ }, V = [
143
+ "bold",
144
+ "italic",
145
+ "underline",
146
+ "strike",
147
+ "code",
148
+ "link",
149
+ "divider",
150
+ "color",
151
+ "highlight",
152
+ "textAlign"
153
+ ], _ = {
39
154
  "editor.remove": "Remove",
40
155
  "editor.copy": "Copy",
41
156
  "editor.words": "WORDS",
@@ -182,7 +297,7 @@ const K = {
182
297
  "editor.exportPdf.tooltip": "Export PDF",
183
298
  "editor.exportWord.tooltip": "Export Word",
184
299
  "editor.importWrod.tooltip": "Import Word"
185
- }, G = K, V = {
300
+ }, k = _, C = {
186
301
  "editor.remove": "Xóa",
187
302
  "editor.copy": "Sao chép",
188
303
  "editor.words": "TỪ",
@@ -329,7 +444,7 @@ const K = {
329
444
  "editor.exportPdf.tooltip": "Xuất PDF",
330
445
  "editor.exportWord.tooltip": "Xuất Word",
331
446
  "editor.importWrod.tooltip": "Nhập Word"
332
- }, X = V, J = {
447
+ }, A = C, x = {
333
448
  "editor.remove": "移除",
334
449
  "editor.copy": "复制",
335
450
  "editor.words": "字数",
@@ -476,86 +591,38 @@ const K = {
476
591
  "editor.exportPdf.tooltip": "导出 PDF",
477
592
  "editor.exportWord.tooltip": "导出 Word",
478
593
  "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,
594
+ }, L = x, i = {
595
+ lang: b,
529
596
  message: {
530
- en: G,
531
- vi: X,
532
- zh_CN: Q
597
+ en: k,
598
+ vi: A,
599
+ zh_CN: L
533
600
  }
534
601
  };
535
- class Z {
602
+ class E {
536
603
  constructor() {
537
- p(this, "emitter");
538
- this.emitter = Y();
604
+ n(this, "emitter");
605
+ this.emitter = u();
539
606
  }
540
607
  // Getter and setter for current language
541
608
  get lang() {
542
- return g.lang;
609
+ return i.lang;
543
610
  }
544
611
  set lang(t) {
545
612
  if (!this.isLangSupported(t)) {
546
613
  console.warn(
547
- `Can't find the current language "${t}", Using language "${g.lang}" by default`
614
+ `Can't find the current language "${t}", Using language "${i.lang}" by default`
548
615
  );
549
616
  return;
550
617
  }
551
- g.lang = t, this.emitter.emit("lang", t);
618
+ i.lang = t, this.emitter.emit("lang", t);
552
619
  }
553
620
  // Getter and setter for messages
554
621
  get message() {
555
- return g.message;
622
+ return i.message;
556
623
  }
557
624
  set message(t) {
558
- g.message = t;
625
+ i.message = t;
559
626
  }
560
627
  // Load messages for a specific language
561
628
  loadLangMessage(t) {
@@ -585,19 +652,19 @@ class Z {
585
652
  buildLocalesHandler(t) {
586
653
  t || (t = this.lang);
587
654
  const o = this.loadLangMessage(t);
588
- return function(r) {
589
- return o[r] || r;
655
+ return function(a) {
656
+ return o[a] || a;
590
657
  };
591
658
  }
592
659
  }
593
- const f = new Z(), T = P({
594
- lang: g.lang
660
+ const l = new E(), r = c({
661
+ lang: i.lang
595
662
  });
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;
663
+ function J() {
664
+ const e = h(r), t = g(() => l.buildLocalesHandler(e.lang), [e.lang]);
665
+ return m(() => {
666
+ const o = l.registerWatchLang((d) => {
667
+ r.lang = d;
601
668
  });
602
669
  return () => {
603
670
  o.unsubscribe();
@@ -607,428 +674,38 @@ function Re() {
607
674
  t
608
675
  };
609
676
  }
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
- }
677
+ const Y = {
678
+ t: (e) => l.buildLocalesHandler(r.lang)(e)
679
+ }, Q = l;
1005
680
  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
681
+ V as B,
682
+ M as C,
683
+ W as D,
684
+ B as E,
685
+ F as I,
686
+ q as L,
687
+ O as M,
688
+ $ as N,
689
+ N as T,
690
+ T as V,
691
+ P as a,
692
+ G as b,
693
+ j as c,
694
+ K as d,
695
+ X as e,
696
+ I as f,
697
+ z as g,
698
+ w as h,
699
+ R as i,
700
+ U as j,
701
+ Q as k,
702
+ Y as l,
703
+ k as m,
704
+ b as n,
705
+ f as o,
706
+ H as p,
707
+ J as u,
708
+ A as v,
709
+ L as z
1034
710
  };
711
+ //# sourceMappingURL=locales-CReRRAlY.js.map