@caspeco/casper-ui-library 12.1.0 → 12.1.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/_virtual/builtin_esm-external-require-react.js +1 -1
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/combobox.js +88 -93
- package/dist/components/image-upload/image-cropper.js +1 -1
- package/dist/components/image-upload/image-upload-dropzone.js +2 -6
- package/dist/components/menu/menu-group.js +0 -1
- package/dist/components/rich-text-editor/rich-text-editor-control.js +2 -6
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +1 -1
- package/dist/node_modules/@dnd-kit/abstract/index.js +1 -1
- package/dist/node_modules/@dnd-kit/dom/index.js +11 -16
- package/dist/node_modules/@dnd-kit/dom/sortable.js +4 -4
- package/dist/node_modules/@dnd-kit/dom/utilities.js +2 -6
- package/dist/node_modules/@dnd-kit/react/hooks.js +2 -5
- package/dist/node_modules/@dnd-kit/react/sortable.js +4 -4
- package/dist/node_modules/@tanstack/table-core/build/lib/index.js +16 -30
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +9 -18
- package/dist/node_modules/@tiptap/core/dist/index.js +838 -790
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +14 -3
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +114 -97
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +133 -120
- package/dist/node_modules/@tiptap/extensions/dist/index.js +33 -33
- package/dist/node_modules/country-flag-icons/modules/react/3x2/index.js +1 -2
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +1 -1
- package/dist/node_modules/date-fns/getISOWeek.js +1 -1
- package/dist/node_modules/date-fns/getWeek.js +1 -1
- package/dist/node_modules/libphonenumber-js/es6-modern/metadata.js +1 -1
- package/dist/node_modules/prosemirror-commands/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js +2 -6
- package/dist/node_modules/prosemirror-history/dist/index.js +27 -22
- package/dist/node_modules/prosemirror-model/dist/index.js +32 -35
- package/dist/node_modules/prosemirror-view/dist/index.js +10 -11
- package/dist/packages/casper-ui-library/node_modules/@tiptap/react/dist/index.js +74 -57
- package/package.json +13 -13
|
@@ -91,17 +91,17 @@ var g = "listItem", _ = "textStyle", v = /^\s*([-+*])\s$/, y = i.create({
|
|
|
91
91
|
d.delete(c, c + s.nodeSize);
|
|
92
92
|
let f = d.mapping.map(l);
|
|
93
93
|
return d.insert(f, e.from(u)), d.setSelection(o.map(d.doc, d.mapping)), n && n(d), !0;
|
|
94
|
-
},
|
|
94
|
+
}, ne = (e, t, n) => te(e.state, e.view.dispatch, t, n), b = (e, t) => r.create({
|
|
95
95
|
name: `${e}BranchingDeleteKeymap`,
|
|
96
96
|
priority: 101,
|
|
97
97
|
addKeyboardShortcuts() {
|
|
98
|
-
let n = () =>
|
|
98
|
+
let n = () => ne(this.editor, e, t);
|
|
99
99
|
return {
|
|
100
100
|
Delete: n,
|
|
101
101
|
"Mod-Delete": n
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
}),
|
|
104
|
+
}), x = [
|
|
105
105
|
[1e3, "m"],
|
|
106
106
|
[900, "cm"],
|
|
107
107
|
[500, "d"],
|
|
@@ -115,20 +115,20 @@ var g = "listItem", _ = "textStyle", v = /^\s*([-+*])\s$/, y = i.create({
|
|
|
115
115
|
[5, "v"],
|
|
116
116
|
[4, "iv"],
|
|
117
117
|
[1, "i"]
|
|
118
|
-
],
|
|
119
|
-
function
|
|
118
|
+
], S = "abcdefghijklmnopqrstuvwxyz", C = String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;
|
|
119
|
+
function w(e) {
|
|
120
120
|
let t = e, n = "";
|
|
121
|
-
for (let [e, r] of
|
|
121
|
+
for (let [e, r] of x) for (; t >= e;) n += r, t -= e;
|
|
122
122
|
return n;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
return
|
|
124
|
+
function T(e) {
|
|
125
|
+
return w(e).toUpperCase();
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function E(e) {
|
|
128
128
|
let t = e.toLowerCase(), n = 0, r = 0;
|
|
129
129
|
for (; n < t.length;) {
|
|
130
130
|
let e = !1;
|
|
131
|
-
for (let [i, a] of
|
|
131
|
+
for (let [i, a] of x) if (t.startsWith(a, n)) {
|
|
132
132
|
r += i, n += a.length, e = !0;
|
|
133
133
|
break;
|
|
134
134
|
}
|
|
@@ -136,12 +136,12 @@ function D(e) {
|
|
|
136
136
|
}
|
|
137
137
|
return r;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function re(e) {
|
|
140
140
|
if (!/^[ivxlcdmIVXLCDM]+$/.test(e)) return !1;
|
|
141
|
-
let t =
|
|
142
|
-
return t <= 0 ? !1 : (e === e.toLowerCase() ?
|
|
141
|
+
let t = E(e);
|
|
142
|
+
return t <= 0 ? !1 : (e === e.toLowerCase() ? w(t) : T(t)) === e;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function ie(e) {
|
|
145
145
|
let t = e.toLowerCase();
|
|
146
146
|
if (t.length === 1) return t.charCodeAt(0) - 97 + 1;
|
|
147
147
|
if (t.length === 2) {
|
|
@@ -150,82 +150,82 @@ function ne(e) {
|
|
|
150
150
|
}
|
|
151
151
|
return 0;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
if (e <= 26) return
|
|
153
|
+
function D(e) {
|
|
154
|
+
if (e <= 26) return S[e - 1];
|
|
155
155
|
let t = Math.floor((e - 1) / 26) - 1, n = (e - 1) % 26;
|
|
156
|
-
return t < 0 ?
|
|
156
|
+
return t < 0 ? S[n] : S[t] + S[n];
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
if (
|
|
160
|
-
if (
|
|
158
|
+
function O(e) {
|
|
159
|
+
if (e && !/^\d+$/.test(e)) {
|
|
160
|
+
if (re(e)) return e === e.toLowerCase() ? "i" : "I";
|
|
161
161
|
if (/^[a-z]{1,2}$/.test(e)) return "a";
|
|
162
162
|
if (/^[A-Z]{1,2}$/.test(e)) return "A";
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function k(e) {
|
|
166
166
|
if (/^\d+$/.test(e)) return parseInt(e, 10);
|
|
167
|
-
let t =
|
|
168
|
-
if (t === "i" || t === "I") return
|
|
167
|
+
let t = O(e);
|
|
168
|
+
if (t === "i" || t === "I") return E(e);
|
|
169
169
|
if (t === "a" || t === "A") {
|
|
170
|
-
let t =
|
|
170
|
+
let t = ie(e);
|
|
171
171
|
return t > 0 ? t : 1;
|
|
172
172
|
}
|
|
173
173
|
let n = parseInt(e, 10);
|
|
174
174
|
return Number.isNaN(n) ? 1 : n;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function ae(e, t) {
|
|
177
177
|
if (e === "numeric") return String(t);
|
|
178
178
|
switch (e) {
|
|
179
|
-
case "a": return
|
|
180
|
-
case "A": return
|
|
181
|
-
case "i": return
|
|
182
|
-
case "I": return
|
|
179
|
+
case "a": return D(t);
|
|
180
|
+
case "A": return D(t).toUpperCase();
|
|
181
|
+
case "i": return w(t);
|
|
182
|
+
case "I": return T(t);
|
|
183
183
|
default: return String(t);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function A(e) {
|
|
187
187
|
if (e.length === 0) return !1;
|
|
188
|
-
let t =
|
|
188
|
+
let t = O(e[0]) ?? "numeric", n = k(e[0]);
|
|
189
189
|
if (n < 1) return !1;
|
|
190
190
|
for (let r = 0; r < e.length; r++) {
|
|
191
|
-
let i =
|
|
191
|
+
let i = ae(t, n + r);
|
|
192
192
|
if (e[r] !== i) return !1;
|
|
193
193
|
}
|
|
194
194
|
return !0;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function j(e) {
|
|
197
197
|
return {
|
|
198
|
-
type:
|
|
199
|
-
start:
|
|
198
|
+
type: O(e),
|
|
199
|
+
start: k(e)
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
|
-
function
|
|
203
|
-
let { type: t, start: n } =
|
|
202
|
+
function M(e) {
|
|
203
|
+
let { type: t, start: n } = j(e), r = {};
|
|
204
204
|
return t && (r.type = t), n !== 1 && (r.start = n), r;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function N(e, t, n = ". ") {
|
|
207
207
|
let r = t + 1;
|
|
208
208
|
if (!e || e === "1") return `${r}${n}`;
|
|
209
209
|
switch (e) {
|
|
210
|
-
case "a": return `${
|
|
211
|
-
case "A": return `${
|
|
212
|
-
case "i": return `${
|
|
213
|
-
case "I": return `${
|
|
210
|
+
case "a": return `${D(r)}${n}`;
|
|
211
|
+
case "A": return `${D(r).toUpperCase()}${n}`;
|
|
212
|
+
case "i": return `${w(r)}${n}`;
|
|
213
|
+
case "I": return `${T(r)}${n}`;
|
|
214
214
|
default: return `${r}${n}`;
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function oe(e) {
|
|
218
218
|
let t = e.tokens?.[0];
|
|
219
219
|
return !!(e.text && e.tokens?.length === 1 && t?.type === "list" && t.ordered && t.raw === e.text);
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function se(e, t) {
|
|
222
222
|
return t.tokenizeInline ? t.parseInline(t.tokenizeInline(e)) : t.parseInline([{
|
|
223
223
|
type: "text",
|
|
224
224
|
raw: e,
|
|
225
225
|
text: e
|
|
226
226
|
}]);
|
|
227
227
|
}
|
|
228
|
-
var
|
|
228
|
+
var P = i.create({
|
|
229
229
|
name: "listItem",
|
|
230
230
|
addOptions() {
|
|
231
231
|
return {
|
|
@@ -251,11 +251,11 @@ var I = i.create({
|
|
|
251
251
|
if (e.type !== "list_item") return [];
|
|
252
252
|
let n = t.parseBlockChildren ?? t.parseChildren, r = [];
|
|
253
253
|
if (e.tokens && e.tokens.length > 0) {
|
|
254
|
-
if (
|
|
254
|
+
if (oe(e)) return {
|
|
255
255
|
type: "listItem",
|
|
256
256
|
content: [{
|
|
257
257
|
type: "paragraph",
|
|
258
|
-
content:
|
|
258
|
+
content: se(e.text || "", t)
|
|
259
259
|
}]
|
|
260
260
|
};
|
|
261
261
|
if (e.tokens.some((e) => e.type === "paragraph")) r = n(e.tokens);
|
|
@@ -285,12 +285,12 @@ var I = i.create({
|
|
|
285
285
|
if (e.parentType === "orderedList") {
|
|
286
286
|
var t, n;
|
|
287
287
|
let r = ((t = e.meta) == null || (t = t.parentAttrs) == null ? void 0 : t.start) || 1;
|
|
288
|
-
return
|
|
288
|
+
return N((n = e.meta) == null || (n = n.parentAttrs) == null ? void 0 : n.type, r - 1 + (e.index || 0), ". ");
|
|
289
289
|
}
|
|
290
290
|
return "- ";
|
|
291
291
|
}, n, { alignNestedToPrefix: n?.parentType === "orderedList" }),
|
|
292
292
|
addExtensions() {
|
|
293
|
-
return [
|
|
293
|
+
return [b(this.name, [this.options.bulletListTypeName, this.options.orderedListTypeName])];
|
|
294
294
|
},
|
|
295
295
|
addKeyboardShortcuts() {
|
|
296
296
|
return {
|
|
@@ -299,25 +299,25 @@ var I = i.create({
|
|
|
299
299
|
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
|
-
}),
|
|
302
|
+
}), F = (e, t) => {
|
|
303
303
|
let { $from: n } = t.selection, r = o(e, t.schema), i = null, a = n.depth, s = n.pos, c = null;
|
|
304
304
|
for (; a > 0 && c === null;) i = n.node(a), i.type === r ? c = a : (--a, --s);
|
|
305
305
|
return c === null ? null : {
|
|
306
306
|
$pos: t.doc.resolve(s),
|
|
307
307
|
depth: c
|
|
308
308
|
};
|
|
309
|
-
},
|
|
310
|
-
let n =
|
|
309
|
+
}, I = (e, t) => {
|
|
310
|
+
let n = F(e, t);
|
|
311
311
|
if (!n) return !1;
|
|
312
312
|
let [, r] = a(t, e, n.$pos.pos + 4);
|
|
313
313
|
return r;
|
|
314
|
-
},
|
|
314
|
+
}, ce = (e, t, n) => {
|
|
315
315
|
let { $anchor: r } = e.selection, i = Math.max(0, r.pos - 2), a = e.doc.resolve(i).node();
|
|
316
316
|
return !(!a || !n.includes(a.type.name));
|
|
317
|
-
},
|
|
317
|
+
}, L = (e, t, n) => {
|
|
318
318
|
if (e.commands.undoInputRule()) return !0;
|
|
319
319
|
if (e.state.selection.from !== e.state.selection.to) return !1;
|
|
320
|
-
if (!d(e.state, t) &&
|
|
320
|
+
if (!d(e.state, t) && ce(e.state, t, n)) {
|
|
321
321
|
let { $anchor: n } = e.state.selection, r = e.state.doc.resolve(n.before() - 1), i = [];
|
|
322
322
|
r.node().descendants((e, n) => {
|
|
323
323
|
e.type.name === t && i.push({
|
|
@@ -336,17 +336,17 @@ var I = i.create({
|
|
|
336
336
|
if (!d(e.state, t) || !u(e.state)) return !1;
|
|
337
337
|
let { $from: r } = e.state.selection, i = r.depth - 1;
|
|
338
338
|
return r.node(i).type !== e.schema.nodes[t] || r.index(i) !== 0 ? !1 : e.chain().liftListItem(t).run();
|
|
339
|
-
},
|
|
340
|
-
let n =
|
|
339
|
+
}, le = (e, t) => {
|
|
340
|
+
let n = I(e, t), r = F(e, t);
|
|
341
341
|
return !r || !n ? !1 : n > r.depth;
|
|
342
|
-
},
|
|
343
|
-
let n =
|
|
342
|
+
}, ue = (e, t) => {
|
|
343
|
+
let n = I(e, t), r = F(e, t);
|
|
344
344
|
return !r || !n ? !1 : n < r.depth;
|
|
345
|
-
},
|
|
345
|
+
}, R = (e, t) => {
|
|
346
346
|
if (!d(e.state, t) || !l(e.state, t)) return !1;
|
|
347
347
|
let { selection: n } = e.state, { $from: r, $to: i } = n;
|
|
348
|
-
return !n.empty && r.sameParent(i) ? !1 :
|
|
349
|
-
},
|
|
348
|
+
return !n.empty && r.sameParent(i) ? !1 : le(t, e.state) ? e.chain().focus(e.state.selection.from + 4).lift(t).joinBackward().run() : ue(t, e.state) ? e.chain().joinForward().joinBackward().run() : e.commands.joinItemForward();
|
|
349
|
+
}, de = (t, r, i) => {
|
|
350
350
|
let { state: a } = t, { selection: o } = a;
|
|
351
351
|
if (!o.empty) return !1;
|
|
352
352
|
let { $from: c } = o;
|
|
@@ -359,7 +359,7 @@ var I = i.create({
|
|
|
359
359
|
if (!u.canReplace(u.childCount, u.childCount, e.from(f))) return !1;
|
|
360
360
|
let p = c.before(), m = c.after(), h = p - 2;
|
|
361
361
|
return t.commands.command(({ tr: t, dispatch: r }) => (r && (t.delete(p, m).insert(h, e.from(f)), t.setSelection(n.create(t.doc, h + 1)), t.scrollIntoView()), !0));
|
|
362
|
-
},
|
|
362
|
+
}, z = r.create({
|
|
363
363
|
name: "listKeymap",
|
|
364
364
|
addOptions() {
|
|
365
365
|
return { listTypes: [{
|
|
@@ -375,86 +375,74 @@ var I = i.create({
|
|
|
375
375
|
Delete: ({ editor: e }) => {
|
|
376
376
|
let t = !1;
|
|
377
377
|
return this.options.listTypes.forEach(({ itemName: n }) => {
|
|
378
|
-
e.state.schema.nodes[n] !== void 0 &&
|
|
378
|
+
e.state.schema.nodes[n] !== void 0 && R(e, n) && (t = !0);
|
|
379
379
|
}), t;
|
|
380
380
|
},
|
|
381
381
|
"Mod-Delete": ({ editor: e }) => {
|
|
382
382
|
let t = !1;
|
|
383
383
|
return this.options.listTypes.forEach(({ itemName: n }) => {
|
|
384
|
-
e.state.schema.nodes[n] !== void 0 &&
|
|
384
|
+
e.state.schema.nodes[n] !== void 0 && R(e, n) && (t = !0);
|
|
385
385
|
}), t;
|
|
386
386
|
},
|
|
387
387
|
Backspace: ({ editor: e }) => {
|
|
388
388
|
let t = !1;
|
|
389
389
|
return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
|
|
390
|
-
e.state.schema.nodes[n] !== void 0 &&
|
|
390
|
+
e.state.schema.nodes[n] !== void 0 && L(e, n, r) && (t = !0);
|
|
391
391
|
}), t;
|
|
392
392
|
},
|
|
393
393
|
"Mod-Backspace": ({ editor: e }) => {
|
|
394
394
|
let t = !1;
|
|
395
395
|
return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
|
|
396
|
-
e.state.schema.nodes[n] !== void 0 &&
|
|
396
|
+
e.state.schema.nodes[n] !== void 0 && L(e, n, r) && (t = !0);
|
|
397
397
|
}), t;
|
|
398
398
|
},
|
|
399
399
|
Tab: ({ editor: e }) => {
|
|
400
|
-
for (let { itemName: t, wrapperNames: n } of this.options.listTypes) if (e.state.schema.nodes[t] !== void 0 &&
|
|
400
|
+
for (let { itemName: t, wrapperNames: n } of this.options.listTypes) if (e.state.schema.nodes[t] !== void 0 && de(e, t, n)) return !0;
|
|
401
401
|
return !1;
|
|
402
402
|
}
|
|
403
403
|
};
|
|
404
404
|
}
|
|
405
|
-
}),
|
|
405
|
+
}), B = RegExp(`^(\\s*)(${C})([.)])\\s+(.*)$`), fe = /^\s/, V = {
|
|
406
406
|
heading: /^#{1,6}(?:\s|$)/,
|
|
407
407
|
bulletItem: /^[-+*]\s+/,
|
|
408
408
|
codeFence: /^(?:```|~~~)/,
|
|
409
409
|
blockMath: /^\$\$/,
|
|
410
410
|
thematicBreak: /^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/
|
|
411
411
|
};
|
|
412
|
-
function
|
|
413
|
-
return
|
|
412
|
+
function pe(e) {
|
|
413
|
+
return B.test(e.trimStart());
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function me(e) {
|
|
416
416
|
let t = e.trimStart();
|
|
417
|
-
return
|
|
417
|
+
return V.bulletItem.test(t) || pe(t) || V.heading.test(t) || V.thematicBreak.test(t) && !t.startsWith("-") || /^>\s?/.test(t) || V.codeFence.test(t) || V.blockMath.test(t);
|
|
418
418
|
}
|
|
419
|
-
function
|
|
420
|
-
return Object.values(
|
|
419
|
+
function he(e) {
|
|
420
|
+
return Object.values(V).some((t) => t.test(e));
|
|
421
421
|
}
|
|
422
|
-
function
|
|
422
|
+
function ge(e) {
|
|
423
423
|
let t = [], n = [], r = !1;
|
|
424
424
|
return e.forEach((e) => {
|
|
425
|
-
|
|
426
|
-
n.push(e);
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
if (e.trim() === "") {
|
|
430
|
-
r = !0, n.push(e);
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
if (t.length > 0 && de(e)) {
|
|
434
|
-
r = !0, n.push(e);
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
t.push(e);
|
|
425
|
+
r ? n.push(e) : e.trim() === "" || t.length > 0 && me(e) ? (r = !0, n.push(e)) : t.push(e);
|
|
438
426
|
}), {
|
|
439
427
|
paragraphLines: t,
|
|
440
428
|
blockLines: n
|
|
441
429
|
};
|
|
442
430
|
}
|
|
443
|
-
function
|
|
431
|
+
function H(e) {
|
|
444
432
|
let t = [], n = 0, r = 0;
|
|
445
433
|
for (; n < e.length;) {
|
|
446
|
-
let i = e[n], a = i.match(
|
|
434
|
+
let i = e[n], a = i.match(B);
|
|
447
435
|
if (!a) break;
|
|
448
|
-
let [, o, s, c, l] = a, u = o.length, d = parseInt(s, 10), f = isNaN(d) ?
|
|
436
|
+
let [, o, s, c, l] = a, u = o.length, d = parseInt(s, 10), f = isNaN(d) ? O(s) : void 0, p = isNaN(d) ? k(s) : d, m = [l], h = n + 1, g = [i], _ = !1;
|
|
449
437
|
for (; h < e.length;) {
|
|
450
438
|
let t = e[h];
|
|
451
|
-
if (t.match(
|
|
439
|
+
if (t.match(B)) break;
|
|
452
440
|
if (t.trim() === "") g.push(t), m.push(""), _ = !0, h += 1;
|
|
453
|
-
else if (t.match(
|
|
441
|
+
else if (t.match(fe)) {
|
|
454
442
|
let e = t.length - t.trimStart().length, n = u + s.length + 1;
|
|
455
443
|
g.push(t), m.push(t.slice(Math.min(e, n))), h += 1;
|
|
456
444
|
} else {
|
|
457
|
-
if (_ ||
|
|
445
|
+
if (_ || he(t)) break;
|
|
458
446
|
g.push(t), m.push(t), h += 1;
|
|
459
447
|
}
|
|
460
448
|
}
|
|
@@ -469,22 +457,22 @@ function me(e) {
|
|
|
469
457
|
}
|
|
470
458
|
return [t, r];
|
|
471
459
|
}
|
|
472
|
-
var
|
|
473
|
-
function
|
|
460
|
+
var _e = RegExp(`^(${C})([.)])\\s+(.+)$`);
|
|
461
|
+
function U(e) {
|
|
474
462
|
let t = e.split("\n").filter((e) => e.trim().length > 0);
|
|
475
463
|
if (t.length === 0) return null;
|
|
476
464
|
let n = [];
|
|
477
465
|
for (let e of t) {
|
|
478
|
-
let t = e.trim().match(
|
|
466
|
+
let t = e.trim().match(_e);
|
|
479
467
|
if (!t) return null;
|
|
480
468
|
n.push({
|
|
481
469
|
marker: t[1],
|
|
482
470
|
content: t[3]
|
|
483
471
|
});
|
|
484
472
|
}
|
|
485
|
-
return
|
|
473
|
+
return A(n.map((e) => e.marker)) ? {
|
|
486
474
|
type: "orderedList",
|
|
487
|
-
attrs:
|
|
475
|
+
attrs: M(n[0].marker),
|
|
488
476
|
content: n.map((e) => ({
|
|
489
477
|
type: "listItem",
|
|
490
478
|
content: [{
|
|
@@ -497,12 +485,12 @@ function G(e) {
|
|
|
497
485
|
}))
|
|
498
486
|
} : null;
|
|
499
487
|
}
|
|
500
|
-
function
|
|
488
|
+
function W(e, t, n) {
|
|
501
489
|
let r = [], i = 0;
|
|
502
490
|
for (; i < e.length;) {
|
|
503
491
|
let a = e[i];
|
|
504
492
|
if (a.indent === t) {
|
|
505
|
-
let { paragraphLines: o, blockLines: s } =
|
|
493
|
+
let { paragraphLines: o, blockLines: s } = ge(a.contentLines), c = o.join("\n").trim(), l = [];
|
|
506
494
|
c && l.push({
|
|
507
495
|
type: "paragraph",
|
|
508
496
|
raw: c,
|
|
@@ -516,7 +504,7 @@ function K(e, t, n) {
|
|
|
516
504
|
let d = i + 1, f = [];
|
|
517
505
|
for (; d < e.length && e[d].indent > t;) f.push(e[d]), d += 1;
|
|
518
506
|
if (f.length > 0) {
|
|
519
|
-
let e =
|
|
507
|
+
let e = W(f, Math.min(...f.map((e) => e.indent)), n);
|
|
520
508
|
l.push({
|
|
521
509
|
type: "list",
|
|
522
510
|
ordered: !0,
|
|
@@ -535,7 +523,7 @@ function K(e, t, n) {
|
|
|
535
523
|
}
|
|
536
524
|
return r;
|
|
537
525
|
}
|
|
538
|
-
function
|
|
526
|
+
function ve(e, t) {
|
|
539
527
|
return e.map((e) => {
|
|
540
528
|
if (e.type !== "list_item") return t.parseChildren([e])[0];
|
|
541
529
|
let n = [];
|
|
@@ -557,7 +545,32 @@ function ge(e, t) {
|
|
|
557
545
|
};
|
|
558
546
|
});
|
|
559
547
|
}
|
|
560
|
-
var
|
|
548
|
+
var ye = 64;
|
|
549
|
+
function G(e, t) {
|
|
550
|
+
let n = [], r = 0;
|
|
551
|
+
for (; n.length < t;) {
|
|
552
|
+
let t = e.indexOf("\n", r);
|
|
553
|
+
if (t === -1) return n.push(e.slice(r)), n;
|
|
554
|
+
n.push(e.slice(r, t)), r = t + 1;
|
|
555
|
+
}
|
|
556
|
+
return n;
|
|
557
|
+
}
|
|
558
|
+
function K(e) {
|
|
559
|
+
let t = e.indexOf("\n"), n = t === -1 ? e : e.slice(0, t);
|
|
560
|
+
if (!B.test(n)) return [
|
|
561
|
+
[],
|
|
562
|
+
0,
|
|
563
|
+
[]
|
|
564
|
+
];
|
|
565
|
+
let r = ye, i = G(e, r), a = H(i);
|
|
566
|
+
for (; a[1] === i.length && i.length === r;) r *= 2, i = G(e, r), a = H(i);
|
|
567
|
+
return [
|
|
568
|
+
a[0],
|
|
569
|
+
a[1],
|
|
570
|
+
i
|
|
571
|
+
];
|
|
572
|
+
}
|
|
573
|
+
var be = "listItem", q = "textStyle", J = /^(\d+)\.\s$/;
|
|
561
574
|
function Y(e) {
|
|
562
575
|
let t = e.match(/list-style-type\s*:\s*([^;]+)/i);
|
|
563
576
|
if (!t) return null;
|
|
@@ -628,7 +641,7 @@ var X = i.create({
|
|
|
628
641
|
markdownTokenName: "list",
|
|
629
642
|
parseMarkdown: (e, t) => {
|
|
630
643
|
if (e.type !== "list" || !e.ordered) return [];
|
|
631
|
-
let n = e.start || 1, r = e.typeMarker, i = e.items ?
|
|
644
|
+
let n = e.start || 1, r = e.typeMarker, i = e.items ? ve(e.items, t) : [], a = {};
|
|
632
645
|
return n !== 1 && (a.start = n), r && (a.type = r), Object.keys(a).length > 0 ? {
|
|
633
646
|
type: "orderedList",
|
|
634
647
|
attrs: a,
|
|
@@ -644,22 +657,22 @@ var X = i.create({
|
|
|
644
657
|
level: "block",
|
|
645
658
|
start: () => -1,
|
|
646
659
|
tokenize: (e, t, n) => {
|
|
647
|
-
let r
|
|
648
|
-
if (
|
|
649
|
-
let o =
|
|
660
|
+
let [r, i, a] = K(e);
|
|
661
|
+
if (r.length === 0) return;
|
|
662
|
+
let o = W(r, r[0].indent, n);
|
|
650
663
|
if (o.length !== 0) return {
|
|
651
664
|
type: "list",
|
|
652
665
|
ordered: !0,
|
|
653
|
-
start:
|
|
654
|
-
typeMarker:
|
|
666
|
+
start: r[0]?.number || 1,
|
|
667
|
+
typeMarker: r[0]?.type,
|
|
655
668
|
items: o,
|
|
656
|
-
raw:
|
|
669
|
+
raw: a.slice(0, i).join("\n")
|
|
657
670
|
};
|
|
658
671
|
}
|
|
659
672
|
},
|
|
660
673
|
markdownOptions: { indentsContent: !0 },
|
|
661
674
|
addCommands() {
|
|
662
|
-
return { toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
675
|
+
return { toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(be, this.editor.getAttributes(q)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
|
|
663
676
|
},
|
|
664
677
|
addKeyboardShortcuts() {
|
|
665
678
|
return { "Mod-Shift-7": () => this.editor.commands.toggleOrderedList() };
|
|
@@ -669,7 +682,7 @@ var X = i.create({
|
|
|
669
682
|
if ((t.clipboardData?.getData("text/html"))?.trim()) return !1;
|
|
670
683
|
let n = t.clipboardData?.getData("text/plain");
|
|
671
684
|
if (!n) return !1;
|
|
672
|
-
let r =
|
|
685
|
+
let r = U(n);
|
|
673
686
|
if (!r) return !1;
|
|
674
687
|
try {
|
|
675
688
|
let t = e.state.schema.nodeFromJSON(r), n = e.state.tr.replaceSelectionWith(t);
|
|
@@ -699,7 +712,7 @@ var X = i.create({
|
|
|
699
712
|
editor: this.editor
|
|
700
713
|
})), [t];
|
|
701
714
|
}
|
|
702
|
-
}), Z = /^\s*(\[([( |x])?\])\s$/,
|
|
715
|
+
}), Z = /^\s*(\[([( |x])?\])\s$/, xe = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0", Se = (e, t, n) => {
|
|
703
716
|
var r;
|
|
704
717
|
return (n == null || (r = n.checkboxLabel) == null ? void 0 : r.call(n, e, t)) || `Task item checkbox for ${e.textContent || "empty task item"}`;
|
|
705
718
|
}, Q = i.create({
|
|
@@ -762,7 +775,7 @@ var X = i.create({
|
|
|
762
775
|
return m(e, t, n);
|
|
763
776
|
},
|
|
764
777
|
addExtensions() {
|
|
765
|
-
return this.options.nested ? [
|
|
778
|
+
return this.options.nested ? [b(this.name, [this.options.taskListTypeName])] : [];
|
|
766
779
|
},
|
|
767
780
|
addKeyboardShortcuts() {
|
|
768
781
|
let e = {
|
|
@@ -777,9 +790,9 @@ var X = i.create({
|
|
|
777
790
|
addNodeView() {
|
|
778
791
|
return ({ node: e, HTMLAttributes: t, getPos: n, editor: r }) => {
|
|
779
792
|
let i = document.createElement("li"), a = document.createElement("label"), o = document.createElement("span"), s = document.createElement("input"), l = document.createElement("div");
|
|
780
|
-
o.style.cssText =
|
|
793
|
+
o.style.cssText = xe;
|
|
781
794
|
let u = (e) => {
|
|
782
|
-
let t =
|
|
795
|
+
let t = Se(e, e.attrs.checked, this.options.a11y);
|
|
783
796
|
s.setAttribute("aria-label", t), o.textContent = t;
|
|
784
797
|
};
|
|
785
798
|
u(e), a.contentEditable = "false", s.type = "checkbox", s.addEventListener("mousedown", (e) => e.preventDefault()), s.addEventListener("change", (t) => {
|
|
@@ -928,8 +941,8 @@ r.create({
|
|
|
928
941
|
name: "listKit",
|
|
929
942
|
addExtensions() {
|
|
930
943
|
let e = [];
|
|
931
|
-
return this.options.bulletList !== !1 && e.push(y.configure(this.options.bulletList)), this.options.listItem !== !1 && e.push(
|
|
944
|
+
return this.options.bulletList !== !1 && e.push(y.configure(this.options.bulletList)), this.options.listItem !== !1 && e.push(P.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(z.configure(this.options.listKeymap)), this.options.orderedList !== !1 && e.push(X.configure(this.options.orderedList)), this.options.taskItem !== !1 && e.push(Q.configure(this.options.taskItem)), this.options.taskList !== !1 && e.push($.configure(this.options.taskList)), e;
|
|
932
945
|
}
|
|
933
946
|
});
|
|
934
947
|
//#endregion
|
|
935
|
-
export { y as BulletList,
|
|
948
|
+
export { y as BulletList, P as ListItem, z as ListKeymap, C as ORDERED_LIST_MARKER_PATTERN, X as OrderedList, Q as TaskItem, $ as TaskList, A as areOrderedListMarkersSequential, M as buildOrderedListAttrsFromMarker, v as bulletListInputRegex, O as detectMarkerType, N as getListMarker, Z as inputRegex, k as markerToStart, J as orderedListInputRegex, j as parseListMarker, U as parsePlainTextOrderedListPaste, w as toRoman, T as toRomanUpper };
|