@clevertask/scribe 0.1.17 → 0.1.18
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 +1 -1
- package/dist/{BarMenu-x4sf3ECS.js → BarMenu-C9tCdvyV.js} +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.d.ts.map +1 -1
- package/dist/components/Menu/LinkBubbleMenu.js +2 -2
- package/dist/components/Menu/LinkEditor.d.ts.map +1 -1
- 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 +1 -1
- 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 +2 -2
- 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/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/index.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/extension/tableOfContents.js +1 -1
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +4 -4
- package/dist/{dist-tNcpTcFT.js → dist-CkWsQ5Lj.js} +197 -185
- package/dist/{dist-DDjaA1Pn.js → dist-DRPH9MfF.js} +1 -1
- package/dist/{extension-CwuvxVkr.js → extension-DOo9QT6U.js} +1167 -1159
- package/dist/{extension-link-RYtPpHwt.js → extension-link-yMrg9JOz.js} +2 -2
- package/dist/{html-to-markdown-nbQ6qHyO.js → html-to-markdown-CnlA8pb8.js} +1 -1
- package/dist/main.js +2 -2
- package/dist/{markdown-to-html-B-KKCZRs.js → markdown-to-html-BLzYd3Fu.js} +10 -11
- package/dist/{menus-U2HdvQnu.js → menus-Dy2dj4QT.js} +5 -5
- package/dist/purify.es-DGv0-Lid.js +805 -0
- package/dist/{resizable-table-m0AzovsZ.js → resizable-table-D0mls3aB.js} +2 -2
- package/dist/{slashCommand-CtvgnL0Z.js → slashCommand-D35jcSNp.js} +2 -2
- 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 +51 -51
- package/dist/purify.es-BES4pJF7.js +0 -774
|
@@ -1,18 +1,18 @@
|
|
|
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 ee, liftEmptyBlock as te, newlineInCode as
|
|
3
|
-
import { AllSelection 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.30.
|
|
9
|
-
var
|
|
10
|
-
for (var n in t)
|
|
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 ne, selectNodeBackward as re, selectNodeForward as ie, selectParentNode as ae, selectTextblockEnd as oe, selectTextblockStart as _, setBlockType as v, wrapIn as y } from "@tiptap/pm/commands";
|
|
3
|
+
import { AllSelection as se, EditorState as b, NodeSelection as x, Plugin as S, PluginKey as C, Selection as w, TextSelection as T } from "@tiptap/pm/state";
|
|
4
|
+
import { DOMParser as ce, DOMSerializer as le, Fragment as E, Schema as ue, Slice as de } from "@tiptap/pm/model";
|
|
5
|
+
import { liftListItem as fe, sinkListItem as pe, wrapInList as me } from "@tiptap/pm/schema-list";
|
|
6
|
+
import { DecorationSet as D, EditorView as he } from "@tiptap/pm/view";
|
|
7
|
+
import { keymap as ge } from "@tiptap/pm/keymap";
|
|
8
|
+
//#region node_modules/.pnpm/@tiptap+core@3.30.2_@tiptap+pm@3.30.2/node_modules/@tiptap/core/dist/index.js
|
|
9
|
+
var _e = Object.defineProperty, ve = (e, t) => {
|
|
10
|
+
for (var n in t) _e(e, n, {
|
|
11
11
|
get: t[n],
|
|
12
12
|
enumerable: !0
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
function
|
|
15
|
+
function O(e) {
|
|
16
16
|
let { state: t, transaction: n } = e, { selection: r } = n, { doc: i } = n, { storedMarks: a } = n;
|
|
17
17
|
return {
|
|
18
18
|
...t,
|
|
@@ -36,7 +36,7 @@ function k(e) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
var
|
|
39
|
+
var k = class e {
|
|
40
40
|
constructor(e) {
|
|
41
41
|
this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
|
|
42
42
|
}
|
|
@@ -69,6 +69,12 @@ var A = class {
|
|
|
69
69
|
};
|
|
70
70
|
return u;
|
|
71
71
|
}
|
|
72
|
+
static createFakeChain() {
|
|
73
|
+
let e = new Proxy({}, { get: (t, n) => {
|
|
74
|
+
if (n !== "then") return n === "run" ? () => !1 : () => e;
|
|
75
|
+
} });
|
|
76
|
+
return e;
|
|
77
|
+
}
|
|
72
78
|
createCan(e) {
|
|
73
79
|
let { rawCommands: t, state: n } = this, r = e || n.tr, i = this.buildProps(r, !1);
|
|
74
80
|
return {
|
|
@@ -79,12 +85,18 @@ var A = class {
|
|
|
79
85
|
chain: () => this.createChain(r, !1)
|
|
80
86
|
};
|
|
81
87
|
}
|
|
88
|
+
static createFallbackCan() {
|
|
89
|
+
let t = e.createFakeChain();
|
|
90
|
+
return new Proxy({ chain: () => t }, { get: (e, t) => {
|
|
91
|
+
if (t !== "then") return t === "chain" ? e.chain : () => !1;
|
|
92
|
+
} });
|
|
93
|
+
}
|
|
82
94
|
buildProps(e, t = !0) {
|
|
83
95
|
let { rawCommands: n, editor: r, state: i } = this, { view: a } = r, o = {
|
|
84
96
|
tr: e,
|
|
85
97
|
editor: r,
|
|
86
98
|
view: a,
|
|
87
|
-
state:
|
|
99
|
+
state: O({
|
|
88
100
|
state: i,
|
|
89
101
|
transaction: e
|
|
90
102
|
}),
|
|
@@ -97,22 +109,22 @@ var A = class {
|
|
|
97
109
|
};
|
|
98
110
|
return o;
|
|
99
111
|
}
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
blur: () =>
|
|
103
|
-
clearContent: () =>
|
|
104
|
-
clearNodes: () =>
|
|
105
|
-
command: () =>
|
|
106
|
-
createParagraphNear: () =>
|
|
107
|
-
cut: () =>
|
|
108
|
-
deleteCurrentNode: () =>
|
|
109
|
-
deleteNode: () =>
|
|
110
|
-
deleteRange: () =>
|
|
111
|
-
deleteSelection: () =>
|
|
112
|
-
enter: () =>
|
|
113
|
-
exitCode: () =>
|
|
114
|
-
extendMarkRange: () =>
|
|
115
|
-
first: () =>
|
|
112
|
+
}, ye = {};
|
|
113
|
+
ve(ye, {
|
|
114
|
+
blur: () => be,
|
|
115
|
+
clearContent: () => xe,
|
|
116
|
+
clearNodes: () => Se,
|
|
117
|
+
command: () => Ce,
|
|
118
|
+
createParagraphNear: () => we,
|
|
119
|
+
cut: () => Te,
|
|
120
|
+
deleteCurrentNode: () => Ee,
|
|
121
|
+
deleteNode: () => De,
|
|
122
|
+
deleteRange: () => Oe,
|
|
123
|
+
deleteSelection: () => Me,
|
|
124
|
+
enter: () => Ne,
|
|
125
|
+
exitCode: () => Pe,
|
|
126
|
+
extendMarkRange: () => Re,
|
|
127
|
+
first: () => ze,
|
|
116
128
|
focus: () => Ue,
|
|
117
129
|
forEach: () => We,
|
|
118
130
|
insertContent: () => Ge,
|
|
@@ -162,10 +174,10 @@ _e(ve, {
|
|
|
162
174
|
wrapIn: () => Vn,
|
|
163
175
|
wrapInList: () => Hn
|
|
164
176
|
});
|
|
165
|
-
var
|
|
177
|
+
var be = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
166
178
|
var n;
|
|
167
179
|
e.isDestroyed || (t.dom.blur(), (n = window == null ? void 0 : window.getSelection()) == null || n.removeAllRanges());
|
|
168
|
-
}), !0),
|
|
180
|
+
}), !0), xe = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), Se = () => ({ state: e, tr: t, dispatch: n }) => {
|
|
169
181
|
let { selection: r } = t, { ranges: i } = r;
|
|
170
182
|
return n && i.forEach(({ $from: n, $to: r }) => {
|
|
171
183
|
e.doc.nodesBetween(n.pos, r.pos, (e, n) => {
|
|
@@ -180,12 +192,12 @@ var ye = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
|
180
192
|
(l || l === 0) && t.lift(s, l);
|
|
181
193
|
});
|
|
182
194
|
}), !0;
|
|
183
|
-
},
|
|
195
|
+
}, Ce = (e) => (t) => e(t), we = () => ({ state: e, dispatch: t }) => l(e, t), Te = (e, t) => ({ editor: n, tr: r }) => {
|
|
184
196
|
let { state: i } = n, a = i.doc.slice(e.from, e.to);
|
|
185
197
|
r.deleteRange(e.from, e.to);
|
|
186
198
|
let o = r.mapping.map(t);
|
|
187
|
-
return r.insert(o, a.content), r.setSelection(new
|
|
188
|
-
},
|
|
199
|
+
return r.insert(o, a.content), r.setSelection(new T(r.doc.resolve(Math.max(o - 1, 0)))), !0;
|
|
200
|
+
}, Ee = () => ({ tr: e, dispatch: t }) => {
|
|
189
201
|
let { selection: n } = e, r = n.$anchor.node();
|
|
190
202
|
if (r.content.size > 0) return !1;
|
|
191
203
|
let i = e.selection.$anchor;
|
|
@@ -198,15 +210,15 @@ var ye = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
|
198
210
|
}
|
|
199
211
|
return !1;
|
|
200
212
|
};
|
|
201
|
-
function
|
|
213
|
+
function A(e, t) {
|
|
202
214
|
if (typeof e == "string") {
|
|
203
215
|
if (!t.nodes[e]) throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
|
|
204
216
|
return t.nodes[e];
|
|
205
217
|
}
|
|
206
218
|
return e;
|
|
207
219
|
}
|
|
208
|
-
var
|
|
209
|
-
let i =
|
|
220
|
+
var De = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
221
|
+
let i = A(e, n.schema), a = t.selection.$anchor;
|
|
210
222
|
for (let e = a.depth; e > 0; --e) if (a.node(e).type === i) {
|
|
211
223
|
if (r) {
|
|
212
224
|
let n = a.before(e), r = a.after(e);
|
|
@@ -215,41 +227,41 @@ var Ee = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
|
215
227
|
return !0;
|
|
216
228
|
}
|
|
217
229
|
return !1;
|
|
218
|
-
},
|
|
230
|
+
}, Oe = (e) => ({ tr: t, dispatch: n }) => {
|
|
219
231
|
let { from: r, to: i } = e;
|
|
220
232
|
return n && t.delete(r, i), !0;
|
|
221
|
-
},
|
|
233
|
+
}, ke = (e) => e.content ? /^text(\*|\+)/.test(e.content) : !1, Ae = (e, t, n) => {
|
|
222
234
|
if (!e.parent.isInline || n === "left" && e.pos > e.start() || n === "right" && e.pos < e.end()) return e.pos;
|
|
223
235
|
let r = t.nodes[e.parent.type.name].spec;
|
|
224
|
-
return
|
|
225
|
-
},
|
|
226
|
-
from:
|
|
227
|
-
to:
|
|
228
|
-
}),
|
|
236
|
+
return ke(r) ? n === "left" ? e.start() - 1 : e.end() + 1 : e.pos;
|
|
237
|
+
}, je = (e, t, n) => ({
|
|
238
|
+
from: Ae(e, n, "left"),
|
|
239
|
+
to: Ae(t, n, "right")
|
|
240
|
+
}), Me = () => ({ state: e, dispatch: t }) => {
|
|
229
241
|
if (e.selection.empty) return !1;
|
|
230
242
|
if (t) {
|
|
231
243
|
let n = e.tr, { ranges: r } = e.selection, i = n.steps.length;
|
|
232
244
|
r.forEach((t) => {
|
|
233
|
-
let r = n.mapping.slice(i), { from: a, to: o } =
|
|
245
|
+
let r = n.mapping.slice(i), { from: a, to: o } = je(n.doc.resolve(r.map(t.$from.pos)), n.doc.resolve(r.map(t.$to.pos)), e.schema);
|
|
234
246
|
n.deleteRange(a, o);
|
|
235
|
-
}), n.selection.empty || n.setSelection(
|
|
247
|
+
}), n.selection.empty || n.setSelection(T.near(n.doc.resolve(n.selection.from))), n.scrollIntoView(), t(n);
|
|
236
248
|
}
|
|
237
249
|
return !0;
|
|
238
|
-
},
|
|
239
|
-
function
|
|
250
|
+
}, Ne = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Pe = () => ({ state: e, dispatch: t }) => u(e, t);
|
|
251
|
+
function Fe(e) {
|
|
240
252
|
return Object.prototype.toString.call(e) === "[object RegExp]";
|
|
241
253
|
}
|
|
242
|
-
function
|
|
254
|
+
function j(e, t, n = { strict: !0 }) {
|
|
243
255
|
let r = Object.keys(t);
|
|
244
|
-
return !r.length || r.every((r) => n.strict ? t[r] === e[r] :
|
|
245
|
-
}
|
|
246
|
-
function Fe(e, t, n = {}) {
|
|
247
|
-
return e.find((e) => e.type === t && M(Object.fromEntries(Object.keys(n).map((t) => [t, e.attrs[t]])), n));
|
|
256
|
+
return !r.length || r.every((r) => n.strict ? t[r] === e[r] : Fe(t[r]) ? t[r].test(e[r]) : t[r] === e[r]);
|
|
248
257
|
}
|
|
249
258
|
function Ie(e, t, n = {}) {
|
|
250
|
-
return
|
|
259
|
+
return e.find((e) => e.type === t && j(Object.fromEntries(Object.keys(n).map((t) => [t, e.attrs[t]])), n));
|
|
260
|
+
}
|
|
261
|
+
function Le(e, t, n = {}) {
|
|
262
|
+
return !!Ie(e, t, n);
|
|
251
263
|
}
|
|
252
|
-
function
|
|
264
|
+
function M(e, t, n) {
|
|
253
265
|
if (!e || !t) return;
|
|
254
266
|
let r = e.parent.childAfter(e.parentOffset);
|
|
255
267
|
if ((!r.node || !r.node.marks.some((e) => e.type === t)) && (r = e.parent.childBefore(e.parentOffset)), !r.node || !r.node.marks.some((e) => e.type === t)) return;
|
|
@@ -257,50 +269,50 @@ function N(e, t, n) {
|
|
|
257
269
|
let e = r.node.marks.find((e) => e.type === t);
|
|
258
270
|
e && (n = e.attrs);
|
|
259
271
|
}
|
|
260
|
-
if (!
|
|
272
|
+
if (!Ie([...r.node.marks], t, n)) return;
|
|
261
273
|
let i = r.index, a = e.start() + r.offset, o = i + 1, s = a + r.node.nodeSize;
|
|
262
|
-
for (; i > 0 &&
|
|
263
|
-
for (; o < e.parent.childCount &&
|
|
274
|
+
for (; i > 0 && Le([...e.parent.child(i - 1).marks], t, n);) --i, a -= e.parent.child(i).nodeSize;
|
|
275
|
+
for (; o < e.parent.childCount && Le([...e.parent.child(o).marks], t, n);) s += e.parent.child(o).nodeSize, o += 1;
|
|
264
276
|
return {
|
|
265
277
|
from: a,
|
|
266
278
|
to: s
|
|
267
279
|
};
|
|
268
280
|
}
|
|
269
|
-
function
|
|
281
|
+
function N(e, t) {
|
|
270
282
|
if (typeof e == "string") {
|
|
271
283
|
if (!t.marks[e]) throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
|
|
272
284
|
return t.marks[e];
|
|
273
285
|
}
|
|
274
286
|
return e;
|
|
275
287
|
}
|
|
276
|
-
var
|
|
277
|
-
let a =
|
|
288
|
+
var Re = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
289
|
+
let a = N(e, r.schema), { doc: o, selection: s } = n, { $from: c, from: l, to: u } = s;
|
|
278
290
|
if (i) {
|
|
279
|
-
let e =
|
|
291
|
+
let e = M(c, a, t);
|
|
280
292
|
if (e && e.from <= l && e.to >= u) {
|
|
281
|
-
let t =
|
|
293
|
+
let t = T.create(o, e.from, e.to);
|
|
282
294
|
n.setSelection(t);
|
|
283
295
|
}
|
|
284
296
|
}
|
|
285
297
|
return !0;
|
|
286
|
-
},
|
|
298
|
+
}, ze = (e) => (t) => {
|
|
287
299
|
let n = typeof e == "function" ? e(t) : e;
|
|
288
300
|
for (let e = 0; e < n.length; e += 1) if (n[e](t)) return !0;
|
|
289
301
|
return !1;
|
|
290
302
|
};
|
|
291
|
-
function
|
|
292
|
-
return e instanceof
|
|
303
|
+
function P(e) {
|
|
304
|
+
return e instanceof T;
|
|
293
305
|
}
|
|
294
306
|
function F(e = 0, t = 0, n = 0) {
|
|
295
307
|
return Math.min(Math.max(e, t), n);
|
|
296
308
|
}
|
|
297
309
|
function Be(e, t = null) {
|
|
298
310
|
if (!t) return null;
|
|
299
|
-
let n =
|
|
311
|
+
let n = w.atStart(e), r = w.atEnd(e);
|
|
300
312
|
if (t === "start" || t === !0) return n;
|
|
301
313
|
if (t === "end") return r;
|
|
302
314
|
let i = n.from, a = r.to;
|
|
303
|
-
return t === "all" ?
|
|
315
|
+
return t === "all" ? T.create(e, F(0, i, a), F(e.content.size, i, a)) : T.create(e, F(t, i, a), F(t, i, a));
|
|
304
316
|
}
|
|
305
317
|
function Ve() {
|
|
306
318
|
return ["Android"].includes(navigator.platform) || /android/i.test(navigator.userAgent);
|
|
@@ -333,7 +345,7 @@ var Ue = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
|
|
|
333
345
|
} catch {
|
|
334
346
|
return !1;
|
|
335
347
|
}
|
|
336
|
-
if (a && e === null && !
|
|
348
|
+
if (a && e === null && !P(n.state.selection)) return o(), !0;
|
|
337
349
|
let s = Be(i.doc, e) || n.state.selection, c = n.state.selection.eq(s);
|
|
338
350
|
return a && (c || i.setSelection(s), c && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
|
|
339
351
|
}, We = (e, t) => (n) => e.every((e, r) => t(e, {
|
|
@@ -368,7 +380,7 @@ function R(e, t, n) {
|
|
|
368
380
|
};
|
|
369
381
|
let i = typeof e == "string";
|
|
370
382
|
if (r) try {
|
|
371
|
-
if (Array.isArray(e) && e.length > 0) return
|
|
383
|
+
if (Array.isArray(e) && e.length > 0) return E.fromArray(e.map((e) => t.nodeFromJSON(e)));
|
|
372
384
|
let r = t.nodeFromJSON(e);
|
|
373
385
|
return n.errorOnInvalidContent && r.check(), r;
|
|
374
386
|
} catch (r) {
|
|
@@ -377,7 +389,7 @@ function R(e, t, n) {
|
|
|
377
389
|
}
|
|
378
390
|
if (i) {
|
|
379
391
|
if (n.errorOnInvalidContent) {
|
|
380
|
-
let r = !1, i = "", a = new
|
|
392
|
+
let r = !1, i = "", a = new ue({
|
|
381
393
|
topNode: t.spec.topNode,
|
|
382
394
|
marks: t.spec.marks,
|
|
383
395
|
nodes: t.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {
|
|
@@ -389,9 +401,9 @@ function R(e, t, n) {
|
|
|
389
401
|
}]
|
|
390
402
|
} })
|
|
391
403
|
});
|
|
392
|
-
if (n.slice ?
|
|
404
|
+
if (n.slice ? ce.fromSchema(a).parseSlice(L(e), n.parseOptions) : ce.fromSchema(a).parse(L(e), n.parseOptions), n.errorOnInvalidContent && r) throw Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ Error(`Invalid element found: ${i}`) });
|
|
393
405
|
}
|
|
394
|
-
let r =
|
|
406
|
+
let r = ce.fromSchema(t);
|
|
395
407
|
return n.slice ? r.parseSlice(L(e), n.parseOptions).content : r.parse(L(e), n.parseOptions);
|
|
396
408
|
}
|
|
397
409
|
return R("", t, n);
|
|
@@ -407,7 +419,7 @@ function Ye(e, r, i) {
|
|
|
407
419
|
let s = e.mapping.maps[a], c = 0;
|
|
408
420
|
s.forEach((e, t, n, r) => {
|
|
409
421
|
c === 0 && (c = r);
|
|
410
|
-
}), e.setSelection(
|
|
422
|
+
}), e.setSelection(w.near(e.doc.resolve(c), i));
|
|
411
423
|
}
|
|
412
424
|
var Xe = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
413
425
|
if (i) {
|
|
@@ -462,7 +474,7 @@ var Xe = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
462
474
|
let p;
|
|
463
475
|
if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") : qe(t) ? f.map((e) => e.text ?? "").join("") : typeof t == "object" && t && t.text ? t.text : t, r.insertText(p, c, l);
|
|
464
476
|
else {
|
|
465
|
-
p =
|
|
477
|
+
p = E.from(f);
|
|
466
478
|
let e = r.doc.resolve(c), t = e.node(), n = e.parentOffset === 0, i = t.isText || t.isTextblock, a = t.content.size > 0;
|
|
467
479
|
n && i && a && d && (c = Math.max(0, c - 1)), r.replaceWith(c, l, f);
|
|
468
480
|
}
|
|
@@ -550,7 +562,7 @@ var lt = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
|
|
|
550
562
|
}), !0;
|
|
551
563
|
};
|
|
552
564
|
function z(e, t, n = {}) {
|
|
553
|
-
let { from: r, to: i, empty: a } = e.selection, o = t ?
|
|
565
|
+
let { from: r, to: i, empty: a } = e.selection, o = t ? A(t, e.schema) : null, s = [];
|
|
554
566
|
e.doc.nodesBetween(r, i, (e, t) => {
|
|
555
567
|
if (e.isText) return;
|
|
556
568
|
let n = Math.max(r, t), a = Math.min(i, t + e.nodeSize);
|
|
@@ -560,13 +572,13 @@ function z(e, t, n = {}) {
|
|
|
560
572
|
to: a
|
|
561
573
|
});
|
|
562
574
|
});
|
|
563
|
-
let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) =>
|
|
575
|
+
let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) => j(e.node.attrs, n, { strict: !1 }));
|
|
564
576
|
return a ? !!l.length : l.reduce((e, t) => e + t.to - t.from, 0) >= c;
|
|
565
577
|
}
|
|
566
|
-
var ut = (e, t = {}) => ({ state: n, dispatch: r }) => z(n,
|
|
567
|
-
let r =
|
|
568
|
-
return
|
|
569
|
-
}, pt = () => ({ state: e, dispatch: t }) =>
|
|
578
|
+
var ut = (e, t = {}) => ({ state: n, dispatch: r }) => z(n, A(e, n.schema), t) ? ee(n, r) : !1, dt = () => ({ state: e, dispatch: t }) => te(e, t), ft = (e) => ({ state: t, dispatch: n }) => {
|
|
579
|
+
let r = A(e, t.schema);
|
|
580
|
+
return fe(r)(t, n);
|
|
581
|
+
}, pt = () => ({ state: e, dispatch: t }) => ne(e, t);
|
|
570
582
|
function B(e, t) {
|
|
571
583
|
return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
|
|
572
584
|
}
|
|
@@ -577,7 +589,7 @@ function mt(e, t) {
|
|
|
577
589
|
var ht = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
578
590
|
let a = null, o = null, s = B(typeof e == "string" ? e : e.name, r.schema);
|
|
579
591
|
if (!s) return !1;
|
|
580
|
-
s === "node" && (a =
|
|
592
|
+
s === "node" && (a = A(e, r.schema)), s === "mark" && (o = N(e, r.schema));
|
|
581
593
|
let c = !1;
|
|
582
594
|
return n.selection.ranges.forEach((e) => {
|
|
583
595
|
r.doc.nodesBetween(e.$from.pos, e.$to.pos, (e, r) => {
|
|
@@ -588,11 +600,11 @@ var ht = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
588
600
|
}), c;
|
|
589
601
|
}, gt = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), _t = () => ({ tr: e, dispatch: t }) => {
|
|
590
602
|
if (t) {
|
|
591
|
-
let t = new
|
|
603
|
+
let t = new se(e.doc);
|
|
592
604
|
e.setSelection(t);
|
|
593
605
|
}
|
|
594
606
|
return !0;
|
|
595
|
-
}, vt = () => ({ state: e, dispatch: t }) =>
|
|
607
|
+
}, vt = () => ({ state: e, dispatch: t }) => re(e, t), yt = () => ({ state: e, dispatch: t }) => ie(e, t), bt = () => ({ state: e, dispatch: t }) => ae(e, t), xt = () => ({ state: e, dispatch: t }) => oe(e, t), St = () => ({ state: e, dispatch: t }) => _(e, t);
|
|
596
608
|
function Ct(e, t, n = {}, r = {}) {
|
|
597
609
|
return R(e, t, {
|
|
598
610
|
slice: !1,
|
|
@@ -619,7 +631,7 @@ var wt = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {
|
|
|
619
631
|
});
|
|
620
632
|
};
|
|
621
633
|
function Tt(e, t) {
|
|
622
|
-
let n =
|
|
634
|
+
let n = N(t, e.schema), { from: r, to: i, empty: a } = e.selection, o = [];
|
|
623
635
|
a ? (e.storedMarks && o.push(...e.storedMarks), o.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, i, (e) => {
|
|
624
636
|
o.push(...e.marks);
|
|
625
637
|
});
|
|
@@ -674,7 +686,7 @@ function kt(e) {
|
|
|
674
686
|
}).flat(10);
|
|
675
687
|
}
|
|
676
688
|
function At(e, t) {
|
|
677
|
-
let n =
|
|
689
|
+
let n = le.fromSchema(t).serializeFragment(e), r = document.implementation.createHTMLDocument().createElement("div");
|
|
678
690
|
return r.appendChild(n), r.innerHTML;
|
|
679
691
|
}
|
|
680
692
|
function jt(e) {
|
|
@@ -902,7 +914,7 @@ function Vt(e, t) {
|
|
|
902
914
|
HTMLAttributes: G(e, i)
|
|
903
915
|
})), [r.name, o];
|
|
904
916
|
}));
|
|
905
|
-
return new
|
|
917
|
+
return new ue({
|
|
906
918
|
topNode: a,
|
|
907
919
|
nodes: o,
|
|
908
920
|
marks: s
|
|
@@ -947,7 +959,7 @@ function Kt(e) {
|
|
|
947
959
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
|
|
948
960
|
}
|
|
949
961
|
function qt(e, t) {
|
|
950
|
-
let n =
|
|
962
|
+
let n = A(t, e.schema), { from: r, to: i } = e.selection, a = [];
|
|
951
963
|
e.doc.nodesBetween(r, i, (e) => {
|
|
952
964
|
a.push(e);
|
|
953
965
|
});
|
|
@@ -1005,7 +1017,7 @@ function Zt(e) {
|
|
|
1005
1017
|
function Qt(e, t, n) {
|
|
1006
1018
|
let r = [];
|
|
1007
1019
|
return e === t ? n.resolve(e).marks().forEach((t) => {
|
|
1008
|
-
let i =
|
|
1020
|
+
let i = M(n.resolve(e), t.type);
|
|
1009
1021
|
i && r.push({
|
|
1010
1022
|
mark: t,
|
|
1011
1023
|
...i
|
|
@@ -1054,8 +1066,8 @@ var tn = (e, t = 500) => {
|
|
|
1054
1066
|
}), n;
|
|
1055
1067
|
};
|
|
1056
1068
|
function nn(e, t, n = {}) {
|
|
1057
|
-
let { empty: r, ranges: i } = e.selection, a = t ?
|
|
1058
|
-
if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) =>
|
|
1069
|
+
let { empty: r, ranges: i } = e.selection, a = t ? N(t, e.schema) : null;
|
|
1070
|
+
if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) => j(e.attrs, n, { strict: !1 }));
|
|
1059
1071
|
let o = 0, s = [];
|
|
1060
1072
|
if (i.forEach(({ $from: t, $to: n }) => {
|
|
1061
1073
|
let r = t.pos, i = n.pos;
|
|
@@ -1070,7 +1082,7 @@ function nn(e, t, n = {}) {
|
|
|
1070
1082
|
})));
|
|
1071
1083
|
});
|
|
1072
1084
|
}), o === 0) return !1;
|
|
1073
|
-
let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) =>
|
|
1085
|
+
let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) => j(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);
|
|
1074
1086
|
return (c > 0 ? c + l : c) >= o;
|
|
1075
1087
|
}
|
|
1076
1088
|
function rn(e, t, n = {}) {
|
|
@@ -1124,11 +1136,11 @@ function Y(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1124
1136
|
return !1;
|
|
1125
1137
|
}
|
|
1126
1138
|
function ln(e) {
|
|
1127
|
-
return e instanceof
|
|
1139
|
+
return e instanceof x;
|
|
1128
1140
|
}
|
|
1129
1141
|
function un({ selection: e, pos: t, nodeSize: n, selectedOnTextSelection: r = !1 }) {
|
|
1130
1142
|
let { from: i, to: a } = e;
|
|
1131
|
-
return !!(i <= t && a >= t + n || r &&
|
|
1143
|
+
return !!(i <= t && a >= t + n || r && P(e) && i > t && a < t + n);
|
|
1132
1144
|
}
|
|
1133
1145
|
var dn = class e {
|
|
1134
1146
|
constructor(e) {
|
|
@@ -1169,7 +1181,7 @@ function mn(e, t, n) {
|
|
|
1169
1181
|
}
|
|
1170
1182
|
function hn(e, t, n) {
|
|
1171
1183
|
let { selection: r } = t, i = null;
|
|
1172
|
-
if (
|
|
1184
|
+
if (P(r) && (i = r.$cursor), i) {
|
|
1173
1185
|
let t = e.storedMarks ?? i.marks();
|
|
1174
1186
|
return i.parent.type.allowsMarkType(n) && (!!n.isInSet(t) || !t.some((e) => e.type.excludes(n)));
|
|
1175
1187
|
}
|
|
@@ -1187,7 +1199,7 @@ function hn(e, t, n) {
|
|
|
1187
1199
|
});
|
|
1188
1200
|
}
|
|
1189
1201
|
var gn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1190
|
-
let { selection: a } = n, { empty: o, ranges: s } = a, c =
|
|
1202
|
+
let { selection: a } = n, { empty: o, ranges: s } = a, c = N(e, r.schema);
|
|
1191
1203
|
if (i) {
|
|
1192
1204
|
if (o) {
|
|
1193
1205
|
let e = Tt(r, c);
|
|
@@ -1210,17 +1222,17 @@ var gn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1210
1222
|
}
|
|
1211
1223
|
return hn(r, n, c);
|
|
1212
1224
|
}, _n = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), vn = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
|
|
1213
|
-
let a =
|
|
1214
|
-
return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) =>
|
|
1225
|
+
let a = A(e, n.schema), o;
|
|
1226
|
+
return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) => v(a, {
|
|
1215
1227
|
...o,
|
|
1216
1228
|
...t
|
|
1217
|
-
})(n) ? !0 : e.clearNodes()).command(({ state: e }) =>
|
|
1229
|
+
})(n) ? !0 : e.clearNodes()).command(({ state: e }) => v(a, {
|
|
1218
1230
|
...o,
|
|
1219
1231
|
...t
|
|
1220
1232
|
})(e, r)).run() : (console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes."), !1);
|
|
1221
1233
|
}, yn = (e) => ({ tr: t, dispatch: n }) => {
|
|
1222
1234
|
if (n) {
|
|
1223
|
-
let { doc: n } = t, r = F(e, 0, n.content.size), i =
|
|
1235
|
+
let { doc: n } = t, r = F(e, 0, n.content.size), i = x.create(n, r);
|
|
1224
1236
|
t.setSelection(i);
|
|
1225
1237
|
}
|
|
1226
1238
|
return !0;
|
|
@@ -1237,13 +1249,13 @@ var gn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1237
1249
|
let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
|
|
1238
1250
|
from: e,
|
|
1239
1251
|
to: e
|
|
1240
|
-
} : e, a =
|
|
1252
|
+
} : e, a = T.atStart(n).from, o = T.atEnd(n).to, s = F(r, a, o), c = F(i, a, o), l = T.create(n, s, c);
|
|
1241
1253
|
t.setSelection(l);
|
|
1242
1254
|
}
|
|
1243
1255
|
return !0;
|
|
1244
1256
|
}, Sn = (e) => ({ state: t, dispatch: n }) => {
|
|
1245
|
-
let r =
|
|
1246
|
-
return
|
|
1257
|
+
let r = A(e, t.schema);
|
|
1258
|
+
return pe(r)(t, n);
|
|
1247
1259
|
};
|
|
1248
1260
|
function Cn(e, t) {
|
|
1249
1261
|
let n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
@@ -1254,7 +1266,7 @@ function Cn(e, t) {
|
|
|
1254
1266
|
}
|
|
1255
1267
|
var wn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: i }) => {
|
|
1256
1268
|
let { selection: o, doc: s } = t, { $from: c, $to: l } = o, u = i.extensionManager.attributes, d = J(u, c.node().type.name, c.node().attrs);
|
|
1257
|
-
if (o instanceof
|
|
1269
|
+
if (o instanceof x && o.node.isBlock) return !c.parentOffset || !a(s, c.pos) ? !1 : (r && (e && Cn(n, i.extensionManager.splittableMarks), t.split(c.pos).scrollIntoView()), !0);
|
|
1258
1270
|
if (!c.parent.isBlock) return !1;
|
|
1259
1271
|
let f = l.parentOffset === l.parent.content.size, p = c.depth === 0 ? void 0 : Ze(c.node(-1).contentMatchAt(c.indexAfter(-1))), m = f && p ? [{
|
|
1260
1272
|
type: p,
|
|
@@ -1264,7 +1276,7 @@ var wn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
1264
1276
|
type: p,
|
|
1265
1277
|
attrs: d
|
|
1266
1278
|
}] : void 0), r) {
|
|
1267
|
-
if (h && (o instanceof
|
|
1279
|
+
if (h && (o instanceof T && t.deleteSelection(), t.split(t.mapping.map(c.pos), 1, m), p && !f && !c.parentOffset && c.parent.type !== p)) {
|
|
1268
1280
|
let e = t.mapping.map(c.before()), n = t.doc.resolve(e);
|
|
1269
1281
|
c.node(-1).canReplaceWith(n.index(), n.index() + 1, p) && t.setNodeMarkup(t.mapping.map(c.before()), p);
|
|
1270
1282
|
}
|
|
@@ -1272,7 +1284,7 @@ var wn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
1272
1284
|
}
|
|
1273
1285
|
return h;
|
|
1274
1286
|
}, Tn = (e, t = {}) => ({ tr: n, state: r, dispatch: i, editor: o }) => {
|
|
1275
|
-
let s =
|
|
1287
|
+
let s = A(e, r.schema), { $from: c, $to: l } = r.selection, u = r.selection.node;
|
|
1276
1288
|
if (u && u.isBlock || c.depth < 2 || !c.sameParent(l)) return !1;
|
|
1277
1289
|
let d = c.node(-1);
|
|
1278
1290
|
if (d.type !== s) return !1;
|
|
@@ -1280,20 +1292,20 @@ var wn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
1280
1292
|
if (c.parent.content.size === 0 && c.node(-1).childCount === c.indexAfter(-1)) {
|
|
1281
1293
|
if (c.depth === 2 || c.node(-3).type !== s || c.index(-2) !== c.node(-2).childCount - 1) return !1;
|
|
1282
1294
|
if (i) {
|
|
1283
|
-
let e =
|
|
1284
|
-
for (let t = c.depth - r; t >= c.depth - 3; --t) e =
|
|
1295
|
+
let e = E.empty, r = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
|
|
1296
|
+
for (let t = c.depth - r; t >= c.depth - 3; --t) e = E.from(c.node(t).copy(e));
|
|
1285
1297
|
let i = c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3, a = {
|
|
1286
1298
|
...J(f, c.node().type.name, c.node().attrs),
|
|
1287
1299
|
...t
|
|
1288
1300
|
}, o = s.contentMatch.defaultType?.createAndFill(a) || void 0;
|
|
1289
|
-
e = e.append(
|
|
1301
|
+
e = e.append(E.from(s.createAndFill(null, o) || void 0));
|
|
1290
1302
|
let l = c.before(c.depth - (r - 1));
|
|
1291
|
-
n.replace(l, c.after(-i), new
|
|
1303
|
+
n.replace(l, c.after(-i), new de(e, 4 - r, 0));
|
|
1292
1304
|
let u = -1;
|
|
1293
1305
|
n.doc.nodesBetween(l, n.doc.content.size, (e, t) => {
|
|
1294
1306
|
if (u > -1) return !1;
|
|
1295
1307
|
e.isTextblock && e.content.size === 0 && (u = t + 1);
|
|
1296
|
-
}), u > -1 && n.setSelection(
|
|
1308
|
+
}), u > -1 && n.setSelection(T.near(n.doc.resolve(u))), n.scrollIntoView();
|
|
1297
1309
|
}
|
|
1298
1310
|
return !0;
|
|
1299
1311
|
}
|
|
@@ -1349,38 +1361,38 @@ function An(e) {
|
|
|
1349
1361
|
let t = e.doc, n = t.firstChild;
|
|
1350
1362
|
if (!n) return null;
|
|
1351
1363
|
let r = t.resolve(1), i = t.resolve(n.nodeSize - 1);
|
|
1352
|
-
return
|
|
1364
|
+
return T.between(r, i);
|
|
1353
1365
|
}
|
|
1354
1366
|
var jn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain: c, commands: l, can: u }) => {
|
|
1355
|
-
let { extensions: d, splittableMarks: f } = i.extensionManager, p =
|
|
1356
|
-
if (!
|
|
1357
|
-
let
|
|
1358
|
-
node:
|
|
1367
|
+
let { extensions: d, splittableMarks: f } = i.extensionManager, p = A(e, o.schema), m = A(t, o.schema), { selection: h, storedMarks: g } = o, { $from: ee, $to: te } = h, ne = ee.blockRange(te), re = g || h.$to.parentOffset && h.$from.marks();
|
|
1368
|
+
if (!ne) return !1;
|
|
1369
|
+
let ie = V((e) => cn(e.type.name, d))(h), ae = h.from === 0 && h.to === o.doc.content.size, oe = o.doc.content.content, _ = oe.length === 1 ? oe[0] : null, v = ae && _ && cn(_.type.name, d) ? {
|
|
1370
|
+
node: _,
|
|
1359
1371
|
pos: 0,
|
|
1360
1372
|
depth: 0
|
|
1361
|
-
} : null,
|
|
1362
|
-
if ((
|
|
1363
|
-
if (
|
|
1373
|
+
} : null, y = ie ?? v, se = !!ie && ne.depth >= 1 && ne.depth - ie.depth <= 1, b = !!v;
|
|
1374
|
+
if ((se || b) && y) {
|
|
1375
|
+
if (y.node.type === p) return ae && b ? c().command(({ tr: e, dispatch: t }) => {
|
|
1364
1376
|
let n = An(e);
|
|
1365
1377
|
return n ? (e.setSelection(n), t && t(e), !0) : !1;
|
|
1366
1378
|
}).liftListItem(m).run() : l.liftListItem(m);
|
|
1367
|
-
if (cn(
|
|
1379
|
+
if (cn(y.node.type.name, d) && p.validContent(y.node.content)) return c().command(() => (a.setNodeMarkup(y.pos, p), !0)).command(() => On(a, p)).command(() => kn(a, p)).run();
|
|
1368
1380
|
}
|
|
1369
|
-
return !n || !
|
|
1370
|
-
let e = u().wrapInList(p, r), t =
|
|
1381
|
+
return !n || !re || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() => On(a, p)).command(() => kn(a, p)).run() : c().command(() => {
|
|
1382
|
+
let e = u().wrapInList(p, r), t = re.filter((e) => f.includes(e.type.name));
|
|
1371
1383
|
return a.ensureMarks(t), e ? !0 : l.clearNodes();
|
|
1372
1384
|
}).wrapInList(p, r).command(() => On(a, p)).command(() => kn(a, p)).run();
|
|
1373
1385
|
}, Mn = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
|
|
1374
|
-
let { extendEmptyMarkRange: a = !1 } = n, o =
|
|
1386
|
+
let { extendEmptyMarkRange: a = !1 } = n, o = N(e, r.schema);
|
|
1375
1387
|
return nn(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
|
|
1376
1388
|
}, Nn = (e, t, n = {}) => ({ state: r, commands: i }) => {
|
|
1377
|
-
let a =
|
|
1389
|
+
let a = A(e, r.schema), o = A(t, r.schema), s = z(r, a, n), c;
|
|
1378
1390
|
return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), s ? i.setNode(o, c) : i.setNode(a, {
|
|
1379
1391
|
...c,
|
|
1380
1392
|
...n
|
|
1381
1393
|
});
|
|
1382
1394
|
}, Pn = (e, t = {}) => ({ state: n, commands: r }) => {
|
|
1383
|
-
let i =
|
|
1395
|
+
let i = A(e, n.schema);
|
|
1384
1396
|
return z(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
|
|
1385
1397
|
}, Fn = () => ({ state: e, dispatch: t }) => {
|
|
1386
1398
|
let n = e.plugins;
|
|
@@ -1411,10 +1423,10 @@ var jn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1411
1423
|
}
|
|
1412
1424
|
return !0;
|
|
1413
1425
|
}, Ln = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1414
|
-
let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s =
|
|
1426
|
+
let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s = N(e, r.schema), { $from: c, empty: l, ranges: u } = o;
|
|
1415
1427
|
if (!i) return !0;
|
|
1416
1428
|
if (l && a) {
|
|
1417
|
-
let { from: e, to: t } = o, r =
|
|
1429
|
+
let { from: e, to: t } = o, r = M(c, s, c.marks().find((e) => e.type === s)?.attrs);
|
|
1418
1430
|
r && (e = r.from, t = r.to), n.removeMark(e, t, s);
|
|
1419
1431
|
} else u.forEach((e) => {
|
|
1420
1432
|
n.removeMark(e.$from.pos, e.$to.pos, s);
|
|
@@ -1430,7 +1442,7 @@ var jn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1430
1442
|
}, zn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1431
1443
|
let a = null, o = null, s = B(typeof e == "string" ? e : e.name, r.schema);
|
|
1432
1444
|
if (!s) return !1;
|
|
1433
|
-
s === "node" && (a =
|
|
1445
|
+
s === "node" && (a = A(e, r.schema)), s === "mark" && (o = N(e, r.schema));
|
|
1434
1446
|
let c = !1;
|
|
1435
1447
|
return n.selection.ranges.forEach((e) => {
|
|
1436
1448
|
let s = e.$from.pos, l = e.$to.pos, u, d, f, p;
|
|
@@ -1459,15 +1471,15 @@ var jn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1459
1471
|
}));
|
|
1460
1472
|
}));
|
|
1461
1473
|
}), c;
|
|
1462
|
-
}, X = new
|
|
1474
|
+
}, X = new C("__tiptap_decorations__"), Bn = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(X, {
|
|
1463
1475
|
type: "force",
|
|
1464
1476
|
name: e
|
|
1465
1477
|
}), !0), Vn = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1466
|
-
let i =
|
|
1467
|
-
return
|
|
1478
|
+
let i = A(e, n.schema);
|
|
1479
|
+
return y(i, t)(n, r);
|
|
1468
1480
|
}, Hn = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1469
|
-
let i =
|
|
1470
|
-
return
|
|
1481
|
+
let i = A(e, n.schema);
|
|
1482
|
+
return me(i, t)(n, r);
|
|
1471
1483
|
}, Z = /* @__PURE__ */ new WeakMap();
|
|
1472
1484
|
function Un(e, t) {
|
|
1473
1485
|
Z.set(e, (Z.get(e) ?? 0) + 1);
|
|
@@ -1520,7 +1532,7 @@ function Jn(e, t) {
|
|
|
1520
1532
|
function Yn(e, t, n) {
|
|
1521
1533
|
let { decorations: r, widgetKeys: i } = Jn(t, n);
|
|
1522
1534
|
return {
|
|
1523
|
-
set:
|
|
1535
|
+
set: D.create(e, r),
|
|
1524
1536
|
widgetKeys: i
|
|
1525
1537
|
};
|
|
1526
1538
|
}
|
|
@@ -1608,7 +1620,7 @@ function ir(e, t, n, r) {
|
|
|
1608
1620
|
} });
|
|
1609
1621
|
}
|
|
1610
1622
|
function ar(e, t, n) {
|
|
1611
|
-
let r = t.decorationSetsByExtension[e] ??
|
|
1623
|
+
let r = t.decorationSetsByExtension[e] ?? D.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
|
|
1612
1624
|
return {
|
|
1613
1625
|
set: ir(r, n.mapping, n.doc, i),
|
|
1614
1626
|
widgetKeys: i
|
|
@@ -1616,7 +1628,7 @@ function ar(e, t, n) {
|
|
|
1616
1628
|
}
|
|
1617
1629
|
function or(e, t) {
|
|
1618
1630
|
let n = Object.values(t).flatMap((e) => e.find());
|
|
1619
|
-
return
|
|
1631
|
+
return D.create(e, n);
|
|
1620
1632
|
}
|
|
1621
1633
|
function sr(e) {
|
|
1622
1634
|
let t = /* @__PURE__ */ new Set();
|
|
@@ -1670,7 +1682,7 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1670
1682
|
}
|
|
1671
1683
|
createPlugin() {
|
|
1672
1684
|
let { editor: e, entries: t } = this;
|
|
1673
|
-
return new
|
|
1685
|
+
return new S({
|
|
1674
1686
|
key: X,
|
|
1675
1687
|
state: {
|
|
1676
1688
|
init: (e, n) => {
|
|
@@ -1723,7 +1735,7 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1723
1735
|
}
|
|
1724
1736
|
},
|
|
1725
1737
|
props: { decorations(e) {
|
|
1726
|
-
return X.getState(e)?.mergedDecorationSet ??
|
|
1738
|
+
return X.getState(e)?.mergedDecorationSet ?? D.empty;
|
|
1727
1739
|
} }
|
|
1728
1740
|
});
|
|
1729
1741
|
}
|
|
@@ -1732,7 +1744,7 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1732
1744
|
return a.type === "full" ? this.buildFullSet(e, t, i) : this.rebuildRanges(e, t, n, r, i, a.ranges);
|
|
1733
1745
|
}
|
|
1734
1746
|
rebuildRanges(e, t, n, r, i, a) {
|
|
1735
|
-
let o = n.decorationSetsByExtension[e] ??
|
|
1747
|
+
let o = n.decorationSetsByExtension[e] ?? D.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c = ir(o, r.mapping, r.doc, s), l = i.doc.content.size;
|
|
1736
1748
|
for (let { from: n, to: r } of a) {
|
|
1737
1749
|
let a = c.find(n, r).filter((e) => Xn({
|
|
1738
1750
|
position: e.from,
|
|
@@ -1806,7 +1818,7 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1806
1818
|
};
|
|
1807
1819
|
function fr(e, t) {
|
|
1808
1820
|
let { selection: n } = e, { $from: r } = n;
|
|
1809
|
-
if (n instanceof
|
|
1821
|
+
if (n instanceof x) {
|
|
1810
1822
|
let e = r.index();
|
|
1811
1823
|
return r.parent.canReplaceWith(e, e + 1, t);
|
|
1812
1824
|
}
|
|
@@ -1849,7 +1861,7 @@ function vr(e) {
|
|
|
1849
1861
|
function yr(e) {
|
|
1850
1862
|
return vr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
1851
1863
|
}
|
|
1852
|
-
|
|
1864
|
+
ve({}, {
|
|
1853
1865
|
createAtomBlockMarkdownSpec: () => Sr,
|
|
1854
1866
|
createBlockMarkdownSpec: () => Cr,
|
|
1855
1867
|
createInlineMarkdownSpec: () => Er,
|
|
@@ -2157,7 +2169,7 @@ var Q = class {
|
|
|
2157
2169
|
this.find = e.find, this.handler = e.handler, this.undoable = e.undoable ?? !0;
|
|
2158
2170
|
}
|
|
2159
2171
|
}, jr = (e, t) => {
|
|
2160
|
-
if (
|
|
2172
|
+
if (Fe(t)) return t.exec(e);
|
|
2161
2173
|
let n = t(e);
|
|
2162
2174
|
if (!n) return null;
|
|
2163
2175
|
let r = [n.text];
|
|
@@ -2178,13 +2190,13 @@ function Mr(e) {
|
|
|
2178
2190
|
let e = c.parentOffset - d;
|
|
2179
2191
|
if (e < 0 || c.parent.textBetween(e, c.parentOffset) !== a[0].slice(0, d)) return;
|
|
2180
2192
|
}
|
|
2181
|
-
let f = s.state.tr, p =
|
|
2193
|
+
let f = s.state.tr, p = O({
|
|
2182
2194
|
state: s.state,
|
|
2183
2195
|
transaction: f
|
|
2184
2196
|
}), m = {
|
|
2185
2197
|
from: n - (a[0].length - i.length),
|
|
2186
2198
|
to: r
|
|
2187
|
-
}, { commands: h, chain: g, can: ee } = new
|
|
2199
|
+
}, { commands: h, chain: g, can: ee } = new k({
|
|
2188
2200
|
editor: t,
|
|
2189
2201
|
state: p
|
|
2190
2202
|
});
|
|
@@ -2204,7 +2216,7 @@ function Mr(e) {
|
|
|
2204
2216
|
}), l;
|
|
2205
2217
|
}
|
|
2206
2218
|
function Nr(e) {
|
|
2207
|
-
let { editor: t, rules: n } = e, r = new
|
|
2219
|
+
let { editor: t, rules: n } = e, r = new S({
|
|
2208
2220
|
state: {
|
|
2209
2221
|
init() {
|
|
2210
2222
|
return null;
|
|
@@ -2215,7 +2227,7 @@ function Nr(e) {
|
|
|
2215
2227
|
let s = e.getMeta("applyInputRules");
|
|
2216
2228
|
return s && setTimeout(() => {
|
|
2217
2229
|
let { text: e } = s;
|
|
2218
|
-
e = typeof e == "string" ? e : At(
|
|
2230
|
+
e = typeof e == "string" ? e : At(E.from(e), a.schema);
|
|
2219
2231
|
let { from: i } = s, o = i + e.length;
|
|
2220
2232
|
Mr({
|
|
2221
2233
|
editor: t,
|
|
@@ -2327,7 +2339,7 @@ var Pr = class {
|
|
|
2327
2339
|
this.find = e.find, this.handler = e.handler;
|
|
2328
2340
|
}
|
|
2329
2341
|
}, Lr = (e, t, n) => {
|
|
2330
|
-
if (
|
|
2342
|
+
if (Fe(t)) return [...e.matchAll(t)];
|
|
2331
2343
|
let r = t(e, n);
|
|
2332
2344
|
return r ? r.map((t) => {
|
|
2333
2345
|
let n = [t.text];
|
|
@@ -2335,7 +2347,7 @@ var Pr = class {
|
|
|
2335
2347
|
}) : [];
|
|
2336
2348
|
};
|
|
2337
2349
|
function Rr(e) {
|
|
2338
|
-
let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new
|
|
2350
|
+
let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new k({
|
|
2339
2351
|
editor: t,
|
|
2340
2352
|
state: n
|
|
2341
2353
|
}), d = [];
|
|
@@ -2374,7 +2386,7 @@ function Vr(e) {
|
|
|
2374
2386
|
s = null;
|
|
2375
2387
|
}
|
|
2376
2388
|
let c = ({ state: e, from: n, to: r, rule: i, pasteEvt: a }) => {
|
|
2377
|
-
let c = e.tr, l =
|
|
2389
|
+
let c = e.tr, l = O({
|
|
2378
2390
|
state: e,
|
|
2379
2391
|
transaction: c
|
|
2380
2392
|
});
|
|
@@ -2395,7 +2407,7 @@ function Vr(e) {
|
|
|
2395
2407
|
return o = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
|
|
2396
2408
|
}
|
|
2397
2409
|
};
|
|
2398
|
-
return n.map((e) => new
|
|
2410
|
+
return n.map((e) => new S({
|
|
2399
2411
|
view(e) {
|
|
2400
2412
|
let n = (n) => {
|
|
2401
2413
|
r = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, r && (zr = t);
|
|
@@ -2430,7 +2442,7 @@ function Vr(e) {
|
|
|
2430
2442
|
if (!l && !u && !f) return;
|
|
2431
2443
|
if (f) {
|
|
2432
2444
|
let { text: t } = d;
|
|
2433
|
-
t = typeof t == "string" ? t : At(
|
|
2445
|
+
t = typeof t == "string" ? t : At(E.from(t), r.schema);
|
|
2434
2446
|
let { from: n } = d, i = n + t.length, a = Br(t);
|
|
2435
2447
|
return c({
|
|
2436
2448
|
rule: e,
|
|
@@ -2489,7 +2501,7 @@ var Hr = class {
|
|
|
2489
2501
|
...t
|
|
2490
2502
|
};
|
|
2491
2503
|
}
|
|
2492
|
-
let o =
|
|
2504
|
+
let o = ge(a);
|
|
2493
2505
|
r.push(o);
|
|
2494
2506
|
let s = H(t, "addInputRules", n);
|
|
2495
2507
|
if (sn(t, e.options.enableInputRules) && s) {
|
|
@@ -2555,7 +2567,7 @@ var Hr = class {
|
|
|
2555
2567
|
options: t.options,
|
|
2556
2568
|
storage: this.editor.extensionStorage[t.name],
|
|
2557
2569
|
editor: e,
|
|
2558
|
-
type:
|
|
2570
|
+
type: A(t.name, this.schema)
|
|
2559
2571
|
});
|
|
2560
2572
|
if (!r) return [];
|
|
2561
2573
|
let i = r();
|
|
@@ -2616,7 +2628,7 @@ var Hr = class {
|
|
|
2616
2628
|
options: t.options,
|
|
2617
2629
|
storage: this.editor.extensionStorage[t.name],
|
|
2618
2630
|
editor: e,
|
|
2619
|
-
type:
|
|
2631
|
+
type: N(t.name, this.schema)
|
|
2620
2632
|
});
|
|
2621
2633
|
return r ? [t.name, (i, a, o) => {
|
|
2622
2634
|
let s = G(i, n);
|
|
@@ -2660,7 +2672,7 @@ var Hr = class {
|
|
|
2660
2672
|
});
|
|
2661
2673
|
}
|
|
2662
2674
|
};
|
|
2663
|
-
Hr.resolve = Ut, Hr.sort = K, Hr.flatten = kt,
|
|
2675
|
+
Hr.resolve = Ut, Hr.sort = K, Hr.flatten = kt, ve({}, {
|
|
2664
2676
|
ClipboardTextSerializer: () => Ur,
|
|
2665
2677
|
Commands: () => Wr,
|
|
2666
2678
|
Delete: () => Gr,
|
|
@@ -2694,8 +2706,8 @@ var $ = class e extends Pr {
|
|
|
2694
2706
|
return { blockSeparator: void 0 };
|
|
2695
2707
|
},
|
|
2696
2708
|
addProseMirrorPlugins() {
|
|
2697
|
-
return [new
|
|
2698
|
-
key: new
|
|
2709
|
+
return [new S({
|
|
2710
|
+
key: new C("clipboardTextSerializer"),
|
|
2699
2711
|
props: { clipboardTextSerializer: () => {
|
|
2700
2712
|
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a = Kt(n), { blockSeparator: o } = this.options, s = {
|
|
2701
2713
|
...o === void 0 ? {} : { blockSeparator: o },
|
|
@@ -2711,7 +2723,7 @@ var $ = class e extends Pr {
|
|
|
2711
2723
|
}), Wr = $.create({
|
|
2712
2724
|
name: "commands",
|
|
2713
2725
|
addCommands() {
|
|
2714
|
-
return { ...
|
|
2726
|
+
return { ...ye };
|
|
2715
2727
|
}
|
|
2716
2728
|
}), Gr = $.create({
|
|
2717
2729
|
name: "delete",
|
|
@@ -2769,8 +2781,8 @@ var $ = class e extends Pr {
|
|
|
2769
2781
|
}), Kr = $.create({
|
|
2770
2782
|
name: "drop",
|
|
2771
2783
|
addProseMirrorPlugins() {
|
|
2772
|
-
return [new
|
|
2773
|
-
key: new
|
|
2784
|
+
return [new S({
|
|
2785
|
+
key: new C("tiptapDrop"),
|
|
2774
2786
|
props: { handleDrop: (e, t, n, r) => {
|
|
2775
2787
|
this.editor.emit("drop", {
|
|
2776
2788
|
editor: this.editor,
|
|
@@ -2784,16 +2796,16 @@ var $ = class e extends Pr {
|
|
|
2784
2796
|
}), qr = $.create({
|
|
2785
2797
|
name: "editable",
|
|
2786
2798
|
addProseMirrorPlugins() {
|
|
2787
|
-
return [new
|
|
2788
|
-
key: new
|
|
2799
|
+
return [new S({
|
|
2800
|
+
key: new C("editable"),
|
|
2789
2801
|
props: { editable: () => this.editor.options.editable }
|
|
2790
2802
|
})];
|
|
2791
2803
|
}
|
|
2792
|
-
}), Jr = new
|
|
2804
|
+
}), Jr = new C("focusEvents"), Yr = $.create({
|
|
2793
2805
|
name: "focusEvents",
|
|
2794
2806
|
addProseMirrorPlugins() {
|
|
2795
2807
|
let { editor: e } = this;
|
|
2796
|
-
return [new
|
|
2808
|
+
return [new S({
|
|
2797
2809
|
key: Jr,
|
|
2798
2810
|
props: { handleDOMEvents: {
|
|
2799
2811
|
focus: (t, n) => {
|
|
@@ -2815,7 +2827,7 @@ var $ = class e extends Pr {
|
|
|
2815
2827
|
let e = () => this.editor.commands.first(({ commands: e }) => [
|
|
2816
2828
|
() => e.undoInputRule(),
|
|
2817
2829
|
() => e.command(({ tr: t }) => {
|
|
2818
|
-
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 :
|
|
2830
|
+
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 : w.atStart(r).from === o;
|
|
2819
2831
|
return !i || !s.type.isTextblock || s.textContent.length || !d || d && a.parent.type.name === "paragraph" ? !1 : e.clearNodes();
|
|
2820
2832
|
}),
|
|
2821
2833
|
() => e.deleteSelection(),
|
|
@@ -2854,18 +2866,18 @@ var $ = class e extends Pr {
|
|
|
2854
2866
|
return I() || st() ? i : r;
|
|
2855
2867
|
},
|
|
2856
2868
|
addProseMirrorPlugins() {
|
|
2857
|
-
return [new
|
|
2858
|
-
key: new
|
|
2869
|
+
return [new S({
|
|
2870
|
+
key: new C("clearDocument"),
|
|
2859
2871
|
appendTransaction: (e, t, n) => {
|
|
2860
2872
|
if (e.some((e) => e.getMeta("composition"))) return;
|
|
2861
2873
|
let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = e.some((e) => e.getMeta("preventClearDocument"));
|
|
2862
2874
|
if (!r || i) return;
|
|
2863
|
-
let { empty: a, from: o, to: s } = t.selection, c =
|
|
2875
|
+
let { empty: a, from: o, to: s } = t.selection, c = w.atStart(t.doc).from, l = w.atEnd(t.doc).to;
|
|
2864
2876
|
if (a || o !== c || s !== l || !Y(n.doc)) return;
|
|
2865
|
-
let u = n.tr, d =
|
|
2877
|
+
let u = n.tr, d = O({
|
|
2866
2878
|
state: n,
|
|
2867
2879
|
transaction: u
|
|
2868
|
-
}), { commands: f } = new
|
|
2880
|
+
}), { commands: f } = new k({
|
|
2869
2881
|
editor: this.editor,
|
|
2870
2882
|
state: d
|
|
2871
2883
|
});
|
|
@@ -2876,8 +2888,8 @@ var $ = class e extends Pr {
|
|
|
2876
2888
|
}), Zr = $.create({
|
|
2877
2889
|
name: "paste",
|
|
2878
2890
|
addProseMirrorPlugins() {
|
|
2879
|
-
return [new
|
|
2880
|
-
key: new
|
|
2891
|
+
return [new S({
|
|
2892
|
+
key: new C("tiptapPaste"),
|
|
2881
2893
|
props: { handlePaste: (e, t, n) => {
|
|
2882
2894
|
this.editor.emit("paste", {
|
|
2883
2895
|
editor: this.editor,
|
|
@@ -2893,8 +2905,8 @@ var $ = class e extends Pr {
|
|
|
2893
2905
|
return { value: void 0 };
|
|
2894
2906
|
},
|
|
2895
2907
|
addProseMirrorPlugins() {
|
|
2896
|
-
return [new
|
|
2897
|
-
key: new
|
|
2908
|
+
return [new S({
|
|
2909
|
+
key: new C("tabindex"),
|
|
2898
2910
|
props: { attributes: () => !this.editor.isEditable && this.options.value === void 0 ? {} : { tabindex: this.options.value ?? "0" } }
|
|
2899
2911
|
})];
|
|
2900
2912
|
}
|
|
@@ -2919,8 +2931,8 @@ var $ = class e extends Pr {
|
|
|
2919
2931
|
}];
|
|
2920
2932
|
},
|
|
2921
2933
|
addProseMirrorPlugins() {
|
|
2922
|
-
return [new
|
|
2923
|
-
key: new
|
|
2934
|
+
return [new S({
|
|
2935
|
+
key: new C("textDirection"),
|
|
2924
2936
|
props: { attributes: () => {
|
|
2925
2937
|
let e = this.options.direction;
|
|
2926
2938
|
return e ? { dir: e } : {};
|
|
@@ -2940,7 +2952,7 @@ function ti(e) {
|
|
|
2940
2952
|
} catch {
|
|
2941
2953
|
return;
|
|
2942
2954
|
}
|
|
2943
|
-
t instanceof
|
|
2955
|
+
t instanceof E || 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.");
|
|
2944
2956
|
}
|
|
2945
2957
|
var ni = class e {
|
|
2946
2958
|
constructor(e, t, n = !1, r = null) {
|
|
@@ -3107,7 +3119,7 @@ var ni = class e {
|
|
|
3107
3119
|
let t = this.createDoc();
|
|
3108
3120
|
if (!this.editorState) {
|
|
3109
3121
|
let e = Be(t, this.options.autofocus);
|
|
3110
|
-
this.editorState =
|
|
3122
|
+
this.editorState = b.create({
|
|
3111
3123
|
doc: t,
|
|
3112
3124
|
schema: this.schema,
|
|
3113
3125
|
selection: e || void 0
|
|
@@ -3141,10 +3153,10 @@ var ni = class e {
|
|
|
3141
3153
|
return this.commandManager.commands;
|
|
3142
3154
|
}
|
|
3143
3155
|
chain() {
|
|
3144
|
-
return this.commandManager.chain();
|
|
3156
|
+
return this.commandManager ? this.commandManager.chain() : k.createFakeChain();
|
|
3145
3157
|
}
|
|
3146
3158
|
can() {
|
|
3147
|
-
return this.commandManager.can();
|
|
3159
|
+
return this.commandManager ? this.commandManager.can() : k.createFallbackCan();
|
|
3148
3160
|
}
|
|
3149
3161
|
injectCSS() {
|
|
3150
3162
|
this.options.injectCSS && typeof document < "u" && (this.css = pr(ri, this.options.injectNonce));
|
|
@@ -3222,7 +3234,7 @@ var ni = class e {
|
|
|
3222
3234
|
this.extensionManager = new Hr(e, this);
|
|
3223
3235
|
}
|
|
3224
3236
|
createCommandManager() {
|
|
3225
|
-
this.commandManager = new
|
|
3237
|
+
this.commandManager = new k({ editor: this });
|
|
3226
3238
|
}
|
|
3227
3239
|
createSchema() {
|
|
3228
3240
|
this.schema = this.extensionManager.schema;
|
|
@@ -3234,7 +3246,7 @@ var ni = class e {
|
|
|
3234
3246
|
} catch (e) {
|
|
3235
3247
|
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) throw e;
|
|
3236
3248
|
let t = Ct(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
3237
|
-
return this.editorState =
|
|
3249
|
+
return this.editorState = b.create({
|
|
3238
3250
|
doc: t,
|
|
3239
3251
|
schema: this.schema,
|
|
3240
3252
|
selection: Be(t, this.options.autofocus) || void 0
|
|
@@ -3250,7 +3262,7 @@ var ni = class e {
|
|
|
3250
3262
|
}
|
|
3251
3263
|
createView(e) {
|
|
3252
3264
|
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);
|
|
3253
|
-
this.editorView = new
|
|
3265
|
+
this.editorView = new he(e, {
|
|
3254
3266
|
...t,
|
|
3255
3267
|
attributes: {
|
|
3256
3268
|
role: "textbox",
|
|
@@ -3644,7 +3656,7 @@ var ui = (e) => "touches" in e, di = class {
|
|
|
3644
3656
|
}
|
|
3645
3657
|
let l = this.getPos();
|
|
3646
3658
|
if (typeof l != "number") return;
|
|
3647
|
-
let u =
|
|
3659
|
+
let u = x.create(n.state.doc, l), d = n.state.tr.setSelection(u);
|
|
3648
3660
|
n.dispatch(d);
|
|
3649
3661
|
}
|
|
3650
3662
|
stopEvent(e) {
|
|
@@ -3659,7 +3671,7 @@ var ui = (e) => "touches" in e, di = class {
|
|
|
3659
3671
|
"SELECT",
|
|
3660
3672
|
"TEXTAREA"
|
|
3661
3673
|
].includes(t.tagName) || t.isContentEditable) && !i && !n) return !0;
|
|
3662
|
-
let { isEditable: a } = this.editor, { isDragging: o } = this, s = !!this.node.type.spec.draggable, c =
|
|
3674
|
+
let { isEditable: a } = this.editor, { isDragging: o } = this, s = !!this.node.type.spec.draggable, c = x.isSelectable(this.node), l = e.type === "copy", u = e.type === "paste", d = e.type === "cut", f = e.type === "mousedown";
|
|
3663
3675
|
if (!s && c && n && e.target === this.dom && e.preventDefault(), s && n && !o && e.target === this.dom) return e.preventDefault(), !1;
|
|
3664
3676
|
if (s && a && !o && f) {
|
|
3665
3677
|
let e = t.closest("[data-drag-handle]");
|
|
@@ -3711,4 +3723,4 @@ function mi(e) {
|
|
|
3711
3723
|
});
|
|
3712
3724
|
}
|
|
3713
3725
|
//#endregion
|
|
3714
|
-
export { z as A, mn as B, G as C, an as D, Kt as E, ai as F, ci as H, mi as I, It as L, ln as M, un as N, on as O,
|
|
3726
|
+
export { z as A, mn as B, G as C, an as D, Kt as E, ai as F, ci as H, mi as I, It as L, ln as M, un as N, on as O, P, oi as R, en as S, Gt as T, si as U, Or as V, li as W, H as _, fi as a, $t as b, di as c, Et as d, mr as f, Zt as g, Jt as h, Fr as i, Y as j, gr as k, U as l, Ot as m, $ as n, pi as o, Dt as p, Q as r, Ir as s, ii as t, fr as u, M as v, hr as w, A as x, Qt as y, Dr as z };
|