@caspeco/casper-ui-library 9.10.0 → 9.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/accordion-recipe.js +1 -1
- package/dist/components/checkbox/checkbox-recipe.js +1 -1
- package/dist/components/drawer/drawer-recipe.js +1 -1
- package/dist/components/fieldset/fieldset-recipe.js +1 -1
- package/dist/components/form-control/form-control-recipe.js +1 -1
- package/dist/components/menu/menu-recipe.js +1 -1
- package/dist/components/modal/modal-recipe.js +1 -1
- package/dist/components/radio/radio-group-recipe.js +1 -1
- package/dist/components/rich-text-editor/boolean-control.js +1 -1
- package/dist/components/rich-text-editor/rich-text-editor-control.js +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.js +1 -1
- package/dist/components/rich-text-editor/use-rich-text-editor.js +1 -1
- package/dist/components/select/select-recipe.js +1 -1
- package/dist/components/switch/switch-recipe.js +1 -1
- package/dist/components/table/table-header-dropdown.d.ts.map +1 -1
- package/dist/components/table/table-header-dropdown.js +68 -66
- package/dist/components/tabs/tabs-recipe.js +1 -1
- package/dist/components/tag/tag-recipe.js +1 -1
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +83 -31
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +411 -226
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/lazy-measurements.js +33 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +29 -28
- package/dist/node_modules/@tiptap/core/dist/index.js +251 -90
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +3 -1
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +3 -1
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +3 -1
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js +5 -1
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +36 -8
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +13 -2
- package/dist/node_modules/@tiptap/extensions/dist/index.js +236 -229
- package/dist/{node_modules → packages/casper-ui-library/node_modules}/@tiptap/react/dist/index.js +12 -7
- package/package.json +13 -13
- package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox.anatomy.js +0 -5
- package/dist/node_modules/@ark-ui/react/dist/components/color-picker/color-picker.anatomy.js +0 -5
- package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox.anatomy.js +0 -5
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker.anatomy.js +0 -5
- package/dist/node_modules/@ark-ui/react/dist/components/field/field.anatomy.js +0 -15
- package/dist/node_modules/@ark-ui/react/dist/components/fieldset/fieldset.anatomy.js +0 -6
- package/dist/node_modules/@ark-ui/react/dist/components/listbox/listbox.anatomy.js +0 -2
- package/dist/node_modules/@chakra-ui/react/dist/esm/anatomy.js +0 -186
- package/dist/node_modules/@zag-js/accordion/dist/accordion.anatomy.js +0 -6
- package/dist/node_modules/@zag-js/anatomy/dist/create-anatomy.js +0 -26
- package/dist/node_modules/@zag-js/checkbox/dist/checkbox.anatomy.js +0 -6
- package/dist/node_modules/@zag-js/clipboard/dist/clipboard.anatomy.js +0 -6
- package/dist/node_modules/@zag-js/color-picker/dist/color-picker.anatomy.js +0 -31
- package/dist/node_modules/@zag-js/combobox/dist/combobox.anatomy.js +0 -21
- package/dist/node_modules/@zag-js/date-picker/dist/date-picker.anatomy.js +0 -31
- package/dist/node_modules/@zag-js/dialog/dist/dialog.anatomy.js +0 -14
- package/dist/node_modules/@zag-js/editable/dist/editable.anatomy.js +0 -16
- package/dist/node_modules/@zag-js/file-upload/dist/file-upload.anatomy.js +0 -19
- package/dist/node_modules/@zag-js/listbox/dist/listbox.anatomy.js +0 -17
- package/dist/node_modules/@zag-js/menu/dist/menu.anatomy.js +0 -21
- package/dist/node_modules/@zag-js/popover/dist/popover.anatomy.js +0 -17
- package/dist/node_modules/@zag-js/radio-group/dist/radio-group.anatomy.js +0 -13
- package/dist/node_modules/@zag-js/rating-group/dist/rating-group.anatomy.js +0 -6
- package/dist/node_modules/@zag-js/select/dist/select.anatomy.js +0 -22
- package/dist/node_modules/@zag-js/slider/dist/slider.anatomy.js +0 -17
- package/dist/node_modules/@zag-js/splitter/dist/splitter.anatomy.js +0 -6
- package/dist/node_modules/@zag-js/switch/dist/switch.anatomy.js +0 -6
|
@@ -207,7 +207,9 @@ var Ye = () => ({ editor: t, view: e }) => (requestAnimationFrame(() => {
|
|
|
207
207
|
function T(t, e) {
|
|
208
208
|
if (typeof t == "string") {
|
|
209
209
|
if (!e.nodes[t])
|
|
210
|
-
throw Error(
|
|
210
|
+
throw Error(
|
|
211
|
+
`There is no node type named '${t}'. Maybe you forgot to add the extension?`
|
|
212
|
+
);
|
|
211
213
|
return e.nodes[t];
|
|
212
214
|
}
|
|
213
215
|
return t;
|
|
@@ -283,7 +285,9 @@ function wt(t, e, n) {
|
|
|
283
285
|
function D(t, e) {
|
|
284
286
|
if (typeof t == "string") {
|
|
285
287
|
if (!e.marks[t])
|
|
286
|
-
throw Error(
|
|
288
|
+
throw Error(
|
|
289
|
+
`There is no mark type named '${t}'. Maybe you forgot to add the extension?`
|
|
290
|
+
);
|
|
287
291
|
return e.marks[t];
|
|
288
292
|
}
|
|
289
293
|
return t;
|
|
@@ -320,13 +324,23 @@ function Ut(t, e = null) {
|
|
|
320
324
|
if (e === "end")
|
|
321
325
|
return r;
|
|
322
326
|
const o = n.from, s = r.to;
|
|
323
|
-
return e === "all" ? O.create(
|
|
327
|
+
return e === "all" ? O.create(
|
|
328
|
+
t,
|
|
329
|
+
z(0, o, s),
|
|
330
|
+
z(t.content.size, o, s)
|
|
331
|
+
) : O.create(
|
|
332
|
+
t,
|
|
333
|
+
z(e, o, s),
|
|
334
|
+
z(e, o, s)
|
|
335
|
+
);
|
|
324
336
|
}
|
|
325
337
|
function Nt() {
|
|
326
338
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
327
339
|
}
|
|
328
340
|
function rt() {
|
|
329
|
-
return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(
|
|
341
|
+
return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(
|
|
342
|
+
navigator.platform
|
|
343
|
+
) || // iPad on iOS 13 detection
|
|
330
344
|
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
331
345
|
}
|
|
332
346
|
function hn() {
|
|
@@ -352,7 +366,11 @@ var gn = (t = null, e = {}) => ({ editor: n, view: r, tr: o, dispatch: s }) => {
|
|
|
352
366
|
return i(), !0;
|
|
353
367
|
const c = Ut(o.doc, t) || n.state.selection, a = n.state.selection.eq(c);
|
|
354
368
|
return s && (a || o.setSelection(c), a && o.storedMarks && o.setStoredMarks(o.storedMarks), i()), !0;
|
|
355
|
-
}, vn = (t, e) => (n) => t.every((r, o) => e(r, { ...n, index: o })), bn = (t, e) => ({ tr: n, commands: r }) => r.insertContentAt(
|
|
369
|
+
}, vn = (t, e) => (n) => t.every((r, o) => e(r, { ...n, index: o })), bn = (t, e) => ({ tr: n, commands: r }) => r.insertContentAt(
|
|
370
|
+
{ from: n.selection.from, to: n.selection.to },
|
|
371
|
+
t,
|
|
372
|
+
e
|
|
373
|
+
), qt = (t) => {
|
|
356
374
|
const e = t.childNodes;
|
|
357
375
|
for (let n = e.length - 1; n >= 0; n -= 1) {
|
|
358
376
|
const r = e[n];
|
|
@@ -362,7 +380,9 @@ var gn = (t = null, e = {}) => ({ editor: n, view: r, tr: o, dispatch: s }) => {
|
|
|
362
380
|
};
|
|
363
381
|
function U(t) {
|
|
364
382
|
if (typeof window > "u")
|
|
365
|
-
throw new Error(
|
|
383
|
+
throw new Error(
|
|
384
|
+
"[tiptap error]: there is no window object available, so this function cannot be used"
|
|
385
|
+
);
|
|
366
386
|
const e = `<body>${t}</body>`, n = new window.DOMParser().parseFromString(e, "text/html").body;
|
|
367
387
|
return qt(n);
|
|
368
388
|
}
|
|
@@ -407,7 +427,13 @@ function K(t, e, n) {
|
|
|
407
427
|
}
|
|
408
428
|
})
|
|
409
429
|
});
|
|
410
|
-
if (n.slice ? tt.fromSchema(a).parseSlice(
|
|
430
|
+
if (n.slice ? tt.fromSchema(a).parseSlice(
|
|
431
|
+
U(t),
|
|
432
|
+
n.parseOptions
|
|
433
|
+
) : tt.fromSchema(a).parse(
|
|
434
|
+
U(t),
|
|
435
|
+
n.parseOptions
|
|
436
|
+
), n.errorOnInvalidContent && i)
|
|
411
437
|
throw new Error("[tiptap error]: Invalid HTML content", {
|
|
412
438
|
cause: new Error(`Invalid element found: ${c}`)
|
|
413
439
|
});
|
|
@@ -595,7 +621,11 @@ var Dn = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
|
|
|
595
621
|
return n.selection.ranges.forEach((l) => {
|
|
596
622
|
r.doc.nodesBetween(l.$from.pos, l.$to.pos, (f, u) => {
|
|
597
623
|
s && s === f.type && (a = !0, o && n.setNodeMarkup(u, void 0, It(f.attrs, e))), i && f.marks.length && f.marks.forEach((p) => {
|
|
598
|
-
i === p.type && (a = !0, o && n.addMark(
|
|
624
|
+
i === p.type && (a = !0, o && n.addMark(
|
|
625
|
+
u,
|
|
626
|
+
u + f.nodeSize,
|
|
627
|
+
i.create(It(p.attrs, e))
|
|
628
|
+
));
|
|
599
629
|
});
|
|
600
630
|
});
|
|
601
631
|
}), a;
|
|
@@ -686,7 +716,11 @@ function xt(t) {
|
|
|
686
716
|
name: e.name,
|
|
687
717
|
options: e.options,
|
|
688
718
|
storage: e.storage
|
|
689
|
-
}, r = b(
|
|
719
|
+
}, r = b(
|
|
720
|
+
e,
|
|
721
|
+
"addExtensions",
|
|
722
|
+
n
|
|
723
|
+
);
|
|
690
724
|
return r ? [e, ...xt(r())] : e;
|
|
691
725
|
}).flat(10);
|
|
692
726
|
}
|
|
@@ -704,7 +738,9 @@ function Kn(t = {}) {
|
|
|
704
738
|
return Object.keys(t).length === 0 && t.constructor === Object;
|
|
705
739
|
}
|
|
706
740
|
function V(t) {
|
|
707
|
-
const e = t.filter(
|
|
741
|
+
const e = t.filter(
|
|
742
|
+
(o) => o.type === "extension"
|
|
743
|
+
), n = t.filter((o) => o.type === "node"), r = t.filter((o) => o.type === "mark");
|
|
708
744
|
return {
|
|
709
745
|
baseExtensions: e,
|
|
710
746
|
nodeExtensions: n,
|
|
@@ -754,11 +790,7 @@ function Zt(t) {
|
|
|
754
790
|
name: l.name,
|
|
755
791
|
options: l.options,
|
|
756
792
|
storage: l.storage
|
|
757
|
-
}, u = b(
|
|
758
|
-
l,
|
|
759
|
-
"addAttributes",
|
|
760
|
-
f
|
|
761
|
-
);
|
|
793
|
+
}, u = b(l, "addAttributes", f);
|
|
762
794
|
if (!u)
|
|
763
795
|
return;
|
|
764
796
|
const p = u();
|
|
@@ -827,10 +859,15 @@ function Zn(...t) {
|
|
|
827
859
|
return;
|
|
828
860
|
}
|
|
829
861
|
if (o === "class") {
|
|
830
|
-
const c = s ? String(s).split(" ") : [], a = r[o] ? r[o].split(" ") : [], l = c.filter(
|
|
862
|
+
const c = s ? String(s).split(" ") : [], a = r[o] ? r[o].split(" ") : [], l = c.filter(
|
|
863
|
+
(f) => !a.includes(f)
|
|
864
|
+
);
|
|
831
865
|
r[o] = [...a, ...l].join(" ");
|
|
832
866
|
} else if (o === "style") {
|
|
833
|
-
const c = new Map([
|
|
867
|
+
const c = new Map([
|
|
868
|
+
...Ot(r[o]),
|
|
869
|
+
...Ot(s)
|
|
870
|
+
]);
|
|
834
871
|
r[o] = Array.from(c.entries()).map(([a, l]) => `${a}: ${l}`).join("; ");
|
|
835
872
|
} else
|
|
836
873
|
r[o] = s;
|
|
@@ -878,72 +915,122 @@ function Gt(t, e) {
|
|
|
878
915
|
var n;
|
|
879
916
|
const r = Zt(t), { nodeExtensions: o, markExtensions: s } = V(t), i = (n = o.find((l) => b(l, "topNode"))) == null ? void 0 : n.name, c = Object.fromEntries(
|
|
880
917
|
o.map((l) => {
|
|
881
|
-
const f = r.filter(
|
|
918
|
+
const f = r.filter(
|
|
919
|
+
(v) => v.type === l.name
|
|
920
|
+
), u = {
|
|
882
921
|
name: l.name,
|
|
883
922
|
options: l.options,
|
|
884
923
|
storage: l.storage,
|
|
885
924
|
editor: e
|
|
886
925
|
}, p = t.reduce((v, y) => {
|
|
887
|
-
const w = b(
|
|
926
|
+
const w = b(
|
|
927
|
+
y,
|
|
928
|
+
"extendNodeSchema",
|
|
929
|
+
u
|
|
930
|
+
);
|
|
888
931
|
return {
|
|
889
932
|
...v,
|
|
890
933
|
...w ? w(l) : {}
|
|
891
934
|
};
|
|
892
935
|
}, {}), d = Bt({
|
|
893
936
|
...p,
|
|
894
|
-
content: M(
|
|
937
|
+
content: M(
|
|
938
|
+
b(l, "content", u)
|
|
939
|
+
),
|
|
895
940
|
marks: M(b(l, "marks", u)),
|
|
896
941
|
group: M(b(l, "group", u)),
|
|
897
942
|
inline: M(b(l, "inline", u)),
|
|
898
943
|
atom: M(b(l, "atom", u)),
|
|
899
|
-
selectable: M(
|
|
900
|
-
|
|
944
|
+
selectable: M(
|
|
945
|
+
b(l, "selectable", u)
|
|
946
|
+
),
|
|
947
|
+
draggable: M(
|
|
948
|
+
b(l, "draggable", u)
|
|
949
|
+
),
|
|
901
950
|
code: M(b(l, "code", u)),
|
|
902
|
-
whitespace: M(
|
|
951
|
+
whitespace: M(
|
|
952
|
+
b(l, "whitespace", u)
|
|
953
|
+
),
|
|
903
954
|
linebreakReplacement: M(
|
|
904
|
-
b(
|
|
955
|
+
b(
|
|
956
|
+
l,
|
|
957
|
+
"linebreakReplacement",
|
|
958
|
+
u
|
|
959
|
+
)
|
|
960
|
+
),
|
|
961
|
+
defining: M(
|
|
962
|
+
b(l, "defining", u)
|
|
963
|
+
),
|
|
964
|
+
isolating: M(
|
|
965
|
+
b(l, "isolating", u)
|
|
905
966
|
),
|
|
906
|
-
defining: M(b(l, "defining", u)),
|
|
907
|
-
isolating: M(b(l, "isolating", u)),
|
|
908
967
|
attrs: Object.fromEntries(f.map(Dt))
|
|
909
|
-
}), h = M(
|
|
968
|
+
}), h = M(
|
|
969
|
+
b(l, "parseHTML", u)
|
|
970
|
+
);
|
|
910
971
|
h && (d.parseDOM = h.map(
|
|
911
972
|
(v) => Rt(v, f)
|
|
912
973
|
));
|
|
913
|
-
const m = b(
|
|
974
|
+
const m = b(
|
|
975
|
+
l,
|
|
976
|
+
"renderHTML",
|
|
977
|
+
u
|
|
978
|
+
);
|
|
914
979
|
m && (d.toDOM = (v) => m({
|
|
915
980
|
node: v,
|
|
916
981
|
HTMLAttributes: ot(v, f)
|
|
917
982
|
}));
|
|
918
|
-
const g = b(
|
|
983
|
+
const g = b(
|
|
984
|
+
l,
|
|
985
|
+
"renderText",
|
|
986
|
+
u
|
|
987
|
+
);
|
|
919
988
|
return g && (d.toText = g), [l.name, d];
|
|
920
989
|
})
|
|
921
990
|
), a = Object.fromEntries(
|
|
922
991
|
s.map((l) => {
|
|
923
|
-
const f = r.filter(
|
|
992
|
+
const f = r.filter(
|
|
993
|
+
(g) => g.type === l.name
|
|
994
|
+
), u = {
|
|
924
995
|
name: l.name,
|
|
925
996
|
options: l.options,
|
|
926
997
|
storage: l.storage,
|
|
927
998
|
editor: e
|
|
928
999
|
}, p = t.reduce((g, v) => {
|
|
929
|
-
const y = b(
|
|
1000
|
+
const y = b(
|
|
1001
|
+
v,
|
|
1002
|
+
"extendMarkSchema",
|
|
1003
|
+
u
|
|
1004
|
+
);
|
|
930
1005
|
return {
|
|
931
1006
|
...g,
|
|
932
1007
|
...y ? y(l) : {}
|
|
933
1008
|
};
|
|
934
1009
|
}, {}), d = Bt({
|
|
935
1010
|
...p,
|
|
936
|
-
inclusive: M(
|
|
937
|
-
|
|
1011
|
+
inclusive: M(
|
|
1012
|
+
b(l, "inclusive", u)
|
|
1013
|
+
),
|
|
1014
|
+
excludes: M(
|
|
1015
|
+
b(l, "excludes", u)
|
|
1016
|
+
),
|
|
938
1017
|
group: M(b(l, "group", u)),
|
|
939
|
-
spanning: M(
|
|
1018
|
+
spanning: M(
|
|
1019
|
+
b(l, "spanning", u)
|
|
1020
|
+
),
|
|
940
1021
|
code: M(b(l, "code", u)),
|
|
941
1022
|
attrs: Object.fromEntries(f.map(Dt))
|
|
942
|
-
}), h = M(
|
|
1023
|
+
}), h = M(
|
|
1024
|
+
b(l, "parseHTML", u)
|
|
1025
|
+
);
|
|
943
1026
|
h && (d.parseDOM = h.map(
|
|
944
1027
|
(g) => Rt(g, f)
|
|
945
1028
|
));
|
|
946
|
-
const m = b(
|
|
1029
|
+
const m = b(
|
|
1030
|
+
l,
|
|
1031
|
+
"renderHTML",
|
|
1032
|
+
u
|
|
1033
|
+
);
|
|
947
1034
|
return m && (d.toDOM = (g) => m({
|
|
948
1035
|
mark: g,
|
|
949
1036
|
HTMLAttributes: ot(g, f)
|
|
@@ -1112,16 +1199,20 @@ function et(t, e, n) {
|
|
|
1112
1199
|
var sr = (t, e = 500) => {
|
|
1113
1200
|
let n = "";
|
|
1114
1201
|
const r = t.parentOffset;
|
|
1115
|
-
return t.parent.nodesBetween(
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1202
|
+
return t.parent.nodesBetween(
|
|
1203
|
+
Math.max(0, r - e),
|
|
1204
|
+
r,
|
|
1205
|
+
(o, s, i, c) => {
|
|
1206
|
+
var a, l;
|
|
1207
|
+
const f = ((l = (a = o.type.spec).toText) == null ? void 0 : l.call(a, {
|
|
1208
|
+
node: o,
|
|
1209
|
+
pos: s,
|
|
1210
|
+
parent: i,
|
|
1211
|
+
index: c
|
|
1212
|
+
})) || o.textContent || "%leaf%";
|
|
1213
|
+
n += o.isAtom && !o.isText ? f : f.slice(0, Math.max(0, r - s));
|
|
1214
|
+
}
|
|
1215
|
+
), n;
|
|
1125
1216
|
};
|
|
1126
1217
|
function vt(t, e, n = {}) {
|
|
1127
1218
|
const { empty: r, ranges: o } = t.selection, s = e ? D(e, t.schema) : null;
|
|
@@ -1329,7 +1420,11 @@ function _t(t, e) {
|
|
|
1329
1420
|
}
|
|
1330
1421
|
}
|
|
1331
1422
|
var vr = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor: o }) => {
|
|
1332
|
-
const { selection: s, doc: i } = e, { $from: c, $to: a } = s, l = o.extensionManager.attributes, f = et(
|
|
1423
|
+
const { selection: s, doc: i } = e, { $from: c, $to: a } = s, l = o.extensionManager.attributes, f = et(
|
|
1424
|
+
l,
|
|
1425
|
+
c.node().type.name,
|
|
1426
|
+
c.node().attrs
|
|
1427
|
+
);
|
|
1333
1428
|
if (s instanceof st && s.node.isBlock)
|
|
1334
1429
|
return !c.parentOffset || !X(i, c.pos) ? !1 : (r && (t && _t(n, o.extensionManager.splittableMarks), e.split(c.pos).scrollIntoView()), !0);
|
|
1335
1430
|
if (!c.parent.isBlock)
|
|
@@ -1372,7 +1467,7 @@ var vr = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor
|
|
|
1372
1467
|
for (let A = a.depth - y; A >= a.depth - 3; A -= 1)
|
|
1373
1468
|
v = j.from(a.node(A).copy(v));
|
|
1374
1469
|
const w = (
|
|
1375
|
-
//
|
|
1470
|
+
// oxlint-disable-next-line no-nested-ternary
|
|
1376
1471
|
a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3
|
|
1377
1472
|
), x = {
|
|
1378
1473
|
...et(p, a.node().type.name, a.node().attrs),
|
|
@@ -1605,7 +1700,9 @@ var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: c, chain:
|
|
|
1605
1700
|
if (!n)
|
|
1606
1701
|
return null;
|
|
1607
1702
|
const r = [n.text];
|
|
1608
|
-
return r.index = n.index, r.input = t, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn(
|
|
1703
|
+
return r.index = n.index, r.input = t, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn(
|
|
1704
|
+
'[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'
|
|
1705
|
+
), r.push(n.replaceWith)), r;
|
|
1609
1706
|
};
|
|
1610
1707
|
function Z(t) {
|
|
1611
1708
|
var e;
|
|
@@ -1750,7 +1847,7 @@ var Et = class {
|
|
|
1750
1847
|
b(this, "addOptions", {
|
|
1751
1848
|
name: this.name
|
|
1752
1849
|
})
|
|
1753
|
-
)
|
|
1850
|
+
)
|
|
1754
1851
|
};
|
|
1755
1852
|
}
|
|
1756
1853
|
get storage() {
|
|
@@ -1760,7 +1857,7 @@ var Et = class {
|
|
|
1760
1857
|
name: this.name,
|
|
1761
1858
|
options: this.options
|
|
1762
1859
|
})
|
|
1763
|
-
)
|
|
1860
|
+
)
|
|
1764
1861
|
};
|
|
1765
1862
|
}
|
|
1766
1863
|
configure(t = {}) {
|
|
@@ -1818,7 +1915,9 @@ var jr = class {
|
|
|
1818
1915
|
const r = e(t, n);
|
|
1819
1916
|
return r ? r.map((o) => {
|
|
1820
1917
|
const s = [o.text];
|
|
1821
|
-
return s.index = o.index, s.input = t, s.data = o.data, o.replaceWith && (o.text.includes(o.replaceWith) || console.warn(
|
|
1918
|
+
return s.index = o.index, s.input = t, s.data = o.data, o.replaceWith && (o.text.includes(o.replaceWith) || console.warn(
|
|
1919
|
+
'[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'
|
|
1920
|
+
), s.push(o.replaceWith)), s;
|
|
1822
1921
|
}) : [];
|
|
1823
1922
|
};
|
|
1824
1923
|
function Lr(t) {
|
|
@@ -1919,7 +2018,10 @@ function Fr(t) {
|
|
|
1919
2018
|
const d = Y;
|
|
1920
2019
|
d?.isEditable && setTimeout(() => {
|
|
1921
2020
|
const h = d.state.selection;
|
|
1922
|
-
h && d.commands.deleteRange({
|
|
2021
|
+
h && d.commands.deleteRange({
|
|
2022
|
+
from: h.from,
|
|
2023
|
+
to: h.to
|
|
2024
|
+
});
|
|
1923
2025
|
}, 10);
|
|
1924
2026
|
}
|
|
1925
2027
|
return !1;
|
|
@@ -1975,7 +2077,11 @@ var ft = class {
|
|
|
1975
2077
|
storage: this.editor.extensionStorage[e.name],
|
|
1976
2078
|
editor: this.editor,
|
|
1977
2079
|
type: W(e.name, this.schema)
|
|
1978
|
-
}, r = b(
|
|
2080
|
+
}, r = b(
|
|
2081
|
+
e,
|
|
2082
|
+
"addCommands",
|
|
2083
|
+
n
|
|
2084
|
+
);
|
|
1979
2085
|
return r ? {
|
|
1980
2086
|
...t,
|
|
1981
2087
|
...r()
|
|
@@ -2009,7 +2115,11 @@ var ft = class {
|
|
|
2009
2115
|
}
|
|
2010
2116
|
const a = Ze(c);
|
|
2011
2117
|
s.push(a);
|
|
2012
|
-
const l = b(
|
|
2118
|
+
const l = b(
|
|
2119
|
+
r,
|
|
2120
|
+
"addInputRules",
|
|
2121
|
+
o
|
|
2122
|
+
);
|
|
2013
2123
|
if (jt(r, t.options.enableInputRules) && l) {
|
|
2014
2124
|
const p = l();
|
|
2015
2125
|
if (p && p.length) {
|
|
@@ -2020,7 +2130,11 @@ var ft = class {
|
|
|
2020
2130
|
s.push(...h);
|
|
2021
2131
|
}
|
|
2022
2132
|
}
|
|
2023
|
-
const f = b(
|
|
2133
|
+
const f = b(
|
|
2134
|
+
r,
|
|
2135
|
+
"addPasteRules",
|
|
2136
|
+
o
|
|
2137
|
+
);
|
|
2024
2138
|
if (jt(r, t.options.enablePasteRules) && f) {
|
|
2025
2139
|
const p = f();
|
|
2026
2140
|
if (p && p.length) {
|
|
@@ -2055,13 +2169,19 @@ var ft = class {
|
|
|
2055
2169
|
const { editor: t } = this, { nodeExtensions: e } = V(this.extensions);
|
|
2056
2170
|
return Object.fromEntries(
|
|
2057
2171
|
e.filter((n) => !!b(n, "addNodeView")).map((n) => {
|
|
2058
|
-
const r = this.attributes.filter(
|
|
2172
|
+
const r = this.attributes.filter(
|
|
2173
|
+
(a) => a.type === n.name
|
|
2174
|
+
), o = {
|
|
2059
2175
|
name: n.name,
|
|
2060
2176
|
options: n.options,
|
|
2061
2177
|
storage: this.editor.extensionStorage[n.name],
|
|
2062
2178
|
editor: t,
|
|
2063
2179
|
type: T(n.name, this.schema)
|
|
2064
|
-
}, s = b(
|
|
2180
|
+
}, s = b(
|
|
2181
|
+
n,
|
|
2182
|
+
"addNodeView",
|
|
2183
|
+
o
|
|
2184
|
+
);
|
|
2065
2185
|
if (!s)
|
|
2066
2186
|
return [];
|
|
2067
2187
|
const i = s();
|
|
@@ -2142,13 +2262,19 @@ var ft = class {
|
|
|
2142
2262
|
const { editor: t } = this, { markExtensions: e } = V(this.extensions);
|
|
2143
2263
|
return Object.fromEntries(
|
|
2144
2264
|
e.filter((n) => !!b(n, "addMarkView")).map((n) => {
|
|
2145
|
-
const r = this.attributes.filter(
|
|
2265
|
+
const r = this.attributes.filter(
|
|
2266
|
+
(c) => c.type === n.name
|
|
2267
|
+
), o = {
|
|
2146
2268
|
name: n.name,
|
|
2147
2269
|
options: n.options,
|
|
2148
2270
|
storage: this.editor.extensionStorage[n.name],
|
|
2149
2271
|
editor: t,
|
|
2150
2272
|
type: D(n.name, this.schema)
|
|
2151
|
-
}, s = b(
|
|
2273
|
+
}, s = b(
|
|
2274
|
+
n,
|
|
2275
|
+
"addMarkView",
|
|
2276
|
+
o
|
|
2277
|
+
);
|
|
2152
2278
|
if (!s)
|
|
2153
2279
|
return [];
|
|
2154
2280
|
const i = (c, a, l) => {
|
|
@@ -2212,11 +2338,19 @@ var ft = class {
|
|
|
2212
2338
|
type: W(e.name, this.schema)
|
|
2213
2339
|
};
|
|
2214
2340
|
e.type === "mark" && ((n = M(b(e, "keepOnSplit", r))) == null || n) && this.splittableMarks.push(e.name);
|
|
2215
|
-
const o = b(
|
|
2341
|
+
const o = b(
|
|
2342
|
+
e,
|
|
2343
|
+
"onBeforeCreate",
|
|
2344
|
+
r
|
|
2345
|
+
), s = b(e, "onCreate", r), i = b(e, "onUpdate", r), c = b(
|
|
2216
2346
|
e,
|
|
2217
2347
|
"onSelectionUpdate",
|
|
2218
2348
|
r
|
|
2219
|
-
), a = b(
|
|
2349
|
+
), a = b(
|
|
2350
|
+
e,
|
|
2351
|
+
"onTransaction",
|
|
2352
|
+
r
|
|
2353
|
+
), l = b(e, "onFocus", r), f = b(e, "onBlur", r), u = b(e, "onDestroy", r);
|
|
2220
2354
|
o && this.editor.on("beforeCreate", o), s && this.editor.on("create", s), i && this.editor.on("update", i), c && this.editor.on("selectionUpdate", c), a && this.editor.on("transaction", a), l && this.editor.on("focus", l), f && this.editor.on("blur", f), u && this.editor.on("destroy", u);
|
|
2221
2355
|
});
|
|
2222
2356
|
}
|
|
@@ -2295,25 +2429,32 @@ var B = class ie extends Et {
|
|
|
2295
2429
|
var i, c, a, l;
|
|
2296
2430
|
if ((l = (a = (c = (i = this.editor.options.coreExtensionOptions) == null ? void 0 : i.delete) == null ? void 0 : c.filterTransaction) == null ? void 0 : a.call(c, t)) != null ? l : t.getMeta("y-sync$"))
|
|
2297
2431
|
return;
|
|
2298
|
-
const f = Un(t.before, [
|
|
2432
|
+
const f = Un(t.before, [
|
|
2433
|
+
t,
|
|
2434
|
+
...e
|
|
2435
|
+
]);
|
|
2299
2436
|
or(f).forEach((d) => {
|
|
2300
|
-
f.mapping.mapResult(d.oldRange.from).deletedAfter && f.mapping.mapResult(d.oldRange.to).deletedBefore && f.before.nodesBetween(
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2437
|
+
f.mapping.mapResult(d.oldRange.from).deletedAfter && f.mapping.mapResult(d.oldRange.to).deletedBefore && f.before.nodesBetween(
|
|
2438
|
+
d.oldRange.from,
|
|
2439
|
+
d.oldRange.to,
|
|
2440
|
+
(h, m) => {
|
|
2441
|
+
const g = m + h.nodeSize - 2, v = d.oldRange.from <= m && g <= d.oldRange.to;
|
|
2442
|
+
this.editor.emit("delete", {
|
|
2443
|
+
type: "node",
|
|
2444
|
+
node: h,
|
|
2445
|
+
from: m,
|
|
2446
|
+
to: g,
|
|
2447
|
+
newFrom: f.mapping.map(m),
|
|
2448
|
+
newTo: f.mapping.map(g),
|
|
2449
|
+
deletedRange: d.oldRange,
|
|
2450
|
+
newRange: d.newRange,
|
|
2451
|
+
partial: !v,
|
|
2452
|
+
editor: this.editor,
|
|
2453
|
+
transaction: t,
|
|
2454
|
+
combinedTransform: f
|
|
2455
|
+
});
|
|
2456
|
+
}
|
|
2457
|
+
);
|
|
2317
2458
|
});
|
|
2318
2459
|
const p = f.mapping;
|
|
2319
2460
|
f.steps.forEach((d, h) => {
|
|
@@ -2457,7 +2598,9 @@ var B = class ie extends Et {
|
|
|
2457
2598
|
appendTransaction: (t, e, n) => {
|
|
2458
2599
|
if (t.some((m) => m.getMeta("composition")))
|
|
2459
2600
|
return;
|
|
2460
|
-
const r = t.some((m) => m.docChanged) && !e.doc.eq(n.doc), o = t.some(
|
|
2601
|
+
const r = t.some((m) => m.docChanged) && !e.doc.eq(n.doc), o = t.some(
|
|
2602
|
+
(m) => m.getMeta("preventClearDocument")
|
|
2603
|
+
);
|
|
2461
2604
|
if (!r || o)
|
|
2462
2605
|
return;
|
|
2463
2606
|
const { empty: s, from: i, to: c } = e.selection, a = F.atStart(e.doc).from, l = F.atEnd(e.doc).to;
|
|
@@ -2585,7 +2728,9 @@ var B = class ie extends Et {
|
|
|
2585
2728
|
let n = this.from, r = this.to;
|
|
2586
2729
|
if (this.isBlock) {
|
|
2587
2730
|
if (this.content.size === 0) {
|
|
2588
|
-
console.error(
|
|
2731
|
+
console.error(
|
|
2732
|
+
`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`
|
|
2733
|
+
);
|
|
2589
2734
|
return;
|
|
2590
2735
|
}
|
|
2591
2736
|
n = this.from + 1, r = this.to - 1;
|
|
@@ -2636,7 +2781,12 @@ var B = class ie extends Et {
|
|
|
2636
2781
|
const a = this.resolvedPos.doc.resolve(c);
|
|
2637
2782
|
if (!o && !i && a.depth <= this.depth)
|
|
2638
2783
|
return;
|
|
2639
|
-
const l = new q(
|
|
2784
|
+
const l = new q(
|
|
2785
|
+
a,
|
|
2786
|
+
this.editor,
|
|
2787
|
+
o,
|
|
2788
|
+
o || i ? n : null
|
|
2789
|
+
);
|
|
2640
2790
|
o && (l.actualDepth = this.depth + 1), e.push(l);
|
|
2641
2791
|
}), e;
|
|
2642
2792
|
}
|
|
@@ -2673,7 +2823,9 @@ var B = class ie extends Et {
|
|
|
2673
2823
|
return o;
|
|
2674
2824
|
const s = Object.keys(n);
|
|
2675
2825
|
return this.children.forEach((i) => {
|
|
2676
|
-
r && o.length > 0 || (i.node.type.name === e && s.every(
|
|
2826
|
+
r && o.length > 0 || (i.node.type.name === e && s.every(
|
|
2827
|
+
(a) => n[a] === i.node.attrs[a]
|
|
2828
|
+
) && o.push(i), !(r && o.length > 0) && (o = o.concat(i.querySelectorAll(e, n, r))));
|
|
2677
2829
|
}), o;
|
|
2678
2830
|
}
|
|
2679
2831
|
setAttribute(e) {
|
|
@@ -3010,13 +3162,17 @@ var go = class extends Nr {
|
|
|
3010
3162
|
errorOnInvalidContent: this.options.enableContentCheck
|
|
3011
3163
|
});
|
|
3012
3164
|
} catch (e) {
|
|
3013
|
-
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(
|
|
3165
|
+
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(
|
|
3166
|
+
e.message
|
|
3167
|
+
))
|
|
3014
3168
|
throw e;
|
|
3015
3169
|
this.emit("contentError", {
|
|
3016
3170
|
editor: this,
|
|
3017
3171
|
error: e,
|
|
3018
3172
|
disableCollaboration: () => {
|
|
3019
|
-
"collaboration" in this.storage && typeof this.storage.collaboration == "object" && this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter(
|
|
3173
|
+
"collaboration" in this.storage && typeof this.storage.collaboration == "object" && this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter(
|
|
3174
|
+
(n) => n.name !== "collaboration"
|
|
3175
|
+
), this.createExtensionManager();
|
|
3020
3176
|
}
|
|
3021
3177
|
}), t = gt(this.options.content, this.schema, this.options.parseOptions, {
|
|
3022
3178
|
errorOnInvalidContent: !1
|
|
@@ -3107,12 +3263,12 @@ var go = class extends Nr {
|
|
|
3107
3263
|
c && this.emit("focus", {
|
|
3108
3264
|
editor: this,
|
|
3109
3265
|
event: c.event,
|
|
3110
|
-
//
|
|
3266
|
+
// oxlint-disable-next-lineno-non-null-assertion
|
|
3111
3267
|
transaction: i
|
|
3112
3268
|
}), a && this.emit("blur", {
|
|
3113
3269
|
editor: this,
|
|
3114
3270
|
event: a.event,
|
|
3115
|
-
//
|
|
3271
|
+
// oxlint-disable-next-lineno-non-null-assertion
|
|
3116
3272
|
transaction: i
|
|
3117
3273
|
}), !(t.getMeta("preventUpdate") || !n.some((l) => l.docChanged) || s.doc.eq(e.doc)) && this.emit("update", {
|
|
3118
3274
|
editor: this,
|
|
@@ -3227,7 +3383,10 @@ function bo(t) {
|
|
|
3227
3383
|
s.insertText(u, i + r[0].length - 1), s.replaceWith(f, c, a);
|
|
3228
3384
|
} else if (r[0]) {
|
|
3229
3385
|
const l = t.type.isInline ? i : i - 1;
|
|
3230
|
-
s.insert(l, t.type.create(o)).delete(
|
|
3386
|
+
s.insert(l, t.type.create(o)).delete(
|
|
3387
|
+
s.mapping.map(i),
|
|
3388
|
+
s.mapping.map(c)
|
|
3389
|
+
);
|
|
3231
3390
|
}
|
|
3232
3391
|
s.scrollIntoView();
|
|
3233
3392
|
},
|
|
@@ -3523,7 +3682,9 @@ function Gr(t) {
|
|
|
3523
3682
|
return m !== void 0 ? m : -1;
|
|
3524
3683
|
},
|
|
3525
3684
|
tokenize(p, d, h) {
|
|
3526
|
-
const m = c ? new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`) : new RegExp(
|
|
3685
|
+
const m = c ? new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`) : new RegExp(
|
|
3686
|
+
`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`
|
|
3687
|
+
), g = p.match(m);
|
|
3527
3688
|
if (!g)
|
|
3528
3689
|
return;
|
|
3529
3690
|
let v = "", y = "";
|
|
@@ -5,7 +5,9 @@ var t = (e, n) => {
|
|
|
5
5
|
return e(n);
|
|
6
6
|
const { children: r, ...s } = n ?? {};
|
|
7
7
|
if (e === "svg")
|
|
8
|
-
throw new Error(
|
|
8
|
+
throw new Error(
|
|
9
|
+
"SVG elements are not supported in the JSX syntax, use the array syntax instead"
|
|
10
|
+
);
|
|
9
11
|
return [e, s, r];
|
|
10
12
|
};
|
|
11
13
|
export {
|
|
@@ -203,7 +203,9 @@ var y = 4, M = /^```([a-z]+)?[\s\n]$/, N = /^~~~([a-z]+)?[\s\n]$/, _ = C.create(
|
|
|
203
203
|
return !1;
|
|
204
204
|
const { tr: s, schema: i } = e.state, l = i.text(r.replace(/\r\n?/g, `
|
|
205
205
|
`));
|
|
206
|
-
return s.replaceSelectionWith(this.type.create({ language: o }, l)), s.selection.$from.parent.type !== this.type && s.setSelection(
|
|
206
|
+
return s.replaceSelectionWith(this.type.create({ language: o }, l)), s.selection.$from.parent.type !== this.type && s.setSelection(
|
|
207
|
+
T.near(s.doc.resolve(Math.max(0, s.selection.from - 2)))
|
|
208
|
+
), s.setMeta("paste", !0), e.dispatch(s), !0;
|
|
207
209
|
}
|
|
208
210
|
}
|
|
209
211
|
})
|