@clevertask/scribe 0.1.20 → 0.1.22
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/README.md +3 -0
- package/dist/{BarMenu-sZGqMjQr.js → BarMenu-tPZoiOba.js} +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/components/Menu/BarMenu.js +1 -1
- package/dist/components/Menu/BubbleMenu.js +2 -2
- package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
- package/dist/components/Menu/LinkBubbleMenu.js +6 -6
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +2 -2
- package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
- package/dist/components/Scribe/extension/callout.js +1 -1
- package/dist/components/Scribe/extension/emoji/suggest.js +3 -3
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/commands.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/index.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/node-view.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/render-html.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/resolver.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
- package/dist/components/Scribe/extension/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
- package/dist/components/Scribe/extension/tableOfContents.js +3 -3
- package/dist/components/Scribe/index.js +4 -4
- package/dist/{dist-Bm6rBIf2.js → dist-Cer8ra_P.js} +2 -2
- package/dist/{dist-jjH04EIX.js → dist-ClNucvAM.js} +441 -435
- package/dist/{dist-BrbZZTdj.js → dist-D31OwZrM.js} +212 -161
- package/dist/{extension-BNjzWzJi.js → extension-BMUUYPzc.js} +3 -2
- package/dist/{extension-link-7ta0X4tP.js → extension-link-BQrkQZHi.js} +23 -23
- package/dist/{html-to-markdown-pY8ngCXa.js → html-to-markdown-D7PT8MhP.js} +1 -1
- package/dist/main.js +2 -2
- package/dist/{markdown-to-html-BSuSwB4B.js → markdown-to-html-ChfR7P_Y.js} +3 -3
- package/dist/{menus-i0cEakC3.js → menus-DLKcWlVX.js} +34 -34
- package/dist/{resizable-table-DFTyMlVu.js → resizable-table-DgMCiXeO.js} +3 -3
- package/dist/{schema-extensions-B-U6SbYg.js → schema-extensions-CQTswF0n.js} +1355 -1353
- package/dist/schema-extensions.d.ts +1 -0
- package/dist/schema-extensions.d.ts.map +1 -1
- package/dist/schema-extensions.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/{tippy.esm-DOXqN1Qm.js → tippy.esm-8vSV0zL7.js} +6 -6
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +56 -53
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { RemoveMarkStep as e, ReplaceAroundStep as t, ReplaceStep as n, Transform as r, canJoin as i, canSplit as a, findWrapping as o, joinPoint as s, liftTarget as c } from "@tiptap/pm/transform";
|
|
2
|
-
import { createParagraphNear as l, exitCode as u, joinBackward as d, joinDown as f, joinForward as p, joinTextblockBackward as m, joinTextblockForward as h, joinUp as g, lift as
|
|
3
|
-
import { AllSelection as ae, EditorState as
|
|
4
|
-
import { DOMParser as
|
|
5
|
-
import { liftListItem as
|
|
6
|
-
import { DecorationSet as
|
|
7
|
-
import { keymap as
|
|
8
|
-
//#region node_modules/.pnpm/@tiptap+core@3.
|
|
9
|
-
var
|
|
2
|
+
import { createParagraphNear as l, exitCode as u, joinBackward as d, joinDown as f, joinForward as p, joinTextblockBackward as m, joinTextblockForward as h, joinUp as g, lift as ee, liftEmptyBlock as te, newlineInCode as _, selectNodeBackward as ne, selectNodeForward as v, selectParentNode as re, selectTextblockEnd as ie, selectTextblockStart as y, setBlockType as b, wrapIn as x } from "@tiptap/pm/commands";
|
|
3
|
+
import { AllSelection as ae, EditorState as oe, NodeSelection as S, Plugin as C, PluginKey as w, Selection as T, TextSelection as E } from "@tiptap/pm/state";
|
|
4
|
+
import { DOMParser as se, DOMSerializer as ce, Fragment as D, Schema as le, Slice as ue } from "@tiptap/pm/model";
|
|
5
|
+
import { liftListItem as de, sinkListItem as fe, wrapInList as pe } from "@tiptap/pm/schema-list";
|
|
6
|
+
import { DecorationSet as O, EditorView as me } from "@tiptap/pm/view";
|
|
7
|
+
import { keymap as he } from "@tiptap/pm/keymap";
|
|
8
|
+
//#region node_modules/.pnpm/@tiptap+core@3.31.3_@tiptap+pm@3.31.3/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js
|
|
9
|
+
var ge = Object.defineProperty, _e = (e, t) => {
|
|
10
10
|
let n = {};
|
|
11
|
-
for (var r in e)
|
|
11
|
+
for (var r in e) ge(n, r, {
|
|
12
12
|
get: e[r],
|
|
13
13
|
enumerable: !0
|
|
14
14
|
});
|
|
15
|
-
return t ||
|
|
15
|
+
return t || ge(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
16
16
|
};
|
|
17
17
|
//#endregion
|
|
18
|
-
//#region node_modules/.pnpm/@tiptap+core@3.
|
|
19
|
-
function
|
|
18
|
+
//#region node_modules/.pnpm/@tiptap+core@3.31.3_@tiptap+pm@3.31.3/node_modules/@tiptap/core/dist/index.js
|
|
19
|
+
function k(e) {
|
|
20
20
|
let { state: t, transaction: n } = e, { selection: r } = n, { doc: i } = n, { storedMarks: a } = n;
|
|
21
21
|
return {
|
|
22
22
|
...t,
|
|
@@ -100,7 +100,7 @@ var A = class e {
|
|
|
100
100
|
tr: e,
|
|
101
101
|
editor: r,
|
|
102
102
|
view: a,
|
|
103
|
-
state:
|
|
103
|
+
state: k({
|
|
104
104
|
state: i,
|
|
105
105
|
transaction: e
|
|
106
106
|
}),
|
|
@@ -137,7 +137,7 @@ var A = class e {
|
|
|
137
137
|
let { state: i } = n, a = i.doc.slice(e.from, e.to);
|
|
138
138
|
r.deleteRange(e.from, e.to);
|
|
139
139
|
let o = r.mapping.map(t);
|
|
140
|
-
return r.insert(o, a.content), r.setSelection(new
|
|
140
|
+
return r.insert(o, a.content), r.setSelection(new E(r.doc.resolve(Math.max(o - 1, 0)))), !0;
|
|
141
141
|
}, we = () => ({ tr: e, dispatch: t }) => {
|
|
142
142
|
let { selection: n } = e, r = n.$anchor.node();
|
|
143
143
|
if (r.content.size > 0) return !1;
|
|
@@ -185,7 +185,7 @@ var Te = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
|
185
185
|
r.forEach((t) => {
|
|
186
186
|
let r = n.mapping.slice(i), { from: a, to: o } = ke(n.doc.resolve(r.map(t.$from.pos)), n.doc.resolve(r.map(t.$to.pos)), e.schema);
|
|
187
187
|
n.deleteRange(a, o);
|
|
188
|
-
}), n.selection.empty || n.setSelection(
|
|
188
|
+
}), n.selection.empty || n.setSelection(E.near(n.doc.resolve(n.selection.from))), n.scrollIntoView(), t(n);
|
|
189
189
|
}
|
|
190
190
|
return !0;
|
|
191
191
|
}, je = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Me = () => ({ state: e, dispatch: t }) => u(e, t);
|
|
@@ -231,7 +231,7 @@ var Ie = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
231
231
|
if (i) {
|
|
232
232
|
let e = N(c, a, t);
|
|
233
233
|
if (e && e.from <= l && e.to >= u) {
|
|
234
|
-
let t =
|
|
234
|
+
let t = E.create(o, e.from, e.to);
|
|
235
235
|
n.setSelection(t);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
@@ -241,24 +241,24 @@ var Ie = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
241
241
|
for (let e = 0; e < n.length; e += 1) if (n[e](t)) return !0;
|
|
242
242
|
return !1;
|
|
243
243
|
};
|
|
244
|
-
function
|
|
245
|
-
return e instanceof
|
|
244
|
+
function Re(e) {
|
|
245
|
+
return e instanceof E;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function F(e = 0, t = 0, n = 0) {
|
|
248
248
|
return Math.min(Math.max(e, t), n);
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function ze(e, t = null) {
|
|
251
251
|
if (!t) return null;
|
|
252
|
-
let n =
|
|
252
|
+
let n = T.atStart(e), r = T.atEnd(e);
|
|
253
253
|
if (t === "start" || t === !0) return n;
|
|
254
254
|
if (t === "end") return r;
|
|
255
255
|
let i = n.from, a = r.to;
|
|
256
|
-
return t === "all" ?
|
|
256
|
+
return t === "all" ? E.create(e, F(0, i, a), F(e.content.size, i, a)) : E.create(e, F(t, i, a), F(t, i, a));
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function Be() {
|
|
259
259
|
return ["Android"].includes(navigator.platform) || /android/i.test(navigator.userAgent);
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function I() {
|
|
262
262
|
return [
|
|
263
263
|
"iPad Simulator",
|
|
264
264
|
"iPhone Simulator",
|
|
@@ -268,16 +268,16 @@ function L() {
|
|
|
268
268
|
"iPod"
|
|
269
269
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function Ve() {
|
|
272
272
|
return typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
273
273
|
}
|
|
274
|
-
var
|
|
274
|
+
var He = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
|
|
275
275
|
t = {
|
|
276
276
|
scrollIntoView: !0,
|
|
277
277
|
...t
|
|
278
278
|
};
|
|
279
279
|
let o = () => {
|
|
280
|
-
(
|
|
280
|
+
(I() || Be()) && r.dom.focus(), Ve() && !I() && !Be() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
|
|
281
281
|
n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
|
|
282
282
|
});
|
|
283
283
|
};
|
|
@@ -286,33 +286,33 @@ var Ve = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
|
|
|
286
286
|
} catch {
|
|
287
287
|
return !1;
|
|
288
288
|
}
|
|
289
|
-
if (a && e === null && !
|
|
290
|
-
let s =
|
|
289
|
+
if (a && e === null && !Re(n.state.selection)) return o(), !0;
|
|
290
|
+
let s = ze(i.doc, e) || n.state.selection, c = n.state.selection.eq(s);
|
|
291
291
|
return a && (c || i.setSelection(s), c && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
|
|
292
|
-
},
|
|
292
|
+
}, Ue = (e, t) => (n) => e.every((e, r) => t(e, {
|
|
293
293
|
...n,
|
|
294
294
|
index: r
|
|
295
|
-
})),
|
|
295
|
+
})), We = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({
|
|
296
296
|
from: n.selection.from,
|
|
297
297
|
to: n.selection.to
|
|
298
|
-
}, e, t),
|
|
298
|
+
}, e, t), Ge = (e) => {
|
|
299
299
|
let t = e.childNodes;
|
|
300
300
|
for (let n = t.length - 1; n >= 0; --n) {
|
|
301
301
|
let r = t[n];
|
|
302
|
-
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 &&
|
|
302
|
+
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Ge(r);
|
|
303
303
|
}
|
|
304
304
|
return e;
|
|
305
305
|
};
|
|
306
|
-
function
|
|
306
|
+
function L(e) {
|
|
307
307
|
if (typeof window > "u") throw Error("[tiptap error]: there is no window object available, so this function cannot be used");
|
|
308
308
|
let t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
|
|
309
|
-
return
|
|
309
|
+
return Ge(n);
|
|
310
310
|
}
|
|
311
|
-
function
|
|
311
|
+
function Ke(e) {
|
|
312
312
|
return typeof e?.nodesBetween == "function";
|
|
313
313
|
}
|
|
314
|
-
function
|
|
315
|
-
if (
|
|
314
|
+
function R(e, t, n) {
|
|
315
|
+
if (Ke(e)) return e;
|
|
316
316
|
let r = typeof e == "object" && !!e;
|
|
317
317
|
n = {
|
|
318
318
|
slice: !0,
|
|
@@ -321,16 +321,16 @@ function z(e, t, n) {
|
|
|
321
321
|
};
|
|
322
322
|
let i = typeof e == "string";
|
|
323
323
|
if (r) try {
|
|
324
|
-
if (Array.isArray(e) && e.length > 0) return
|
|
324
|
+
if (Array.isArray(e) && e.length > 0) return D.fromArray(e.map((e) => t.nodeFromJSON(e)));
|
|
325
325
|
let r = t.nodeFromJSON(e);
|
|
326
326
|
return n.errorOnInvalidContent && r.check(), r;
|
|
327
327
|
} catch (r) {
|
|
328
328
|
if (n.errorOnInvalidContent) throw Error("[tiptap error]: Invalid JSON content", { cause: r });
|
|
329
|
-
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", r),
|
|
329
|
+
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", r), R("", t, n);
|
|
330
330
|
}
|
|
331
331
|
if (i) {
|
|
332
332
|
if (n.errorOnInvalidContent) {
|
|
333
|
-
let r = !1, i = "", a = new
|
|
333
|
+
let r = !1, i = "", a = new le({
|
|
334
334
|
topNode: t.spec.topNode,
|
|
335
335
|
marks: t.spec.marks,
|
|
336
336
|
nodes: t.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {
|
|
@@ -342,17 +342,17 @@ function z(e, t, n) {
|
|
|
342
342
|
}]
|
|
343
343
|
} })
|
|
344
344
|
});
|
|
345
|
-
if (n.slice ?
|
|
345
|
+
if (n.slice ? se.fromSchema(a).parseSlice(L(e), n.parseOptions) : se.fromSchema(a).parse(L(e), n.parseOptions), n.errorOnInvalidContent && r) throw Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ Error(`Invalid element found: ${i}`) });
|
|
346
346
|
}
|
|
347
|
-
let r =
|
|
348
|
-
return n.slice ? r.parseSlice(
|
|
347
|
+
let r = se.fromSchema(t);
|
|
348
|
+
return n.slice ? r.parseSlice(L(e), n.parseOptions).content : r.parse(L(e), n.parseOptions);
|
|
349
349
|
}
|
|
350
|
-
return
|
|
350
|
+
return R("", t, n);
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function qe(e) {
|
|
353
353
|
return !("type" in e);
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function Je(e, r, i) {
|
|
356
356
|
let a = e.steps.length - 1;
|
|
357
357
|
if (a < r) return;
|
|
358
358
|
let o = e.steps[a];
|
|
@@ -360,9 +360,9 @@ function qe(e, r, i) {
|
|
|
360
360
|
let s = e.mapping.maps[a], c = 0;
|
|
361
361
|
s.forEach((e, t, n, r) => {
|
|
362
362
|
c === 0 && (c = r);
|
|
363
|
-
}), e.setSelection(
|
|
363
|
+
}), e.setSelection(T.near(e.doc.resolve(c), i));
|
|
364
364
|
}
|
|
365
|
-
var
|
|
365
|
+
var Ye = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
366
366
|
if (i) {
|
|
367
367
|
n = {
|
|
368
368
|
parseOptions: a.options.parseOptions,
|
|
@@ -384,7 +384,7 @@ var Je = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
384
384
|
...n.parseOptions
|
|
385
385
|
};
|
|
386
386
|
if (!n.errorOnInvalidContent && !a.options.enableContentCheck && a.options.emitContentError) try {
|
|
387
|
-
|
|
387
|
+
R(t, a.schema, {
|
|
388
388
|
parseOptions: s,
|
|
389
389
|
errorOnInvalidContent: !0
|
|
390
390
|
});
|
|
@@ -392,7 +392,7 @@ var Je = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
392
392
|
o(e);
|
|
393
393
|
}
|
|
394
394
|
try {
|
|
395
|
-
i =
|
|
395
|
+
i = R(t, a.schema, {
|
|
396
396
|
parseOptions: s,
|
|
397
397
|
errorOnInvalidContent: n.errorOnInvalidContent ?? a.options.enableContentCheck
|
|
398
398
|
});
|
|
@@ -405,7 +405,7 @@ var Je = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
405
405
|
} : {
|
|
406
406
|
from: e.from,
|
|
407
407
|
to: e.to
|
|
408
|
-
}, u = !0, d = !0, f =
|
|
408
|
+
}, u = !0, d = !0, f = qe(i) ? i.content : [i];
|
|
409
409
|
if (f.forEach((e) => {
|
|
410
410
|
e.check(), u = u ? e.isText && e.marks.length === 0 : !1, d = d ? e.isBlock : !1;
|
|
411
411
|
}), c === l && d) {
|
|
@@ -413,13 +413,13 @@ var Je = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
413
413
|
e.isTextblock && !e.type.spec.code && !e.childCount && (--c, l += 1);
|
|
414
414
|
}
|
|
415
415
|
let p;
|
|
416
|
-
if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") :
|
|
416
|
+
if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") : Ke(t) ? f.map((e) => e.text ?? "").join("") : typeof t == "object" && t && t.text ? t.text : t, r.insertText(p, c, l);
|
|
417
417
|
else {
|
|
418
|
-
p =
|
|
418
|
+
p = D.from(f);
|
|
419
419
|
let e = r.doc.resolve(c), t = e.node(), n = e.parentOffset === 0, i = t.isText || t.isTextblock, a = t.content.size > 0;
|
|
420
420
|
n && i && a && d && (c = Math.max(0, c - 1)), r.replaceWith(c, l, f);
|
|
421
421
|
}
|
|
422
|
-
n.updateSelection &&
|
|
422
|
+
n.updateSelection && Je(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", {
|
|
423
423
|
from: c,
|
|
424
424
|
text: p
|
|
425
425
|
}), n.applyPasteRules && r.setMeta("applyPasteRules", {
|
|
@@ -429,43 +429,43 @@ var Je = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
429
429
|
}
|
|
430
430
|
return !0;
|
|
431
431
|
};
|
|
432
|
-
function
|
|
432
|
+
function Xe(e) {
|
|
433
433
|
for (let t = 0; t < e.edgeCount; t += 1) {
|
|
434
434
|
let { type: n } = e.edge(t);
|
|
435
435
|
if (n.isTextblock && !n.hasRequiredAttrs()) return n;
|
|
436
436
|
}
|
|
437
437
|
return null;
|
|
438
438
|
}
|
|
439
|
-
var
|
|
439
|
+
var Ze = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
|
|
440
440
|
let { pos: i, attrs: a, content: o, updateSelection: s = !0 } = e, c;
|
|
441
441
|
c = typeof i == "number" ? t.doc.resolve(i) : i || t.selection.$from;
|
|
442
|
-
let l =
|
|
442
|
+
let l = Xe(c.parent.contentMatchAt(c.index()));
|
|
443
443
|
if (!l) return !1;
|
|
444
444
|
let u = Object.keys(l.spec.attrs || {}), d = a ? Object.fromEntries(Object.entries(a).filter(([e]) => u.includes(e))) : {}, f;
|
|
445
445
|
if (o) {
|
|
446
|
-
let e =
|
|
446
|
+
let e = R(o, r.schema);
|
|
447
447
|
f = l.createAndFill(d, e);
|
|
448
448
|
} else f = l.createAndFill(d);
|
|
449
|
-
return f ? (n && (t.insert(c.pos, f), s &&
|
|
450
|
-
},
|
|
449
|
+
return f ? (n && (t.insert(c.pos, f), s && Je(t, t.steps.length - 1, -1)), !0) : !1;
|
|
450
|
+
}, Qe = () => ({ state: e, dispatch: t }) => g(e, t), $e = () => ({ state: e, dispatch: t }) => f(e, t), et = () => ({ state: e, dispatch: t }) => d(e, t), tt = () => ({ state: e, dispatch: t }) => p(e, t), nt = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
451
451
|
try {
|
|
452
452
|
let r = s(e.doc, e.selection.$from.pos, -1);
|
|
453
453
|
return r != null && (n.join(r, 2), t && t(n), !0);
|
|
454
454
|
} catch {
|
|
455
455
|
return !1;
|
|
456
456
|
}
|
|
457
|
-
},
|
|
457
|
+
}, rt = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
458
458
|
try {
|
|
459
459
|
let r = s(e.doc, e.selection.$from.pos, 1);
|
|
460
460
|
return r != null && (n.join(r, 2), t && t(n), !0);
|
|
461
461
|
} catch {
|
|
462
462
|
return !1;
|
|
463
463
|
}
|
|
464
|
-
},
|
|
465
|
-
function
|
|
464
|
+
}, it = () => ({ state: e, dispatch: t }) => m(e, t), at = () => ({ state: e, dispatch: t }) => h(e, t);
|
|
465
|
+
function ot() {
|
|
466
466
|
return typeof navigator < "u" && /Mac/.test(navigator.platform);
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function st(e) {
|
|
469
469
|
let t = e.split(/-(?!$)/), n = t[t.length - 1];
|
|
470
470
|
n === "Space" && (n = " ");
|
|
471
471
|
let r, i, a, o;
|
|
@@ -475,13 +475,13 @@ function ot(e) {
|
|
|
475
475
|
else if (/^a(lt)?$/i.test(n)) r = !0;
|
|
476
476
|
else if (/^(c|ctrl|control)$/i.test(n)) i = !0;
|
|
477
477
|
else if (/^s(hift)?$/i.test(n)) a = !0;
|
|
478
|
-
else if (/^mod$/i.test(n))
|
|
478
|
+
else if (/^mod$/i.test(n)) I() || ot() ? o = !0 : i = !0;
|
|
479
479
|
else throw Error(`Unrecognized modifier name: ${n}`);
|
|
480
480
|
}
|
|
481
481
|
return r && (n = `Alt-${n}`), i && (n = `Ctrl-${n}`), o && (n = `Meta-${n}`), a && (n = `Shift-${n}`), n;
|
|
482
482
|
}
|
|
483
|
-
var
|
|
484
|
-
let a =
|
|
483
|
+
var ct = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
|
|
484
|
+
let a = st(e).split(/-(?!$)/), o = a.find((e) => ![
|
|
485
485
|
"Alt",
|
|
486
486
|
"Ctrl",
|
|
487
487
|
"Meta",
|
|
@@ -502,7 +502,7 @@ var st = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
|
|
|
502
502
|
t && i && r.maybeStep(t);
|
|
503
503
|
}), !0;
|
|
504
504
|
};
|
|
505
|
-
function
|
|
505
|
+
function z(e, t, n = {}) {
|
|
506
506
|
let { from: r, to: i, empty: a } = e.selection, o = t ? j(t, e.schema) : null, s = [];
|
|
507
507
|
e.doc.nodesBetween(r, i, (e, t) => {
|
|
508
508
|
if (e.isText) return;
|
|
@@ -516,11 +516,11 @@ function B(e, t, n = {}) {
|
|
|
516
516
|
let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) => M(e.node.attrs, n, { strict: !1 }));
|
|
517
517
|
return a ? !!l.length : l.reduce((e, t) => e + t.to - t.from, 0) >= c;
|
|
518
518
|
}
|
|
519
|
-
var
|
|
519
|
+
var lt = (e, t = {}) => ({ state: n, dispatch: r }) => z(n, j(e, n.schema), t) ? ee(n, r) : !1, ut = () => ({ state: e, dispatch: t }) => te(e, t), dt = (e) => ({ state: t, dispatch: n }) => {
|
|
520
520
|
let r = j(e, t.schema);
|
|
521
|
-
return
|
|
522
|
-
},
|
|
523
|
-
function
|
|
521
|
+
return de(r)(t, n);
|
|
522
|
+
}, ft = () => ({ state: e, dispatch: t }) => _(e, t);
|
|
523
|
+
function B(e, t) {
|
|
524
524
|
return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
|
|
525
525
|
}
|
|
526
526
|
function pt(e, t) {
|
|
@@ -528,7 +528,7 @@ function pt(e, t) {
|
|
|
528
528
|
return Object.keys(e).reduce((t, r) => (n.includes(r) || (t[r] = e[r]), t), {});
|
|
529
529
|
}
|
|
530
530
|
var mt = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
531
|
-
let a = null, o = null, s =
|
|
531
|
+
let a = null, o = null, s = B(typeof e == "string" ? e : e.name, r.schema);
|
|
532
532
|
if (!s) return !1;
|
|
533
533
|
s === "node" && (a = j(e, r.schema)), s === "mark" && (o = P(e, r.schema));
|
|
534
534
|
let c = !1;
|
|
@@ -547,7 +547,7 @@ var mt = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
547
547
|
return !0;
|
|
548
548
|
}, _t = () => ({ state: e, dispatch: t }) => ne(e, t), vt = () => ({ state: e, dispatch: t }) => v(e, t), yt = () => ({ state: e, dispatch: t }) => re(e, t), bt = () => ({ state: e, dispatch: t }) => ie(e, t), xt = () => ({ state: e, dispatch: t }) => y(e, t);
|
|
549
549
|
function St(e, t, n = {}, r = {}) {
|
|
550
|
-
return
|
|
550
|
+
return R(e, t, {
|
|
551
551
|
slice: !1,
|
|
552
552
|
parseOptions: n,
|
|
553
553
|
errorOnInvalidContent: r.errorOnInvalidContent
|
|
@@ -558,7 +558,7 @@ var Ct = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {
|
|
|
558
558
|
if (r.preserveWhitespace !== "full") {
|
|
559
559
|
let s = St(e, i.schema, r, { errorOnInvalidContent: t ?? i.options.enableContentCheck });
|
|
560
560
|
if (o) {
|
|
561
|
-
let e =
|
|
561
|
+
let e = qe(s) ? s.content : [s];
|
|
562
562
|
a.replaceWith(0, c.content.size, e).setMeta("preventUpdate", !n);
|
|
563
563
|
}
|
|
564
564
|
return !0;
|
|
@@ -607,47 +607,47 @@ function Dt(e, t) {
|
|
|
607
607
|
};
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
function
|
|
610
|
+
function Ot(e) {
|
|
611
611
|
return (t) => Dt(t.$from, e);
|
|
612
612
|
}
|
|
613
|
-
function
|
|
614
|
-
return e.config[t] === void 0 && e.parent ?
|
|
613
|
+
function V(e, t, n) {
|
|
614
|
+
return e.config[t] === void 0 && e.parent ? V(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
|
|
615
615
|
...n,
|
|
616
|
-
parent: e.parent ?
|
|
616
|
+
parent: e.parent ? V(e.parent, t, n) : null
|
|
617
617
|
}) : e.config[t];
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function kt(e) {
|
|
620
620
|
return e.map((e) => {
|
|
621
|
-
let t =
|
|
621
|
+
let t = V(e, "addExtensions", {
|
|
622
622
|
name: e.name,
|
|
623
623
|
options: e.options,
|
|
624
624
|
storage: e.storage
|
|
625
625
|
});
|
|
626
|
-
return t ? [e, ...
|
|
626
|
+
return t ? [e, ...kt(t())] : e;
|
|
627
627
|
}).flat(10);
|
|
628
628
|
}
|
|
629
|
-
function
|
|
630
|
-
let n =
|
|
629
|
+
function At(e, t) {
|
|
630
|
+
let n = ce.fromSchema(t).serializeFragment(e), r = document.implementation.createHTMLDocument().createElement("div");
|
|
631
631
|
return r.appendChild(n), r.innerHTML;
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function jt(e) {
|
|
634
634
|
return typeof e == "function";
|
|
635
635
|
}
|
|
636
|
-
function
|
|
637
|
-
return
|
|
636
|
+
function H(e, t = void 0, ...n) {
|
|
637
|
+
return jt(e) ? t ? e.bind(t)(...n) : e(...n) : e;
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function Mt(e = {}) {
|
|
640
640
|
return Object.keys(e).length === 0 && e.constructor === Object;
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function U(e) {
|
|
643
643
|
return {
|
|
644
644
|
baseExtensions: e.filter((e) => e.type === "extension"),
|
|
645
645
|
nodeExtensions: e.filter((e) => e.type === "node"),
|
|
646
646
|
markExtensions: e.filter((e) => e.type === "mark")
|
|
647
647
|
};
|
|
648
648
|
}
|
|
649
|
-
function
|
|
650
|
-
let t = [], { nodeExtensions: n, markExtensions: r } =
|
|
649
|
+
function Nt(e) {
|
|
650
|
+
let t = [], { nodeExtensions: n, markExtensions: r } = U(e), i = [...n, ...r], a = {
|
|
651
651
|
default: null,
|
|
652
652
|
validate: void 0,
|
|
653
653
|
rendered: !0,
|
|
@@ -657,7 +657,7 @@ function Mt(e) {
|
|
|
657
657
|
isRequired: !1
|
|
658
658
|
}, o = n.filter((e) => e.name !== "text").map((e) => e.name), s = r.map((e) => e.name), c = [...o, ...s];
|
|
659
659
|
return e.forEach((e) => {
|
|
660
|
-
let n =
|
|
660
|
+
let n = V(e, "addGlobalAttributes", {
|
|
661
661
|
name: e.name,
|
|
662
662
|
options: e.options,
|
|
663
663
|
storage: e.storage,
|
|
@@ -679,7 +679,7 @@ function Mt(e) {
|
|
|
679
679
|
});
|
|
680
680
|
});
|
|
681
681
|
}), i.forEach((e) => {
|
|
682
|
-
let n =
|
|
682
|
+
let n = V(e, "addAttributes", {
|
|
683
683
|
name: e.name,
|
|
684
684
|
options: e.options,
|
|
685
685
|
storage: e.storage
|
|
@@ -699,7 +699,7 @@ function Mt(e) {
|
|
|
699
699
|
});
|
|
700
700
|
}), t;
|
|
701
701
|
}
|
|
702
|
-
function
|
|
702
|
+
function Pt(e) {
|
|
703
703
|
let t = [], n = "", r = !1, i = !1, a = 0, o = e.length;
|
|
704
704
|
for (let s = 0; s < o; s += 1) {
|
|
705
705
|
let o = e[s];
|
|
@@ -729,8 +729,8 @@ function Nt(e) {
|
|
|
729
729
|
}
|
|
730
730
|
return n && t.push(n), t;
|
|
731
731
|
}
|
|
732
|
-
function
|
|
733
|
-
let t = [], n =
|
|
732
|
+
function Ft(e) {
|
|
733
|
+
let t = [], n = Pt(e || ""), r = n.length;
|
|
734
734
|
for (let e = 0; e < r; e += 1) {
|
|
735
735
|
let r = n[e], i = r.indexOf(":");
|
|
736
736
|
if (i === -1) continue;
|
|
@@ -739,7 +739,7 @@ function Pt(e) {
|
|
|
739
739
|
}
|
|
740
740
|
return t;
|
|
741
741
|
}
|
|
742
|
-
function
|
|
742
|
+
function It(...e) {
|
|
743
743
|
return e.filter((e) => !!e).reduce((e, t) => {
|
|
744
744
|
let n = { ...e };
|
|
745
745
|
return Object.entries(t).forEach(([e, t]) => {
|
|
@@ -760,26 +760,26 @@ function Ft(...e) {
|
|
|
760
760
|
let r = t ? String(t).split(" ") : [], i = n[e] ? n[e].split(" ") : [], a = r.filter((e) => !i.includes(e));
|
|
761
761
|
n[e] = [...i, ...a].join(" ");
|
|
762
762
|
} else if (e === "style") {
|
|
763
|
-
let r = new Map([...
|
|
763
|
+
let r = new Map([...Ft(n[e]), ...Ft(t)]);
|
|
764
764
|
n[e] = Array.from(r.entries()).map(([e, t]) => `${e}: ${t}`).join("; ");
|
|
765
765
|
} else n[e] = t;
|
|
766
766
|
}), n;
|
|
767
767
|
}, {});
|
|
768
768
|
}
|
|
769
|
-
function
|
|
770
|
-
return t.filter((t) => t.type === e.type.name).filter((e) => e.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(e.attrs) || {} : { [t.name]: e.attrs[t.name] }).reduce((e, t) =>
|
|
769
|
+
function W(e, t) {
|
|
770
|
+
return t.filter((t) => t.type === e.type.name).filter((e) => e.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(e.attrs) || {} : { [t.name]: e.attrs[t.name] }).reduce((e, t) => It(e, t), {});
|
|
771
771
|
}
|
|
772
|
-
function
|
|
772
|
+
function Lt(e) {
|
|
773
773
|
return typeof e == "string" ? e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" || e !== "false" && e : e;
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function Rt(e, t) {
|
|
776
776
|
return "style" in e ? e : {
|
|
777
777
|
...e,
|
|
778
778
|
getAttrs: (n) => {
|
|
779
779
|
let r = e.getAttrs ? e.getAttrs(n) : e.attrs;
|
|
780
780
|
if (r === !1) return !1;
|
|
781
781
|
let i = t.reduce((e, t) => {
|
|
782
|
-
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) :
|
|
782
|
+
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) : Lt(n.getAttribute(t.name));
|
|
783
783
|
return r == null ? e : {
|
|
784
784
|
...e,
|
|
785
785
|
[t.name]: r
|
|
@@ -792,50 +792,50 @@ function Lt(e, t) {
|
|
|
792
792
|
}
|
|
793
793
|
};
|
|
794
794
|
}
|
|
795
|
-
function Rt(e) {
|
|
796
|
-
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && jt(t) ? !1 : t != null));
|
|
797
|
-
}
|
|
798
795
|
function zt(e) {
|
|
796
|
+
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && Mt(t) ? !1 : t != null));
|
|
797
|
+
}
|
|
798
|
+
function Bt(e) {
|
|
799
799
|
var t, n;
|
|
800
800
|
let r = {};
|
|
801
801
|
return !(e != null && (t = e.attribute) != null && t.isRequired) && "default" in (e?.attribute || {}) && (r.default = e.attribute.default), (e == null || (n = e.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = e.attribute.validate), [e.name, r];
|
|
802
802
|
}
|
|
803
|
-
function
|
|
804
|
-
let n =
|
|
803
|
+
function Vt(e, t) {
|
|
804
|
+
let n = Nt(e), { nodeExtensions: r, markExtensions: i } = U(e), a = r.find((e) => V(e, "topNode"))?.name, o = Object.fromEntries(r.map((r) => {
|
|
805
805
|
let i = n.filter((e) => e.type === r.name), a = {
|
|
806
806
|
name: r.name,
|
|
807
807
|
options: r.options,
|
|
808
808
|
storage: r.storage,
|
|
809
809
|
editor: t
|
|
810
|
-
}, o =
|
|
810
|
+
}, o = zt({
|
|
811
811
|
...e.reduce((e, t) => {
|
|
812
|
-
let n =
|
|
812
|
+
let n = V(t, "extendNodeSchema", a);
|
|
813
813
|
return {
|
|
814
814
|
...e,
|
|
815
815
|
...n ? n(r) : {}
|
|
816
816
|
};
|
|
817
817
|
}, {}),
|
|
818
|
-
content:
|
|
819
|
-
marks:
|
|
820
|
-
group:
|
|
821
|
-
inline:
|
|
822
|
-
atom:
|
|
823
|
-
selectable:
|
|
824
|
-
draggable:
|
|
825
|
-
code:
|
|
826
|
-
whitespace:
|
|
827
|
-
linebreakReplacement:
|
|
828
|
-
defining:
|
|
829
|
-
isolating:
|
|
830
|
-
attrs: Object.fromEntries(i.map(
|
|
831
|
-
}), s =
|
|
832
|
-
s && (o.parseDOM = s.map((e) =>
|
|
833
|
-
let c =
|
|
818
|
+
content: H(V(r, "content", a)),
|
|
819
|
+
marks: H(V(r, "marks", a)),
|
|
820
|
+
group: H(V(r, "group", a)),
|
|
821
|
+
inline: H(V(r, "inline", a)),
|
|
822
|
+
atom: H(V(r, "atom", a)),
|
|
823
|
+
selectable: H(V(r, "selectable", a)),
|
|
824
|
+
draggable: H(V(r, "draggable", a)),
|
|
825
|
+
code: H(V(r, "code", a)),
|
|
826
|
+
whitespace: H(V(r, "whitespace", a)),
|
|
827
|
+
linebreakReplacement: H(V(r, "linebreakReplacement", a)),
|
|
828
|
+
defining: H(V(r, "defining", a)),
|
|
829
|
+
isolating: H(V(r, "isolating", a)),
|
|
830
|
+
attrs: Object.fromEntries(i.map(Bt))
|
|
831
|
+
}), s = H(V(r, "parseHTML", a));
|
|
832
|
+
s && (o.parseDOM = s.map((e) => Rt(e, i)));
|
|
833
|
+
let c = V(r, "renderHTML", a);
|
|
834
834
|
c && (o.toDOM = (e) => c({
|
|
835
835
|
node: e,
|
|
836
|
-
HTMLAttributes:
|
|
836
|
+
HTMLAttributes: W(e, i)
|
|
837
837
|
}));
|
|
838
|
-
let l =
|
|
838
|
+
let l = V(r, "renderText", a);
|
|
839
839
|
return l && (o.toText = l), [r.name, o];
|
|
840
840
|
})), s = Object.fromEntries(i.map((r) => {
|
|
841
841
|
let i = n.filter((e) => e.type === r.name), a = {
|
|
@@ -843,49 +843,49 @@ function Bt(e, t) {
|
|
|
843
843
|
options: r.options,
|
|
844
844
|
storage: r.storage,
|
|
845
845
|
editor: t
|
|
846
|
-
}, o =
|
|
846
|
+
}, o = zt({
|
|
847
847
|
...e.reduce((e, t) => {
|
|
848
|
-
let n =
|
|
848
|
+
let n = V(t, "extendMarkSchema", a);
|
|
849
849
|
return {
|
|
850
850
|
...e,
|
|
851
851
|
...n ? n(r) : {}
|
|
852
852
|
};
|
|
853
853
|
}, {}),
|
|
854
|
-
inclusive:
|
|
855
|
-
excludes:
|
|
856
|
-
group:
|
|
857
|
-
spanning:
|
|
858
|
-
code:
|
|
859
|
-
attrs: Object.fromEntries(i.map(
|
|
860
|
-
}), s =
|
|
861
|
-
s && (o.parseDOM = s.map((e) =>
|
|
862
|
-
let c =
|
|
854
|
+
inclusive: H(V(r, "inclusive", a)),
|
|
855
|
+
excludes: H(V(r, "excludes", a)),
|
|
856
|
+
group: H(V(r, "group", a)),
|
|
857
|
+
spanning: H(V(r, "spanning", a)),
|
|
858
|
+
code: H(V(r, "code", a)),
|
|
859
|
+
attrs: Object.fromEntries(i.map(Bt))
|
|
860
|
+
}), s = H(V(r, "parseHTML", a));
|
|
861
|
+
s && (o.parseDOM = s.map((e) => Rt(e, i)));
|
|
862
|
+
let c = V(r, "renderHTML", a);
|
|
863
863
|
return c && (o.toDOM = (e) => c({
|
|
864
864
|
mark: e,
|
|
865
|
-
HTMLAttributes:
|
|
865
|
+
HTMLAttributes: W(e, i)
|
|
866
866
|
})), [r.name, o];
|
|
867
867
|
}));
|
|
868
|
-
return new
|
|
868
|
+
return new le({
|
|
869
869
|
topNode: a,
|
|
870
870
|
nodes: o,
|
|
871
871
|
marks: s
|
|
872
872
|
});
|
|
873
873
|
}
|
|
874
|
-
function
|
|
874
|
+
function Ht(e) {
|
|
875
875
|
let t = e.filter((t, n) => e.indexOf(t) !== n);
|
|
876
876
|
return Array.from(new Set(t));
|
|
877
877
|
}
|
|
878
|
-
function
|
|
878
|
+
function G(e) {
|
|
879
879
|
return e.sort((e, t) => {
|
|
880
|
-
let n =
|
|
880
|
+
let n = V(e, "priority") || 100, r = V(t, "priority") || 100;
|
|
881
881
|
return n > r ? -1 : +(n < r);
|
|
882
882
|
});
|
|
883
883
|
}
|
|
884
|
-
function
|
|
885
|
-
let t =
|
|
884
|
+
function Ut(e) {
|
|
885
|
+
let t = G(kt(e)), n = Ht(t.map((e) => e.name));
|
|
886
886
|
return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e) => `'${e}'`).join(", ")}]. This can lead to issues.`), t;
|
|
887
887
|
}
|
|
888
|
-
function
|
|
888
|
+
function Wt(e, t, n) {
|
|
889
889
|
let { from: r, to: i } = t, { blockSeparator: a = "\n\n", textSerializers: o = {} } = n || {}, s = "";
|
|
890
890
|
return e.nodesBetween(r, i, (e, n, c, l) => {
|
|
891
891
|
e.isBlock && n > r && (s += a);
|
|
@@ -903,16 +903,16 @@ function Ut(e, t, n) {
|
|
|
903
903
|
}
|
|
904
904
|
}), s;
|
|
905
905
|
}
|
|
906
|
-
function
|
|
907
|
-
return
|
|
906
|
+
function Gt(e, t) {
|
|
907
|
+
return Wt(e, {
|
|
908
908
|
from: 0,
|
|
909
909
|
to: e.content.size
|
|
910
910
|
}, t);
|
|
911
911
|
}
|
|
912
|
-
function
|
|
912
|
+
function Kt(e) {
|
|
913
913
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
|
|
914
914
|
}
|
|
915
|
-
function
|
|
915
|
+
function qt(e, t) {
|
|
916
916
|
let n = j(t, e.schema), { from: r, to: i } = e.selection, a = [];
|
|
917
917
|
e.doc.nodesBetween(r, i, (e) => {
|
|
918
918
|
a.push(e);
|
|
@@ -920,22 +920,22 @@ function Kt(e, t) {
|
|
|
920
920
|
let o = a.reverse().find((e) => e.type.name === n.name);
|
|
921
921
|
return o ? { ...o.attrs } : {};
|
|
922
922
|
}
|
|
923
|
-
function
|
|
924
|
-
let n =
|
|
925
|
-
return n === "node" ?
|
|
923
|
+
function Jt(e, t) {
|
|
924
|
+
let n = B(typeof t == "string" ? t : t.name, e.schema);
|
|
925
|
+
return n === "node" ? qt(e, t) : n === "mark" ? wt(e, t) : {};
|
|
926
926
|
}
|
|
927
|
-
function
|
|
927
|
+
function Yt(e, t = JSON.stringify) {
|
|
928
928
|
let n = {};
|
|
929
929
|
return e.filter((e) => {
|
|
930
930
|
let r = t(e);
|
|
931
931
|
return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
|
|
932
932
|
});
|
|
933
933
|
}
|
|
934
|
-
function
|
|
935
|
-
let t =
|
|
934
|
+
function Xt(e) {
|
|
935
|
+
let t = Yt(e);
|
|
936
936
|
return t.length === 1 ? t : t.filter((e, n) => !t.filter((e, t) => t !== n).some((t) => e.oldRange.from >= t.oldRange.from && e.oldRange.to <= t.oldRange.to && e.newRange.from >= t.newRange.from && e.newRange.to <= t.newRange.to));
|
|
937
937
|
}
|
|
938
|
-
function
|
|
938
|
+
function Zt(e) {
|
|
939
939
|
let { mapping: t, steps: n } = e, r = [];
|
|
940
940
|
return t.maps.forEach((e, i) => {
|
|
941
941
|
let a = [];
|
|
@@ -966,9 +966,9 @@ function Xt(e) {
|
|
|
966
966
|
}
|
|
967
967
|
});
|
|
968
968
|
});
|
|
969
|
-
}),
|
|
969
|
+
}), Xt(r);
|
|
970
970
|
}
|
|
971
|
-
function
|
|
971
|
+
function Qt(e, t, n) {
|
|
972
972
|
let r = [];
|
|
973
973
|
return e === t ? n.resolve(e).marks().forEach((t) => {
|
|
974
974
|
let i = N(n.resolve(e), t.type);
|
|
@@ -977,36 +977,36 @@ function Zt(e, t, n) {
|
|
|
977
977
|
...i
|
|
978
978
|
});
|
|
979
979
|
}) : n.nodesBetween(e, t, (e, t) => {
|
|
980
|
-
|
|
980
|
+
e && e?.nodeSize !== void 0 && r.push(...e.marks.map((n) => ({
|
|
981
981
|
from: t,
|
|
982
982
|
to: t + e.nodeSize,
|
|
983
983
|
mark: n
|
|
984
984
|
})));
|
|
985
985
|
}), r;
|
|
986
986
|
}
|
|
987
|
-
var
|
|
987
|
+
var $t = (e, t, n, r = 20) => {
|
|
988
988
|
let i = e.doc.resolve(n), a = r, o = null;
|
|
989
989
|
for (; a > 0 && o === null;) {
|
|
990
990
|
let e = i.node(a);
|
|
991
991
|
e?.type.name === t ? o = e : --a;
|
|
992
992
|
}
|
|
993
993
|
return [o, a];
|
|
994
|
-
},
|
|
994
|
+
}, en = (e) => {
|
|
995
995
|
let t = e.depth - 1;
|
|
996
996
|
if (t < 0) return null;
|
|
997
997
|
let n = e.index(t);
|
|
998
998
|
return n === 0 ? null : e.node(t).child(n - 1);
|
|
999
999
|
};
|
|
1000
|
-
function
|
|
1000
|
+
function K(e, t) {
|
|
1001
1001
|
return t.nodes[e] || t.marks[e] || null;
|
|
1002
1002
|
}
|
|
1003
|
-
function
|
|
1003
|
+
function q(e, t, n) {
|
|
1004
1004
|
return Object.fromEntries(Object.entries(n).filter(([n]) => {
|
|
1005
1005
|
let r = e.find((e) => e.type === t && e.name === n);
|
|
1006
1006
|
return r ? r.attribute.keepOnSplit : !1;
|
|
1007
1007
|
}));
|
|
1008
1008
|
}
|
|
1009
|
-
var
|
|
1009
|
+
var tn = (e, t = 500) => {
|
|
1010
1010
|
let n = "", r = e.parentOffset;
|
|
1011
1011
|
return e.parent.nodesBetween(Math.max(0, r - t), r, (e, t, i, a) => {
|
|
1012
1012
|
var o;
|
|
@@ -1019,7 +1019,7 @@ var en = (e, t = 500) => {
|
|
|
1019
1019
|
n += e.isAtom && !e.isText ? s : s.slice(0, Math.max(0, r - t));
|
|
1020
1020
|
}), n;
|
|
1021
1021
|
};
|
|
1022
|
-
function
|
|
1022
|
+
function nn(e, t, n = {}) {
|
|
1023
1023
|
let { empty: r, ranges: i } = e.selection, a = t ? P(t, e.schema) : null;
|
|
1024
1024
|
if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) => M(e.attrs, n, { strict: !1 }));
|
|
1025
1025
|
let o = 0, s = [];
|
|
@@ -1039,38 +1039,38 @@ function tn(e, t, n = {}) {
|
|
|
1039
1039
|
let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) => M(e.mark.attrs, n, { strict: !1 })).reduce((e, t) => e + t.to - t.from, 0), l = s.filter((e) => !a || e.mark.type !== a && e.mark.type.excludes(a)).reduce((e, t) => e + t.to - t.from, 0);
|
|
1040
1040
|
return (c > 0 ? c + l : c) >= o;
|
|
1041
1041
|
}
|
|
1042
|
-
function
|
|
1043
|
-
if (!t) return
|
|
1044
|
-
let r =
|
|
1045
|
-
return r === "node" ?
|
|
1042
|
+
function rn(e, t, n = {}) {
|
|
1043
|
+
if (!t) return z(e, null, n) || nn(e, null, n);
|
|
1044
|
+
let r = B(t, e.schema);
|
|
1045
|
+
return r === "node" ? z(e, t, n) : r === "mark" && nn(e, t, n);
|
|
1046
1046
|
}
|
|
1047
|
-
var
|
|
1047
|
+
var an = (e, t) => {
|
|
1048
1048
|
let { $from: n, $to: r, $anchor: i } = e.selection;
|
|
1049
1049
|
if (t) {
|
|
1050
|
-
let n =
|
|
1050
|
+
let n = Ot((e) => e.type.name === t)(e.selection);
|
|
1051
1051
|
if (!n) return !1;
|
|
1052
1052
|
let r = e.doc.resolve(n.pos + 1);
|
|
1053
1053
|
return i.pos + 1 === r.end();
|
|
1054
1054
|
}
|
|
1055
1055
|
return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
|
|
1056
|
-
},
|
|
1056
|
+
}, on = (e) => {
|
|
1057
1057
|
let { $from: t, $to: n } = e.selection;
|
|
1058
1058
|
return !(t.parentOffset > 0 || t.pos !== n.pos);
|
|
1059
1059
|
};
|
|
1060
|
-
function
|
|
1060
|
+
function sn(e, t) {
|
|
1061
1061
|
return Array.isArray(t) ? t.some((t) => (typeof t == "string" ? t : t.name) === e.name) : t;
|
|
1062
1062
|
}
|
|
1063
|
-
function
|
|
1064
|
-
let { nodeExtensions: n } =
|
|
1063
|
+
function cn(e, t) {
|
|
1064
|
+
let { nodeExtensions: n } = U(t), r = n.find((t) => t.name === e);
|
|
1065
1065
|
if (!r) return !1;
|
|
1066
|
-
let i =
|
|
1066
|
+
let i = H(V(r, "group", {
|
|
1067
1067
|
name: r.name,
|
|
1068
1068
|
options: r.options,
|
|
1069
1069
|
storage: r.storage
|
|
1070
1070
|
}));
|
|
1071
1071
|
return typeof i == "string" && i.split(" ").includes("list");
|
|
1072
1072
|
}
|
|
1073
|
-
function
|
|
1073
|
+
function J(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
1074
1074
|
if (n) {
|
|
1075
1075
|
if (e.type.name === "hardBreak") return !0;
|
|
1076
1076
|
if (e.isText) return !/\S/.test(e.text ?? "");
|
|
@@ -1081,7 +1081,7 @@ function Y(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1081
1081
|
if (t) {
|
|
1082
1082
|
let r = !0;
|
|
1083
1083
|
return e.content.forEach((e) => {
|
|
1084
|
-
r !== !1 && (
|
|
1084
|
+
r !== !1 && (J(e, {
|
|
1085
1085
|
ignoreWhitespace: n,
|
|
1086
1086
|
checkChildren: t
|
|
1087
1087
|
}) || (r = !1));
|
|
@@ -1089,12 +1089,8 @@ function Y(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
return !1;
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1093
|
-
return e instanceof
|
|
1094
|
-
}
|
|
1095
|
-
function ln({ selection: e, pos: t, nodeSize: n, selectedOnTextSelection: r = !1 }) {
|
|
1096
|
-
let { from: i, to: a } = e;
|
|
1097
|
-
return !!(i <= t && a >= t + n || r && F(e) && i > t && a < t + n);
|
|
1092
|
+
function ln(e) {
|
|
1093
|
+
return e instanceof S;
|
|
1098
1094
|
}
|
|
1099
1095
|
var un = class e {
|
|
1100
1096
|
constructor(e) {
|
|
@@ -1118,7 +1114,7 @@ function fn(e) {
|
|
|
1118
1114
|
return new un(e);
|
|
1119
1115
|
}
|
|
1120
1116
|
function pn(e, t, n) {
|
|
1121
|
-
let r = e.state.doc.content.size, i =
|
|
1117
|
+
let r = e.state.doc.content.size, i = F(t, 0, r), a = F(n, 0, r), o = e.coordsAtPos(i), s = e.coordsAtPos(a, -1), c = Math.min(o.top, s.top), l = Math.max(o.bottom, s.bottom), u = Math.min(o.left, s.left), d = Math.max(o.right, s.right), f = {
|
|
1122
1118
|
top: c,
|
|
1123
1119
|
bottom: l,
|
|
1124
1120
|
left: u,
|
|
@@ -1135,7 +1131,7 @@ function pn(e, t, n) {
|
|
|
1135
1131
|
}
|
|
1136
1132
|
function mn(e, t, n) {
|
|
1137
1133
|
let { selection: r } = t, i = null;
|
|
1138
|
-
if (
|
|
1134
|
+
if (Re(r) && (i = r.$cursor), i) {
|
|
1139
1135
|
let t = e.storedMarks ?? i.marks();
|
|
1140
1136
|
return i.parent.type.allowsMarkType(n) && (!!n.isInSet(t) || !t.some((e) => e.type.excludes(n)));
|
|
1141
1137
|
}
|
|
@@ -1186,7 +1182,7 @@ var hn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1186
1182
|
})(e, r)).run() : (console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes."), !1);
|
|
1187
1183
|
}, vn = (e) => ({ tr: t, dispatch: n }) => {
|
|
1188
1184
|
if (n) {
|
|
1189
|
-
let { doc: n } = t, r =
|
|
1185
|
+
let { doc: n } = t, r = F(e, 0, n.content.size), i = S.create(n, r);
|
|
1190
1186
|
t.setSelection(i);
|
|
1191
1187
|
}
|
|
1192
1188
|
return !0;
|
|
@@ -1203,13 +1199,13 @@ var hn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1203
1199
|
let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
|
|
1204
1200
|
from: e,
|
|
1205
1201
|
to: e
|
|
1206
|
-
} : e, a =
|
|
1202
|
+
} : e, a = E.atStart(n).from, o = E.atEnd(n).to, s = F(r, a, o), c = F(i, a, o), l = E.create(n, s, c);
|
|
1207
1203
|
t.setSelection(l);
|
|
1208
1204
|
}
|
|
1209
1205
|
return !0;
|
|
1210
1206
|
}, xn = (e) => ({ state: t, dispatch: n }) => {
|
|
1211
1207
|
let r = j(e, t.schema);
|
|
1212
|
-
return
|
|
1208
|
+
return fe(r)(t, n);
|
|
1213
1209
|
};
|
|
1214
1210
|
function Sn(e, t) {
|
|
1215
1211
|
let n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
@@ -1219,10 +1215,10 @@ function Sn(e, t) {
|
|
|
1219
1215
|
}
|
|
1220
1216
|
}
|
|
1221
1217
|
var Cn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: i }) => {
|
|
1222
|
-
let { selection: o, doc: s } = t, { $from: c, $to: l } = o, u = i.extensionManager.attributes, d =
|
|
1223
|
-
if (o instanceof
|
|
1218
|
+
let { selection: o, doc: s } = t, { $from: c, $to: l } = o, u = i.extensionManager.attributes, d = q(u, c.node().type.name, c.node().attrs);
|
|
1219
|
+
if (o instanceof S && o.node.isBlock) return !c.parentOffset || !a(s, c.pos) ? !1 : (r && (e && Sn(n, i.extensionManager.splittableMarks), t.split(c.pos).scrollIntoView()), !0);
|
|
1224
1220
|
if (!c.parent.isBlock) return !1;
|
|
1225
|
-
let f = l.parentOffset === l.parent.content.size, p = c.depth === 0 ? void 0 :
|
|
1221
|
+
let f = l.parentOffset === l.parent.content.size, p = c.depth === 0 ? void 0 : Xe(c.node(-1).contentMatchAt(c.indexAfter(-1))), m = f && p ? [{
|
|
1226
1222
|
type: p,
|
|
1227
1223
|
attrs: d
|
|
1228
1224
|
}] : void 0, h = a(t.doc, t.mapping.map(c.pos), 1, m);
|
|
@@ -1230,7 +1226,7 @@ var Cn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
1230
1226
|
type: p,
|
|
1231
1227
|
attrs: d
|
|
1232
1228
|
}] : void 0), r) {
|
|
1233
|
-
if (h && (o instanceof
|
|
1229
|
+
if (h && (o instanceof E && t.deleteSelection(), t.split(t.mapping.map(c.pos), 1, m), p && !f && !c.parentOffset && c.parent.type !== p)) {
|
|
1234
1230
|
let e = t.mapping.map(c.before()), n = t.doc.resolve(e);
|
|
1235
1231
|
c.node(-1).canReplaceWith(n.index(), n.index() + 1, p) && t.setNodeMarkup(t.mapping.map(c.before()), p);
|
|
1236
1232
|
}
|
|
@@ -1246,28 +1242,28 @@ var Cn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
1246
1242
|
if (c.parent.content.size === 0 && c.node(-1).childCount === c.indexAfter(-1)) {
|
|
1247
1243
|
if (c.depth === 2 || c.node(-3).type !== s || c.index(-2) !== c.node(-2).childCount - 1) return !1;
|
|
1248
1244
|
if (i) {
|
|
1249
|
-
let e =
|
|
1250
|
-
for (let t = c.depth - r; t >= c.depth - 3; --t) e =
|
|
1245
|
+
let e = D.empty, r = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
|
|
1246
|
+
for (let t = c.depth - r; t >= c.depth - 3; --t) e = D.from(c.node(t).copy(e));
|
|
1251
1247
|
let i = c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3, a = {
|
|
1252
|
-
...
|
|
1248
|
+
...q(f, c.node().type.name, c.node().attrs),
|
|
1253
1249
|
...t
|
|
1254
1250
|
}, o = s.contentMatch.defaultType?.createAndFill(a) || void 0;
|
|
1255
|
-
e = e.append(
|
|
1251
|
+
e = e.append(D.from(s.createAndFill(null, o) || void 0));
|
|
1256
1252
|
let l = c.before(c.depth - (r - 1));
|
|
1257
|
-
n.replace(l, c.after(-i), new
|
|
1253
|
+
n.replace(l, c.after(-i), new ue(e, 4 - r, 0));
|
|
1258
1254
|
let u = -1;
|
|
1259
1255
|
n.doc.nodesBetween(l, n.doc.content.size, (e, t) => {
|
|
1260
1256
|
if (u > -1) return !1;
|
|
1261
1257
|
e.isTextblock && e.content.size === 0 && (u = t + 1);
|
|
1262
|
-
}), u > -1 && n.setSelection(
|
|
1258
|
+
}), u > -1 && n.setSelection(E.near(n.doc.resolve(u))), n.scrollIntoView();
|
|
1263
1259
|
}
|
|
1264
1260
|
return !0;
|
|
1265
1261
|
}
|
|
1266
1262
|
let p = l.pos === c.end() ? d.contentMatchAt(0).defaultType : null, m = {
|
|
1267
|
-
...
|
|
1263
|
+
...q(f, d.type.name, d.attrs),
|
|
1268
1264
|
...t
|
|
1269
1265
|
}, h = {
|
|
1270
|
-
...
|
|
1266
|
+
...q(f, c.node().type.name, c.node().attrs),
|
|
1271
1267
|
...t
|
|
1272
1268
|
};
|
|
1273
1269
|
n.delete(c.pos, l.pos);
|
|
@@ -1297,14 +1293,14 @@ function En(e, t) {
|
|
|
1297
1293
|
return Tn(e) === Tn(t);
|
|
1298
1294
|
}
|
|
1299
1295
|
var Dn = (e, t) => {
|
|
1300
|
-
let n =
|
|
1296
|
+
let n = Ot((e) => e.type === t)(e.selection);
|
|
1301
1297
|
if (!n) return !0;
|
|
1302
1298
|
let r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
1303
1299
|
if (r === void 0) return !0;
|
|
1304
1300
|
let a = e.doc.nodeAt(r);
|
|
1305
1301
|
return !(n.node.type === a?.type && i(e.doc, n.pos)) || !En(n.node.attrs.type, a?.attrs.type) || e.join(n.pos), !0;
|
|
1306
1302
|
}, On = (e, t) => {
|
|
1307
|
-
let n =
|
|
1303
|
+
let n = Ot((e) => e.type === t)(e.selection);
|
|
1308
1304
|
if (!n) return !0;
|
|
1309
1305
|
let r = e.doc.resolve(n.start).after(n.depth);
|
|
1310
1306
|
if (r === void 0) return !0;
|
|
@@ -1315,22 +1311,22 @@ function kn(e) {
|
|
|
1315
1311
|
let t = e.doc, n = t.firstChild;
|
|
1316
1312
|
if (!n) return null;
|
|
1317
1313
|
let r = t.resolve(1), i = t.resolve(n.nodeSize - 1);
|
|
1318
|
-
return
|
|
1314
|
+
return E.between(r, i);
|
|
1319
1315
|
}
|
|
1320
1316
|
var An = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain: c, commands: l, can: u }) => {
|
|
1321
|
-
let { extensions: d, splittableMarks: f } = i.extensionManager, p = j(e, o.schema), m = j(t, o.schema), { selection: h, storedMarks: g } = o, { $from:
|
|
1322
|
-
if (!
|
|
1323
|
-
let v =
|
|
1317
|
+
let { extensions: d, splittableMarks: f } = i.extensionManager, p = j(e, o.schema), m = j(t, o.schema), { selection: h, storedMarks: g } = o, { $from: ee, $to: te } = h, _ = ee.blockRange(te), ne = g || h.$to.parentOffset && h.$from.marks();
|
|
1318
|
+
if (!_) return !1;
|
|
1319
|
+
let v = Ot((e) => cn(e.type.name, d))(h), re = h.from === 0 && h.to === o.doc.content.size, ie = o.doc.content.content, y = ie.length === 1 ? ie[0] : null, b = re && y && cn(y.type.name, d) ? {
|
|
1324
1320
|
node: y,
|
|
1325
1321
|
pos: 0,
|
|
1326
1322
|
depth: 0
|
|
1327
|
-
} : null, x = v ?? b, ae = !!v &&
|
|
1328
|
-
if ((ae ||
|
|
1329
|
-
if (x.node.type === p) return re &&
|
|
1323
|
+
} : null, x = v ?? b, ae = !!v && _.depth >= 1 && _.depth - v.depth <= 1, oe = !!b;
|
|
1324
|
+
if ((ae || oe) && x) {
|
|
1325
|
+
if (x.node.type === p) return re && oe ? c().command(({ tr: e, dispatch: t }) => {
|
|
1330
1326
|
let n = kn(e);
|
|
1331
1327
|
return n ? (e.setSelection(n), t && t(e), !0) : !1;
|
|
1332
1328
|
}).liftListItem(m).run() : l.liftListItem(m);
|
|
1333
|
-
if (
|
|
1329
|
+
if (cn(x.node.type.name, d) && p.validContent(x.node.content)) return c().command(() => (a.setNodeMarkup(x.pos, p), !0)).command(() => Dn(a, p)).command(() => On(a, p)).run();
|
|
1334
1330
|
}
|
|
1335
1331
|
return !n || !ne || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() => Dn(a, p)).command(() => On(a, p)).run() : c().command(() => {
|
|
1336
1332
|
let e = u().wrapInList(p, r), t = ne.filter((e) => f.includes(e.type.name));
|
|
@@ -1338,16 +1334,16 @@ var An = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1338
1334
|
}).wrapInList(p, r).command(() => Dn(a, p)).command(() => On(a, p)).run();
|
|
1339
1335
|
}, jn = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
|
|
1340
1336
|
let { extendEmptyMarkRange: a = !1 } = n, o = P(e, r.schema);
|
|
1341
|
-
return
|
|
1337
|
+
return nn(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
|
|
1342
1338
|
}, Mn = (e, t, n = {}) => ({ state: r, commands: i }) => {
|
|
1343
|
-
let a = j(e, r.schema), o = j(t, r.schema), s =
|
|
1339
|
+
let a = j(e, r.schema), o = j(t, r.schema), s = z(r, a, n), c;
|
|
1344
1340
|
return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), s ? i.setNode(o, c) : i.setNode(a, {
|
|
1345
1341
|
...c,
|
|
1346
1342
|
...n
|
|
1347
1343
|
});
|
|
1348
1344
|
}, Nn = (e, t = {}) => ({ state: n, commands: r }) => {
|
|
1349
1345
|
let i = j(e, n.schema);
|
|
1350
|
-
return
|
|
1346
|
+
return z(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
|
|
1351
1347
|
}, Pn = () => ({ state: e, dispatch: t }) => {
|
|
1352
1348
|
let n = e.plugins;
|
|
1353
1349
|
for (let r = 0; r < n.length; r += 1) {
|
|
@@ -1394,7 +1390,7 @@ var An = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1394
1390
|
delete r.dir, t.setNodeMarkup(n, void 0, r);
|
|
1395
1391
|
}), !0;
|
|
1396
1392
|
}, Rn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1397
|
-
let a = null, o = null, s =
|
|
1393
|
+
let a = null, o = null, s = B(typeof e == "string" ? e : e.name, r.schema);
|
|
1398
1394
|
if (!s) return !1;
|
|
1399
1395
|
s === "node" && (a = j(e, r.schema)), s === "mark" && (o = P(e, r.schema));
|
|
1400
1396
|
let c = !1;
|
|
@@ -1425,7 +1421,7 @@ var An = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1425
1421
|
}));
|
|
1426
1422
|
}));
|
|
1427
1423
|
}), c;
|
|
1428
|
-
},
|
|
1424
|
+
}, Y = new w("__tiptap_decorations__"), zn = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(Y, {
|
|
1429
1425
|
type: "force",
|
|
1430
1426
|
name: e
|
|
1431
1427
|
}), !0), Bn = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
@@ -1433,8 +1429,8 @@ var An = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1433
1429
|
return x(i, t)(n, r);
|
|
1434
1430
|
}, Vn = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1435
1431
|
let i = j(e, n.schema);
|
|
1436
|
-
return
|
|
1437
|
-
}, Hn = /* @__PURE__ */
|
|
1432
|
+
return pe(i, t)(n, r);
|
|
1433
|
+
}, Hn = /* @__PURE__ */ _e({
|
|
1438
1434
|
blur: () => ve,
|
|
1439
1435
|
clearContent: () => ye,
|
|
1440
1436
|
clearNodes: () => be,
|
|
@@ -1449,24 +1445,24 @@ var An = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1449
1445
|
exitCode: () => Me,
|
|
1450
1446
|
extendMarkRange: () => Ie,
|
|
1451
1447
|
first: () => Le,
|
|
1452
|
-
focus: () =>
|
|
1453
|
-
forEach: () =>
|
|
1454
|
-
insertContent: () =>
|
|
1455
|
-
insertContentAt: () =>
|
|
1456
|
-
insertDefaultBlock: () =>
|
|
1457
|
-
joinBackward: () =>
|
|
1458
|
-
joinDown: () =>
|
|
1459
|
-
joinForward: () =>
|
|
1460
|
-
joinItemBackward: () =>
|
|
1461
|
-
joinItemForward: () =>
|
|
1462
|
-
joinTextblockBackward: () =>
|
|
1463
|
-
joinTextblockForward: () =>
|
|
1464
|
-
joinUp: () =>
|
|
1465
|
-
keyboardShortcut: () =>
|
|
1466
|
-
lift: () =>
|
|
1467
|
-
liftEmptyBlock: () =>
|
|
1468
|
-
liftListItem: () =>
|
|
1469
|
-
newlineInCode: () =>
|
|
1448
|
+
focus: () => He,
|
|
1449
|
+
forEach: () => Ue,
|
|
1450
|
+
insertContent: () => We,
|
|
1451
|
+
insertContentAt: () => Ye,
|
|
1452
|
+
insertDefaultBlock: () => Ze,
|
|
1453
|
+
joinBackward: () => et,
|
|
1454
|
+
joinDown: () => $e,
|
|
1455
|
+
joinForward: () => tt,
|
|
1456
|
+
joinItemBackward: () => nt,
|
|
1457
|
+
joinItemForward: () => rt,
|
|
1458
|
+
joinTextblockBackward: () => it,
|
|
1459
|
+
joinTextblockForward: () => at,
|
|
1460
|
+
joinUp: () => Qe,
|
|
1461
|
+
keyboardShortcut: () => ct,
|
|
1462
|
+
lift: () => lt,
|
|
1463
|
+
liftEmptyBlock: () => ut,
|
|
1464
|
+
liftListItem: () => dt,
|
|
1465
|
+
newlineInCode: () => ft,
|
|
1470
1466
|
resetAttributes: () => mt,
|
|
1471
1467
|
scrollIntoView: () => ht,
|
|
1472
1468
|
selectAll: () => gt,
|
|
@@ -1497,18 +1493,18 @@ var An = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1497
1493
|
updateDecorations: () => zn,
|
|
1498
1494
|
wrapIn: () => Bn,
|
|
1499
1495
|
wrapInList: () => Vn
|
|
1500
|
-
}),
|
|
1496
|
+
}), X = /* @__PURE__ */ new WeakMap();
|
|
1501
1497
|
function Un(e, t) {
|
|
1502
|
-
|
|
1498
|
+
X.set(e, (X.get(e) ?? 0) + 1);
|
|
1503
1499
|
try {
|
|
1504
1500
|
return t();
|
|
1505
1501
|
} finally {
|
|
1506
|
-
let t = (
|
|
1507
|
-
t > 0 ?
|
|
1502
|
+
let t = (X.get(e) ?? 1) - 1;
|
|
1503
|
+
t > 0 ? X.set(e, t) : X.delete(e);
|
|
1508
1504
|
}
|
|
1509
1505
|
}
|
|
1510
1506
|
function Wn(e) {
|
|
1511
|
-
return
|
|
1507
|
+
return X.has(e);
|
|
1512
1508
|
}
|
|
1513
1509
|
var Gn = class {
|
|
1514
1510
|
constructor() {
|
|
@@ -1549,7 +1545,7 @@ function Jn(e, t) {
|
|
|
1549
1545
|
function Yn(e, t, n) {
|
|
1550
1546
|
let { decorations: r, widgetKeys: i } = Jn(t, n);
|
|
1551
1547
|
return {
|
|
1552
|
-
set:
|
|
1548
|
+
set: O.create(e, r),
|
|
1553
1549
|
widgetKeys: i
|
|
1554
1550
|
};
|
|
1555
1551
|
}
|
|
@@ -1605,7 +1601,7 @@ function nr(e, t) {
|
|
|
1605
1601
|
}
|
|
1606
1602
|
function rr(e, t) {
|
|
1607
1603
|
if (e.steps.some((e) => !tr(e))) return { type: "full" };
|
|
1608
|
-
let n =
|
|
1604
|
+
let n = Zt(e).map(({ newRange: e }) => e);
|
|
1609
1605
|
e.steps.forEach((t, r) => {
|
|
1610
1606
|
if (!er(t)) return;
|
|
1611
1607
|
let i = e.mapping.slice(r);
|
|
@@ -1637,7 +1633,7 @@ function ir(e, t, n, r) {
|
|
|
1637
1633
|
} });
|
|
1638
1634
|
}
|
|
1639
1635
|
function ar(e, t, n) {
|
|
1640
|
-
let r = t.decorationSetsByExtension[e] ??
|
|
1636
|
+
let r = t.decorationSetsByExtension[e] ?? O.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
|
|
1641
1637
|
return {
|
|
1642
1638
|
set: ir(r, n.mapping, n.doc, i),
|
|
1643
1639
|
widgetKeys: i
|
|
@@ -1645,7 +1641,7 @@ function ar(e, t, n) {
|
|
|
1645
1641
|
}
|
|
1646
1642
|
function or(e, t) {
|
|
1647
1643
|
let n = Object.values(t).flatMap((e) => e.find());
|
|
1648
|
-
return
|
|
1644
|
+
return O.create(e, n);
|
|
1649
1645
|
}
|
|
1650
1646
|
function sr(e) {
|
|
1651
1647
|
let t = /* @__PURE__ */ new Set();
|
|
@@ -1673,7 +1669,7 @@ function lr(e, t, n) {
|
|
|
1673
1669
|
var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
1674
1670
|
constructor(e) {
|
|
1675
1671
|
this.warnedWidgetKeys = /* @__PURE__ */ new Set(), this.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set(), this.handleBeforeTransaction = ({ nextState: e }) => {
|
|
1676
|
-
let t =
|
|
1672
|
+
let t = Y.getState(e);
|
|
1677
1673
|
t && this.warnDuplicateWidgetKeys(t);
|
|
1678
1674
|
}, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) => cr(e, t)), this.plugin = this.entries.length > 0 ? this.createPlugin() : null, this.editor.on("beforeTransaction", this.handleBeforeTransaction);
|
|
1679
1675
|
}
|
|
@@ -1681,7 +1677,7 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1681
1677
|
this.editor.off("beforeTransaction", this.handleBeforeTransaction);
|
|
1682
1678
|
}
|
|
1683
1679
|
liveWidgetKeys() {
|
|
1684
|
-
return
|
|
1680
|
+
return Y.getState(this.editor.state)?.widgetKeys ?? ur;
|
|
1685
1681
|
}
|
|
1686
1682
|
get mountedView() {
|
|
1687
1683
|
return this.editor.isDestroyed ? null : this.editor.view;
|
|
@@ -1699,8 +1695,8 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1699
1695
|
}
|
|
1700
1696
|
createPlugin() {
|
|
1701
1697
|
let { editor: e, entries: t } = this;
|
|
1702
|
-
return new
|
|
1703
|
-
key:
|
|
1698
|
+
return new C({
|
|
1699
|
+
key: Y,
|
|
1704
1700
|
state: {
|
|
1705
1701
|
init: (e, n) => {
|
|
1706
1702
|
let r = {}, i = {};
|
|
@@ -1717,7 +1713,7 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1717
1713
|
return this.warnDuplicateWidgetKeys(a), a;
|
|
1718
1714
|
},
|
|
1719
1715
|
apply: (n, r, i, a) => {
|
|
1720
|
-
let o = n.getMeta(
|
|
1716
|
+
let o = n.getMeta(Y), s = o?.type === "force" && !o.name, c = o?.type === "force" ? o.name : void 0, l = {}, u = {}, d = /* @__PURE__ */ new Set();
|
|
1721
1717
|
return Un(e, () => {
|
|
1722
1718
|
for (let { name: o, spec: f } of t) {
|
|
1723
1719
|
let t = s || c === o;
|
|
@@ -1752,7 +1748,7 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1752
1748
|
}
|
|
1753
1749
|
},
|
|
1754
1750
|
props: { decorations(e) {
|
|
1755
|
-
return
|
|
1751
|
+
return Y.getState(e)?.mergedDecorationSet ?? O.empty;
|
|
1756
1752
|
} }
|
|
1757
1753
|
});
|
|
1758
1754
|
}
|
|
@@ -1761,7 +1757,7 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1761
1757
|
return a.type === "full" ? this.buildFullSet(e, t, i) : this.rebuildRanges(e, t, n, r, i, a.ranges);
|
|
1762
1758
|
}
|
|
1763
1759
|
rebuildRanges(e, t, n, r, i, a) {
|
|
1764
|
-
let o = n.decorationSetsByExtension[e] ??
|
|
1760
|
+
let o = n.decorationSetsByExtension[e] ?? O.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c = ir(o, r.mapping, r.doc, s), l = i.doc.content.size;
|
|
1765
1761
|
for (let { from: n, to: r } of a) {
|
|
1766
1762
|
let a = c.find(n, r).filter((e) => Xn({
|
|
1767
1763
|
position: e.from,
|
|
@@ -1835,7 +1831,7 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1835
1831
|
};
|
|
1836
1832
|
function fr(e, t) {
|
|
1837
1833
|
let { selection: n } = e, { $from: r } = n;
|
|
1838
|
-
if (n instanceof
|
|
1834
|
+
if (n instanceof S) {
|
|
1839
1835
|
let e = r.index();
|
|
1840
1836
|
return r.parent.canReplaceWith(e, e + 1, t);
|
|
1841
1837
|
}
|
|
@@ -1875,10 +1871,10 @@ function _r(e) {
|
|
|
1875
1871
|
function vr(e) {
|
|
1876
1872
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
1877
1873
|
}
|
|
1878
|
-
function
|
|
1874
|
+
function Z(e) {
|
|
1879
1875
|
return vr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
1880
1876
|
}
|
|
1881
|
-
function
|
|
1877
|
+
function yr(e, t, n) {
|
|
1882
1878
|
let r = e.split("\n"), i = [], a = "", o = 0, s = t.baseIndentSize || 2;
|
|
1883
1879
|
for (; o < r.length;) {
|
|
1884
1880
|
let e = r[o], u = e.match(t.itemPattern);
|
|
@@ -1914,32 +1910,42 @@ function br(e, t, n) {
|
|
|
1914
1910
|
let e = g.map((e) => e.slice(f + s)).join("\n");
|
|
1915
1911
|
e.trim() && (h = t.customNestedParser ? t.customNestedParser(e) : n.blockTokens(e));
|
|
1916
1912
|
}
|
|
1917
|
-
let
|
|
1918
|
-
i.push(
|
|
1913
|
+
let ee = t.createToken(d, h);
|
|
1914
|
+
i.push(ee);
|
|
1919
1915
|
}
|
|
1920
1916
|
if (i.length !== 0) return {
|
|
1921
1917
|
items: i,
|
|
1922
1918
|
raw: a
|
|
1923
1919
|
};
|
|
1924
1920
|
}
|
|
1925
|
-
|
|
1921
|
+
var br = 4;
|
|
1922
|
+
function xr(e) {
|
|
1923
|
+
let t = 0;
|
|
1924
|
+
for (let n of e) t = n === " " ? t + br - t % br : t + 1;
|
|
1925
|
+
return t;
|
|
1926
|
+
}
|
|
1927
|
+
function Sr(e, t, n, r, i) {
|
|
1926
1928
|
if (!e || !Array.isArray(e.content)) return "";
|
|
1927
|
-
let
|
|
1928
|
-
return
|
|
1929
|
+
let a = typeof n == "function" ? n(r) : n, [o, ...s] = e.content, c = `${a}${t.renderChildren([o])}`;
|
|
1930
|
+
return s && s.length > 0 && s.forEach((e, n) => {
|
|
1929
1931
|
let r = t.renderChild?.call(t, e, n + 1) ?? t.renderChildren([e]);
|
|
1930
1932
|
if (r != null) {
|
|
1931
|
-
let n =
|
|
1932
|
-
|
|
1933
|
+
let n = (e) => {
|
|
1934
|
+
if (!i?.alignNestedToPrefix) return t.indent(e);
|
|
1935
|
+
let n = t.indent(""), r = xr(a);
|
|
1936
|
+
return (xr(n) >= r ? n : " ".repeat(r)) + e;
|
|
1937
|
+
}, o = r.split("\n").map((e) => n(e || "")).join("\n");
|
|
1938
|
+
c += e.type === "paragraph" ? `\n\n${o}` : `\n${o}`;
|
|
1933
1939
|
}
|
|
1934
|
-
}),
|
|
1940
|
+
}), c;
|
|
1935
1941
|
}
|
|
1936
|
-
function
|
|
1942
|
+
function Cr(e, t) {
|
|
1937
1943
|
let n = { ...e };
|
|
1938
|
-
return
|
|
1939
|
-
|
|
1944
|
+
return Z(e) && Z(t) && Object.keys(t).forEach((r) => {
|
|
1945
|
+
Z(t[r]) && Z(e[r]) ? n[r] = Cr(e[r], t[r]) : n[r] = t[r];
|
|
1940
1946
|
}), n;
|
|
1941
1947
|
}
|
|
1942
|
-
function
|
|
1948
|
+
function wr(e, t, n = {}) {
|
|
1943
1949
|
let { state: r } = t, { doc: i, tr: a } = r, o = e;
|
|
1944
1950
|
i.descendants((t, r) => {
|
|
1945
1951
|
let i = a.mapping.map(r), s = a.mapping.map(r) + t.nodeSize, c = null;
|
|
@@ -1963,35 +1969,35 @@ var Q = class {
|
|
|
1963
1969
|
constructor(e) {
|
|
1964
1970
|
this.find = e.find, this.handler = e.handler, this.undoable = e.undoable ?? !0;
|
|
1965
1971
|
}
|
|
1966
|
-
},
|
|
1972
|
+
}, Tr = (e, t) => {
|
|
1967
1973
|
if (Ne(t)) return t.exec(e);
|
|
1968
1974
|
let n = t(e);
|
|
1969
1975
|
if (!n) return null;
|
|
1970
1976
|
let r = [n.text];
|
|
1971
1977
|
return r.index = n.index, r.input = e, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn("[tiptap warn]: \"inputRuleMatch.replaceWith\" must be part of \"inputRuleMatch.text\"."), r.push(n.replaceWith)), r;
|
|
1972
1978
|
};
|
|
1973
|
-
function
|
|
1979
|
+
function Er(e) {
|
|
1974
1980
|
let { editor: t, from: n, to: r, text: i, rules: a, plugin: o } = e, { view: s } = t;
|
|
1975
1981
|
if (s.composing) return !1;
|
|
1976
1982
|
let c = s.state.doc.resolve(n);
|
|
1977
1983
|
if (c.parent.type.spec.code || (c.nodeBefore || c.nodeAfter)?.marks.find((e) => e.type.spec.code)) return !1;
|
|
1978
|
-
let l = !1, u =
|
|
1984
|
+
let l = !1, u = tn(c) + i;
|
|
1979
1985
|
return a.forEach((e) => {
|
|
1980
1986
|
if (l) return;
|
|
1981
|
-
let a =
|
|
1987
|
+
let a = Tr(u, e.find);
|
|
1982
1988
|
if (!a) return;
|
|
1983
1989
|
let d = a[0].length - i.length;
|
|
1984
1990
|
if (d > 0) {
|
|
1985
1991
|
let e = c.parentOffset - d;
|
|
1986
1992
|
if (e < 0 || c.parent.textBetween(e, c.parentOffset) !== a[0].slice(0, d)) return;
|
|
1987
1993
|
}
|
|
1988
|
-
let f = s.state.tr, p =
|
|
1994
|
+
let f = s.state.tr, p = k({
|
|
1989
1995
|
state: s.state,
|
|
1990
1996
|
transaction: f
|
|
1991
1997
|
}), m = {
|
|
1992
1998
|
from: n - (a[0].length - i.length),
|
|
1993
1999
|
to: r
|
|
1994
|
-
}, { commands: h, chain: g, can:
|
|
2000
|
+
}, { commands: h, chain: g, can: ee } = new A({
|
|
1995
2001
|
editor: t,
|
|
1996
2002
|
state: p
|
|
1997
2003
|
});
|
|
@@ -2001,8 +2007,8 @@ function Tr(e) {
|
|
|
2001
2007
|
match: a,
|
|
2002
2008
|
commands: h,
|
|
2003
2009
|
chain: g,
|
|
2004
|
-
can:
|
|
2005
|
-
})
|
|
2010
|
+
can: ee
|
|
2011
|
+
}) !== null && f.steps.length && (e.undoable && f.setMeta(o, {
|
|
2006
2012
|
transform: f,
|
|
2007
2013
|
from: n,
|
|
2008
2014
|
to: r,
|
|
@@ -2010,8 +2016,8 @@ function Tr(e) {
|
|
|
2010
2016
|
}), s.dispatch(f), l = !0);
|
|
2011
2017
|
}), l;
|
|
2012
2018
|
}
|
|
2013
|
-
function
|
|
2014
|
-
let { editor: t, rules: n } = e, r = new
|
|
2019
|
+
function Dr(e) {
|
|
2020
|
+
let { editor: t, rules: n } = e, r = new C({
|
|
2015
2021
|
state: {
|
|
2016
2022
|
init() {
|
|
2017
2023
|
return null;
|
|
@@ -2022,9 +2028,9 @@ function Er(e) {
|
|
|
2022
2028
|
let s = e.getMeta("applyInputRules");
|
|
2023
2029
|
return s && setTimeout(() => {
|
|
2024
2030
|
let { text: e } = s;
|
|
2025
|
-
e = typeof e == "string" ? e :
|
|
2031
|
+
e = typeof e == "string" ? e : At(D.from(e), a.schema);
|
|
2026
2032
|
let { from: i } = s, o = i + e.length;
|
|
2027
|
-
|
|
2033
|
+
Er({
|
|
2028
2034
|
editor: t,
|
|
2029
2035
|
from: i,
|
|
2030
2036
|
to: o,
|
|
@@ -2037,7 +2043,7 @@ function Er(e) {
|
|
|
2037
2043
|
},
|
|
2038
2044
|
props: {
|
|
2039
2045
|
handleTextInput(e, i, a, o) {
|
|
2040
|
-
return
|
|
2046
|
+
return Er({
|
|
2041
2047
|
editor: t,
|
|
2042
2048
|
from: i,
|
|
2043
2049
|
to: a,
|
|
@@ -2048,7 +2054,7 @@ function Er(e) {
|
|
|
2048
2054
|
},
|
|
2049
2055
|
handleDOMEvents: { compositionend: (e) => (setTimeout(() => {
|
|
2050
2056
|
let { $cursor: i } = e.state.selection;
|
|
2051
|
-
i &&
|
|
2057
|
+
i && Er({
|
|
2052
2058
|
editor: t,
|
|
2053
2059
|
from: i.pos,
|
|
2054
2060
|
to: i.pos,
|
|
@@ -2060,7 +2066,7 @@ function Er(e) {
|
|
|
2060
2066
|
handleKeyDown(e, i) {
|
|
2061
2067
|
if (i.key !== "Enter") return !1;
|
|
2062
2068
|
let { $cursor: a } = e.state.selection;
|
|
2063
|
-
return a ?
|
|
2069
|
+
return a ? Er({
|
|
2064
2070
|
editor: t,
|
|
2065
2071
|
from: a.pos,
|
|
2066
2072
|
to: a.pos,
|
|
@@ -2074,7 +2080,7 @@ function Er(e) {
|
|
|
2074
2080
|
});
|
|
2075
2081
|
return r;
|
|
2076
2082
|
}
|
|
2077
|
-
var
|
|
2083
|
+
var Or = class {
|
|
2078
2084
|
constructor(e = {}) {
|
|
2079
2085
|
this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = { name: this.name }, this.config = {
|
|
2080
2086
|
...this.config,
|
|
@@ -2082,10 +2088,10 @@ var Dr = class {
|
|
|
2082
2088
|
}, this.name = this.config.name;
|
|
2083
2089
|
}
|
|
2084
2090
|
get options() {
|
|
2085
|
-
return { ...
|
|
2091
|
+
return { ...H(V(this, "addOptions", { name: this.name })) };
|
|
2086
2092
|
}
|
|
2087
2093
|
get storage() {
|
|
2088
|
-
return { ...
|
|
2094
|
+
return { ...H(V(this, "addStorage", {
|
|
2089
2095
|
name: this.name,
|
|
2090
2096
|
options: this.options
|
|
2091
2097
|
})) };
|
|
@@ -2093,7 +2099,7 @@ var Dr = class {
|
|
|
2093
2099
|
configure(e = {}) {
|
|
2094
2100
|
let t = this.extend({
|
|
2095
2101
|
...this.config,
|
|
2096
|
-
addOptions: () =>
|
|
2102
|
+
addOptions: () => Cr(this.options, e)
|
|
2097
2103
|
});
|
|
2098
2104
|
return t.name = this.name, t.parent = this.parent, this.child = null, t;
|
|
2099
2105
|
}
|
|
@@ -2104,7 +2110,7 @@ var Dr = class {
|
|
|
2104
2110
|
});
|
|
2105
2111
|
return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
|
|
2106
2112
|
}
|
|
2107
|
-
},
|
|
2113
|
+
}, kr = class e extends Or {
|
|
2108
2114
|
constructor(...e) {
|
|
2109
2115
|
super(...e), this.type = "mark";
|
|
2110
2116
|
}
|
|
@@ -2129,11 +2135,11 @@ var Dr = class {
|
|
|
2129
2135
|
let t = typeof e == "function" ? e() : e;
|
|
2130
2136
|
return super.extend(t);
|
|
2131
2137
|
}
|
|
2132
|
-
},
|
|
2138
|
+
}, Ar = class {
|
|
2133
2139
|
constructor(e) {
|
|
2134
2140
|
this.find = e.find, this.handler = e.handler;
|
|
2135
2141
|
}
|
|
2136
|
-
},
|
|
2142
|
+
}, jr = (e, t, n) => {
|
|
2137
2143
|
if (Ne(t)) return [...e.matchAll(t)];
|
|
2138
2144
|
let r = t(e, n);
|
|
2139
2145
|
return r ? r.map((t) => {
|
|
@@ -2141,7 +2147,7 @@ var Dr = class {
|
|
|
2141
2147
|
return n.index = t.index, n.input = e, n.data = t.data, t.replaceWith && (t.text.includes(t.replaceWith) || console.warn("[tiptap warn]: \"pasteRuleMatch.replaceWith\" must be part of \"pasteRuleMatch.text\"."), n.push(t.replaceWith)), n;
|
|
2142
2148
|
}) : [];
|
|
2143
2149
|
};
|
|
2144
|
-
function
|
|
2150
|
+
function Mr(e) {
|
|
2145
2151
|
let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new A({
|
|
2146
2152
|
editor: t,
|
|
2147
2153
|
state: n
|
|
@@ -2150,7 +2156,7 @@ function jr(e) {
|
|
|
2150
2156
|
var f;
|
|
2151
2157
|
if ((f = e.type) != null && (f = f.spec) != null && f.code || !(e.isText || e.isTextblock || e.isInline)) return;
|
|
2152
2158
|
let p = e.content?.size ?? e.nodeSize ?? 0, m = Math.max(r, t), h = Math.min(i, t + p);
|
|
2153
|
-
m >= h ||
|
|
2159
|
+
m >= h || jr(e.isText ? e.text || "" : e.textBetween(m - t, h - t, void 0, ""), a.find, o).forEach((e) => {
|
|
2154
2160
|
if (e.index === void 0) return;
|
|
2155
2161
|
let t = m + e.index + 1, r = t + e[0].length, i = {
|
|
2156
2162
|
from: n.tr.mapping.map(t),
|
|
@@ -2169,12 +2175,12 @@ function jr(e) {
|
|
|
2169
2175
|
});
|
|
2170
2176
|
}), d.every((e) => e !== null);
|
|
2171
2177
|
}
|
|
2172
|
-
var
|
|
2178
|
+
var Nr = null, Pr = (e) => {
|
|
2173
2179
|
var t;
|
|
2174
2180
|
let n = new ClipboardEvent("paste", { clipboardData: new DataTransfer() });
|
|
2175
2181
|
return (t = n.clipboardData) == null || t.setData("text/html", e), n;
|
|
2176
2182
|
};
|
|
2177
|
-
function
|
|
2183
|
+
function Fr(e) {
|
|
2178
2184
|
let { editor: t, rules: n } = e, r = null, i = !1, a = !1, o = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, s;
|
|
2179
2185
|
try {
|
|
2180
2186
|
s = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
@@ -2182,11 +2188,11 @@ function Pr(e) {
|
|
|
2182
2188
|
s = null;
|
|
2183
2189
|
}
|
|
2184
2190
|
let c = ({ state: e, from: n, to: r, rule: i, pasteEvt: a }) => {
|
|
2185
|
-
let c = e.tr, l =
|
|
2191
|
+
let c = e.tr, l = k({
|
|
2186
2192
|
state: e,
|
|
2187
2193
|
transaction: c
|
|
2188
2194
|
});
|
|
2189
|
-
if (
|
|
2195
|
+
if (Mr({
|
|
2190
2196
|
editor: t,
|
|
2191
2197
|
state: l,
|
|
2192
2198
|
from: Math.max(n - 1, 0),
|
|
@@ -2194,7 +2200,7 @@ function Pr(e) {
|
|
|
2194
2200
|
rule: i,
|
|
2195
2201
|
pasteEvent: a,
|
|
2196
2202
|
dropEvent: s
|
|
2197
|
-
})
|
|
2203
|
+
}) && c.steps.length) {
|
|
2198
2204
|
try {
|
|
2199
2205
|
s = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
2200
2206
|
} catch {
|
|
@@ -2203,12 +2209,12 @@ function Pr(e) {
|
|
|
2203
2209
|
return o = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
|
|
2204
2210
|
}
|
|
2205
2211
|
};
|
|
2206
|
-
return n.map((e) => new
|
|
2212
|
+
return n.map((e) => new C({
|
|
2207
2213
|
view(e) {
|
|
2208
2214
|
let n = (n) => {
|
|
2209
|
-
r = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, r && (
|
|
2215
|
+
r = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, r && (Nr = t);
|
|
2210
2216
|
}, i = () => {
|
|
2211
|
-
|
|
2217
|
+
Nr &&= null;
|
|
2212
2218
|
};
|
|
2213
2219
|
return window.addEventListener("dragstart", n), window.addEventListener("dragend", i), { destroy() {
|
|
2214
2220
|
window.removeEventListener("dragstart", n), window.removeEventListener("dragend", i);
|
|
@@ -2217,7 +2223,7 @@ function Pr(e) {
|
|
|
2217
2223
|
props: { handleDOMEvents: {
|
|
2218
2224
|
drop: (e, t) => {
|
|
2219
2225
|
if (a = r === e.dom.parentElement, s = t, !a) {
|
|
2220
|
-
let e =
|
|
2226
|
+
let e = Nr;
|
|
2221
2227
|
e?.isEditable && setTimeout(() => {
|
|
2222
2228
|
let t = e.state.selection;
|
|
2223
2229
|
t && e.commands.deleteRange({
|
|
@@ -2238,8 +2244,8 @@ function Pr(e) {
|
|
|
2238
2244
|
if (!l && !u && !f) return;
|
|
2239
2245
|
if (f) {
|
|
2240
2246
|
let { text: t } = d;
|
|
2241
|
-
t = typeof t == "string" ? t :
|
|
2242
|
-
let { from: n } = d, i = n + t.length, a =
|
|
2247
|
+
t = typeof t == "string" ? t : At(D.from(t), r.schema);
|
|
2248
|
+
let { from: n } = d, i = n + t.length, a = Pr(t);
|
|
2243
2249
|
return c({
|
|
2244
2250
|
rule: e,
|
|
2245
2251
|
state: r,
|
|
@@ -2249,7 +2255,7 @@ function Pr(e) {
|
|
|
2249
2255
|
});
|
|
2250
2256
|
}
|
|
2251
2257
|
let p = n.doc.content.findDiffStart(r.doc.content), m = n.doc.content.findDiffEnd(r.doc.content);
|
|
2252
|
-
if (
|
|
2258
|
+
if (_r(p) && m && p !== m.b) return c({
|
|
2253
2259
|
rule: e,
|
|
2254
2260
|
state: r,
|
|
2255
2261
|
from: p,
|
|
@@ -2259,18 +2265,18 @@ function Pr(e) {
|
|
|
2259
2265
|
}
|
|
2260
2266
|
}));
|
|
2261
2267
|
}
|
|
2262
|
-
var
|
|
2268
|
+
var Ir = class {
|
|
2263
2269
|
constructor(e, t) {
|
|
2264
|
-
this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions =
|
|
2270
|
+
this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions = Ut(e), this.schema = Vt(this.extensions, t), this.setupExtensions();
|
|
2265
2271
|
}
|
|
2266
2272
|
get commands() {
|
|
2267
2273
|
return this.extensions.reduce((e, t) => {
|
|
2268
|
-
let n =
|
|
2274
|
+
let n = V(t, "addCommands", {
|
|
2269
2275
|
name: t.name,
|
|
2270
2276
|
options: t.options,
|
|
2271
2277
|
storage: this.editor.extensionStorage[t.name],
|
|
2272
2278
|
editor: this.editor,
|
|
2273
|
-
type:
|
|
2279
|
+
type: K(t.name, this.schema)
|
|
2274
2280
|
});
|
|
2275
2281
|
return n ? {
|
|
2276
2282
|
...e,
|
|
@@ -2279,15 +2285,15 @@ var Fr = class {
|
|
|
2279
2285
|
}, {});
|
|
2280
2286
|
}
|
|
2281
2287
|
get plugins() {
|
|
2282
|
-
let { editor: e } = this, t =
|
|
2288
|
+
let { editor: e } = this, t = G([...this.extensions].reverse()).flatMap((t) => {
|
|
2283
2289
|
let n = {
|
|
2284
2290
|
name: t.name,
|
|
2285
2291
|
options: t.options,
|
|
2286
2292
|
storage: this.editor.extensionStorage[t.name],
|
|
2287
2293
|
editor: e,
|
|
2288
|
-
type:
|
|
2289
|
-
}, r = [], i =
|
|
2290
|
-
if (t.type === "mark" &&
|
|
2294
|
+
type: K(t.name, this.schema)
|
|
2295
|
+
}, r = [], i = V(t, "addKeyboardShortcuts", n), a = {};
|
|
2296
|
+
if (t.type === "mark" && V(t, "exitable", n) && (a.ArrowRight = () => kr.handleExit({
|
|
2291
2297
|
editor: e,
|
|
2292
2298
|
mark: t
|
|
2293
2299
|
})), i) {
|
|
@@ -2297,31 +2303,31 @@ var Fr = class {
|
|
|
2297
2303
|
...t
|
|
2298
2304
|
};
|
|
2299
2305
|
}
|
|
2300
|
-
let o =
|
|
2306
|
+
let o = he(a);
|
|
2301
2307
|
r.push(o);
|
|
2302
|
-
let s =
|
|
2303
|
-
if (
|
|
2308
|
+
let s = V(t, "addInputRules", n);
|
|
2309
|
+
if (sn(t, e.options.enableInputRules) && s) {
|
|
2304
2310
|
let t = s();
|
|
2305
2311
|
if (t && t.length) {
|
|
2306
|
-
let n =
|
|
2312
|
+
let n = Dr({
|
|
2307
2313
|
editor: e,
|
|
2308
2314
|
rules: t
|
|
2309
2315
|
}), i = Array.isArray(n) ? n : [n];
|
|
2310
2316
|
r.push(...i);
|
|
2311
2317
|
}
|
|
2312
2318
|
}
|
|
2313
|
-
let c =
|
|
2314
|
-
if (
|
|
2319
|
+
let c = V(t, "addPasteRules", n);
|
|
2320
|
+
if (sn(t, e.options.enablePasteRules) && c) {
|
|
2315
2321
|
let t = c();
|
|
2316
2322
|
if (t && t.length) {
|
|
2317
|
-
let n =
|
|
2323
|
+
let n = Fr({
|
|
2318
2324
|
editor: e,
|
|
2319
2325
|
rules: t
|
|
2320
2326
|
});
|
|
2321
2327
|
r.push(...n);
|
|
2322
2328
|
}
|
|
2323
2329
|
}
|
|
2324
|
-
let l =
|
|
2330
|
+
let l = V(t, "addProseMirrorPlugins", n);
|
|
2325
2331
|
if (l) {
|
|
2326
2332
|
let e = l();
|
|
2327
2333
|
r.push(...e);
|
|
@@ -2336,12 +2342,12 @@ var Fr = class {
|
|
|
2336
2342
|
(e = this.decorationManager) == null || e.destroy();
|
|
2337
2343
|
let n = [];
|
|
2338
2344
|
return this.extensions.forEach((e) => {
|
|
2339
|
-
let r =
|
|
2345
|
+
let r = V(e, "addDecorations", {
|
|
2340
2346
|
name: e.name,
|
|
2341
2347
|
options: e.options,
|
|
2342
2348
|
storage: this.editor.extensionStorage[e.name],
|
|
2343
2349
|
editor: t,
|
|
2344
|
-
type:
|
|
2350
|
+
type: K(e.name, this.schema)
|
|
2345
2351
|
});
|
|
2346
2352
|
r && n.push({
|
|
2347
2353
|
name: e.name,
|
|
@@ -2353,12 +2359,12 @@ var Fr = class {
|
|
|
2353
2359
|
}), this.decorationManager.plugin;
|
|
2354
2360
|
}
|
|
2355
2361
|
get attributes() {
|
|
2356
|
-
return
|
|
2362
|
+
return Nt(this.extensions);
|
|
2357
2363
|
}
|
|
2358
2364
|
get nodeViews() {
|
|
2359
|
-
let { editor: e } = this, { nodeExtensions: t } =
|
|
2360
|
-
return Object.fromEntries(t.filter((e) => !!
|
|
2361
|
-
let n = this.attributes.filter((e) => e.type === t.name), r =
|
|
2365
|
+
let { editor: e } = this, { nodeExtensions: t } = U(this.extensions);
|
|
2366
|
+
return Object.fromEntries(t.filter((e) => !!V(e, "addNodeView")).map((t) => {
|
|
2367
|
+
let n = this.attributes.filter((e) => e.type === t.name), r = V(t, "addNodeView", {
|
|
2362
2368
|
name: t.name,
|
|
2363
2369
|
options: t.options,
|
|
2364
2370
|
storage: this.editor.extensionStorage[t.name],
|
|
@@ -2368,7 +2374,7 @@ var Fr = class {
|
|
|
2368
2374
|
if (!r) return [];
|
|
2369
2375
|
let i = r();
|
|
2370
2376
|
return i ? [t.name, (r, a, o, s, c) => {
|
|
2371
|
-
let l =
|
|
2377
|
+
let l = W(r, n);
|
|
2372
2378
|
return i({
|
|
2373
2379
|
node: r,
|
|
2374
2380
|
view: a,
|
|
@@ -2384,14 +2390,14 @@ var Fr = class {
|
|
|
2384
2390
|
}
|
|
2385
2391
|
dispatchTransaction(e) {
|
|
2386
2392
|
let { editor: t } = this;
|
|
2387
|
-
return
|
|
2393
|
+
return G([...this.extensions].reverse()).reduceRight((e, n) => {
|
|
2388
2394
|
let r = {
|
|
2389
2395
|
name: n.name,
|
|
2390
2396
|
options: n.options,
|
|
2391
2397
|
storage: this.editor.extensionStorage[n.name],
|
|
2392
2398
|
editor: t,
|
|
2393
|
-
type:
|
|
2394
|
-
}, i =
|
|
2399
|
+
type: K(n.name, this.schema)
|
|
2400
|
+
}, i = V(n, "dispatchTransaction", r);
|
|
2395
2401
|
return i ? (t) => {
|
|
2396
2402
|
i.call(r, {
|
|
2397
2403
|
transaction: t,
|
|
@@ -2402,14 +2408,14 @@ var Fr = class {
|
|
|
2402
2408
|
}
|
|
2403
2409
|
transformPastedHTML(e) {
|
|
2404
2410
|
let { editor: t } = this;
|
|
2405
|
-
return
|
|
2411
|
+
return G([...this.extensions]).reduce((e, n) => {
|
|
2406
2412
|
let r = {
|
|
2407
2413
|
name: n.name,
|
|
2408
2414
|
options: n.options,
|
|
2409
2415
|
storage: this.editor.extensionStorage[n.name],
|
|
2410
2416
|
editor: t,
|
|
2411
|
-
type:
|
|
2412
|
-
}, i =
|
|
2417
|
+
type: K(n.name, this.schema)
|
|
2418
|
+
}, i = V(n, "transformPastedHTML", r);
|
|
2413
2419
|
return i ? (t, n) => {
|
|
2414
2420
|
let a = e(t, n);
|
|
2415
2421
|
return i.call(r, a);
|
|
@@ -2417,9 +2423,9 @@ var Fr = class {
|
|
|
2417
2423
|
}, e || ((e) => e));
|
|
2418
2424
|
}
|
|
2419
2425
|
get markViews() {
|
|
2420
|
-
let { editor: e } = this, { markExtensions: t } =
|
|
2421
|
-
return Object.fromEntries(t.filter((e) => !!
|
|
2422
|
-
let n = this.attributes.filter((e) => e.type === t.name), r =
|
|
2426
|
+
let { editor: e } = this, { markExtensions: t } = U(this.extensions);
|
|
2427
|
+
return Object.fromEntries(t.filter((e) => !!V(e, "addMarkView")).map((t) => {
|
|
2428
|
+
let n = this.attributes.filter((e) => e.type === t.name), r = V(t, "addMarkView", {
|
|
2423
2429
|
name: t.name,
|
|
2424
2430
|
options: t.options,
|
|
2425
2431
|
storage: this.editor.extensionStorage[t.name],
|
|
@@ -2427,7 +2433,7 @@ var Fr = class {
|
|
|
2427
2433
|
type: P(t.name, this.schema)
|
|
2428
2434
|
});
|
|
2429
2435
|
return r ? [t.name, (i, a, o) => {
|
|
2430
|
-
let s =
|
|
2436
|
+
let s = W(i, n);
|
|
2431
2437
|
return r()({
|
|
2432
2438
|
mark: i,
|
|
2433
2439
|
view: a,
|
|
@@ -2436,7 +2442,7 @@ var Fr = class {
|
|
|
2436
2442
|
extension: t,
|
|
2437
2443
|
HTMLAttributes: s,
|
|
2438
2444
|
updateAttributes: (t) => {
|
|
2439
|
-
|
|
2445
|
+
wr(i, e, t);
|
|
2440
2446
|
}
|
|
2441
2447
|
});
|
|
2442
2448
|
}] : [];
|
|
@@ -2460,16 +2466,16 @@ var Fr = class {
|
|
|
2460
2466
|
options: e.options,
|
|
2461
2467
|
storage: this.editor.extensionStorage[e.name],
|
|
2462
2468
|
editor: this.editor,
|
|
2463
|
-
type:
|
|
2469
|
+
type: K(e.name, this.schema)
|
|
2464
2470
|
};
|
|
2465
|
-
e.type === "mark" && ((
|
|
2466
|
-
let n =
|
|
2471
|
+
e.type === "mark" && ((H(V(e, "keepOnSplit", t)) ?? !0) && this.splittableMarks.push(e.name), (H(V(e, "clearable", t)) ?? !0) || this.nonClearableMarks.push(e.name));
|
|
2472
|
+
let n = V(e, "onBeforeCreate", t), r = V(e, "onCreate", t), i = V(e, "onUpdate", t), a = V(e, "onSelectionUpdate", t), o = V(e, "onTransaction", t), s = V(e, "onFocus", t), c = V(e, "onBlur", t), l = V(e, "onDestroy", t);
|
|
2467
2473
|
n && this.editor.on("beforeCreate", n), r && this.editor.on("create", r), i && this.editor.on("update", i), a && this.editor.on("selectionUpdate", a), o && this.editor.on("transaction", o), s && this.editor.on("focus", s), c && this.editor.on("blur", c), l && this.editor.on("destroy", l);
|
|
2468
2474
|
});
|
|
2469
2475
|
}
|
|
2470
2476
|
};
|
|
2471
|
-
|
|
2472
|
-
var $ = class e extends
|
|
2477
|
+
Ir.resolve = Ut, Ir.sort = G, Ir.flatten = kt;
|
|
2478
|
+
var $ = class e extends Or {
|
|
2473
2479
|
constructor(...e) {
|
|
2474
2480
|
super(...e), this.type = "extension";
|
|
2475
2481
|
}
|
|
@@ -2484,32 +2490,32 @@ var $ = class e extends Dr {
|
|
|
2484
2490
|
let t = typeof e == "function" ? e() : e;
|
|
2485
2491
|
return super.extend(t);
|
|
2486
2492
|
}
|
|
2487
|
-
},
|
|
2493
|
+
}, Lr = $.create({
|
|
2488
2494
|
name: "clipboardTextSerializer",
|
|
2489
2495
|
addOptions() {
|
|
2490
2496
|
return { blockSeparator: void 0 };
|
|
2491
2497
|
},
|
|
2492
2498
|
addProseMirrorPlugins() {
|
|
2493
|
-
return [new
|
|
2494
|
-
key: new
|
|
2499
|
+
return [new C({
|
|
2500
|
+
key: new w("clipboardTextSerializer"),
|
|
2495
2501
|
props: { clipboardTextSerializer: () => {
|
|
2496
|
-
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a =
|
|
2502
|
+
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a = Kt(n), { blockSeparator: o } = this.options, s = {
|
|
2497
2503
|
...o === void 0 ? {} : { blockSeparator: o },
|
|
2498
2504
|
textSerializers: a
|
|
2499
2505
|
};
|
|
2500
|
-
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) =>
|
|
2506
|
+
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) => Wt(r, {
|
|
2501
2507
|
from: e.pos,
|
|
2502
2508
|
to: t.pos
|
|
2503
2509
|
}, s)).join(o ?? "\n\n");
|
|
2504
2510
|
} }
|
|
2505
2511
|
})];
|
|
2506
2512
|
}
|
|
2507
|
-
}),
|
|
2513
|
+
}), Rr = $.create({
|
|
2508
2514
|
name: "commands",
|
|
2509
2515
|
addCommands() {
|
|
2510
2516
|
return { ...Hn };
|
|
2511
2517
|
}
|
|
2512
|
-
}),
|
|
2518
|
+
}), zr = $.create({
|
|
2513
2519
|
name: "delete",
|
|
2514
2520
|
onUpdate({ transaction: t, appendedTransactions: n }) {
|
|
2515
2521
|
var r;
|
|
@@ -2517,7 +2523,7 @@ var $ = class e extends Dr {
|
|
|
2517
2523
|
var r, i;
|
|
2518
2524
|
if (((r = this.editor.options.coreExtensionOptions) == null || (r = r.delete) == null || (i = r.filterTransaction) == null ? void 0 : i.call(r, t)) ?? t.getMeta("y-sync$")) return;
|
|
2519
2525
|
let a = Tt(t.before, [t, ...n]);
|
|
2520
|
-
|
|
2526
|
+
Zt(a).forEach((e) => {
|
|
2521
2527
|
a.mapping.mapResult(e.oldRange.from).deletedAfter && a.mapping.mapResult(e.oldRange.to).deletedBefore && a.before.nodesBetween(e.oldRange.from, e.oldRange.to, (n, r) => {
|
|
2522
2528
|
let i = r + n.nodeSize - 2, o = e.oldRange.from <= r && i <= e.oldRange.to;
|
|
2523
2529
|
this.editor.emit("delete", {
|
|
@@ -2563,11 +2569,11 @@ var $ = class e extends Dr {
|
|
|
2563
2569
|
};
|
|
2564
2570
|
((r = this.editor.options.coreExtensionOptions) == null || (r = r.delete) == null ? void 0 : r.async) ?? !0 ? setTimeout(i, 0) : i();
|
|
2565
2571
|
}
|
|
2566
|
-
}),
|
|
2572
|
+
}), Br = $.create({
|
|
2567
2573
|
name: "drop",
|
|
2568
2574
|
addProseMirrorPlugins() {
|
|
2569
|
-
return [new
|
|
2570
|
-
key: new
|
|
2575
|
+
return [new C({
|
|
2576
|
+
key: new w("tiptapDrop"),
|
|
2571
2577
|
props: { handleDrop: (e, t, n, r) => {
|
|
2572
2578
|
this.editor.emit("drop", {
|
|
2573
2579
|
editor: this.editor,
|
|
@@ -2578,20 +2584,20 @@ var $ = class e extends Dr {
|
|
|
2578
2584
|
} }
|
|
2579
2585
|
})];
|
|
2580
2586
|
}
|
|
2581
|
-
}),
|
|
2587
|
+
}), Vr = $.create({
|
|
2582
2588
|
name: "editable",
|
|
2583
2589
|
addProseMirrorPlugins() {
|
|
2584
|
-
return [new
|
|
2585
|
-
key: new
|
|
2590
|
+
return [new C({
|
|
2591
|
+
key: new w("editable"),
|
|
2586
2592
|
props: { editable: () => this.editor.options.editable }
|
|
2587
2593
|
})];
|
|
2588
2594
|
}
|
|
2589
|
-
}),
|
|
2595
|
+
}), Hr = new w("focusEvents"), Ur = $.create({
|
|
2590
2596
|
name: "focusEvents",
|
|
2591
2597
|
addProseMirrorPlugins() {
|
|
2592
2598
|
let { editor: e } = this;
|
|
2593
|
-
return [new
|
|
2594
|
-
key:
|
|
2599
|
+
return [new C({
|
|
2600
|
+
key: Hr,
|
|
2595
2601
|
props: { handleDOMEvents: {
|
|
2596
2602
|
focus: (t, n) => {
|
|
2597
2603
|
e.isFocused = !0;
|
|
@@ -2606,13 +2612,13 @@ var $ = class e extends Dr {
|
|
|
2606
2612
|
} }
|
|
2607
2613
|
})];
|
|
2608
2614
|
}
|
|
2609
|
-
}),
|
|
2615
|
+
}), Wr = $.create({
|
|
2610
2616
|
name: "keymap",
|
|
2611
2617
|
addKeyboardShortcuts() {
|
|
2612
2618
|
let e = () => this.editor.commands.first(({ commands: e }) => [
|
|
2613
2619
|
() => e.undoInputRule(),
|
|
2614
2620
|
() => e.command(({ tr: t }) => {
|
|
2615
|
-
let { selection: n, doc: r } = t, { empty: i, $anchor: a } = n, { pos: o, parent: s } = a, c = a.parent.isTextblock && o > 0 ? t.doc.resolve(o - 1) : a, l = c.parent.type.spec.isolating, u = a.pos - a.parentOffset, d = l && c.parent.childCount === 1 ? u === a.pos :
|
|
2621
|
+
let { selection: n, doc: r } = t, { empty: i, $anchor: a } = n, { pos: o, parent: s } = a, c = a.parent.isTextblock && o > 0 ? t.doc.resolve(o - 1) : a, l = c.parent.type.spec.isolating, u = a.pos - a.parentOffset, d = l && c.parent.childCount === 1 ? u === a.pos : T.atStart(r).from === o;
|
|
2616
2622
|
return !i || !s.type.isTextblock || s.textContent.length || !d || d && a.parent.type.name === "paragraph" ? !1 : e.clearNodes();
|
|
2617
2623
|
}),
|
|
2618
2624
|
() => e.deleteSelection(),
|
|
@@ -2648,18 +2654,18 @@ var $ = class e extends Dr {
|
|
|
2648
2654
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
2649
2655
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
2650
2656
|
};
|
|
2651
|
-
return
|
|
2657
|
+
return I() || ot() ? i : r;
|
|
2652
2658
|
},
|
|
2653
2659
|
addProseMirrorPlugins() {
|
|
2654
|
-
return [new
|
|
2655
|
-
key: new
|
|
2660
|
+
return [new C({
|
|
2661
|
+
key: new w("clearDocument"),
|
|
2656
2662
|
appendTransaction: (e, t, n) => {
|
|
2657
2663
|
if (e.some((e) => e.getMeta("composition"))) return;
|
|
2658
2664
|
let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = e.some((e) => e.getMeta("preventClearDocument"));
|
|
2659
2665
|
if (!r || i) return;
|
|
2660
|
-
let { empty: a, from: o, to: s } = t.selection, c =
|
|
2661
|
-
if (a || o !== c || s !== l || !
|
|
2662
|
-
let u = n.tr, d =
|
|
2666
|
+
let { empty: a, from: o, to: s } = t.selection, c = T.atStart(t.doc).from, l = T.atEnd(t.doc).to;
|
|
2667
|
+
if (a || o !== c || s !== l || !J(n.doc)) return;
|
|
2668
|
+
let u = n.tr, d = k({
|
|
2663
2669
|
state: n,
|
|
2664
2670
|
transaction: u
|
|
2665
2671
|
}), { commands: f } = new A({
|
|
@@ -2670,11 +2676,11 @@ var $ = class e extends Dr {
|
|
|
2670
2676
|
}
|
|
2671
2677
|
})];
|
|
2672
2678
|
}
|
|
2673
|
-
}),
|
|
2679
|
+
}), Gr = $.create({
|
|
2674
2680
|
name: "paste",
|
|
2675
2681
|
addProseMirrorPlugins() {
|
|
2676
|
-
return [new
|
|
2677
|
-
key: new
|
|
2682
|
+
return [new C({
|
|
2683
|
+
key: new w("tiptapPaste"),
|
|
2678
2684
|
props: { handlePaste: (e, t, n) => {
|
|
2679
2685
|
this.editor.emit("paste", {
|
|
2680
2686
|
editor: this.editor,
|
|
@@ -2684,25 +2690,25 @@ var $ = class e extends Dr {
|
|
|
2684
2690
|
} }
|
|
2685
2691
|
})];
|
|
2686
2692
|
}
|
|
2687
|
-
}),
|
|
2693
|
+
}), Kr = $.create({
|
|
2688
2694
|
name: "tabindex",
|
|
2689
2695
|
addOptions() {
|
|
2690
2696
|
return { value: void 0 };
|
|
2691
2697
|
},
|
|
2692
2698
|
addProseMirrorPlugins() {
|
|
2693
|
-
return [new
|
|
2694
|
-
key: new
|
|
2699
|
+
return [new C({
|
|
2700
|
+
key: new w("tabindex"),
|
|
2695
2701
|
props: { attributes: () => !this.editor.isEditable && this.options.value === void 0 ? {} : { tabindex: this.options.value ?? "0" } }
|
|
2696
2702
|
})];
|
|
2697
2703
|
}
|
|
2698
|
-
}),
|
|
2704
|
+
}), qr = $.create({
|
|
2699
2705
|
name: "textDirection",
|
|
2700
2706
|
addOptions() {
|
|
2701
2707
|
return { direction: void 0 };
|
|
2702
2708
|
},
|
|
2703
2709
|
addGlobalAttributes() {
|
|
2704
2710
|
if (!this.options.direction) return [];
|
|
2705
|
-
let { nodeExtensions: e } =
|
|
2711
|
+
let { nodeExtensions: e } = U(this.extensions);
|
|
2706
2712
|
return [{
|
|
2707
2713
|
types: e.filter((e) => e.name !== "text").map((e) => e.name),
|
|
2708
2714
|
attributes: { dir: {
|
|
@@ -2716,18 +2722,18 @@ var $ = class e extends Dr {
|
|
|
2716
2722
|
}];
|
|
2717
2723
|
},
|
|
2718
2724
|
addProseMirrorPlugins() {
|
|
2719
|
-
return [new
|
|
2720
|
-
key: new
|
|
2725
|
+
return [new C({
|
|
2726
|
+
key: new w("textDirection"),
|
|
2721
2727
|
props: { attributes: () => {
|
|
2722
2728
|
let e = this.options.direction;
|
|
2723
2729
|
return e ? { dir: e } : {};
|
|
2724
2730
|
} }
|
|
2725
2731
|
})];
|
|
2726
2732
|
}
|
|
2727
|
-
}),
|
|
2728
|
-
function
|
|
2729
|
-
if (
|
|
2730
|
-
|
|
2733
|
+
}), Jr = !1;
|
|
2734
|
+
function Yr(e) {
|
|
2735
|
+
if (Jr) return;
|
|
2736
|
+
Jr = !0;
|
|
2731
2737
|
let t;
|
|
2732
2738
|
try {
|
|
2733
2739
|
t = n.fromJSON(e, {
|
|
@@ -2737,9 +2743,9 @@ function Jr(e) {
|
|
|
2737
2743
|
} catch {
|
|
2738
2744
|
return;
|
|
2739
2745
|
}
|
|
2740
|
-
t instanceof
|
|
2746
|
+
t instanceof D || console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.");
|
|
2741
2747
|
}
|
|
2742
|
-
var
|
|
2748
|
+
var Xr = class e {
|
|
2743
2749
|
get name() {
|
|
2744
2750
|
return this.node.type.name;
|
|
2745
2751
|
}
|
|
@@ -2861,7 +2867,7 @@ var Yr = class e {
|
|
|
2861
2867
|
...e
|
|
2862
2868
|
}), this.editor.view.dispatch(t);
|
|
2863
2869
|
}
|
|
2864
|
-
},
|
|
2870
|
+
}, Zr = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}", Qr = class extends Gn {
|
|
2865
2871
|
constructor(e = {}) {
|
|
2866
2872
|
super(), this.css = null, this.className = "tiptap", this.editorView = null, this.isFocused = !1, this.destroyed = !1, this.isInitialized = !1, this.extensionStorage = {}, this.instanceId = Math.random().toString(36).slice(2, 9), this.hasWarnedStaleDecorationRead = !1, this.options = {
|
|
2867
2873
|
element: typeof document < "u" ? document.createElement("div") : null,
|
|
@@ -2903,14 +2909,14 @@ var Yr = class e {
|
|
|
2903
2909
|
}, this.setOptions(e), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("mount", this.options.onMount), this.on("unmount", this.options.onUnmount), this.on("contentError", this.options.onContentError), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: e, slice: t, moved: n }) => this.options.onDrop(e, t, n)), this.on("paste", ({ event: e, slice: t }) => this.options.onPaste(e, t)), this.on("delete", this.options.onDelete);
|
|
2904
2910
|
let t = this.createDoc();
|
|
2905
2911
|
if (!this.editorState) {
|
|
2906
|
-
let e =
|
|
2907
|
-
this.editorState =
|
|
2912
|
+
let e = ze(t, this.options.autofocus);
|
|
2913
|
+
this.editorState = oe.create({
|
|
2908
2914
|
doc: t,
|
|
2909
2915
|
schema: this.schema,
|
|
2910
2916
|
selection: e || void 0
|
|
2911
2917
|
});
|
|
2912
2918
|
}
|
|
2913
|
-
|
|
2919
|
+
Yr(this.schema), this.options.element && this.mount(this.options.element);
|
|
2914
2920
|
}
|
|
2915
2921
|
mount(e) {
|
|
2916
2922
|
if (typeof document > "u") throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");
|
|
@@ -2944,13 +2950,13 @@ var Yr = class e {
|
|
|
2944
2950
|
return this.commandManager ? this.commandManager.can() : A.createFallbackCan();
|
|
2945
2951
|
}
|
|
2946
2952
|
injectCSS() {
|
|
2947
|
-
this.options.injectCSS && typeof document < "u" && (this.css = pr(
|
|
2953
|
+
this.options.injectCSS && typeof document < "u" && (this.css = pr(Zr, this.options.injectNonce));
|
|
2948
2954
|
}
|
|
2949
2955
|
setOptions(e = {}) {
|
|
2950
2956
|
this.options = {
|
|
2951
2957
|
...this.options,
|
|
2952
2958
|
...e
|
|
2953
|
-
},
|
|
2959
|
+
}, this.editorView && this.state && !this.isDestroyed && (this.options.editorProps && this.view.setProps(this.options.editorProps), this.view.updateState(this.state));
|
|
2954
2960
|
}
|
|
2955
2961
|
setEditable(e, t = !0) {
|
|
2956
2962
|
this.setOptions({ editable: e }), t && this.emit("update", {
|
|
@@ -2986,7 +2992,7 @@ var Yr = class e {
|
|
|
2986
2992
|
return Kn && !this.hasWarnedStaleDecorationRead && Wn(this) && (this.hasWarnedStaleDecorationRead = !0, console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")), this.editorView && (this.editorState = this.view.state), this.editorState;
|
|
2987
2993
|
}
|
|
2988
2994
|
registerPlugin(e, t) {
|
|
2989
|
-
let n =
|
|
2995
|
+
let n = jt(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
|
|
2990
2996
|
return this.view.updateState(r), r;
|
|
2991
2997
|
}
|
|
2992
2998
|
unregisterPlugin(e) {
|
|
@@ -3002,22 +3008,22 @@ var Yr = class e {
|
|
|
3002
3008
|
createExtensionManager() {
|
|
3003
3009
|
var e, t;
|
|
3004
3010
|
let n = [...this.options.enableCoreExtensions ? [
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
Hr,
|
|
3011
|
+
Vr,
|
|
3012
|
+
Lr.configure({ blockSeparator: (e = this.options.coreExtensionOptions) == null || (e = e.clipboardTextSerializer) == null ? void 0 : e.blockSeparator }),
|
|
3013
|
+
Rr,
|
|
3009
3014
|
Ur,
|
|
3010
|
-
Gr.configure({ value: (t = this.options.coreExtensionOptions) == null || (t = t.tabindex) == null ? void 0 : t.value }),
|
|
3011
|
-
zr,
|
|
3012
3015
|
Wr,
|
|
3013
|
-
|
|
3014
|
-
|
|
3016
|
+
Kr.configure({ value: (t = this.options.coreExtensionOptions) == null || (t = t.tabindex) == null ? void 0 : t.value }),
|
|
3017
|
+
Br,
|
|
3018
|
+
Gr,
|
|
3019
|
+
zr,
|
|
3020
|
+
qr.configure({ direction: this.options.textDirection })
|
|
3015
3021
|
].filter((e) => typeof this.options.enableCoreExtensions != "object" || this.options.enableCoreExtensions[e.name] !== !1) : [], ...this.options.extensions].filter((e) => [
|
|
3016
3022
|
"extension",
|
|
3017
3023
|
"node",
|
|
3018
3024
|
"mark"
|
|
3019
3025
|
].includes(e?.type));
|
|
3020
|
-
this.extensionManager = new
|
|
3026
|
+
this.extensionManager = new Ir(n, this);
|
|
3021
3027
|
}
|
|
3022
3028
|
createCommandManager() {
|
|
3023
3029
|
this.commandManager = new A({ editor: this });
|
|
@@ -3032,10 +3038,10 @@ var Yr = class e {
|
|
|
3032
3038
|
} catch (e) {
|
|
3033
3039
|
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) throw e;
|
|
3034
3040
|
let t = St(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
3035
|
-
return this.editorState =
|
|
3041
|
+
return this.editorState = oe.create({
|
|
3036
3042
|
doc: t,
|
|
3037
3043
|
schema: this.schema,
|
|
3038
|
-
selection:
|
|
3044
|
+
selection: ze(t, this.options.autofocus) || void 0
|
|
3039
3045
|
}), this.emit("contentError", {
|
|
3040
3046
|
editor: this,
|
|
3041
3047
|
error: e,
|
|
@@ -3048,7 +3054,7 @@ var Yr = class e {
|
|
|
3048
3054
|
}
|
|
3049
3055
|
createView(e) {
|
|
3050
3056
|
let { editorProps: t, enableExtensionDispatchTransaction: n } = this.options, r = t.dispatchTransaction || this.dispatchTransaction.bind(this), i = n ? this.extensionManager.dispatchTransaction(r) : r, a = t.transformPastedHTML, o = this.extensionManager.transformPastedHTML(a);
|
|
3051
|
-
this.editorView = new
|
|
3057
|
+
this.editorView = new me(e, {
|
|
3052
3058
|
...t,
|
|
3053
3059
|
attributes: {
|
|
3054
3060
|
role: "textbox",
|
|
@@ -3119,30 +3125,30 @@ var Yr = class e {
|
|
|
3119
3125
|
});
|
|
3120
3126
|
}
|
|
3121
3127
|
getAttributes(e) {
|
|
3122
|
-
return
|
|
3128
|
+
return Jt(this.state, e);
|
|
3123
3129
|
}
|
|
3124
3130
|
isActive(e, t) {
|
|
3125
3131
|
let n = typeof e == "string" ? e : null, r = typeof e == "string" ? t : e;
|
|
3126
|
-
return
|
|
3132
|
+
return rn(this.state, n, r);
|
|
3127
3133
|
}
|
|
3128
3134
|
getJSON() {
|
|
3129
3135
|
return this.state.doc.toJSON();
|
|
3130
3136
|
}
|
|
3131
3137
|
getHTML() {
|
|
3132
|
-
return
|
|
3138
|
+
return At(this.state.doc.content, this.schema);
|
|
3133
3139
|
}
|
|
3134
3140
|
getText(e) {
|
|
3135
3141
|
let { blockSeparator: t = "\n\n", textSerializers: n = {} } = e || {};
|
|
3136
|
-
return
|
|
3142
|
+
return Gt(this.state.doc, {
|
|
3137
3143
|
blockSeparator: t,
|
|
3138
3144
|
textSerializers: {
|
|
3139
|
-
...
|
|
3145
|
+
...Kt(this.schema),
|
|
3140
3146
|
...n
|
|
3141
3147
|
}
|
|
3142
3148
|
});
|
|
3143
3149
|
}
|
|
3144
3150
|
get isEmpty() {
|
|
3145
|
-
return
|
|
3151
|
+
return J(this.state.doc);
|
|
3146
3152
|
}
|
|
3147
3153
|
destroy() {
|
|
3148
3154
|
this.destroyed || (this.destroyed = !0, this.emit("destroy"), this.unmount(), this.removeAllListeners(), this.extensionManager.destroy(), this.extensionManager = null, this.schema = null, this.commandManager = null, this.extensionStorage = {});
|
|
@@ -3158,22 +3164,22 @@ var Yr = class e {
|
|
|
3158
3164
|
}
|
|
3159
3165
|
$pos(e) {
|
|
3160
3166
|
let t = this.state.doc.resolve(e), n = e > 0 && t.nodeAfter && !t.nodeAfter.isText && t.nodeAfter.isAtom ? t.nodeAfter : null;
|
|
3161
|
-
return new
|
|
3167
|
+
return new Xr(t, this, !1, n);
|
|
3162
3168
|
}
|
|
3163
3169
|
get $doc() {
|
|
3164
3170
|
return this.$pos(0);
|
|
3165
3171
|
}
|
|
3166
3172
|
};
|
|
3167
|
-
function
|
|
3173
|
+
function $r(e) {
|
|
3168
3174
|
return new Q({
|
|
3169
3175
|
find: e.find,
|
|
3170
3176
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3171
|
-
let i =
|
|
3177
|
+
let i = H(e.getAttributes, void 0, r);
|
|
3172
3178
|
if (i === !1 || i === null) return null;
|
|
3173
3179
|
let { tr: a } = t, o = r[r.length - 1], s = r[0];
|
|
3174
3180
|
if (o) {
|
|
3175
3181
|
let r = s.search(/\S/), c = n.from + s.indexOf(o), l = c + o.length;
|
|
3176
|
-
if (
|
|
3182
|
+
if (Qt(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > c).length) return null;
|
|
3177
3183
|
l < n.to && a.delete(l, n.to), c > n.from && a.delete(n.from + r, c);
|
|
3178
3184
|
let u = n.from + r + o.length;
|
|
3179
3185
|
a.addMark(n.from + r, u, e.type.create(i || {})), a.removeStoredMark(e.type);
|
|
@@ -3182,11 +3188,11 @@ function Qr(e) {
|
|
|
3182
3188
|
undoable: e.undoable
|
|
3183
3189
|
});
|
|
3184
3190
|
}
|
|
3185
|
-
function
|
|
3191
|
+
function ei(e) {
|
|
3186
3192
|
return new Q({
|
|
3187
3193
|
find: e.find,
|
|
3188
3194
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3189
|
-
let i =
|
|
3195
|
+
let i = H(e.getAttributes, void 0, r) || {}, { tr: a } = t, o = n.from, s = n.to, c = e.type.create(i);
|
|
3190
3196
|
if (r[1]) {
|
|
3191
3197
|
let e = o + r[0].lastIndexOf(r[1]);
|
|
3192
3198
|
e > s ? e = s : s = e + r[1].length;
|
|
@@ -3201,18 +3207,18 @@ function $r(e) {
|
|
|
3201
3207
|
undoable: e.undoable
|
|
3202
3208
|
});
|
|
3203
3209
|
}
|
|
3204
|
-
function
|
|
3210
|
+
function ti(e) {
|
|
3205
3211
|
return new Q({
|
|
3206
3212
|
find: e.find,
|
|
3207
3213
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3208
|
-
let i = t.doc.resolve(n.from), a =
|
|
3214
|
+
let i = t.doc.resolve(n.from), a = H(e.getAttributes, void 0, r) || {};
|
|
3209
3215
|
if (!i.node(-1).canReplaceWith(i.index(-1), i.indexAfter(-1), e.type)) return null;
|
|
3210
3216
|
t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, a);
|
|
3211
3217
|
},
|
|
3212
3218
|
undoable: e.undoable
|
|
3213
3219
|
});
|
|
3214
3220
|
}
|
|
3215
|
-
function
|
|
3221
|
+
function ni(e) {
|
|
3216
3222
|
return new Q({
|
|
3217
3223
|
find: e.find,
|
|
3218
3224
|
handler: ({ state: t, range: n, match: r }) => {
|
|
@@ -3228,11 +3234,11 @@ function ti(e) {
|
|
|
3228
3234
|
undoable: e.undoable
|
|
3229
3235
|
});
|
|
3230
3236
|
}
|
|
3231
|
-
function
|
|
3237
|
+
function ri(e) {
|
|
3232
3238
|
return new Q({
|
|
3233
3239
|
find: e.find,
|
|
3234
3240
|
handler: ({ state: t, range: n, match: r, chain: a }) => {
|
|
3235
|
-
let s =
|
|
3241
|
+
let s = H(e.getAttributes, void 0, r) || {}, c = t.tr.delete(n.from, n.to), l = c.doc.resolve(n.from).blockRange(), u = l && o(l, e.type, s);
|
|
3236
3242
|
if (!u) return null;
|
|
3237
3243
|
if (c.wrap(l, u), e.keepMarks && e.editor) {
|
|
3238
3244
|
let { selection: n, storedMarks: r } = t, { splittableMarks: i } = e.editor.extensionManager, a = r || n.$to.parentOffset && n.$from.marks();
|
|
@@ -3251,7 +3257,7 @@ function ni(e) {
|
|
|
3251
3257
|
undoable: e.undoable
|
|
3252
3258
|
});
|
|
3253
3259
|
}
|
|
3254
|
-
var
|
|
3260
|
+
var ii = (e) => "touches" in e, ai = class {
|
|
3255
3261
|
constructor(e) {
|
|
3256
3262
|
var t;
|
|
3257
3263
|
this.directions = [
|
|
@@ -3341,7 +3347,7 @@ var ri = (e) => "touches" in e, ii = class {
|
|
|
3341
3347
|
e ? (this.element.style.width = `${e}px`, this.initialWidth = e) : this.initialWidth = this.element.offsetWidth, t ? (this.element.style.height = `${t}px`, this.initialHeight = t) : this.initialHeight = this.element.offsetHeight, this.initialWidth > 0 && this.initialHeight > 0 && (this.aspectRatio = this.initialWidth / this.initialHeight);
|
|
3342
3348
|
}
|
|
3343
3349
|
handleResizeStart(e, t) {
|
|
3344
|
-
e.preventDefault(), e.stopPropagation(), this.isResizing = !0, this.activeHandle = t,
|
|
3350
|
+
e.preventDefault(), e.stopPropagation(), this.isResizing = !0, this.activeHandle = t, ii(e) ? (this.startX = e.touches[0].clientX, this.startY = e.touches[0].clientY) : (this.startX = e.clientX, this.startY = e.clientY), this.startWidth = this.element.offsetWidth, this.startHeight = this.element.offsetHeight, this.startWidth > 0 && this.startHeight > 0 && (this.aspectRatio = this.startWidth / this.startHeight), this.getPos(), this.container.dataset.resizeState = "true", this.classNames.resizing && this.container.classList.add(this.classNames.resizing), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("touchmove", this.handleTouchMove), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp);
|
|
3345
3351
|
}
|
|
3346
3352
|
handleResize(e, t) {
|
|
3347
3353
|
if (!this.activeHandle) return;
|
|
@@ -3381,7 +3387,7 @@ var ri = (e) => "touches" in e, ii = class {
|
|
|
3381
3387
|
height: e / this.aspectRatio
|
|
3382
3388
|
};
|
|
3383
3389
|
}
|
|
3384
|
-
},
|
|
3390
|
+
}, oi = class e extends Or {
|
|
3385
3391
|
constructor(...e) {
|
|
3386
3392
|
super(...e), this.type = "node";
|
|
3387
3393
|
}
|
|
@@ -3396,7 +3402,7 @@ var ri = (e) => "touches" in e, ii = class {
|
|
|
3396
3402
|
let t = typeof e == "function" ? e() : e;
|
|
3397
3403
|
return super.extend(t);
|
|
3398
3404
|
}
|
|
3399
|
-
},
|
|
3405
|
+
}, si = class {
|
|
3400
3406
|
constructor(e, t, n) {
|
|
3401
3407
|
this.isDragging = !1, this.component = e, this.editor = t.editor, this.options = {
|
|
3402
3408
|
stopEvent: null,
|
|
@@ -3443,14 +3449,14 @@ var ri = (e) => "touches" in e, ii = class {
|
|
|
3443
3449
|
}
|
|
3444
3450
|
let l = this.getPos();
|
|
3445
3451
|
if (typeof l != "number") return;
|
|
3446
|
-
let u =
|
|
3452
|
+
let u = S.create(t.state.doc, l), d = t.state.tr.setSelection(u);
|
|
3447
3453
|
t.dispatch(d);
|
|
3448
3454
|
}
|
|
3449
3455
|
stopEvent(e) {
|
|
3450
3456
|
if (!this.dom) return !1;
|
|
3451
3457
|
if (typeof this.options.stopEvent == "function") return this.options.stopEvent({ event: e });
|
|
3452
3458
|
let t = e.target;
|
|
3453
|
-
if (!
|
|
3459
|
+
if (!this.dom.contains(t) || this.contentDOM?.contains(t)) return !1;
|
|
3454
3460
|
let n = e.type.startsWith("drag"), r = e.type === "dragover" || e.type === "dragenter", i = e.type === "drop";
|
|
3455
3461
|
if (([
|
|
3456
3462
|
"INPUT",
|
|
@@ -3458,7 +3464,7 @@ var ri = (e) => "touches" in e, ii = class {
|
|
|
3458
3464
|
"SELECT",
|
|
3459
3465
|
"TEXTAREA"
|
|
3460
3466
|
].includes(t.tagName) || t.isContentEditable) && !i && !n) return !0;
|
|
3461
|
-
let { isEditable: a } = this.editor, { isDragging: o } = this, s = !!this.node.type.spec.draggable, c =
|
|
3467
|
+
let { isEditable: a } = this.editor, { isDragging: o } = this, s = !!this.node.type.spec.draggable, c = S.isSelectable(this.node), l = e.type === "copy", u = e.type === "paste", d = e.type === "cut", f = e.type === "mousedown";
|
|
3462
3468
|
if (!s && c && n && e.target === this.dom && e.preventDefault(), s && n && !o && e.target === this.dom) return e.preventDefault(), !1;
|
|
3463
3469
|
if (s && a && !o && f) {
|
|
3464
3470
|
let e = t.closest("[data-drag-handle]");
|
|
@@ -3473,7 +3479,7 @@ var ri = (e) => "touches" in e, ii = class {
|
|
|
3473
3479
|
return !(o || r || i || l || u || d || f && c);
|
|
3474
3480
|
}
|
|
3475
3481
|
ignoreMutation(e) {
|
|
3476
|
-
return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: e }) : this.node.isLeaf || this.node.isAtom ? !0 : e.type === "selection" || this.
|
|
3482
|
+
return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: e }) : this.node.isLeaf || this.node.isAtom ? !0 : e.type === "selection" || this.contentDOM.contains(e.target) && e.type === "childList" && (I() || Be()) && this.editor.isFocused && [...Array.from(e.addedNodes), ...Array.from(e.removedNodes)].every((e) => e.isContentEditable) ? !1 : this.contentDOM === e.target && e.type === "attributes" || !this.contentDOM.contains(e.target);
|
|
3477
3483
|
}
|
|
3478
3484
|
updateAttributes(e) {
|
|
3479
3485
|
this.editor.commands.command(({ tr: t }) => {
|
|
@@ -3494,20 +3500,20 @@ var ri = (e) => "touches" in e, ii = class {
|
|
|
3494
3500
|
});
|
|
3495
3501
|
}
|
|
3496
3502
|
};
|
|
3497
|
-
function
|
|
3498
|
-
return new
|
|
3503
|
+
function ci(e) {
|
|
3504
|
+
return new Ar({
|
|
3499
3505
|
find: e.find,
|
|
3500
3506
|
handler: ({ state: t, range: n, match: r, pasteEvent: i }) => {
|
|
3501
|
-
let a =
|
|
3507
|
+
let a = H(e.getAttributes, void 0, r, i);
|
|
3502
3508
|
if (a === !1 || a === null) return null;
|
|
3503
3509
|
let { tr: o } = t, s = r[r.length - 1], c = r[0], l = n.to;
|
|
3504
3510
|
if (s) {
|
|
3505
3511
|
let i = c.search(/\S/), u = n.from + c.indexOf(s), d = u + s.length;
|
|
3506
|
-
if (
|
|
3512
|
+
if (Qt(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > u).length) return null;
|
|
3507
3513
|
d < n.to && o.delete(d, n.to), u > n.from && o.delete(n.from + i, u), l = n.from + i + s.length, o.addMark(n.from + i, l, e.type.create(a || {})), r.index !== void 0 && r.input !== void 0 && r.index + r[0].length >= r.input.length || o.removeStoredMark(e.type);
|
|
3508
3514
|
}
|
|
3509
3515
|
}
|
|
3510
3516
|
});
|
|
3511
3517
|
}
|
|
3512
3518
|
//#endregion
|
|
3513
|
-
export {
|
|
3519
|
+
export { z as A, Sr as B, W as C, an as D, Kt as E, ci as F, ti as H, It as I, ei as L, ln as M, Re as N, on as O, $r as P, yr as R, en as S, Gt as T, ri as U, ni as V, V as _, oi as a, $t as b, ai as c, Tt as d, mr as f, Zt as g, Jt as h, kr as i, J as j, gr as k, H as l, Dt as m, $ as n, si as o, Et as p, Q as r, Ar as s, Qr as t, fr as u, N as v, hr as w, j as x, Qt as y, pn as z };
|