@burdenoff/microfe-support 2026.1013.3 → 2026.1014.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node_modules/@tiptap/core/dist/index.js +734 -960
- package/dist/node_modules/@tiptap/core/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +37 -13
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +1 -1
- package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js.map +1 -0
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/react/dist/index.js +22 -22
- package/dist/node_modules/prosemirror-view/dist/index.js +14 -2
- package/dist/node_modules/prosemirror-view/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { t as e } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { DOMParser as t, DOMSerializer as n, Fragment as r, Schema as i, Slice as a } from "../../../prosemirror-model/dist/index.js";
|
|
3
|
+
import { RemoveMarkStep as o, ReplaceAroundStep as s, ReplaceStep as c, Transform as l, canJoin as u, canSplit as d, findWrapping as f, joinPoint as p, liftTarget as m } from "../../../prosemirror-transform/dist/index.js";
|
|
4
|
+
import { AllSelection as h, EditorState as g, NodeSelection as _, Plugin as v, PluginKey as y, Selection as b, TextSelection as x } from "../../../prosemirror-state/dist/index.js";
|
|
5
|
+
import { createParagraphNear as ee, exitCode as te, joinBackward as ne, joinDown as re, joinForward as S, joinTextblockBackward as ie, joinTextblockForward as ae, joinUp as oe, lift as se, liftEmptyBlock as ce, newlineInCode as le, selectNodeBackward as ue, selectNodeForward as de, selectParentNode as fe, selectTextblockEnd as pe, selectTextblockStart as me, setBlockType as he, wrapIn as ge } from "../../../prosemirror-commands/dist/index.js";
|
|
6
|
+
import { liftListItem as _e, sinkListItem as ve, wrapInList as ye } from "../../../prosemirror-schema-list/dist/index.js";
|
|
7
|
+
import { DecorationSet as C, EditorView as be } from "../../../prosemirror-view/dist/index.js";
|
|
8
|
+
import { keymap as xe } from "../../../prosemirror-keymap/dist/index.js";
|
|
8
9
|
//#region node_modules/@tiptap/core/dist/index.js
|
|
9
|
-
var xe = Object.defineProperty, Se = (e, t) => {
|
|
10
|
-
for (var n in t) xe(e, n, {
|
|
11
|
-
get: t[n],
|
|
12
|
-
enumerable: !0
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
10
|
function w(e) {
|
|
16
11
|
let { state: t, transaction: n } = e, { selection: r } = n, { doc: i } = n, { storedMarks: a } = n;
|
|
17
12
|
return {
|
|
@@ -109,82 +104,19 @@ var T = class e {
|
|
|
109
104
|
};
|
|
110
105
|
return o;
|
|
111
106
|
}
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
createParagraphNear: () => Oe,
|
|
119
|
-
cut: () => ke,
|
|
120
|
-
deleteCurrentNode: () => Ae,
|
|
121
|
-
deleteNode: () => je,
|
|
122
|
-
deleteRange: () => Me,
|
|
123
|
-
deleteSelection: () => Ie,
|
|
124
|
-
enter: () => Le,
|
|
125
|
-
exitCode: () => Re,
|
|
126
|
-
extendMarkRange: () => Ve,
|
|
127
|
-
first: () => He,
|
|
128
|
-
focus: () => Ke,
|
|
129
|
-
forEach: () => qe,
|
|
130
|
-
insertContent: () => Je,
|
|
131
|
-
insertContentAt: () => $e,
|
|
132
|
-
insertDefaultBlock: () => tt,
|
|
133
|
-
joinBackward: () => it,
|
|
134
|
-
joinDown: () => rt,
|
|
135
|
-
joinForward: () => at,
|
|
136
|
-
joinItemBackward: () => ot,
|
|
137
|
-
joinItemForward: () => st,
|
|
138
|
-
joinTextblockBackward: () => ct,
|
|
139
|
-
joinTextblockForward: () => lt,
|
|
140
|
-
joinUp: () => nt,
|
|
141
|
-
keyboardShortcut: () => ft,
|
|
142
|
-
lift: () => pt,
|
|
143
|
-
liftEmptyBlock: () => mt,
|
|
144
|
-
liftListItem: () => ht,
|
|
145
|
-
newlineInCode: () => gt,
|
|
146
|
-
resetAttributes: () => vt,
|
|
147
|
-
scrollIntoView: () => yt,
|
|
148
|
-
selectAll: () => bt,
|
|
149
|
-
selectNodeBackward: () => xt,
|
|
150
|
-
selectNodeForward: () => St,
|
|
151
|
-
selectParentNode: () => Ct,
|
|
152
|
-
selectTextblockEnd: () => wt,
|
|
153
|
-
selectTextblockStart: () => Tt,
|
|
154
|
-
setContent: () => Et,
|
|
155
|
-
setMark: () => gn,
|
|
156
|
-
setMeta: () => _n,
|
|
157
|
-
setNode: () => vn,
|
|
158
|
-
setNodeSelection: () => yn,
|
|
159
|
-
setTextDirection: () => bn,
|
|
160
|
-
setTextSelection: () => xn,
|
|
161
|
-
sinkListItem: () => Sn,
|
|
162
|
-
splitBlock: () => wn,
|
|
163
|
-
splitListItem: () => Tn,
|
|
164
|
-
toggleList: () => jn,
|
|
165
|
-
toggleMark: () => Mn,
|
|
166
|
-
toggleNode: () => Nn,
|
|
167
|
-
toggleWrap: () => Pn,
|
|
168
|
-
undoInputRule: () => Fn,
|
|
169
|
-
unsetAllMarks: () => In,
|
|
170
|
-
unsetMark: () => Ln,
|
|
171
|
-
unsetTextDirection: () => Rn,
|
|
172
|
-
updateAttributes: () => zn,
|
|
173
|
-
updateDecorations: () => Bn,
|
|
174
|
-
wrapIn: () => Vn,
|
|
175
|
-
wrapInList: () => Hn
|
|
176
|
-
});
|
|
177
|
-
var we = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
178
|
-
var n;
|
|
179
|
-
e.isDestroyed || (t.dom.blur(), (n = window == null ? void 0 : window.getSelection()) == null || n.removeAllRanges());
|
|
180
|
-
}), !0), Te = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), Ee = () => ({ state: e, tr: t, dispatch: n }) => {
|
|
107
|
+
}, Se = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
108
|
+
if (!e.isDestroyed) {
|
|
109
|
+
var n;
|
|
110
|
+
t.dom.blur(), (n = window) == null || (n = n.getSelection()) == null || n.removeAllRanges();
|
|
111
|
+
}
|
|
112
|
+
}), !0), Ce = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), we = () => ({ state: e, tr: t, dispatch: n }) => {
|
|
181
113
|
let { selection: r } = t, { ranges: i } = r;
|
|
182
114
|
return n && i.forEach(({ $from: n, $to: r }) => {
|
|
183
115
|
e.doc.nodesBetween(n.pos, r.pos, (e, n) => {
|
|
184
116
|
if (e.type.isText) return;
|
|
185
117
|
let { doc: r, mapping: i } = t, a = r.resolve(i.map(n)), o = r.resolve(i.map(n + e.nodeSize)), s = a.blockRange(o);
|
|
186
118
|
if (!s) return;
|
|
187
|
-
let c =
|
|
119
|
+
let c = m(s);
|
|
188
120
|
if (e.type.isTextblock) {
|
|
189
121
|
let { defaultType: e } = a.parent.contentMatchAt(a.index());
|
|
190
122
|
t.setNodeMarkup(s.start, e);
|
|
@@ -192,12 +124,12 @@ var we = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
|
192
124
|
(c || c === 0) && t.lift(s, c);
|
|
193
125
|
});
|
|
194
126
|
}), !0;
|
|
195
|
-
},
|
|
127
|
+
}, Te = (e) => (t) => e(t), Ee = () => ({ state: e, dispatch: t }) => ee(e, t), De = (e, t) => ({ editor: n, tr: r }) => {
|
|
196
128
|
let { state: i } = n, a = i.doc.slice(e.from, e.to);
|
|
197
129
|
r.deleteRange(e.from, e.to);
|
|
198
130
|
let o = r.mapping.map(t);
|
|
199
|
-
return r.insert(o, a.content), r.setSelection(new
|
|
200
|
-
},
|
|
131
|
+
return r.insert(o, a.content), r.setSelection(new x(r.doc.resolve(Math.max(o - 1, 0)))), !0;
|
|
132
|
+
}, Oe = () => ({ tr: e, dispatch: t }) => {
|
|
201
133
|
let { selection: n } = e, r = n.$anchor.node();
|
|
202
134
|
if (r.content.size > 0) return !1;
|
|
203
135
|
let i = e.selection.$anchor;
|
|
@@ -217,7 +149,7 @@ function E(e, t) {
|
|
|
217
149
|
}
|
|
218
150
|
return e;
|
|
219
151
|
}
|
|
220
|
-
var
|
|
152
|
+
var ke = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
221
153
|
let i = E(e, n.schema), a = t.selection.$anchor;
|
|
222
154
|
for (let e = a.depth; e > 0; --e) if (a.node(e).type === i) {
|
|
223
155
|
if (r) {
|
|
@@ -227,41 +159,41 @@ var je = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
|
227
159
|
return !0;
|
|
228
160
|
}
|
|
229
161
|
return !1;
|
|
230
|
-
},
|
|
162
|
+
}, Ae = (e) => ({ tr: t, dispatch: n }) => {
|
|
231
163
|
let { from: r, to: i } = e;
|
|
232
164
|
return n && t.delete(r, i), !0;
|
|
233
|
-
},
|
|
165
|
+
}, je = (e) => e.content ? /^text(\*|\+)/.test(e.content) : !1, Me = (e, t, n) => {
|
|
234
166
|
if (!e.parent.isInline || n === "left" && e.pos > e.start() || n === "right" && e.pos < e.end()) return e.pos;
|
|
235
167
|
let r = t.nodes[e.parent.type.name].spec;
|
|
236
|
-
return
|
|
237
|
-
},
|
|
238
|
-
from:
|
|
239
|
-
to:
|
|
240
|
-
}),
|
|
168
|
+
return je(r) ? n === "left" ? e.start() - 1 : e.end() + 1 : e.pos;
|
|
169
|
+
}, Ne = (e, t, n) => ({
|
|
170
|
+
from: Me(e, n, "left"),
|
|
171
|
+
to: Me(t, n, "right")
|
|
172
|
+
}), Pe = () => ({ state: e, dispatch: t }) => {
|
|
241
173
|
if (e.selection.empty) return !1;
|
|
242
174
|
if (t) {
|
|
243
175
|
let n = e.tr, { ranges: r } = e.selection, i = n.steps.length;
|
|
244
176
|
r.forEach((t) => {
|
|
245
|
-
let r = n.mapping.slice(i), { from: a, to: o } =
|
|
177
|
+
let r = n.mapping.slice(i), { from: a, to: o } = Ne(n.doc.resolve(r.map(t.$from.pos)), n.doc.resolve(r.map(t.$to.pos)), e.schema);
|
|
246
178
|
n.deleteRange(a, o);
|
|
247
|
-
}), n.selection.empty || n.setSelection(
|
|
179
|
+
}), n.selection.empty || n.setSelection(x.near(n.doc.resolve(n.selection.from))), n.scrollIntoView(), t(n);
|
|
248
180
|
}
|
|
249
181
|
return !0;
|
|
250
|
-
},
|
|
251
|
-
function
|
|
182
|
+
}, Fe = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Ie = () => ({ state: e, dispatch: t }) => te(e, t);
|
|
183
|
+
function Le(e) {
|
|
252
184
|
return Object.prototype.toString.call(e) === "[object RegExp]";
|
|
253
185
|
}
|
|
254
|
-
function
|
|
186
|
+
function D(e, t, n = { strict: !0 }) {
|
|
255
187
|
let r = Object.keys(t);
|
|
256
|
-
return !r.length || r.every((r) => n.strict ? t[r] === e[r] :
|
|
188
|
+
return !r.length || r.every((r) => n.strict ? t[r] === e[r] : Le(t[r]) ? t[r].test(e[r]) : t[r] === e[r]);
|
|
257
189
|
}
|
|
258
|
-
function
|
|
259
|
-
return e.find((e) => e.type === t &&
|
|
190
|
+
function Re(e, t, n = {}) {
|
|
191
|
+
return e.find((e) => e.type === t && D(Object.fromEntries(Object.keys(n).map((t) => [t, e.attrs[t]])), n));
|
|
260
192
|
}
|
|
261
|
-
function
|
|
262
|
-
return !!
|
|
193
|
+
function ze(e, t, n = {}) {
|
|
194
|
+
return !!Re(e, t, n);
|
|
263
195
|
}
|
|
264
|
-
function
|
|
196
|
+
function O(e, t, n) {
|
|
265
197
|
if (!e || !t) return;
|
|
266
198
|
let r = e.parent.childAfter(e.parentOffset);
|
|
267
199
|
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;
|
|
@@ -269,55 +201,55 @@ function k(e, t, n) {
|
|
|
269
201
|
let e = r.node.marks.find((e) => e.type === t);
|
|
270
202
|
e && (n = e.attrs);
|
|
271
203
|
}
|
|
272
|
-
if (!
|
|
204
|
+
if (!Re([...r.node.marks], t, n)) return;
|
|
273
205
|
let i = r.index, a = e.start() + r.offset, o = i + 1, s = a + r.node.nodeSize;
|
|
274
|
-
for (; i > 0 &&
|
|
275
|
-
for (; o < e.parent.childCount &&
|
|
206
|
+
for (; i > 0 && ze([...e.parent.child(i - 1).marks], t, n);) --i, a -= e.parent.child(i).nodeSize;
|
|
207
|
+
for (; o < e.parent.childCount && ze([...e.parent.child(o).marks], t, n);) s += e.parent.child(o).nodeSize, o += 1;
|
|
276
208
|
return {
|
|
277
209
|
from: a,
|
|
278
210
|
to: s
|
|
279
211
|
};
|
|
280
212
|
}
|
|
281
|
-
function
|
|
213
|
+
function k(e, t) {
|
|
282
214
|
if (typeof e == "string") {
|
|
283
215
|
if (!t.marks[e]) throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
|
|
284
216
|
return t.marks[e];
|
|
285
217
|
}
|
|
286
218
|
return e;
|
|
287
219
|
}
|
|
288
|
-
var
|
|
289
|
-
let a =
|
|
220
|
+
var Be = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
221
|
+
let a = k(e, r.schema), { doc: o, selection: s } = n, { $from: c, from: l, to: u } = s;
|
|
290
222
|
if (i) {
|
|
291
|
-
let e =
|
|
223
|
+
let e = O(c, a, t);
|
|
292
224
|
if (e && e.from <= l && e.to >= u) {
|
|
293
|
-
let t =
|
|
225
|
+
let t = x.create(o, e.from, e.to);
|
|
294
226
|
n.setSelection(t);
|
|
295
227
|
}
|
|
296
228
|
}
|
|
297
229
|
return !0;
|
|
298
|
-
},
|
|
230
|
+
}, Ve = (e) => (t) => {
|
|
299
231
|
let n = typeof e == "function" ? e(t) : e;
|
|
300
232
|
for (let e = 0; e < n.length; e += 1) if (n[e](t)) return !0;
|
|
301
233
|
return !1;
|
|
302
234
|
};
|
|
303
|
-
function
|
|
304
|
-
return e instanceof
|
|
235
|
+
function He(e) {
|
|
236
|
+
return e instanceof x;
|
|
305
237
|
}
|
|
306
|
-
function
|
|
238
|
+
function A(e = 0, t = 0, n = 0) {
|
|
307
239
|
return Math.min(Math.max(e, t), n);
|
|
308
240
|
}
|
|
309
|
-
function
|
|
241
|
+
function j(e, t = null) {
|
|
310
242
|
if (!t) return null;
|
|
311
|
-
let n =
|
|
243
|
+
let n = b.atStart(e), r = b.atEnd(e);
|
|
312
244
|
if (t === "start" || t === !0) return n;
|
|
313
245
|
if (t === "end") return r;
|
|
314
246
|
let i = n.from, a = r.to;
|
|
315
|
-
return t === "all" ?
|
|
247
|
+
return t === "all" ? x.create(e, A(0, i, a), A(e.content.size, i, a)) : x.create(e, A(t, i, a), A(t, i, a));
|
|
316
248
|
}
|
|
317
|
-
function
|
|
249
|
+
function Ue() {
|
|
318
250
|
return ["Android"].includes(navigator.platform) || /android/i.test(navigator.userAgent);
|
|
319
251
|
}
|
|
320
|
-
function
|
|
252
|
+
function M() {
|
|
321
253
|
return [
|
|
322
254
|
"iPad Simulator",
|
|
323
255
|
"iPhone Simulator",
|
|
@@ -327,16 +259,16 @@ function N() {
|
|
|
327
259
|
"iPod"
|
|
328
260
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
329
261
|
}
|
|
330
|
-
function
|
|
262
|
+
function We() {
|
|
331
263
|
return typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
332
264
|
}
|
|
333
|
-
var
|
|
265
|
+
var Ge = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
|
|
334
266
|
t = {
|
|
335
267
|
scrollIntoView: !0,
|
|
336
268
|
...t
|
|
337
269
|
};
|
|
338
270
|
let o = () => {
|
|
339
|
-
(
|
|
271
|
+
(M() || Ue()) && r.dom.focus(), We() && !M() && !Ue() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
|
|
340
272
|
n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
|
|
341
273
|
});
|
|
342
274
|
};
|
|
@@ -345,90 +277,90 @@ var Ke = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
|
|
|
345
277
|
} catch {
|
|
346
278
|
return !1;
|
|
347
279
|
}
|
|
348
|
-
if (a && e === null && !
|
|
349
|
-
let s =
|
|
280
|
+
if (a && e === null && !He(n.state.selection)) return o(), !0;
|
|
281
|
+
let s = j(i.doc, e) || n.state.selection, c = n.state.selection.eq(s);
|
|
350
282
|
return a && (c || i.setSelection(s), c && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
|
|
351
|
-
},
|
|
283
|
+
}, Ke = (e, t) => (n) => e.every((e, r) => t(e, {
|
|
352
284
|
...n,
|
|
353
285
|
index: r
|
|
354
|
-
})),
|
|
286
|
+
})), qe = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({
|
|
355
287
|
from: n.selection.from,
|
|
356
288
|
to: n.selection.to
|
|
357
|
-
}, e, t),
|
|
289
|
+
}, e, t), Je = (e) => {
|
|
358
290
|
let t = e.childNodes;
|
|
359
291
|
for (let n = t.length - 1; n >= 0; --n) {
|
|
360
292
|
let r = t[n];
|
|
361
|
-
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 &&
|
|
293
|
+
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Je(r);
|
|
362
294
|
}
|
|
363
295
|
return e;
|
|
364
296
|
};
|
|
365
|
-
function
|
|
297
|
+
function N(e) {
|
|
366
298
|
if (typeof window > "u") throw Error("[tiptap error]: there is no window object available, so this function cannot be used");
|
|
367
299
|
let t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
|
|
368
|
-
return
|
|
300
|
+
return Je(n);
|
|
369
301
|
}
|
|
370
|
-
function
|
|
302
|
+
function Ye(e) {
|
|
371
303
|
return typeof e?.nodesBetween == "function";
|
|
372
304
|
}
|
|
373
|
-
function
|
|
374
|
-
if (
|
|
375
|
-
let o = typeof
|
|
305
|
+
function P(e, n, a) {
|
|
306
|
+
if (Ye(e)) return e;
|
|
307
|
+
let o = typeof e == "object" && !!e;
|
|
376
308
|
a = {
|
|
377
309
|
slice: !0,
|
|
378
310
|
parseOptions: {},
|
|
379
311
|
...a
|
|
380
312
|
};
|
|
381
|
-
let s = typeof
|
|
313
|
+
let s = typeof e == "string";
|
|
382
314
|
if (o) try {
|
|
383
|
-
if (Array.isArray(
|
|
384
|
-
let
|
|
385
|
-
return a.errorOnInvalidContent &&
|
|
386
|
-
} catch (
|
|
387
|
-
if (a.errorOnInvalidContent) throw Error("[tiptap error]: Invalid JSON content", { cause:
|
|
388
|
-
return console.warn("[tiptap warn]: Invalid content.", "Passed value:",
|
|
315
|
+
if (Array.isArray(e) && e.length > 0) return r.fromArray(e.map((e) => n.nodeFromJSON(e)));
|
|
316
|
+
let t = n.nodeFromJSON(e);
|
|
317
|
+
return a.errorOnInvalidContent && t.check(), t;
|
|
318
|
+
} catch (t) {
|
|
319
|
+
if (a.errorOnInvalidContent) throw Error("[tiptap error]: Invalid JSON content", { cause: t });
|
|
320
|
+
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", t), P("", n, a);
|
|
389
321
|
}
|
|
390
322
|
if (s) {
|
|
391
323
|
if (a.errorOnInvalidContent) {
|
|
392
|
-
let
|
|
393
|
-
topNode:
|
|
394
|
-
marks:
|
|
395
|
-
nodes:
|
|
324
|
+
let r = !1, o = "", s = new i({
|
|
325
|
+
topNode: n.spec.topNode,
|
|
326
|
+
marks: n.spec.marks,
|
|
327
|
+
nodes: n.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {
|
|
396
328
|
content: "inline*",
|
|
397
329
|
group: "block",
|
|
398
330
|
parseDOM: [{
|
|
399
331
|
tag: "*",
|
|
400
|
-
getAttrs: (e) => (
|
|
332
|
+
getAttrs: (e) => (r = !0, o = typeof e == "string" ? e : e.outerHTML, null)
|
|
401
333
|
}]
|
|
402
334
|
} })
|
|
403
335
|
});
|
|
404
|
-
if (a.slice ?
|
|
336
|
+
if (a.slice ? t.fromSchema(s).parseSlice(N(e), a.parseOptions) : t.fromSchema(s).parse(N(e), a.parseOptions), a.errorOnInvalidContent && r) throw Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ Error(`Invalid element found: ${o}`) });
|
|
405
337
|
}
|
|
406
|
-
let
|
|
407
|
-
return a.slice ?
|
|
338
|
+
let r = t.fromSchema(n);
|
|
339
|
+
return a.slice ? r.parseSlice(N(e), a.parseOptions).content : r.parse(N(e), a.parseOptions);
|
|
408
340
|
}
|
|
409
|
-
return
|
|
341
|
+
return P("", n, a);
|
|
410
342
|
}
|
|
411
|
-
function
|
|
343
|
+
function Xe(e) {
|
|
412
344
|
return !("type" in e);
|
|
413
345
|
}
|
|
414
|
-
function
|
|
346
|
+
function Ze(e, t, n) {
|
|
415
347
|
let r = e.steps.length - 1;
|
|
416
348
|
if (r < t) return;
|
|
417
349
|
let i = e.steps[r];
|
|
418
|
-
if (!(i instanceof
|
|
419
|
-
let a = e.mapping.maps[r],
|
|
350
|
+
if (!(i instanceof c || i instanceof s)) return;
|
|
351
|
+
let a = e.mapping.maps[r], o = 0;
|
|
420
352
|
a.forEach((e, t, n, r) => {
|
|
421
|
-
|
|
422
|
-
}), e.setSelection(
|
|
353
|
+
o === 0 && (o = r);
|
|
354
|
+
}), e.setSelection(b.near(e.doc.resolve(o), n));
|
|
423
355
|
}
|
|
424
|
-
var
|
|
356
|
+
var Qe = (e, t, n) => ({ tr: i, dispatch: a, editor: o }) => {
|
|
425
357
|
if (a) {
|
|
426
|
-
|
|
358
|
+
n = {
|
|
427
359
|
parseOptions: o.options.parseOptions,
|
|
428
360
|
updateSelection: !0,
|
|
429
361
|
applyInputRules: !1,
|
|
430
362
|
applyPasteRules: !1,
|
|
431
|
-
...
|
|
363
|
+
...n
|
|
432
364
|
};
|
|
433
365
|
let a, s = (e) => {
|
|
434
366
|
o.emit("contentError", {
|
|
@@ -440,10 +372,10 @@ var $e = (e, t, r) => ({ tr: i, dispatch: a, editor: o }) => {
|
|
|
440
372
|
});
|
|
441
373
|
}, c = {
|
|
442
374
|
preserveWhitespace: "full",
|
|
443
|
-
...
|
|
375
|
+
...n.parseOptions
|
|
444
376
|
};
|
|
445
|
-
if (!
|
|
446
|
-
|
|
377
|
+
if (!n.errorOnInvalidContent && !o.options.enableContentCheck && o.options.emitContentError) try {
|
|
378
|
+
P(t, o.schema, {
|
|
447
379
|
parseOptions: c,
|
|
448
380
|
errorOnInvalidContent: !0
|
|
449
381
|
});
|
|
@@ -451,9 +383,9 @@ var $e = (e, t, r) => ({ tr: i, dispatch: a, editor: o }) => {
|
|
|
451
383
|
s(e);
|
|
452
384
|
}
|
|
453
385
|
try {
|
|
454
|
-
a =
|
|
386
|
+
a = P(t, o.schema, {
|
|
455
387
|
parseOptions: c,
|
|
456
|
-
errorOnInvalidContent:
|
|
388
|
+
errorOnInvalidContent: n.errorOnInvalidContent ?? o.options.enableContentCheck
|
|
457
389
|
});
|
|
458
390
|
} catch (e) {
|
|
459
391
|
return s(e), !1;
|
|
@@ -464,7 +396,7 @@ var $e = (e, t, r) => ({ tr: i, dispatch: a, editor: o }) => {
|
|
|
464
396
|
} : {
|
|
465
397
|
from: e.from,
|
|
466
398
|
to: e.to
|
|
467
|
-
}, d = !0, f = !0, p =
|
|
399
|
+
}, d = !0, f = !0, p = Xe(a) ? a.content : [a];
|
|
468
400
|
if (p.forEach((e) => {
|
|
469
401
|
e.check(), d = d ? e.isText && e.marks.length === 0 : !1, f = f ? e.isBlock : !1;
|
|
470
402
|
}), l === u && f) {
|
|
@@ -472,59 +404,59 @@ var $e = (e, t, r) => ({ tr: i, dispatch: a, editor: o }) => {
|
|
|
472
404
|
e.isTextblock && !e.type.spec.code && !e.childCount && (--l, u += 1);
|
|
473
405
|
}
|
|
474
406
|
let m;
|
|
475
|
-
if (d) m = Array.isArray(t) ? t.map((e) => e.text || "").join("") :
|
|
407
|
+
if (d) m = Array.isArray(t) ? t.map((e) => e.text || "").join("") : Ye(t) ? p.map((e) => e.text ?? "").join("") : typeof t == "object" && t && t.text ? t.text : t, i.insertText(m, l, u);
|
|
476
408
|
else {
|
|
477
|
-
m =
|
|
478
|
-
let e = i.doc.resolve(l), t = e.node(),
|
|
479
|
-
|
|
409
|
+
m = r.from(p);
|
|
410
|
+
let e = i.doc.resolve(l), t = e.node(), n = e.parentOffset === 0, a = t.isText || t.isTextblock, o = t.content.size > 0;
|
|
411
|
+
n && a && o && f && (l = Math.max(0, l - 1)), i.replaceWith(l, u, p);
|
|
480
412
|
}
|
|
481
|
-
|
|
413
|
+
n.updateSelection && Ze(i, i.steps.length - 1, -1), n.applyInputRules && i.setMeta("applyInputRules", {
|
|
482
414
|
from: l,
|
|
483
415
|
text: m
|
|
484
|
-
}),
|
|
416
|
+
}), n.applyPasteRules && i.setMeta("applyPasteRules", {
|
|
485
417
|
from: l,
|
|
486
418
|
text: m
|
|
487
419
|
});
|
|
488
420
|
}
|
|
489
421
|
return !0;
|
|
490
422
|
};
|
|
491
|
-
function
|
|
423
|
+
function $e(e) {
|
|
492
424
|
for (let t = 0; t < e.edgeCount; t += 1) {
|
|
493
425
|
let { type: n } = e.edge(t);
|
|
494
426
|
if (n.isTextblock && !n.hasRequiredAttrs()) return n;
|
|
495
427
|
}
|
|
496
428
|
return null;
|
|
497
429
|
}
|
|
498
|
-
var
|
|
430
|
+
var et = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
|
|
499
431
|
let { pos: i, attrs: a, content: o, updateSelection: s = !0 } = e, c;
|
|
500
432
|
c = typeof i == "number" ? t.doc.resolve(i) : i || t.selection.$from;
|
|
501
|
-
let l =
|
|
433
|
+
let l = $e(c.parent.contentMatchAt(c.index()));
|
|
502
434
|
if (!l) return !1;
|
|
503
435
|
let u = Object.keys(l.spec.attrs || {}), d = a ? Object.fromEntries(Object.entries(a).filter(([e]) => u.includes(e))) : {}, f;
|
|
504
436
|
if (o) {
|
|
505
|
-
let e =
|
|
437
|
+
let e = P(o, r.schema);
|
|
506
438
|
f = l.createAndFill(d, e);
|
|
507
439
|
} else f = l.createAndFill(d);
|
|
508
|
-
return f ? (n && (t.insert(c.pos, f), s &&
|
|
509
|
-
},
|
|
440
|
+
return f ? (n && (t.insert(c.pos, f), s && Ze(t, t.steps.length - 1, -1)), !0) : !1;
|
|
441
|
+
}, tt = () => ({ state: e, dispatch: t }) => oe(e, t), nt = () => ({ state: e, dispatch: t }) => re(e, t), rt = () => ({ state: e, dispatch: t }) => ne(e, t), it = () => ({ state: e, dispatch: t }) => S(e, t), at = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
510
442
|
try {
|
|
511
|
-
let r =
|
|
443
|
+
let r = p(e.doc, e.selection.$from.pos, -1);
|
|
512
444
|
return r != null && (n.join(r, 2), t && t(n), !0);
|
|
513
445
|
} catch {
|
|
514
446
|
return !1;
|
|
515
447
|
}
|
|
516
|
-
},
|
|
448
|
+
}, ot = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
517
449
|
try {
|
|
518
|
-
let r =
|
|
450
|
+
let r = p(e.doc, e.selection.$from.pos, 1);
|
|
519
451
|
return r != null && (n.join(r, 2), t && t(n), !0);
|
|
520
452
|
} catch {
|
|
521
453
|
return !1;
|
|
522
454
|
}
|
|
523
|
-
},
|
|
524
|
-
function
|
|
455
|
+
}, st = () => ({ state: e, dispatch: t }) => ie(e, t), ct = () => ({ state: e, dispatch: t }) => ae(e, t);
|
|
456
|
+
function lt() {
|
|
525
457
|
return typeof navigator < "u" && /Mac/.test(navigator.platform);
|
|
526
458
|
}
|
|
527
|
-
function
|
|
459
|
+
function ut(e) {
|
|
528
460
|
let t = e.split(/-(?!$)/), n = t[t.length - 1];
|
|
529
461
|
n === "Space" && (n = " ");
|
|
530
462
|
let r, i, a, o;
|
|
@@ -534,13 +466,13 @@ function dt(e) {
|
|
|
534
466
|
else if (/^a(lt)?$/i.test(n)) r = !0;
|
|
535
467
|
else if (/^(c|ctrl|control)$/i.test(n)) i = !0;
|
|
536
468
|
else if (/^s(hift)?$/i.test(n)) a = !0;
|
|
537
|
-
else if (/^mod$/i.test(n))
|
|
469
|
+
else if (/^mod$/i.test(n)) M() || lt() ? o = !0 : i = !0;
|
|
538
470
|
else throw Error(`Unrecognized modifier name: ${n}`);
|
|
539
471
|
}
|
|
540
472
|
return r && (n = `Alt-${n}`), i && (n = `Ctrl-${n}`), o && (n = `Meta-${n}`), a && (n = `Shift-${n}`), n;
|
|
541
473
|
}
|
|
542
|
-
var
|
|
543
|
-
let a =
|
|
474
|
+
var dt = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
|
|
475
|
+
let a = ut(e).split(/-(?!$)/), o = a.find((e) => ![
|
|
544
476
|
"Alt",
|
|
545
477
|
"Ctrl",
|
|
546
478
|
"Meta",
|
|
@@ -561,7 +493,7 @@ var ft = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
|
|
|
561
493
|
t && i && r.maybeStep(t);
|
|
562
494
|
}), !0;
|
|
563
495
|
};
|
|
564
|
-
function
|
|
496
|
+
function F(e, t, n = {}) {
|
|
565
497
|
let { from: r, to: i, empty: a } = e.selection, o = t ? E(t, e.schema) : null, s = [];
|
|
566
498
|
e.doc.nodesBetween(r, i, (e, t) => {
|
|
567
499
|
if (e.isText) return;
|
|
@@ -572,52 +504,52 @@ function I(e, t, n = {}) {
|
|
|
572
504
|
to: a
|
|
573
505
|
});
|
|
574
506
|
});
|
|
575
|
-
let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) =>
|
|
507
|
+
let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) => D(e.node.attrs, n, { strict: !1 }));
|
|
576
508
|
return a ? !!l.length : l.reduce((e, t) => e + t.to - t.from, 0) >= c;
|
|
577
509
|
}
|
|
578
|
-
var
|
|
510
|
+
var ft = (e, t = {}) => ({ state: n, dispatch: r }) => F(n, E(e, n.schema), t) ? se(n, r) : !1, pt = () => ({ state: e, dispatch: t }) => ce(e, t), mt = (e) => ({ state: t, dispatch: n }) => {
|
|
579
511
|
let r = E(e, t.schema);
|
|
580
|
-
return
|
|
581
|
-
},
|
|
582
|
-
function
|
|
512
|
+
return _e(r)(t, n);
|
|
513
|
+
}, ht = () => ({ state: e, dispatch: t }) => le(e, t);
|
|
514
|
+
function I(e, t) {
|
|
583
515
|
return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
|
|
584
516
|
}
|
|
585
|
-
function
|
|
517
|
+
function gt(e, t) {
|
|
586
518
|
let n = typeof t == "string" ? [t] : t;
|
|
587
519
|
return Object.keys(e).reduce((t, r) => (n.includes(r) || (t[r] = e[r]), t), {});
|
|
588
520
|
}
|
|
589
|
-
var
|
|
590
|
-
let a = null, o = null, s =
|
|
521
|
+
var _t = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
522
|
+
let a = null, o = null, s = I(typeof e == "string" ? e : e.name, r.schema);
|
|
591
523
|
if (!s) return !1;
|
|
592
|
-
s === "node" && (a = E(e, r.schema)), s === "mark" && (o =
|
|
524
|
+
s === "node" && (a = E(e, r.schema)), s === "mark" && (o = k(e, r.schema));
|
|
593
525
|
let c = !1;
|
|
594
526
|
return n.selection.ranges.forEach((e) => {
|
|
595
527
|
r.doc.nodesBetween(e.$from.pos, e.$to.pos, (e, r) => {
|
|
596
|
-
a && a === e.type && (c = !0, i && n.setNodeMarkup(r, void 0,
|
|
597
|
-
o === a.type && (c = !0, i && n.addMark(r, r + e.nodeSize, o.create(
|
|
528
|
+
a && a === e.type && (c = !0, i && n.setNodeMarkup(r, void 0, gt(e.attrs, t))), o && e.marks.length && e.marks.forEach((a) => {
|
|
529
|
+
o === a.type && (c = !0, i && n.addMark(r, r + e.nodeSize, o.create(gt(a.attrs, t))));
|
|
598
530
|
});
|
|
599
531
|
});
|
|
600
532
|
}), c;
|
|
601
|
-
},
|
|
533
|
+
}, vt = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), yt = () => ({ tr: e, dispatch: t }) => {
|
|
602
534
|
if (t) {
|
|
603
|
-
let t = new
|
|
535
|
+
let t = new h(e.doc);
|
|
604
536
|
e.setSelection(t);
|
|
605
537
|
}
|
|
606
538
|
return !0;
|
|
607
|
-
},
|
|
608
|
-
function
|
|
609
|
-
return
|
|
539
|
+
}, bt = () => ({ state: e, dispatch: t }) => ue(e, t), xt = () => ({ state: e, dispatch: t }) => de(e, t), St = () => ({ state: e, dispatch: t }) => fe(e, t), Ct = () => ({ state: e, dispatch: t }) => pe(e, t), wt = () => ({ state: e, dispatch: t }) => me(e, t);
|
|
540
|
+
function L(e, t, n = {}, r = {}) {
|
|
541
|
+
return P(e, t, {
|
|
610
542
|
slice: !1,
|
|
611
543
|
parseOptions: n,
|
|
612
544
|
errorOnInvalidContent: r.errorOnInvalidContent
|
|
613
545
|
});
|
|
614
546
|
}
|
|
615
|
-
var
|
|
547
|
+
var Tt = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: i, tr: a, dispatch: o, commands: s }) => {
|
|
616
548
|
let { doc: c } = a;
|
|
617
549
|
if (r.preserveWhitespace !== "full") {
|
|
618
|
-
let s =
|
|
550
|
+
let s = L(e, i.schema, r, { errorOnInvalidContent: t ?? i.options.enableContentCheck });
|
|
619
551
|
if (o) {
|
|
620
|
-
let e =
|
|
552
|
+
let e = Xe(s) ? s.content : [s];
|
|
621
553
|
a.replaceWith(0, c.content.size, e).setMeta("preventUpdate", !n);
|
|
622
554
|
}
|
|
623
555
|
return !0;
|
|
@@ -630,23 +562,23 @@ var Et = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {
|
|
|
630
562
|
errorOnInvalidContent: t ?? i.options.enableContentCheck
|
|
631
563
|
});
|
|
632
564
|
};
|
|
633
|
-
function
|
|
634
|
-
let n =
|
|
565
|
+
function Et(e, t) {
|
|
566
|
+
let n = k(t, e.schema), { from: r, to: i, empty: a } = e.selection, o = [];
|
|
635
567
|
a ? (e.storedMarks && o.push(...e.storedMarks), o.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, i, (e) => {
|
|
636
568
|
o.push(...e.marks);
|
|
637
569
|
});
|
|
638
570
|
let s = o.find((e) => e.type.name === n.name);
|
|
639
571
|
return s ? { ...s.attrs } : {};
|
|
640
572
|
}
|
|
641
|
-
function
|
|
642
|
-
let n = new
|
|
573
|
+
function Dt(e, t) {
|
|
574
|
+
let n = new l(e);
|
|
643
575
|
return t.forEach((e) => {
|
|
644
576
|
e.steps.forEach((e) => {
|
|
645
577
|
n.step(e);
|
|
646
578
|
});
|
|
647
579
|
}), n;
|
|
648
580
|
}
|
|
649
|
-
function
|
|
581
|
+
function Ot(e, t, n) {
|
|
650
582
|
let r = [];
|
|
651
583
|
return e.nodesBetween(t.from, t.to, (e, t) => {
|
|
652
584
|
n(e) && r.push({
|
|
@@ -655,7 +587,7 @@ function kt(e, t, n) {
|
|
|
655
587
|
});
|
|
656
588
|
}), r;
|
|
657
589
|
}
|
|
658
|
-
function
|
|
590
|
+
function kt(e, t) {
|
|
659
591
|
for (let n = e.depth; n > 0; --n) {
|
|
660
592
|
let r = e.node(n);
|
|
661
593
|
if (t(r)) return {
|
|
@@ -666,47 +598,47 @@ function At(e, t) {
|
|
|
666
598
|
};
|
|
667
599
|
}
|
|
668
600
|
}
|
|
669
|
-
function
|
|
670
|
-
return (t) =>
|
|
601
|
+
function R(e) {
|
|
602
|
+
return (t) => kt(t.$from, e);
|
|
671
603
|
}
|
|
672
|
-
function
|
|
673
|
-
return e.config[t] === void 0 && e.parent ?
|
|
604
|
+
function z(e, t, n) {
|
|
605
|
+
return e.config[t] === void 0 && e.parent ? z(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
|
|
674
606
|
...n,
|
|
675
|
-
parent: e.parent ?
|
|
607
|
+
parent: e.parent ? z(e.parent, t, n) : null
|
|
676
608
|
}) : e.config[t];
|
|
677
609
|
}
|
|
678
|
-
function
|
|
610
|
+
function At(e) {
|
|
679
611
|
return e.map((e) => {
|
|
680
|
-
let t =
|
|
612
|
+
let t = z(e, "addExtensions", {
|
|
681
613
|
name: e.name,
|
|
682
614
|
options: e.options,
|
|
683
615
|
storage: e.storage
|
|
684
616
|
});
|
|
685
|
-
return t ? [e, ...
|
|
617
|
+
return t ? [e, ...At(t())] : e;
|
|
686
618
|
}).flat(10);
|
|
687
619
|
}
|
|
688
|
-
function
|
|
689
|
-
let r =
|
|
620
|
+
function jt(e, t) {
|
|
621
|
+
let r = n.fromSchema(t).serializeFragment(e), i = document.implementation.createHTMLDocument().createElement("div");
|
|
690
622
|
return i.appendChild(r), i.innerHTML;
|
|
691
623
|
}
|
|
692
|
-
function
|
|
624
|
+
function Mt(e) {
|
|
693
625
|
return typeof e == "function";
|
|
694
626
|
}
|
|
695
|
-
function
|
|
696
|
-
return
|
|
627
|
+
function B(e, t = void 0, ...n) {
|
|
628
|
+
return Mt(e) ? t ? e.bind(t)(...n) : e(...n) : e;
|
|
697
629
|
}
|
|
698
|
-
function
|
|
630
|
+
function Nt(e = {}) {
|
|
699
631
|
return Object.keys(e).length === 0 && e.constructor === Object;
|
|
700
632
|
}
|
|
701
|
-
function
|
|
633
|
+
function V(e) {
|
|
702
634
|
return {
|
|
703
635
|
baseExtensions: e.filter((e) => e.type === "extension"),
|
|
704
636
|
nodeExtensions: e.filter((e) => e.type === "node"),
|
|
705
637
|
markExtensions: e.filter((e) => e.type === "mark")
|
|
706
638
|
};
|
|
707
639
|
}
|
|
708
|
-
function
|
|
709
|
-
let t = [], { nodeExtensions: n, markExtensions: r } =
|
|
640
|
+
function Pt(e) {
|
|
641
|
+
let t = [], { nodeExtensions: n, markExtensions: r } = V(e), i = [...n, ...r], a = {
|
|
710
642
|
default: null,
|
|
711
643
|
validate: void 0,
|
|
712
644
|
rendered: !0,
|
|
@@ -716,7 +648,7 @@ function Ft(e) {
|
|
|
716
648
|
isRequired: !1
|
|
717
649
|
}, o = n.filter((e) => e.name !== "text").map((e) => e.name), s = r.map((e) => e.name), c = [...o, ...s];
|
|
718
650
|
return e.forEach((e) => {
|
|
719
|
-
let n =
|
|
651
|
+
let n = z(e, "addGlobalAttributes", {
|
|
720
652
|
name: e.name,
|
|
721
653
|
options: e.options,
|
|
722
654
|
storage: e.storage,
|
|
@@ -738,7 +670,7 @@ function Ft(e) {
|
|
|
738
670
|
});
|
|
739
671
|
});
|
|
740
672
|
}), i.forEach((e) => {
|
|
741
|
-
let n =
|
|
673
|
+
let n = z(e, "addAttributes", {
|
|
742
674
|
name: e.name,
|
|
743
675
|
options: e.options,
|
|
744
676
|
storage: e.storage
|
|
@@ -758,7 +690,7 @@ function Ft(e) {
|
|
|
758
690
|
});
|
|
759
691
|
}), t;
|
|
760
692
|
}
|
|
761
|
-
function
|
|
693
|
+
function Ft(e) {
|
|
762
694
|
let t = [], n = "", r = !1, i = !1, a = 0, o = e.length;
|
|
763
695
|
for (let s = 0; s < o; s += 1) {
|
|
764
696
|
let o = e[s];
|
|
@@ -788,8 +720,8 @@ function It(e) {
|
|
|
788
720
|
}
|
|
789
721
|
return n && t.push(n), t;
|
|
790
722
|
}
|
|
791
|
-
function
|
|
792
|
-
let t = [], n =
|
|
723
|
+
function It(e) {
|
|
724
|
+
let t = [], n = Ft(e || ""), r = n.length;
|
|
793
725
|
for (let e = 0; e < r; e += 1) {
|
|
794
726
|
let r = n[e], i = r.indexOf(":");
|
|
795
727
|
if (i === -1) continue;
|
|
@@ -798,10 +730,19 @@ function Lt(e) {
|
|
|
798
730
|
}
|
|
799
731
|
return t;
|
|
800
732
|
}
|
|
801
|
-
function
|
|
733
|
+
function Lt(...e) {
|
|
802
734
|
return e.filter((e) => !!e).reduce((e, t) => {
|
|
803
735
|
let n = { ...e };
|
|
804
736
|
return Object.entries(t).forEach(([e, t]) => {
|
|
737
|
+
if (e === "__proto__") {
|
|
738
|
+
Object.defineProperty(n, e, {
|
|
739
|
+
configurable: !0,
|
|
740
|
+
enumerable: !0,
|
|
741
|
+
value: t,
|
|
742
|
+
writable: !0
|
|
743
|
+
});
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
805
746
|
if (!n[e]) {
|
|
806
747
|
n[e] = t;
|
|
807
748
|
return;
|
|
@@ -810,26 +751,26 @@ function Rt(...e) {
|
|
|
810
751
|
let r = t ? String(t).split(" ") : [], i = n[e] ? n[e].split(" ") : [], a = r.filter((e) => !i.includes(e));
|
|
811
752
|
n[e] = [...i, ...a].join(" ");
|
|
812
753
|
} else if (e === "style") {
|
|
813
|
-
let r = new Map([...
|
|
754
|
+
let r = new Map([...It(n[e]), ...It(t)]);
|
|
814
755
|
n[e] = Array.from(r.entries()).map(([e, t]) => `${e}: ${t}`).join("; ");
|
|
815
756
|
} else n[e] = t;
|
|
816
757
|
}), n;
|
|
817
758
|
}, {});
|
|
818
759
|
}
|
|
819
|
-
function
|
|
820
|
-
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) =>
|
|
760
|
+
function H(e, t) {
|
|
761
|
+
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) => Lt(e, t), {});
|
|
821
762
|
}
|
|
822
|
-
function
|
|
763
|
+
function Rt(e) {
|
|
823
764
|
return typeof e == "string" ? e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" || e !== "false" && e : e;
|
|
824
765
|
}
|
|
825
|
-
function
|
|
766
|
+
function zt(e, t) {
|
|
826
767
|
return "style" in e ? e : {
|
|
827
768
|
...e,
|
|
828
769
|
getAttrs: (n) => {
|
|
829
770
|
let r = e.getAttrs ? e.getAttrs(n) : e.attrs;
|
|
830
771
|
if (r === !1) return !1;
|
|
831
772
|
let i = t.reduce((e, t) => {
|
|
832
|
-
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) :
|
|
773
|
+
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) : Rt(n.getAttribute(t.name));
|
|
833
774
|
return r == null ? e : {
|
|
834
775
|
...e,
|
|
835
776
|
[t.name]: r
|
|
@@ -842,49 +783,50 @@ function Bt(e, t) {
|
|
|
842
783
|
}
|
|
843
784
|
};
|
|
844
785
|
}
|
|
845
|
-
function
|
|
846
|
-
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" &&
|
|
786
|
+
function Bt(e) {
|
|
787
|
+
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && Nt(t) ? !1 : t != null));
|
|
847
788
|
}
|
|
848
|
-
function
|
|
849
|
-
|
|
850
|
-
|
|
789
|
+
function Vt(e) {
|
|
790
|
+
var t, n;
|
|
791
|
+
let r = {};
|
|
792
|
+
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];
|
|
851
793
|
}
|
|
852
|
-
function
|
|
853
|
-
let n =
|
|
794
|
+
function Ht(e, t) {
|
|
795
|
+
let n = Pt(e), { nodeExtensions: r, markExtensions: a } = V(e), o = r.find((e) => z(e, "topNode"))?.name, s = Object.fromEntries(r.map((r) => {
|
|
854
796
|
let i = n.filter((e) => e.type === r.name), a = {
|
|
855
797
|
name: r.name,
|
|
856
798
|
options: r.options,
|
|
857
799
|
storage: r.storage,
|
|
858
800
|
editor: t
|
|
859
|
-
}, o =
|
|
801
|
+
}, o = Bt({
|
|
860
802
|
...e.reduce((e, t) => {
|
|
861
|
-
let n =
|
|
803
|
+
let n = z(t, "extendNodeSchema", a);
|
|
862
804
|
return {
|
|
863
805
|
...e,
|
|
864
806
|
...n ? n(r) : {}
|
|
865
807
|
};
|
|
866
808
|
}, {}),
|
|
867
|
-
content:
|
|
868
|
-
marks:
|
|
869
|
-
group:
|
|
870
|
-
inline:
|
|
871
|
-
atom:
|
|
872
|
-
selectable:
|
|
873
|
-
draggable:
|
|
874
|
-
code:
|
|
875
|
-
whitespace:
|
|
876
|
-
linebreakReplacement:
|
|
877
|
-
defining:
|
|
878
|
-
isolating:
|
|
879
|
-
attrs: Object.fromEntries(i.map(
|
|
880
|
-
}), s =
|
|
881
|
-
s && (o.parseDOM = s.map((e) =>
|
|
882
|
-
let c =
|
|
809
|
+
content: B(z(r, "content", a)),
|
|
810
|
+
marks: B(z(r, "marks", a)),
|
|
811
|
+
group: B(z(r, "group", a)),
|
|
812
|
+
inline: B(z(r, "inline", a)),
|
|
813
|
+
atom: B(z(r, "atom", a)),
|
|
814
|
+
selectable: B(z(r, "selectable", a)),
|
|
815
|
+
draggable: B(z(r, "draggable", a)),
|
|
816
|
+
code: B(z(r, "code", a)),
|
|
817
|
+
whitespace: B(z(r, "whitespace", a)),
|
|
818
|
+
linebreakReplacement: B(z(r, "linebreakReplacement", a)),
|
|
819
|
+
defining: B(z(r, "defining", a)),
|
|
820
|
+
isolating: B(z(r, "isolating", a)),
|
|
821
|
+
attrs: Object.fromEntries(i.map(Vt))
|
|
822
|
+
}), s = B(z(r, "parseHTML", a));
|
|
823
|
+
s && (o.parseDOM = s.map((e) => zt(e, i)));
|
|
824
|
+
let c = z(r, "renderHTML", a);
|
|
883
825
|
c && (o.toDOM = (e) => c({
|
|
884
826
|
node: e,
|
|
885
|
-
HTMLAttributes:
|
|
827
|
+
HTMLAttributes: H(e, i)
|
|
886
828
|
}));
|
|
887
|
-
let l =
|
|
829
|
+
let l = z(r, "renderText", a);
|
|
888
830
|
return l && (o.toText = l), [r.name, o];
|
|
889
831
|
})), c = Object.fromEntries(a.map((r) => {
|
|
890
832
|
let i = n.filter((e) => e.type === r.name), a = {
|
|
@@ -892,49 +834,49 @@ function Ut(e, t) {
|
|
|
892
834
|
options: r.options,
|
|
893
835
|
storage: r.storage,
|
|
894
836
|
editor: t
|
|
895
|
-
}, o =
|
|
837
|
+
}, o = Bt({
|
|
896
838
|
...e.reduce((e, t) => {
|
|
897
|
-
let n =
|
|
839
|
+
let n = z(t, "extendMarkSchema", a);
|
|
898
840
|
return {
|
|
899
841
|
...e,
|
|
900
842
|
...n ? n(r) : {}
|
|
901
843
|
};
|
|
902
844
|
}, {}),
|
|
903
|
-
inclusive:
|
|
904
|
-
excludes:
|
|
905
|
-
group:
|
|
906
|
-
spanning:
|
|
907
|
-
code:
|
|
908
|
-
attrs: Object.fromEntries(i.map(
|
|
909
|
-
}), s =
|
|
910
|
-
s && (o.parseDOM = s.map((e) =>
|
|
911
|
-
let c =
|
|
845
|
+
inclusive: B(z(r, "inclusive", a)),
|
|
846
|
+
excludes: B(z(r, "excludes", a)),
|
|
847
|
+
group: B(z(r, "group", a)),
|
|
848
|
+
spanning: B(z(r, "spanning", a)),
|
|
849
|
+
code: B(z(r, "code", a)),
|
|
850
|
+
attrs: Object.fromEntries(i.map(Vt))
|
|
851
|
+
}), s = B(z(r, "parseHTML", a));
|
|
852
|
+
s && (o.parseDOM = s.map((e) => zt(e, i)));
|
|
853
|
+
let c = z(r, "renderHTML", a);
|
|
912
854
|
return c && (o.toDOM = (e) => c({
|
|
913
855
|
mark: e,
|
|
914
|
-
HTMLAttributes:
|
|
856
|
+
HTMLAttributes: H(e, i)
|
|
915
857
|
})), [r.name, o];
|
|
916
858
|
}));
|
|
917
|
-
return new
|
|
859
|
+
return new i({
|
|
918
860
|
topNode: o,
|
|
919
861
|
nodes: s,
|
|
920
862
|
marks: c
|
|
921
863
|
});
|
|
922
864
|
}
|
|
923
|
-
function
|
|
865
|
+
function Ut(e) {
|
|
924
866
|
let t = e.filter((t, n) => e.indexOf(t) !== n);
|
|
925
867
|
return Array.from(new Set(t));
|
|
926
868
|
}
|
|
927
|
-
function
|
|
869
|
+
function U(e) {
|
|
928
870
|
return e.sort((e, t) => {
|
|
929
|
-
let n =
|
|
871
|
+
let n = z(e, "priority") || 100, r = z(t, "priority") || 100;
|
|
930
872
|
return n > r ? -1 : +(n < r);
|
|
931
873
|
});
|
|
932
874
|
}
|
|
933
|
-
function
|
|
934
|
-
let t =
|
|
875
|
+
function Wt(e) {
|
|
876
|
+
let t = U(At(e)), n = Ut(t.map((e) => e.name));
|
|
935
877
|
return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e) => `'${e}'`).join(", ")}]. This can lead to issues.`), t;
|
|
936
878
|
}
|
|
937
|
-
function
|
|
879
|
+
function Gt(e, t, n) {
|
|
938
880
|
let { from: r, to: i } = t, { blockSeparator: a = "\n\n", textSerializers: o = {} } = n || {}, s = "";
|
|
939
881
|
return e.nodesBetween(r, i, (e, n, c, l) => {
|
|
940
882
|
e.isBlock && n > r && (s += a);
|
|
@@ -946,19 +888,22 @@ function Kt(e, t, n) {
|
|
|
946
888
|
index: l,
|
|
947
889
|
range: t
|
|
948
890
|
})), !1;
|
|
949
|
-
|
|
891
|
+
if (e.isText) {
|
|
892
|
+
var d;
|
|
893
|
+
s += e == null || (d = e.text) == null ? void 0 : d.slice(Math.max(r, n) - n, i - n);
|
|
894
|
+
}
|
|
950
895
|
}), s;
|
|
951
896
|
}
|
|
952
|
-
function
|
|
953
|
-
return
|
|
897
|
+
function Kt(e, t) {
|
|
898
|
+
return Gt(e, {
|
|
954
899
|
from: 0,
|
|
955
900
|
to: e.content.size
|
|
956
901
|
}, t);
|
|
957
902
|
}
|
|
958
|
-
function
|
|
903
|
+
function qt(e) {
|
|
959
904
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
|
|
960
905
|
}
|
|
961
|
-
function
|
|
906
|
+
function Jt(e, t) {
|
|
962
907
|
let n = E(t, e.schema), { from: r, to: i } = e.selection, a = [];
|
|
963
908
|
e.doc.nodesBetween(r, i, (e) => {
|
|
964
909
|
a.push(e);
|
|
@@ -966,22 +911,22 @@ function Yt(e, t) {
|
|
|
966
911
|
let o = a.reverse().find((e) => e.type.name === n.name);
|
|
967
912
|
return o ? { ...o.attrs } : {};
|
|
968
913
|
}
|
|
969
|
-
function
|
|
970
|
-
let n =
|
|
971
|
-
return n === "node" ?
|
|
914
|
+
function Yt(e, t) {
|
|
915
|
+
let n = I(typeof t == "string" ? t : t.name, e.schema);
|
|
916
|
+
return n === "node" ? Jt(e, t) : n === "mark" ? Et(e, t) : {};
|
|
972
917
|
}
|
|
973
|
-
function
|
|
918
|
+
function Xt(e, t = JSON.stringify) {
|
|
974
919
|
let n = {};
|
|
975
920
|
return e.filter((e) => {
|
|
976
921
|
let r = t(e);
|
|
977
922
|
return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
|
|
978
923
|
});
|
|
979
924
|
}
|
|
980
|
-
function
|
|
981
|
-
let t =
|
|
925
|
+
function Zt(e) {
|
|
926
|
+
let t = Xt(e);
|
|
982
927
|
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));
|
|
983
928
|
}
|
|
984
|
-
function
|
|
929
|
+
function Qt(e) {
|
|
985
930
|
let { mapping: t, steps: n } = e, r = [];
|
|
986
931
|
return t.maps.forEach((e, i) => {
|
|
987
932
|
let a = [];
|
|
@@ -1012,12 +957,12 @@ function $t(e) {
|
|
|
1012
957
|
}
|
|
1013
958
|
});
|
|
1014
959
|
});
|
|
1015
|
-
}),
|
|
960
|
+
}), Zt(r);
|
|
1016
961
|
}
|
|
1017
|
-
function
|
|
962
|
+
function $t(e, t, n) {
|
|
1018
963
|
let r = [];
|
|
1019
964
|
return e === t ? n.resolve(e).marks().forEach((t) => {
|
|
1020
|
-
let i =
|
|
965
|
+
let i = O(n.resolve(e), t.type);
|
|
1021
966
|
i && r.push({
|
|
1022
967
|
mark: t,
|
|
1023
968
|
...i
|
|
@@ -1030,29 +975,29 @@ function en(e, t, n) {
|
|
|
1030
975
|
})));
|
|
1031
976
|
}), r;
|
|
1032
977
|
}
|
|
1033
|
-
var
|
|
978
|
+
var en = (e, t, n, r = 20) => {
|
|
1034
979
|
let i = e.doc.resolve(n), a = r, o = null;
|
|
1035
980
|
for (; a > 0 && o === null;) {
|
|
1036
981
|
let e = i.node(a);
|
|
1037
982
|
e?.type.name === t ? o = e : --a;
|
|
1038
983
|
}
|
|
1039
984
|
return [o, a];
|
|
1040
|
-
},
|
|
985
|
+
}, tn = (e) => {
|
|
1041
986
|
let t = e.depth - 1;
|
|
1042
987
|
if (t < 0) return null;
|
|
1043
988
|
let n = e.index(t);
|
|
1044
989
|
return n === 0 ? null : e.node(t).child(n - 1);
|
|
1045
990
|
};
|
|
1046
|
-
function
|
|
991
|
+
function W(e, t) {
|
|
1047
992
|
return t.nodes[e] || t.marks[e] || null;
|
|
1048
993
|
}
|
|
1049
|
-
function
|
|
994
|
+
function G(e, t, n) {
|
|
1050
995
|
return Object.fromEntries(Object.entries(n).filter(([n]) => {
|
|
1051
996
|
let r = e.find((e) => e.type === t && e.name === n);
|
|
1052
997
|
return r ? r.attribute.keepOnSplit : !1;
|
|
1053
998
|
}));
|
|
1054
999
|
}
|
|
1055
|
-
var
|
|
1000
|
+
var nn = (e, t = 500) => {
|
|
1056
1001
|
let n = "", r = e.parentOffset;
|
|
1057
1002
|
return e.parent.nodesBetween(Math.max(0, r - t), r, (e, t, i, a) => {
|
|
1058
1003
|
var o;
|
|
@@ -1065,9 +1010,9 @@ var rn = (e, t = 500) => {
|
|
|
1065
1010
|
n += e.isAtom && !e.isText ? s : s.slice(0, Math.max(0, r - t));
|
|
1066
1011
|
}), n;
|
|
1067
1012
|
};
|
|
1068
|
-
function
|
|
1069
|
-
let { empty: r, ranges: i } = e.selection, a = t ?
|
|
1070
|
-
if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) =>
|
|
1013
|
+
function K(e, t, n = {}) {
|
|
1014
|
+
let { empty: r, ranges: i } = e.selection, a = t ? k(t, e.schema) : null;
|
|
1015
|
+
if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) => D(e.attrs, n, { strict: !1 }));
|
|
1071
1016
|
let o = 0, s = [];
|
|
1072
1017
|
if (i.forEach(({ $from: t, $to: n }) => {
|
|
1073
1018
|
let r = t.pos, i = n.pos;
|
|
@@ -1082,41 +1027,41 @@ function an(e, t, n = {}) {
|
|
|
1082
1027
|
})));
|
|
1083
1028
|
});
|
|
1084
1029
|
}), o === 0) return !1;
|
|
1085
|
-
let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) =>
|
|
1030
|
+
let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) => D(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);
|
|
1086
1031
|
return (c > 0 ? c + l : c) >= o;
|
|
1087
1032
|
}
|
|
1088
|
-
function
|
|
1089
|
-
if (!t) return
|
|
1090
|
-
let r =
|
|
1091
|
-
return r === "node" ?
|
|
1033
|
+
function rn(e, t, n = {}) {
|
|
1034
|
+
if (!t) return F(e, null, n) || K(e, null, n);
|
|
1035
|
+
let r = I(t, e.schema);
|
|
1036
|
+
return r === "node" ? F(e, t, n) : r === "mark" && K(e, t, n);
|
|
1092
1037
|
}
|
|
1093
|
-
var
|
|
1038
|
+
var an = (e, t) => {
|
|
1094
1039
|
let { $from: n, $to: r, $anchor: i } = e.selection;
|
|
1095
1040
|
if (t) {
|
|
1096
|
-
let n =
|
|
1041
|
+
let n = R((e) => e.type.name === t)(e.selection);
|
|
1097
1042
|
if (!n) return !1;
|
|
1098
1043
|
let r = e.doc.resolve(n.pos + 1);
|
|
1099
1044
|
return i.pos + 1 === r.end();
|
|
1100
1045
|
}
|
|
1101
1046
|
return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
|
|
1102
|
-
},
|
|
1047
|
+
}, on = (e) => {
|
|
1103
1048
|
let { $from: t, $to: n } = e.selection;
|
|
1104
1049
|
return !(t.parentOffset > 0 || t.pos !== n.pos);
|
|
1105
1050
|
};
|
|
1106
|
-
function
|
|
1051
|
+
function sn(e, t) {
|
|
1107
1052
|
return Array.isArray(t) ? t.some((t) => (typeof t == "string" ? t : t.name) === e.name) : t;
|
|
1108
1053
|
}
|
|
1109
1054
|
function q(e, t) {
|
|
1110
|
-
let { nodeExtensions: n } =
|
|
1055
|
+
let { nodeExtensions: n } = V(t), r = n.find((t) => t.name === e);
|
|
1111
1056
|
if (!r) return !1;
|
|
1112
|
-
let i =
|
|
1057
|
+
let i = B(z(r, "group", {
|
|
1113
1058
|
name: r.name,
|
|
1114
1059
|
options: r.options,
|
|
1115
1060
|
storage: r.storage
|
|
1116
1061
|
}));
|
|
1117
1062
|
return typeof i == "string" && i.split(" ").includes("list");
|
|
1118
1063
|
}
|
|
1119
|
-
function
|
|
1064
|
+
function J(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
1120
1065
|
if (n) {
|
|
1121
1066
|
if (e.type.name === "hardBreak") return !0;
|
|
1122
1067
|
if (e.isText) return !/\S/.test(e.text ?? "");
|
|
@@ -1127,7 +1072,7 @@ function un(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1127
1072
|
if (t) {
|
|
1128
1073
|
let r = !0;
|
|
1129
1074
|
return e.content.forEach((e) => {
|
|
1130
|
-
r !== !1 && (
|
|
1075
|
+
r !== !1 && (J(e, {
|
|
1131
1076
|
ignoreWhitespace: n,
|
|
1132
1077
|
checkChildren: t
|
|
1133
1078
|
}) || (r = !1));
|
|
@@ -1135,10 +1080,10 @@ function un(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1135
1080
|
}
|
|
1136
1081
|
return !1;
|
|
1137
1082
|
}
|
|
1138
|
-
function
|
|
1139
|
-
return e instanceof
|
|
1083
|
+
function cn(e) {
|
|
1084
|
+
return e instanceof _;
|
|
1140
1085
|
}
|
|
1141
|
-
var
|
|
1086
|
+
var ln = class e {
|
|
1142
1087
|
constructor(e) {
|
|
1143
1088
|
this.position = e;
|
|
1144
1089
|
}
|
|
@@ -1149,19 +1094,19 @@ var fn = class e {
|
|
|
1149
1094
|
return { position: this.position };
|
|
1150
1095
|
}
|
|
1151
1096
|
};
|
|
1152
|
-
function
|
|
1097
|
+
function un(e, t) {
|
|
1153
1098
|
let n = t.mapping.mapResult(e.position);
|
|
1154
1099
|
return {
|
|
1155
|
-
position: new
|
|
1100
|
+
position: new ln(n.pos),
|
|
1156
1101
|
mapResult: n
|
|
1157
1102
|
};
|
|
1158
1103
|
}
|
|
1159
|
-
function
|
|
1160
|
-
return new
|
|
1104
|
+
function dn(e) {
|
|
1105
|
+
return new ln(e);
|
|
1161
1106
|
}
|
|
1162
|
-
function
|
|
1107
|
+
function fn(e, t, n) {
|
|
1163
1108
|
let { selection: r } = t, i = null;
|
|
1164
|
-
if (
|
|
1109
|
+
if (He(r) && (i = r.$cursor), i) {
|
|
1165
1110
|
let t = e.storedMarks ?? i.marks();
|
|
1166
1111
|
return i.parent.type.allowsMarkType(n) && (!!n.isInSet(t) || !t.some((e) => e.type.excludes(n)));
|
|
1167
1112
|
}
|
|
@@ -1178,11 +1123,11 @@ function hn(e, t, n) {
|
|
|
1178
1123
|
}), i;
|
|
1179
1124
|
});
|
|
1180
1125
|
}
|
|
1181
|
-
var
|
|
1182
|
-
let { selection: a } = n, { empty: o, ranges: s } = a, c =
|
|
1126
|
+
var pn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1127
|
+
let { selection: a } = n, { empty: o, ranges: s } = a, c = k(e, r.schema);
|
|
1183
1128
|
if (i) {
|
|
1184
1129
|
if (o) {
|
|
1185
|
-
let e =
|
|
1130
|
+
let e = Et(r, c);
|
|
1186
1131
|
n.addStoredMark(c.create({
|
|
1187
1132
|
...e,
|
|
1188
1133
|
...t
|
|
@@ -1200,23 +1145,23 @@ var gn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1200
1145
|
});
|
|
1201
1146
|
});
|
|
1202
1147
|
}
|
|
1203
|
-
return
|
|
1204
|
-
},
|
|
1148
|
+
return fn(r, n, c);
|
|
1149
|
+
}, mn = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), hn = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
|
|
1205
1150
|
let a = E(e, n.schema), o;
|
|
1206
|
-
return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) =>
|
|
1151
|
+
return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) => he(a, {
|
|
1207
1152
|
...o,
|
|
1208
1153
|
...t
|
|
1209
|
-
})(n) ? !0 : e.clearNodes()).command(({ state: e }) =>
|
|
1154
|
+
})(n) ? !0 : e.clearNodes()).command(({ state: e }) => he(a, {
|
|
1210
1155
|
...o,
|
|
1211
1156
|
...t
|
|
1212
1157
|
})(e, r)).run() : (console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes."), !1);
|
|
1213
|
-
},
|
|
1158
|
+
}, gn = (e) => ({ tr: t, dispatch: n }) => {
|
|
1214
1159
|
if (n) {
|
|
1215
|
-
let { doc: n } = t, r =
|
|
1160
|
+
let { doc: n } = t, r = A(e, 0, n.content.size), i = _.create(n, r);
|
|
1216
1161
|
t.setSelection(i);
|
|
1217
1162
|
}
|
|
1218
1163
|
return !0;
|
|
1219
|
-
},
|
|
1164
|
+
}, _n = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1220
1165
|
let { selection: a } = r, o, s;
|
|
1221
1166
|
return typeof t == "number" ? (o = t, s = t) : t && "from" in t && "to" in t ? (o = t.from, s = t.to) : (o = a.from, s = a.to), i && n.doc.nodesBetween(o, s, (t, r) => {
|
|
1222
1167
|
t.isText || n.setNodeMarkup(r, void 0, {
|
|
@@ -1224,79 +1169,79 @@ var gn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1224
1169
|
dir: e
|
|
1225
1170
|
});
|
|
1226
1171
|
}), !0;
|
|
1227
|
-
},
|
|
1172
|
+
}, vn = (e) => ({ tr: t, dispatch: n }) => {
|
|
1228
1173
|
if (n) {
|
|
1229
1174
|
let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
|
|
1230
1175
|
from: e,
|
|
1231
1176
|
to: e
|
|
1232
|
-
} : e, a =
|
|
1177
|
+
} : e, a = x.atStart(n).from, o = x.atEnd(n).to, s = A(r, a, o), c = A(i, a, o), l = x.create(n, s, c);
|
|
1233
1178
|
t.setSelection(l);
|
|
1234
1179
|
}
|
|
1235
1180
|
return !0;
|
|
1236
|
-
},
|
|
1181
|
+
}, yn = (e) => ({ state: t, dispatch: n }) => {
|
|
1237
1182
|
let r = E(e, t.schema);
|
|
1238
|
-
return
|
|
1183
|
+
return ve(r)(t, n);
|
|
1239
1184
|
};
|
|
1240
|
-
function
|
|
1185
|
+
function bn(e, t) {
|
|
1241
1186
|
let n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
1242
1187
|
if (n) {
|
|
1243
1188
|
let r = n.filter((e) => t?.includes(e.type.name));
|
|
1244
1189
|
e.tr.ensureMarks(r);
|
|
1245
1190
|
}
|
|
1246
1191
|
}
|
|
1247
|
-
var
|
|
1248
|
-
let { selection: a, doc: o } = t, { $from: s, $to: c } = a, l = i.extensionManager.attributes,
|
|
1249
|
-
if (a instanceof
|
|
1192
|
+
var xn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: i }) => {
|
|
1193
|
+
let { selection: a, doc: o } = t, { $from: s, $to: c } = a, l = i.extensionManager.attributes, u = G(l, s.node().type.name, s.node().attrs);
|
|
1194
|
+
if (a instanceof _ && a.node.isBlock) return !s.parentOffset || !d(o, s.pos) ? !1 : (r && (e && bn(n, i.extensionManager.splittableMarks), t.split(s.pos).scrollIntoView()), !0);
|
|
1250
1195
|
if (!s.parent.isBlock) return !1;
|
|
1251
|
-
let f = c.parentOffset === c.parent.content.size, p = s.depth === 0 ? void 0 :
|
|
1196
|
+
let f = c.parentOffset === c.parent.content.size, p = s.depth === 0 ? void 0 : $e(s.node(-1).contentMatchAt(s.indexAfter(-1))), m = f && p ? [{
|
|
1252
1197
|
type: p,
|
|
1253
|
-
attrs:
|
|
1254
|
-
}] : void 0, h =
|
|
1255
|
-
if (!m && !h &&
|
|
1198
|
+
attrs: u
|
|
1199
|
+
}] : void 0, h = d(t.doc, t.mapping.map(s.pos), 1, m);
|
|
1200
|
+
if (!m && !h && d(t.doc, t.mapping.map(s.pos), 1, p ? [{ type: p }] : void 0) && (h = !0, m = p ? [{
|
|
1256
1201
|
type: p,
|
|
1257
|
-
attrs:
|
|
1202
|
+
attrs: u
|
|
1258
1203
|
}] : void 0), r) {
|
|
1259
|
-
if (h && (a instanceof
|
|
1204
|
+
if (h && (a instanceof x && t.deleteSelection(), t.split(t.mapping.map(s.pos), 1, m), p && !f && !s.parentOffset && s.parent.type !== p)) {
|
|
1260
1205
|
let e = t.mapping.map(s.before()), n = t.doc.resolve(e);
|
|
1261
1206
|
s.node(-1).canReplaceWith(n.index(), n.index() + 1, p) && t.setNodeMarkup(t.mapping.map(s.before()), p);
|
|
1262
1207
|
}
|
|
1263
|
-
e &&
|
|
1208
|
+
e && bn(n, i.extensionManager.splittableMarks), t.scrollIntoView();
|
|
1264
1209
|
}
|
|
1265
1210
|
return h;
|
|
1266
|
-
},
|
|
1267
|
-
let c = E(e,
|
|
1268
|
-
if (f && f.isBlock || l.depth < 2 || !l.sameParent(
|
|
1211
|
+
}, Sn = (e, t = {}) => ({ tr: n, state: i, dispatch: o, editor: s }) => {
|
|
1212
|
+
let c = E(e, i.schema), { $from: l, $to: u } = i.selection, f = i.selection.node;
|
|
1213
|
+
if (f && f.isBlock || l.depth < 2 || !l.sameParent(u)) return !1;
|
|
1269
1214
|
let p = l.node(-1);
|
|
1270
1215
|
if (p.type !== c) return !1;
|
|
1271
1216
|
let m = s.extensionManager.attributes;
|
|
1272
1217
|
if (l.parent.content.size === 0 && l.node(-1).childCount === l.indexAfter(-1)) {
|
|
1273
1218
|
if (l.depth === 2 || l.node(-3).type !== c || l.index(-2) !== l.node(-2).childCount - 1) return !1;
|
|
1274
1219
|
if (o) {
|
|
1275
|
-
let e =
|
|
1276
|
-
for (let t = l.depth -
|
|
1220
|
+
let e = r.empty, i = l.index(-1) ? 1 : l.index(-2) ? 2 : 3;
|
|
1221
|
+
for (let t = l.depth - i; t >= l.depth - 3; --t) e = r.from(l.node(t).copy(e));
|
|
1277
1222
|
let o = l.indexAfter(-1) < l.node(-2).childCount ? 1 : l.indexAfter(-2) < l.node(-3).childCount ? 2 : 3, s = {
|
|
1278
|
-
...
|
|
1223
|
+
...G(m, l.node().type.name, l.node().attrs),
|
|
1279
1224
|
...t
|
|
1280
1225
|
}, u = c.contentMatch.defaultType?.createAndFill(s) || void 0;
|
|
1281
|
-
e = e.append(
|
|
1282
|
-
let d = l.before(l.depth - (
|
|
1283
|
-
|
|
1226
|
+
e = e.append(r.from(c.createAndFill(null, u) || void 0));
|
|
1227
|
+
let d = l.before(l.depth - (i - 1));
|
|
1228
|
+
n.replace(d, l.after(-o), new a(e, 4 - i, 0));
|
|
1284
1229
|
let f = -1;
|
|
1285
|
-
|
|
1230
|
+
n.doc.nodesBetween(d, n.doc.content.size, (e, t) => {
|
|
1286
1231
|
if (f > -1) return !1;
|
|
1287
1232
|
e.isTextblock && e.content.size === 0 && (f = t + 1);
|
|
1288
|
-
}), f > -1 &&
|
|
1233
|
+
}), f > -1 && n.setSelection(x.near(n.doc.resolve(f))), n.scrollIntoView();
|
|
1289
1234
|
}
|
|
1290
1235
|
return !0;
|
|
1291
1236
|
}
|
|
1292
|
-
let h =
|
|
1293
|
-
...
|
|
1237
|
+
let h = u.pos === l.end() ? p.contentMatchAt(0).defaultType : null, g = {
|
|
1238
|
+
...G(m, p.type.name, p.attrs),
|
|
1294
1239
|
...t
|
|
1295
1240
|
}, _ = {
|
|
1296
|
-
...
|
|
1241
|
+
...G(m, l.node().type.name, l.node().attrs),
|
|
1297
1242
|
...t
|
|
1298
1243
|
};
|
|
1299
|
-
|
|
1244
|
+
n.delete(l.pos, u.pos);
|
|
1300
1245
|
let v = h ? [{
|
|
1301
1246
|
type: c,
|
|
1302
1247
|
attrs: g
|
|
@@ -1307,74 +1252,74 @@ var wn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
1307
1252
|
type: c,
|
|
1308
1253
|
attrs: g
|
|
1309
1254
|
}];
|
|
1310
|
-
if (!
|
|
1255
|
+
if (!d(n.doc, l.pos, 2)) return !1;
|
|
1311
1256
|
if (o) {
|
|
1312
|
-
let { selection: e, storedMarks: t } =
|
|
1313
|
-
if (
|
|
1314
|
-
let c =
|
|
1315
|
-
|
|
1257
|
+
let { selection: e, storedMarks: t } = i, { splittableMarks: r } = s.extensionManager, a = t || e.$to.parentOffset && e.$from.marks();
|
|
1258
|
+
if (n.split(l.pos, 2, v).scrollIntoView(), !a || !o) return !0;
|
|
1259
|
+
let c = a.filter((e) => r.includes(e.type.name));
|
|
1260
|
+
n.ensureMarks(c);
|
|
1316
1261
|
}
|
|
1317
1262
|
return !0;
|
|
1318
1263
|
};
|
|
1319
|
-
function
|
|
1264
|
+
function Cn(e) {
|
|
1320
1265
|
return !e || e === "1" ? null : e;
|
|
1321
1266
|
}
|
|
1322
|
-
function
|
|
1323
|
-
return
|
|
1267
|
+
function wn(e, t) {
|
|
1268
|
+
return Cn(e) === Cn(t);
|
|
1324
1269
|
}
|
|
1325
|
-
var
|
|
1326
|
-
let n =
|
|
1270
|
+
var Tn = (e, t) => {
|
|
1271
|
+
let n = R((e) => e.type === t)(e.selection);
|
|
1327
1272
|
if (!n) return !0;
|
|
1328
1273
|
let r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
1329
1274
|
if (r === void 0) return !0;
|
|
1330
1275
|
let i = e.doc.nodeAt(r);
|
|
1331
|
-
return !(n.node.type === i?.type &&
|
|
1332
|
-
},
|
|
1333
|
-
let n =
|
|
1276
|
+
return !(n.node.type === i?.type && u(e.doc, n.pos)) || !wn(n.node.attrs.type, i?.attrs.type) || e.join(n.pos), !0;
|
|
1277
|
+
}, En = (e, t) => {
|
|
1278
|
+
let n = R((e) => e.type === t)(e.selection);
|
|
1334
1279
|
if (!n) return !0;
|
|
1335
1280
|
let r = e.doc.resolve(n.start).after(n.depth);
|
|
1336
1281
|
if (r === void 0) return !0;
|
|
1337
1282
|
let i = e.doc.nodeAt(r);
|
|
1338
|
-
return !(n.node.type === i?.type &&
|
|
1283
|
+
return !(n.node.type === i?.type && u(e.doc, r)) || !wn(n.node.attrs.type, i?.attrs.type) || e.join(r), !0;
|
|
1339
1284
|
};
|
|
1340
|
-
function
|
|
1285
|
+
function Dn(e) {
|
|
1341
1286
|
let t = e.doc, n = t.firstChild;
|
|
1342
1287
|
if (!n) return null;
|
|
1343
1288
|
let r = t.resolve(1), i = t.resolve(n.nodeSize - 1);
|
|
1344
|
-
return
|
|
1289
|
+
return x.between(r, i);
|
|
1345
1290
|
}
|
|
1346
|
-
var
|
|
1291
|
+
var On = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain: c, commands: l, can: u }) => {
|
|
1347
1292
|
let { extensions: d, splittableMarks: f } = i.extensionManager, p = E(e, o.schema), m = E(t, o.schema), { selection: h, storedMarks: g } = o, { $from: _, $to: v } = h, y = _.blockRange(v), b = g || h.$to.parentOffset && h.$from.marks();
|
|
1348
1293
|
if (!y) return !1;
|
|
1349
|
-
let x =
|
|
1294
|
+
let x = R((e) => q(e.type.name, d))(h), ee = h.from === 0 && h.to === o.doc.content.size, te = o.doc.content.content, ne = te.length === 1 ? te[0] : null, re = ee && ne && q(ne.type.name, d) ? {
|
|
1350
1295
|
node: ne,
|
|
1351
1296
|
pos: 0,
|
|
1352
1297
|
depth: 0
|
|
1353
1298
|
} : null, S = x ?? re, ie = !!x && y.depth >= 1 && y.depth - x.depth <= 1, ae = !!re;
|
|
1354
1299
|
if ((ie || ae) && S) {
|
|
1355
1300
|
if (S.node.type === p) return ee && ae ? c().command(({ tr: e, dispatch: t }) => {
|
|
1356
|
-
let n =
|
|
1301
|
+
let n = Dn(e);
|
|
1357
1302
|
return n ? (e.setSelection(n), t && t(e), !0) : !1;
|
|
1358
1303
|
}).liftListItem(m).run() : l.liftListItem(m);
|
|
1359
|
-
if (q(S.node.type.name, d) && p.validContent(S.node.content)) return c().command(() => (a.setNodeMarkup(S.pos, p), !0)).command(() =>
|
|
1304
|
+
if (q(S.node.type.name, d) && p.validContent(S.node.content)) return c().command(() => (a.setNodeMarkup(S.pos, p), !0)).command(() => Tn(a, p)).command(() => En(a, p)).run();
|
|
1360
1305
|
}
|
|
1361
|
-
return !n || !b || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() =>
|
|
1306
|
+
return !n || !b || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() => Tn(a, p)).command(() => En(a, p)).run() : c().command(() => {
|
|
1362
1307
|
let e = u().wrapInList(p, r), t = b.filter((e) => f.includes(e.type.name));
|
|
1363
1308
|
return a.ensureMarks(t), e ? !0 : l.clearNodes();
|
|
1364
|
-
}).wrapInList(p, r).command(() =>
|
|
1365
|
-
},
|
|
1366
|
-
let { extendEmptyMarkRange: a = !1 } = n, o =
|
|
1367
|
-
return
|
|
1368
|
-
},
|
|
1369
|
-
let a = E(e, r.schema), o = E(t, r.schema), s =
|
|
1309
|
+
}).wrapInList(p, r).command(() => Tn(a, p)).command(() => En(a, p)).run();
|
|
1310
|
+
}, kn = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
|
|
1311
|
+
let { extendEmptyMarkRange: a = !1 } = n, o = k(e, r.schema);
|
|
1312
|
+
return K(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
|
|
1313
|
+
}, An = (e, t, n = {}) => ({ state: r, commands: i }) => {
|
|
1314
|
+
let a = E(e, r.schema), o = E(t, r.schema), s = F(r, a, n), c;
|
|
1370
1315
|
return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), s ? i.setNode(o, c) : i.setNode(a, {
|
|
1371
1316
|
...c,
|
|
1372
1317
|
...n
|
|
1373
1318
|
});
|
|
1374
|
-
},
|
|
1319
|
+
}, jn = (e, t = {}) => ({ state: n, commands: r }) => {
|
|
1375
1320
|
let i = E(e, n.schema);
|
|
1376
|
-
return
|
|
1377
|
-
},
|
|
1321
|
+
return F(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
|
|
1322
|
+
}, Mn = () => ({ state: e, dispatch: t }) => {
|
|
1378
1323
|
let n = e.plugins;
|
|
1379
1324
|
for (let r = 0; r < n.length; r += 1) {
|
|
1380
1325
|
let i = n[r], a;
|
|
@@ -1391,7 +1336,7 @@ var jn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1391
1336
|
}
|
|
1392
1337
|
}
|
|
1393
1338
|
return !1;
|
|
1394
|
-
},
|
|
1339
|
+
}, Nn = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
|
|
1395
1340
|
let { ignoreClearable: i = !1 } = e, { selection: a } = t, { empty: o, ranges: s } = a;
|
|
1396
1341
|
if (o) return !0;
|
|
1397
1342
|
let { nonClearableMarks: c } = r.extensionManager;
|
|
@@ -1402,27 +1347,27 @@ var jn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1402
1347
|
});
|
|
1403
1348
|
}
|
|
1404
1349
|
return !0;
|
|
1405
|
-
},
|
|
1406
|
-
let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s =
|
|
1350
|
+
}, Pn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1351
|
+
let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s = k(e, r.schema), { $from: c, empty: l, ranges: u } = o;
|
|
1407
1352
|
if (!i) return !0;
|
|
1408
1353
|
if (l && a) {
|
|
1409
|
-
let { from: e, to: t } = o, r =
|
|
1354
|
+
let { from: e, to: t } = o, r = O(c, s, c.marks().find((e) => e.type === s)?.attrs);
|
|
1410
1355
|
r && (e = r.from, t = r.to), n.removeMark(e, t, s);
|
|
1411
1356
|
} else u.forEach((e) => {
|
|
1412
1357
|
n.removeMark(e.$from.pos, e.$to.pos, s);
|
|
1413
1358
|
});
|
|
1414
1359
|
return n.removeStoredMark(s), !0;
|
|
1415
|
-
},
|
|
1360
|
+
}, Fn = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
1416
1361
|
let { selection: i } = n, a, o;
|
|
1417
1362
|
return typeof e == "number" ? (a = e, o = e) : e && "from" in e && "to" in e ? (a = e.from, o = e.to) : (a = i.from, o = i.to), r && t.doc.nodesBetween(a, o, (e, n) => {
|
|
1418
1363
|
if (e.isText) return;
|
|
1419
1364
|
let r = { ...e.attrs };
|
|
1420
1365
|
delete r.dir, t.setNodeMarkup(n, void 0, r);
|
|
1421
1366
|
}), !0;
|
|
1422
|
-
},
|
|
1423
|
-
let a = null, o = null, s =
|
|
1367
|
+
}, In = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1368
|
+
let a = null, o = null, s = I(typeof e == "string" ? e : e.name, r.schema);
|
|
1424
1369
|
if (!s) return !1;
|
|
1425
|
-
s === "node" && (a = E(e, r.schema)), s === "mark" && (o =
|
|
1370
|
+
s === "node" && (a = E(e, r.schema)), s === "mark" && (o = k(e, r.schema));
|
|
1426
1371
|
let c = !1;
|
|
1427
1372
|
return n.selection.ranges.forEach((e) => {
|
|
1428
1373
|
let s = e.$from.pos, l = e.$to.pos, u, d, f, p;
|
|
@@ -1451,29 +1396,92 @@ var jn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1451
1396
|
}));
|
|
1452
1397
|
}));
|
|
1453
1398
|
}), c;
|
|
1454
|
-
},
|
|
1399
|
+
}, Y = new y("__tiptap_decorations__"), Ln = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(Y, {
|
|
1455
1400
|
type: "force",
|
|
1456
1401
|
name: e
|
|
1457
|
-
}), !0),
|
|
1402
|
+
}), !0), Rn = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1458
1403
|
let i = E(e, n.schema);
|
|
1459
|
-
return
|
|
1460
|
-
},
|
|
1404
|
+
return ge(i, t)(n, r);
|
|
1405
|
+
}, zn = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1461
1406
|
let i = E(e, n.schema);
|
|
1462
|
-
return
|
|
1463
|
-
},
|
|
1464
|
-
|
|
1465
|
-
|
|
1407
|
+
return ye(i, t)(n, r);
|
|
1408
|
+
}, Bn = /* @__PURE__ */ e({
|
|
1409
|
+
blur: () => Se,
|
|
1410
|
+
clearContent: () => Ce,
|
|
1411
|
+
clearNodes: () => we,
|
|
1412
|
+
command: () => Te,
|
|
1413
|
+
createParagraphNear: () => Ee,
|
|
1414
|
+
cut: () => De,
|
|
1415
|
+
deleteCurrentNode: () => Oe,
|
|
1416
|
+
deleteNode: () => ke,
|
|
1417
|
+
deleteRange: () => Ae,
|
|
1418
|
+
deleteSelection: () => Pe,
|
|
1419
|
+
enter: () => Fe,
|
|
1420
|
+
exitCode: () => Ie,
|
|
1421
|
+
extendMarkRange: () => Be,
|
|
1422
|
+
first: () => Ve,
|
|
1423
|
+
focus: () => Ge,
|
|
1424
|
+
forEach: () => Ke,
|
|
1425
|
+
insertContent: () => qe,
|
|
1426
|
+
insertContentAt: () => Qe,
|
|
1427
|
+
insertDefaultBlock: () => et,
|
|
1428
|
+
joinBackward: () => rt,
|
|
1429
|
+
joinDown: () => nt,
|
|
1430
|
+
joinForward: () => it,
|
|
1431
|
+
joinItemBackward: () => at,
|
|
1432
|
+
joinItemForward: () => ot,
|
|
1433
|
+
joinTextblockBackward: () => st,
|
|
1434
|
+
joinTextblockForward: () => ct,
|
|
1435
|
+
joinUp: () => tt,
|
|
1436
|
+
keyboardShortcut: () => dt,
|
|
1437
|
+
lift: () => ft,
|
|
1438
|
+
liftEmptyBlock: () => pt,
|
|
1439
|
+
liftListItem: () => mt,
|
|
1440
|
+
newlineInCode: () => ht,
|
|
1441
|
+
resetAttributes: () => _t,
|
|
1442
|
+
scrollIntoView: () => vt,
|
|
1443
|
+
selectAll: () => yt,
|
|
1444
|
+
selectNodeBackward: () => bt,
|
|
1445
|
+
selectNodeForward: () => xt,
|
|
1446
|
+
selectParentNode: () => St,
|
|
1447
|
+
selectTextblockEnd: () => Ct,
|
|
1448
|
+
selectTextblockStart: () => wt,
|
|
1449
|
+
setContent: () => Tt,
|
|
1450
|
+
setMark: () => pn,
|
|
1451
|
+
setMeta: () => mn,
|
|
1452
|
+
setNode: () => hn,
|
|
1453
|
+
setNodeSelection: () => gn,
|
|
1454
|
+
setTextDirection: () => _n,
|
|
1455
|
+
setTextSelection: () => vn,
|
|
1456
|
+
sinkListItem: () => yn,
|
|
1457
|
+
splitBlock: () => xn,
|
|
1458
|
+
splitListItem: () => Sn,
|
|
1459
|
+
toggleList: () => On,
|
|
1460
|
+
toggleMark: () => kn,
|
|
1461
|
+
toggleNode: () => An,
|
|
1462
|
+
toggleWrap: () => jn,
|
|
1463
|
+
undoInputRule: () => Mn,
|
|
1464
|
+
unsetAllMarks: () => Nn,
|
|
1465
|
+
unsetMark: () => Pn,
|
|
1466
|
+
unsetTextDirection: () => Fn,
|
|
1467
|
+
updateAttributes: () => In,
|
|
1468
|
+
updateDecorations: () => Ln,
|
|
1469
|
+
wrapIn: () => Rn,
|
|
1470
|
+
wrapInList: () => zn
|
|
1471
|
+
}), X = /* @__PURE__ */ new WeakMap();
|
|
1472
|
+
function Vn(e, t) {
|
|
1473
|
+
X.set(e, (X.get(e) ?? 0) + 1);
|
|
1466
1474
|
try {
|
|
1467
1475
|
return t();
|
|
1468
1476
|
} finally {
|
|
1469
|
-
let t = (
|
|
1470
|
-
t > 0 ?
|
|
1477
|
+
let t = (X.get(e) ?? 1) - 1;
|
|
1478
|
+
t > 0 ? X.set(e, t) : X.delete(e);
|
|
1471
1479
|
}
|
|
1472
1480
|
}
|
|
1473
|
-
function
|
|
1474
|
-
return
|
|
1481
|
+
function Hn(e) {
|
|
1482
|
+
return X.has(e);
|
|
1475
1483
|
}
|
|
1476
|
-
var
|
|
1484
|
+
var Un = class {
|
|
1477
1485
|
constructor() {
|
|
1478
1486
|
this.callbacks = {};
|
|
1479
1487
|
}
|
|
@@ -1497,44 +1505,44 @@ var Gn = class {
|
|
|
1497
1505
|
removeAllListeners() {
|
|
1498
1506
|
this.callbacks = {};
|
|
1499
1507
|
}
|
|
1500
|
-
},
|
|
1501
|
-
function
|
|
1508
|
+
}, Wn = typeof process < "u" && process.env.NODE_ENV !== "production";
|
|
1509
|
+
function Gn(e) {
|
|
1502
1510
|
return e.kind === "widget";
|
|
1503
1511
|
}
|
|
1504
|
-
function
|
|
1512
|
+
function Kn(e, t) {
|
|
1505
1513
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
1506
|
-
for (let i of e) i.kind === "widget" &&
|
|
1514
|
+
for (let i of e) i.kind === "widget" && Gn(i) && r.add(i.key), n.push(i.toPMDecoration(t));
|
|
1507
1515
|
return {
|
|
1508
1516
|
decorations: n,
|
|
1509
1517
|
widgetKeys: r
|
|
1510
1518
|
};
|
|
1511
1519
|
}
|
|
1512
|
-
function
|
|
1513
|
-
let { decorations: r, widgetKeys: i } =
|
|
1520
|
+
function qn(e, t, n) {
|
|
1521
|
+
let { decorations: r, widgetKeys: i } = Kn(t, n);
|
|
1514
1522
|
return {
|
|
1515
1523
|
set: C.create(e, r),
|
|
1516
1524
|
widgetKeys: i
|
|
1517
1525
|
};
|
|
1518
1526
|
}
|
|
1519
|
-
function
|
|
1527
|
+
function Jn({ position: e, from: t, to: n, docSize: r }) {
|
|
1520
1528
|
return e < t ? !1 : e < n || e === n && n === r;
|
|
1521
1529
|
}
|
|
1522
|
-
function
|
|
1523
|
-
return e.filter((e) =>
|
|
1530
|
+
function Yn({ decorations: e, from: t, to: n, docSize: r, extensionName: i, warnedExtensions: a }) {
|
|
1531
|
+
return e.filter((e) => Jn({
|
|
1524
1532
|
position: e.anchor,
|
|
1525
1533
|
from: t,
|
|
1526
1534
|
to: n,
|
|
1527
1535
|
docSize: r
|
|
1528
1536
|
}) ? !0 : (e.anchor === n || a.has(i) || (a.add(i), console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)), !1));
|
|
1529
1537
|
}
|
|
1530
|
-
function
|
|
1538
|
+
function Xn(e) {
|
|
1531
1539
|
let t = e.spec?.key;
|
|
1532
1540
|
return typeof t == "string" ? t : void 0;
|
|
1533
1541
|
}
|
|
1534
|
-
function
|
|
1542
|
+
function Zn(e) {
|
|
1535
1543
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
1536
1544
|
for (let r of e.find()) {
|
|
1537
|
-
let e =
|
|
1545
|
+
let e = Xn(r);
|
|
1538
1546
|
if (!e) continue;
|
|
1539
1547
|
let i = r.spec.extensionName ?? "unknown", a = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
1540
1548
|
a.add(i), t.set(e, a), n.set(e, (n.get(e) ?? 0) + 1);
|
|
@@ -1544,18 +1552,18 @@ function $n(e) {
|
|
|
1544
1552
|
extensions: t
|
|
1545
1553
|
})).filter(({ key: e }) => (n.get(e) ?? 0) > 1);
|
|
1546
1554
|
}
|
|
1547
|
-
function
|
|
1555
|
+
function Qn(e) {
|
|
1548
1556
|
return e.jsonID === "attr";
|
|
1549
1557
|
}
|
|
1550
|
-
function
|
|
1558
|
+
function $n(e) {
|
|
1551
1559
|
let t = !1;
|
|
1552
1560
|
if (e.getMap().forEach(() => {
|
|
1553
1561
|
t = !0;
|
|
1554
|
-
}), t ||
|
|
1562
|
+
}), t || Qn(e)) return !0;
|
|
1555
1563
|
let n = e;
|
|
1556
1564
|
return typeof n.from == "number" && typeof n.to == "number";
|
|
1557
1565
|
}
|
|
1558
|
-
function
|
|
1566
|
+
function er(e, t) {
|
|
1559
1567
|
let n = null, r = 0, i = 0;
|
|
1560
1568
|
for (let a = 0; a < e.childCount && !(i > t.to); a += 1) {
|
|
1561
1569
|
let o = i + e.child(a).nodeSize;
|
|
@@ -1566,11 +1574,11 @@ function nr(e, t) {
|
|
|
1566
1574
|
to: r
|
|
1567
1575
|
};
|
|
1568
1576
|
}
|
|
1569
|
-
function
|
|
1570
|
-
if (e.steps.some((e) =>
|
|
1571
|
-
let n =
|
|
1577
|
+
function tr(e, t) {
|
|
1578
|
+
if (e.steps.some((e) => !$n(e))) return { type: "full" };
|
|
1579
|
+
let n = Qt(e).map(({ newRange: e }) => e);
|
|
1572
1580
|
e.steps.forEach((t, r) => {
|
|
1573
|
-
if (!
|
|
1581
|
+
if (!Qn(t)) return;
|
|
1574
1582
|
let i = e.mapping.slice(r);
|
|
1575
1583
|
n.push({
|
|
1576
1584
|
from: i.map(t.pos, -1),
|
|
@@ -1579,7 +1587,7 @@ function rr(e, t) {
|
|
|
1579
1587
|
});
|
|
1580
1588
|
let r = [];
|
|
1581
1589
|
for (let e of n) {
|
|
1582
|
-
let n =
|
|
1590
|
+
let n = er(t, e);
|
|
1583
1591
|
n && r.push(n);
|
|
1584
1592
|
}
|
|
1585
1593
|
r.sort((e, t) => e.from - t.from);
|
|
@@ -1593,29 +1601,29 @@ function rr(e, t) {
|
|
|
1593
1601
|
ranges: i
|
|
1594
1602
|
};
|
|
1595
1603
|
}
|
|
1596
|
-
function
|
|
1604
|
+
function nr(e, t, n, r) {
|
|
1597
1605
|
return e.map(t, n, { onRemove: (e) => {
|
|
1598
1606
|
let t = e?.key;
|
|
1599
1607
|
typeof t == "string" && r.delete(t);
|
|
1600
1608
|
} });
|
|
1601
1609
|
}
|
|
1602
|
-
function
|
|
1610
|
+
function rr(e, t, n) {
|
|
1603
1611
|
let r = t.decorationSetsByExtension[e] ?? C.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
|
|
1604
1612
|
return {
|
|
1605
|
-
set:
|
|
1613
|
+
set: nr(r, n.mapping, n.doc, i),
|
|
1606
1614
|
widgetKeys: i
|
|
1607
1615
|
};
|
|
1608
1616
|
}
|
|
1609
|
-
function
|
|
1617
|
+
function ir(e, t) {
|
|
1610
1618
|
let n = Object.values(t).flatMap((e) => e.find());
|
|
1611
1619
|
return C.create(e, n);
|
|
1612
1620
|
}
|
|
1613
|
-
function
|
|
1621
|
+
function ar(e) {
|
|
1614
1622
|
let t = /* @__PURE__ */ new Set();
|
|
1615
1623
|
for (let n of Object.values(e)) for (let e of n) t.add(e);
|
|
1616
1624
|
return t;
|
|
1617
1625
|
}
|
|
1618
|
-
function
|
|
1626
|
+
function or(e, t) {
|
|
1619
1627
|
switch (t.update ?? "document") {
|
|
1620
1628
|
case "document":
|
|
1621
1629
|
if (t.createInRange) throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);
|
|
@@ -1630,21 +1638,21 @@ function cr(e, t) {
|
|
|
1630
1638
|
default: throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`);
|
|
1631
1639
|
}
|
|
1632
1640
|
}
|
|
1633
|
-
function
|
|
1641
|
+
function sr(e, t, n) {
|
|
1634
1642
|
return n ? !0 : e.update === "manual" ? !1 : e.shouldUpdate ? e.shouldUpdate(t) : t.tr.docChanged;
|
|
1635
1643
|
}
|
|
1636
|
-
var
|
|
1644
|
+
var cr = /* @__PURE__ */ new Set(), lr = class {
|
|
1637
1645
|
constructor(e) {
|
|
1638
1646
|
this.warnedWidgetKeys = /* @__PURE__ */ new Set(), this.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set(), this.handleBeforeTransaction = ({ nextState: e }) => {
|
|
1639
|
-
let t =
|
|
1647
|
+
let t = Y.getState(e);
|
|
1640
1648
|
t && this.warnDuplicateWidgetKeys(t);
|
|
1641
|
-
}, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) =>
|
|
1649
|
+
}, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) => or(e, t)), this.plugin = this.entries.length > 0 ? this.createPlugin() : null, this.editor.on("beforeTransaction", this.handleBeforeTransaction);
|
|
1642
1650
|
}
|
|
1643
1651
|
destroy() {
|
|
1644
1652
|
this.editor.off("beforeTransaction", this.handleBeforeTransaction);
|
|
1645
1653
|
}
|
|
1646
1654
|
liveWidgetKeys() {
|
|
1647
|
-
return
|
|
1655
|
+
return Y.getState(this.editor.state)?.widgetKeys ?? cr;
|
|
1648
1656
|
}
|
|
1649
1657
|
get mountedView() {
|
|
1650
1658
|
return this.editor.isDestroyed ? null : this.editor.view;
|
|
@@ -1662,8 +1670,8 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1662
1670
|
}
|
|
1663
1671
|
createPlugin() {
|
|
1664
1672
|
let { editor: e, entries: t } = this;
|
|
1665
|
-
return new
|
|
1666
|
-
key:
|
|
1673
|
+
return new v({
|
|
1674
|
+
key: Y,
|
|
1667
1675
|
state: {
|
|
1668
1676
|
init: (e, n) => {
|
|
1669
1677
|
let r = {}, i = {};
|
|
@@ -1675,22 +1683,22 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1675
1683
|
decorationSetsByExtension: r,
|
|
1676
1684
|
widgetKeysByExtension: i,
|
|
1677
1685
|
mergedDecorationSet: this.buildMergedSet(n.doc, r),
|
|
1678
|
-
widgetKeys:
|
|
1686
|
+
widgetKeys: ar(i)
|
|
1679
1687
|
};
|
|
1680
1688
|
return this.warnDuplicateWidgetKeys(a), a;
|
|
1681
1689
|
},
|
|
1682
1690
|
apply: (n, r, i, a) => {
|
|
1683
|
-
let o = n.getMeta(
|
|
1684
|
-
return
|
|
1691
|
+
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();
|
|
1692
|
+
return Vn(e, () => {
|
|
1685
1693
|
for (let { name: o, spec: f } of t) {
|
|
1686
1694
|
let t = s || c === o;
|
|
1687
|
-
if (!
|
|
1695
|
+
if (!sr(f, {
|
|
1688
1696
|
editor: e,
|
|
1689
1697
|
tr: n,
|
|
1690
1698
|
oldState: i,
|
|
1691
1699
|
newState: a
|
|
1692
1700
|
}, t)) {
|
|
1693
|
-
let e =
|
|
1701
|
+
let e = rr(o, r, n);
|
|
1694
1702
|
l[o] = e.set, u[o] = e.widgetKeys;
|
|
1695
1703
|
} else if (f.update === "changedRanges" && n.docChanged && !t) {
|
|
1696
1704
|
let e = this.applyChangedRangesRecompute(o, f, r, n, a);
|
|
@@ -1710,34 +1718,34 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1710
1718
|
decorationSetsByExtension: l,
|
|
1711
1719
|
recomputedNames: d
|
|
1712
1720
|
}),
|
|
1713
|
-
widgetKeys:
|
|
1721
|
+
widgetKeys: ar(u)
|
|
1714
1722
|
};
|
|
1715
1723
|
}
|
|
1716
1724
|
},
|
|
1717
1725
|
props: { decorations(e) {
|
|
1718
|
-
return
|
|
1726
|
+
return Y.getState(e)?.mergedDecorationSet ?? C.empty;
|
|
1719
1727
|
} }
|
|
1720
1728
|
});
|
|
1721
1729
|
}
|
|
1722
1730
|
applyChangedRangesRecompute(e, t, n, r, i) {
|
|
1723
|
-
let a =
|
|
1731
|
+
let a = tr(r, i.doc);
|
|
1724
1732
|
return a.type === "full" ? this.buildFullSet(e, t, i) : this.rebuildRanges(e, t, n, r, i, a.ranges);
|
|
1725
1733
|
}
|
|
1726
1734
|
rebuildRanges(e, t, n, r, i, a) {
|
|
1727
|
-
let o = n.decorationSetsByExtension[e] ?? C.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c =
|
|
1735
|
+
let o = n.decorationSetsByExtension[e] ?? C.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c = nr(o, r.mapping, r.doc, s), l = i.doc.content.size;
|
|
1728
1736
|
for (let { from: n, to: r } of a) {
|
|
1729
|
-
let a = c.find(n, r).filter((e) =>
|
|
1737
|
+
let a = c.find(n, r).filter((e) => Jn({
|
|
1730
1738
|
position: e.from,
|
|
1731
1739
|
from: n,
|
|
1732
1740
|
to: r,
|
|
1733
1741
|
docSize: l
|
|
1734
1742
|
}));
|
|
1735
1743
|
for (let e of a) {
|
|
1736
|
-
let t =
|
|
1744
|
+
let t = Xn(e);
|
|
1737
1745
|
t && s.delete(t);
|
|
1738
1746
|
}
|
|
1739
1747
|
c = c.remove(a);
|
|
1740
|
-
let { decorations: o, widgetKeys: u } =
|
|
1748
|
+
let { decorations: o, widgetKeys: u } = Kn(Yn({
|
|
1741
1749
|
decorations: this.runCreate(e, "createInRange", () => t.createInRange({
|
|
1742
1750
|
editor: this.editor,
|
|
1743
1751
|
state: i,
|
|
@@ -1765,7 +1773,7 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1765
1773
|
state: n,
|
|
1766
1774
|
view: this.mountedView
|
|
1767
1775
|
}));
|
|
1768
|
-
return
|
|
1776
|
+
return qn(n.doc, r, e);
|
|
1769
1777
|
}
|
|
1770
1778
|
runCreate(e, t, n) {
|
|
1771
1779
|
try {
|
|
@@ -1775,12 +1783,12 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1775
1783
|
}
|
|
1776
1784
|
}
|
|
1777
1785
|
warnDuplicateWidgetKeys(e) {
|
|
1778
|
-
if (!
|
|
1786
|
+
if (!Wn) return;
|
|
1779
1787
|
if (e.widgetKeys.size === 0) {
|
|
1780
1788
|
this.warnedWidgetKeys.clear();
|
|
1781
1789
|
return;
|
|
1782
1790
|
}
|
|
1783
|
-
let t =
|
|
1791
|
+
let t = Zn(e.mergedDecorationSet), n = new Set(t.map(({ key: e }) => e));
|
|
1784
1792
|
for (let { key: e, extensions: n } of t) {
|
|
1785
1793
|
if (this.warnedWidgetKeys.has(e)) continue;
|
|
1786
1794
|
let t = Array.from(n).map((e) => `"${e}"`).join(", ");
|
|
@@ -1790,15 +1798,15 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
|
1790
1798
|
}
|
|
1791
1799
|
buildMergedSet(e, t) {
|
|
1792
1800
|
let n = Object.keys(t);
|
|
1793
|
-
return n.length === 1 ? t[n[0]] :
|
|
1801
|
+
return n.length === 1 ? t[n[0]] : ir(e, t);
|
|
1794
1802
|
}
|
|
1795
1803
|
mergeAfterApply({ entries: e, previous: t, tr: n, decorationSetsByExtension: r, recomputedNames: i }) {
|
|
1796
|
-
return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) :
|
|
1804
|
+
return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) : ir(n.doc, r);
|
|
1797
1805
|
}
|
|
1798
1806
|
};
|
|
1799
|
-
function
|
|
1807
|
+
function ur(e, t) {
|
|
1800
1808
|
let { selection: n } = e, { $from: r } = n;
|
|
1801
|
-
if (n instanceof
|
|
1809
|
+
if (n instanceof _) {
|
|
1802
1810
|
let e = r.index();
|
|
1803
1811
|
return r.parent.canReplaceWith(e, e + 1, t);
|
|
1804
1812
|
}
|
|
@@ -1810,306 +1818,83 @@ function fr(e, t) {
|
|
|
1810
1818
|
}
|
|
1811
1819
|
return !1;
|
|
1812
1820
|
}
|
|
1813
|
-
function
|
|
1821
|
+
function dr(e, t, n) {
|
|
1814
1822
|
let r = document.querySelector(`style[data-tiptap-style${n ? `-${n}` : ""}]`);
|
|
1815
1823
|
if (r !== null) return r;
|
|
1816
1824
|
let i = document.createElement("style");
|
|
1817
1825
|
return t && i.setAttribute("nonce", t), i.setAttribute(`data-tiptap-style${n ? `-${n}` : ""}`, ""), i.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(i), i;
|
|
1818
1826
|
}
|
|
1819
|
-
function
|
|
1827
|
+
function fr(e) {
|
|
1820
1828
|
return typeof e == "number";
|
|
1821
1829
|
}
|
|
1822
|
-
function
|
|
1830
|
+
function pr(e) {
|
|
1823
1831
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
1824
1832
|
}
|
|
1825
|
-
function
|
|
1826
|
-
return
|
|
1827
|
-
}
|
|
1828
|
-
var gr = {};
|
|
1829
|
-
Se(gr, {
|
|
1830
|
-
createAtomBlockMarkdownSpec: () => yr,
|
|
1831
|
-
createBlockMarkdownSpec: () => br,
|
|
1832
|
-
createInlineMarkdownSpec: () => Cr,
|
|
1833
|
-
parseAttributes: () => _r,
|
|
1834
|
-
parseIndentedBlocks: () => wr,
|
|
1835
|
-
renderNestedMarkdownContent: () => Tr,
|
|
1836
|
-
serializeAttributes: () => vr
|
|
1837
|
-
});
|
|
1838
|
-
function _r(e) {
|
|
1839
|
-
if (!e?.trim()) return {};
|
|
1840
|
-
let t = {}, n = [], r = e.replace(/["']([^"']*)["']/g, (e) => (n.push(e), `__QUOTED_${n.length - 1}__`)), i = r.match(/(?:^|\s)\.([\w-]+)/g);
|
|
1841
|
-
i && (t.class = i.map((e) => e.trim().slice(1)).join(" "));
|
|
1842
|
-
let a = r.match(/(?:^|\s)#([\w-]+)/);
|
|
1843
|
-
a && (t.id = a[1]), Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([, e, r]) => {
|
|
1844
|
-
let i = parseInt(r.match(/__QUOTED_(\d+)__/)?.[1] || "0", 10), a = n[i];
|
|
1845
|
-
a && (t[e] = a.slice(1, -1));
|
|
1846
|
-
});
|
|
1847
|
-
let o = r.replace(/(?:^|\s)\.([\w-]+)/g, "").replace(/(?:^|\s)#([\w-]+)/g, "").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g, "").trim();
|
|
1848
|
-
return o && o.split(/\s+/).filter(Boolean).forEach((e) => {
|
|
1849
|
-
e.match(/^[a-zA-Z][\w-]*$/) && (t[e] = !0);
|
|
1850
|
-
}), t;
|
|
1851
|
-
}
|
|
1852
|
-
function vr(e) {
|
|
1853
|
-
if (!e || Object.keys(e).length === 0) return "";
|
|
1854
|
-
let t = [];
|
|
1855
|
-
return e.class && String(e.class).split(/\s+/).filter(Boolean).forEach((e) => t.push(`.${e}`)), e.id && t.push(`#${e.id}`), Object.entries(e).forEach(([e, n]) => {
|
|
1856
|
-
e !== "class" && e !== "id" && (n === !0 ? t.push(e) : n !== !1 && n != null && t.push(`${e}="${String(n)}"`));
|
|
1857
|
-
}), t.join(" ");
|
|
1858
|
-
}
|
|
1859
|
-
function yr(e) {
|
|
1860
|
-
let { nodeName: t, name: n, parseAttributes: r = _r, serializeAttributes: i = vr, defaultAttributes: a = {}, requiredAttributes: o = [], allowedAttributes: s } = e, c = n || t, l = (e) => {
|
|
1861
|
-
if (!s) return e;
|
|
1862
|
-
let t = {};
|
|
1863
|
-
return s.forEach((n) => {
|
|
1864
|
-
n in e && (t[n] = e[n]);
|
|
1865
|
-
}), t;
|
|
1866
|
-
};
|
|
1867
|
-
return {
|
|
1868
|
-
parseMarkdown: (e, n) => {
|
|
1869
|
-
let r = {
|
|
1870
|
-
...a,
|
|
1871
|
-
...e.attributes
|
|
1872
|
-
};
|
|
1873
|
-
return n.createNode(t, r, []);
|
|
1874
|
-
},
|
|
1875
|
-
markdownTokenizer: {
|
|
1876
|
-
name: t,
|
|
1877
|
-
level: "block",
|
|
1878
|
-
start(e) {
|
|
1879
|
-
let t = RegExp(`^:::${c}(?:\\s|$)`, "m"), n = e.match(t)?.index;
|
|
1880
|
-
return n === void 0 ? -1 : n;
|
|
1881
|
-
},
|
|
1882
|
-
tokenize(e, n, i) {
|
|
1883
|
-
let a = RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`), s = e.match(a);
|
|
1884
|
-
if (!s) return;
|
|
1885
|
-
let l = s[1] || "", u = r(l);
|
|
1886
|
-
if (!o.find((e) => !(e in u))) return {
|
|
1887
|
-
type: t,
|
|
1888
|
-
raw: s[0],
|
|
1889
|
-
attributes: u
|
|
1890
|
-
};
|
|
1891
|
-
}
|
|
1892
|
-
},
|
|
1893
|
-
renderMarkdown: (e) => {
|
|
1894
|
-
let t = l(e.attrs || {}), n = i(t), r = n ? ` {${n}}` : "";
|
|
1895
|
-
return `:::${c}${r} :::`;
|
|
1896
|
-
}
|
|
1897
|
-
};
|
|
1833
|
+
function Z(e) {
|
|
1834
|
+
return pr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
1898
1835
|
}
|
|
1899
|
-
function
|
|
1900
|
-
let { nodeName: t, name: n, getContent: r, parseAttributes: i = _r, serializeAttributes: a = vr, defaultAttributes: o = {}, content: s = "block", allowedAttributes: c } = e, l = n || t, u = (e) => {
|
|
1901
|
-
if (!c) return e;
|
|
1902
|
-
let t = {};
|
|
1903
|
-
return c.forEach((n) => {
|
|
1904
|
-
n in e && (t[n] = e[n]);
|
|
1905
|
-
}), t;
|
|
1906
|
-
};
|
|
1907
|
-
return {
|
|
1908
|
-
parseMarkdown: (e, n) => {
|
|
1909
|
-
let i;
|
|
1910
|
-
if (r) {
|
|
1911
|
-
let t = r(e);
|
|
1912
|
-
i = typeof t == "string" ? [{
|
|
1913
|
-
type: "text",
|
|
1914
|
-
text: t
|
|
1915
|
-
}] : t;
|
|
1916
|
-
} else i = s === "block" ? n.parseChildren(e.tokens || []) : n.parseInline(e.tokens || []);
|
|
1917
|
-
let a = {
|
|
1918
|
-
...o,
|
|
1919
|
-
...e.attributes
|
|
1920
|
-
};
|
|
1921
|
-
return n.createNode(t, a, i);
|
|
1922
|
-
},
|
|
1923
|
-
markdownTokenizer: {
|
|
1924
|
-
name: t,
|
|
1925
|
-
level: "block",
|
|
1926
|
-
start(e) {
|
|
1927
|
-
let t = RegExp(`^:::${l}`, "m"), n = e.match(t)?.index;
|
|
1928
|
-
return n === void 0 ? -1 : n;
|
|
1929
|
-
},
|
|
1930
|
-
tokenize(e, n, r) {
|
|
1931
|
-
let a = RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`), o = e.match(a);
|
|
1932
|
-
if (!o) return;
|
|
1933
|
-
let [c, u = ""] = o, d = i(u), f = 1, p = c.length, m = "", h = /^:::([\w-]*)(\s.*)?/gm, g = e.slice(p);
|
|
1934
|
-
for (h.lastIndex = 0;;) {
|
|
1935
|
-
let n = h.exec(g);
|
|
1936
|
-
if (n === null) break;
|
|
1937
|
-
let i = n.index, a = n[1];
|
|
1938
|
-
if (!n[2]?.endsWith(":::")) {
|
|
1939
|
-
if (a) f += 1;
|
|
1940
|
-
else if (--f, f === 0) {
|
|
1941
|
-
let a = g.slice(0, i);
|
|
1942
|
-
m = a.trim();
|
|
1943
|
-
let o = e.slice(0, p + i + n[0].length), c = [];
|
|
1944
|
-
if (m) {
|
|
1945
|
-
if (s === "block") for (c = r.blockTokens(a), c.forEach((e) => {
|
|
1946
|
-
e.text && (!e.tokens || e.tokens.length === 0) && (e.tokens = r.inlineTokens(e.text));
|
|
1947
|
-
}); c.length > 0;) {
|
|
1948
|
-
let e = c[c.length - 1];
|
|
1949
|
-
if (e.type === "paragraph" && (!e.text || e.text.trim() === "")) c.pop();
|
|
1950
|
-
else break;
|
|
1951
|
-
}
|
|
1952
|
-
else c = r.inlineTokens(m);
|
|
1953
|
-
}
|
|
1954
|
-
return {
|
|
1955
|
-
type: t,
|
|
1956
|
-
raw: o,
|
|
1957
|
-
attributes: d,
|
|
1958
|
-
content: m,
|
|
1959
|
-
tokens: c
|
|
1960
|
-
};
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
}
|
|
1965
|
-
},
|
|
1966
|
-
renderMarkdown: (e, t) => {
|
|
1967
|
-
let n = u(e.attrs || {}), r = a(n), i = r ? ` {${r}}` : "", o = t.renderChildren(e.content || [], "\n\n");
|
|
1968
|
-
return `:::${l}${i}
|
|
1969
|
-
|
|
1970
|
-
${o}
|
|
1971
|
-
|
|
1972
|
-
:::`;
|
|
1973
|
-
}
|
|
1974
|
-
};
|
|
1975
|
-
}
|
|
1976
|
-
function xr(e) {
|
|
1977
|
-
if (!e.trim()) return {};
|
|
1978
|
-
let t = {}, n = /(\w+)=(?:"([^"]*)"|'([^']*)')/g, r = n.exec(e);
|
|
1979
|
-
for (; r !== null;) {
|
|
1980
|
-
let [, i, a, o] = r;
|
|
1981
|
-
t[i] = a || o, r = n.exec(e);
|
|
1982
|
-
}
|
|
1983
|
-
return t;
|
|
1984
|
-
}
|
|
1985
|
-
function Sr(e) {
|
|
1986
|
-
return Object.entries(e).filter(([, e]) => e != null).map(([e, t]) => `${e}="${t}"`).join(" ");
|
|
1987
|
-
}
|
|
1988
|
-
function Cr(e) {
|
|
1989
|
-
let { nodeName: t, name: n, getContent: r, parseAttributes: i = xr, serializeAttributes: a = Sr, defaultAttributes: o = {}, selfClosing: s = !1, allowedAttributes: c } = e, l = n || t, u = (e) => {
|
|
1990
|
-
if (!c) return e;
|
|
1991
|
-
let t = {};
|
|
1992
|
-
return c.forEach((n) => {
|
|
1993
|
-
let r = typeof n == "string" ? n : n.name, i = typeof n == "string" ? void 0 : n.skipIfDefault;
|
|
1994
|
-
if (r in e) {
|
|
1995
|
-
let n = e[r];
|
|
1996
|
-
if (i !== void 0 && n === i) return;
|
|
1997
|
-
t[r] = n;
|
|
1998
|
-
}
|
|
1999
|
-
}), t;
|
|
2000
|
-
}, d = l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2001
|
-
return {
|
|
2002
|
-
parseMarkdown: (e, n) => {
|
|
2003
|
-
let i = {
|
|
2004
|
-
...o,
|
|
2005
|
-
...e.attributes
|
|
2006
|
-
};
|
|
2007
|
-
if (s) return n.createNode(t, i);
|
|
2008
|
-
let a = r ? r(e) : e.content || "";
|
|
2009
|
-
return a ? n.createNode(t, i, [n.createTextNode(a)]) : n.createNode(t, i, []);
|
|
2010
|
-
},
|
|
2011
|
-
markdownTokenizer: {
|
|
2012
|
-
name: t,
|
|
2013
|
-
level: "inline",
|
|
2014
|
-
start(e) {
|
|
2015
|
-
let t = RegExp(s ? `\\[${d}\\s*[^\\]]*\\]` : `\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`), n = e.match(t)?.index;
|
|
2016
|
-
return n === void 0 ? -1 : n;
|
|
2017
|
-
},
|
|
2018
|
-
tokenize(e, n, r) {
|
|
2019
|
-
let a = RegExp(s ? `^\\[${d}\\s*([^\\]]*)\\]` : `^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`), o = e.match(a);
|
|
2020
|
-
if (!o) return;
|
|
2021
|
-
let c = "", l = "";
|
|
2022
|
-
if (s) {
|
|
2023
|
-
let [, e] = o;
|
|
2024
|
-
l = e;
|
|
2025
|
-
} else {
|
|
2026
|
-
let [, e, t] = o;
|
|
2027
|
-
l = e, c = t || "";
|
|
2028
|
-
}
|
|
2029
|
-
let u = i(l.trim());
|
|
2030
|
-
return {
|
|
2031
|
-
type: t,
|
|
2032
|
-
raw: o[0],
|
|
2033
|
-
content: c.trim(),
|
|
2034
|
-
attributes: u
|
|
2035
|
-
};
|
|
2036
|
-
}
|
|
2037
|
-
},
|
|
2038
|
-
renderMarkdown: (e) => {
|
|
2039
|
-
let t = "";
|
|
2040
|
-
r ? t = r(e) : e.content && e.content.length > 0 && (t = e.content.filter((e) => e.type === "text").map((e) => e.text).join(""));
|
|
2041
|
-
let n = u(e.attrs || {}), i = a(n), o = i ? ` ${i}` : "";
|
|
2042
|
-
return s ? `[${l}${o}]` : `[${l}${o}]${t}[/${l}]`;
|
|
2043
|
-
}
|
|
2044
|
-
};
|
|
2045
|
-
}
|
|
2046
|
-
function wr(e, t, n) {
|
|
1836
|
+
function mr(e, t, n) {
|
|
2047
1837
|
let r = e.split("\n"), i = [], a = "", o = 0, s = t.baseIndentSize || 2;
|
|
2048
1838
|
for (; o < r.length;) {
|
|
2049
|
-
let e = r[o],
|
|
2050
|
-
if (!
|
|
1839
|
+
let e = r[o], u = e.match(t.itemPattern);
|
|
1840
|
+
if (!u) {
|
|
2051
1841
|
if (i.length > 0) break;
|
|
2052
1842
|
if (e.trim() === "") {
|
|
2053
|
-
o += 1, a = `${a}${e}
|
|
2054
|
-
`;
|
|
1843
|
+
o += 1, a = `${a}${e}\n`;
|
|
2055
1844
|
continue;
|
|
2056
1845
|
}
|
|
2057
1846
|
return;
|
|
2058
1847
|
}
|
|
2059
|
-
let
|
|
2060
|
-
a = `${a}${e}
|
|
2061
|
-
|
|
2062
|
-
let f = [d];
|
|
1848
|
+
let d = t.extractItemData(u), { indentLevel: f, mainContent: p } = d;
|
|
1849
|
+
a = `${a}${e}\n`;
|
|
1850
|
+
let m = [p];
|
|
2063
1851
|
for (o += 1; o < r.length;) {
|
|
1852
|
+
var c;
|
|
2064
1853
|
let e = r[o];
|
|
2065
1854
|
if (e.trim() === "") {
|
|
1855
|
+
var l;
|
|
2066
1856
|
let t = r.slice(o + 1).findIndex((e) => e.trim() !== "");
|
|
2067
1857
|
if (t === -1) break;
|
|
2068
|
-
if ((r[o + 1 + t].match(/^(\s*)/)
|
|
2069
|
-
|
|
2070
|
-
`, o += 1;
|
|
1858
|
+
if ((((l = r[o + 1 + t].match(/^(\s*)/)) == null || (l = l[1]) == null ? void 0 : l.length) || 0) > f) {
|
|
1859
|
+
m.push(e), a = `${a}${e}\n`, o += 1;
|
|
2071
1860
|
continue;
|
|
2072
1861
|
}
|
|
2073
1862
|
break;
|
|
2074
1863
|
}
|
|
2075
|
-
if ((e.match(/^(\s*)/)
|
|
2076
|
-
`, o += 1;
|
|
1864
|
+
if ((((c = e.match(/^(\s*)/)) == null || (c = c[1]) == null ? void 0 : c.length) || 0) > f) m.push(e), a = `${a}${e}\n`, o += 1;
|
|
2077
1865
|
else break;
|
|
2078
1866
|
}
|
|
2079
|
-
let
|
|
2080
|
-
if (
|
|
2081
|
-
let e =
|
|
2082
|
-
e.trim() && (
|
|
1867
|
+
let h, g = m.slice(1);
|
|
1868
|
+
if (g.length > 0) {
|
|
1869
|
+
let e = g.map((e) => e.slice(f + s)).join("\n");
|
|
1870
|
+
e.trim() && (h = t.customNestedParser ? t.customNestedParser(e) : n.blockTokens(e));
|
|
2083
1871
|
}
|
|
2084
|
-
let
|
|
2085
|
-
i.push(
|
|
1872
|
+
let _ = t.createToken(d, h);
|
|
1873
|
+
i.push(_);
|
|
2086
1874
|
}
|
|
2087
1875
|
if (i.length !== 0) return {
|
|
2088
1876
|
items: i,
|
|
2089
1877
|
raw: a
|
|
2090
1878
|
};
|
|
2091
1879
|
}
|
|
2092
|
-
function
|
|
1880
|
+
function hr(e, t, n, r) {
|
|
2093
1881
|
if (!e || !Array.isArray(e.content)) return "";
|
|
2094
1882
|
let i = typeof n == "function" ? n(r) : n, [a, ...o] = e.content, s = `${i}${t.renderChildren([a])}`;
|
|
2095
1883
|
return o && o.length > 0 && o.forEach((e, n) => {
|
|
2096
1884
|
let r = t.renderChild?.call(t, e, n + 1) ?? t.renderChildren([e]);
|
|
2097
1885
|
if (r != null) {
|
|
2098
1886
|
let n = r.split("\n").map((e) => e ? t.indent(e) : t.indent("")).join("\n");
|
|
2099
|
-
s += e.type === "paragraph" ? `
|
|
2100
|
-
|
|
2101
|
-
${n}` : `
|
|
2102
|
-
${n}`;
|
|
1887
|
+
s += e.type === "paragraph" ? `\n\n${n}` : `\n${n}`;
|
|
2103
1888
|
}
|
|
2104
1889
|
}), s;
|
|
2105
1890
|
}
|
|
2106
|
-
function
|
|
1891
|
+
function gr(e, t) {
|
|
2107
1892
|
let n = { ...e };
|
|
2108
|
-
return
|
|
2109
|
-
|
|
1893
|
+
return Z(e) && Z(t) && Object.keys(t).forEach((r) => {
|
|
1894
|
+
Z(t[r]) && Z(e[r]) ? n[r] = gr(e[r], t[r]) : n[r] = t[r];
|
|
2110
1895
|
}), n;
|
|
2111
1896
|
}
|
|
2112
|
-
function
|
|
1897
|
+
function _r(e, t, n = {}) {
|
|
2113
1898
|
let { state: r } = t, { doc: i, tr: a } = r, o = e;
|
|
2114
1899
|
i.descendants((t, r) => {
|
|
2115
1900
|
let i = a.mapping.map(r), s = a.mapping.map(r) + t.nodeSize, c = null;
|
|
@@ -2129,26 +1914,26 @@ function Dr(e, t, n = {}) {
|
|
|
2129
1914
|
}
|
|
2130
1915
|
}), a.docChanged && t.view.dispatch(a);
|
|
2131
1916
|
}
|
|
2132
|
-
var
|
|
1917
|
+
var Q = class {
|
|
2133
1918
|
constructor(e) {
|
|
2134
1919
|
this.find = e.find, this.handler = e.handler, this.undoable = e.undoable ?? !0;
|
|
2135
1920
|
}
|
|
2136
|
-
},
|
|
2137
|
-
if (
|
|
1921
|
+
}, vr = (e, t) => {
|
|
1922
|
+
if (Le(t)) return t.exec(e);
|
|
2138
1923
|
let n = t(e);
|
|
2139
1924
|
if (!n) return null;
|
|
2140
1925
|
let r = [n.text];
|
|
2141
1926
|
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;
|
|
2142
1927
|
};
|
|
2143
|
-
function
|
|
1928
|
+
function yr(e) {
|
|
2144
1929
|
let { editor: t, from: n, to: r, text: i, rules: a, plugin: o } = e, { view: s } = t;
|
|
2145
1930
|
if (s.composing) return !1;
|
|
2146
1931
|
let c = s.state.doc.resolve(n);
|
|
2147
1932
|
if (c.parent.type.spec.code || (c.nodeBefore || c.nodeAfter)?.marks.find((e) => e.type.spec.code)) return !1;
|
|
2148
|
-
let l = !1, u =
|
|
1933
|
+
let l = !1, u = nn(c) + i;
|
|
2149
1934
|
return a.forEach((e) => {
|
|
2150
1935
|
if (l) return;
|
|
2151
|
-
let a =
|
|
1936
|
+
let a = vr(u, e.find);
|
|
2152
1937
|
if (!a) return;
|
|
2153
1938
|
let d = a[0].length - i.length;
|
|
2154
1939
|
if (d > 0) {
|
|
@@ -2180,8 +1965,8 @@ function kr(e) {
|
|
|
2180
1965
|
}), s.dispatch(f), l = !0);
|
|
2181
1966
|
}), l;
|
|
2182
1967
|
}
|
|
2183
|
-
function
|
|
2184
|
-
let { editor: t, rules:
|
|
1968
|
+
function br(e) {
|
|
1969
|
+
let { editor: t, rules: n } = e, i = new v({
|
|
2185
1970
|
state: {
|
|
2186
1971
|
init() {
|
|
2187
1972
|
return null;
|
|
@@ -2192,50 +1977,50 @@ function Ar(e) {
|
|
|
2192
1977
|
let c = e.getMeta("applyInputRules");
|
|
2193
1978
|
return c && setTimeout(() => {
|
|
2194
1979
|
let { text: e } = c;
|
|
2195
|
-
e = typeof e == "string" ? e :
|
|
1980
|
+
e = typeof e == "string" ? e : jt(r.from(e), o.schema);
|
|
2196
1981
|
let { from: a } = c, s = a + e.length;
|
|
2197
|
-
|
|
1982
|
+
yr({
|
|
2198
1983
|
editor: t,
|
|
2199
1984
|
from: a,
|
|
2200
1985
|
to: s,
|
|
2201
1986
|
text: e,
|
|
2202
|
-
rules:
|
|
1987
|
+
rules: n,
|
|
2203
1988
|
plugin: i
|
|
2204
1989
|
});
|
|
2205
1990
|
}), e.selectionSet || e.docChanged ? null : a;
|
|
2206
1991
|
}
|
|
2207
1992
|
},
|
|
2208
1993
|
props: {
|
|
2209
|
-
handleTextInput(e,
|
|
2210
|
-
return
|
|
1994
|
+
handleTextInput(e, r, a, o) {
|
|
1995
|
+
return yr({
|
|
2211
1996
|
editor: t,
|
|
2212
|
-
from:
|
|
1997
|
+
from: r,
|
|
2213
1998
|
to: a,
|
|
2214
1999
|
text: o,
|
|
2215
|
-
rules:
|
|
2000
|
+
rules: n,
|
|
2216
2001
|
plugin: i
|
|
2217
2002
|
});
|
|
2218
2003
|
},
|
|
2219
2004
|
handleDOMEvents: { compositionend: (e) => (setTimeout(() => {
|
|
2220
|
-
let { $cursor:
|
|
2221
|
-
|
|
2005
|
+
let { $cursor: r } = e.state.selection;
|
|
2006
|
+
r && yr({
|
|
2222
2007
|
editor: t,
|
|
2223
|
-
from:
|
|
2224
|
-
to:
|
|
2008
|
+
from: r.pos,
|
|
2009
|
+
to: r.pos,
|
|
2225
2010
|
text: "",
|
|
2226
|
-
rules:
|
|
2011
|
+
rules: n,
|
|
2227
2012
|
plugin: i
|
|
2228
2013
|
});
|
|
2229
2014
|
}), !1) },
|
|
2230
|
-
handleKeyDown(e,
|
|
2231
|
-
if (
|
|
2015
|
+
handleKeyDown(e, r) {
|
|
2016
|
+
if (r.key !== "Enter") return !1;
|
|
2232
2017
|
let { $cursor: a } = e.state.selection;
|
|
2233
|
-
return a ?
|
|
2018
|
+
return a ? yr({
|
|
2234
2019
|
editor: t,
|
|
2235
2020
|
from: a.pos,
|
|
2236
2021
|
to: a.pos,
|
|
2237
2022
|
text: "\n",
|
|
2238
|
-
rules:
|
|
2023
|
+
rules: n,
|
|
2239
2024
|
plugin: i
|
|
2240
2025
|
}) : !1;
|
|
2241
2026
|
}
|
|
@@ -2244,7 +2029,7 @@ function Ar(e) {
|
|
|
2244
2029
|
});
|
|
2245
2030
|
return i;
|
|
2246
2031
|
}
|
|
2247
|
-
var
|
|
2032
|
+
var xr = class {
|
|
2248
2033
|
constructor(e = {}) {
|
|
2249
2034
|
this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = { name: this.name }, this.config = {
|
|
2250
2035
|
...this.config,
|
|
@@ -2252,10 +2037,10 @@ var jr = class {
|
|
|
2252
2037
|
}, this.name = this.config.name;
|
|
2253
2038
|
}
|
|
2254
2039
|
get options() {
|
|
2255
|
-
return { ...
|
|
2040
|
+
return { ...B(z(this, "addOptions", { name: this.name })) };
|
|
2256
2041
|
}
|
|
2257
2042
|
get storage() {
|
|
2258
|
-
return { ...
|
|
2043
|
+
return { ...B(z(this, "addStorage", {
|
|
2259
2044
|
name: this.name,
|
|
2260
2045
|
options: this.options
|
|
2261
2046
|
})) };
|
|
@@ -2263,7 +2048,7 @@ var jr = class {
|
|
|
2263
2048
|
configure(e = {}) {
|
|
2264
2049
|
let t = this.extend({
|
|
2265
2050
|
...this.config,
|
|
2266
|
-
addOptions: () =>
|
|
2051
|
+
addOptions: () => gr(this.options, e)
|
|
2267
2052
|
});
|
|
2268
2053
|
return t.name = this.name, t.parent = this.parent, this.child = null, t;
|
|
2269
2054
|
}
|
|
@@ -2274,9 +2059,9 @@ var jr = class {
|
|
|
2274
2059
|
});
|
|
2275
2060
|
return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
|
|
2276
2061
|
}
|
|
2277
|
-
},
|
|
2278
|
-
constructor() {
|
|
2279
|
-
super(...
|
|
2062
|
+
}, Sr = class e extends xr {
|
|
2063
|
+
constructor(...e) {
|
|
2064
|
+
super(...e), this.type = "mark";
|
|
2280
2065
|
}
|
|
2281
2066
|
static create(t = {}) {
|
|
2282
2067
|
let n = typeof t == "function" ? t() : t;
|
|
@@ -2299,29 +2084,30 @@ var jr = class {
|
|
|
2299
2084
|
let t = typeof e == "function" ? e() : e;
|
|
2300
2085
|
return super.extend(t);
|
|
2301
2086
|
}
|
|
2302
|
-
},
|
|
2087
|
+
}, Cr = class {
|
|
2303
2088
|
constructor(e) {
|
|
2304
2089
|
this.find = e.find, this.handler = e.handler;
|
|
2305
2090
|
}
|
|
2306
|
-
},
|
|
2307
|
-
if (
|
|
2091
|
+
}, wr = (e, t, n) => {
|
|
2092
|
+
if (Le(t)) return [...e.matchAll(t)];
|
|
2308
2093
|
let r = t(e, n);
|
|
2309
2094
|
return r ? r.map((t) => {
|
|
2310
2095
|
let n = [t.text];
|
|
2311
2096
|
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;
|
|
2312
2097
|
}) : [];
|
|
2313
2098
|
};
|
|
2314
|
-
function
|
|
2099
|
+
function Tr(e) {
|
|
2315
2100
|
let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new T({
|
|
2316
2101
|
editor: t,
|
|
2317
2102
|
state: n
|
|
2318
2103
|
}), d = [];
|
|
2319
2104
|
return n.doc.nodesBetween(r, i, (e, t) => {
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
p
|
|
2105
|
+
var f;
|
|
2106
|
+
if ((f = e.type) != null && (f = f.spec) != null && f.code || !(e.isText || e.isTextblock || e.isInline)) return;
|
|
2107
|
+
let p = e.content?.size ?? e.nodeSize ?? 0, m = Math.max(r, t), h = Math.min(i, t + p);
|
|
2108
|
+
m >= h || wr(e.isText ? e.text || "" : e.textBetween(m - t, h - t, void 0, ""), a.find, o).forEach((e) => {
|
|
2323
2109
|
if (e.index === void 0) return;
|
|
2324
|
-
let t =
|
|
2110
|
+
let t = m + e.index + 1, r = t + e[0].length, i = {
|
|
2325
2111
|
from: n.tr.mapping.map(t),
|
|
2326
2112
|
to: n.tr.mapping.map(r)
|
|
2327
2113
|
}, f = a.handler({
|
|
@@ -2338,13 +2124,13 @@ function Fr(e) {
|
|
|
2338
2124
|
});
|
|
2339
2125
|
}), d.every((e) => e !== null);
|
|
2340
2126
|
}
|
|
2341
|
-
var
|
|
2127
|
+
var Er = null, Dr = (e) => {
|
|
2342
2128
|
var t;
|
|
2343
2129
|
let n = new ClipboardEvent("paste", { clipboardData: new DataTransfer() });
|
|
2344
2130
|
return (t = n.clipboardData) == null || t.setData("text/html", e), n;
|
|
2345
2131
|
};
|
|
2346
|
-
function
|
|
2347
|
-
let { editor: t, rules:
|
|
2132
|
+
function Or(e) {
|
|
2133
|
+
let { editor: t, rules: n } = e, i = null, a = !1, o = !1, s = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
|
|
2348
2134
|
try {
|
|
2349
2135
|
c = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
2350
2136
|
} catch {
|
|
@@ -2355,7 +2141,7 @@ function Rr(e) {
|
|
|
2355
2141
|
state: e,
|
|
2356
2142
|
transaction: o
|
|
2357
2143
|
});
|
|
2358
|
-
if (!(!
|
|
2144
|
+
if (!(!Tr({
|
|
2359
2145
|
editor: t,
|
|
2360
2146
|
state: l,
|
|
2361
2147
|
from: Math.max(n - 1, 0),
|
|
@@ -2372,12 +2158,12 @@ function Rr(e) {
|
|
|
2372
2158
|
return s = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, o;
|
|
2373
2159
|
}
|
|
2374
2160
|
};
|
|
2375
|
-
return
|
|
2161
|
+
return n.map((e) => new v({
|
|
2376
2162
|
view(e) {
|
|
2377
2163
|
let n = (n) => {
|
|
2378
|
-
i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (
|
|
2164
|
+
i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (Er = t);
|
|
2379
2165
|
}, r = () => {
|
|
2380
|
-
|
|
2166
|
+
Er &&= null;
|
|
2381
2167
|
};
|
|
2382
2168
|
return window.addEventListener("dragstart", n), window.addEventListener("dragend", r), { destroy() {
|
|
2383
2169
|
window.removeEventListener("dragstart", n), window.removeEventListener("dragend", r);
|
|
@@ -2386,7 +2172,7 @@ function Rr(e) {
|
|
|
2386
2172
|
props: { handleDOMEvents: {
|
|
2387
2173
|
drop: (e, t) => {
|
|
2388
2174
|
if (o = i === e.dom.parentElement, c = t, !o) {
|
|
2389
|
-
let e =
|
|
2175
|
+
let e = Er;
|
|
2390
2176
|
e?.isEditable && setTimeout(() => {
|
|
2391
2177
|
let t = e.state.selection;
|
|
2392
2178
|
t && e.commands.deleteRange({
|
|
@@ -2402,23 +2188,23 @@ function Rr(e) {
|
|
|
2402
2188
|
return s = t, a = !!n?.includes("data-pm-slice"), !1;
|
|
2403
2189
|
}
|
|
2404
2190
|
} },
|
|
2405
|
-
appendTransaction: (t,
|
|
2191
|
+
appendTransaction: (t, n, i) => {
|
|
2406
2192
|
let c = t[0], u = c.getMeta("uiEvent") === "paste" && !a, d = c.getMeta("uiEvent") === "drop" && !o, f = c.getMeta("applyPasteRules"), p = !!f;
|
|
2407
2193
|
if (!u && !d && !p) return;
|
|
2408
2194
|
if (p) {
|
|
2409
2195
|
let { text: t } = f;
|
|
2410
|
-
t = typeof t == "string" ? t :
|
|
2411
|
-
let { from:
|
|
2196
|
+
t = typeof t == "string" ? t : jt(r.from(t), i.schema);
|
|
2197
|
+
let { from: n } = f, a = n + t.length, o = Dr(t);
|
|
2412
2198
|
return l({
|
|
2413
2199
|
rule: e,
|
|
2414
2200
|
state: i,
|
|
2415
|
-
from:
|
|
2201
|
+
from: n,
|
|
2416
2202
|
to: { b: a },
|
|
2417
2203
|
pasteEvt: o
|
|
2418
2204
|
});
|
|
2419
2205
|
}
|
|
2420
|
-
let m =
|
|
2421
|
-
if (!(!
|
|
2206
|
+
let m = n.doc.content.findDiffStart(i.doc.content), h = n.doc.content.findDiffEnd(i.doc.content);
|
|
2207
|
+
if (!(!fr(m) || !h || m === h.b)) return l({
|
|
2422
2208
|
rule: e,
|
|
2423
2209
|
state: i,
|
|
2424
2210
|
from: m,
|
|
@@ -2428,18 +2214,18 @@ function Rr(e) {
|
|
|
2428
2214
|
}
|
|
2429
2215
|
}));
|
|
2430
2216
|
}
|
|
2431
|
-
var
|
|
2217
|
+
var kr = class {
|
|
2432
2218
|
constructor(e, t) {
|
|
2433
|
-
this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions =
|
|
2219
|
+
this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions = Wt(e), this.schema = Ht(this.extensions, t), this.setupExtensions();
|
|
2434
2220
|
}
|
|
2435
2221
|
get commands() {
|
|
2436
2222
|
return this.extensions.reduce((e, t) => {
|
|
2437
|
-
let n =
|
|
2223
|
+
let n = z(t, "addCommands", {
|
|
2438
2224
|
name: t.name,
|
|
2439
2225
|
options: t.options,
|
|
2440
2226
|
storage: this.editor.extensionStorage[t.name],
|
|
2441
2227
|
editor: this.editor,
|
|
2442
|
-
type:
|
|
2228
|
+
type: W(t.name, this.schema)
|
|
2443
2229
|
});
|
|
2444
2230
|
return n ? {
|
|
2445
2231
|
...e,
|
|
@@ -2448,15 +2234,15 @@ var Q = class {
|
|
|
2448
2234
|
}, {});
|
|
2449
2235
|
}
|
|
2450
2236
|
get plugins() {
|
|
2451
|
-
let { editor: e } = this, t =
|
|
2237
|
+
let { editor: e } = this, t = U([...this.extensions].reverse()).flatMap((t) => {
|
|
2452
2238
|
let n = {
|
|
2453
2239
|
name: t.name,
|
|
2454
2240
|
options: t.options,
|
|
2455
2241
|
storage: this.editor.extensionStorage[t.name],
|
|
2456
2242
|
editor: e,
|
|
2457
|
-
type:
|
|
2458
|
-
}, r = [], i =
|
|
2459
|
-
if (t.type === "mark" &&
|
|
2243
|
+
type: W(t.name, this.schema)
|
|
2244
|
+
}, r = [], i = z(t, "addKeyboardShortcuts", n), a = {};
|
|
2245
|
+
if (t.type === "mark" && z(t, "exitable", n) && (a.ArrowRight = () => Sr.handleExit({
|
|
2460
2246
|
editor: e,
|
|
2461
2247
|
mark: t
|
|
2462
2248
|
})), i) {
|
|
@@ -2466,31 +2252,31 @@ var Q = class {
|
|
|
2466
2252
|
...t
|
|
2467
2253
|
};
|
|
2468
2254
|
}
|
|
2469
|
-
let o =
|
|
2255
|
+
let o = xe(a);
|
|
2470
2256
|
r.push(o);
|
|
2471
|
-
let s =
|
|
2472
|
-
if (
|
|
2257
|
+
let s = z(t, "addInputRules", n);
|
|
2258
|
+
if (sn(t, e.options.enableInputRules) && s) {
|
|
2473
2259
|
let t = s();
|
|
2474
2260
|
if (t && t.length) {
|
|
2475
|
-
let n =
|
|
2261
|
+
let n = br({
|
|
2476
2262
|
editor: e,
|
|
2477
2263
|
rules: t
|
|
2478
2264
|
}), i = Array.isArray(n) ? n : [n];
|
|
2479
2265
|
r.push(...i);
|
|
2480
2266
|
}
|
|
2481
2267
|
}
|
|
2482
|
-
let c =
|
|
2483
|
-
if (
|
|
2268
|
+
let c = z(t, "addPasteRules", n);
|
|
2269
|
+
if (sn(t, e.options.enablePasteRules) && c) {
|
|
2484
2270
|
let t = c();
|
|
2485
2271
|
if (t && t.length) {
|
|
2486
|
-
let n =
|
|
2272
|
+
let n = Or({
|
|
2487
2273
|
editor: e,
|
|
2488
2274
|
rules: t
|
|
2489
2275
|
});
|
|
2490
2276
|
r.push(...n);
|
|
2491
2277
|
}
|
|
2492
2278
|
}
|
|
2493
|
-
let l =
|
|
2279
|
+
let l = z(t, "addProseMirrorPlugins", n);
|
|
2494
2280
|
if (l) {
|
|
2495
2281
|
let e = l();
|
|
2496
2282
|
r.push(...e);
|
|
@@ -2505,29 +2291,29 @@ var Q = class {
|
|
|
2505
2291
|
(e = this.decorationManager) == null || e.destroy();
|
|
2506
2292
|
let n = [];
|
|
2507
2293
|
return this.extensions.forEach((e) => {
|
|
2508
|
-
let r =
|
|
2294
|
+
let r = z(e, "addDecorations", {
|
|
2509
2295
|
name: e.name,
|
|
2510
2296
|
options: e.options,
|
|
2511
2297
|
storage: this.editor.extensionStorage[e.name],
|
|
2512
2298
|
editor: t,
|
|
2513
|
-
type:
|
|
2299
|
+
type: W(e.name, this.schema)
|
|
2514
2300
|
});
|
|
2515
2301
|
r && n.push({
|
|
2516
2302
|
name: e.name,
|
|
2517
2303
|
addDecorations: r
|
|
2518
2304
|
});
|
|
2519
|
-
}), this.decorationManager = new
|
|
2305
|
+
}), this.decorationManager = new lr({
|
|
2520
2306
|
editor: t,
|
|
2521
2307
|
entries: n
|
|
2522
2308
|
}), this.decorationManager.plugin;
|
|
2523
2309
|
}
|
|
2524
2310
|
get attributes() {
|
|
2525
|
-
return
|
|
2311
|
+
return Pt(this.extensions);
|
|
2526
2312
|
}
|
|
2527
2313
|
get nodeViews() {
|
|
2528
|
-
let { editor: e } = this, { nodeExtensions: t } =
|
|
2529
|
-
return Object.fromEntries(t.filter((e) => !!
|
|
2530
|
-
let n = this.attributes.filter((e) => e.type === t.name), r =
|
|
2314
|
+
let { editor: e } = this, { nodeExtensions: t } = V(this.extensions);
|
|
2315
|
+
return Object.fromEntries(t.filter((e) => !!z(e, "addNodeView")).map((t) => {
|
|
2316
|
+
let n = this.attributes.filter((e) => e.type === t.name), r = z(t, "addNodeView", {
|
|
2531
2317
|
name: t.name,
|
|
2532
2318
|
options: t.options,
|
|
2533
2319
|
storage: this.editor.extensionStorage[t.name],
|
|
@@ -2537,7 +2323,7 @@ var Q = class {
|
|
|
2537
2323
|
if (!r) return [];
|
|
2538
2324
|
let i = r();
|
|
2539
2325
|
return i ? [t.name, (r, a, o, s, c) => {
|
|
2540
|
-
let l =
|
|
2326
|
+
let l = H(r, n);
|
|
2541
2327
|
return i({
|
|
2542
2328
|
node: r,
|
|
2543
2329
|
view: a,
|
|
@@ -2553,14 +2339,14 @@ var Q = class {
|
|
|
2553
2339
|
}
|
|
2554
2340
|
dispatchTransaction(e) {
|
|
2555
2341
|
let { editor: t } = this;
|
|
2556
|
-
return
|
|
2342
|
+
return U([...this.extensions].reverse()).reduceRight((e, n) => {
|
|
2557
2343
|
let r = {
|
|
2558
2344
|
name: n.name,
|
|
2559
2345
|
options: n.options,
|
|
2560
2346
|
storage: this.editor.extensionStorage[n.name],
|
|
2561
2347
|
editor: t,
|
|
2562
|
-
type:
|
|
2563
|
-
}, i =
|
|
2348
|
+
type: W(n.name, this.schema)
|
|
2349
|
+
}, i = z(n, "dispatchTransaction", r);
|
|
2564
2350
|
return i ? (t) => {
|
|
2565
2351
|
i.call(r, {
|
|
2566
2352
|
transaction: t,
|
|
@@ -2571,14 +2357,14 @@ var Q = class {
|
|
|
2571
2357
|
}
|
|
2572
2358
|
transformPastedHTML(e) {
|
|
2573
2359
|
let { editor: t } = this;
|
|
2574
|
-
return
|
|
2360
|
+
return U([...this.extensions]).reduce((e, n) => {
|
|
2575
2361
|
let r = {
|
|
2576
2362
|
name: n.name,
|
|
2577
2363
|
options: n.options,
|
|
2578
2364
|
storage: this.editor.extensionStorage[n.name],
|
|
2579
2365
|
editor: t,
|
|
2580
|
-
type:
|
|
2581
|
-
}, i =
|
|
2366
|
+
type: W(n.name, this.schema)
|
|
2367
|
+
}, i = z(n, "transformPastedHTML", r);
|
|
2582
2368
|
return i ? (t, n) => {
|
|
2583
2369
|
let a = e(t, n);
|
|
2584
2370
|
return i.call(r, a);
|
|
@@ -2586,17 +2372,17 @@ var Q = class {
|
|
|
2586
2372
|
}, e || ((e) => e));
|
|
2587
2373
|
}
|
|
2588
2374
|
get markViews() {
|
|
2589
|
-
let { editor: e } = this, { markExtensions: t } =
|
|
2590
|
-
return Object.fromEntries(t.filter((e) => !!
|
|
2591
|
-
let n = this.attributes.filter((e) => e.type === t.name), r =
|
|
2375
|
+
let { editor: e } = this, { markExtensions: t } = V(this.extensions);
|
|
2376
|
+
return Object.fromEntries(t.filter((e) => !!z(e, "addMarkView")).map((t) => {
|
|
2377
|
+
let n = this.attributes.filter((e) => e.type === t.name), r = z(t, "addMarkView", {
|
|
2592
2378
|
name: t.name,
|
|
2593
2379
|
options: t.options,
|
|
2594
2380
|
storage: this.editor.extensionStorage[t.name],
|
|
2595
2381
|
editor: e,
|
|
2596
|
-
type:
|
|
2382
|
+
type: k(t.name, this.schema)
|
|
2597
2383
|
});
|
|
2598
2384
|
return r ? [t.name, (i, a, o) => {
|
|
2599
|
-
let s =
|
|
2385
|
+
let s = H(i, n);
|
|
2600
2386
|
return r()({
|
|
2601
2387
|
mark: i,
|
|
2602
2388
|
view: a,
|
|
@@ -2605,7 +2391,7 @@ var Q = class {
|
|
|
2605
2391
|
extension: t,
|
|
2606
2392
|
HTMLAttributes: s,
|
|
2607
2393
|
updateAttributes: (t) => {
|
|
2608
|
-
|
|
2394
|
+
_r(i, e, t);
|
|
2609
2395
|
}
|
|
2610
2396
|
});
|
|
2611
2397
|
}] : [];
|
|
@@ -2629,32 +2415,18 @@ var Q = class {
|
|
|
2629
2415
|
options: e.options,
|
|
2630
2416
|
storage: this.editor.extensionStorage[e.name],
|
|
2631
2417
|
editor: this.editor,
|
|
2632
|
-
type:
|
|
2418
|
+
type: W(e.name, this.schema)
|
|
2633
2419
|
};
|
|
2634
|
-
e.type === "mark" && ((
|
|
2635
|
-
let n =
|
|
2420
|
+
e.type === "mark" && ((B(z(e, "keepOnSplit", t)) ?? !0) && this.splittableMarks.push(e.name), (B(z(e, "clearable", t)) ?? !0) || this.nonClearableMarks.push(e.name));
|
|
2421
|
+
let n = z(e, "onBeforeCreate", t), r = z(e, "onCreate", t), i = z(e, "onUpdate", t), a = z(e, "onSelectionUpdate", t), o = z(e, "onTransaction", t), s = z(e, "onFocus", t), c = z(e, "onBlur", t), l = z(e, "onDestroy", t);
|
|
2636
2422
|
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);
|
|
2637
2423
|
});
|
|
2638
2424
|
}
|
|
2639
2425
|
};
|
|
2640
|
-
|
|
2641
|
-
var
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
Commands: () => Vr,
|
|
2645
|
-
Delete: () => Hr,
|
|
2646
|
-
Drop: () => Ur,
|
|
2647
|
-
Editable: () => Wr,
|
|
2648
|
-
FocusEvents: () => Kr,
|
|
2649
|
-
Keymap: () => qr,
|
|
2650
|
-
Paste: () => Jr,
|
|
2651
|
-
Tabindex: () => Yr,
|
|
2652
|
-
TextDirection: () => Xr,
|
|
2653
|
-
focusEventsPluginKey: () => Gr
|
|
2654
|
-
});
|
|
2655
|
-
var $ = class e extends jr {
|
|
2656
|
-
constructor() {
|
|
2657
|
-
super(...arguments), this.type = "extension";
|
|
2426
|
+
kr.resolve = Wt, kr.sort = U, kr.flatten = At;
|
|
2427
|
+
var $ = class e extends xr {
|
|
2428
|
+
constructor(...e) {
|
|
2429
|
+
super(...e), this.type = "extension";
|
|
2658
2430
|
}
|
|
2659
2431
|
static create(t = {}) {
|
|
2660
2432
|
let n = typeof t == "function" ? t() : t;
|
|
@@ -2667,61 +2439,62 @@ var $ = class e extends jr {
|
|
|
2667
2439
|
let t = typeof e == "function" ? e() : e;
|
|
2668
2440
|
return super.extend(t);
|
|
2669
2441
|
}
|
|
2670
|
-
},
|
|
2442
|
+
}, Ar = $.create({
|
|
2671
2443
|
name: "clipboardTextSerializer",
|
|
2672
2444
|
addOptions() {
|
|
2673
2445
|
return { blockSeparator: void 0 };
|
|
2674
2446
|
},
|
|
2675
2447
|
addProseMirrorPlugins() {
|
|
2676
|
-
return [new
|
|
2677
|
-
key: new
|
|
2448
|
+
return [new v({
|
|
2449
|
+
key: new y("clipboardTextSerializer"),
|
|
2678
2450
|
props: { clipboardTextSerializer: () => {
|
|
2679
|
-
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a =
|
|
2451
|
+
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a = qt(n), { blockSeparator: o } = this.options, s = {
|
|
2680
2452
|
...o === void 0 ? {} : { blockSeparator: o },
|
|
2681
2453
|
textSerializers: a
|
|
2682
2454
|
};
|
|
2683
|
-
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) =>
|
|
2455
|
+
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) => Gt(r, {
|
|
2684
2456
|
from: e.pos,
|
|
2685
2457
|
to: t.pos
|
|
2686
2458
|
}, s)).join(o ?? "\n\n");
|
|
2687
2459
|
} }
|
|
2688
2460
|
})];
|
|
2689
2461
|
}
|
|
2690
|
-
}),
|
|
2462
|
+
}), jr = $.create({
|
|
2691
2463
|
name: "commands",
|
|
2692
2464
|
addCommands() {
|
|
2693
|
-
return { ...
|
|
2465
|
+
return { ...Bn };
|
|
2694
2466
|
}
|
|
2695
|
-
}),
|
|
2467
|
+
}), Mr = $.create({
|
|
2696
2468
|
name: "delete",
|
|
2697
2469
|
onUpdate({ transaction: e, appendedTransactions: t }) {
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2470
|
+
var n;
|
|
2471
|
+
let r = () => {
|
|
2472
|
+
var n, r;
|
|
2473
|
+
if (((n = this.editor.options.coreExtensionOptions) == null || (n = n.delete) == null || (r = n.filterTransaction) == null ? void 0 : r.call(n, e)) ?? e.getMeta("y-sync$")) return;
|
|
2474
|
+
let i = Dt(e.before, [e, ...t]);
|
|
2475
|
+
Qt(i).forEach((t) => {
|
|
2476
|
+
i.mapping.mapResult(t.oldRange.from).deletedAfter && i.mapping.mapResult(t.oldRange.to).deletedBefore && i.before.nodesBetween(t.oldRange.from, t.oldRange.to, (n, r) => {
|
|
2477
|
+
let a = r + n.nodeSize - 2, o = t.oldRange.from <= r && a <= t.oldRange.to;
|
|
2705
2478
|
this.editor.emit("delete", {
|
|
2706
2479
|
type: "node",
|
|
2707
2480
|
node: n,
|
|
2708
|
-
from:
|
|
2481
|
+
from: r,
|
|
2709
2482
|
to: a,
|
|
2710
|
-
newFrom:
|
|
2711
|
-
newTo:
|
|
2483
|
+
newFrom: i.mapping.map(r),
|
|
2484
|
+
newTo: i.mapping.map(a),
|
|
2712
2485
|
deletedRange: t.oldRange,
|
|
2713
2486
|
newRange: t.newRange,
|
|
2714
2487
|
partial: !o,
|
|
2715
2488
|
editor: this.editor,
|
|
2716
2489
|
transaction: e,
|
|
2717
|
-
combinedTransform:
|
|
2490
|
+
combinedTransform: i
|
|
2718
2491
|
});
|
|
2719
2492
|
});
|
|
2720
2493
|
});
|
|
2721
|
-
let
|
|
2722
|
-
|
|
2723
|
-
if (t instanceof
|
|
2724
|
-
let
|
|
2494
|
+
let a = i.mapping;
|
|
2495
|
+
i.steps.forEach((t, n) => {
|
|
2496
|
+
if (t instanceof o) {
|
|
2497
|
+
let r = a.slice(n).map(t.from, -1), o = a.slice(n).map(t.to), s = a.invert().map(r, -1), c = a.invert().map(o), l = r > 0 && i.doc.nodeAt(r - 1)?.marks.some((e) => e.eq(t.mark)), u = i.doc.nodeAt(o)?.marks.some((e) => e.eq(t.mark));
|
|
2725
2498
|
this.editor.emit("delete", {
|
|
2726
2499
|
type: "mark",
|
|
2727
2500
|
mark: t.mark,
|
|
@@ -2732,24 +2505,24 @@ var $ = class e extends jr {
|
|
|
2732
2505
|
to: c
|
|
2733
2506
|
},
|
|
2734
2507
|
newRange: {
|
|
2735
|
-
from:
|
|
2508
|
+
from: r,
|
|
2736
2509
|
to: o
|
|
2737
2510
|
},
|
|
2738
2511
|
partial: !!(u || l),
|
|
2739
2512
|
editor: this.editor,
|
|
2740
2513
|
transaction: e,
|
|
2741
|
-
combinedTransform:
|
|
2514
|
+
combinedTransform: i
|
|
2742
2515
|
});
|
|
2743
2516
|
}
|
|
2744
2517
|
});
|
|
2745
2518
|
};
|
|
2746
|
-
this.editor.options.coreExtensionOptions
|
|
2519
|
+
((n = this.editor.options.coreExtensionOptions) == null || (n = n.delete) == null ? void 0 : n.async) ?? !0 ? setTimeout(r, 0) : r();
|
|
2747
2520
|
}
|
|
2748
|
-
}),
|
|
2521
|
+
}), Nr = $.create({
|
|
2749
2522
|
name: "drop",
|
|
2750
2523
|
addProseMirrorPlugins() {
|
|
2751
|
-
return [new
|
|
2752
|
-
key: new
|
|
2524
|
+
return [new v({
|
|
2525
|
+
key: new y("tiptapDrop"),
|
|
2753
2526
|
props: { handleDrop: (e, t, n, r) => {
|
|
2754
2527
|
this.editor.emit("drop", {
|
|
2755
2528
|
editor: this.editor,
|
|
@@ -2760,20 +2533,20 @@ var $ = class e extends jr {
|
|
|
2760
2533
|
} }
|
|
2761
2534
|
})];
|
|
2762
2535
|
}
|
|
2763
|
-
}),
|
|
2536
|
+
}), Pr = $.create({
|
|
2764
2537
|
name: "editable",
|
|
2765
2538
|
addProseMirrorPlugins() {
|
|
2766
|
-
return [new
|
|
2767
|
-
key: new
|
|
2539
|
+
return [new v({
|
|
2540
|
+
key: new y("editable"),
|
|
2768
2541
|
props: { editable: () => this.editor.options.editable }
|
|
2769
2542
|
})];
|
|
2770
2543
|
}
|
|
2771
|
-
}),
|
|
2544
|
+
}), Fr = new y("focusEvents"), Ir = $.create({
|
|
2772
2545
|
name: "focusEvents",
|
|
2773
2546
|
addProseMirrorPlugins() {
|
|
2774
2547
|
let { editor: e } = this;
|
|
2775
|
-
return [new
|
|
2776
|
-
key:
|
|
2548
|
+
return [new v({
|
|
2549
|
+
key: Fr,
|
|
2777
2550
|
props: { handleDOMEvents: {
|
|
2778
2551
|
focus: (t, n) => {
|
|
2779
2552
|
e.isFocused = !0;
|
|
@@ -2788,13 +2561,13 @@ var $ = class e extends jr {
|
|
|
2788
2561
|
} }
|
|
2789
2562
|
})];
|
|
2790
2563
|
}
|
|
2791
|
-
}),
|
|
2564
|
+
}), Lr = $.create({
|
|
2792
2565
|
name: "keymap",
|
|
2793
2566
|
addKeyboardShortcuts() {
|
|
2794
2567
|
let e = () => this.editor.commands.first(({ commands: e }) => [
|
|
2795
2568
|
() => e.undoInputRule(),
|
|
2796
2569
|
() => e.command(({ tr: t }) => {
|
|
2797
|
-
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 :
|
|
2570
|
+
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 : b.atStart(r).from === o;
|
|
2798
2571
|
return !i || !s.type.isTextblock || s.textContent.length || !d || d && a.parent.type.name === "paragraph" ? !1 : e.clearNodes();
|
|
2799
2572
|
}),
|
|
2800
2573
|
() => e.deleteSelection(),
|
|
@@ -2830,17 +2603,17 @@ var $ = class e extends jr {
|
|
|
2830
2603
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
2831
2604
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
2832
2605
|
};
|
|
2833
|
-
return
|
|
2606
|
+
return M() || lt() ? i : r;
|
|
2834
2607
|
},
|
|
2835
2608
|
addProseMirrorPlugins() {
|
|
2836
|
-
return [new
|
|
2837
|
-
key: new
|
|
2609
|
+
return [new v({
|
|
2610
|
+
key: new y("clearDocument"),
|
|
2838
2611
|
appendTransaction: (e, t, n) => {
|
|
2839
2612
|
if (e.some((e) => e.getMeta("composition"))) return;
|
|
2840
2613
|
let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = e.some((e) => e.getMeta("preventClearDocument"));
|
|
2841
2614
|
if (!r || i) return;
|
|
2842
|
-
let { empty: a, from: o, to: s } = t.selection, c =
|
|
2843
|
-
if (a || o !== c || s !== l || !
|
|
2615
|
+
let { empty: a, from: o, to: s } = t.selection, c = b.atStart(t.doc).from, l = b.atEnd(t.doc).to;
|
|
2616
|
+
if (a || o !== c || s !== l || !J(n.doc)) return;
|
|
2844
2617
|
let u = n.tr, d = w({
|
|
2845
2618
|
state: n,
|
|
2846
2619
|
transaction: u
|
|
@@ -2852,11 +2625,11 @@ var $ = class e extends jr {
|
|
|
2852
2625
|
}
|
|
2853
2626
|
})];
|
|
2854
2627
|
}
|
|
2855
|
-
}),
|
|
2628
|
+
}), Rr = $.create({
|
|
2856
2629
|
name: "paste",
|
|
2857
2630
|
addProseMirrorPlugins() {
|
|
2858
|
-
return [new
|
|
2859
|
-
key: new
|
|
2631
|
+
return [new v({
|
|
2632
|
+
key: new y("tiptapPaste"),
|
|
2860
2633
|
props: { handlePaste: (e, t, n) => {
|
|
2861
2634
|
this.editor.emit("paste", {
|
|
2862
2635
|
editor: this.editor,
|
|
@@ -2866,25 +2639,25 @@ var $ = class e extends jr {
|
|
|
2866
2639
|
} }
|
|
2867
2640
|
})];
|
|
2868
2641
|
}
|
|
2869
|
-
}),
|
|
2642
|
+
}), zr = $.create({
|
|
2870
2643
|
name: "tabindex",
|
|
2871
2644
|
addOptions() {
|
|
2872
2645
|
return { value: void 0 };
|
|
2873
2646
|
},
|
|
2874
2647
|
addProseMirrorPlugins() {
|
|
2875
|
-
return [new
|
|
2876
|
-
key: new
|
|
2648
|
+
return [new v({
|
|
2649
|
+
key: new y("tabindex"),
|
|
2877
2650
|
props: { attributes: () => !this.editor.isEditable && this.options.value === void 0 ? {} : { tabindex: this.options.value ?? "0" } }
|
|
2878
2651
|
})];
|
|
2879
2652
|
}
|
|
2880
|
-
}),
|
|
2653
|
+
}), Br = $.create({
|
|
2881
2654
|
name: "textDirection",
|
|
2882
2655
|
addOptions() {
|
|
2883
2656
|
return { direction: void 0 };
|
|
2884
2657
|
},
|
|
2885
2658
|
addGlobalAttributes() {
|
|
2886
2659
|
if (!this.options.direction) return [];
|
|
2887
|
-
let { nodeExtensions: e } =
|
|
2660
|
+
let { nodeExtensions: e } = V(this.extensions);
|
|
2888
2661
|
return [{
|
|
2889
2662
|
types: e.filter((e) => e.name !== "text").map((e) => e.name),
|
|
2890
2663
|
attributes: { dir: {
|
|
@@ -2898,36 +2671,36 @@ var $ = class e extends jr {
|
|
|
2898
2671
|
}];
|
|
2899
2672
|
},
|
|
2900
2673
|
addProseMirrorPlugins() {
|
|
2901
|
-
return [new
|
|
2902
|
-
key: new
|
|
2674
|
+
return [new v({
|
|
2675
|
+
key: new y("textDirection"),
|
|
2903
2676
|
props: { attributes: () => {
|
|
2904
2677
|
let e = this.options.direction;
|
|
2905
2678
|
return e ? { dir: e } : {};
|
|
2906
2679
|
} }
|
|
2907
2680
|
})];
|
|
2908
2681
|
}
|
|
2909
|
-
}),
|
|
2910
|
-
function
|
|
2911
|
-
if (
|
|
2912
|
-
|
|
2682
|
+
}), Vr = !1;
|
|
2683
|
+
function Hr(e) {
|
|
2684
|
+
if (Vr) return;
|
|
2685
|
+
Vr = !0;
|
|
2913
2686
|
let t;
|
|
2914
2687
|
try {
|
|
2915
|
-
t =
|
|
2688
|
+
t = c.fromJSON(e, {
|
|
2916
2689
|
from: 0,
|
|
2917
2690
|
to: 0
|
|
2918
2691
|
}).slice.content;
|
|
2919
2692
|
} catch {
|
|
2920
2693
|
return;
|
|
2921
2694
|
}
|
|
2922
|
-
t instanceof
|
|
2695
|
+
t instanceof r || 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.");
|
|
2923
2696
|
}
|
|
2924
|
-
var
|
|
2925
|
-
constructor(e, t, n = !1, r = null) {
|
|
2926
|
-
this.currentNode = null, this.actualDepth = null, this.isBlock = n, this.resolvedPos = e, this.editor = t, this.currentNode = r;
|
|
2927
|
-
}
|
|
2697
|
+
var Ur = class e {
|
|
2928
2698
|
get name() {
|
|
2929
2699
|
return this.node.type.name;
|
|
2930
2700
|
}
|
|
2701
|
+
constructor(e, t, n = !1, r = null) {
|
|
2702
|
+
this.currentNode = null, this.actualDepth = null, this.isBlock = n, this.resolvedPos = e, this.editor = t, this.currentNode = r;
|
|
2703
|
+
}
|
|
2931
2704
|
get node() {
|
|
2932
2705
|
return this.currentNode || this.resolvedPos.node();
|
|
2933
2706
|
}
|
|
@@ -2947,7 +2720,7 @@ var $r = class e {
|
|
|
2947
2720
|
let t = this.from, n = this.to;
|
|
2948
2721
|
if (this.isBlock) {
|
|
2949
2722
|
if (this.content.size === 0) {
|
|
2950
|
-
console.error(`You can
|
|
2723
|
+
console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);
|
|
2951
2724
|
return;
|
|
2952
2725
|
}
|
|
2953
2726
|
t = this.from + 1, n = this.to - 1;
|
|
@@ -3043,7 +2816,7 @@ var $r = class e {
|
|
|
3043
2816
|
...e
|
|
3044
2817
|
}), this.editor.view.dispatch(t);
|
|
3045
2818
|
}
|
|
3046
|
-
},
|
|
2819
|
+
}, Wr = ".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}", Gr = class extends Un {
|
|
3047
2820
|
constructor(e = {}) {
|
|
3048
2821
|
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 = {
|
|
3049
2822
|
element: typeof document < "u" ? document.createElement("div") : null,
|
|
@@ -3080,19 +2853,19 @@ var $r = class e {
|
|
|
3080
2853
|
onDelete: () => null,
|
|
3081
2854
|
enableExtensionDispatchTransaction: !0
|
|
3082
2855
|
}, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
|
|
3083
|
-
getUpdatedPosition:
|
|
3084
|
-
createMappablePosition:
|
|
2856
|
+
getUpdatedPosition: un,
|
|
2857
|
+
createMappablePosition: dn
|
|
3085
2858
|
}, 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);
|
|
3086
2859
|
let t = this.createDoc();
|
|
3087
2860
|
if (!this.editorState) {
|
|
3088
|
-
let e =
|
|
3089
|
-
this.editorState =
|
|
2861
|
+
let e = j(t, this.options.autofocus);
|
|
2862
|
+
this.editorState = g.create({
|
|
3090
2863
|
doc: t,
|
|
3091
2864
|
schema: this.schema,
|
|
3092
2865
|
selection: e || void 0
|
|
3093
2866
|
});
|
|
3094
2867
|
}
|
|
3095
|
-
|
|
2868
|
+
Hr(this.schema), this.options.element && this.mount(this.options.element);
|
|
3096
2869
|
}
|
|
3097
2870
|
mount(e) {
|
|
3098
2871
|
if (typeof document > "u") throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");
|
|
@@ -3126,7 +2899,7 @@ var $r = class e {
|
|
|
3126
2899
|
return this.commandManager ? this.commandManager.can() : T.createFallbackCan();
|
|
3127
2900
|
}
|
|
3128
2901
|
injectCSS() {
|
|
3129
|
-
this.options.injectCSS && typeof document < "u" && (this.css =
|
|
2902
|
+
this.options.injectCSS && typeof document < "u" && (this.css = dr(Wr, this.options.injectNonce));
|
|
3130
2903
|
}
|
|
3131
2904
|
setOptions(e = {}) {
|
|
3132
2905
|
this.options = {
|
|
@@ -3165,10 +2938,10 @@ var $r = class e {
|
|
|
3165
2938
|
} });
|
|
3166
2939
|
}
|
|
3167
2940
|
get state() {
|
|
3168
|
-
return
|
|
2941
|
+
return Wn && !this.hasWarnedStaleDecorationRead && Hn(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;
|
|
3169
2942
|
}
|
|
3170
2943
|
registerPlugin(e, t) {
|
|
3171
|
-
let n =
|
|
2944
|
+
let n = Mt(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
|
|
3172
2945
|
return this.view.updateState(r), r;
|
|
3173
2946
|
}
|
|
3174
2947
|
unregisterPlugin(e) {
|
|
@@ -3182,23 +2955,24 @@ var $r = class e {
|
|
|
3182
2955
|
return this.view.updateState(r), r;
|
|
3183
2956
|
}
|
|
3184
2957
|
createExtensionManager() {
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
2958
|
+
var e, t;
|
|
2959
|
+
let n = [...this.options.enableCoreExtensions ? [
|
|
2960
|
+
Pr,
|
|
2961
|
+
Ar.configure({ blockSeparator: (e = this.options.coreExtensionOptions) == null || (e = e.clipboardTextSerializer) == null ? void 0 : e.blockSeparator }),
|
|
2962
|
+
jr,
|
|
2963
|
+
Ir,
|
|
2964
|
+
Lr,
|
|
2965
|
+
zr.configure({ value: (t = this.options.coreExtensionOptions) == null || (t = t.tabindex) == null ? void 0 : t.value }),
|
|
2966
|
+
Nr,
|
|
2967
|
+
Rr,
|
|
2968
|
+
Mr,
|
|
2969
|
+
Br.configure({ direction: this.options.textDirection })
|
|
3196
2970
|
].filter((e) => typeof this.options.enableCoreExtensions != "object" || this.options.enableCoreExtensions[e.name] !== !1) : [], ...this.options.extensions].filter((e) => [
|
|
3197
2971
|
"extension",
|
|
3198
2972
|
"node",
|
|
3199
2973
|
"mark"
|
|
3200
2974
|
].includes(e?.type));
|
|
3201
|
-
this.extensionManager = new
|
|
2975
|
+
this.extensionManager = new kr(n, this);
|
|
3202
2976
|
}
|
|
3203
2977
|
createCommandManager() {
|
|
3204
2978
|
this.commandManager = new T({ editor: this });
|
|
@@ -3209,14 +2983,14 @@ var $r = class e {
|
|
|
3209
2983
|
createDoc() {
|
|
3210
2984
|
let e;
|
|
3211
2985
|
try {
|
|
3212
|
-
e =
|
|
2986
|
+
e = L(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
3213
2987
|
} catch (e) {
|
|
3214
2988
|
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) throw e;
|
|
3215
|
-
let t =
|
|
3216
|
-
return this.editorState =
|
|
2989
|
+
let t = L(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
2990
|
+
return this.editorState = g.create({
|
|
3217
2991
|
doc: t,
|
|
3218
2992
|
schema: this.schema,
|
|
3219
|
-
selection:
|
|
2993
|
+
selection: j(t, this.options.autofocus) || void 0
|
|
3220
2994
|
}), this.emit("contentError", {
|
|
3221
2995
|
editor: this,
|
|
3222
2996
|
error: e,
|
|
@@ -3229,7 +3003,7 @@ var $r = class e {
|
|
|
3229
3003
|
}
|
|
3230
3004
|
createView(e) {
|
|
3231
3005
|
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);
|
|
3232
|
-
this.editorView = new
|
|
3006
|
+
this.editorView = new be(e, {
|
|
3233
3007
|
...t,
|
|
3234
3008
|
attributes: {
|
|
3235
3009
|
role: "textbox",
|
|
@@ -3300,30 +3074,30 @@ var $r = class e {
|
|
|
3300
3074
|
});
|
|
3301
3075
|
}
|
|
3302
3076
|
getAttributes(e) {
|
|
3303
|
-
return
|
|
3077
|
+
return Yt(this.state, e);
|
|
3304
3078
|
}
|
|
3305
3079
|
isActive(e, t) {
|
|
3306
3080
|
let n = typeof e == "string" ? e : null, r = typeof e == "string" ? t : e;
|
|
3307
|
-
return
|
|
3081
|
+
return rn(this.state, n, r);
|
|
3308
3082
|
}
|
|
3309
3083
|
getJSON() {
|
|
3310
3084
|
return this.state.doc.toJSON();
|
|
3311
3085
|
}
|
|
3312
3086
|
getHTML() {
|
|
3313
|
-
return
|
|
3087
|
+
return jt(this.state.doc.content, this.schema);
|
|
3314
3088
|
}
|
|
3315
3089
|
getText(e) {
|
|
3316
3090
|
let { blockSeparator: t = "\n\n", textSerializers: n = {} } = e || {};
|
|
3317
|
-
return
|
|
3091
|
+
return Kt(this.state.doc, {
|
|
3318
3092
|
blockSeparator: t,
|
|
3319
3093
|
textSerializers: {
|
|
3320
|
-
...
|
|
3094
|
+
...qt(this.schema),
|
|
3321
3095
|
...n
|
|
3322
3096
|
}
|
|
3323
3097
|
});
|
|
3324
3098
|
}
|
|
3325
3099
|
get isEmpty() {
|
|
3326
|
-
return
|
|
3100
|
+
return J(this.state.doc);
|
|
3327
3101
|
}
|
|
3328
3102
|
destroy() {
|
|
3329
3103
|
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 = {});
|
|
@@ -3339,22 +3113,22 @@ var $r = class e {
|
|
|
3339
3113
|
}
|
|
3340
3114
|
$pos(e) {
|
|
3341
3115
|
let t = this.state.doc.resolve(e), n = e > 0 && t.nodeAfter && !t.nodeAfter.isText && t.nodeAfter.isAtom ? t.nodeAfter : null;
|
|
3342
|
-
return new
|
|
3116
|
+
return new Ur(t, this, !1, n);
|
|
3343
3117
|
}
|
|
3344
3118
|
get $doc() {
|
|
3345
3119
|
return this.$pos(0);
|
|
3346
3120
|
}
|
|
3347
3121
|
};
|
|
3348
|
-
function
|
|
3349
|
-
return new
|
|
3122
|
+
function Kr(e) {
|
|
3123
|
+
return new Q({
|
|
3350
3124
|
find: e.find,
|
|
3351
3125
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3352
|
-
let i =
|
|
3126
|
+
let i = B(e.getAttributes, void 0, r);
|
|
3353
3127
|
if (i === !1 || i === null) return null;
|
|
3354
3128
|
let { tr: a } = t, o = r[r.length - 1], s = r[0];
|
|
3355
3129
|
if (o) {
|
|
3356
3130
|
let r = s.search(/\S/), c = n.from + s.indexOf(o), l = c + o.length;
|
|
3357
|
-
if (
|
|
3131
|
+
if ($t(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;
|
|
3358
3132
|
l < n.to && a.delete(l, n.to), c > n.from && a.delete(n.from + r, c);
|
|
3359
3133
|
let u = n.from + r + o.length;
|
|
3360
3134
|
a.addMark(n.from + r, u, e.type.create(i || {})), a.removeStoredMark(e.type);
|
|
@@ -3363,11 +3137,11 @@ function ni(e) {
|
|
|
3363
3137
|
undoable: e.undoable
|
|
3364
3138
|
});
|
|
3365
3139
|
}
|
|
3366
|
-
function
|
|
3367
|
-
return new
|
|
3140
|
+
function qr(e) {
|
|
3141
|
+
return new Q({
|
|
3368
3142
|
find: e.find,
|
|
3369
3143
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3370
|
-
let i =
|
|
3144
|
+
let i = B(e.getAttributes, void 0, r) || {}, { tr: a } = t, o = n.from, s = n.to, c = e.type.create(i);
|
|
3371
3145
|
if (r[1]) {
|
|
3372
3146
|
let e = o + r[0].lastIndexOf(r[1]);
|
|
3373
3147
|
e > s ? e = s : s = e + r[1].length;
|
|
@@ -3382,22 +3156,22 @@ function ri(e) {
|
|
|
3382
3156
|
undoable: e.undoable
|
|
3383
3157
|
});
|
|
3384
3158
|
}
|
|
3385
|
-
function
|
|
3386
|
-
return new
|
|
3159
|
+
function Jr(e) {
|
|
3160
|
+
return new Q({
|
|
3387
3161
|
find: e.find,
|
|
3388
3162
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3389
|
-
let i = t.doc.resolve(n.from), a =
|
|
3163
|
+
let i = t.doc.resolve(n.from), a = B(e.getAttributes, void 0, r) || {};
|
|
3390
3164
|
if (!i.node(-1).canReplaceWith(i.index(-1), i.indexAfter(-1), e.type)) return null;
|
|
3391
3165
|
t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, a);
|
|
3392
3166
|
},
|
|
3393
3167
|
undoable: e.undoable
|
|
3394
3168
|
});
|
|
3395
3169
|
}
|
|
3396
|
-
function
|
|
3397
|
-
return new
|
|
3170
|
+
function Yr(e) {
|
|
3171
|
+
return new Q({
|
|
3398
3172
|
find: e.find,
|
|
3399
3173
|
handler: ({ state: t, range: n, match: r, chain: i }) => {
|
|
3400
|
-
let a =
|
|
3174
|
+
let a = B(e.getAttributes, void 0, r) || {}, o = t.tr.delete(n.from, n.to), s = o.doc.resolve(n.from).blockRange(), c = s && f(s, e.type, a);
|
|
3401
3175
|
if (!c) return null;
|
|
3402
3176
|
if (o.wrap(s, c), e.keepMarks && e.editor) {
|
|
3403
3177
|
let { selection: n, storedMarks: r } = t, { splittableMarks: i } = e.editor.extensionManager, a = r || n.$to.parentOffset && n.$from.marks();
|
|
@@ -3410,15 +3184,15 @@ function ai(e) {
|
|
|
3410
3184
|
let t = e.type.name === "bulletList" || e.type.name === "orderedList" ? "listItem" : "taskList";
|
|
3411
3185
|
i().updateAttributes(t, a).run();
|
|
3412
3186
|
}
|
|
3413
|
-
let
|
|
3414
|
-
|
|
3187
|
+
let l = o.doc.resolve(n.from - 1).nodeBefore;
|
|
3188
|
+
l && l.type === e.type && u(o.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, l)) && o.join(n.from - 1);
|
|
3415
3189
|
},
|
|
3416
3190
|
undoable: e.undoable
|
|
3417
3191
|
});
|
|
3418
3192
|
}
|
|
3419
|
-
var
|
|
3420
|
-
constructor() {
|
|
3421
|
-
super(...
|
|
3193
|
+
var Xr = class e extends xr {
|
|
3194
|
+
constructor(...e) {
|
|
3195
|
+
super(...e), this.type = "node";
|
|
3422
3196
|
}
|
|
3423
3197
|
static create(t = {}) {
|
|
3424
3198
|
let n = typeof t == "function" ? t() : t;
|
|
@@ -3432,22 +3206,22 @@ var oi = class e extends jr {
|
|
|
3432
3206
|
return super.extend(t);
|
|
3433
3207
|
}
|
|
3434
3208
|
};
|
|
3435
|
-
function
|
|
3436
|
-
return new
|
|
3209
|
+
function Zr(e) {
|
|
3210
|
+
return new Cr({
|
|
3437
3211
|
find: e.find,
|
|
3438
3212
|
handler: ({ state: t, range: n, match: r, pasteEvent: i }) => {
|
|
3439
|
-
let a =
|
|
3213
|
+
let a = B(e.getAttributes, void 0, r, i);
|
|
3440
3214
|
if (a === !1 || a === null) return null;
|
|
3441
3215
|
let { tr: o } = t, s = r[r.length - 1], c = r[0], l = n.to;
|
|
3442
3216
|
if (s) {
|
|
3443
3217
|
let i = c.search(/\S/), u = n.from + c.indexOf(s), d = u + s.length;
|
|
3444
|
-
if (
|
|
3218
|
+
if ($t(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;
|
|
3445
3219
|
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);
|
|
3446
3220
|
}
|
|
3447
3221
|
}
|
|
3448
3222
|
});
|
|
3449
3223
|
}
|
|
3450
3224
|
//#endregion
|
|
3451
|
-
export { T as CommandManager,
|
|
3225
|
+
export { T as CommandManager, Y as DECORATION_MANAGER_PLUGIN_KEY, lr as DecorationManager, Gr as Editor, xr as Extendable, $ as Extension, Q as InputRule, ln as MappablePosition, Sr as Mark, Xr as Node, Ur as NodePos, Cr as PasteRule, B as callOrReturn, ur as canInsertNode, Dt as combineTransactionSteps, Bn as commands, w as createChainableState, L as createDocument, dn as createMappablePosition, P as createNodeFromContent, dr as createStyleTag, $e as defaultBlockAt, gt as deleteProps, N as elementFromString, Ot as findChildrenInRange, Ut as findDuplicates, R as findParentNode, kt as findParentNodeClosestToPos, At as flattenExtensions, Rt as fromString, Yt as getAttributes, Pt as getAttributesFromExtensions, Qt as getChangedRanges, z as getExtensionField, jt as getHTMLFromFragment, Et as getMarkAttributes, O as getMarkRange, k as getMarkType, $t as getMarksBetween, en as getNodeAtPosition, Jt as getNodeAttributes, E as getNodeType, tn as getPreviousBlockSibling, H as getRenderedAttributes, Ht as getSchemaByResolvedExtensions, W as getSchemaTypeByName, I as getSchemaTypeNameByName, G as getSplittedAttributes, Kt as getText, Gt as getTextBetween, nn as getTextContentFromNodes, qt as getTextSerializersFromSchema, un as getUpdatedPosition, zt as injectExtensionAttributesToParseRule, br as inputRulesPlugin, rn as isActive, Ue as isAndroid, an as isAtEndOfNode, on as isAtStartOfNode, Nt as isEmptyObject, sn as isExtensionRulesEnabled, Mt as isFunction, q as isList, lt as isMacOS, K as isMarkActive, F as isNodeActive, J as isNodeEmpty, cn as isNodeSelection, fr as isNumber, Z as isPlainObject, Le as isRegExp, We as isSafari, He as isTextSelection, M as isiOS, Kr as markInputRule, Zr as markPasteRule, Lt as mergeAttributes, gr as mergeDeep, A as minMax, qr as nodeInputRule, D as objectIncludes, mr as parseIndentedBlocks, Or as pasteRulesPlugin, Xt as removeDuplicates, hr as renderNestedMarkdownContent, Wt as resolveExtensions, j as resolveFocusPosition, Ze as selectionToInsertionEnd, U as sortExtensions, V as splitExtensions, Jr as textblockTypeInputRule, _r as updateMarkViewAttributes, Yr as wrappingInputRule };
|
|
3452
3226
|
|
|
3453
3227
|
//# sourceMappingURL=index.js.map
|