reactjs-tiptap-editor 1.0.5 → 1.0.6
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/lib/{ActionMenuButton-BS1m0efQ.cjs → ActionMenuButton-DYT5chmX.cjs} +1 -1
- package/lib/{ActionMenuButton-CmYQziyT.js → ActionMenuButton-htJNI0Fa.js} +6 -6
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +1 -1
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +1 -1
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +1 -1
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +1 -1
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +1 -1
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +1 -1
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +2 -2
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +1 -1
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +6 -6
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +1 -1
- package/lib/{Drawer-BCMlTDss.js → Drawer-1211urKj.js} +1 -1
- package/lib/{Drawer-DPVStAKs.cjs → Drawer-DUFUd5BW.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +1 -1
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +1 -1
- package/lib/{Excalidraw-BP-xjF6S.cjs → Excalidraw-CajgZDjU.cjs} +1 -1
- package/lib/{Excalidraw-1dKmqI-3.js → Excalidraw-Du3hBR8t.js} +1 -1
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +1 -1
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +1 -1
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +1 -1
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +1 -1
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +1 -1
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +1 -1
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +6 -6
- package/lib/History.cjs +1 -1
- package/lib/History.js +2 -2
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +1 -1
- package/lib/{Iframe-CeasogsD.cjs → Iframe-CM6mRQmv.cjs} +1 -1
- package/lib/{Iframe-B_GAN9lj.js → Iframe-DTYTLQE6.js} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +1 -1
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +2 -2
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +1 -1
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +1 -1
- package/lib/{Indent-BGmFt7Dc.cjs → Indent-BmhiEb0S.cjs} +1 -1
- package/lib/{Indent-DCTAYr8i.js → Indent-jOPn3eUM.js} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +1 -1
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +1 -1
- package/lib/{Katex-CxEAc1xw.js → Katex-CERSrcTP.js} +1 -1
- package/lib/{Katex-CFZB-dZq.cjs → Katex-CUd3LxLh.cjs} +1 -1
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +1 -1
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +12 -12
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +1 -1
- package/lib/{LinkEditBlock-C8rPUoNH.js → LinkEditBlock-B5SdhOfa.js} +2 -2
- package/lib/{LinkEditBlock-DiSXJpTN.cjs → LinkEditBlock-DaxljgJC.cjs} +1 -1
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +1 -1
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +14 -14
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +1 -1
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +7 -7
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +43 -41
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +1 -1
- package/lib/{Table-B9w1GsCg.js → Table-39OkCQbu.js} +1 -1
- package/lib/{Table-B4s9CpR4.cjs → Table-3VstSlg4.cjs} +1 -1
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +1 -1
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +2 -2
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +2 -2
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +1 -1
- package/lib/{Twitter-B-GTNq1g.js → Twitter-D7PhLycr.js} +18 -18
- package/lib/{Twitter-BVlF0vEs.cjs → Twitter-DuHPeVW1.cjs} +1 -1
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +1 -1
- package/lib/bubble.cjs +4 -4
- package/lib/bubble.js +267 -254
- package/lib/{toggle-Bo07J-M7.cjs → toggle-DVCNvcqp.cjs} +1 -1
- package/lib/{toggle-MUGlaI1L.js → toggle-xchtz-Kf.js} +9 -9
- package/package.json +1 -1
package/lib/bubble.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { jsx as p, Fragment as M, jsxs as S } from "react/jsx-runtime";
|
|
2
2
|
import ms, { useRef as Lt, useEffect as st, useCallback as L, useState as z, useMemo as Pt, Fragment as ti } from "react";
|
|
3
|
-
import { a3 as Yr, f as ws, E as ke, a4 as Gr, a5 as Jr, O as bs, a6 as ve, a7 as qr, U as ei, Q as ys, x as
|
|
3
|
+
import { a3 as Yr, f as ws, E as ke, a4 as Gr, a5 as Jr, O as bs, a6 as ve, a7 as qr, U as ei, Q as ys, x as Ae, F as Oe, T as ni, A as Xr, v as Zr, a8 as Qr, a9 as to } from "./index-nFjllrEl.js";
|
|
4
4
|
import { f as xs, s as Ss, o as ks, a as vs, b as Cs, d as _s, h as Es, i as Ts, c as ii } from "./floating-ui.dom-U1vPFQ5f.js";
|
|
5
5
|
import { Plugin as Ce, PluginKey as te, NodeSelection as eo, TextSelection as no, SelectionRange as io, Selection as so } from "@tiptap/pm/state";
|
|
6
|
-
import { C as ro, T as oo } from "./Table-
|
|
6
|
+
import { C as ro, T as oo } from "./Table-39OkCQbu.js";
|
|
7
7
|
import { createPortal as Ds } from "react-dom";
|
|
8
|
-
import { A as y } from "./toggle-
|
|
8
|
+
import { A as y } from "./toggle-xchtz-Kf.js";
|
|
9
9
|
import { MultipleColumnNode as _i } from "./Column.js";
|
|
10
|
-
import { u as X, p as
|
|
11
|
-
import { c as Y, d as
|
|
10
|
+
import { u as X, p as We, V as Ei } from "./index-0OnGZkVF.js";
|
|
11
|
+
import { c as Y, d as Is } from "./useButtonProps-D0SrPzuG.js";
|
|
12
12
|
import { b as Z } from "./index-DuZCJJSp.js";
|
|
13
13
|
import { d as _e } from "./delete-node-IyVmiRbI.js";
|
|
14
|
-
import { C as lo, D as kn } from "./Drawer-
|
|
14
|
+
import { C as lo, D as kn } from "./Drawer-1211urKj.js";
|
|
15
15
|
import { Editor as co, makeDropdownToolbar as ao } from "easydrawer";
|
|
16
|
-
import { s as
|
|
16
|
+
import { s as As, i as Os } from "./shortId-WJVkrvml.js";
|
|
17
17
|
import { D as on, a as ln, b as cn, c as an, d as hn, e as ho } from "./dialog-Ce9Cjfft.js";
|
|
18
18
|
import { d as Ms } from "./file-BLas99n7.js";
|
|
19
19
|
import { B as Jt } from "./button-Crm67hfl.js";
|
|
20
|
-
import { u as ee, K as
|
|
20
|
+
import { u as ee, K as je } from "./Katex-CERSrcTP.js";
|
|
21
21
|
import { S as Nt } from "./separator-6SnwzytZ.js";
|
|
22
22
|
import { L as vn } from "./label-DC33TZy_.js";
|
|
23
23
|
import { P as uo, a as fo, b as po } from "./popover-CoepUobG.js";
|
|
24
24
|
import { I as Be } from "./input-DfqFAyKo.js";
|
|
25
|
-
import { E as oe, t as go } from "./Excalidraw-
|
|
26
|
-
import { I as le, g as mo } from "./Iframe-
|
|
25
|
+
import { E as oe, t as go } from "./Excalidraw-Du3hBR8t.js";
|
|
26
|
+
import { I as le, g as mo } from "./Iframe-DTYTLQE6.js";
|
|
27
27
|
import wo from "katex";
|
|
28
28
|
import { Pencil as bo, Trash2 as yo } from "lucide-react";
|
|
29
29
|
import { T as Rs } from "./textarea-CIs52G8B.js";
|
|
30
|
-
import { L as Ti, a as xo, R as So } from "./LinkEditBlock-
|
|
30
|
+
import { L as Ti, a as xo, R as So } from "./LinkEditBlock-B5SdhOfa.js";
|
|
31
31
|
import { Image as ko } from "./Image.js";
|
|
32
32
|
import { ImageGif as vo } from "./ImageGif.js";
|
|
33
33
|
import { Video as Co } from "./Video.js";
|
|
@@ -37,17 +37,17 @@ import { RichTextCode as Eo } from "./Code.js";
|
|
|
37
37
|
import "./index-prphFVsp.js";
|
|
38
38
|
import { RichTextColor as To } from "./Color.js";
|
|
39
39
|
import { RichTextHighlight as Do } from "./Highlight.js";
|
|
40
|
-
import { RichTextItalic as
|
|
41
|
-
import { RichTextStrike as
|
|
40
|
+
import { RichTextItalic as Io } from "./Italic.js";
|
|
41
|
+
import { RichTextStrike as Ao } from "./Strike.js";
|
|
42
42
|
import { RichTextAlign as Oo, TextAlign as Mo } from "./TextAlign.js";
|
|
43
43
|
import { RichTextUnderline as Di } from "./TextUnderline.js";
|
|
44
|
-
import { T as
|
|
45
|
-
import { DecorationSet as
|
|
44
|
+
import { T as Ii, F as Ro } from "./Twitter-D7PhLycr.js";
|
|
45
|
+
import { DecorationSet as Ai, Decoration as No } from "@tiptap/pm/view";
|
|
46
46
|
import { NodeRange as Uo } from "@tiptap/pm/model";
|
|
47
|
-
import { I as rt } from "./Icon-C-qYUAS1.js";
|
|
48
47
|
import { Clear as Lo } from "./Clear.js";
|
|
49
|
-
import { I as Po, a as Oi, s as Mi } from "./Indent-
|
|
48
|
+
import { I as Po, a as Oi, s as Mi } from "./Indent-jOPn3eUM.js";
|
|
50
49
|
import { D as Bo, a as Vo, b as Ho, f as mt, d as $o, g as Ri, h as Ni, i as Ui, j as Li } from "./dropdown-menu-CQykJhBs.js";
|
|
50
|
+
import { I as rt } from "./Icon-C-qYUAS1.js";
|
|
51
51
|
function Fo(e, t) {
|
|
52
52
|
const n = Math.min(e.top, t.top), i = Math.max(e.bottom, t.bottom), s = Math.min(e.left, t.left), o = Math.max(e.right, t.right) - s, l = i - n, c = s, a = n;
|
|
53
53
|
return new DOMRect(c, a, o, l);
|
|
@@ -249,7 +249,7 @@ ke.create({
|
|
|
249
249
|
] : [];
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
|
-
var
|
|
252
|
+
var Ko = class {
|
|
253
253
|
constructor({ editor: e, element: t, view: n, options: i, appendTo: s, shouldShow: r }) {
|
|
254
254
|
this.preventHide = !1, this.isVisible = !1, this.shouldShow = ({ view: o, state: l }) => {
|
|
255
255
|
const { selection: c } = l, { $anchor: a, empty: d } = c, h = a.depth === 1, u = a.parent.isTextblock && !a.parent.type.spec.code && !a.parent.textContent && a.parent.childCount === 0 && !this.getTextContent(a.parent);
|
|
@@ -352,7 +352,7 @@ var Wo = class {
|
|
|
352
352
|
}
|
|
353
353
|
}, Us = (e) => new Ce({
|
|
354
354
|
key: typeof e.pluginKey == "string" ? new te(e.pluginKey) : e.pluginKey,
|
|
355
|
-
view: (t) => new
|
|
355
|
+
view: (t) => new Ko({ view: t, ...e })
|
|
356
356
|
});
|
|
357
357
|
ke.create({
|
|
358
358
|
name: "floatingMenu",
|
|
@@ -465,6 +465,7 @@ function zd() {
|
|
|
465
465
|
{
|
|
466
466
|
editor: t,
|
|
467
467
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
468
|
+
pluginKey: "RichTextBubbleColumns",
|
|
468
469
|
shouldShow: i,
|
|
469
470
|
children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
|
|
470
471
|
/* @__PURE__ */ p(
|
|
@@ -503,7 +504,7 @@ function zd() {
|
|
|
503
504
|
}
|
|
504
505
|
) : /* @__PURE__ */ p(M, {});
|
|
505
506
|
}
|
|
506
|
-
function
|
|
507
|
+
function Wo(e, t) {
|
|
507
508
|
const n = ["size-small", "size-medium", "size-large"], i = [
|
|
508
509
|
"SizeS",
|
|
509
510
|
"SizeM",
|
|
@@ -515,12 +516,12 @@ function jo(e, t) {
|
|
|
515
516
|
componentProps: {
|
|
516
517
|
tooltip: t(`editor.${s.replace("-", ".")}.tooltip`),
|
|
517
518
|
icon: i[r],
|
|
518
|
-
action: () => e.commands.updateImage({ width:
|
|
519
|
-
isActive: () => e.isActive("image", { width:
|
|
519
|
+
action: () => e.commands.updateImage({ width: We[s] }),
|
|
520
|
+
isActive: () => e.isActive("image", { width: We[s] })
|
|
520
521
|
}
|
|
521
522
|
}));
|
|
522
523
|
}
|
|
523
|
-
function
|
|
524
|
+
function jo(e, t) {
|
|
524
525
|
const n = ["size-small", "size-medium", "size-large"], i = [
|
|
525
526
|
"SizeS",
|
|
526
527
|
"SizeM",
|
|
@@ -532,8 +533,8 @@ function Ko(e, t) {
|
|
|
532
533
|
componentProps: {
|
|
533
534
|
tooltip: t(`editor.${s.replace("-", ".")}.tooltip`),
|
|
534
535
|
icon: i[r],
|
|
535
|
-
action: () => e.commands.updateImageGif({ width:
|
|
536
|
-
isActive: () => e.isActive("image", { width:
|
|
536
|
+
action: () => e.commands.updateImageGif({ width: We[s] }),
|
|
537
|
+
isActive: () => e.isActive("image", { width: We[s] })
|
|
537
538
|
}
|
|
538
539
|
}));
|
|
539
540
|
}
|
|
@@ -686,7 +687,7 @@ function Qo(e, t) {
|
|
|
686
687
|
}
|
|
687
688
|
}
|
|
688
689
|
},
|
|
689
|
-
...
|
|
690
|
+
...Wo(e, t),
|
|
690
691
|
...Yo(e, t),
|
|
691
692
|
{
|
|
692
693
|
type: "remove",
|
|
@@ -705,7 +706,7 @@ function Qo(e, t) {
|
|
|
705
706
|
}
|
|
706
707
|
function tl(e, t) {
|
|
707
708
|
return [
|
|
708
|
-
...
|
|
709
|
+
...jo(e, t),
|
|
709
710
|
...Go(e, t),
|
|
710
711
|
{
|
|
711
712
|
type: "remove",
|
|
@@ -815,7 +816,7 @@ function sl({ editor: e, attrs: t, extension: n }) {
|
|
|
815
816
|
}, [i]);
|
|
816
817
|
const h = async () => {
|
|
817
818
|
if (r.current) {
|
|
818
|
-
const E = r.current.toSVG(), x = E.outerHTML, k = `drawer-${
|
|
819
|
+
const E = r.current.toSVG(), x = E.outerHTML, k = `drawer-${As()}.svg`;
|
|
819
820
|
let N = Os(E.outerHTML);
|
|
820
821
|
if (a) {
|
|
821
822
|
const H = Ms(N, k);
|
|
@@ -854,7 +855,7 @@ function sl({ editor: e, attrs: t, extension: n }) {
|
|
|
854
855
|
}, D = (E) => {
|
|
855
856
|
const x = r.current.toolController.getPrimaryTools()[5], k = o.current.getWidgetById("shape");
|
|
856
857
|
x && k && (x.setBorderColor(E), k.serializeState());
|
|
857
|
-
},
|
|
858
|
+
}, I = () => {
|
|
858
859
|
if (ce) {
|
|
859
860
|
for (; r.current.history.redoStackSize > 0; )
|
|
860
861
|
r.current.history.redo();
|
|
@@ -896,7 +897,7 @@ function sl({ editor: e, attrs: t, extension: n }) {
|
|
|
896
897
|
onClear: () => {
|
|
897
898
|
if (!ce) {
|
|
898
899
|
for (; r.current.history.undoStackSize > 0; )
|
|
899
|
-
|
|
900
|
+
I();
|
|
900
901
|
ce = !0;
|
|
901
902
|
}
|
|
902
903
|
},
|
|
@@ -904,7 +905,7 @@ function sl({ editor: e, attrs: t, extension: n }) {
|
|
|
904
905
|
ce || r.current.history.redo();
|
|
905
906
|
},
|
|
906
907
|
onThicknessChange: w,
|
|
907
|
-
onUndo:
|
|
908
|
+
onUndo: I,
|
|
908
909
|
refEditor: r,
|
|
909
910
|
setColorHighlight: g,
|
|
910
911
|
setColorPen: u,
|
|
@@ -943,8 +944,8 @@ function rl({ item: e, disabled: t, editor: n }) {
|
|
|
943
944
|
}
|
|
944
945
|
) }) : /* @__PURE__ */ p(M, {});
|
|
945
946
|
}
|
|
946
|
-
function
|
|
947
|
-
const { lang: e, t } = X(), n = Z(), i = Y(), s = ee(i, kn.name), r =
|
|
947
|
+
function Kd() {
|
|
948
|
+
const { lang: e, t } = X(), n = Z(), i = Y(), s = ee(i, kn.name), r = Is(kn.name), o = ({ editor: c }) => {
|
|
948
949
|
const { selection: a } = c.view.state, { $from: d, to: h } = a;
|
|
949
950
|
let u = !1;
|
|
950
951
|
return c.view.state.doc.nodesBetween(d.pos, h, (f) => {
|
|
@@ -957,6 +958,7 @@ function Wd() {
|
|
|
957
958
|
{
|
|
958
959
|
editor: i,
|
|
959
960
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
961
|
+
pluginKey: "RichTextBubbleDrawer",
|
|
960
962
|
shouldShow: o,
|
|
961
963
|
children: l != null && l.length ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: l == null ? void 0 : l.map((c, a) => c.type === "edit" && (s != null && s.src) ? /* @__PURE__ */ p(
|
|
962
964
|
sl,
|
|
@@ -1054,7 +1056,7 @@ function ol(e) {
|
|
|
1054
1056
|
s.disconnect();
|
|
1055
1057
|
}), { width: Mt.get("width") };
|
|
1056
1058
|
}
|
|
1057
|
-
function
|
|
1059
|
+
function Wd() {
|
|
1058
1060
|
const e = Z(), t = Y(), { t: n } = X(), { width: i } = ol(t), s = ee(t, oe.name, {
|
|
1059
1061
|
defaultShowPicker: !1,
|
|
1060
1062
|
createUser: "",
|
|
@@ -1075,6 +1077,7 @@ function jd() {
|
|
|
1075
1077
|
{
|
|
1076
1078
|
editor: t,
|
|
1077
1079
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1080
|
+
pluginKey: "RichTextBubbleExcalidraw",
|
|
1078
1081
|
shouldShow: h,
|
|
1079
1082
|
children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
|
|
1080
1083
|
/* @__PURE__ */ p(
|
|
@@ -1113,7 +1116,7 @@ function jd() {
|
|
|
1113
1116
|
}
|
|
1114
1117
|
) : /* @__PURE__ */ p(M, {});
|
|
1115
1118
|
}
|
|
1116
|
-
function
|
|
1119
|
+
function jd() {
|
|
1117
1120
|
const e = Z(), t = Y(), { t: n } = X(), { width: i, height: s, src: r } = ee(t, le.name, {
|
|
1118
1121
|
width: 0,
|
|
1119
1122
|
height: 0,
|
|
@@ -1127,8 +1130,8 @@ function Kd() {
|
|
|
1127
1130
|
o && a(r);
|
|
1128
1131
|
}, [o, r]);
|
|
1129
1132
|
const h = L((w) => {
|
|
1130
|
-
var
|
|
1131
|
-
(
|
|
1133
|
+
var I;
|
|
1134
|
+
(I = w == null ? void 0 : w.preventDefault) == null || I.call(w);
|
|
1132
1135
|
const D = mo(c);
|
|
1133
1136
|
t.chain().updateAttributes(le.name, {
|
|
1134
1137
|
src: (D == null ? void 0 : D.src) || c
|
|
@@ -1149,6 +1152,7 @@ function Kd() {
|
|
|
1149
1152
|
{
|
|
1150
1153
|
editor: t,
|
|
1151
1154
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1155
|
+
pluginKey: "RichTextBubbleIframe",
|
|
1152
1156
|
shouldShow: m,
|
|
1153
1157
|
children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
|
|
1154
1158
|
/* @__PURE__ */ p(
|
|
@@ -1241,14 +1245,14 @@ function ll({
|
|
|
1241
1245
|
visible: t,
|
|
1242
1246
|
toggleVisible: n
|
|
1243
1247
|
}) {
|
|
1244
|
-
const { t: i } = X(), s = Y(), r = ee(s,
|
|
1248
|
+
const { t: i } = X(), s = Y(), r = ee(s, je.name, {
|
|
1245
1249
|
text: "",
|
|
1246
1250
|
defaultShowPicker: !1
|
|
1247
1251
|
}), { text: o, defaultShowPicker: l } = r, [c, a] = z(o || "");
|
|
1248
1252
|
st(() => {
|
|
1249
1253
|
t && a(o || "");
|
|
1250
1254
|
}, [t]), st(() => {
|
|
1251
|
-
l && (n(!0), s.chain().updateAttributes(
|
|
1255
|
+
l && (n(!0), s.chain().updateAttributes(je.name, { defaultShowPicker: !1 }).focus().run());
|
|
1252
1256
|
}, [s, l, n]);
|
|
1253
1257
|
const d = L(() => {
|
|
1254
1258
|
s.chain().focus().setKatex({ text: c }).run(), a(""), n(!1);
|
|
@@ -1322,12 +1326,13 @@ function ll({
|
|
|
1322
1326
|
);
|
|
1323
1327
|
}
|
|
1324
1328
|
function Yd() {
|
|
1325
|
-
const e = Z(), t = Y(), [n, i] = z(!1), s = L(() => t.isActive(
|
|
1329
|
+
const e = Z(), t = Y(), [n, i] = z(!1), s = L(() => t.isActive(je.name), [t]), r = L(() => _e(je.name, t), [t]);
|
|
1326
1330
|
return e ? /* @__PURE__ */ p(
|
|
1327
1331
|
tt,
|
|
1328
1332
|
{
|
|
1329
1333
|
editor: t,
|
|
1330
1334
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1335
|
+
pluginKey: "RichTextBubbleKatex",
|
|
1331
1336
|
shouldShow: s,
|
|
1332
1337
|
children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
|
|
1333
1338
|
/* @__PURE__ */ p(
|
|
@@ -1422,6 +1427,7 @@ function Gd() {
|
|
|
1422
1427
|
{
|
|
1423
1428
|
editor: t,
|
|
1424
1429
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1430
|
+
pluginKey: "RichTextBubbleLink",
|
|
1425
1431
|
shouldShow: o,
|
|
1426
1432
|
children: /* @__PURE__ */ p(M, { children: n ? /* @__PURE__ */ p(
|
|
1427
1433
|
"div",
|
|
@@ -1496,6 +1502,7 @@ function Jd() {
|
|
|
1496
1502
|
{
|
|
1497
1503
|
editor: i,
|
|
1498
1504
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1505
|
+
pluginKey: "RichTextBubbleImage",
|
|
1499
1506
|
shouldShow: s,
|
|
1500
1507
|
children: r != null && r.length ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: r == null ? void 0 : r.map((o, l) => /* @__PURE__ */ p(
|
|
1501
1508
|
si,
|
|
@@ -1522,6 +1529,7 @@ function qd() {
|
|
|
1522
1529
|
{
|
|
1523
1530
|
editor: i,
|
|
1524
1531
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1532
|
+
pluginKey: "RichTextBubbleImageGif",
|
|
1525
1533
|
shouldShow: s,
|
|
1526
1534
|
children: r != null && r.length ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: r == null ? void 0 : r.map((o, l) => /* @__PURE__ */ p(
|
|
1527
1535
|
si,
|
|
@@ -1548,6 +1556,7 @@ function Xd() {
|
|
|
1548
1556
|
{
|
|
1549
1557
|
editor: n,
|
|
1550
1558
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1559
|
+
pluginKey: "RichTextBubbleVideo",
|
|
1551
1560
|
shouldShow: i,
|
|
1552
1561
|
children: s != null && s.length ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: s == null ? void 0 : s.map((r, o) => /* @__PURE__ */ p(
|
|
1553
1562
|
si,
|
|
@@ -1563,15 +1572,15 @@ function Xd() {
|
|
|
1563
1572
|
const Pi = `graph TB
|
|
1564
1573
|
a-->b`, ul = ({ editor: e, attrs: t, extension: n }) => {
|
|
1565
1574
|
const { alt: i, align: s } = t, [r, o] = z(decodeURIComponent(i ?? Pi)), [l, c] = z(""), [a, d] = z(!1), h = Lt(null), [u, f] = z(null), g = n == null ? void 0 : n.options.upload, m = L(
|
|
1566
|
-
(
|
|
1567
|
-
|
|
1575
|
+
(I) => {
|
|
1576
|
+
I && import("mermaid").then((v) => {
|
|
1568
1577
|
f(v.default);
|
|
1569
1578
|
});
|
|
1570
1579
|
},
|
|
1571
1580
|
[]
|
|
1572
|
-
), b = async (
|
|
1581
|
+
), b = async (I) => {
|
|
1573
1582
|
try {
|
|
1574
|
-
const { svg: v } = await u.render("mermaid-svg",
|
|
1583
|
+
const { svg: v } = await u.render("mermaid-svg", I);
|
|
1575
1584
|
c(v);
|
|
1576
1585
|
} catch {
|
|
1577
1586
|
c("");
|
|
@@ -1617,7 +1626,7 @@ a-->b`, ul = ({ editor: e, attrs: t, extension: n }) => {
|
|
|
1617
1626
|
autoFocus: !0,
|
|
1618
1627
|
className: "richtext-flex-1",
|
|
1619
1628
|
defaultValue: Pi,
|
|
1620
|
-
onChange: (
|
|
1629
|
+
onChange: (I) => o(I.target.value),
|
|
1621
1630
|
placeholder: "Text",
|
|
1622
1631
|
required: !0,
|
|
1623
1632
|
rows: 10,
|
|
@@ -1645,8 +1654,8 @@ a-->b`, ul = ({ editor: e, attrs: t, extension: n }) => {
|
|
|
1645
1654
|
onClick: async () => {
|
|
1646
1655
|
if (r !== "") {
|
|
1647
1656
|
if (r) {
|
|
1648
|
-
const
|
|
1649
|
-
let x = Os(
|
|
1657
|
+
const I = h.current.querySelector("svg"), { width: v, height: P } = I.getBoundingClientRect(), E = `mermaid-${As()}.svg`;
|
|
1658
|
+
let x = Os(I.outerHTML);
|
|
1650
1659
|
if (g) {
|
|
1651
1660
|
const k = Ms(x, E);
|
|
1652
1661
|
x = await g(k);
|
|
@@ -1696,7 +1705,7 @@ function pl(e) {
|
|
|
1696
1705
|
return e.type.name === Un.name;
|
|
1697
1706
|
}
|
|
1698
1707
|
function Zd() {
|
|
1699
|
-
const { lang: e, t } = X(), n = Z(), i = Y(), s = ee(i, Un.name), r =
|
|
1708
|
+
const { lang: e, t } = X(), n = Z(), i = Y(), s = ee(i, Un.name), r = Is(Un.name), o = ({ editor: c }) => {
|
|
1700
1709
|
const { selection: a } = c.view.state, { $from: d, to: h } = a;
|
|
1701
1710
|
let u = !1;
|
|
1702
1711
|
return c.view.state.doc.nodesBetween(d.pos, h, (f) => {
|
|
@@ -1709,6 +1718,7 @@ function Zd() {
|
|
|
1709
1718
|
{
|
|
1710
1719
|
editor: i,
|
|
1711
1720
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1721
|
+
pluginKey: "RichTextBubbleMermaid",
|
|
1712
1722
|
shouldShow: o,
|
|
1713
1723
|
children: l != null && l.length ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: l == null ? void 0 : l.map((c, a) => c.type === "edit" && (s != null && s.src) ? /* @__PURE__ */ p(
|
|
1714
1724
|
ul,
|
|
@@ -1730,8 +1740,8 @@ function Zd() {
|
|
|
1730
1740
|
) : /* @__PURE__ */ p(M, {});
|
|
1731
1741
|
}
|
|
1732
1742
|
function Qd({ hiddenActions: e = [] }) {
|
|
1733
|
-
var m, b, w, D,
|
|
1734
|
-
const { t } = X(), n = Z(), i = Y(), s = ({ editor:
|
|
1743
|
+
var m, b, w, D, I, v, P, E, x, k, N, H, et, At, Ot, _, ft, re;
|
|
1744
|
+
const { t } = X(), n = Z(), i = Y(), s = ({ editor: Kt }) => qr(Kt.view.state, oo.name), r = (Kt) => e.includes(Kt);
|
|
1735
1745
|
function o() {
|
|
1736
1746
|
i.chain().focus().addColumnBefore().run();
|
|
1737
1747
|
}
|
|
@@ -1764,8 +1774,8 @@ function Qd({ hiddenActions: e = [] }) {
|
|
|
1764
1774
|
{
|
|
1765
1775
|
editor: i,
|
|
1766
1776
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1777
|
+
pluginKey: "RichTextBubbleTable",
|
|
1767
1778
|
shouldShow: s,
|
|
1768
|
-
updateDelay: 0,
|
|
1769
1779
|
children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
|
|
1770
1780
|
!r("addColumnBefore") && /* @__PURE__ */ p(
|
|
1771
1781
|
y,
|
|
@@ -1791,7 +1801,7 @@ function Qd({ hiddenActions: e = [] }) {
|
|
|
1791
1801
|
y,
|
|
1792
1802
|
{
|
|
1793
1803
|
action: c,
|
|
1794
|
-
disabled: !((v = i == null ? void 0 : (
|
|
1804
|
+
disabled: !((v = i == null ? void 0 : (I = i.can()).deleteColumn) != null && v.call(I)),
|
|
1795
1805
|
icon: "DeleteColumn",
|
|
1796
1806
|
tooltip: t("editor.table.menu.deleteColumn"),
|
|
1797
1807
|
tooltipOptions: { sideOffset: 15 }
|
|
@@ -1845,7 +1855,7 @@ function Qd({ hiddenActions: e = [] }) {
|
|
|
1845
1855
|
y,
|
|
1846
1856
|
{
|
|
1847
1857
|
action: u,
|
|
1848
|
-
disabled: !((
|
|
1858
|
+
disabled: !((At = (et = i == null ? void 0 : i.can()) == null ? void 0 : et.mergeCells) != null && At.call(et)),
|
|
1849
1859
|
icon: "TableCellsMerge",
|
|
1850
1860
|
tooltip: t("editor.table.menu.mergeCells"),
|
|
1851
1861
|
tooltipOptions: { sideOffset: 15 }
|
|
@@ -1885,10 +1895,10 @@ function Qd({ hiddenActions: e = [] }) {
|
|
|
1885
1895
|
function gl() {
|
|
1886
1896
|
return /* @__PURE__ */ S(M, { children: [
|
|
1887
1897
|
/* @__PURE__ */ p(_o, {}),
|
|
1888
|
-
/* @__PURE__ */ p(
|
|
1898
|
+
/* @__PURE__ */ p(Io, {}),
|
|
1889
1899
|
/* @__PURE__ */ p(Di, {}),
|
|
1890
1900
|
/* @__PURE__ */ p(Di, {}),
|
|
1891
|
-
/* @__PURE__ */ p(
|
|
1901
|
+
/* @__PURE__ */ p(Ao, {}),
|
|
1892
1902
|
/* @__PURE__ */ p(Eo, {}),
|
|
1893
1903
|
/* @__PURE__ */ p(So, {}),
|
|
1894
1904
|
/* @__PURE__ */ p(
|
|
@@ -1913,20 +1923,22 @@ function tu({ buttonBubble: e }) {
|
|
|
1913
1923
|
{
|
|
1914
1924
|
editor: t,
|
|
1915
1925
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1926
|
+
pluginKey: "RichTextBubbleText",
|
|
1916
1927
|
shouldShow: i,
|
|
1917
1928
|
children: e ? /* @__PURE__ */ p(M, { children: e }) : /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: /* @__PURE__ */ p(gl, {}) })
|
|
1918
1929
|
}
|
|
1919
1930
|
) : /* @__PURE__ */ p(M, {});
|
|
1920
1931
|
}
|
|
1921
1932
|
function eu() {
|
|
1922
|
-
const { t: e } = X(), t = Z(), n = Y(), [i, s] = z(!1), r = L(({ editor: c }) => c.isActive(
|
|
1933
|
+
const { t: e } = X(), t = Z(), n = Y(), [i, s] = z(!1), r = L(({ editor: c }) => c.isActive(Ii.name), []), o = (c) => {
|
|
1923
1934
|
n.commands.updateTweet({ src: c }), s(!1);
|
|
1924
|
-
}, l = L(() => _e(
|
|
1935
|
+
}, l = L(() => _e(Ii.name, n), [n]);
|
|
1925
1936
|
return t ? /* @__PURE__ */ p(
|
|
1926
1937
|
tt,
|
|
1927
1938
|
{
|
|
1928
1939
|
editor: n,
|
|
1929
1940
|
options: { placement: "bottom", offset: 8, flip: !0 },
|
|
1941
|
+
pluginKey: "RichTextBubbleTwitter",
|
|
1930
1942
|
shouldShow: r,
|
|
1931
1943
|
children: /* @__PURE__ */ p(M, { children: i ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: /* @__PURE__ */ p(
|
|
1932
1944
|
Ro,
|
|
@@ -2048,7 +2060,7 @@ class Ps {
|
|
|
2048
2060
|
this._observers = ct();
|
|
2049
2061
|
}
|
|
2050
2062
|
}
|
|
2051
|
-
const xt = Math.floor, Ve = Math.abs, qt = (e, t) => e < t ? e : t, Et = (e, t) => e > t ? e : t, Bs = (e) => e !== 0 ? e < 0 : 1 / e < 0, Bi = 1, Vi = 2, _n = 4, En = 8, ue = 32, bt = 64,
|
|
2063
|
+
const xt = Math.floor, Ve = Math.abs, qt = (e, t) => e < t ? e : t, Et = (e, t) => e > t ? e : t, Bs = (e) => e !== 0 ? e < 0 : 1 / e < 0, Bi = 1, Vi = 2, _n = 4, En = 8, ue = 32, bt = 64, j = 128, xl = 1 << 29, dn = 31, Bn = 63, Ut = 127, Sl = 2147483647, Vs = Number.MAX_SAFE_INTEGER, kl = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && xt(e) === e), vl = String.fromCharCode, Cl = (e) => e.toLowerCase(), _l = /^\s*/g, El = (e) => e.replace(_l, ""), Tl = /([A-Z])/g, Hi = (e, t) => El(e.replace(Tl, (n) => `${t}${Cl(n)}`)), Dl = (e) => {
|
|
2052
2064
|
const t = unescape(encodeURIComponent(e)), n = t.length, i = new Uint8Array(n);
|
|
2053
2065
|
for (let s = 0; s < n; s++)
|
|
2054
2066
|
i[s] = /** @type {number} */
|
|
@@ -2057,7 +2069,7 @@ const xt = Math.floor, Ve = Math.abs, qt = (e, t) => e < t ? e : t, Et = (e, t)
|
|
|
2057
2069
|
}, fe = (
|
|
2058
2070
|
/** @type {TextEncoder} */
|
|
2059
2071
|
typeof TextEncoder < "u" ? new TextEncoder() : null
|
|
2060
|
-
),
|
|
2072
|
+
), Il = (e) => fe.encode(e), Al = fe ? Il : Dl;
|
|
2061
2073
|
let he = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
|
|
2062
2074
|
he && he.decode(new Uint8Array()).length === 1 && (he = null);
|
|
2063
2075
|
class Ee {
|
|
@@ -2089,12 +2101,12 @@ const Te = () => new Ee(), Ol = (e) => {
|
|
|
2089
2101
|
e.cpos === n && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(n * 2), e.cpos = 0), e.cbuf[e.cpos++] = t;
|
|
2090
2102
|
}, Vn = $, T = (e, t) => {
|
|
2091
2103
|
for (; t > Ut; )
|
|
2092
|
-
$(e,
|
|
2104
|
+
$(e, j | Ut & t), t = xt(t / 128);
|
|
2093
2105
|
$(e, Ut & t);
|
|
2094
2106
|
}, ri = (e, t) => {
|
|
2095
2107
|
const n = Bs(t);
|
|
2096
|
-
for (n && (t = -t), $(e, (t > Bn ?
|
|
2097
|
-
$(e, (t > Ut ?
|
|
2108
|
+
for (n && (t = -t), $(e, (t > Bn ? j : 0) | (n ? bt : 0) | Bn & t), t = xt(t / 64); t > 0; )
|
|
2109
|
+
$(e, (t > Ut ? j : 0) | Ut & t), t = xt(t / 128);
|
|
2098
2110
|
}, Hn = new Uint8Array(3e4), Nl = Hn.length / 3, Ul = (e, t) => {
|
|
2099
2111
|
if (t.length < Nl) {
|
|
2100
2112
|
const n = fe.encodeInto(t, Hn).written || 0;
|
|
@@ -2102,7 +2114,7 @@ const Te = () => new Ee(), Ol = (e) => {
|
|
|
2102
2114
|
for (let i = 0; i < n; i++)
|
|
2103
2115
|
$(e, Hn[i]);
|
|
2104
2116
|
} else
|
|
2105
|
-
Q(e,
|
|
2117
|
+
Q(e, Al(t));
|
|
2106
2118
|
}, Ll = (e, t) => {
|
|
2107
2119
|
const n = unescape(encodeURIComponent(t)), i = n.length;
|
|
2108
2120
|
T(e, i);
|
|
@@ -2112,7 +2124,7 @@ const Te = () => new Ee(), Ol = (e) => {
|
|
|
2112
2124
|
/** @type {number} */
|
|
2113
2125
|
n.codePointAt(s)
|
|
2114
2126
|
);
|
|
2115
|
-
},
|
|
2127
|
+
}, Wt = fe && /** @type {any} */
|
|
2116
2128
|
fe.encodeInto ? Ul : Ll, un = (e, t) => {
|
|
2117
2129
|
const n = e.cbuf.length, i = e.cpos, s = qt(n - i, t.length), r = t.length - s;
|
|
2118
2130
|
e.cbuf.set(t.subarray(0, s), i), e.cpos += s, r > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(Et(n * 2, r)), e.cbuf.set(t.subarray(s)), e.cpos = r);
|
|
@@ -2128,7 +2140,7 @@ fe.encodeInto ? Ul : Ll, un = (e, t) => {
|
|
|
2128
2140
|
), $i = new DataView(new ArrayBuffer(4)), Hl = (e) => ($i.setFloat32(0, e), $i.getFloat32(0) === e), Xt = (e, t) => {
|
|
2129
2141
|
switch (typeof t) {
|
|
2130
2142
|
case "string":
|
|
2131
|
-
$(e, 119),
|
|
2143
|
+
$(e, 119), Wt(e, t);
|
|
2132
2144
|
break;
|
|
2133
2145
|
case "number":
|
|
2134
2146
|
kl(t) && Ve(t) <= Sl ? ($(e, 125), ri(e, t)) : Hl(t) ? ($(e, 124), Pl(e, t)) : ($(e, 123), Bl(e, t));
|
|
@@ -2151,7 +2163,7 @@ fe.encodeInto ? Ul : Ll, un = (e, t) => {
|
|
|
2151
2163
|
T(e, n.length);
|
|
2152
2164
|
for (let i = 0; i < n.length; i++) {
|
|
2153
2165
|
const s = n[i];
|
|
2154
|
-
|
|
2166
|
+
Wt(e, s), Xt(e, t[s]);
|
|
2155
2167
|
}
|
|
2156
2168
|
}
|
|
2157
2169
|
break;
|
|
@@ -2198,7 +2210,7 @@ class He {
|
|
|
2198
2210
|
return zi(this), lt(this.encoder);
|
|
2199
2211
|
}
|
|
2200
2212
|
}
|
|
2201
|
-
const
|
|
2213
|
+
const Ki = (e) => {
|
|
2202
2214
|
if (e.count > 0) {
|
|
2203
2215
|
const t = e.diff * 2 + (e.count === 1 ? 0 : 1);
|
|
2204
2216
|
ri(e.encoder, t), e.count > 1 && T(e.encoder, e.count - 2);
|
|
@@ -2212,7 +2224,7 @@ class Tn {
|
|
|
2212
2224
|
* @param {number} v
|
|
2213
2225
|
*/
|
|
2214
2226
|
write(t) {
|
|
2215
|
-
this.diff === t - this.s ? (this.s = t, this.count++) : (
|
|
2227
|
+
this.diff === t - this.s ? (this.s = t, this.count++) : (Ki(this), this.count = 1, this.diff = t - this.s, this.s = t);
|
|
2216
2228
|
}
|
|
2217
2229
|
/**
|
|
2218
2230
|
* Flush the encoded state and transform this to a Uint8Array.
|
|
@@ -2220,7 +2232,7 @@ class Tn {
|
|
|
2220
2232
|
* Note that this should only be called once.
|
|
2221
2233
|
*/
|
|
2222
2234
|
toUint8Array() {
|
|
2223
|
-
return
|
|
2235
|
+
return Ki(this), lt(this.encoder);
|
|
2224
2236
|
}
|
|
2225
2237
|
}
|
|
2226
2238
|
class $l {
|
|
@@ -2235,7 +2247,7 @@ class $l {
|
|
|
2235
2247
|
}
|
|
2236
2248
|
toUint8Array() {
|
|
2237
2249
|
const t = new Ee();
|
|
2238
|
-
return this.sarr.push(this.s), this.s = "",
|
|
2250
|
+
return this.sarr.push(this.s), this.s = "", Wt(t, this.sarr.join("")), un(t, this.lensE.toUint8Array()), lt(t);
|
|
2239
2251
|
}
|
|
2240
2252
|
}
|
|
2241
2253
|
const Tt = (e) => new Error(e), at = () => {
|
|
@@ -2259,7 +2271,7 @@ const li = (e) => new fn(e), Fl = (e) => e.pos !== e.arr.length, zl = (e, t) =>
|
|
|
2259
2271
|
const i = e.arr.length;
|
|
2260
2272
|
for (; e.pos < i; ) {
|
|
2261
2273
|
const s = e.arr[e.pos++];
|
|
2262
|
-
if (t = t + (s & Ut) * n, n *= 128, s <
|
|
2274
|
+
if (t = t + (s & Ut) * n, n *= 128, s < j)
|
|
2263
2275
|
return t;
|
|
2264
2276
|
if (t > Vs)
|
|
2265
2277
|
throw $s;
|
|
@@ -2268,17 +2280,17 @@ const li = (e) => new fn(e), Fl = (e) => e.pos !== e.arr.length, zl = (e, t) =>
|
|
|
2268
2280
|
}, ci = (e) => {
|
|
2269
2281
|
let t = e.arr[e.pos++], n = t & Bn, i = 64;
|
|
2270
2282
|
const s = (t & bt) > 0 ? -1 : 1;
|
|
2271
|
-
if ((t &
|
|
2283
|
+
if ((t & j) === 0)
|
|
2272
2284
|
return s * n;
|
|
2273
2285
|
const r = e.arr.length;
|
|
2274
2286
|
for (; e.pos < r; ) {
|
|
2275
|
-
if (t = e.arr[e.pos++], n = n + (t & Ut) * i, i *= 128, t <
|
|
2287
|
+
if (t = e.arr[e.pos++], n = n + (t & Ut) * i, i *= 128, t < j)
|
|
2276
2288
|
return s * n;
|
|
2277
2289
|
if (n > Vs)
|
|
2278
2290
|
throw $s;
|
|
2279
2291
|
}
|
|
2280
2292
|
throw Hs;
|
|
2281
|
-
},
|
|
2293
|
+
}, Kl = (e) => {
|
|
2282
2294
|
let t = R(e);
|
|
2283
2295
|
if (t === 0)
|
|
2284
2296
|
return "";
|
|
@@ -2298,13 +2310,13 @@ const li = (e) => new fn(e), Fl = (e) => e.pos !== e.arr.length, zl = (e, t) =>
|
|
|
2298
2310
|
}
|
|
2299
2311
|
return decodeURIComponent(escape(n));
|
|
2300
2312
|
}
|
|
2301
|
-
},
|
|
2313
|
+
}, Wl = (e) => (
|
|
2302
2314
|
/** @type any */
|
|
2303
2315
|
he.decode(nt(e))
|
|
2304
|
-
), $n = he ?
|
|
2316
|
+
), $n = he ? Wl : Kl, ai = (e, t) => {
|
|
2305
2317
|
const n = new DataView(e.arr.buffer, e.arr.byteOffset + e.pos, t);
|
|
2306
2318
|
return e.pos += t, n;
|
|
2307
|
-
},
|
|
2319
|
+
}, jl = (e) => ai(e, 4).getFloat32(0, !1), Yl = (e) => ai(e, 8).getFloat64(0, !1), Gl = (e) => (
|
|
2308
2320
|
/** @type {any} */
|
|
2309
2321
|
ai(e, 8).getBigInt64(0, !1)
|
|
2310
2322
|
), Jl = [
|
|
@@ -2315,7 +2327,7 @@ const li = (e) => new fn(e), Fl = (e) => e.pos !== e.arr.length, zl = (e, t) =>
|
|
|
2315
2327
|
// CASE 126: null
|
|
2316
2328
|
ci,
|
|
2317
2329
|
// CASE 125: integer
|
|
2318
|
-
|
|
2330
|
+
jl,
|
|
2319
2331
|
// CASE 124: float32
|
|
2320
2332
|
Yl,
|
|
2321
2333
|
// CASE 123: float64
|
|
@@ -2344,7 +2356,7 @@ const li = (e) => new fn(e), Fl = (e) => e.pos !== e.arr.length, zl = (e, t) =>
|
|
|
2344
2356
|
nt
|
|
2345
2357
|
// CASE 116: Uint8Array
|
|
2346
2358
|
], Ye = (e) => Jl[127 - pe(e)](e);
|
|
2347
|
-
class
|
|
2359
|
+
class Wi extends fn {
|
|
2348
2360
|
/**
|
|
2349
2361
|
* @param {Uint8Array} uint8Array
|
|
2350
2362
|
* @param {function(Decoder):T} reader
|
|
@@ -2411,7 +2423,7 @@ const Xl = crypto.getRandomValues.bind(crypto), Zl = Math.random, Fs = () => Xl(
|
|
|
2411
2423
|
/[018]/g,
|
|
2412
2424
|
/** @param {number} c */
|
|
2413
2425
|
(e) => (e ^ Fs() & 15 >> e / 4).toString(16)
|
|
2414
|
-
), nc = Date.now,
|
|
2426
|
+
), nc = Date.now, ji = (e) => (
|
|
2415
2427
|
/** @type {Promise<T>} */
|
|
2416
2428
|
new Promise(e)
|
|
2417
2429
|
);
|
|
@@ -2440,22 +2452,22 @@ try {
|
|
|
2440
2452
|
typeof localStorage < "u" && localStorage && (zs = localStorage, sc = !1);
|
|
2441
2453
|
} catch {
|
|
2442
2454
|
}
|
|
2443
|
-
const rc = zs, oc = Object.assign,
|
|
2455
|
+
const rc = zs, oc = Object.assign, Ks = Object.keys, lc = (e, t) => {
|
|
2444
2456
|
for (const n in e)
|
|
2445
2457
|
t(e[n], n);
|
|
2446
|
-
}, Gi = (e) =>
|
|
2458
|
+
}, Gi = (e) => Ks(e).length, cc = (e) => {
|
|
2447
2459
|
for (const t in e)
|
|
2448
2460
|
return !1;
|
|
2449
2461
|
return !0;
|
|
2450
|
-
},
|
|
2462
|
+
}, Ws = (e, t) => {
|
|
2451
2463
|
for (const n in e)
|
|
2452
2464
|
if (!t(e[n], n))
|
|
2453
2465
|
return !1;
|
|
2454
2466
|
return !0;
|
|
2455
|
-
}, ac = (e, t) => Object.prototype.hasOwnProperty.call(e, t), hc = (e, t) => e === t || Gi(e) === Gi(t) &&
|
|
2467
|
+
}, ac = (e, t) => Object.prototype.hasOwnProperty.call(e, t), hc = (e, t) => e === t || Gi(e) === Gi(t) && Ws(e, (n, i) => (n !== void 0 || ac(t, i)) && t[i] === n), dc = Object.freeze, js = (e) => {
|
|
2456
2468
|
for (const t in e) {
|
|
2457
2469
|
const n = e[t];
|
|
2458
|
-
(typeof n == "object" || typeof n == "function") &&
|
|
2470
|
+
(typeof n == "object" || typeof n == "function") && js(e[t]);
|
|
2459
2471
|
}
|
|
2460
2472
|
return dc(e);
|
|
2461
2473
|
}, hi = (e, t, n = 0) => {
|
|
@@ -2518,7 +2530,7 @@ const kc = (e) => ml(e, (t, n) => `${n}:${t};`).join(""), vc = (e) => class {
|
|
|
2518
2530
|
destroy() {
|
|
2519
2531
|
e(this._);
|
|
2520
2532
|
}
|
|
2521
|
-
}, Cc = vc(clearTimeout), Js = (e, t) => new Cc(setTimeout(t, e)), kt = Symbol, qs = kt(), Xs = kt(), _c = kt(), Ec = kt(), Tc = kt(), Zs = kt(), Dc = kt(), di = kt(),
|
|
2533
|
+
}, Cc = vc(clearTimeout), Js = (e, t) => new Cc(setTimeout(t, e)), kt = Symbol, qs = kt(), Xs = kt(), _c = kt(), Ec = kt(), Tc = kt(), Zs = kt(), Dc = kt(), di = kt(), Ic = kt(), Ac = (e) => {
|
|
2522
2534
|
var s;
|
|
2523
2535
|
e.length === 1 && ((s = e[0]) == null ? void 0 : s.constructor) === Function && (e = /** @type {Array<string|Symbol|Object|number>} */
|
|
2524
2536
|
/** @type {[function]} */
|
|
@@ -2549,7 +2561,7 @@ const kc = (e) => ml(e, (t, n) => `${n}:${t};`).join(""), vc = (e) => class {
|
|
|
2549
2561
|
[Dc]: wt("color", "purple"),
|
|
2550
2562
|
[di]: wt("color", "orange"),
|
|
2551
2563
|
// not well supported in chrome when debugging node with inspector - TODO: deprecate
|
|
2552
|
-
[
|
|
2564
|
+
[Ic]: wt("color", "black")
|
|
2553
2565
|
}, Mc = (e) => {
|
|
2554
2566
|
var o;
|
|
2555
2567
|
e.length === 1 && ((o = e[0]) == null ? void 0 : o.constructor) === Function && (e = /** @type {Array<string|Symbol|Object|number>} */
|
|
@@ -2576,7 +2588,7 @@ const kc = (e) => ml(e, (t, n) => `${n}:${t};`).join(""), vc = (e) => class {
|
|
|
2576
2588
|
l instanceof Symbol || s.push(l);
|
|
2577
2589
|
}
|
|
2578
2590
|
return s;
|
|
2579
|
-
}, Qs = gc ? Mc :
|
|
2591
|
+
}, Qs = gc ? Mc : Ac, Rc = (...e) => {
|
|
2580
2592
|
console.log(...Qs(e)), er.forEach((t) => t.print(e));
|
|
2581
2593
|
}, tr = (...e) => {
|
|
2582
2594
|
console.warn(...Qs(e)), e.unshift(di), er.forEach((t) => t.print(e));
|
|
@@ -2595,7 +2607,7 @@ const kc = (e) => ml(e, (t, n) => `${n}:${t};`).join(""), vc = (e) => class {
|
|
|
2595
2607
|
n = e.next();
|
|
2596
2608
|
while (!n.done && !t(n.value));
|
|
2597
2609
|
return n;
|
|
2598
|
-
}),
|
|
2610
|
+
}), In = (e, t) => nr(() => {
|
|
2599
2611
|
const { done: n, value: i } = e.next();
|
|
2600
2612
|
return { done: n, value: n ? void 0 : t(i) };
|
|
2601
2613
|
});
|
|
@@ -2734,12 +2746,12 @@ class Ft extends Ps {
|
|
|
2734
2746
|
* @param {DocOpts} opts configuration
|
|
2735
2747
|
*/
|
|
2736
2748
|
constructor({ guid: t = ec(), collectionid: n = null, gc: i = !0, gcFilter: s = () => !0, meta: r = null, autoLoad: o = !1, shouldLoad: l = !0 } = {}) {
|
|
2737
|
-
super(), this.gc = i, this.gcFilter = s, this.clientID = sr(), this.guid = t, this.collectionid = n, this.share = /* @__PURE__ */ new Map(), this.store = new cr(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = l, this.autoLoad = o, this.meta = r, this.isLoaded = !1, this.isSynced = !1, this.isDestroyed = !1, this.whenLoaded =
|
|
2749
|
+
super(), this.gc = i, this.gcFilter = s, this.clientID = sr(), this.guid = t, this.collectionid = n, this.share = /* @__PURE__ */ new Map(), this.store = new cr(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = l, this.autoLoad = o, this.meta = r, this.isLoaded = !1, this.isSynced = !1, this.isDestroyed = !1, this.whenLoaded = ji((a) => {
|
|
2738
2750
|
this.on("load", () => {
|
|
2739
2751
|
this.isLoaded = !0, a(this);
|
|
2740
2752
|
});
|
|
2741
2753
|
});
|
|
2742
|
-
const c = () =>
|
|
2754
|
+
const c = () => ji((a) => {
|
|
2743
2755
|
const d = (h) => {
|
|
2744
2756
|
(h === void 0 || h === !0) && (this.off("sync", d), a());
|
|
2745
2757
|
};
|
|
@@ -2866,7 +2878,7 @@ class Ft extends Ps {
|
|
|
2866
2878
|
* @public
|
|
2867
2879
|
*/
|
|
2868
2880
|
getText(t = "") {
|
|
2869
|
-
return this.get(t,
|
|
2881
|
+
return this.get(t, It);
|
|
2870
2882
|
}
|
|
2871
2883
|
/**
|
|
2872
2884
|
* @template T
|
|
@@ -2890,7 +2902,7 @@ class Ft extends Ps {
|
|
|
2890
2902
|
getXmlElement(t = "") {
|
|
2891
2903
|
return (
|
|
2892
2904
|
/** @type {YXmlElement<{[key:string]:string}>} */
|
|
2893
|
-
this.get(t,
|
|
2905
|
+
this.get(t, K)
|
|
2894
2906
|
);
|
|
2895
2907
|
}
|
|
2896
2908
|
/**
|
|
@@ -2971,19 +2983,19 @@ class Je extends Bc {
|
|
|
2971
2983
|
* @param {decoding.Decoder} decoder
|
|
2972
2984
|
*/
|
|
2973
2985
|
constructor(t) {
|
|
2974
|
-
super(t), this.keys = [], R(t), this.keyClockDecoder = new Dn(nt(t)), this.clientDecoder = new $e(nt(t)), this.leftClockDecoder = new Dn(nt(t)), this.rightClockDecoder = new Dn(nt(t)), this.infoDecoder = new
|
|
2986
|
+
super(t), this.keys = [], R(t), this.keyClockDecoder = new Dn(nt(t)), this.clientDecoder = new $e(nt(t)), this.leftClockDecoder = new Dn(nt(t)), this.rightClockDecoder = new Dn(nt(t)), this.infoDecoder = new Wi(nt(t), pe), this.stringDecoder = new ql(nt(t)), this.parentInfoDecoder = new Wi(nt(t), pe), this.typeRefDecoder = new $e(nt(t)), this.lenDecoder = new $e(nt(t));
|
|
2975
2987
|
}
|
|
2976
2988
|
/**
|
|
2977
2989
|
* @return {ID}
|
|
2978
2990
|
*/
|
|
2979
2991
|
readLeftID() {
|
|
2980
|
-
return new
|
|
2992
|
+
return new jt(this.clientDecoder.read(), this.leftClockDecoder.read());
|
|
2981
2993
|
}
|
|
2982
2994
|
/**
|
|
2983
2995
|
* @return {ID}
|
|
2984
2996
|
*/
|
|
2985
2997
|
readRightID() {
|
|
2986
|
-
return new
|
|
2998
|
+
return new jt(this.clientDecoder.read(), this.rightClockDecoder.read());
|
|
2987
2999
|
}
|
|
2988
3000
|
/**
|
|
2989
3001
|
* Read the next client id.
|
|
@@ -3114,7 +3126,7 @@ class Hc extends Vc {
|
|
|
3114
3126
|
* @param {string} s
|
|
3115
3127
|
*/
|
|
3116
3128
|
writeString(t) {
|
|
3117
|
-
|
|
3129
|
+
Wt(this.restEncoder, t);
|
|
3118
3130
|
}
|
|
3119
3131
|
/**
|
|
3120
3132
|
* @param {boolean} isYKey
|
|
@@ -3152,13 +3164,13 @@ class Hc extends Vc {
|
|
|
3152
3164
|
* @param {any} embed
|
|
3153
3165
|
*/
|
|
3154
3166
|
writeJSON(t) {
|
|
3155
|
-
|
|
3167
|
+
Wt(this.restEncoder, JSON.stringify(t));
|
|
3156
3168
|
}
|
|
3157
3169
|
/**
|
|
3158
3170
|
* @param {string} key
|
|
3159
3171
|
*/
|
|
3160
3172
|
writeKey(t) {
|
|
3161
|
-
|
|
3173
|
+
Wt(this.restEncoder, t);
|
|
3162
3174
|
}
|
|
3163
3175
|
}
|
|
3164
3176
|
class $c {
|
|
@@ -3321,11 +3333,11 @@ const Fc = (e, t, n, i) => {
|
|
|
3321
3333
|
break;
|
|
3322
3334
|
}
|
|
3323
3335
|
default: {
|
|
3324
|
-
const h = (d & (bt |
|
|
3336
|
+
const h = (d & (bt | j)) === 0, u = new A(
|
|
3325
3337
|
C(l, c),
|
|
3326
3338
|
null,
|
|
3327
3339
|
// left
|
|
3328
|
-
(d &
|
|
3340
|
+
(d & j) === j ? e.readLeftID() : null,
|
|
3329
3341
|
// origin
|
|
3330
3342
|
null,
|
|
3331
3343
|
// right
|
|
@@ -3344,7 +3356,7 @@ const Fc = (e, t, n, i) => {
|
|
|
3344
3356
|
}
|
|
3345
3357
|
}
|
|
3346
3358
|
return n;
|
|
3347
|
-
},
|
|
3359
|
+
}, Kc = (e, t, n) => {
|
|
3348
3360
|
const i = [];
|
|
3349
3361
|
let s = Vt(n.keys()).sort((f, g) => f - g);
|
|
3350
3362
|
if (s.length === 0)
|
|
@@ -3429,10 +3441,10 @@ const Fc = (e, t, n, i) => {
|
|
|
3429
3441
|
return rr(f, l, /* @__PURE__ */ new Map()), T(f.restEncoder, 0), { missing: c, update: f.toUint8Array() };
|
|
3430
3442
|
}
|
|
3431
3443
|
return null;
|
|
3432
|
-
},
|
|
3444
|
+
}, Wc = (e, t) => rr(e, t.doc.store, t.beforeState), jc = (e, t, n, i = new Je(e)) => O(t, (s) => {
|
|
3433
3445
|
s.local = !1;
|
|
3434
3446
|
let r = !1;
|
|
3435
|
-
const o = s.doc, l = o.store, c = zc(i, o), a =
|
|
3447
|
+
const o = s.doc, l = o.store, c = zc(i, o), a = Kc(s, l, c), d = l.pendingStructs;
|
|
3436
3448
|
if (d) {
|
|
3437
3449
|
for (const [u, f] of d.missing)
|
|
3438
3450
|
if (f < B(l, u)) {
|
|
@@ -3461,11 +3473,11 @@ const Fc = (e, t, n, i) => {
|
|
|
3461
3473
|
/** @type {{update: Uint8Array}} */
|
|
3462
3474
|
l.pendingStructs.update
|
|
3463
3475
|
);
|
|
3464
|
-
l.pendingStructs = null,
|
|
3476
|
+
l.pendingStructs = null, Kn(s.doc, u);
|
|
3465
3477
|
}
|
|
3466
|
-
}, n, !1),
|
|
3478
|
+
}, n, !1), Kn = (e, t, n, i = Je) => {
|
|
3467
3479
|
const s = li(t);
|
|
3468
|
-
|
|
3480
|
+
jc(s, e, n, new i(s));
|
|
3469
3481
|
};
|
|
3470
3482
|
class Yc {
|
|
3471
3483
|
constructor() {
|
|
@@ -3476,7 +3488,7 @@ const qi = () => new Yc(), Xi = (e, t) => e.l.push(t), Zi = (e, t) => {
|
|
|
3476
3488
|
const n = e.l, i = n.length;
|
|
3477
3489
|
e.l = n.filter((s) => t !== s), i === e.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
|
|
3478
3490
|
}, or = (e, t, n) => hi(e.l, [t, n]);
|
|
3479
|
-
class
|
|
3491
|
+
class jt {
|
|
3480
3492
|
/**
|
|
3481
3493
|
* @param {number} client client id
|
|
3482
3494
|
* @param {number} clock unique per client id, continuous number
|
|
@@ -3485,7 +3497,7 @@ class Kt {
|
|
|
3485
3497
|
this.client = t, this.clock = n;
|
|
3486
3498
|
}
|
|
3487
3499
|
}
|
|
3488
|
-
const Me = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, C = (e, t) => new
|
|
3500
|
+
const Me = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, C = (e, t) => new jt(e, t), me = (e) => {
|
|
3489
3501
|
for (const [t, n] of e.doc.share.entries())
|
|
3490
3502
|
if (n === e)
|
|
3491
3503
|
return t;
|
|
@@ -3523,7 +3535,7 @@ class Gc {
|
|
|
3523
3535
|
const Jc = (e, t, n = 0) => new Gc(e, t, n), Re = (e, t, n) => {
|
|
3524
3536
|
let i = null, s = null;
|
|
3525
3537
|
return e._item === null ? s = me(e) : i = C(e._item.id.client, e._item.id.clock), new qe(i, s, t, n);
|
|
3526
|
-
},
|
|
3538
|
+
}, An = (e, t, n = 0) => {
|
|
3527
3539
|
let i = e._start;
|
|
3528
3540
|
if (n < 0) {
|
|
3529
3541
|
if (t === 0)
|
|
@@ -3554,7 +3566,7 @@ const Jc = (e, t, n = 0) => new Gc(e, t, n), Re = (e, t, n) => {
|
|
|
3554
3566
|
if (B(i, s.client) <= s.clock)
|
|
3555
3567
|
return null;
|
|
3556
3568
|
const d = n ? Gn(i, s) : qc(i, s), h = d.item;
|
|
3557
|
-
if (!(h instanceof
|
|
3569
|
+
if (!(h instanceof A))
|
|
3558
3570
|
return null;
|
|
3559
3571
|
if (c = /** @type {AbstractType<any>} */
|
|
3560
3572
|
h.parent, c._item === null || !c._item.deleted) {
|
|
@@ -3570,7 +3582,7 @@ const Jc = (e, t, n = 0) => new Gc(e, t, n), Re = (e, t, n) => {
|
|
|
3570
3582
|
if (B(i, r.client) <= r.clock)
|
|
3571
3583
|
return null;
|
|
3572
3584
|
const { item: d } = n ? Gn(i, r) : { item: Yt(i, r) };
|
|
3573
|
-
if (d instanceof
|
|
3585
|
+
if (d instanceof A && d.content instanceof ut)
|
|
3574
3586
|
c = d.content.type;
|
|
3575
3587
|
else
|
|
3576
3588
|
return null;
|
|
@@ -3589,8 +3601,8 @@ class gi {
|
|
|
3589
3601
|
this.ds = t, this.sv = n;
|
|
3590
3602
|
}
|
|
3591
3603
|
}
|
|
3592
|
-
const lr = (e, t) => new gi(e, t), On = (e) => lr(Lc(e.store), gn(e.store)), Rt = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !ie(t.ds, e.id),
|
|
3593
|
-
const n = St(e.meta,
|
|
3604
|
+
const lr = (e, t) => new gi(e, t), On = (e) => lr(Lc(e.store), gn(e.store)), Rt = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !ie(t.ds, e.id), Wn = (e, t) => {
|
|
3605
|
+
const n = St(e.meta, Wn, Bt), i = e.doc.store;
|
|
3594
3606
|
n.has(t) || (t.sv.forEach((s, r) => {
|
|
3595
3607
|
s < B(i, r) && G(e, C(r, s));
|
|
3596
3608
|
}), Dt(e, t.ds, (s) => {
|
|
@@ -3644,15 +3656,15 @@ const gn = (e) => {
|
|
|
3644
3656
|
}, Yt = (
|
|
3645
3657
|
/** @type {function(StructStore,ID):Item} */
|
|
3646
3658
|
Zc
|
|
3647
|
-
),
|
|
3659
|
+
), jn = (e, t, n) => {
|
|
3648
3660
|
const i = ht(t, n), s = t[i];
|
|
3649
|
-
return s.id.clock < n && s instanceof
|
|
3661
|
+
return s.id.clock < n && s instanceof A ? (t.splice(i + 1, 0, en(e, s, n - s.id.clock)), i + 1) : i;
|
|
3650
3662
|
}, G = (e, t) => {
|
|
3651
3663
|
const n = (
|
|
3652
3664
|
/** @type {Array<Item>} */
|
|
3653
3665
|
e.doc.store.clients.get(t.client)
|
|
3654
3666
|
);
|
|
3655
|
-
return n[
|
|
3667
|
+
return n[jn(e, n, t.clock)];
|
|
3656
3668
|
}, Qi = (e, t, n) => {
|
|
3657
3669
|
const i = t.clients.get(n.client), s = ht(i, n.clock), r = i[s];
|
|
3658
3670
|
return n.clock !== r.id.clock + r.length - 1 && r.constructor !== it && i.splice(s + 1, 0, en(e, r, n.clock - r.id.clock + 1)), r;
|
|
@@ -3666,9 +3678,9 @@ const gn = (e) => {
|
|
|
3666
3678
|
if (i === 0)
|
|
3667
3679
|
return;
|
|
3668
3680
|
const r = n + i;
|
|
3669
|
-
let o =
|
|
3681
|
+
let o = jn(e, t, n), l;
|
|
3670
3682
|
do
|
|
3671
|
-
l = t[o++], r < l.id.clock + l.length &&
|
|
3683
|
+
l = t[o++], r < l.id.clock + l.length && jn(e, t, r), s(l);
|
|
3672
3684
|
while (o < t.length && t[o].id.clock < r);
|
|
3673
3685
|
};
|
|
3674
3686
|
class ta {
|
|
@@ -3681,14 +3693,14 @@ class ta {
|
|
|
3681
3693
|
this.doc = t, this.deleteSet = new ne(), this.beforeState = gn(t.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = n, this.meta = /* @__PURE__ */ new Map(), this.local = i, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1;
|
|
3682
3694
|
}
|
|
3683
3695
|
}
|
|
3684
|
-
const ts = (e, t) => t.deleteSet.clients.size === 0 && !wl(t.afterState, (n, i) => t.beforeState.get(i) !== n) ? !1 : (fi(t.deleteSet),
|
|
3696
|
+
const ts = (e, t) => t.deleteSet.clients.size === 0 && !wl(t.afterState, (n, i) => t.beforeState.get(i) !== n) ? !1 : (fi(t.deleteSet), Wc(e, t), pi(e, t.deleteSet), !0), es = (e, t, n) => {
|
|
3685
3697
|
const i = t._item;
|
|
3686
3698
|
(i === null || i.id.clock < (e.beforeState.get(i.id.client) || 0) && !i.deleted) && St(e.changed, t, Bt).add(n);
|
|
3687
3699
|
}, Fe = (e, t) => {
|
|
3688
3700
|
let n = e[t], i = e[t - 1], s = t;
|
|
3689
3701
|
for (; s > 0; n = i, i = e[--s - 1]) {
|
|
3690
3702
|
if (i.deleted === n.deleted && i.constructor === n.constructor && i.mergeWith(n)) {
|
|
3691
|
-
n instanceof
|
|
3703
|
+
n instanceof A && n.parentSub !== null && /** @type {AbstractType<any>} */
|
|
3692
3704
|
n.parent._map.get(n.parentSub) === n && n.parent._map.set(
|
|
3693
3705
|
n.parentSub,
|
|
3694
3706
|
/** @type {Item} */
|
|
@@ -3712,7 +3724,7 @@ const ts = (e, t) => t.deleteSet.clients.size === 0 && !wl(t.afterState, (n, i)
|
|
|
3712
3724
|
const h = r[a];
|
|
3713
3725
|
if (l.clock + l.len <= h.id.clock)
|
|
3714
3726
|
break;
|
|
3715
|
-
h instanceof
|
|
3727
|
+
h instanceof A && h.deleted && !h.keep && n(h) && h.gc(t, !1);
|
|
3716
3728
|
}
|
|
3717
3729
|
}
|
|
3718
3730
|
}
|
|
@@ -3805,7 +3817,7 @@ class ia {
|
|
|
3805
3817
|
}
|
|
3806
3818
|
const ns = (e, t, n) => {
|
|
3807
3819
|
Dt(e, n.deletions, (i) => {
|
|
3808
|
-
i instanceof
|
|
3820
|
+
i instanceof A && t.scope.some((s) => s === e.doc || we(
|
|
3809
3821
|
/** @type {AbstractType<any>} */
|
|
3810
3822
|
s,
|
|
3811
3823
|
i
|
|
@@ -3822,7 +3834,7 @@ const ns = (e, t, n) => {
|
|
|
3822
3834
|
), d = /* @__PURE__ */ new Set(), h = [];
|
|
3823
3835
|
let u = !1;
|
|
3824
3836
|
Dt(l, a.insertions, (f) => {
|
|
3825
|
-
if (f instanceof
|
|
3837
|
+
if (f instanceof A) {
|
|
3826
3838
|
if (f.redone !== null) {
|
|
3827
3839
|
let { item: g, diff: m } = Gn(c, f.id);
|
|
3828
3840
|
m > 0 && (g = G(l, C(g.id.client, g.id.clock + m))), f = g;
|
|
@@ -3835,7 +3847,7 @@ const ns = (e, t, n) => {
|
|
|
3835
3847
|
)) && h.push(f);
|
|
3836
3848
|
}
|
|
3837
3849
|
}), Dt(l, a.deletions, (f) => {
|
|
3838
|
-
f instanceof
|
|
3850
|
+
f instanceof A && r.some((g) => g === l.doc || we(
|
|
3839
3851
|
/** @type {AbstractType<any>} */
|
|
3840
3852
|
g,
|
|
3841
3853
|
f
|
|
@@ -3887,8 +3899,8 @@ class ur extends Ps {
|
|
|
3887
3899
|
a ? this.stopCapturing() : d || this.clear(!1, !0);
|
|
3888
3900
|
const u = new ne();
|
|
3889
3901
|
c.afterState.forEach((b, w) => {
|
|
3890
|
-
const D = c.beforeState.get(w) || 0,
|
|
3891
|
-
|
|
3902
|
+
const D = c.beforeState.get(w) || 0, I = b - D;
|
|
3903
|
+
I > 0 && ge(u, w, D, I);
|
|
3892
3904
|
});
|
|
3893
3905
|
const f = nc();
|
|
3894
3906
|
let g = !1;
|
|
@@ -3902,7 +3914,7 @@ class ur extends Ps {
|
|
|
3902
3914
|
c.deleteSet,
|
|
3903
3915
|
/** @param {Item|GC} item */
|
|
3904
3916
|
(b) => {
|
|
3905
|
-
b instanceof
|
|
3917
|
+
b instanceof A && this.scope.some((w) => w === c.doc || we(
|
|
3906
3918
|
/** @type {AbstractType<any>} */
|
|
3907
3919
|
w,
|
|
3908
3920
|
b
|
|
@@ -4027,11 +4039,11 @@ function* sa(e) {
|
|
|
4027
4039
|
const c = R(e.restDecoder);
|
|
4028
4040
|
yield new ot(C(s, r), c), r += c;
|
|
4029
4041
|
} else if ((dn & l) !== 0) {
|
|
4030
|
-
const c = (l & (bt |
|
|
4042
|
+
const c = (l & (bt | j)) === 0, a = new A(
|
|
4031
4043
|
C(s, r),
|
|
4032
4044
|
null,
|
|
4033
4045
|
// left
|
|
4034
|
-
(l &
|
|
4046
|
+
(l & j) === j ? e.readLeftID() : null,
|
|
4035
4047
|
// origin
|
|
4036
4048
|
null,
|
|
4037
4049
|
// right
|
|
@@ -4091,7 +4103,7 @@ const la = (e, t) => {
|
|
|
4091
4103
|
/** @type {Item} */
|
|
4092
4104
|
e
|
|
4093
4105
|
), { client: i, clock: s } = n.id;
|
|
4094
|
-
return new
|
|
4106
|
+
return new A(
|
|
4095
4107
|
C(i, s + t),
|
|
4096
4108
|
null,
|
|
4097
4109
|
C(i, s + t - 1),
|
|
@@ -4326,7 +4338,7 @@ const aa = (e, t) => {
|
|
|
4326
4338
|
t._item.parent;
|
|
4327
4339
|
}
|
|
4328
4340
|
return n;
|
|
4329
|
-
},
|
|
4341
|
+
}, W = () => {
|
|
4330
4342
|
tr("Invalid access: Add Yjs type to a document before reading data.");
|
|
4331
4343
|
}, pr = 80;
|
|
4332
4344
|
let mi = 0;
|
|
@@ -4498,7 +4510,7 @@ class F {
|
|
|
4498
4510
|
}
|
|
4499
4511
|
}
|
|
4500
4512
|
const mr = (e, t, n) => {
|
|
4501
|
-
e.doc ??
|
|
4513
|
+
e.doc ?? W(), t < 0 && (t = e._length + t), n < 0 && (n = e._length + n);
|
|
4502
4514
|
let i = n - t;
|
|
4503
4515
|
const s = [];
|
|
4504
4516
|
let r = e._start;
|
|
@@ -4517,7 +4529,7 @@ const mr = (e, t, n) => {
|
|
|
4517
4529
|
}
|
|
4518
4530
|
return s;
|
|
4519
4531
|
}, wr = (e) => {
|
|
4520
|
-
e.doc ??
|
|
4532
|
+
e.doc ?? W();
|
|
4521
4533
|
const t = [];
|
|
4522
4534
|
let n = e._start;
|
|
4523
4535
|
for (; n !== null; ) {
|
|
@@ -4543,7 +4555,7 @@ const mr = (e, t, n) => {
|
|
|
4543
4555
|
return n;
|
|
4544
4556
|
}, ye = (e, t) => {
|
|
4545
4557
|
let n = 0, i = e._start;
|
|
4546
|
-
for (e.doc ??
|
|
4558
|
+
for (e.doc ?? W(); i !== null; ) {
|
|
4547
4559
|
if (i.countable && !i.deleted) {
|
|
4548
4560
|
const s = i.content.getContent();
|
|
4549
4561
|
for (let r = 0; r < s.length; r++)
|
|
@@ -4581,7 +4593,7 @@ const mr = (e, t, n) => {
|
|
|
4581
4593
|
}
|
|
4582
4594
|
};
|
|
4583
4595
|
}, xr = (e, t) => {
|
|
4584
|
-
e.doc ??
|
|
4596
|
+
e.doc ?? W();
|
|
4585
4597
|
const n = wn(e, t);
|
|
4586
4598
|
let i = e._start;
|
|
4587
4599
|
for (n !== null && (i = n.p, t -= n.index); i !== null; i = i.right)
|
|
@@ -4595,7 +4607,7 @@ const mr = (e, t, n) => {
|
|
|
4595
4607
|
const r = e.doc, o = r.clientID, l = r.store, c = n === null ? t._start : n.right;
|
|
4596
4608
|
let a = [];
|
|
4597
4609
|
const d = () => {
|
|
4598
|
-
a.length > 0 && (s = new
|
|
4610
|
+
a.length > 0 && (s = new A(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new $t(a)), s.integrate(e, 0), a = []);
|
|
4599
4611
|
};
|
|
4600
4612
|
i.forEach((h) => {
|
|
4601
4613
|
if (h === null)
|
|
@@ -4613,20 +4625,20 @@ const mr = (e, t, n) => {
|
|
|
4613
4625
|
switch (d(), h.constructor) {
|
|
4614
4626
|
case Uint8Array:
|
|
4615
4627
|
case ArrayBuffer:
|
|
4616
|
-
s = new
|
|
4628
|
+
s = new A(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new De(new Uint8Array(
|
|
4617
4629
|
/** @type {Uint8Array} */
|
|
4618
4630
|
h
|
|
4619
4631
|
))), s.integrate(e, 0);
|
|
4620
4632
|
break;
|
|
4621
4633
|
case Ft:
|
|
4622
|
-
s = new
|
|
4634
|
+
s = new A(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new Ie(
|
|
4623
4635
|
/** @type {Doc} */
|
|
4624
4636
|
h
|
|
4625
4637
|
)), s.integrate(e, 0);
|
|
4626
4638
|
break;
|
|
4627
4639
|
default:
|
|
4628
4640
|
if (h instanceof F)
|
|
4629
|
-
s = new
|
|
4641
|
+
s = new A(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new ut(h)), s.integrate(e, 0);
|
|
4630
4642
|
else
|
|
4631
4643
|
throw new Error("Unexpected content type in insert operation");
|
|
4632
4644
|
}
|
|
@@ -4697,7 +4709,7 @@ const mr = (e, t, n) => {
|
|
|
4697
4709
|
);
|
|
4698
4710
|
break;
|
|
4699
4711
|
case Ft:
|
|
4700
|
-
l = new
|
|
4712
|
+
l = new Ie(
|
|
4701
4713
|
/** @type {Doc} */
|
|
4702
4714
|
i
|
|
4703
4715
|
);
|
|
@@ -4708,18 +4720,18 @@ const mr = (e, t, n) => {
|
|
|
4708
4720
|
else
|
|
4709
4721
|
throw new Error("Unexpected content type");
|
|
4710
4722
|
}
|
|
4711
|
-
new
|
|
4723
|
+
new A(C(o, B(r.store, o)), s, s && s.lastId, null, null, t, n, l).integrate(e, 0);
|
|
4712
4724
|
}, bi = (e, t) => {
|
|
4713
|
-
e.doc ??
|
|
4725
|
+
e.doc ?? W();
|
|
4714
4726
|
const n = e._map.get(t);
|
|
4715
4727
|
return n !== void 0 && !n.deleted ? n.content.getContent()[n.length - 1] : void 0;
|
|
4716
4728
|
}, Cr = (e) => {
|
|
4717
4729
|
const t = {};
|
|
4718
|
-
return e.doc ??
|
|
4730
|
+
return e.doc ?? W(), e._map.forEach((n, i) => {
|
|
4719
4731
|
n.deleted || (t[i] = n.content.getContent()[n.length - 1]);
|
|
4720
4732
|
}), t;
|
|
4721
4733
|
}, _r = (e, t) => {
|
|
4722
|
-
e.doc ??
|
|
4734
|
+
e.doc ?? W();
|
|
4723
4735
|
const n = e._map.get(t);
|
|
4724
4736
|
return n !== void 0 && !n.deleted;
|
|
4725
4737
|
}, ga = (e, t) => {
|
|
@@ -4730,7 +4742,7 @@ const mr = (e, t, n) => {
|
|
|
4730
4742
|
r = r.left;
|
|
4731
4743
|
r !== null && Rt(r, t) && (n[s] = r.content.getContent()[r.length - 1]);
|
|
4732
4744
|
}), n;
|
|
4733
|
-
}, Ne = (e) => (e.doc ??
|
|
4745
|
+
}, Ne = (e) => (e.doc ?? W(), Nc(
|
|
4734
4746
|
e._map.entries(),
|
|
4735
4747
|
/** @param {any} entry */
|
|
4736
4748
|
(t) => !t[1].deleted
|
|
@@ -4791,7 +4803,7 @@ class Gt extends F {
|
|
|
4791
4803
|
)), t;
|
|
4792
4804
|
}
|
|
4793
4805
|
get length() {
|
|
4794
|
-
return this.doc ??
|
|
4806
|
+
return this.doc ?? W(), this._length;
|
|
4795
4807
|
}
|
|
4796
4808
|
/**
|
|
4797
4809
|
* Creates YArrayEvent and calls observers.
|
|
@@ -5009,7 +5021,7 @@ class Qt extends F {
|
|
|
5009
5021
|
* @return {Object<string,any>}
|
|
5010
5022
|
*/
|
|
5011
5023
|
toJSON() {
|
|
5012
|
-
this.doc ??
|
|
5024
|
+
this.doc ?? W();
|
|
5013
5025
|
const t = {};
|
|
5014
5026
|
return this._map.forEach((n, i) => {
|
|
5015
5027
|
if (!n.deleted) {
|
|
@@ -5032,7 +5044,7 @@ class Qt extends F {
|
|
|
5032
5044
|
* @return {IterableIterator<string>}
|
|
5033
5045
|
*/
|
|
5034
5046
|
keys() {
|
|
5035
|
-
return
|
|
5047
|
+
return In(
|
|
5036
5048
|
Ne(this),
|
|
5037
5049
|
/** @param {any} v */
|
|
5038
5050
|
(t) => t[0]
|
|
@@ -5044,7 +5056,7 @@ class Qt extends F {
|
|
|
5044
5056
|
* @return {IterableIterator<MapType>}
|
|
5045
5057
|
*/
|
|
5046
5058
|
values() {
|
|
5047
|
-
return
|
|
5059
|
+
return In(
|
|
5048
5060
|
Ne(this),
|
|
5049
5061
|
/** @param {any} v */
|
|
5050
5062
|
(t) => t[1].content.getContent()[t[1].length - 1]
|
|
@@ -5056,7 +5068,7 @@ class Qt extends F {
|
|
|
5056
5068
|
* @return {IterableIterator<[string, MapType]>}
|
|
5057
5069
|
*/
|
|
5058
5070
|
entries() {
|
|
5059
|
-
return
|
|
5071
|
+
return In(
|
|
5060
5072
|
Ne(this),
|
|
5061
5073
|
/** @param {any} v */
|
|
5062
5074
|
(t) => (
|
|
@@ -5071,7 +5083,7 @@ class Qt extends F {
|
|
|
5071
5083
|
* @param {function(MapType,string,YMap<MapType>):void} f A function to execute on every element of this YArray.
|
|
5072
5084
|
*/
|
|
5073
5085
|
forEach(t) {
|
|
5074
|
-
this.doc ??
|
|
5086
|
+
this.doc ?? W(), this._map.forEach((n, i) => {
|
|
5075
5087
|
n.deleted || t(n.content.getContent()[n.length - 1], i, this);
|
|
5076
5088
|
});
|
|
5077
5089
|
}
|
|
@@ -5221,7 +5233,7 @@ const os = (e, t, n) => {
|
|
|
5221
5233
|
), n.forward();
|
|
5222
5234
|
const s = e.doc, r = s.clientID;
|
|
5223
5235
|
i.forEach((o, l) => {
|
|
5224
|
-
const c = n.left, a = n.right, d = new
|
|
5236
|
+
const c = n.left, a = n.right, d = new A(C(r, B(s.store, r)), c, c && c.lastId, a, a && a.id, t, null, new V(l, o));
|
|
5225
5237
|
d.integrate(e, 0), n.right = d, n.forward();
|
|
5226
5238
|
});
|
|
5227
5239
|
}, se = (e, t) => {
|
|
@@ -5246,7 +5258,7 @@ const os = (e, t, n) => {
|
|
|
5246
5258
|
if (!Ct(a, c)) {
|
|
5247
5259
|
o.set(l, a);
|
|
5248
5260
|
const { left: d, right: h } = n;
|
|
5249
|
-
n.right = new
|
|
5261
|
+
n.right = new A(C(r, B(s.store, r)), d, d && d.lastId, h, h && h.id, t, null, new V(l, c)), n.right.integrate(e, 0), n.forward();
|
|
5250
5262
|
}
|
|
5251
5263
|
}
|
|
5252
5264
|
return o;
|
|
@@ -5261,7 +5273,7 @@ const os = (e, t, n) => {
|
|
|
5261
5273
|
i
|
|
5262
5274
|
) : i instanceof F ? new ut(i) : new zt(i);
|
|
5263
5275
|
let { left: a, right: d, index: h } = n;
|
|
5264
|
-
t._searchMarker && be(t._searchMarker, n.index, c.getLength()), d = new
|
|
5276
|
+
t._searchMarker && be(t._searchMarker, n.index, c.getLength()), d = new A(C(o, B(r.store, o)), a, a && a.lastId, d, d && d.id, t, null, c), d.integrate(e, 0), n.right = d, n.index = h, n.forward(), Er(e, t, n, l);
|
|
5265
5277
|
}, ls = (e, t, n, i, s) => {
|
|
5266
5278
|
const r = e.doc, o = r.clientID;
|
|
5267
5279
|
Tr(n, s);
|
|
@@ -5298,10 +5310,10 @@ const os = (e, t, n) => {
|
|
|
5298
5310
|
for (; i > 0; i--)
|
|
5299
5311
|
c += `
|
|
5300
5312
|
`;
|
|
5301
|
-
n.right = new
|
|
5313
|
+
n.right = new A(C(o, B(r.store, o)), n.left, n.left && n.left.lastId, n.right, n.right && n.right.id, t, null, new dt(c)), n.right.integrate(e, 0), n.forward();
|
|
5302
5314
|
}
|
|
5303
5315
|
Er(e, t, n, l);
|
|
5304
|
-
},
|
|
5316
|
+
}, Ir = (e, t, n, i, s) => {
|
|
5305
5317
|
let r = t;
|
|
5306
5318
|
const o = ct();
|
|
5307
5319
|
for (; r && (!r.countable || r.deleted); ) {
|
|
@@ -5373,7 +5385,7 @@ const os = (e, t, n) => {
|
|
|
5373
5385
|
);
|
|
5374
5386
|
break;
|
|
5375
5387
|
default:
|
|
5376
|
-
t +=
|
|
5388
|
+
t += Ir(n, i, s, r, o), r = Ln(o), i = s;
|
|
5377
5389
|
break;
|
|
5378
5390
|
}
|
|
5379
5391
|
s = s.right;
|
|
@@ -5429,7 +5441,7 @@ const os = (e, t, n) => {
|
|
|
5429
5441
|
}
|
|
5430
5442
|
t.forward();
|
|
5431
5443
|
}
|
|
5432
|
-
r &&
|
|
5444
|
+
r && Ir(e, r, t.right, s, t.currentAttributes);
|
|
5433
5445
|
const o = (
|
|
5434
5446
|
/** @type {AbstractType<any>} */
|
|
5435
5447
|
/** @type {Item} */
|
|
@@ -5558,7 +5570,7 @@ class va extends mn {
|
|
|
5558
5570
|
);
|
|
5559
5571
|
}
|
|
5560
5572
|
}
|
|
5561
|
-
class
|
|
5573
|
+
class It extends F {
|
|
5562
5574
|
/**
|
|
5563
5575
|
* @param {String} [string] The initial value of the YText.
|
|
5564
5576
|
*/
|
|
@@ -5571,7 +5583,7 @@ class At extends F {
|
|
|
5571
5583
|
* @type {number}
|
|
5572
5584
|
*/
|
|
5573
5585
|
get length() {
|
|
5574
|
-
return this.doc ??
|
|
5586
|
+
return this.doc ?? W(), this._length;
|
|
5575
5587
|
}
|
|
5576
5588
|
/**
|
|
5577
5589
|
* @param {Doc} y
|
|
@@ -5587,7 +5599,7 @@ class At extends F {
|
|
|
5587
5599
|
this._pending = null;
|
|
5588
5600
|
}
|
|
5589
5601
|
_copy() {
|
|
5590
|
-
return new
|
|
5602
|
+
return new It();
|
|
5591
5603
|
}
|
|
5592
5604
|
/**
|
|
5593
5605
|
* Makes a copy of this data type that can be included somewhere else.
|
|
@@ -5597,7 +5609,7 @@ class At extends F {
|
|
|
5597
5609
|
* @return {YText}
|
|
5598
5610
|
*/
|
|
5599
5611
|
clone() {
|
|
5600
|
-
const t = new
|
|
5612
|
+
const t = new It();
|
|
5601
5613
|
return t.applyDelta(this.toDelta()), t;
|
|
5602
5614
|
}
|
|
5603
5615
|
/**
|
|
@@ -5617,7 +5629,7 @@ class At extends F {
|
|
|
5617
5629
|
* @public
|
|
5618
5630
|
*/
|
|
5619
5631
|
toString() {
|
|
5620
|
-
this.doc ??
|
|
5632
|
+
this.doc ?? W();
|
|
5621
5633
|
let t = "", n = this._start;
|
|
5622
5634
|
for (; n !== null; )
|
|
5623
5635
|
!n.deleted && n.countable && n.content.constructor === dt && (t += /** @type {ContentString} */
|
|
@@ -5667,7 +5679,7 @@ class At extends F {
|
|
|
5667
5679
|
* @public
|
|
5668
5680
|
*/
|
|
5669
5681
|
toDelta(t, n, i) {
|
|
5670
|
-
this.doc ??
|
|
5682
|
+
this.doc ?? W();
|
|
5671
5683
|
const s = [], r = /* @__PURE__ */ new Map(), o = (
|
|
5672
5684
|
/** @type {Doc} */
|
|
5673
5685
|
this.doc
|
|
@@ -5725,7 +5737,7 @@ class At extends F {
|
|
|
5725
5737
|
a();
|
|
5726
5738
|
};
|
|
5727
5739
|
return t || n ? O(o, (h) => {
|
|
5728
|
-
t &&
|
|
5740
|
+
t && Wn(h, t), n && Wn(h, n), d();
|
|
5729
5741
|
}, "cleanup") : d(), s;
|
|
5730
5742
|
}
|
|
5731
5743
|
/**
|
|
@@ -5866,7 +5878,7 @@ class At extends F {
|
|
|
5866
5878
|
t.writeTypeRef(za);
|
|
5867
5879
|
}
|
|
5868
5880
|
}
|
|
5869
|
-
const Ca = (e) => new
|
|
5881
|
+
const Ca = (e) => new It();
|
|
5870
5882
|
class Rn {
|
|
5871
5883
|
/**
|
|
5872
5884
|
* @param {YXmlFragment | YXmlElement} root
|
|
@@ -5874,7 +5886,7 @@ class Rn {
|
|
|
5874
5886
|
*/
|
|
5875
5887
|
constructor(t, n = () => !0) {
|
|
5876
5888
|
this._filter = n, this._root = t, this._currentNode = /** @type {Item} */
|
|
5877
|
-
t._start, this._firstCall = !0, t.doc ??
|
|
5889
|
+
t._start, this._firstCall = !0, t.doc ?? W();
|
|
5878
5890
|
}
|
|
5879
5891
|
[Symbol.iterator]() {
|
|
5880
5892
|
return this;
|
|
@@ -5892,7 +5904,7 @@ class Rn {
|
|
|
5892
5904
|
if (t !== null && (!this._firstCall || t.deleted || !this._filter(n)))
|
|
5893
5905
|
do
|
|
5894
5906
|
if (n = /** @type {any} */
|
|
5895
|
-
t.content.type, !t.deleted && (n.constructor ===
|
|
5907
|
+
t.content.type, !t.deleted && (n.constructor === K || n.constructor === Ht) && n._start !== null)
|
|
5896
5908
|
t = n._start;
|
|
5897
5909
|
else
|
|
5898
5910
|
for (; t !== null; ) {
|
|
@@ -5956,7 +5968,7 @@ class Ht extends F {
|
|
|
5956
5968
|
return t.insert(0, this.toArray().map((n) => n instanceof F ? n.clone() : n)), t;
|
|
5957
5969
|
}
|
|
5958
5970
|
get length() {
|
|
5959
|
-
return this.doc ??
|
|
5971
|
+
return this.doc ?? W(), this._prelimContent === null ? this._length : this._prelimContent.length;
|
|
5960
5972
|
}
|
|
5961
5973
|
/**
|
|
5962
5974
|
* Create a subtree of childNodes.
|
|
@@ -6169,11 +6181,11 @@ class Ht extends F {
|
|
|
6169
6181
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
|
|
6170
6182
|
*/
|
|
6171
6183
|
_write(t) {
|
|
6172
|
-
t.writeTypeRef(
|
|
6184
|
+
t.writeTypeRef(Wa);
|
|
6173
6185
|
}
|
|
6174
6186
|
}
|
|
6175
6187
|
const _a = (e) => new Ht();
|
|
6176
|
-
class
|
|
6188
|
+
class K extends Ht {
|
|
6177
6189
|
constructor(t = "UNDEFINED") {
|
|
6178
6190
|
super(), this.nodeName = t, this._prelimAttrs = /* @__PURE__ */ new Map();
|
|
6179
6191
|
}
|
|
@@ -6221,7 +6233,7 @@ class W extends Ht {
|
|
|
6221
6233
|
* @return {YXmlElement}
|
|
6222
6234
|
*/
|
|
6223
6235
|
_copy() {
|
|
6224
|
-
return new
|
|
6236
|
+
return new K(this.nodeName);
|
|
6225
6237
|
}
|
|
6226
6238
|
/**
|
|
6227
6239
|
* Makes a copy of this data type that can be included somewhere else.
|
|
@@ -6231,7 +6243,7 @@ class W extends Ht {
|
|
|
6231
6243
|
* @return {YXmlElement<KV>}
|
|
6232
6244
|
*/
|
|
6233
6245
|
clone() {
|
|
6234
|
-
const t = new
|
|
6246
|
+
const t = new K(this.nodeName), n = this.getAttributes();
|
|
6235
6247
|
return lc(n, (i, s) => {
|
|
6236
6248
|
typeof i == "string" && t.setAttribute(s, i);
|
|
6237
6249
|
}), t.insert(0, this.toArray().map((i) => i instanceof F ? i.clone() : i)), t;
|
|
@@ -6364,10 +6376,10 @@ class W extends Ht {
|
|
|
6364
6376
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
|
|
6365
6377
|
*/
|
|
6366
6378
|
_write(t) {
|
|
6367
|
-
t.writeTypeRef(
|
|
6379
|
+
t.writeTypeRef(Ka), t.writeKey(this.nodeName);
|
|
6368
6380
|
}
|
|
6369
6381
|
}
|
|
6370
|
-
const Ea = (e) => new
|
|
6382
|
+
const Ea = (e) => new K(e.readKey());
|
|
6371
6383
|
class Ta extends mn {
|
|
6372
6384
|
/**
|
|
6373
6385
|
* @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.
|
|
@@ -6437,11 +6449,11 @@ class Qe extends Qt {
|
|
|
6437
6449
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
|
|
6438
6450
|
*/
|
|
6439
6451
|
_write(t) {
|
|
6440
|
-
t.writeTypeRef(
|
|
6452
|
+
t.writeTypeRef(ja), t.writeKey(this.hookName);
|
|
6441
6453
|
}
|
|
6442
6454
|
}
|
|
6443
6455
|
const Da = (e) => new Qe(e.readKey());
|
|
6444
|
-
class J extends
|
|
6456
|
+
class J extends It {
|
|
6445
6457
|
/**
|
|
6446
6458
|
* @type {YXmlElement|YXmlText|null}
|
|
6447
6459
|
*/
|
|
@@ -6536,7 +6548,7 @@ class J extends At {
|
|
|
6536
6548
|
t.writeTypeRef(Ya);
|
|
6537
6549
|
}
|
|
6538
6550
|
}
|
|
6539
|
-
const
|
|
6551
|
+
const Ia = (e) => new J();
|
|
6540
6552
|
class yi {
|
|
6541
6553
|
/**
|
|
6542
6554
|
* @param {ID} id
|
|
@@ -6577,7 +6589,7 @@ class yi {
|
|
|
6577
6589
|
throw at();
|
|
6578
6590
|
}
|
|
6579
6591
|
}
|
|
6580
|
-
const
|
|
6592
|
+
const Aa = 0;
|
|
6581
6593
|
class it extends yi {
|
|
6582
6594
|
get deleted() {
|
|
6583
6595
|
return !0;
|
|
@@ -6603,7 +6615,7 @@ class it extends yi {
|
|
|
6603
6615
|
* @param {number} offset
|
|
6604
6616
|
*/
|
|
6605
6617
|
write(t, n) {
|
|
6606
|
-
t.writeInfo(
|
|
6618
|
+
t.writeInfo(Aa), t.writeLen(this.length - n);
|
|
6607
6619
|
}
|
|
6608
6620
|
/**
|
|
6609
6621
|
* @param {Transaction} transaction
|
|
@@ -6767,8 +6779,8 @@ class xe {
|
|
|
6767
6779
|
return 1;
|
|
6768
6780
|
}
|
|
6769
6781
|
}
|
|
6770
|
-
const Ma = (e) => new xe(e.readLen()),
|
|
6771
|
-
class
|
|
6782
|
+
const Ma = (e) => new xe(e.readLen()), Ar = (e, t) => new Ft({ guid: e, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
|
|
6783
|
+
class Ie {
|
|
6772
6784
|
/**
|
|
6773
6785
|
* @param {Doc} doc
|
|
6774
6786
|
*/
|
|
@@ -6799,7 +6811,7 @@ class Ae {
|
|
|
6799
6811
|
* @return {ContentDoc}
|
|
6800
6812
|
*/
|
|
6801
6813
|
copy() {
|
|
6802
|
-
return new
|
|
6814
|
+
return new Ie(Ar(this.doc.guid, this.opts));
|
|
6803
6815
|
}
|
|
6804
6816
|
/**
|
|
6805
6817
|
* @param {number} offset
|
|
@@ -6847,7 +6859,7 @@ class Ae {
|
|
|
6847
6859
|
return 9;
|
|
6848
6860
|
}
|
|
6849
6861
|
}
|
|
6850
|
-
const Ra = (e) => new
|
|
6862
|
+
const Ra = (e) => new Ie(Ar(e.readString(), e.readAny()));
|
|
6851
6863
|
class zt {
|
|
6852
6864
|
/**
|
|
6853
6865
|
* @param {Object} embed
|
|
@@ -7100,7 +7112,7 @@ class $t {
|
|
|
7100
7112
|
* @param {Array<any>} arr
|
|
7101
7113
|
*/
|
|
7102
7114
|
constructor(t) {
|
|
7103
|
-
this.arr = t, Pa &&
|
|
7115
|
+
this.arr = t, Pa && js(t);
|
|
7104
7116
|
}
|
|
7105
7117
|
/**
|
|
7106
7118
|
* @return {number}
|
|
@@ -7267,8 +7279,8 @@ const Va = (e) => new dt(e.readString()), Ha = [
|
|
|
7267
7279
|
Ea,
|
|
7268
7280
|
_a,
|
|
7269
7281
|
Da,
|
|
7270
|
-
|
|
7271
|
-
], $a = 0, Fa = 1, za = 2,
|
|
7282
|
+
Ia
|
|
7283
|
+
], $a = 0, Fa = 1, za = 2, Ka = 3, Wa = 4, ja = 5, Ya = 6;
|
|
7272
7284
|
class ut {
|
|
7273
7285
|
/**
|
|
7274
7286
|
* @param {AbstractType<any>} type
|
|
@@ -7365,7 +7377,7 @@ const Ga = (e) => new ut(Ha[e.readTypeRef()](e)), Gn = (e, t) => {
|
|
|
7365
7377
|
let n = t, i = 0, s;
|
|
7366
7378
|
do
|
|
7367
7379
|
i > 0 && (n = C(n.client, n.clock + i)), s = Yt(e, n), i = n.clock - s.id.clock, n = s.redone;
|
|
7368
|
-
while (n !== null && s instanceof
|
|
7380
|
+
while (n !== null && s instanceof A);
|
|
7369
7381
|
return {
|
|
7370
7382
|
item: s,
|
|
7371
7383
|
diff: i
|
|
@@ -7375,7 +7387,7 @@ const Ga = (e) => new ut(Ha[e.readTypeRef()](e)), Gn = (e, t) => {
|
|
|
7375
7387
|
e.keep = t, e = /** @type {AbstractType<any>} */
|
|
7376
7388
|
e.parent._item;
|
|
7377
7389
|
}, en = (e, t, n) => {
|
|
7378
|
-
const { client: i, clock: s } = t.id, r = new
|
|
7390
|
+
const { client: i, clock: s } = t.id, r = new A(
|
|
7379
7391
|
C(i, s + n),
|
|
7380
7392
|
t,
|
|
7381
7393
|
C(i, s + n - 1),
|
|
@@ -7443,7 +7455,7 @@ const Ga = (e) => new ut(Ha[e.readTypeRef()](e)), Gn = (e, t) => {
|
|
|
7443
7455
|
return null;
|
|
7444
7456
|
} else
|
|
7445
7457
|
h = f._map.get(t.parentSub) || null;
|
|
7446
|
-
const g = B(l, c), m = C(c, g), b = new
|
|
7458
|
+
const g = B(l, c), m = C(c, g), b = new A(
|
|
7447
7459
|
m,
|
|
7448
7460
|
h,
|
|
7449
7461
|
h && h.lastId,
|
|
@@ -7455,7 +7467,7 @@ const Ga = (e) => new ut(Ha[e.readTypeRef()](e)), Gn = (e, t) => {
|
|
|
7455
7467
|
);
|
|
7456
7468
|
return t.redone = m, xi(b, !0), b.integrate(e, 0), b;
|
|
7457
7469
|
};
|
|
7458
|
-
class
|
|
7470
|
+
class A extends yi {
|
|
7459
7471
|
/**
|
|
7460
7472
|
* @param {ID} id
|
|
7461
7473
|
* @param {Item | null} left
|
|
@@ -7517,13 +7529,13 @@ class I extends yi {
|
|
|
7517
7529
|
return this.origin.client;
|
|
7518
7530
|
if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= B(n, this.rightOrigin.client))
|
|
7519
7531
|
return this.rightOrigin.client;
|
|
7520
|
-
if (this.parent && this.parent.constructor ===
|
|
7532
|
+
if (this.parent && this.parent.constructor === jt && this.id.client !== this.parent.client && this.parent.clock >= B(n, this.parent.client))
|
|
7521
7533
|
return this.parent.client;
|
|
7522
7534
|
if (this.origin && (this.left = Qi(t, n, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = G(t, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === it || this.right && this.right.constructor === it)
|
|
7523
7535
|
this.parent = null;
|
|
7524
7536
|
else if (!this.parent)
|
|
7525
|
-
this.left && this.left.constructor ===
|
|
7526
|
-
else if (this.parent.constructor ===
|
|
7537
|
+
this.left && this.left.constructor === A ? (this.parent = this.left.parent, this.parentSub = this.left.parentSub) : this.right && this.right.constructor === A && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
|
|
7538
|
+
else if (this.parent.constructor === jt) {
|
|
7527
7539
|
const i = Yt(n, this.parent);
|
|
7528
7540
|
i.constructor === it ? this.parent = null : this.parent = /** @type {ContentType} */
|
|
7529
7541
|
i.content.type;
|
|
@@ -7662,7 +7674,7 @@ class I extends yi {
|
|
|
7662
7674
|
* @param {number} offset
|
|
7663
7675
|
*/
|
|
7664
7676
|
write(t, n) {
|
|
7665
|
-
const i = n > 0 ? C(this.id.client, this.id.clock + n - 1) : this.origin, s = this.rightOrigin, r = this.parentSub, o = this.content.getRef() & dn | (i === null ? 0 :
|
|
7677
|
+
const i = n > 0 ? C(this.id.client, this.id.clock + n - 1) : this.origin, s = this.rightOrigin, r = this.parentSub, o = this.content.getRef() & dn | (i === null ? 0 : j) | // origin is defined
|
|
7666
7678
|
(s === null ? 0 : bt) | // right origin is defined
|
|
7667
7679
|
(r === null ? 0 : ue);
|
|
7668
7680
|
if (t.writeInfo(o), i !== null && t.writeLeftID(i), s !== null && t.writeRightID(s), i === null && s === null) {
|
|
@@ -7677,7 +7689,7 @@ class I extends yi {
|
|
|
7677
7689
|
t.writeParentInfo(!0), t.writeString(a);
|
|
7678
7690
|
} else
|
|
7679
7691
|
t.writeParentInfo(!1), t.writeLeftID(c.id);
|
|
7680
|
-
} else l.constructor === String ? (t.writeParentInfo(!0), t.writeString(l)) : l.constructor ===
|
|
7692
|
+
} else l.constructor === String ? (t.writeParentInfo(!0), t.writeString(l)) : l.constructor === jt ? (t.writeParentInfo(!1), t.writeLeftID(l)) : q();
|
|
7681
7693
|
r !== null && t.writeString(r);
|
|
7682
7694
|
}
|
|
7683
7695
|
this.content.write(t, n);
|
|
@@ -7879,7 +7891,7 @@ class ch {
|
|
|
7879
7891
|
if (n % 64 !== 0) {
|
|
7880
7892
|
for (this._W.fill(0, o, 16); n < t.length; )
|
|
7881
7893
|
this._W[o] |= t[n] << (3 - n % 4) * 8, n++;
|
|
7882
|
-
this._W[o] |=
|
|
7894
|
+
this._W[o] |= j << (3 - n % 4) * 8;
|
|
7883
7895
|
}
|
|
7884
7896
|
this._updateHash();
|
|
7885
7897
|
}
|
|
@@ -7889,7 +7901,7 @@ class ch {
|
|
|
7889
7901
|
for (; n < t.length; s++)
|
|
7890
7902
|
for (let o = 3; o >= 0 && n < t.length; o--)
|
|
7891
7903
|
this._W[s] |= t[n++] << o * 8;
|
|
7892
|
-
i || (this._W[s - (n % 4 === 0 ? 0 : 1)] |=
|
|
7904
|
+
i || (this._W[s - (n % 4 === 0 ? 0 : 1)] |= j << (3 - n % 4) * 8), this._W[14] = t.byteLength / xl, this._W[15] = t.byteLength * 8, this._updateHash();
|
|
7893
7905
|
const r = new Uint8Array(32);
|
|
7894
7906
|
for (let o = 0; o < this._H.length; o++)
|
|
7895
7907
|
for (let l = 0; l < 4; l++)
|
|
@@ -8102,7 +8114,7 @@ class wh {
|
|
|
8102
8114
|
).filter((i) => i !== null), n = this._tr.replace(
|
|
8103
8115
|
0,
|
|
8104
8116
|
this.prosemirrorView.state.doc.content.size,
|
|
8105
|
-
new
|
|
8117
|
+
new Ae(Oe.from(t), 0, 0)
|
|
8106
8118
|
);
|
|
8107
8119
|
n.setMeta(U, { snapshot: null, prevSnapshot: null }), this.prosemirrorView.dispatch(n);
|
|
8108
8120
|
});
|
|
@@ -8119,7 +8131,7 @@ class wh {
|
|
|
8119
8131
|
).filter((s) => s !== null), i = this._tr.replace(
|
|
8120
8132
|
0,
|
|
8121
8133
|
this.prosemirrorView.state.doc.content.size,
|
|
8122
|
-
new
|
|
8134
|
+
new Ae(Oe.from(n), 0, 0)
|
|
8123
8135
|
);
|
|
8124
8136
|
if (t) {
|
|
8125
8137
|
const s = qt(Et(t.anchor, 0), i.doc.content.size), r = qt(Et(t.head, 0), i.doc.content.size);
|
|
@@ -8138,7 +8150,7 @@ class wh {
|
|
|
8138
8150
|
_renderSnapshot(t, n, i) {
|
|
8139
8151
|
let s = this.doc, r = this.type;
|
|
8140
8152
|
if (t || (t = On(this.doc)), t instanceof Uint8Array || n instanceof Uint8Array)
|
|
8141
|
-
if ((!(t instanceof Uint8Array) || !(n instanceof Uint8Array)) && q(), s = new Ft({ gc: !1 }),
|
|
8153
|
+
if ((!(t instanceof Uint8Array) || !(n instanceof Uint8Array)) && q(), s = new Ft({ gc: !1 }), Kn(s, n), n = On(s), Kn(s, t), t = On(s), r._item === null) {
|
|
8142
8154
|
const o = Array.from(this.doc.share.keys()).find(
|
|
8143
8155
|
(l) => this.doc.share.get(l) === this.type
|
|
8144
8156
|
);
|
|
@@ -8184,7 +8196,7 @@ class wh {
|
|
|
8184
8196
|
) : null).filter((h) => h !== null), d = this._tr.replace(
|
|
8185
8197
|
0,
|
|
8186
8198
|
this.prosemirrorView.state.doc.content.size,
|
|
8187
|
-
new
|
|
8199
|
+
new Ae(Oe.from(a), 0, 0)
|
|
8188
8200
|
);
|
|
8189
8201
|
this.prosemirrorView.dispatch(
|
|
8190
8202
|
d.setMeta(U, { isChangeOrigin: !0 })
|
|
@@ -8209,7 +8221,7 @@ class wh {
|
|
|
8209
8221
|
n,
|
|
8210
8222
|
n.deleteSet,
|
|
8211
8223
|
(l) => {
|
|
8212
|
-
if (l.constructor ===
|
|
8224
|
+
if (l.constructor === A) {
|
|
8213
8225
|
const c = (
|
|
8214
8226
|
/** @type {Y.ContentType} */
|
|
8215
8227
|
/** @type {Y.Item} */
|
|
@@ -8230,7 +8242,7 @@ class wh {
|
|
|
8230
8242
|
let o = this._tr.replace(
|
|
8231
8243
|
0,
|
|
8232
8244
|
this.prosemirrorView.state.doc.content.size,
|
|
8233
|
-
new
|
|
8245
|
+
new Ae(Oe.from(r), 0, 0)
|
|
8234
8246
|
);
|
|
8235
8247
|
gh(o, this.beforeTransactionSelection, this), o = o.setMeta(U, { isChangeOrigin: !0, isUndoRedoOperation: n.origin instanceof ur }), this.beforeTransactionSelection !== null && this._isLocalCursorInView() && o.scrollIntoView(), this.prosemirrorView.dispatch(o);
|
|
8236
8248
|
});
|
|
@@ -8263,7 +8275,7 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8263
8275
|
n.mapping.get(e)
|
|
8264
8276
|
);
|
|
8265
8277
|
if (o === void 0) {
|
|
8266
|
-
if (e instanceof
|
|
8278
|
+
if (e instanceof K)
|
|
8267
8279
|
return ze(
|
|
8268
8280
|
e,
|
|
8269
8281
|
t,
|
|
@@ -8278,7 +8290,7 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8278
8290
|
}, ze = (e, t, n, i, s, r) => {
|
|
8279
8291
|
const o = [], l = (c) => {
|
|
8280
8292
|
var a, d;
|
|
8281
|
-
if (c instanceof
|
|
8293
|
+
if (c instanceof K) {
|
|
8282
8294
|
const h = Ur(
|
|
8283
8295
|
c,
|
|
8284
8296
|
t,
|
|
@@ -8293,7 +8305,7 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8293
8305
|
/** @type {Y.ContentType} */
|
|
8294
8306
|
(d = (a = c._item.right) == null ? void 0 : a.content) == null ? void 0 : d.type
|
|
8295
8307
|
);
|
|
8296
|
-
h instanceof
|
|
8308
|
+
h instanceof It && !h._item.deleted && h._item.id.client === h.doc.clientID && (c.applyDelta([
|
|
8297
8309
|
{ retain: c.length },
|
|
8298
8310
|
...h.toDelta()
|
|
8299
8311
|
]), h.doc.transact((f) => {
|
|
@@ -8360,7 +8372,7 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8360
8372
|
}));
|
|
8361
8373
|
return n.applyDelta(i), t.mapping.set(n, e), n;
|
|
8362
8374
|
}, xh = (e, t) => {
|
|
8363
|
-
const n = new
|
|
8375
|
+
const n = new K(e.type.name);
|
|
8364
8376
|
for (const i in e.attrs) {
|
|
8365
8377
|
const s = e.attrs[i];
|
|
8366
8378
|
s !== null && i !== "ychange" && n.setAttribute(i, s);
|
|
@@ -8397,7 +8409,7 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8397
8409
|
return n.length === t.length && n.every(
|
|
8398
8410
|
/** @type {(d:any,i:number) => boolean} */
|
|
8399
8411
|
(i, s) => i.insert === /** @type {any} */
|
|
8400
|
-
t[s].text &&
|
|
8412
|
+
t[s].text && Ks(i.attributes || {}).length === t[s].marks.length && Ws(i.attributes, (r, o) => {
|
|
8401
8413
|
var d;
|
|
8402
8414
|
const l = ki(o), c = t[s].marks;
|
|
8403
8415
|
return c.find(
|
|
@@ -8410,7 +8422,7 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8410
8422
|
})
|
|
8411
8423
|
);
|
|
8412
8424
|
}, Se = (e, t) => {
|
|
8413
|
-
if (e instanceof
|
|
8425
|
+
if (e instanceof K && !(t instanceof Array) && Zn(e, t)) {
|
|
8414
8426
|
const n = yn(t);
|
|
8415
8427
|
return e._length === n.length && Si(e.getAttributes(), t.attrs) && e.toArray().every(
|
|
8416
8428
|
(i, s) => Se(i, n[s])
|
|
@@ -8481,9 +8493,9 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8481
8493
|
}
|
|
8482
8494
|
}), n;
|
|
8483
8495
|
}, Xn = (e, t, n, i) => {
|
|
8484
|
-
if (t instanceof
|
|
8496
|
+
if (t instanceof K && t.nodeName !== n.type.name)
|
|
8485
8497
|
throw new Error("node name mismatch!");
|
|
8486
|
-
if (i.mapping.set(t, n), t instanceof
|
|
8498
|
+
if (i.mapping.set(t, n), t instanceof K) {
|
|
8487
8499
|
const h = t.getAttributes(), u = n.attrs;
|
|
8488
8500
|
for (const f in u)
|
|
8489
8501
|
u[f] !== null ? h[f] !== u[f] && f !== "ychange" && t.setAttribute(f, u[f]) : t.removeAttribute(f);
|
|
@@ -8514,7 +8526,7 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8514
8526
|
if (u instanceof J && f instanceof Array)
|
|
8515
8527
|
Lr(u, f) || kh(u, f, i), a += 1;
|
|
8516
8528
|
else {
|
|
8517
|
-
let b = u instanceof
|
|
8529
|
+
let b = u instanceof K && Zn(u, f), w = g instanceof K && Zn(g, m);
|
|
8518
8530
|
if (b && w) {
|
|
8519
8531
|
const D = ds(
|
|
8520
8532
|
/** @type {Y.XmlElement} */
|
|
@@ -8522,14 +8534,14 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8522
8534
|
/** @type {PModel.Node} */
|
|
8523
8535
|
f,
|
|
8524
8536
|
i
|
|
8525
|
-
),
|
|
8537
|
+
), I = ds(
|
|
8526
8538
|
/** @type {Y.XmlElement} */
|
|
8527
8539
|
g,
|
|
8528
8540
|
/** @type {PModel.Node} */
|
|
8529
8541
|
m,
|
|
8530
8542
|
i
|
|
8531
8543
|
);
|
|
8532
|
-
D.foundMappedChild && !
|
|
8544
|
+
D.foundMappedChild && !I.foundMappedChild ? w = !1 : !D.foundMappedChild && I.foundMappedChild || D.equalityFactor < I.equalityFactor ? b = !1 : w = !1;
|
|
8533
8545
|
}
|
|
8534
8546
|
b ? (Xn(
|
|
8535
8547
|
e,
|
|
@@ -8560,7 +8572,7 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8560
8572
|
}, U);
|
|
8561
8573
|
}, Zn = (e, t) => !(t instanceof Array) && e.nodeName === t.type.name, rn = (e, t, n) => {
|
|
8562
8574
|
if (e === 0)
|
|
8563
|
-
return
|
|
8575
|
+
return An(t, 0, -1);
|
|
8564
8576
|
let i = t._first === null ? null : (
|
|
8565
8577
|
/** @type {Y.ContentType} */
|
|
8566
8578
|
t._first.content.type
|
|
@@ -8568,7 +8580,7 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8568
8580
|
for (; i !== null && t !== i; ) {
|
|
8569
8581
|
if (i instanceof J) {
|
|
8570
8582
|
if (i._length >= e)
|
|
8571
|
-
return
|
|
8583
|
+
return An(i, e, -1);
|
|
8572
8584
|
if (e -= i._length, i._item !== null && i._item.next !== null)
|
|
8573
8585
|
i = /** @type {Y.ContentType} */
|
|
8574
8586
|
i._item.next.content.type;
|
|
@@ -8616,7 +8628,7 @@ const Ur = (e, t, n, i, s, r) => {
|
|
|
8616
8628
|
if (e === 0 && i.constructor !== J && i !== t)
|
|
8617
8629
|
return _h(i._item.parent, i._item);
|
|
8618
8630
|
}
|
|
8619
|
-
return
|
|
8631
|
+
return An(t, t._length, -1);
|
|
8620
8632
|
}, _h = (e, t) => {
|
|
8621
8633
|
let n = null, i = null;
|
|
8622
8634
|
return e._item === null ? i = me(e) : n = C(e._item.id.client, e._item.id.clock), new qe(n, i, t.id);
|
|
@@ -8686,7 +8698,7 @@ function Eh(e) {
|
|
|
8686
8698
|
})), l;
|
|
8687
8699
|
}
|
|
8688
8700
|
);
|
|
8689
|
-
else if (i instanceof
|
|
8701
|
+
else if (i instanceof K) {
|
|
8690
8702
|
s = {
|
|
8691
8703
|
type: i.nodeName
|
|
8692
8704
|
};
|
|
@@ -8711,13 +8723,13 @@ const Th = (e) => {
|
|
|
8711
8723
|
const t = yt.getState(e).undoManager;
|
|
8712
8724
|
if (t != null)
|
|
8713
8725
|
return t.redo(), !0;
|
|
8714
|
-
},
|
|
8726
|
+
}, Ih = /* @__PURE__ */ new Set(["paragraph"]), Ah = (e, t) => !(e instanceof A) || !(e.content instanceof ut) || !(e.content.type instanceof It || e.content.type instanceof K && t.has(e.content.type.nodeName)) || e.content.type._length === 0, Oh = ({ protectedNodes: e = Ih, trackedOrigins: t = [], undoManager: n = null } = {}) => new ys({
|
|
8715
8727
|
key: yt,
|
|
8716
8728
|
state: {
|
|
8717
8729
|
init: (i, s) => {
|
|
8718
8730
|
const r = U.getState(s), o = n || new ur(r.type, {
|
|
8719
8731
|
trackedOrigins: new Set([U].concat(t)),
|
|
8720
|
-
deleteFilter: (l) =>
|
|
8732
|
+
deleteFilter: (l) => Ah(l, e),
|
|
8721
8733
|
captureTransaction: (l) => l.meta.get("addToHistory") !== !1
|
|
8722
8734
|
});
|
|
8723
8735
|
return {
|
|
@@ -8769,7 +8781,7 @@ function Vr(e, t) {
|
|
|
8769
8781
|
const n = U.getState(e);
|
|
8770
8782
|
return rn(t, n.type, n.binding.mapping);
|
|
8771
8783
|
}
|
|
8772
|
-
var
|
|
8784
|
+
var Ke = class Hr extends to {
|
|
8773
8785
|
constructor(t, n) {
|
|
8774
8786
|
super(t), this.yRelativePosition = n;
|
|
8775
8787
|
}
|
|
@@ -8791,20 +8803,20 @@ var We = class Hr extends to {
|
|
|
8791
8803
|
};
|
|
8792
8804
|
function Rh(e, t) {
|
|
8793
8805
|
const n = Vr(t, e);
|
|
8794
|
-
return new
|
|
8806
|
+
return new Ke(e, n);
|
|
8795
8807
|
}
|
|
8796
8808
|
function Nh(e, t, n) {
|
|
8797
|
-
const i = e instanceof
|
|
8809
|
+
const i = e instanceof Ke ? e.yRelativePosition : null;
|
|
8798
8810
|
if (Br(t) && i) {
|
|
8799
8811
|
const o = Mh(n, i);
|
|
8800
8812
|
return {
|
|
8801
|
-
position: new
|
|
8813
|
+
position: new Ke(o, i),
|
|
8802
8814
|
mapResult: null
|
|
8803
8815
|
};
|
|
8804
8816
|
}
|
|
8805
8817
|
const s = Qr(e, t), r = s.position.position;
|
|
8806
8818
|
return {
|
|
8807
|
-
position: new
|
|
8819
|
+
position: new Ke(
|
|
8808
8820
|
r,
|
|
8809
8821
|
i ?? Vr(n, r)
|
|
8810
8822
|
),
|
|
@@ -8901,7 +8913,7 @@ ke.create({
|
|
|
8901
8913
|
});
|
|
8902
8914
|
function us(e) {
|
|
8903
8915
|
if (!e.length)
|
|
8904
|
-
return
|
|
8916
|
+
return Ai.empty;
|
|
8905
8917
|
const t = [], n = e[0].$from.node(0);
|
|
8906
8918
|
return e.forEach((i) => {
|
|
8907
8919
|
const s = i.$from.pos, r = i.$from.nodeAfter;
|
|
@@ -8910,7 +8922,7 @@ function us(e) {
|
|
|
8910
8922
|
class: "ProseMirror-selectednoderange"
|
|
8911
8923
|
})
|
|
8912
8924
|
);
|
|
8913
|
-
}),
|
|
8925
|
+
}), Ai.create(n, t);
|
|
8914
8926
|
}
|
|
8915
8927
|
function xn(e, t, n) {
|
|
8916
8928
|
const i = [], s = e.node(0);
|
|
@@ -9192,7 +9204,7 @@ var fs = (e, t) => {
|
|
|
9192
9204
|
}, Nn = (e, t) => {
|
|
9193
9205
|
const n = U.getState(e);
|
|
9194
9206
|
return n ? rn(t, n.type, n.binding.mapping) : null;
|
|
9195
|
-
},
|
|
9207
|
+
}, Kh = (e, t) => {
|
|
9196
9208
|
const n = U.getState(e);
|
|
9197
9209
|
return n ? de(n.doc, n.type, t, n.binding.mapping) || 0 : -1;
|
|
9198
9210
|
}, gs = (e, t) => {
|
|
@@ -9200,8 +9212,8 @@ var fs = (e, t) => {
|
|
|
9200
9212
|
for (; n != null && n.parentNode && n.parentNode !== e.dom; )
|
|
9201
9213
|
n = n.parentNode;
|
|
9202
9214
|
return n;
|
|
9203
|
-
},
|
|
9204
|
-
pluginKey: e =
|
|
9215
|
+
}, Kr = new te("dragHandle"), Wr = ({
|
|
9216
|
+
pluginKey: e = Kr,
|
|
9205
9217
|
element: t,
|
|
9206
9218
|
editor: n,
|
|
9207
9219
|
computePositionConfig: i,
|
|
@@ -9241,12 +9253,12 @@ var fs = (e, t) => {
|
|
|
9241
9253
|
t && (t.style.pointerEvents = "none");
|
|
9242
9254
|
}, 0);
|
|
9243
9255
|
}
|
|
9244
|
-
function
|
|
9256
|
+
function I(v) {
|
|
9245
9257
|
l == null || l(v), m(), t && (t.style.pointerEvents = "auto", t.dataset.dragging = "false");
|
|
9246
9258
|
}
|
|
9247
|
-
return t.addEventListener("dragstart", D), t.addEventListener("dragend",
|
|
9259
|
+
return t.addEventListener("dragstart", D), t.addEventListener("dragend", I), c.appendChild(t), {
|
|
9248
9260
|
unbind() {
|
|
9249
|
-
t.removeEventListener("dragstart", D), t.removeEventListener("dragend",
|
|
9261
|
+
t.removeEventListener("dragstart", D), t.removeEventListener("dragend", I), f && (cancelAnimationFrame(f), f = null, g = null);
|
|
9250
9262
|
},
|
|
9251
9263
|
plugin: new Ce({
|
|
9252
9264
|
key: typeof e == "string" ? new te(e) : e,
|
|
@@ -9260,7 +9272,7 @@ var fs = (e, t) => {
|
|
|
9260
9272
|
return m(), a = !1, d = null, h = -1, r == null || r({ editor: n, node: null, pos: -1 }), P;
|
|
9261
9273
|
if (v.docChanged && h !== -1 && t)
|
|
9262
9274
|
if (Br(v)) {
|
|
9263
|
-
const H =
|
|
9275
|
+
const H = Kh(x, u);
|
|
9264
9276
|
H !== h && (h = H);
|
|
9265
9277
|
} else {
|
|
9266
9278
|
const H = v.mapping.map(h);
|
|
@@ -9319,8 +9331,8 @@ var fs = (e, t) => {
|
|
|
9319
9331
|
return;
|
|
9320
9332
|
const H = v.posAtDOM(N, 0), et = ps(n.state.doc, H);
|
|
9321
9333
|
if (et !== d) {
|
|
9322
|
-
const
|
|
9323
|
-
d = et, h =
|
|
9334
|
+
const At = fs(n.state.doc, H);
|
|
9335
|
+
d = et, h = At, u = Nn(v.state, h), r == null || r({ editor: n, node: d, pos: h }), w(N), b();
|
|
9324
9336
|
}
|
|
9325
9337
|
})), !1;
|
|
9326
9338
|
}
|
|
@@ -9357,7 +9369,7 @@ ke.create({
|
|
|
9357
9369
|
addProseMirrorPlugins() {
|
|
9358
9370
|
const e = this.options.render();
|
|
9359
9371
|
return [
|
|
9360
|
-
|
|
9372
|
+
Wr({
|
|
9361
9373
|
computePositionConfig: { ...Qn, ...this.options.computePositionConfig },
|
|
9362
9374
|
getReferencedVirtualElement: this.options.getReferencedVirtualElement,
|
|
9363
9375
|
element: e,
|
|
@@ -9369,12 +9381,12 @@ ke.create({
|
|
|
9369
9381
|
];
|
|
9370
9382
|
}
|
|
9371
9383
|
});
|
|
9372
|
-
var
|
|
9384
|
+
var Wh = (e) => {
|
|
9373
9385
|
const {
|
|
9374
9386
|
className: t = "drag-handle",
|
|
9375
9387
|
children: n,
|
|
9376
9388
|
editor: i,
|
|
9377
|
-
pluginKey: s =
|
|
9389
|
+
pluginKey: s = Kr,
|
|
9378
9390
|
onNodeChange: r,
|
|
9379
9391
|
onElementDragStart: o,
|
|
9380
9392
|
onElementDragEnd: l,
|
|
@@ -9384,7 +9396,7 @@ var jh = (e) => {
|
|
|
9384
9396
|
let u = null;
|
|
9385
9397
|
return a ? i.isDestroyed ? () => {
|
|
9386
9398
|
h.current = null;
|
|
9387
|
-
} : (h.current || (u =
|
|
9399
|
+
} : (h.current || (u = Wr({
|
|
9388
9400
|
editor: i,
|
|
9389
9401
|
element: a,
|
|
9390
9402
|
pluginKey: s,
|
|
@@ -9410,9 +9422,9 @@ var jh = (e) => {
|
|
|
9410
9422
|
children: n
|
|
9411
9423
|
}
|
|
9412
9424
|
);
|
|
9413
|
-
},
|
|
9425
|
+
}, jh = Wh;
|
|
9414
9426
|
function iu() {
|
|
9415
|
-
var E, x, k, N, H, et,
|
|
9427
|
+
var E, x, k, N, H, et, At, Ot;
|
|
9416
9428
|
const e = Y(), t = Z(), { t: n } = X(), [i, s] = z(null), [r, o] = z(-1), [l, c] = z(!1), a = (x = (E = e == null ? void 0 : e.extensionManager) == null ? void 0 : E.extensions) == null ? void 0 : x.some((_) => (_ == null ? void 0 : _.name) === Mo.name), d = (N = (k = e == null ? void 0 : e.extensionManager) == null ? void 0 : k.extensions) == null ? void 0 : N.some((_) => (_ == null ? void 0 : _.name) === Po.name), h = (et = (H = e == null ? void 0 : e.extensionManager) == null ? void 0 : H.extensions) == null ? void 0 : et.some((_) => (_ == null ? void 0 : _.name) === Lo.name);
|
|
9417
9429
|
function u() {
|
|
9418
9430
|
const _ = e.chain();
|
|
@@ -9440,17 +9452,17 @@ function iu() {
|
|
|
9440
9452
|
function D() {
|
|
9441
9453
|
e.chain().setMeta("hideDragHandle", !0).setNodeSelection(r).deleteSelection().run();
|
|
9442
9454
|
}
|
|
9443
|
-
function
|
|
9455
|
+
function I({ node: _, pos: ft }) {
|
|
9444
9456
|
_ && s(_), o(ft);
|
|
9445
9457
|
}
|
|
9446
9458
|
function v() {
|
|
9447
9459
|
var _;
|
|
9448
9460
|
if (r !== -1) {
|
|
9449
|
-
const ft = (i == null ? void 0 : i.nodeSize) || 0, re = r + ft,
|
|
9450
|
-
e.chain().command(({ dispatch: vi, tr: Sn, state: Ci }) => vi ? (
|
|
9461
|
+
const ft = (i == null ? void 0 : i.nodeSize) || 0, re = r + ft, Kt = (i == null ? void 0 : i.type.name) === "paragraph" && ((_ = i == null ? void 0 : i.content) == null ? void 0 : _.size) === 0, jr = Kt ? r + 2 : re + 2;
|
|
9462
|
+
e.chain().command(({ dispatch: vi, tr: Sn, state: Ci }) => vi ? (Kt ? Sn.insertText("/", r, r + 1) : Sn.insert(
|
|
9451
9463
|
re,
|
|
9452
9464
|
Ci.schema.nodes.paragraph.create(null, [Ci.schema.text("/")])
|
|
9453
|
-
), vi(Sn)) : !0).focus(
|
|
9465
|
+
), vi(Sn)) : !0).focus(jr).run();
|
|
9454
9466
|
}
|
|
9455
9467
|
}
|
|
9456
9468
|
st(() => (l ? e.commands.setMeta("lockDragHandle", !0) : e.commands.setMeta("lockDragHandle", !1), () => {
|
|
@@ -9461,10 +9473,11 @@ function iu() {
|
|
|
9461
9473
|
};
|
|
9462
9474
|
return /* @__PURE__ */ S(M, { children: [
|
|
9463
9475
|
/* @__PURE__ */ p(
|
|
9464
|
-
|
|
9476
|
+
jh,
|
|
9465
9477
|
{
|
|
9466
9478
|
editor: e,
|
|
9467
|
-
onNodeChange:
|
|
9479
|
+
onNodeChange: I,
|
|
9480
|
+
pluginKey: "RichTextBubbleMenuDragHandle",
|
|
9468
9481
|
children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-0.5 richtext-duration-200 richtext-ease-in-out [transition-property:top,_left]", children: [
|
|
9469
9482
|
/* @__PURE__ */ p(
|
|
9470
9483
|
y,
|
|
@@ -9601,7 +9614,7 @@ function iu() {
|
|
|
9601
9614
|
mt,
|
|
9602
9615
|
{
|
|
9603
9616
|
className: "richtext-flex richtext-gap-3",
|
|
9604
|
-
disabled: ((
|
|
9617
|
+
disabled: ((At = i == null ? void 0 : i.attrs) == null ? void 0 : At.indent) >= Oi.max,
|
|
9605
9618
|
onClick: b,
|
|
9606
9619
|
children: [
|
|
9607
9620
|
/* @__PURE__ */ p(rt, { name: "IndentIncrease" }),
|
|
@@ -9633,9 +9646,9 @@ function iu() {
|
|
|
9633
9646
|
}
|
|
9634
9647
|
export {
|
|
9635
9648
|
zd as RichTextBubbleColumns,
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9649
|
+
Kd as RichTextBubbleDrawer,
|
|
9650
|
+
Wd as RichTextBubbleExcalidraw,
|
|
9651
|
+
jd as RichTextBubbleIframe,
|
|
9639
9652
|
Jd as RichTextBubbleImage,
|
|
9640
9653
|
qd as RichTextBubbleImageGif,
|
|
9641
9654
|
Yd as RichTextBubbleKatex,
|