@clevertask/scribe 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -0
- package/dist/{BarMenu-O2IVhHXx.js → BarMenu-x4sf3ECS.js} +1 -1
- package/dist/components/Menu/BarMenu.js +1 -1
- package/dist/components/Menu/BubbleMenu.js +2 -2
- package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
- package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts +13 -0
- package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts.map +1 -0
- package/dist/components/Menu/ExternalLinkDisplayOptions.js +90 -0
- package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/LinkBubbleMenu.js +161 -61
- package/dist/components/Menu/LinkEditor.d.ts +9 -0
- package/dist/components/Menu/LinkEditor.d.ts.map +1 -1
- package/dist/components/Menu/LinkEditor.js +117 -64
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +2 -2
- package/dist/components/Menu/contextualMenuOwner.d.ts +1 -1
- package/dist/components/Menu/contextualMenuOwner.d.ts.map +1 -1
- package/dist/components/Menu/contextualMenuOwner.js +9 -6
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts +24 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.js +43 -6
- package/dist/components/Scribe/extension/callout.js +1 -1
- package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/attributes.d.ts +18 -0
- package/dist/components/Scribe/extension/external-link-preview/attributes.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/attributes.js +82 -0
- package/dist/components/Scribe/extension/external-link-preview/commands.d.ts +53 -0
- package/dist/components/Scribe/extension/external-link-preview/commands.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/commands.js +134 -0
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts +13 -0
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/index.js +140 -0
- package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts +3 -0
- package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/node-view.js +97 -0
- package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts +7 -0
- package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/normalization.js +21 -0
- package/dist/components/Scribe/extension/external-link-preview/paste.d.ts +9 -0
- package/dist/components/Scribe/extension/external-link-preview/paste.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/paste.js +54 -0
- package/dist/components/Scribe/extension/external-link-preview/policy.d.ts +7 -0
- package/dist/components/Scribe/extension/external-link-preview/policy.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/policy.js +38 -0
- package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts +7 -0
- package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/render-html.js +62 -0
- package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts +23 -0
- package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/resolver.js +118 -0
- package/dist/components/Scribe/extension/external-link-preview/serialization.d.ts +10 -0
- package/dist/components/Scribe/extension/external-link-preview/serialization.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/serialization.js +69 -0
- package/dist/components/Scribe/extension/external-link-preview/types.d.ts +58 -0
- package/dist/components/Scribe/extension/external-link-preview/types.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/types.js +4 -0
- package/dist/components/Scribe/extension/index.d.ts +1 -1
- package/dist/components/Scribe/extension/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/index.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/extension/tableOfContents.js +1 -1
- package/dist/components/Scribe/index.d.ts +14 -0
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +5 -5
- package/dist/{dist-BoYfa2nz.js → dist-DDjaA1Pn.js} +309 -150
- package/dist/{dist-W9E-K577.js → dist-tNcpTcFT.js} +738 -637
- package/dist/{extension-D5WIAWhc.js → extension-dRUfQQo6.js} +1940 -1938
- package/dist/{extension-link-D8Zi7OSa.js → extension-link-RYtPpHwt.js} +28 -27
- package/dist/{html-to-markdown-C920nQtn.js → html-to-markdown-nbQ6qHyO.js} +173 -162
- package/dist/main.css +148 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +12 -9
- package/dist/{markdown-to-html-CW0Nb9Ye.js → markdown-to-html-B-KKCZRs.js} +115 -111
- package/dist/{menus-B1Zz0GjH.js → menus-U2HdvQnu.js} +11 -11
- package/dist/{resizable-table-Bf-fb9iv.js → resizable-table-m0AzovsZ.js} +14 -14
- package/dist/{slashCommand-47omO4ob.js → slashCommand-CtvgnL0Z.js} +1 -1
- package/dist/utils/create-scribe-editor.d.ts +4 -1
- package/dist/utils/create-scribe-editor.d.ts.map +1 -1
- package/dist/utils/html-to-markdown.d.ts.map +1 -1
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.js +7 -7
- package/dist/utils/markdown-to-html.d.ts.map +1 -1
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { RemoveMarkStep as e, ReplaceAroundStep as t, ReplaceStep as n, Transform as r, canJoin as i, canSplit as a, findWrapping as o, joinPoint as s, liftTarget as c } from "@tiptap/pm/transform";
|
|
2
2
|
import { createParagraphNear as l, exitCode as u, joinBackward as d, joinDown as f, joinForward as p, joinTextblockBackward as m, joinTextblockForward as h, joinUp as g, lift as ee, liftEmptyBlock as te, newlineInCode as _, selectNodeBackward as ne, selectNodeForward as v, selectParentNode as re, selectTextblockEnd as ie, selectTextblockStart as y, setBlockType as b, wrapIn as x } from "@tiptap/pm/commands";
|
|
3
|
-
import { AllSelection as ae, EditorState as oe, NodeSelection as
|
|
4
|
-
import { DOMParser as
|
|
5
|
-
import { liftListItem as
|
|
6
|
-
import { DecorationSet as
|
|
7
|
-
import { keymap as
|
|
3
|
+
import { AllSelection as ae, EditorState as oe, NodeSelection as S, Plugin as C, PluginKey as w, Selection as T, TextSelection as E } from "@tiptap/pm/state";
|
|
4
|
+
import { DOMParser as se, DOMSerializer as ce, Fragment as D, Schema as le, Slice as ue } from "@tiptap/pm/model";
|
|
5
|
+
import { liftListItem as de, sinkListItem as fe, wrapInList as pe } from "@tiptap/pm/schema-list";
|
|
6
|
+
import { DecorationSet as O, EditorView as me } from "@tiptap/pm/view";
|
|
7
|
+
import { keymap as he } from "@tiptap/pm/keymap";
|
|
8
8
|
//#region node_modules/.pnpm/@tiptap+core@3.30.1_@tiptap+pm@3.30.1/node_modules/@tiptap/core/dist/index.js
|
|
9
|
-
var
|
|
10
|
-
for (var n in t)
|
|
9
|
+
var ge = Object.defineProperty, _e = (e, t) => {
|
|
10
|
+
for (var n in t) ge(e, n, {
|
|
11
11
|
get: t[n],
|
|
12
12
|
enumerable: !0
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
function
|
|
15
|
+
function k(e) {
|
|
16
16
|
let { state: t, transaction: n } = e, { selection: r } = n, { doc: i } = n, { storedMarks: a } = n;
|
|
17
17
|
return {
|
|
18
18
|
...t,
|
|
@@ -36,7 +36,7 @@ function O(e) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
var
|
|
39
|
+
var A = class {
|
|
40
40
|
constructor(e) {
|
|
41
41
|
this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
|
|
42
42
|
}
|
|
@@ -84,7 +84,7 @@ var k = class {
|
|
|
84
84
|
tr: e,
|
|
85
85
|
editor: r,
|
|
86
86
|
view: a,
|
|
87
|
-
state:
|
|
87
|
+
state: k({
|
|
88
88
|
state: i,
|
|
89
89
|
transaction: e
|
|
90
90
|
}),
|
|
@@ -97,75 +97,75 @@ var k = class {
|
|
|
97
97
|
};
|
|
98
98
|
return o;
|
|
99
99
|
}
|
|
100
|
-
},
|
|
101
|
-
ve
|
|
102
|
-
blur: () =>
|
|
103
|
-
clearContent: () =>
|
|
104
|
-
clearNodes: () =>
|
|
105
|
-
command: () =>
|
|
106
|
-
createParagraphNear: () =>
|
|
107
|
-
cut: () =>
|
|
108
|
-
deleteCurrentNode: () =>
|
|
109
|
-
deleteNode: () =>
|
|
110
|
-
deleteRange: () =>
|
|
111
|
-
deleteSelection: () =>
|
|
112
|
-
enter: () =>
|
|
113
|
-
exitCode: () =>
|
|
114
|
-
extendMarkRange: () =>
|
|
115
|
-
first: () =>
|
|
116
|
-
focus: () =>
|
|
117
|
-
forEach: () =>
|
|
118
|
-
insertContent: () =>
|
|
119
|
-
insertContentAt: () =>
|
|
120
|
-
insertDefaultBlock: () =>
|
|
121
|
-
joinBackward: () =>
|
|
122
|
-
joinDown: () =>
|
|
123
|
-
joinForward: () =>
|
|
124
|
-
joinItemBackward: () =>
|
|
125
|
-
joinItemForward: () =>
|
|
126
|
-
joinTextblockBackward: () =>
|
|
127
|
-
joinTextblockForward: () =>
|
|
128
|
-
joinUp: () =>
|
|
129
|
-
keyboardShortcut: () =>
|
|
130
|
-
lift: () =>
|
|
131
|
-
liftEmptyBlock: () =>
|
|
132
|
-
liftListItem: () =>
|
|
133
|
-
newlineInCode: () =>
|
|
134
|
-
resetAttributes: () =>
|
|
135
|
-
scrollIntoView: () =>
|
|
136
|
-
selectAll: () =>
|
|
137
|
-
selectNodeBackward: () =>
|
|
138
|
-
selectNodeForward: () =>
|
|
139
|
-
selectParentNode: () =>
|
|
140
|
-
selectTextblockEnd: () =>
|
|
141
|
-
selectTextblockStart: () =>
|
|
142
|
-
setContent: () =>
|
|
143
|
-
setMark: () =>
|
|
144
|
-
setMeta: () =>
|
|
145
|
-
setNode: () =>
|
|
146
|
-
setNodeSelection: () =>
|
|
147
|
-
setTextDirection: () =>
|
|
148
|
-
setTextSelection: () =>
|
|
149
|
-
sinkListItem: () =>
|
|
150
|
-
splitBlock: () =>
|
|
151
|
-
splitListItem: () =>
|
|
152
|
-
toggleList: () =>
|
|
153
|
-
toggleMark: () =>
|
|
154
|
-
toggleNode: () =>
|
|
155
|
-
toggleWrap: () =>
|
|
156
|
-
undoInputRule: () =>
|
|
157
|
-
unsetAllMarks: () =>
|
|
158
|
-
unsetMark: () =>
|
|
159
|
-
unsetTextDirection: () =>
|
|
160
|
-
updateAttributes: () =>
|
|
161
|
-
updateDecorations: () =>
|
|
162
|
-
wrapIn: () =>
|
|
163
|
-
wrapInList: () =>
|
|
100
|
+
}, ve = {};
|
|
101
|
+
_e(ve, {
|
|
102
|
+
blur: () => ye,
|
|
103
|
+
clearContent: () => be,
|
|
104
|
+
clearNodes: () => xe,
|
|
105
|
+
command: () => Se,
|
|
106
|
+
createParagraphNear: () => Ce,
|
|
107
|
+
cut: () => we,
|
|
108
|
+
deleteCurrentNode: () => Te,
|
|
109
|
+
deleteNode: () => Ee,
|
|
110
|
+
deleteRange: () => De,
|
|
111
|
+
deleteSelection: () => je,
|
|
112
|
+
enter: () => Me,
|
|
113
|
+
exitCode: () => Ne,
|
|
114
|
+
extendMarkRange: () => Le,
|
|
115
|
+
first: () => Re,
|
|
116
|
+
focus: () => Ue,
|
|
117
|
+
forEach: () => We,
|
|
118
|
+
insertContent: () => Ge,
|
|
119
|
+
insertContentAt: () => Xe,
|
|
120
|
+
insertDefaultBlock: () => Qe,
|
|
121
|
+
joinBackward: () => tt,
|
|
122
|
+
joinDown: () => et,
|
|
123
|
+
joinForward: () => nt,
|
|
124
|
+
joinItemBackward: () => rt,
|
|
125
|
+
joinItemForward: () => it,
|
|
126
|
+
joinTextblockBackward: () => at,
|
|
127
|
+
joinTextblockForward: () => ot,
|
|
128
|
+
joinUp: () => $e,
|
|
129
|
+
keyboardShortcut: () => lt,
|
|
130
|
+
lift: () => ut,
|
|
131
|
+
liftEmptyBlock: () => dt,
|
|
132
|
+
liftListItem: () => ft,
|
|
133
|
+
newlineInCode: () => pt,
|
|
134
|
+
resetAttributes: () => ht,
|
|
135
|
+
scrollIntoView: () => gt,
|
|
136
|
+
selectAll: () => _t,
|
|
137
|
+
selectNodeBackward: () => vt,
|
|
138
|
+
selectNodeForward: () => yt,
|
|
139
|
+
selectParentNode: () => bt,
|
|
140
|
+
selectTextblockEnd: () => xt,
|
|
141
|
+
selectTextblockStart: () => St,
|
|
142
|
+
setContent: () => wt,
|
|
143
|
+
setMark: () => gn,
|
|
144
|
+
setMeta: () => _n,
|
|
145
|
+
setNode: () => vn,
|
|
146
|
+
setNodeSelection: () => yn,
|
|
147
|
+
setTextDirection: () => bn,
|
|
148
|
+
setTextSelection: () => xn,
|
|
149
|
+
sinkListItem: () => Sn,
|
|
150
|
+
splitBlock: () => wn,
|
|
151
|
+
splitListItem: () => Tn,
|
|
152
|
+
toggleList: () => jn,
|
|
153
|
+
toggleMark: () => Mn,
|
|
154
|
+
toggleNode: () => Nn,
|
|
155
|
+
toggleWrap: () => Pn,
|
|
156
|
+
undoInputRule: () => Fn,
|
|
157
|
+
unsetAllMarks: () => In,
|
|
158
|
+
unsetMark: () => Ln,
|
|
159
|
+
unsetTextDirection: () => Rn,
|
|
160
|
+
updateAttributes: () => zn,
|
|
161
|
+
updateDecorations: () => Bn,
|
|
162
|
+
wrapIn: () => Vn,
|
|
163
|
+
wrapInList: () => Hn
|
|
164
164
|
});
|
|
165
|
-
var
|
|
165
|
+
var ye = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
166
166
|
var n;
|
|
167
167
|
e.isDestroyed || (t.dom.blur(), (n = window == null ? void 0 : window.getSelection()) == null || n.removeAllRanges());
|
|
168
|
-
}), !0),
|
|
168
|
+
}), !0), be = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), xe = () => ({ state: e, tr: t, dispatch: n }) => {
|
|
169
169
|
let { selection: r } = t, { ranges: i } = r;
|
|
170
170
|
return n && i.forEach(({ $from: n, $to: r }) => {
|
|
171
171
|
e.doc.nodesBetween(n.pos, r.pos, (e, n) => {
|
|
@@ -180,12 +180,12 @@ var be = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
|
180
180
|
(l || l === 0) && t.lift(s, l);
|
|
181
181
|
});
|
|
182
182
|
}), !0;
|
|
183
|
-
},
|
|
183
|
+
}, Se = (e) => (t) => e(t), Ce = () => ({ state: e, dispatch: t }) => l(e, t), we = (e, t) => ({ editor: n, tr: r }) => {
|
|
184
184
|
let { state: i } = n, a = i.doc.slice(e.from, e.to);
|
|
185
185
|
r.deleteRange(e.from, e.to);
|
|
186
186
|
let o = r.mapping.map(t);
|
|
187
|
-
return r.insert(o, a.content), r.setSelection(new
|
|
188
|
-
},
|
|
187
|
+
return r.insert(o, a.content), r.setSelection(new E(r.doc.resolve(Math.max(o - 1, 0)))), !0;
|
|
188
|
+
}, Te = () => ({ tr: e, dispatch: t }) => {
|
|
189
189
|
let { selection: n } = e, r = n.$anchor.node();
|
|
190
190
|
if (r.content.size > 0) return !1;
|
|
191
191
|
let i = e.selection.$anchor;
|
|
@@ -198,15 +198,15 @@ var be = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
|
198
198
|
}
|
|
199
199
|
return !1;
|
|
200
200
|
};
|
|
201
|
-
function
|
|
201
|
+
function j(e, t) {
|
|
202
202
|
if (typeof e == "string") {
|
|
203
203
|
if (!t.nodes[e]) throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
|
|
204
204
|
return t.nodes[e];
|
|
205
205
|
}
|
|
206
206
|
return e;
|
|
207
207
|
}
|
|
208
|
-
var
|
|
209
|
-
let i =
|
|
208
|
+
var Ee = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
209
|
+
let i = j(e, n.schema), a = t.selection.$anchor;
|
|
210
210
|
for (let e = a.depth; e > 0; --e) if (a.node(e).type === i) {
|
|
211
211
|
if (r) {
|
|
212
212
|
let n = a.before(e), r = a.after(e);
|
|
@@ -215,41 +215,41 @@ var De = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
|
215
215
|
return !0;
|
|
216
216
|
}
|
|
217
217
|
return !1;
|
|
218
|
-
},
|
|
218
|
+
}, De = (e) => ({ tr: t, dispatch: n }) => {
|
|
219
219
|
let { from: r, to: i } = e;
|
|
220
220
|
return n && t.delete(r, i), !0;
|
|
221
|
-
},
|
|
221
|
+
}, Oe = (e) => e.content ? /^text(\*|\+)/.test(e.content) : !1, ke = (e, t, n) => {
|
|
222
222
|
if (!e.parent.isInline || n === "left" && e.pos > e.start() || n === "right" && e.pos < e.end()) return e.pos;
|
|
223
223
|
let r = t.nodes[e.parent.type.name].spec;
|
|
224
|
-
return
|
|
225
|
-
},
|
|
226
|
-
from:
|
|
227
|
-
to:
|
|
228
|
-
}),
|
|
224
|
+
return Oe(r) ? n === "left" ? e.start() - 1 : e.end() + 1 : e.pos;
|
|
225
|
+
}, Ae = (e, t, n) => ({
|
|
226
|
+
from: ke(e, n, "left"),
|
|
227
|
+
to: ke(t, n, "right")
|
|
228
|
+
}), je = () => ({ state: e, dispatch: t }) => {
|
|
229
229
|
if (e.selection.empty) return !1;
|
|
230
230
|
if (t) {
|
|
231
231
|
let n = e.tr, { ranges: r } = e.selection, i = n.steps.length;
|
|
232
232
|
r.forEach((t) => {
|
|
233
|
-
let r = n.mapping.slice(i), { from: a, to: o } =
|
|
233
|
+
let r = n.mapping.slice(i), { from: a, to: o } = Ae(n.doc.resolve(r.map(t.$from.pos)), n.doc.resolve(r.map(t.$to.pos)), e.schema);
|
|
234
234
|
n.deleteRange(a, o);
|
|
235
|
-
}), n.selection.empty || n.setSelection(
|
|
235
|
+
}), n.selection.empty || n.setSelection(E.near(n.doc.resolve(n.selection.from))), n.scrollIntoView(), t(n);
|
|
236
236
|
}
|
|
237
237
|
return !0;
|
|
238
|
-
},
|
|
239
|
-
function
|
|
238
|
+
}, Me = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Ne = () => ({ state: e, dispatch: t }) => u(e, t);
|
|
239
|
+
function Pe(e) {
|
|
240
240
|
return Object.prototype.toString.call(e) === "[object RegExp]";
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function M(e, t, n = { strict: !0 }) {
|
|
243
243
|
let r = Object.keys(t);
|
|
244
|
-
return !r.length || r.every((r) => n.strict ? t[r] === e[r] :
|
|
244
|
+
return !r.length || r.every((r) => n.strict ? t[r] === e[r] : Pe(t[r]) ? t[r].test(e[r]) : t[r] === e[r]);
|
|
245
245
|
}
|
|
246
|
-
function
|
|
247
|
-
return e.find((e) => e.type === t &&
|
|
246
|
+
function Fe(e, t, n = {}) {
|
|
247
|
+
return e.find((e) => e.type === t && M(Object.fromEntries(Object.keys(n).map((t) => [t, e.attrs[t]])), n));
|
|
248
248
|
}
|
|
249
|
-
function
|
|
250
|
-
return !!
|
|
249
|
+
function Ie(e, t, n = {}) {
|
|
250
|
+
return !!Fe(e, t, n);
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function N(e, t, n) {
|
|
253
253
|
if (!e || !t) return;
|
|
254
254
|
let r = e.parent.childAfter(e.parentOffset);
|
|
255
255
|
if ((!r.node || !r.node.marks.some((e) => e.type === t)) && (r = e.parent.childBefore(e.parentOffset)), !r.node || !r.node.marks.some((e) => e.type === t)) return;
|
|
@@ -257,55 +257,55 @@ function Re(e, t, n) {
|
|
|
257
257
|
let e = r.node.marks.find((e) => e.type === t);
|
|
258
258
|
e && (n = e.attrs);
|
|
259
259
|
}
|
|
260
|
-
if (!
|
|
260
|
+
if (!Fe([...r.node.marks], t, n)) return;
|
|
261
261
|
let i = r.index, a = e.start() + r.offset, o = i + 1, s = a + r.node.nodeSize;
|
|
262
|
-
for (; i > 0 &&
|
|
263
|
-
for (; o < e.parent.childCount &&
|
|
262
|
+
for (; i > 0 && Ie([...e.parent.child(i - 1).marks], t, n);) --i, a -= e.parent.child(i).nodeSize;
|
|
263
|
+
for (; o < e.parent.childCount && Ie([...e.parent.child(o).marks], t, n);) s += e.parent.child(o).nodeSize, o += 1;
|
|
264
264
|
return {
|
|
265
265
|
from: a,
|
|
266
266
|
to: s
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function P(e, t) {
|
|
270
270
|
if (typeof e == "string") {
|
|
271
271
|
if (!t.marks[e]) throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
|
|
272
272
|
return t.marks[e];
|
|
273
273
|
}
|
|
274
274
|
return e;
|
|
275
275
|
}
|
|
276
|
-
var
|
|
277
|
-
let a =
|
|
276
|
+
var Le = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
277
|
+
let a = P(e, r.schema), { doc: o, selection: s } = n, { $from: c, from: l, to: u } = s;
|
|
278
278
|
if (i) {
|
|
279
|
-
let e =
|
|
279
|
+
let e = N(c, a, t);
|
|
280
280
|
if (e && e.from <= l && e.to >= u) {
|
|
281
|
-
let t =
|
|
281
|
+
let t = E.create(o, e.from, e.to);
|
|
282
282
|
n.setSelection(t);
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
return !0;
|
|
286
|
-
},
|
|
286
|
+
}, Re = (e) => (t) => {
|
|
287
287
|
let n = typeof e == "function" ? e(t) : e;
|
|
288
288
|
for (let e = 0; e < n.length; e += 1) if (n[e](t)) return !0;
|
|
289
289
|
return !1;
|
|
290
290
|
};
|
|
291
|
-
function
|
|
292
|
-
return e instanceof
|
|
291
|
+
function ze(e) {
|
|
292
|
+
return e instanceof E;
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function F(e = 0, t = 0, n = 0) {
|
|
295
295
|
return Math.min(Math.max(e, t), n);
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function Be(e, t = null) {
|
|
298
298
|
if (!t) return null;
|
|
299
|
-
let n =
|
|
299
|
+
let n = T.atStart(e), r = T.atEnd(e);
|
|
300
300
|
if (t === "start" || t === !0) return n;
|
|
301
301
|
if (t === "end") return r;
|
|
302
302
|
let i = n.from, a = r.to;
|
|
303
|
-
return t === "all" ?
|
|
303
|
+
return t === "all" ? E.create(e, F(0, i, a), F(e.content.size, i, a)) : E.create(e, F(t, i, a), F(t, i, a));
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function Ve() {
|
|
306
306
|
return ["Android"].includes(navigator.platform) || /android/i.test(navigator.userAgent);
|
|
307
307
|
}
|
|
308
|
-
function
|
|
308
|
+
function I() {
|
|
309
309
|
return [
|
|
310
310
|
"iPad Simulator",
|
|
311
311
|
"iPhone Simulator",
|
|
@@ -315,16 +315,16 @@ function P() {
|
|
|
315
315
|
"iPod"
|
|
316
316
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function He() {
|
|
319
319
|
return typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
320
320
|
}
|
|
321
|
-
var
|
|
321
|
+
var Ue = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
|
|
322
322
|
t = {
|
|
323
323
|
scrollIntoView: !0,
|
|
324
324
|
...t
|
|
325
325
|
};
|
|
326
326
|
let o = () => {
|
|
327
|
-
(
|
|
327
|
+
(I() || Ve()) && r.dom.focus(), He() && !I() && !Ve() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
|
|
328
328
|
n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
|
|
329
329
|
});
|
|
330
330
|
};
|
|
@@ -333,33 +333,33 @@ var Ge = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
|
|
|
333
333
|
} catch {
|
|
334
334
|
return !1;
|
|
335
335
|
}
|
|
336
|
-
if (a && e === null && !
|
|
337
|
-
let s =
|
|
336
|
+
if (a && e === null && !ze(n.state.selection)) return o(), !0;
|
|
337
|
+
let s = Be(i.doc, e) || n.state.selection, c = n.state.selection.eq(s);
|
|
338
338
|
return a && (c || i.setSelection(s), c && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
|
|
339
|
-
},
|
|
339
|
+
}, We = (e, t) => (n) => e.every((e, r) => t(e, {
|
|
340
340
|
...n,
|
|
341
341
|
index: r
|
|
342
|
-
})),
|
|
342
|
+
})), Ge = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({
|
|
343
343
|
from: n.selection.from,
|
|
344
344
|
to: n.selection.to
|
|
345
|
-
}, e, t),
|
|
345
|
+
}, e, t), Ke = (e) => {
|
|
346
346
|
let t = e.childNodes;
|
|
347
347
|
for (let n = t.length - 1; n >= 0; --n) {
|
|
348
348
|
let r = t[n];
|
|
349
|
-
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 &&
|
|
349
|
+
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Ke(r);
|
|
350
350
|
}
|
|
351
351
|
return e;
|
|
352
352
|
};
|
|
353
|
-
function
|
|
353
|
+
function L(e) {
|
|
354
354
|
if (typeof window > "u") throw Error("[tiptap error]: there is no window object available, so this function cannot be used");
|
|
355
355
|
let t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
|
|
356
|
-
return
|
|
356
|
+
return Ke(n);
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function qe(e) {
|
|
359
359
|
return typeof e?.nodesBetween == "function";
|
|
360
360
|
}
|
|
361
|
-
function
|
|
362
|
-
if (
|
|
361
|
+
function R(e, t, n) {
|
|
362
|
+
if (qe(e)) return e;
|
|
363
363
|
let r = typeof e == "object" && !!e;
|
|
364
364
|
n = {
|
|
365
365
|
slice: !0,
|
|
@@ -368,16 +368,16 @@ function I(e, t, n) {
|
|
|
368
368
|
};
|
|
369
369
|
let i = typeof e == "string";
|
|
370
370
|
if (r) try {
|
|
371
|
-
if (Array.isArray(e) && e.length > 0) return
|
|
371
|
+
if (Array.isArray(e) && e.length > 0) return D.fromArray(e.map((e) => t.nodeFromJSON(e)));
|
|
372
372
|
let r = t.nodeFromJSON(e);
|
|
373
373
|
return n.errorOnInvalidContent && r.check(), r;
|
|
374
374
|
} catch (r) {
|
|
375
375
|
if (n.errorOnInvalidContent) throw Error("[tiptap error]: Invalid JSON content", { cause: r });
|
|
376
|
-
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", r),
|
|
376
|
+
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", r), R("", t, n);
|
|
377
377
|
}
|
|
378
378
|
if (i) {
|
|
379
379
|
if (n.errorOnInvalidContent) {
|
|
380
|
-
let r = !1, i = "", a = new
|
|
380
|
+
let r = !1, i = "", a = new le({
|
|
381
381
|
topNode: t.spec.topNode,
|
|
382
382
|
marks: t.spec.marks,
|
|
383
383
|
nodes: t.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {
|
|
@@ -389,17 +389,17 @@ function I(e, t, n) {
|
|
|
389
389
|
}]
|
|
390
390
|
} })
|
|
391
391
|
});
|
|
392
|
-
if (n.slice ?
|
|
392
|
+
if (n.slice ? se.fromSchema(a).parseSlice(L(e), n.parseOptions) : se.fromSchema(a).parse(L(e), n.parseOptions), n.errorOnInvalidContent && r) throw Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ Error(`Invalid element found: ${i}`) });
|
|
393
393
|
}
|
|
394
|
-
let r =
|
|
395
|
-
return n.slice ? r.parseSlice(
|
|
394
|
+
let r = se.fromSchema(t);
|
|
395
|
+
return n.slice ? r.parseSlice(L(e), n.parseOptions).content : r.parse(L(e), n.parseOptions);
|
|
396
396
|
}
|
|
397
|
-
return
|
|
397
|
+
return R("", t, n);
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function Je(e) {
|
|
400
400
|
return !("type" in e);
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function Ye(e, r, i) {
|
|
403
403
|
let a = e.steps.length - 1;
|
|
404
404
|
if (a < r) return;
|
|
405
405
|
let o = e.steps[a];
|
|
@@ -407,9 +407,9 @@ function Ze(e, r, i) {
|
|
|
407
407
|
let s = e.mapping.maps[a], c = 0;
|
|
408
408
|
s.forEach((e, t, n, r) => {
|
|
409
409
|
c === 0 && (c = r);
|
|
410
|
-
}), e.setSelection(
|
|
410
|
+
}), e.setSelection(T.near(e.doc.resolve(c), i));
|
|
411
411
|
}
|
|
412
|
-
var
|
|
412
|
+
var Xe = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
413
413
|
if (i) {
|
|
414
414
|
n = {
|
|
415
415
|
parseOptions: a.options.parseOptions,
|
|
@@ -431,7 +431,7 @@ var Qe = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
431
431
|
...n.parseOptions
|
|
432
432
|
};
|
|
433
433
|
if (!n.errorOnInvalidContent && !a.options.enableContentCheck && a.options.emitContentError) try {
|
|
434
|
-
|
|
434
|
+
R(t, a.schema, {
|
|
435
435
|
parseOptions: s,
|
|
436
436
|
errorOnInvalidContent: !0
|
|
437
437
|
});
|
|
@@ -439,7 +439,7 @@ var Qe = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
439
439
|
o(e);
|
|
440
440
|
}
|
|
441
441
|
try {
|
|
442
|
-
i =
|
|
442
|
+
i = R(t, a.schema, {
|
|
443
443
|
parseOptions: s,
|
|
444
444
|
errorOnInvalidContent: n.errorOnInvalidContent ?? a.options.enableContentCheck
|
|
445
445
|
});
|
|
@@ -452,7 +452,7 @@ var Qe = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
452
452
|
} : {
|
|
453
453
|
from: e.from,
|
|
454
454
|
to: e.to
|
|
455
|
-
}, u = !0, d = !0, f =
|
|
455
|
+
}, u = !0, d = !0, f = Je(i) ? i.content : [i];
|
|
456
456
|
if (f.forEach((e) => {
|
|
457
457
|
e.check(), u = u ? e.isText && e.marks.length === 0 : !1, d = d ? e.isBlock : !1;
|
|
458
458
|
}), c === l && d) {
|
|
@@ -460,13 +460,13 @@ var Qe = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
460
460
|
e.isTextblock && !e.type.spec.code && !e.childCount && (--c, l += 1);
|
|
461
461
|
}
|
|
462
462
|
let p;
|
|
463
|
-
if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") :
|
|
463
|
+
if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") : qe(t) ? f.map((e) => e.text ?? "").join("") : typeof t == "object" && t && t.text ? t.text : t, r.insertText(p, c, l);
|
|
464
464
|
else {
|
|
465
|
-
p =
|
|
465
|
+
p = D.from(f);
|
|
466
466
|
let e = r.doc.resolve(c), t = e.node(), n = e.parentOffset === 0, i = t.isText || t.isTextblock, a = t.content.size > 0;
|
|
467
467
|
n && i && a && d && (c = Math.max(0, c - 1)), r.replaceWith(c, l, f);
|
|
468
468
|
}
|
|
469
|
-
n.updateSelection &&
|
|
469
|
+
n.updateSelection && Ye(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", {
|
|
470
470
|
from: c,
|
|
471
471
|
text: p
|
|
472
472
|
}), n.applyPasteRules && r.setMeta("applyPasteRules", {
|
|
@@ -476,43 +476,43 @@ var Qe = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
476
476
|
}
|
|
477
477
|
return !0;
|
|
478
478
|
};
|
|
479
|
-
function
|
|
479
|
+
function Ze(e) {
|
|
480
480
|
for (let t = 0; t < e.edgeCount; t += 1) {
|
|
481
481
|
let { type: n } = e.edge(t);
|
|
482
482
|
if (n.isTextblock && !n.hasRequiredAttrs()) return n;
|
|
483
483
|
}
|
|
484
484
|
return null;
|
|
485
485
|
}
|
|
486
|
-
var
|
|
486
|
+
var Qe = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
|
|
487
487
|
let { pos: i, attrs: a, content: o, updateSelection: s = !0 } = e, c;
|
|
488
488
|
c = typeof i == "number" ? t.doc.resolve(i) : i || t.selection.$from;
|
|
489
|
-
let l =
|
|
489
|
+
let l = Ze(c.parent.contentMatchAt(c.index()));
|
|
490
490
|
if (!l) return !1;
|
|
491
491
|
let u = Object.keys(l.spec.attrs || {}), d = a ? Object.fromEntries(Object.entries(a).filter(([e]) => u.includes(e))) : {}, f;
|
|
492
492
|
if (o) {
|
|
493
|
-
let e =
|
|
493
|
+
let e = R(o, r.schema);
|
|
494
494
|
f = l.createAndFill(d, e);
|
|
495
495
|
} else f = l.createAndFill(d);
|
|
496
|
-
return f ? (n && (t.insert(c.pos, f), s &&
|
|
497
|
-
},
|
|
496
|
+
return f ? (n && (t.insert(c.pos, f), s && Ye(t, t.steps.length - 1, -1)), !0) : !1;
|
|
497
|
+
}, $e = () => ({ state: e, dispatch: t }) => g(e, t), et = () => ({ state: e, dispatch: t }) => f(e, t), tt = () => ({ state: e, dispatch: t }) => d(e, t), nt = () => ({ state: e, dispatch: t }) => p(e, t), rt = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
498
498
|
try {
|
|
499
499
|
let r = s(e.doc, e.selection.$from.pos, -1);
|
|
500
500
|
return r != null && (n.join(r, 2), t && t(n), !0);
|
|
501
501
|
} catch {
|
|
502
502
|
return !1;
|
|
503
503
|
}
|
|
504
|
-
},
|
|
504
|
+
}, it = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
505
505
|
try {
|
|
506
506
|
let r = s(e.doc, e.selection.$from.pos, 1);
|
|
507
507
|
return r != null && (n.join(r, 2), t && t(n), !0);
|
|
508
508
|
} catch {
|
|
509
509
|
return !1;
|
|
510
510
|
}
|
|
511
|
-
},
|
|
512
|
-
function
|
|
511
|
+
}, at = () => ({ state: e, dispatch: t }) => m(e, t), ot = () => ({ state: e, dispatch: t }) => h(e, t);
|
|
512
|
+
function st() {
|
|
513
513
|
return typeof navigator < "u" && /Mac/.test(navigator.platform);
|
|
514
514
|
}
|
|
515
|
-
function
|
|
515
|
+
function ct(e) {
|
|
516
516
|
let t = e.split(/-(?!$)/), n = t[t.length - 1];
|
|
517
517
|
n === "Space" && (n = " ");
|
|
518
518
|
let r, i, a, o;
|
|
@@ -522,13 +522,13 @@ function ut(e) {
|
|
|
522
522
|
else if (/^a(lt)?$/i.test(n)) r = !0;
|
|
523
523
|
else if (/^(c|ctrl|control)$/i.test(n)) i = !0;
|
|
524
524
|
else if (/^s(hift)?$/i.test(n)) a = !0;
|
|
525
|
-
else if (/^mod$/i.test(n))
|
|
525
|
+
else if (/^mod$/i.test(n)) I() || st() ? o = !0 : i = !0;
|
|
526
526
|
else throw Error(`Unrecognized modifier name: ${n}`);
|
|
527
527
|
}
|
|
528
528
|
return r && (n = `Alt-${n}`), i && (n = `Ctrl-${n}`), o && (n = `Meta-${n}`), a && (n = `Shift-${n}`), n;
|
|
529
529
|
}
|
|
530
|
-
var
|
|
531
|
-
let a =
|
|
530
|
+
var lt = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
|
|
531
|
+
let a = ct(e).split(/-(?!$)/), o = a.find((e) => ![
|
|
532
532
|
"Alt",
|
|
533
533
|
"Ctrl",
|
|
534
534
|
"Meta",
|
|
@@ -549,8 +549,8 @@ var dt = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
|
|
|
549
549
|
t && i && r.maybeStep(t);
|
|
550
550
|
}), !0;
|
|
551
551
|
};
|
|
552
|
-
function
|
|
553
|
-
let { from: r, to: i, empty: a } = e.selection, o = t ?
|
|
552
|
+
function z(e, t, n = {}) {
|
|
553
|
+
let { from: r, to: i, empty: a } = e.selection, o = t ? j(t, e.schema) : null, s = [];
|
|
554
554
|
e.doc.nodesBetween(r, i, (e, t) => {
|
|
555
555
|
if (e.isText) return;
|
|
556
556
|
let n = Math.max(r, t), a = Math.min(i, t + e.nodeSize);
|
|
@@ -560,52 +560,52 @@ function L(e, t, n = {}) {
|
|
|
560
560
|
to: a
|
|
561
561
|
});
|
|
562
562
|
});
|
|
563
|
-
let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) =>
|
|
563
|
+
let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) => M(e.node.attrs, n, { strict: !1 }));
|
|
564
564
|
return a ? !!l.length : l.reduce((e, t) => e + t.to - t.from, 0) >= c;
|
|
565
565
|
}
|
|
566
|
-
var
|
|
567
|
-
let r =
|
|
568
|
-
return
|
|
569
|
-
},
|
|
570
|
-
function
|
|
566
|
+
var ut = (e, t = {}) => ({ state: n, dispatch: r }) => z(n, j(e, n.schema), t) ? ee(n, r) : !1, dt = () => ({ state: e, dispatch: t }) => te(e, t), ft = (e) => ({ state: t, dispatch: n }) => {
|
|
567
|
+
let r = j(e, t.schema);
|
|
568
|
+
return de(r)(t, n);
|
|
569
|
+
}, pt = () => ({ state: e, dispatch: t }) => _(e, t);
|
|
570
|
+
function B(e, t) {
|
|
571
571
|
return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function mt(e, t) {
|
|
574
574
|
let n = typeof t == "string" ? [t] : t;
|
|
575
575
|
return Object.keys(e).reduce((t, r) => (n.includes(r) || (t[r] = e[r]), t), {});
|
|
576
576
|
}
|
|
577
|
-
var
|
|
578
|
-
let a = null, o = null, s =
|
|
577
|
+
var ht = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
578
|
+
let a = null, o = null, s = B(typeof e == "string" ? e : e.name, r.schema);
|
|
579
579
|
if (!s) return !1;
|
|
580
|
-
s === "node" && (a =
|
|
580
|
+
s === "node" && (a = j(e, r.schema)), s === "mark" && (o = P(e, r.schema));
|
|
581
581
|
let c = !1;
|
|
582
582
|
return n.selection.ranges.forEach((e) => {
|
|
583
583
|
r.doc.nodesBetween(e.$from.pos, e.$to.pos, (e, r) => {
|
|
584
|
-
a && a === e.type && (c = !0, i && n.setNodeMarkup(r, void 0,
|
|
585
|
-
o === a.type && (c = !0, i && n.addMark(r, r + e.nodeSize, o.create(
|
|
584
|
+
a && a === e.type && (c = !0, i && n.setNodeMarkup(r, void 0, mt(e.attrs, t))), o && e.marks.length && e.marks.forEach((a) => {
|
|
585
|
+
o === a.type && (c = !0, i && n.addMark(r, r + e.nodeSize, o.create(mt(a.attrs, t))));
|
|
586
586
|
});
|
|
587
587
|
});
|
|
588
588
|
}), c;
|
|
589
|
-
},
|
|
589
|
+
}, gt = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), _t = () => ({ tr: e, dispatch: t }) => {
|
|
590
590
|
if (t) {
|
|
591
591
|
let t = new ae(e.doc);
|
|
592
592
|
e.setSelection(t);
|
|
593
593
|
}
|
|
594
594
|
return !0;
|
|
595
|
-
},
|
|
596
|
-
function
|
|
597
|
-
return
|
|
595
|
+
}, vt = () => ({ state: e, dispatch: t }) => ne(e, t), yt = () => ({ state: e, dispatch: t }) => v(e, t), bt = () => ({ state: e, dispatch: t }) => re(e, t), xt = () => ({ state: e, dispatch: t }) => ie(e, t), St = () => ({ state: e, dispatch: t }) => y(e, t);
|
|
596
|
+
function Ct(e, t, n = {}, r = {}) {
|
|
597
|
+
return R(e, t, {
|
|
598
598
|
slice: !1,
|
|
599
599
|
parseOptions: n,
|
|
600
600
|
errorOnInvalidContent: r.errorOnInvalidContent
|
|
601
601
|
});
|
|
602
602
|
}
|
|
603
|
-
var
|
|
603
|
+
var wt = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: i, tr: a, dispatch: o, commands: s }) => {
|
|
604
604
|
let { doc: c } = a;
|
|
605
605
|
if (r.preserveWhitespace !== "full") {
|
|
606
|
-
let s =
|
|
606
|
+
let s = Ct(e, i.schema, r, { errorOnInvalidContent: t ?? i.options.enableContentCheck });
|
|
607
607
|
if (o) {
|
|
608
|
-
let e =
|
|
608
|
+
let e = Je(s) ? s.content : [s];
|
|
609
609
|
a.replaceWith(0, c.content.size, e).setMeta("preventUpdate", !n);
|
|
610
610
|
}
|
|
611
611
|
return !0;
|
|
@@ -618,15 +618,15 @@ var Et = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {
|
|
|
618
618
|
errorOnInvalidContent: t ?? i.options.enableContentCheck
|
|
619
619
|
});
|
|
620
620
|
};
|
|
621
|
-
function
|
|
622
|
-
let n =
|
|
621
|
+
function Tt(e, t) {
|
|
622
|
+
let n = P(t, e.schema), { from: r, to: i, empty: a } = e.selection, o = [];
|
|
623
623
|
a ? (e.storedMarks && o.push(...e.storedMarks), o.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, i, (e) => {
|
|
624
624
|
o.push(...e.marks);
|
|
625
625
|
});
|
|
626
626
|
let s = o.find((e) => e.type.name === n.name);
|
|
627
627
|
return s ? { ...s.attrs } : {};
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function Et(e, t) {
|
|
630
630
|
let n = new r(e);
|
|
631
631
|
return t.forEach((e) => {
|
|
632
632
|
e.steps.forEach((e) => {
|
|
@@ -634,7 +634,7 @@ function Ot(e, t) {
|
|
|
634
634
|
});
|
|
635
635
|
}), n;
|
|
636
636
|
}
|
|
637
|
-
function
|
|
637
|
+
function Dt(e, t, n) {
|
|
638
638
|
let r = [];
|
|
639
639
|
return e.nodesBetween(t.from, t.to, (e, t) => {
|
|
640
640
|
n(e) && r.push({
|
|
@@ -643,7 +643,7 @@ function kt(e, t, n) {
|
|
|
643
643
|
});
|
|
644
644
|
}), r;
|
|
645
645
|
}
|
|
646
|
-
function
|
|
646
|
+
function Ot(e, t) {
|
|
647
647
|
for (let n = e.depth; n > 0; --n) {
|
|
648
648
|
let r = e.node(n);
|
|
649
649
|
if (t(r)) return {
|
|
@@ -654,47 +654,47 @@ function At(e, t) {
|
|
|
654
654
|
};
|
|
655
655
|
}
|
|
656
656
|
}
|
|
657
|
-
function
|
|
658
|
-
return (t) =>
|
|
657
|
+
function V(e) {
|
|
658
|
+
return (t) => Ot(t.$from, e);
|
|
659
659
|
}
|
|
660
|
-
function
|
|
661
|
-
return e.config[t] === void 0 && e.parent ?
|
|
660
|
+
function H(e, t, n) {
|
|
661
|
+
return e.config[t] === void 0 && e.parent ? H(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
|
|
662
662
|
...n,
|
|
663
|
-
parent: e.parent ?
|
|
663
|
+
parent: e.parent ? H(e.parent, t, n) : null
|
|
664
664
|
}) : e.config[t];
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function kt(e) {
|
|
667
667
|
return e.map((e) => {
|
|
668
|
-
let t =
|
|
668
|
+
let t = H(e, "addExtensions", {
|
|
669
669
|
name: e.name,
|
|
670
670
|
options: e.options,
|
|
671
671
|
storage: e.storage
|
|
672
672
|
});
|
|
673
|
-
return t ? [e, ...
|
|
673
|
+
return t ? [e, ...kt(t())] : e;
|
|
674
674
|
}).flat(10);
|
|
675
675
|
}
|
|
676
|
-
function
|
|
677
|
-
let n =
|
|
676
|
+
function At(e, t) {
|
|
677
|
+
let n = ce.fromSchema(t).serializeFragment(e), r = document.implementation.createHTMLDocument().createElement("div");
|
|
678
678
|
return r.appendChild(n), r.innerHTML;
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function jt(e) {
|
|
681
681
|
return typeof e == "function";
|
|
682
682
|
}
|
|
683
|
-
function
|
|
684
|
-
return
|
|
683
|
+
function U(e, t = void 0, ...n) {
|
|
684
|
+
return jt(e) ? t ? e.bind(t)(...n) : e(...n) : e;
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function Mt(e = {}) {
|
|
687
687
|
return Object.keys(e).length === 0 && e.constructor === Object;
|
|
688
688
|
}
|
|
689
|
-
function
|
|
689
|
+
function W(e) {
|
|
690
690
|
return {
|
|
691
691
|
baseExtensions: e.filter((e) => e.type === "extension"),
|
|
692
692
|
nodeExtensions: e.filter((e) => e.type === "node"),
|
|
693
693
|
markExtensions: e.filter((e) => e.type === "mark")
|
|
694
694
|
};
|
|
695
695
|
}
|
|
696
|
-
function
|
|
697
|
-
let t = [], { nodeExtensions: n, markExtensions: r } =
|
|
696
|
+
function Nt(e) {
|
|
697
|
+
let t = [], { nodeExtensions: n, markExtensions: r } = W(e), i = [...n, ...r], a = {
|
|
698
698
|
default: null,
|
|
699
699
|
validate: void 0,
|
|
700
700
|
rendered: !0,
|
|
@@ -704,7 +704,7 @@ function Ft(e) {
|
|
|
704
704
|
isRequired: !1
|
|
705
705
|
}, o = n.filter((e) => e.name !== "text").map((e) => e.name), s = r.map((e) => e.name), c = [...o, ...s];
|
|
706
706
|
return e.forEach((e) => {
|
|
707
|
-
let n =
|
|
707
|
+
let n = H(e, "addGlobalAttributes", {
|
|
708
708
|
name: e.name,
|
|
709
709
|
options: e.options,
|
|
710
710
|
storage: e.storage,
|
|
@@ -726,7 +726,7 @@ function Ft(e) {
|
|
|
726
726
|
});
|
|
727
727
|
});
|
|
728
728
|
}), i.forEach((e) => {
|
|
729
|
-
let n =
|
|
729
|
+
let n = H(e, "addAttributes", {
|
|
730
730
|
name: e.name,
|
|
731
731
|
options: e.options,
|
|
732
732
|
storage: e.storage
|
|
@@ -746,7 +746,7 @@ function Ft(e) {
|
|
|
746
746
|
});
|
|
747
747
|
}), t;
|
|
748
748
|
}
|
|
749
|
-
function
|
|
749
|
+
function Pt(e) {
|
|
750
750
|
let t = [], n = "", r = !1, i = !1, a = 0, o = e.length;
|
|
751
751
|
for (let s = 0; s < o; s += 1) {
|
|
752
752
|
let o = e[s];
|
|
@@ -776,8 +776,8 @@ function It(e) {
|
|
|
776
776
|
}
|
|
777
777
|
return n && t.push(n), t;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
780
|
-
let t = [], n =
|
|
779
|
+
function Ft(e) {
|
|
780
|
+
let t = [], n = Pt(e || ""), r = n.length;
|
|
781
781
|
for (let e = 0; e < r; e += 1) {
|
|
782
782
|
let r = n[e], i = r.indexOf(":");
|
|
783
783
|
if (i === -1) continue;
|
|
@@ -786,7 +786,7 @@ function Lt(e) {
|
|
|
786
786
|
}
|
|
787
787
|
return t;
|
|
788
788
|
}
|
|
789
|
-
function
|
|
789
|
+
function It(...e) {
|
|
790
790
|
return e.filter((e) => !!e).reduce((e, t) => {
|
|
791
791
|
let n = { ...e };
|
|
792
792
|
return Object.entries(t).forEach(([e, t]) => {
|
|
@@ -798,26 +798,26 @@ function Rt(...e) {
|
|
|
798
798
|
let r = t ? String(t).split(" ") : [], i = n[e] ? n[e].split(" ") : [], a = r.filter((e) => !i.includes(e));
|
|
799
799
|
n[e] = [...i, ...a].join(" ");
|
|
800
800
|
} else if (e === "style") {
|
|
801
|
-
let r = new Map([...
|
|
801
|
+
let r = new Map([...Ft(n[e]), ...Ft(t)]);
|
|
802
802
|
n[e] = Array.from(r.entries()).map(([e, t]) => `${e}: ${t}`).join("; ");
|
|
803
803
|
} else n[e] = t;
|
|
804
804
|
}), n;
|
|
805
805
|
}, {});
|
|
806
806
|
}
|
|
807
|
-
function
|
|
808
|
-
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) =>
|
|
807
|
+
function G(e, t) {
|
|
808
|
+
return t.filter((t) => t.type === e.type.name).filter((e) => e.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(e.attrs) || {} : { [t.name]: e.attrs[t.name] }).reduce((e, t) => It(e, t), {});
|
|
809
809
|
}
|
|
810
|
-
function
|
|
810
|
+
function Lt(e) {
|
|
811
811
|
return typeof e == "string" ? e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" || e !== "false" && e : e;
|
|
812
812
|
}
|
|
813
|
-
function
|
|
813
|
+
function Rt(e, t) {
|
|
814
814
|
return "style" in e ? e : {
|
|
815
815
|
...e,
|
|
816
816
|
getAttrs: (n) => {
|
|
817
817
|
let r = e.getAttrs ? e.getAttrs(n) : e.attrs;
|
|
818
818
|
if (r === !1) return !1;
|
|
819
819
|
let i = t.reduce((e, t) => {
|
|
820
|
-
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) :
|
|
820
|
+
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) : Lt(n.getAttribute(t.name));
|
|
821
821
|
return r == null ? e : {
|
|
822
822
|
...e,
|
|
823
823
|
[t.name]: r
|
|
@@ -830,49 +830,49 @@ function Bt(e, t) {
|
|
|
830
830
|
}
|
|
831
831
|
};
|
|
832
832
|
}
|
|
833
|
-
function
|
|
834
|
-
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" &&
|
|
833
|
+
function zt(e) {
|
|
834
|
+
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && Mt(t) ? !1 : t != null));
|
|
835
835
|
}
|
|
836
|
-
function
|
|
836
|
+
function Bt(e) {
|
|
837
837
|
let t = {};
|
|
838
838
|
return !e?.attribute?.isRequired && "default" in (e?.attribute || {}) && (t.default = e.attribute.default), e?.attribute?.validate !== void 0 && (t.validate = e.attribute.validate), [e.name, t];
|
|
839
839
|
}
|
|
840
|
-
function
|
|
841
|
-
let n =
|
|
840
|
+
function Vt(e, t) {
|
|
841
|
+
let n = Nt(e), { nodeExtensions: r, markExtensions: i } = W(e), a = r.find((e) => H(e, "topNode"))?.name, o = Object.fromEntries(r.map((r) => {
|
|
842
842
|
let i = n.filter((e) => e.type === r.name), a = {
|
|
843
843
|
name: r.name,
|
|
844
844
|
options: r.options,
|
|
845
845
|
storage: r.storage,
|
|
846
846
|
editor: t
|
|
847
|
-
}, o =
|
|
847
|
+
}, o = zt({
|
|
848
848
|
...e.reduce((e, t) => {
|
|
849
|
-
let n =
|
|
849
|
+
let n = H(t, "extendNodeSchema", a);
|
|
850
850
|
return {
|
|
851
851
|
...e,
|
|
852
852
|
...n ? n(r) : {}
|
|
853
853
|
};
|
|
854
854
|
}, {}),
|
|
855
|
-
content:
|
|
856
|
-
marks:
|
|
857
|
-
group:
|
|
858
|
-
inline:
|
|
859
|
-
atom:
|
|
860
|
-
selectable:
|
|
861
|
-
draggable:
|
|
862
|
-
code:
|
|
863
|
-
whitespace:
|
|
864
|
-
linebreakReplacement:
|
|
865
|
-
defining:
|
|
866
|
-
isolating:
|
|
867
|
-
attrs: Object.fromEntries(i.map(
|
|
868
|
-
}), s =
|
|
869
|
-
s && (o.parseDOM = s.map((e) =>
|
|
870
|
-
let c =
|
|
855
|
+
content: U(H(r, "content", a)),
|
|
856
|
+
marks: U(H(r, "marks", a)),
|
|
857
|
+
group: U(H(r, "group", a)),
|
|
858
|
+
inline: U(H(r, "inline", a)),
|
|
859
|
+
atom: U(H(r, "atom", a)),
|
|
860
|
+
selectable: U(H(r, "selectable", a)),
|
|
861
|
+
draggable: U(H(r, "draggable", a)),
|
|
862
|
+
code: U(H(r, "code", a)),
|
|
863
|
+
whitespace: U(H(r, "whitespace", a)),
|
|
864
|
+
linebreakReplacement: U(H(r, "linebreakReplacement", a)),
|
|
865
|
+
defining: U(H(r, "defining", a)),
|
|
866
|
+
isolating: U(H(r, "isolating", a)),
|
|
867
|
+
attrs: Object.fromEntries(i.map(Bt))
|
|
868
|
+
}), s = U(H(r, "parseHTML", a));
|
|
869
|
+
s && (o.parseDOM = s.map((e) => Rt(e, i)));
|
|
870
|
+
let c = H(r, "renderHTML", a);
|
|
871
871
|
c && (o.toDOM = (e) => c({
|
|
872
872
|
node: e,
|
|
873
|
-
HTMLAttributes:
|
|
873
|
+
HTMLAttributes: G(e, i)
|
|
874
874
|
}));
|
|
875
|
-
let l =
|
|
875
|
+
let l = H(r, "renderText", a);
|
|
876
876
|
return l && (o.toText = l), [r.name, o];
|
|
877
877
|
})), s = Object.fromEntries(i.map((r) => {
|
|
878
878
|
let i = n.filter((e) => e.type === r.name), a = {
|
|
@@ -880,49 +880,49 @@ function Ut(e, t) {
|
|
|
880
880
|
options: r.options,
|
|
881
881
|
storage: r.storage,
|
|
882
882
|
editor: t
|
|
883
|
-
}, o =
|
|
883
|
+
}, o = zt({
|
|
884
884
|
...e.reduce((e, t) => {
|
|
885
|
-
let n =
|
|
885
|
+
let n = H(t, "extendMarkSchema", a);
|
|
886
886
|
return {
|
|
887
887
|
...e,
|
|
888
888
|
...n ? n(r) : {}
|
|
889
889
|
};
|
|
890
890
|
}, {}),
|
|
891
|
-
inclusive:
|
|
892
|
-
excludes:
|
|
893
|
-
group:
|
|
894
|
-
spanning:
|
|
895
|
-
code:
|
|
896
|
-
attrs: Object.fromEntries(i.map(
|
|
897
|
-
}), s =
|
|
898
|
-
s && (o.parseDOM = s.map((e) =>
|
|
899
|
-
let c =
|
|
891
|
+
inclusive: U(H(r, "inclusive", a)),
|
|
892
|
+
excludes: U(H(r, "excludes", a)),
|
|
893
|
+
group: U(H(r, "group", a)),
|
|
894
|
+
spanning: U(H(r, "spanning", a)),
|
|
895
|
+
code: U(H(r, "code", a)),
|
|
896
|
+
attrs: Object.fromEntries(i.map(Bt))
|
|
897
|
+
}), s = U(H(r, "parseHTML", a));
|
|
898
|
+
s && (o.parseDOM = s.map((e) => Rt(e, i)));
|
|
899
|
+
let c = H(r, "renderHTML", a);
|
|
900
900
|
return c && (o.toDOM = (e) => c({
|
|
901
901
|
mark: e,
|
|
902
|
-
HTMLAttributes:
|
|
902
|
+
HTMLAttributes: G(e, i)
|
|
903
903
|
})), [r.name, o];
|
|
904
904
|
}));
|
|
905
|
-
return new
|
|
905
|
+
return new le({
|
|
906
906
|
topNode: a,
|
|
907
907
|
nodes: o,
|
|
908
908
|
marks: s
|
|
909
909
|
});
|
|
910
910
|
}
|
|
911
|
-
function
|
|
911
|
+
function Ht(e) {
|
|
912
912
|
let t = e.filter((t, n) => e.indexOf(t) !== n);
|
|
913
913
|
return Array.from(new Set(t));
|
|
914
914
|
}
|
|
915
|
-
function
|
|
915
|
+
function K(e) {
|
|
916
916
|
return e.sort((e, t) => {
|
|
917
|
-
let n =
|
|
917
|
+
let n = H(e, "priority") || 100, r = H(t, "priority") || 100;
|
|
918
918
|
return n > r ? -1 : +(n < r);
|
|
919
919
|
});
|
|
920
920
|
}
|
|
921
|
-
function
|
|
922
|
-
let t =
|
|
921
|
+
function Ut(e) {
|
|
922
|
+
let t = K(kt(e)), n = Ht(t.map((e) => e.name));
|
|
923
923
|
return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e) => `'${e}'`).join(", ")}]. This can lead to issues.`), t;
|
|
924
924
|
}
|
|
925
|
-
function
|
|
925
|
+
function Wt(e, t, n) {
|
|
926
926
|
let { from: r, to: i } = t, { blockSeparator: a = "\n\n", textSerializers: o = {} } = n || {}, s = "";
|
|
927
927
|
return e.nodesBetween(r, i, (e, n, c, l) => {
|
|
928
928
|
e.isBlock && n > r && (s += a);
|
|
@@ -937,39 +937,39 @@ function Kt(e, t, n) {
|
|
|
937
937
|
e.isText && (s += (e?.text)?.slice(Math.max(r, n) - n, i - n));
|
|
938
938
|
}), s;
|
|
939
939
|
}
|
|
940
|
-
function
|
|
941
|
-
return
|
|
940
|
+
function Gt(e, t) {
|
|
941
|
+
return Wt(e, {
|
|
942
942
|
from: 0,
|
|
943
943
|
to: e.content.size
|
|
944
944
|
}, t);
|
|
945
945
|
}
|
|
946
|
-
function
|
|
946
|
+
function Kt(e) {
|
|
947
947
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
|
|
948
948
|
}
|
|
949
|
-
function
|
|
950
|
-
let n =
|
|
949
|
+
function qt(e, t) {
|
|
950
|
+
let n = j(t, e.schema), { from: r, to: i } = e.selection, a = [];
|
|
951
951
|
e.doc.nodesBetween(r, i, (e) => {
|
|
952
952
|
a.push(e);
|
|
953
953
|
});
|
|
954
954
|
let o = a.reverse().find((e) => e.type.name === n.name);
|
|
955
955
|
return o ? { ...o.attrs } : {};
|
|
956
956
|
}
|
|
957
|
-
function
|
|
958
|
-
let n =
|
|
959
|
-
return n === "node" ?
|
|
957
|
+
function Jt(e, t) {
|
|
958
|
+
let n = B(typeof t == "string" ? t : t.name, e.schema);
|
|
959
|
+
return n === "node" ? qt(e, t) : n === "mark" ? Tt(e, t) : {};
|
|
960
960
|
}
|
|
961
|
-
function
|
|
961
|
+
function Yt(e, t = JSON.stringify) {
|
|
962
962
|
let n = {};
|
|
963
963
|
return e.filter((e) => {
|
|
964
964
|
let r = t(e);
|
|
965
965
|
return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
|
|
966
966
|
});
|
|
967
967
|
}
|
|
968
|
-
function
|
|
969
|
-
let t =
|
|
968
|
+
function Xt(e) {
|
|
969
|
+
let t = Yt(e);
|
|
970
970
|
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));
|
|
971
971
|
}
|
|
972
|
-
function
|
|
972
|
+
function Zt(e) {
|
|
973
973
|
let { mapping: t, steps: n } = e, r = [];
|
|
974
974
|
return t.maps.forEach((e, i) => {
|
|
975
975
|
let a = [];
|
|
@@ -1000,12 +1000,12 @@ function $t(e) {
|
|
|
1000
1000
|
}
|
|
1001
1001
|
});
|
|
1002
1002
|
});
|
|
1003
|
-
}),
|
|
1003
|
+
}), Xt(r);
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1005
|
+
function Qt(e, t, n) {
|
|
1006
1006
|
let r = [];
|
|
1007
1007
|
return e === t ? n.resolve(e).marks().forEach((t) => {
|
|
1008
|
-
let i =
|
|
1008
|
+
let i = N(n.resolve(e), t.type);
|
|
1009
1009
|
i && r.push({
|
|
1010
1010
|
mark: t,
|
|
1011
1011
|
...i
|
|
@@ -1018,29 +1018,29 @@ function en(e, t, n) {
|
|
|
1018
1018
|
})));
|
|
1019
1019
|
}), r;
|
|
1020
1020
|
}
|
|
1021
|
-
var
|
|
1021
|
+
var $t = (e, t, n, r = 20) => {
|
|
1022
1022
|
let i = e.doc.resolve(n), a = r, o = null;
|
|
1023
1023
|
for (; a > 0 && o === null;) {
|
|
1024
1024
|
let e = i.node(a);
|
|
1025
1025
|
e?.type.name === t ? o = e : --a;
|
|
1026
1026
|
}
|
|
1027
1027
|
return [o, a];
|
|
1028
|
-
},
|
|
1028
|
+
}, en = (e) => {
|
|
1029
1029
|
let t = e.depth - 1;
|
|
1030
1030
|
if (t < 0) return null;
|
|
1031
1031
|
let n = e.index(t);
|
|
1032
1032
|
return n === 0 ? null : e.node(t).child(n - 1);
|
|
1033
1033
|
};
|
|
1034
|
-
function
|
|
1034
|
+
function q(e, t) {
|
|
1035
1035
|
return t.nodes[e] || t.marks[e] || null;
|
|
1036
1036
|
}
|
|
1037
|
-
function
|
|
1037
|
+
function J(e, t, n) {
|
|
1038
1038
|
return Object.fromEntries(Object.entries(n).filter(([n]) => {
|
|
1039
1039
|
let r = e.find((e) => e.type === t && e.name === n);
|
|
1040
1040
|
return r ? r.attribute.keepOnSplit : !1;
|
|
1041
1041
|
}));
|
|
1042
1042
|
}
|
|
1043
|
-
var
|
|
1043
|
+
var tn = (e, t = 500) => {
|
|
1044
1044
|
let n = "", r = e.parentOffset;
|
|
1045
1045
|
return e.parent.nodesBetween(Math.max(0, r - t), r, (e, t, i, a) => {
|
|
1046
1046
|
var o;
|
|
@@ -1053,9 +1053,9 @@ var rn = (e, t = 500) => {
|
|
|
1053
1053
|
n += e.isAtom && !e.isText ? s : s.slice(0, Math.max(0, r - t));
|
|
1054
1054
|
}), n;
|
|
1055
1055
|
};
|
|
1056
|
-
function
|
|
1057
|
-
let { empty: r, ranges: i } = e.selection, a = t ?
|
|
1058
|
-
if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) =>
|
|
1056
|
+
function nn(e, t, n = {}) {
|
|
1057
|
+
let { empty: r, ranges: i } = e.selection, a = t ? P(t, e.schema) : null;
|
|
1058
|
+
if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) => M(e.attrs, n, { strict: !1 }));
|
|
1059
1059
|
let o = 0, s = [];
|
|
1060
1060
|
if (i.forEach(({ $from: t, $to: n }) => {
|
|
1061
1061
|
let r = t.pos, i = n.pos;
|
|
@@ -1070,41 +1070,41 @@ function an(e, t, n = {}) {
|
|
|
1070
1070
|
})));
|
|
1071
1071
|
});
|
|
1072
1072
|
}), o === 0) return !1;
|
|
1073
|
-
let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) =>
|
|
1073
|
+
let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) => M(e.mark.attrs, n, { strict: !1 })).reduce((e, t) => e + t.to - t.from, 0), l = s.filter((e) => !a || e.mark.type !== a && e.mark.type.excludes(a)).reduce((e, t) => e + t.to - t.from, 0);
|
|
1074
1074
|
return (c > 0 ? c + l : c) >= o;
|
|
1075
1075
|
}
|
|
1076
|
-
function
|
|
1077
|
-
if (!t) return
|
|
1078
|
-
let r =
|
|
1079
|
-
return r === "node" ?
|
|
1076
|
+
function rn(e, t, n = {}) {
|
|
1077
|
+
if (!t) return z(e, null, n) || nn(e, null, n);
|
|
1078
|
+
let r = B(t, e.schema);
|
|
1079
|
+
return r === "node" ? z(e, t, n) : r === "mark" && nn(e, t, n);
|
|
1080
1080
|
}
|
|
1081
|
-
var
|
|
1081
|
+
var an = (e, t) => {
|
|
1082
1082
|
let { $from: n, $to: r, $anchor: i } = e.selection;
|
|
1083
1083
|
if (t) {
|
|
1084
|
-
let n =
|
|
1084
|
+
let n = V((e) => e.type.name === t)(e.selection);
|
|
1085
1085
|
if (!n) return !1;
|
|
1086
1086
|
let r = e.doc.resolve(n.pos + 1);
|
|
1087
1087
|
return i.pos + 1 === r.end();
|
|
1088
1088
|
}
|
|
1089
1089
|
return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
|
|
1090
|
-
},
|
|
1090
|
+
}, on = (e) => {
|
|
1091
1091
|
let { $from: t, $to: n } = e.selection;
|
|
1092
1092
|
return !(t.parentOffset > 0 || t.pos !== n.pos);
|
|
1093
1093
|
};
|
|
1094
|
-
function
|
|
1094
|
+
function sn(e, t) {
|
|
1095
1095
|
return Array.isArray(t) ? t.some((t) => (typeof t == "string" ? t : t.name) === e.name) : t;
|
|
1096
1096
|
}
|
|
1097
|
-
function
|
|
1098
|
-
let { nodeExtensions: n } =
|
|
1097
|
+
function cn(e, t) {
|
|
1098
|
+
let { nodeExtensions: n } = W(t), r = n.find((t) => t.name === e);
|
|
1099
1099
|
if (!r) return !1;
|
|
1100
|
-
let i =
|
|
1100
|
+
let i = U(H(r, "group", {
|
|
1101
1101
|
name: r.name,
|
|
1102
1102
|
options: r.options,
|
|
1103
1103
|
storage: r.storage
|
|
1104
1104
|
}));
|
|
1105
1105
|
return typeof i == "string" && i.split(" ").includes("list");
|
|
1106
1106
|
}
|
|
1107
|
-
function
|
|
1107
|
+
function Y(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
1108
1108
|
if (n) {
|
|
1109
1109
|
if (e.type.name === "hardBreak") return !0;
|
|
1110
1110
|
if (e.isText) return !/\S/.test(e.text ?? "");
|
|
@@ -1115,7 +1115,7 @@ function q(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1115
1115
|
if (t) {
|
|
1116
1116
|
let r = !0;
|
|
1117
1117
|
return e.content.forEach((e) => {
|
|
1118
|
-
r !== !1 && (
|
|
1118
|
+
r !== !1 && (Y(e, {
|
|
1119
1119
|
ignoreWhitespace: n,
|
|
1120
1120
|
checkChildren: t
|
|
1121
1121
|
}) || (r = !1));
|
|
@@ -1123,10 +1123,14 @@ function q(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1123
1123
|
}
|
|
1124
1124
|
return !1;
|
|
1125
1125
|
}
|
|
1126
|
-
function
|
|
1127
|
-
return e instanceof
|
|
1126
|
+
function ln(e) {
|
|
1127
|
+
return e instanceof S;
|
|
1128
1128
|
}
|
|
1129
|
-
|
|
1129
|
+
function un({ selection: e, pos: t, nodeSize: n, selectedOnTextSelection: r = !1 }) {
|
|
1130
|
+
let { from: i, to: a } = e;
|
|
1131
|
+
return !!(i <= t && a >= t + n || r && ze(e) && i > t && a < t + n);
|
|
1132
|
+
}
|
|
1133
|
+
var dn = class e {
|
|
1130
1134
|
constructor(e) {
|
|
1131
1135
|
this.position = e;
|
|
1132
1136
|
}
|
|
@@ -1137,18 +1141,18 @@ var fn = class e {
|
|
|
1137
1141
|
return { position: this.position };
|
|
1138
1142
|
}
|
|
1139
1143
|
};
|
|
1140
|
-
function
|
|
1144
|
+
function fn(e, t) {
|
|
1141
1145
|
let n = t.mapping.mapResult(e.position);
|
|
1142
1146
|
return {
|
|
1143
|
-
position: new
|
|
1147
|
+
position: new dn(n.pos),
|
|
1144
1148
|
mapResult: n
|
|
1145
1149
|
};
|
|
1146
1150
|
}
|
|
1147
|
-
function
|
|
1148
|
-
return new
|
|
1151
|
+
function pn(e) {
|
|
1152
|
+
return new dn(e);
|
|
1149
1153
|
}
|
|
1150
|
-
function
|
|
1151
|
-
let r = e.state.doc.content.size, i =
|
|
1154
|
+
function mn(e, t, n) {
|
|
1155
|
+
let r = e.state.doc.content.size, i = F(t, 0, r), a = F(n, 0, r), o = e.coordsAtPos(i), s = e.coordsAtPos(a, -1), c = Math.min(o.top, s.top), l = Math.max(o.bottom, s.bottom), u = Math.min(o.left, s.left), d = Math.max(o.right, s.right), f = {
|
|
1152
1156
|
top: c,
|
|
1153
1157
|
bottom: l,
|
|
1154
1158
|
left: u,
|
|
@@ -1163,9 +1167,9 @@ function hn(e, t, n) {
|
|
|
1163
1167
|
toJSON: () => f
|
|
1164
1168
|
};
|
|
1165
1169
|
}
|
|
1166
|
-
function
|
|
1170
|
+
function hn(e, t, n) {
|
|
1167
1171
|
let { selection: r } = t, i = null;
|
|
1168
|
-
if (
|
|
1172
|
+
if (ze(r) && (i = r.$cursor), i) {
|
|
1169
1173
|
let t = e.storedMarks ?? i.marks();
|
|
1170
1174
|
return i.parent.type.allowsMarkType(n) && (!!n.isInSet(t) || !t.some((e) => e.type.excludes(n)));
|
|
1171
1175
|
}
|
|
@@ -1182,11 +1186,11 @@ function gn(e, t, n) {
|
|
|
1182
1186
|
}), i;
|
|
1183
1187
|
});
|
|
1184
1188
|
}
|
|
1185
|
-
var
|
|
1186
|
-
let { selection: a } = n, { empty: o, ranges: s } = a, c =
|
|
1189
|
+
var gn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1190
|
+
let { selection: a } = n, { empty: o, ranges: s } = a, c = P(e, r.schema);
|
|
1187
1191
|
if (i) {
|
|
1188
1192
|
if (o) {
|
|
1189
|
-
let e =
|
|
1193
|
+
let e = Tt(r, c);
|
|
1190
1194
|
n.addStoredMark(c.create({
|
|
1191
1195
|
...e,
|
|
1192
1196
|
...t
|
|
@@ -1204,9 +1208,9 @@ var _n = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1204
1208
|
});
|
|
1205
1209
|
});
|
|
1206
1210
|
}
|
|
1207
|
-
return
|
|
1208
|
-
},
|
|
1209
|
-
let a =
|
|
1211
|
+
return hn(r, n, c);
|
|
1212
|
+
}, _n = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), vn = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
|
|
1213
|
+
let a = j(e, n.schema), o;
|
|
1210
1214
|
return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) => b(a, {
|
|
1211
1215
|
...o,
|
|
1212
1216
|
...t
|
|
@@ -1214,13 +1218,13 @@ var _n = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1214
1218
|
...o,
|
|
1215
1219
|
...t
|
|
1216
1220
|
})(e, r)).run() : (console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes."), !1);
|
|
1217
|
-
},
|
|
1221
|
+
}, yn = (e) => ({ tr: t, dispatch: n }) => {
|
|
1218
1222
|
if (n) {
|
|
1219
|
-
let { doc: n } = t, r =
|
|
1223
|
+
let { doc: n } = t, r = F(e, 0, n.content.size), i = S.create(n, r);
|
|
1220
1224
|
t.setSelection(i);
|
|
1221
1225
|
}
|
|
1222
1226
|
return !0;
|
|
1223
|
-
},
|
|
1227
|
+
}, bn = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1224
1228
|
let { selection: a } = r, o, s;
|
|
1225
1229
|
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) => {
|
|
1226
1230
|
t.isText || n.setNodeMarkup(r, void 0, {
|
|
@@ -1228,31 +1232,31 @@ var _n = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1228
1232
|
dir: e
|
|
1229
1233
|
});
|
|
1230
1234
|
}), !0;
|
|
1231
|
-
},
|
|
1235
|
+
}, xn = (e) => ({ tr: t, dispatch: n }) => {
|
|
1232
1236
|
if (n) {
|
|
1233
1237
|
let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
|
|
1234
1238
|
from: e,
|
|
1235
1239
|
to: e
|
|
1236
|
-
} : e, a =
|
|
1240
|
+
} : e, a = E.atStart(n).from, o = E.atEnd(n).to, s = F(r, a, o), c = F(i, a, o), l = E.create(n, s, c);
|
|
1237
1241
|
t.setSelection(l);
|
|
1238
1242
|
}
|
|
1239
1243
|
return !0;
|
|
1240
|
-
},
|
|
1241
|
-
let r =
|
|
1242
|
-
return
|
|
1244
|
+
}, Sn = (e) => ({ state: t, dispatch: n }) => {
|
|
1245
|
+
let r = j(e, t.schema);
|
|
1246
|
+
return fe(r)(t, n);
|
|
1243
1247
|
};
|
|
1244
|
-
function
|
|
1248
|
+
function Cn(e, t) {
|
|
1245
1249
|
let n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
1246
1250
|
if (n) {
|
|
1247
1251
|
let r = n.filter((e) => t?.includes(e.type.name));
|
|
1248
1252
|
e.tr.ensureMarks(r);
|
|
1249
1253
|
}
|
|
1250
1254
|
}
|
|
1251
|
-
var
|
|
1252
|
-
let { selection: o, doc: s } = t, { $from: c, $to: l } = o, u = i.extensionManager.attributes, d =
|
|
1253
|
-
if (o instanceof
|
|
1255
|
+
var wn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: i }) => {
|
|
1256
|
+
let { selection: o, doc: s } = t, { $from: c, $to: l } = o, u = i.extensionManager.attributes, d = J(u, c.node().type.name, c.node().attrs);
|
|
1257
|
+
if (o instanceof S && o.node.isBlock) return !c.parentOffset || !a(s, c.pos) ? !1 : (r && (e && Cn(n, i.extensionManager.splittableMarks), t.split(c.pos).scrollIntoView()), !0);
|
|
1254
1258
|
if (!c.parent.isBlock) return !1;
|
|
1255
|
-
let f = l.parentOffset === l.parent.content.size, p = c.depth === 0 ? void 0 :
|
|
1259
|
+
let f = l.parentOffset === l.parent.content.size, p = c.depth === 0 ? void 0 : Ze(c.node(-1).contentMatchAt(c.indexAfter(-1))), m = f && p ? [{
|
|
1256
1260
|
type: p,
|
|
1257
1261
|
attrs: d
|
|
1258
1262
|
}] : void 0, h = a(t.doc, t.mapping.map(c.pos), 1, m);
|
|
@@ -1260,15 +1264,15 @@ var Tn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
1260
1264
|
type: p,
|
|
1261
1265
|
attrs: d
|
|
1262
1266
|
}] : void 0), r) {
|
|
1263
|
-
if (h && (o instanceof
|
|
1267
|
+
if (h && (o instanceof E && t.deleteSelection(), t.split(t.mapping.map(c.pos), 1, m), p && !f && !c.parentOffset && c.parent.type !== p)) {
|
|
1264
1268
|
let e = t.mapping.map(c.before()), n = t.doc.resolve(e);
|
|
1265
1269
|
c.node(-1).canReplaceWith(n.index(), n.index() + 1, p) && t.setNodeMarkup(t.mapping.map(c.before()), p);
|
|
1266
1270
|
}
|
|
1267
|
-
e &&
|
|
1271
|
+
e && Cn(n, i.extensionManager.splittableMarks), t.scrollIntoView();
|
|
1268
1272
|
}
|
|
1269
1273
|
return h;
|
|
1270
|
-
},
|
|
1271
|
-
let s =
|
|
1274
|
+
}, Tn = (e, t = {}) => ({ tr: n, state: r, dispatch: i, editor: o }) => {
|
|
1275
|
+
let s = j(e, r.schema), { $from: c, $to: l } = r.selection, u = r.selection.node;
|
|
1272
1276
|
if (u && u.isBlock || c.depth < 2 || !c.sameParent(l)) return !1;
|
|
1273
1277
|
let d = c.node(-1);
|
|
1274
1278
|
if (d.type !== s) return !1;
|
|
@@ -1276,28 +1280,28 @@ var Tn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
1276
1280
|
if (c.parent.content.size === 0 && c.node(-1).childCount === c.indexAfter(-1)) {
|
|
1277
1281
|
if (c.depth === 2 || c.node(-3).type !== s || c.index(-2) !== c.node(-2).childCount - 1) return !1;
|
|
1278
1282
|
if (i) {
|
|
1279
|
-
let e =
|
|
1280
|
-
for (let t = c.depth - r; t >= c.depth - 3; --t) e =
|
|
1283
|
+
let e = D.empty, r = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
|
|
1284
|
+
for (let t = c.depth - r; t >= c.depth - 3; --t) e = D.from(c.node(t).copy(e));
|
|
1281
1285
|
let i = c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3, a = {
|
|
1282
|
-
...
|
|
1286
|
+
...J(f, c.node().type.name, c.node().attrs),
|
|
1283
1287
|
...t
|
|
1284
1288
|
}, o = s.contentMatch.defaultType?.createAndFill(a) || void 0;
|
|
1285
|
-
e = e.append(
|
|
1289
|
+
e = e.append(D.from(s.createAndFill(null, o) || void 0));
|
|
1286
1290
|
let l = c.before(c.depth - (r - 1));
|
|
1287
|
-
n.replace(l, c.after(-i), new
|
|
1291
|
+
n.replace(l, c.after(-i), new ue(e, 4 - r, 0));
|
|
1288
1292
|
let u = -1;
|
|
1289
1293
|
n.doc.nodesBetween(l, n.doc.content.size, (e, t) => {
|
|
1290
1294
|
if (u > -1) return !1;
|
|
1291
1295
|
e.isTextblock && e.content.size === 0 && (u = t + 1);
|
|
1292
|
-
}), u > -1 && n.setSelection(
|
|
1296
|
+
}), u > -1 && n.setSelection(E.near(n.doc.resolve(u))), n.scrollIntoView();
|
|
1293
1297
|
}
|
|
1294
1298
|
return !0;
|
|
1295
1299
|
}
|
|
1296
1300
|
let p = l.pos === c.end() ? d.contentMatchAt(0).defaultType : null, m = {
|
|
1297
|
-
...
|
|
1301
|
+
...J(f, d.type.name, d.attrs),
|
|
1298
1302
|
...t
|
|
1299
1303
|
}, h = {
|
|
1300
|
-
...
|
|
1304
|
+
...J(f, c.node().type.name, c.node().attrs),
|
|
1301
1305
|
...t
|
|
1302
1306
|
};
|
|
1303
1307
|
n.delete(c.pos, l.pos);
|
|
@@ -1320,65 +1324,65 @@ var Tn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
1320
1324
|
}
|
|
1321
1325
|
return !0;
|
|
1322
1326
|
};
|
|
1323
|
-
function
|
|
1327
|
+
function En(e) {
|
|
1324
1328
|
return !e || e === "1" ? null : e;
|
|
1325
1329
|
}
|
|
1326
|
-
function
|
|
1327
|
-
return
|
|
1330
|
+
function Dn(e, t) {
|
|
1331
|
+
return En(e) === En(t);
|
|
1328
1332
|
}
|
|
1329
|
-
var
|
|
1330
|
-
let n =
|
|
1333
|
+
var On = (e, t) => {
|
|
1334
|
+
let n = V((e) => e.type === t)(e.selection);
|
|
1331
1335
|
if (!n) return !0;
|
|
1332
1336
|
let r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
1333
1337
|
if (r === void 0) return !0;
|
|
1334
1338
|
let a = e.doc.nodeAt(r);
|
|
1335
|
-
return !(n.node.type === a?.type && i(e.doc, n.pos)) || !
|
|
1336
|
-
},
|
|
1337
|
-
let n =
|
|
1339
|
+
return !(n.node.type === a?.type && i(e.doc, n.pos)) || !Dn(n.node.attrs.type, a?.attrs.type) || e.join(n.pos), !0;
|
|
1340
|
+
}, kn = (e, t) => {
|
|
1341
|
+
let n = V((e) => e.type === t)(e.selection);
|
|
1338
1342
|
if (!n) return !0;
|
|
1339
1343
|
let r = e.doc.resolve(n.start).after(n.depth);
|
|
1340
1344
|
if (r === void 0) return !0;
|
|
1341
1345
|
let a = e.doc.nodeAt(r);
|
|
1342
|
-
return !(n.node.type === a?.type && i(e.doc, r)) || !
|
|
1346
|
+
return !(n.node.type === a?.type && i(e.doc, r)) || !Dn(n.node.attrs.type, a?.attrs.type) || e.join(r), !0;
|
|
1343
1347
|
};
|
|
1344
|
-
function
|
|
1348
|
+
function An(e) {
|
|
1345
1349
|
let t = e.doc, n = t.firstChild;
|
|
1346
1350
|
if (!n) return null;
|
|
1347
1351
|
let r = t.resolve(1), i = t.resolve(n.nodeSize - 1);
|
|
1348
|
-
return
|
|
1352
|
+
return E.between(r, i);
|
|
1349
1353
|
}
|
|
1350
|
-
var
|
|
1351
|
-
let { extensions: d, splittableMarks: f } = i.extensionManager, p =
|
|
1354
|
+
var jn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain: c, commands: l, can: u }) => {
|
|
1355
|
+
let { extensions: d, splittableMarks: f } = i.extensionManager, p = j(e, o.schema), m = j(t, o.schema), { selection: h, storedMarks: g } = o, { $from: ee, $to: te } = h, _ = ee.blockRange(te), ne = g || h.$to.parentOffset && h.$from.marks();
|
|
1352
1356
|
if (!_) return !1;
|
|
1353
|
-
let v =
|
|
1357
|
+
let v = V((e) => cn(e.type.name, d))(h), re = h.from === 0 && h.to === o.doc.content.size, ie = o.doc.content.content, y = ie.length === 1 ? ie[0] : null, b = re && y && cn(y.type.name, d) ? {
|
|
1354
1358
|
node: y,
|
|
1355
1359
|
pos: 0,
|
|
1356
1360
|
depth: 0
|
|
1357
1361
|
} : null, x = v ?? b, ae = !!v && _.depth >= 1 && _.depth - v.depth <= 1, oe = !!b;
|
|
1358
1362
|
if ((ae || oe) && x) {
|
|
1359
1363
|
if (x.node.type === p) return re && oe ? c().command(({ tr: e, dispatch: t }) => {
|
|
1360
|
-
let n =
|
|
1364
|
+
let n = An(e);
|
|
1361
1365
|
return n ? (e.setSelection(n), t && t(e), !0) : !1;
|
|
1362
1366
|
}).liftListItem(m).run() : l.liftListItem(m);
|
|
1363
|
-
if (
|
|
1367
|
+
if (cn(x.node.type.name, d) && p.validContent(x.node.content)) return c().command(() => (a.setNodeMarkup(x.pos, p), !0)).command(() => On(a, p)).command(() => kn(a, p)).run();
|
|
1364
1368
|
}
|
|
1365
|
-
return !n || !ne || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() =>
|
|
1369
|
+
return !n || !ne || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() => On(a, p)).command(() => kn(a, p)).run() : c().command(() => {
|
|
1366
1370
|
let e = u().wrapInList(p, r), t = ne.filter((e) => f.includes(e.type.name));
|
|
1367
1371
|
return a.ensureMarks(t), e ? !0 : l.clearNodes();
|
|
1368
|
-
}).wrapInList(p, r).command(() =>
|
|
1369
|
-
},
|
|
1370
|
-
let { extendEmptyMarkRange: a = !1 } = n, o =
|
|
1371
|
-
return
|
|
1372
|
-
},
|
|
1373
|
-
let a =
|
|
1372
|
+
}).wrapInList(p, r).command(() => On(a, p)).command(() => kn(a, p)).run();
|
|
1373
|
+
}, Mn = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
|
|
1374
|
+
let { extendEmptyMarkRange: a = !1 } = n, o = P(e, r.schema);
|
|
1375
|
+
return nn(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
|
|
1376
|
+
}, Nn = (e, t, n = {}) => ({ state: r, commands: i }) => {
|
|
1377
|
+
let a = j(e, r.schema), o = j(t, r.schema), s = z(r, a, n), c;
|
|
1374
1378
|
return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), s ? i.setNode(o, c) : i.setNode(a, {
|
|
1375
1379
|
...c,
|
|
1376
1380
|
...n
|
|
1377
1381
|
});
|
|
1378
|
-
},
|
|
1379
|
-
let i =
|
|
1380
|
-
return
|
|
1381
|
-
},
|
|
1382
|
+
}, Pn = (e, t = {}) => ({ state: n, commands: r }) => {
|
|
1383
|
+
let i = j(e, n.schema);
|
|
1384
|
+
return z(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
|
|
1385
|
+
}, Fn = () => ({ state: e, dispatch: t }) => {
|
|
1382
1386
|
let n = e.plugins;
|
|
1383
1387
|
for (let r = 0; r < n.length; r += 1) {
|
|
1384
1388
|
let i = n[r], a;
|
|
@@ -1395,7 +1399,7 @@ var Mn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1395
1399
|
}
|
|
1396
1400
|
}
|
|
1397
1401
|
return !1;
|
|
1398
|
-
},
|
|
1402
|
+
}, In = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
|
|
1399
1403
|
let { ignoreClearable: i = !1 } = e, { selection: a } = t, { empty: o, ranges: s } = a;
|
|
1400
1404
|
if (o) return !0;
|
|
1401
1405
|
let { nonClearableMarks: c } = r.extensionManager;
|
|
@@ -1406,27 +1410,27 @@ var Mn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1406
1410
|
});
|
|
1407
1411
|
}
|
|
1408
1412
|
return !0;
|
|
1409
|
-
},
|
|
1410
|
-
let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s =
|
|
1413
|
+
}, Ln = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1414
|
+
let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s = P(e, r.schema), { $from: c, empty: l, ranges: u } = o;
|
|
1411
1415
|
if (!i) return !0;
|
|
1412
1416
|
if (l && a) {
|
|
1413
|
-
let { from: e, to: t } = o, r =
|
|
1417
|
+
let { from: e, to: t } = o, r = N(c, s, c.marks().find((e) => e.type === s)?.attrs);
|
|
1414
1418
|
r && (e = r.from, t = r.to), n.removeMark(e, t, s);
|
|
1415
1419
|
} else u.forEach((e) => {
|
|
1416
1420
|
n.removeMark(e.$from.pos, e.$to.pos, s);
|
|
1417
1421
|
});
|
|
1418
1422
|
return n.removeStoredMark(s), !0;
|
|
1419
|
-
},
|
|
1423
|
+
}, Rn = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
1420
1424
|
let { selection: i } = n, a, o;
|
|
1421
1425
|
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) => {
|
|
1422
1426
|
if (e.isText) return;
|
|
1423
1427
|
let r = { ...e.attrs };
|
|
1424
1428
|
delete r.dir, t.setNodeMarkup(n, void 0, r);
|
|
1425
1429
|
}), !0;
|
|
1426
|
-
},
|
|
1427
|
-
let a = null, o = null, s =
|
|
1430
|
+
}, zn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1431
|
+
let a = null, o = null, s = B(typeof e == "string" ? e : e.name, r.schema);
|
|
1428
1432
|
if (!s) return !1;
|
|
1429
|
-
s === "node" && (a =
|
|
1433
|
+
s === "node" && (a = j(e, r.schema)), s === "mark" && (o = P(e, r.schema));
|
|
1430
1434
|
let c = !1;
|
|
1431
1435
|
return n.selection.ranges.forEach((e) => {
|
|
1432
1436
|
let s = e.$from.pos, l = e.$to.pos, u, d, f, p;
|
|
@@ -1455,29 +1459,29 @@ var Mn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1455
1459
|
}));
|
|
1456
1460
|
}));
|
|
1457
1461
|
}), c;
|
|
1458
|
-
},
|
|
1462
|
+
}, X = new w("__tiptap_decorations__"), Bn = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(X, {
|
|
1459
1463
|
type: "force",
|
|
1460
1464
|
name: e
|
|
1461
|
-
}), !0),
|
|
1462
|
-
let i =
|
|
1465
|
+
}), !0), Vn = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1466
|
+
let i = j(e, n.schema);
|
|
1463
1467
|
return x(i, t)(n, r);
|
|
1464
|
-
},
|
|
1465
|
-
let i =
|
|
1466
|
-
return
|
|
1467
|
-
},
|
|
1468
|
-
function
|
|
1469
|
-
|
|
1468
|
+
}, Hn = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1469
|
+
let i = j(e, n.schema);
|
|
1470
|
+
return pe(i, t)(n, r);
|
|
1471
|
+
}, Z = /* @__PURE__ */ new WeakMap();
|
|
1472
|
+
function Un(e, t) {
|
|
1473
|
+
Z.set(e, (Z.get(e) ?? 0) + 1);
|
|
1470
1474
|
try {
|
|
1471
1475
|
return t();
|
|
1472
1476
|
} finally {
|
|
1473
|
-
let t = (
|
|
1474
|
-
t > 0 ?
|
|
1477
|
+
let t = (Z.get(e) ?? 1) - 1;
|
|
1478
|
+
t > 0 ? Z.set(e, t) : Z.delete(e);
|
|
1475
1479
|
}
|
|
1476
1480
|
}
|
|
1477
|
-
function
|
|
1478
|
-
return
|
|
1481
|
+
function Wn(e) {
|
|
1482
|
+
return Z.has(e);
|
|
1479
1483
|
}
|
|
1480
|
-
var
|
|
1484
|
+
var Gn = class {
|
|
1481
1485
|
constructor() {
|
|
1482
1486
|
this.callbacks = {};
|
|
1483
1487
|
}
|
|
@@ -1501,44 +1505,44 @@ var Kn = class {
|
|
|
1501
1505
|
removeAllListeners() {
|
|
1502
1506
|
this.callbacks = {};
|
|
1503
1507
|
}
|
|
1504
|
-
},
|
|
1505
|
-
function
|
|
1508
|
+
}, Kn = typeof process < "u" && process.env.NODE_ENV !== "production";
|
|
1509
|
+
function qn(e) {
|
|
1506
1510
|
return e.kind === "widget";
|
|
1507
1511
|
}
|
|
1508
|
-
function
|
|
1512
|
+
function Jn(e, t) {
|
|
1509
1513
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
1510
|
-
for (let i of e) i.kind === "widget" &&
|
|
1514
|
+
for (let i of e) i.kind === "widget" && qn(i) && r.add(i.key), n.push(i.toPMDecoration(t));
|
|
1511
1515
|
return {
|
|
1512
1516
|
decorations: n,
|
|
1513
1517
|
widgetKeys: r
|
|
1514
1518
|
};
|
|
1515
1519
|
}
|
|
1516
|
-
function
|
|
1517
|
-
let { decorations: r, widgetKeys: i } =
|
|
1520
|
+
function Yn(e, t, n) {
|
|
1521
|
+
let { decorations: r, widgetKeys: i } = Jn(t, n);
|
|
1518
1522
|
return {
|
|
1519
|
-
set:
|
|
1523
|
+
set: O.create(e, r),
|
|
1520
1524
|
widgetKeys: i
|
|
1521
1525
|
};
|
|
1522
1526
|
}
|
|
1523
|
-
function
|
|
1527
|
+
function Xn({ position: e, from: t, to: n, docSize: r }) {
|
|
1524
1528
|
return e < t ? !1 : e < n || e === n && n === r;
|
|
1525
1529
|
}
|
|
1526
|
-
function
|
|
1527
|
-
return e.filter((e) =>
|
|
1530
|
+
function Zn({ decorations: e, from: t, to: n, docSize: r, extensionName: i, warnedExtensions: a }) {
|
|
1531
|
+
return e.filter((e) => Xn({
|
|
1528
1532
|
position: e.anchor,
|
|
1529
1533
|
from: t,
|
|
1530
1534
|
to: n,
|
|
1531
1535
|
docSize: r
|
|
1532
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));
|
|
1533
1537
|
}
|
|
1534
|
-
function
|
|
1538
|
+
function Qn(e) {
|
|
1535
1539
|
let t = e.spec?.key;
|
|
1536
1540
|
return typeof t == "string" ? t : void 0;
|
|
1537
1541
|
}
|
|
1538
|
-
function
|
|
1542
|
+
function $n(e) {
|
|
1539
1543
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
1540
1544
|
for (let r of e.find()) {
|
|
1541
|
-
let e =
|
|
1545
|
+
let e = Qn(r);
|
|
1542
1546
|
if (!e) continue;
|
|
1543
1547
|
let i = r.spec.extensionName ?? "unknown", a = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
1544
1548
|
a.add(i), t.set(e, a), n.set(e, (n.get(e) ?? 0) + 1);
|
|
@@ -1548,18 +1552,18 @@ function er(e) {
|
|
|
1548
1552
|
extensions: t
|
|
1549
1553
|
})).filter(({ key: e }) => (n.get(e) ?? 0) > 1);
|
|
1550
1554
|
}
|
|
1551
|
-
function
|
|
1555
|
+
function er(e) {
|
|
1552
1556
|
return e.jsonID === "attr";
|
|
1553
1557
|
}
|
|
1554
|
-
function
|
|
1558
|
+
function tr(e) {
|
|
1555
1559
|
let t = !1;
|
|
1556
1560
|
if (e.getMap().forEach(() => {
|
|
1557
1561
|
t = !0;
|
|
1558
|
-
}), t ||
|
|
1562
|
+
}), t || er(e)) return !0;
|
|
1559
1563
|
let n = e;
|
|
1560
1564
|
return typeof n.from == "number" && typeof n.to == "number";
|
|
1561
1565
|
}
|
|
1562
|
-
function
|
|
1566
|
+
function nr(e, t) {
|
|
1563
1567
|
let n = null, r = 0, i = 0;
|
|
1564
1568
|
for (let a = 0; a < e.childCount && !(i > t.to); a += 1) {
|
|
1565
1569
|
let o = i + e.child(a).nodeSize;
|
|
@@ -1570,11 +1574,11 @@ function rr(e, t) {
|
|
|
1570
1574
|
to: r
|
|
1571
1575
|
};
|
|
1572
1576
|
}
|
|
1573
|
-
function
|
|
1574
|
-
if (e.steps.some((e) => !
|
|
1575
|
-
let n =
|
|
1577
|
+
function rr(e, t) {
|
|
1578
|
+
if (e.steps.some((e) => !tr(e))) return { type: "full" };
|
|
1579
|
+
let n = Zt(e).map(({ newRange: e }) => e);
|
|
1576
1580
|
e.steps.forEach((t, r) => {
|
|
1577
|
-
if (!
|
|
1581
|
+
if (!er(t)) return;
|
|
1578
1582
|
let i = e.mapping.slice(r);
|
|
1579
1583
|
n.push({
|
|
1580
1584
|
from: i.map(t.pos, -1),
|
|
@@ -1583,7 +1587,7 @@ function ir(e, t) {
|
|
|
1583
1587
|
});
|
|
1584
1588
|
let r = [];
|
|
1585
1589
|
for (let e of n) {
|
|
1586
|
-
let n =
|
|
1590
|
+
let n = nr(t, e);
|
|
1587
1591
|
n && r.push(n);
|
|
1588
1592
|
}
|
|
1589
1593
|
r.sort((e, t) => e.from - t.from);
|
|
@@ -1597,29 +1601,29 @@ function ir(e, t) {
|
|
|
1597
1601
|
ranges: i
|
|
1598
1602
|
};
|
|
1599
1603
|
}
|
|
1600
|
-
function
|
|
1604
|
+
function ir(e, t, n, r) {
|
|
1601
1605
|
return e.map(t, n, { onRemove: (e) => {
|
|
1602
1606
|
let t = e?.key;
|
|
1603
1607
|
typeof t == "string" && r.delete(t);
|
|
1604
1608
|
} });
|
|
1605
1609
|
}
|
|
1606
|
-
function
|
|
1607
|
-
let r = t.decorationSetsByExtension[e] ??
|
|
1610
|
+
function ar(e, t, n) {
|
|
1611
|
+
let r = t.decorationSetsByExtension[e] ?? O.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
|
|
1608
1612
|
return {
|
|
1609
|
-
set:
|
|
1613
|
+
set: ir(r, n.mapping, n.doc, i),
|
|
1610
1614
|
widgetKeys: i
|
|
1611
1615
|
};
|
|
1612
1616
|
}
|
|
1613
|
-
function
|
|
1617
|
+
function or(e, t) {
|
|
1614
1618
|
let n = Object.values(t).flatMap((e) => e.find());
|
|
1615
|
-
return
|
|
1619
|
+
return O.create(e, n);
|
|
1616
1620
|
}
|
|
1617
|
-
function
|
|
1621
|
+
function sr(e) {
|
|
1618
1622
|
let t = /* @__PURE__ */ new Set();
|
|
1619
1623
|
for (let n of Object.values(e)) for (let e of n) t.add(e);
|
|
1620
1624
|
return t;
|
|
1621
1625
|
}
|
|
1622
|
-
function
|
|
1626
|
+
function cr(e, t) {
|
|
1623
1627
|
switch (t.update ?? "document") {
|
|
1624
1628
|
case "document":
|
|
1625
1629
|
if (t.createInRange) throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);
|
|
@@ -1634,21 +1638,21 @@ function lr(e, t) {
|
|
|
1634
1638
|
default: throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`);
|
|
1635
1639
|
}
|
|
1636
1640
|
}
|
|
1637
|
-
function
|
|
1641
|
+
function lr(e, t, n) {
|
|
1638
1642
|
return n ? !0 : e.update === "manual" ? !1 : e.shouldUpdate ? e.shouldUpdate(t) : t.tr.docChanged;
|
|
1639
1643
|
}
|
|
1640
|
-
var
|
|
1644
|
+
var ur = /* @__PURE__ */ new Set(), dr = class {
|
|
1641
1645
|
constructor(e) {
|
|
1642
1646
|
this.warnedWidgetKeys = /* @__PURE__ */ new Set(), this.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set(), this.handleBeforeTransaction = ({ nextState: e }) => {
|
|
1643
|
-
let t =
|
|
1647
|
+
let t = X.getState(e);
|
|
1644
1648
|
t && this.warnDuplicateWidgetKeys(t);
|
|
1645
|
-
}, 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 }) => cr(e, t)), this.plugin = this.entries.length > 0 ? this.createPlugin() : null, this.editor.on("beforeTransaction", this.handleBeforeTransaction);
|
|
1646
1650
|
}
|
|
1647
1651
|
destroy() {
|
|
1648
1652
|
this.editor.off("beforeTransaction", this.handleBeforeTransaction);
|
|
1649
1653
|
}
|
|
1650
1654
|
liveWidgetKeys() {
|
|
1651
|
-
return
|
|
1655
|
+
return X.getState(this.editor.state)?.widgetKeys ?? ur;
|
|
1652
1656
|
}
|
|
1653
1657
|
get mountedView() {
|
|
1654
1658
|
return this.editor.isDestroyed ? null : this.editor.view;
|
|
@@ -1666,8 +1670,8 @@ var dr = /* @__PURE__ */ new Set(), fr = class {
|
|
|
1666
1670
|
}
|
|
1667
1671
|
createPlugin() {
|
|
1668
1672
|
let { editor: e, entries: t } = this;
|
|
1669
|
-
return new
|
|
1670
|
-
key:
|
|
1673
|
+
return new C({
|
|
1674
|
+
key: X,
|
|
1671
1675
|
state: {
|
|
1672
1676
|
init: (e, n) => {
|
|
1673
1677
|
let r = {}, i = {};
|
|
@@ -1679,22 +1683,22 @@ var dr = /* @__PURE__ */ new Set(), fr = class {
|
|
|
1679
1683
|
decorationSetsByExtension: r,
|
|
1680
1684
|
widgetKeysByExtension: i,
|
|
1681
1685
|
mergedDecorationSet: this.buildMergedSet(n.doc, r),
|
|
1682
|
-
widgetKeys:
|
|
1686
|
+
widgetKeys: sr(i)
|
|
1683
1687
|
};
|
|
1684
1688
|
return this.warnDuplicateWidgetKeys(a), a;
|
|
1685
1689
|
},
|
|
1686
1690
|
apply: (n, r, i, a) => {
|
|
1687
|
-
let o = n.getMeta(
|
|
1688
|
-
return
|
|
1691
|
+
let o = n.getMeta(X), s = o?.type === "force" && !o.name, c = o?.type === "force" ? o.name : void 0, l = {}, u = {}, d = /* @__PURE__ */ new Set();
|
|
1692
|
+
return Un(e, () => {
|
|
1689
1693
|
for (let { name: o, spec: f } of t) {
|
|
1690
1694
|
let t = s || c === o;
|
|
1691
|
-
if (!
|
|
1695
|
+
if (!lr(f, {
|
|
1692
1696
|
editor: e,
|
|
1693
1697
|
tr: n,
|
|
1694
1698
|
oldState: i,
|
|
1695
1699
|
newState: a
|
|
1696
1700
|
}, t)) {
|
|
1697
|
-
let e =
|
|
1701
|
+
let e = ar(o, r, n);
|
|
1698
1702
|
l[o] = e.set, u[o] = e.widgetKeys;
|
|
1699
1703
|
} else if (f.update === "changedRanges" && n.docChanged && !t) {
|
|
1700
1704
|
let e = this.applyChangedRangesRecompute(o, f, r, n, a);
|
|
@@ -1714,34 +1718,34 @@ var dr = /* @__PURE__ */ new Set(), fr = class {
|
|
|
1714
1718
|
decorationSetsByExtension: l,
|
|
1715
1719
|
recomputedNames: d
|
|
1716
1720
|
}),
|
|
1717
|
-
widgetKeys:
|
|
1721
|
+
widgetKeys: sr(u)
|
|
1718
1722
|
};
|
|
1719
1723
|
}
|
|
1720
1724
|
},
|
|
1721
1725
|
props: { decorations(e) {
|
|
1722
|
-
return
|
|
1726
|
+
return X.getState(e)?.mergedDecorationSet ?? O.empty;
|
|
1723
1727
|
} }
|
|
1724
1728
|
});
|
|
1725
1729
|
}
|
|
1726
1730
|
applyChangedRangesRecompute(e, t, n, r, i) {
|
|
1727
|
-
let a =
|
|
1731
|
+
let a = rr(r, i.doc);
|
|
1728
1732
|
return a.type === "full" ? this.buildFullSet(e, t, i) : this.rebuildRanges(e, t, n, r, i, a.ranges);
|
|
1729
1733
|
}
|
|
1730
1734
|
rebuildRanges(e, t, n, r, i, a) {
|
|
1731
|
-
let o = n.decorationSetsByExtension[e] ??
|
|
1735
|
+
let o = n.decorationSetsByExtension[e] ?? O.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c = ir(o, r.mapping, r.doc, s), l = i.doc.content.size;
|
|
1732
1736
|
for (let { from: n, to: r } of a) {
|
|
1733
|
-
let a = c.find(n, r).filter((e) =>
|
|
1737
|
+
let a = c.find(n, r).filter((e) => Xn({
|
|
1734
1738
|
position: e.from,
|
|
1735
1739
|
from: n,
|
|
1736
1740
|
to: r,
|
|
1737
1741
|
docSize: l
|
|
1738
1742
|
}));
|
|
1739
1743
|
for (let e of a) {
|
|
1740
|
-
let t =
|
|
1744
|
+
let t = Qn(e);
|
|
1741
1745
|
t && s.delete(t);
|
|
1742
1746
|
}
|
|
1743
1747
|
c = c.remove(a);
|
|
1744
|
-
let { decorations: o, widgetKeys: u } =
|
|
1748
|
+
let { decorations: o, widgetKeys: u } = Jn(Zn({
|
|
1745
1749
|
decorations: this.runCreate(e, "createInRange", () => t.createInRange({
|
|
1746
1750
|
editor: this.editor,
|
|
1747
1751
|
state: i,
|
|
@@ -1769,7 +1773,7 @@ var dr = /* @__PURE__ */ new Set(), fr = class {
|
|
|
1769
1773
|
state: n,
|
|
1770
1774
|
view: this.mountedView
|
|
1771
1775
|
}));
|
|
1772
|
-
return
|
|
1776
|
+
return Yn(n.doc, r, e);
|
|
1773
1777
|
}
|
|
1774
1778
|
runCreate(e, t, n) {
|
|
1775
1779
|
try {
|
|
@@ -1779,12 +1783,12 @@ var dr = /* @__PURE__ */ new Set(), fr = class {
|
|
|
1779
1783
|
}
|
|
1780
1784
|
}
|
|
1781
1785
|
warnDuplicateWidgetKeys(e) {
|
|
1782
|
-
if (!
|
|
1786
|
+
if (!Kn) return;
|
|
1783
1787
|
if (e.widgetKeys.size === 0) {
|
|
1784
1788
|
this.warnedWidgetKeys.clear();
|
|
1785
1789
|
return;
|
|
1786
1790
|
}
|
|
1787
|
-
let t =
|
|
1791
|
+
let t = $n(e.mergedDecorationSet), n = new Set(t.map(({ key: e }) => e));
|
|
1788
1792
|
for (let { key: e, extensions: n } of t) {
|
|
1789
1793
|
if (this.warnedWidgetKeys.has(e)) continue;
|
|
1790
1794
|
let t = Array.from(n).map((e) => `"${e}"`).join(", ");
|
|
@@ -1794,15 +1798,15 @@ var dr = /* @__PURE__ */ new Set(), fr = class {
|
|
|
1794
1798
|
}
|
|
1795
1799
|
buildMergedSet(e, t) {
|
|
1796
1800
|
let n = Object.keys(t);
|
|
1797
|
-
return n.length === 1 ? t[n[0]] :
|
|
1801
|
+
return n.length === 1 ? t[n[0]] : or(e, t);
|
|
1798
1802
|
}
|
|
1799
1803
|
mergeAfterApply({ entries: e, previous: t, tr: n, decorationSetsByExtension: r, recomputedNames: i }) {
|
|
1800
|
-
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) : or(n.doc, r);
|
|
1801
1805
|
}
|
|
1802
1806
|
};
|
|
1803
|
-
function
|
|
1807
|
+
function fr(e, t) {
|
|
1804
1808
|
let { selection: n } = e, { $from: r } = n;
|
|
1805
|
-
if (n instanceof
|
|
1809
|
+
if (n instanceof S) {
|
|
1806
1810
|
let e = r.index();
|
|
1807
1811
|
return r.parent.canReplaceWith(e, e + 1, t);
|
|
1808
1812
|
}
|
|
@@ -1814,16 +1818,16 @@ function pr(e, t) {
|
|
|
1814
1818
|
}
|
|
1815
1819
|
return !1;
|
|
1816
1820
|
}
|
|
1817
|
-
function
|
|
1821
|
+
function pr(e, t, n) {
|
|
1818
1822
|
let r = document.querySelector(`style[data-tiptap-style${n ? `-${n}` : ""}]`);
|
|
1819
1823
|
if (r !== null) return r;
|
|
1820
1824
|
let i = document.createElement("style");
|
|
1821
1825
|
return t && i.setAttribute("nonce", t), i.setAttribute(`data-tiptap-style${n ? `-${n}` : ""}`, ""), i.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(i), i;
|
|
1822
1826
|
}
|
|
1823
|
-
function
|
|
1827
|
+
function mr(e) {
|
|
1824
1828
|
return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
1825
1829
|
}
|
|
1826
|
-
function
|
|
1830
|
+
function hr(e, t) {
|
|
1827
1831
|
let n = e.getAttribute("style");
|
|
1828
1832
|
if (!n) return null;
|
|
1829
1833
|
let r = n.split(";").map((e) => e.trim()).filter(Boolean), i = t.toLowerCase();
|
|
@@ -1833,19 +1837,19 @@ function gr(e, t) {
|
|
|
1833
1837
|
}
|
|
1834
1838
|
return null;
|
|
1835
1839
|
}
|
|
1836
|
-
function
|
|
1840
|
+
function gr() {
|
|
1837
1841
|
return typeof navigator < "u" && /Firefox/.test(navigator.userAgent);
|
|
1838
1842
|
}
|
|
1839
|
-
function
|
|
1843
|
+
function _r(e) {
|
|
1840
1844
|
return typeof e == "number";
|
|
1841
1845
|
}
|
|
1842
|
-
function
|
|
1846
|
+
function vr(e) {
|
|
1843
1847
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
1844
1848
|
}
|
|
1845
|
-
function
|
|
1846
|
-
return
|
|
1849
|
+
function yr(e) {
|
|
1850
|
+
return vr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
1847
1851
|
}
|
|
1848
|
-
|
|
1852
|
+
_e({}, {
|
|
1849
1853
|
createAtomBlockMarkdownSpec: () => Sr,
|
|
1850
1854
|
createBlockMarkdownSpec: () => Cr,
|
|
1851
1855
|
createInlineMarkdownSpec: () => Er,
|
|
@@ -2124,8 +2128,8 @@ ${n}`;
|
|
|
2124
2128
|
}
|
|
2125
2129
|
function kr(e, t) {
|
|
2126
2130
|
let n = { ...e };
|
|
2127
|
-
return
|
|
2128
|
-
|
|
2131
|
+
return yr(e) && yr(t) && Object.keys(t).forEach((r) => {
|
|
2132
|
+
yr(t[r]) && yr(e[r]) ? n[r] = kr(e[r], t[r]) : n[r] = t[r];
|
|
2129
2133
|
}), n;
|
|
2130
2134
|
}
|
|
2131
2135
|
function Ar(e, t, n = {}) {
|
|
@@ -2148,23 +2152,23 @@ function Ar(e, t, n = {}) {
|
|
|
2148
2152
|
}
|
|
2149
2153
|
}), a.docChanged && t.view.dispatch(a);
|
|
2150
2154
|
}
|
|
2151
|
-
var
|
|
2155
|
+
var Q = class {
|
|
2152
2156
|
constructor(e) {
|
|
2153
2157
|
this.find = e.find, this.handler = e.handler, this.undoable = e.undoable ?? !0;
|
|
2154
2158
|
}
|
|
2155
2159
|
}, jr = (e, t) => {
|
|
2156
|
-
if (
|
|
2160
|
+
if (Pe(t)) return t.exec(e);
|
|
2157
2161
|
let n = t(e);
|
|
2158
2162
|
if (!n) return null;
|
|
2159
2163
|
let r = [n.text];
|
|
2160
2164
|
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;
|
|
2161
2165
|
};
|
|
2162
|
-
function
|
|
2166
|
+
function Mr(e) {
|
|
2163
2167
|
let { editor: t, from: n, to: r, text: i, rules: a, plugin: o } = e, { view: s } = t;
|
|
2164
2168
|
if (s.composing) return !1;
|
|
2165
2169
|
let c = s.state.doc.resolve(n);
|
|
2166
2170
|
if (c.parent.type.spec.code || (c.nodeBefore || c.nodeAfter)?.marks.find((e) => e.type.spec.code)) return !1;
|
|
2167
|
-
let l = !1, u =
|
|
2171
|
+
let l = !1, u = tn(c) + i;
|
|
2168
2172
|
return a.forEach((e) => {
|
|
2169
2173
|
if (l) return;
|
|
2170
2174
|
let a = jr(u, e.find);
|
|
@@ -2174,13 +2178,13 @@ function Q(e) {
|
|
|
2174
2178
|
let e = c.parentOffset - d;
|
|
2175
2179
|
if (e < 0 || c.parent.textBetween(e, c.parentOffset) !== a[0].slice(0, d)) return;
|
|
2176
2180
|
}
|
|
2177
|
-
let f = s.state.tr, p =
|
|
2181
|
+
let f = s.state.tr, p = k({
|
|
2178
2182
|
state: s.state,
|
|
2179
2183
|
transaction: f
|
|
2180
2184
|
}), m = {
|
|
2181
2185
|
from: n - (a[0].length - i.length),
|
|
2182
2186
|
to: r
|
|
2183
|
-
}, { commands: h, chain: g, can: ee } = new
|
|
2187
|
+
}, { commands: h, chain: g, can: ee } = new A({
|
|
2184
2188
|
editor: t,
|
|
2185
2189
|
state: p
|
|
2186
2190
|
});
|
|
@@ -2199,8 +2203,8 @@ function Q(e) {
|
|
|
2199
2203
|
}), s.dispatch(f), l = !0);
|
|
2200
2204
|
}), l;
|
|
2201
2205
|
}
|
|
2202
|
-
function
|
|
2203
|
-
let { editor: t, rules: n } = e, r = new
|
|
2206
|
+
function Nr(e) {
|
|
2207
|
+
let { editor: t, rules: n } = e, r = new C({
|
|
2204
2208
|
state: {
|
|
2205
2209
|
init() {
|
|
2206
2210
|
return null;
|
|
@@ -2211,9 +2215,9 @@ function Mr(e) {
|
|
|
2211
2215
|
let s = e.getMeta("applyInputRules");
|
|
2212
2216
|
return s && setTimeout(() => {
|
|
2213
2217
|
let { text: e } = s;
|
|
2214
|
-
e = typeof e == "string" ? e :
|
|
2218
|
+
e = typeof e == "string" ? e : At(D.from(e), a.schema);
|
|
2215
2219
|
let { from: i } = s, o = i + e.length;
|
|
2216
|
-
|
|
2220
|
+
Mr({
|
|
2217
2221
|
editor: t,
|
|
2218
2222
|
from: i,
|
|
2219
2223
|
to: o,
|
|
@@ -2226,7 +2230,7 @@ function Mr(e) {
|
|
|
2226
2230
|
},
|
|
2227
2231
|
props: {
|
|
2228
2232
|
handleTextInput(e, i, a, o) {
|
|
2229
|
-
return
|
|
2233
|
+
return Mr({
|
|
2230
2234
|
editor: t,
|
|
2231
2235
|
from: i,
|
|
2232
2236
|
to: a,
|
|
@@ -2237,7 +2241,7 @@ function Mr(e) {
|
|
|
2237
2241
|
},
|
|
2238
2242
|
handleDOMEvents: { compositionend: (e) => (setTimeout(() => {
|
|
2239
2243
|
let { $cursor: i } = e.state.selection;
|
|
2240
|
-
i &&
|
|
2244
|
+
i && Mr({
|
|
2241
2245
|
editor: t,
|
|
2242
2246
|
from: i.pos,
|
|
2243
2247
|
to: i.pos,
|
|
@@ -2249,7 +2253,7 @@ function Mr(e) {
|
|
|
2249
2253
|
handleKeyDown(e, i) {
|
|
2250
2254
|
if (i.key !== "Enter") return !1;
|
|
2251
2255
|
let { $cursor: a } = e.state.selection;
|
|
2252
|
-
return a ?
|
|
2256
|
+
return a ? Mr({
|
|
2253
2257
|
editor: t,
|
|
2254
2258
|
from: a.pos,
|
|
2255
2259
|
to: a.pos,
|
|
@@ -2263,7 +2267,7 @@ function Mr(e) {
|
|
|
2263
2267
|
});
|
|
2264
2268
|
return r;
|
|
2265
2269
|
}
|
|
2266
|
-
var
|
|
2270
|
+
var Pr = class {
|
|
2267
2271
|
constructor(e = {}) {
|
|
2268
2272
|
this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = { name: this.name }, this.config = {
|
|
2269
2273
|
...this.config,
|
|
@@ -2271,10 +2275,10 @@ var Nr = class {
|
|
|
2271
2275
|
}, this.name = this.config.name;
|
|
2272
2276
|
}
|
|
2273
2277
|
get options() {
|
|
2274
|
-
return { ...
|
|
2278
|
+
return { ...U(H(this, "addOptions", { name: this.name })) };
|
|
2275
2279
|
}
|
|
2276
2280
|
get storage() {
|
|
2277
|
-
return { ...
|
|
2281
|
+
return { ...U(H(this, "addStorage", {
|
|
2278
2282
|
name: this.name,
|
|
2279
2283
|
options: this.options
|
|
2280
2284
|
})) };
|
|
@@ -2293,7 +2297,7 @@ var Nr = class {
|
|
|
2293
2297
|
});
|
|
2294
2298
|
return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
|
|
2295
2299
|
}
|
|
2296
|
-
},
|
|
2300
|
+
}, Fr = class e extends Pr {
|
|
2297
2301
|
constructor() {
|
|
2298
2302
|
super(...arguments), this.type = "mark";
|
|
2299
2303
|
}
|
|
@@ -2318,27 +2322,27 @@ var Nr = class {
|
|
|
2318
2322
|
let t = typeof e == "function" ? e() : e;
|
|
2319
2323
|
return super.extend(t);
|
|
2320
2324
|
}
|
|
2321
|
-
},
|
|
2325
|
+
}, Ir = class {
|
|
2322
2326
|
constructor(e) {
|
|
2323
2327
|
this.find = e.find, this.handler = e.handler;
|
|
2324
2328
|
}
|
|
2325
|
-
},
|
|
2326
|
-
if (
|
|
2329
|
+
}, Lr = (e, t, n) => {
|
|
2330
|
+
if (Pe(t)) return [...e.matchAll(t)];
|
|
2327
2331
|
let r = t(e, n);
|
|
2328
2332
|
return r ? r.map((t) => {
|
|
2329
2333
|
let n = [t.text];
|
|
2330
2334
|
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;
|
|
2331
2335
|
}) : [];
|
|
2332
2336
|
};
|
|
2333
|
-
function
|
|
2334
|
-
let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new
|
|
2337
|
+
function Rr(e) {
|
|
2338
|
+
let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new A({
|
|
2335
2339
|
editor: t,
|
|
2336
2340
|
state: n
|
|
2337
2341
|
}), d = [];
|
|
2338
2342
|
return n.doc.nodesBetween(r, i, (e, t) => {
|
|
2339
2343
|
if (e.type?.spec?.code || !(e.isText || e.isTextblock || e.isInline)) return;
|
|
2340
2344
|
let f = e.content?.size ?? e.nodeSize ?? 0, p = Math.max(r, t), m = Math.min(i, t + f);
|
|
2341
|
-
p >= m ||
|
|
2345
|
+
p >= m || Lr(e.isText ? e.text || "" : e.textBetween(p - t, m - t, void 0, ""), a.find, o).forEach((e) => {
|
|
2342
2346
|
if (e.index === void 0) return;
|
|
2343
2347
|
let t = p + e.index + 1, r = t + e[0].length, i = {
|
|
2344
2348
|
from: n.tr.mapping.map(t),
|
|
@@ -2357,12 +2361,12 @@ function Lr(e) {
|
|
|
2357
2361
|
});
|
|
2358
2362
|
}), d.every((e) => e !== null);
|
|
2359
2363
|
}
|
|
2360
|
-
var
|
|
2364
|
+
var zr = null, Br = (e) => {
|
|
2361
2365
|
var t;
|
|
2362
2366
|
let n = new ClipboardEvent("paste", { clipboardData: new DataTransfer() });
|
|
2363
2367
|
return (t = n.clipboardData) == null || t.setData("text/html", e), n;
|
|
2364
2368
|
};
|
|
2365
|
-
function
|
|
2369
|
+
function Vr(e) {
|
|
2366
2370
|
let { editor: t, rules: n } = e, r = null, i = !1, a = !1, o = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, s;
|
|
2367
2371
|
try {
|
|
2368
2372
|
s = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
@@ -2370,11 +2374,11 @@ function Br(e) {
|
|
|
2370
2374
|
s = null;
|
|
2371
2375
|
}
|
|
2372
2376
|
let c = ({ state: e, from: n, to: r, rule: i, pasteEvt: a }) => {
|
|
2373
|
-
let c = e.tr, l =
|
|
2377
|
+
let c = e.tr, l = k({
|
|
2374
2378
|
state: e,
|
|
2375
2379
|
transaction: c
|
|
2376
2380
|
});
|
|
2377
|
-
if (!(!
|
|
2381
|
+
if (!(!Rr({
|
|
2378
2382
|
editor: t,
|
|
2379
2383
|
state: l,
|
|
2380
2384
|
from: Math.max(n - 1, 0),
|
|
@@ -2391,12 +2395,12 @@ function Br(e) {
|
|
|
2391
2395
|
return o = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
|
|
2392
2396
|
}
|
|
2393
2397
|
};
|
|
2394
|
-
return n.map((e) => new
|
|
2398
|
+
return n.map((e) => new C({
|
|
2395
2399
|
view(e) {
|
|
2396
2400
|
let n = (n) => {
|
|
2397
|
-
r = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, r && (
|
|
2401
|
+
r = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, r && (zr = t);
|
|
2398
2402
|
}, i = () => {
|
|
2399
|
-
|
|
2403
|
+
zr &&= null;
|
|
2400
2404
|
};
|
|
2401
2405
|
return window.addEventListener("dragstart", n), window.addEventListener("dragend", i), { destroy() {
|
|
2402
2406
|
window.removeEventListener("dragstart", n), window.removeEventListener("dragend", i);
|
|
@@ -2405,7 +2409,7 @@ function Br(e) {
|
|
|
2405
2409
|
props: { handleDOMEvents: {
|
|
2406
2410
|
drop: (e, t) => {
|
|
2407
2411
|
if (a = r === e.dom.parentElement, s = t, !a) {
|
|
2408
|
-
let e =
|
|
2412
|
+
let e = zr;
|
|
2409
2413
|
e?.isEditable && setTimeout(() => {
|
|
2410
2414
|
let t = e.state.selection;
|
|
2411
2415
|
t && e.commands.deleteRange({
|
|
@@ -2426,8 +2430,8 @@ function Br(e) {
|
|
|
2426
2430
|
if (!l && !u && !f) return;
|
|
2427
2431
|
if (f) {
|
|
2428
2432
|
let { text: t } = d;
|
|
2429
|
-
t = typeof t == "string" ? t :
|
|
2430
|
-
let { from: n } = d, i = n + t.length, a =
|
|
2433
|
+
t = typeof t == "string" ? t : At(D.from(t), r.schema);
|
|
2434
|
+
let { from: n } = d, i = n + t.length, a = Br(t);
|
|
2431
2435
|
return c({
|
|
2432
2436
|
rule: e,
|
|
2433
2437
|
state: r,
|
|
@@ -2437,7 +2441,7 @@ function Br(e) {
|
|
|
2437
2441
|
});
|
|
2438
2442
|
}
|
|
2439
2443
|
let p = n.doc.content.findDiffStart(r.doc.content), m = n.doc.content.findDiffEnd(r.doc.content);
|
|
2440
|
-
if (!(!
|
|
2444
|
+
if (!(!_r(p) || !m || p === m.b)) return c({
|
|
2441
2445
|
rule: e,
|
|
2442
2446
|
state: r,
|
|
2443
2447
|
from: p,
|
|
@@ -2447,18 +2451,18 @@ function Br(e) {
|
|
|
2447
2451
|
}
|
|
2448
2452
|
}));
|
|
2449
2453
|
}
|
|
2450
|
-
var
|
|
2454
|
+
var Hr = class {
|
|
2451
2455
|
constructor(e, t) {
|
|
2452
|
-
this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions =
|
|
2456
|
+
this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions = Ut(e), this.schema = Vt(this.extensions, t), this.setupExtensions();
|
|
2453
2457
|
}
|
|
2454
2458
|
get commands() {
|
|
2455
2459
|
return this.extensions.reduce((e, t) => {
|
|
2456
|
-
let n =
|
|
2460
|
+
let n = H(t, "addCommands", {
|
|
2457
2461
|
name: t.name,
|
|
2458
2462
|
options: t.options,
|
|
2459
2463
|
storage: this.editor.extensionStorage[t.name],
|
|
2460
2464
|
editor: this.editor,
|
|
2461
|
-
type:
|
|
2465
|
+
type: q(t.name, this.schema)
|
|
2462
2466
|
});
|
|
2463
2467
|
return n ? {
|
|
2464
2468
|
...e,
|
|
@@ -2467,15 +2471,15 @@ var Vr = class {
|
|
|
2467
2471
|
}, {});
|
|
2468
2472
|
}
|
|
2469
2473
|
get plugins() {
|
|
2470
|
-
let { editor: e } = this, t =
|
|
2474
|
+
let { editor: e } = this, t = K([...this.extensions].reverse()).flatMap((t) => {
|
|
2471
2475
|
let n = {
|
|
2472
2476
|
name: t.name,
|
|
2473
2477
|
options: t.options,
|
|
2474
2478
|
storage: this.editor.extensionStorage[t.name],
|
|
2475
2479
|
editor: e,
|
|
2476
|
-
type:
|
|
2477
|
-
}, r = [], i =
|
|
2478
|
-
if (t.type === "mark" &&
|
|
2480
|
+
type: q(t.name, this.schema)
|
|
2481
|
+
}, r = [], i = H(t, "addKeyboardShortcuts", n), a = {};
|
|
2482
|
+
if (t.type === "mark" && H(t, "exitable", n) && (a.ArrowRight = () => Fr.handleExit({
|
|
2479
2483
|
editor: e,
|
|
2480
2484
|
mark: t
|
|
2481
2485
|
})), i) {
|
|
@@ -2485,31 +2489,31 @@ var Vr = class {
|
|
|
2485
2489
|
...t
|
|
2486
2490
|
};
|
|
2487
2491
|
}
|
|
2488
|
-
let o =
|
|
2492
|
+
let o = he(a);
|
|
2489
2493
|
r.push(o);
|
|
2490
|
-
let s =
|
|
2491
|
-
if (
|
|
2494
|
+
let s = H(t, "addInputRules", n);
|
|
2495
|
+
if (sn(t, e.options.enableInputRules) && s) {
|
|
2492
2496
|
let t = s();
|
|
2493
2497
|
if (t && t.length) {
|
|
2494
|
-
let n =
|
|
2498
|
+
let n = Nr({
|
|
2495
2499
|
editor: e,
|
|
2496
2500
|
rules: t
|
|
2497
2501
|
}), i = Array.isArray(n) ? n : [n];
|
|
2498
2502
|
r.push(...i);
|
|
2499
2503
|
}
|
|
2500
2504
|
}
|
|
2501
|
-
let c =
|
|
2502
|
-
if (
|
|
2505
|
+
let c = H(t, "addPasteRules", n);
|
|
2506
|
+
if (sn(t, e.options.enablePasteRules) && c) {
|
|
2503
2507
|
let t = c();
|
|
2504
2508
|
if (t && t.length) {
|
|
2505
|
-
let n =
|
|
2509
|
+
let n = Vr({
|
|
2506
2510
|
editor: e,
|
|
2507
2511
|
rules: t
|
|
2508
2512
|
});
|
|
2509
2513
|
r.push(...n);
|
|
2510
2514
|
}
|
|
2511
2515
|
}
|
|
2512
|
-
let l =
|
|
2516
|
+
let l = H(t, "addProseMirrorPlugins", n);
|
|
2513
2517
|
if (l) {
|
|
2514
2518
|
let e = l();
|
|
2515
2519
|
r.push(...e);
|
|
@@ -2524,39 +2528,39 @@ var Vr = class {
|
|
|
2524
2528
|
(e = this.decorationManager) == null || e.destroy();
|
|
2525
2529
|
let n = [];
|
|
2526
2530
|
return this.extensions.forEach((e) => {
|
|
2527
|
-
let r =
|
|
2531
|
+
let r = H(e, "addDecorations", {
|
|
2528
2532
|
name: e.name,
|
|
2529
2533
|
options: e.options,
|
|
2530
2534
|
storage: this.editor.extensionStorage[e.name],
|
|
2531
2535
|
editor: t,
|
|
2532
|
-
type:
|
|
2536
|
+
type: q(e.name, this.schema)
|
|
2533
2537
|
});
|
|
2534
2538
|
r && n.push({
|
|
2535
2539
|
name: e.name,
|
|
2536
2540
|
addDecorations: r
|
|
2537
2541
|
});
|
|
2538
|
-
}), this.decorationManager = new
|
|
2542
|
+
}), this.decorationManager = new dr({
|
|
2539
2543
|
editor: t,
|
|
2540
2544
|
entries: n
|
|
2541
2545
|
}), this.decorationManager.plugin;
|
|
2542
2546
|
}
|
|
2543
2547
|
get attributes() {
|
|
2544
|
-
return
|
|
2548
|
+
return Nt(this.extensions);
|
|
2545
2549
|
}
|
|
2546
2550
|
get nodeViews() {
|
|
2547
|
-
let { editor: e } = this, { nodeExtensions: t } =
|
|
2548
|
-
return Object.fromEntries(t.filter((e) => !!
|
|
2549
|
-
let n = this.attributes.filter((e) => e.type === t.name), r =
|
|
2551
|
+
let { editor: e } = this, { nodeExtensions: t } = W(this.extensions);
|
|
2552
|
+
return Object.fromEntries(t.filter((e) => !!H(e, "addNodeView")).map((t) => {
|
|
2553
|
+
let n = this.attributes.filter((e) => e.type === t.name), r = H(t, "addNodeView", {
|
|
2550
2554
|
name: t.name,
|
|
2551
2555
|
options: t.options,
|
|
2552
2556
|
storage: this.editor.extensionStorage[t.name],
|
|
2553
2557
|
editor: e,
|
|
2554
|
-
type:
|
|
2558
|
+
type: j(t.name, this.schema)
|
|
2555
2559
|
});
|
|
2556
2560
|
if (!r) return [];
|
|
2557
2561
|
let i = r();
|
|
2558
2562
|
return i ? [t.name, (r, a, o, s, c) => {
|
|
2559
|
-
let l =
|
|
2563
|
+
let l = G(r, n);
|
|
2560
2564
|
return i({
|
|
2561
2565
|
node: r,
|
|
2562
2566
|
view: a,
|
|
@@ -2572,14 +2576,14 @@ var Vr = class {
|
|
|
2572
2576
|
}
|
|
2573
2577
|
dispatchTransaction(e) {
|
|
2574
2578
|
let { editor: t } = this;
|
|
2575
|
-
return
|
|
2579
|
+
return K([...this.extensions].reverse()).reduceRight((e, n) => {
|
|
2576
2580
|
let r = {
|
|
2577
2581
|
name: n.name,
|
|
2578
2582
|
options: n.options,
|
|
2579
2583
|
storage: this.editor.extensionStorage[n.name],
|
|
2580
2584
|
editor: t,
|
|
2581
|
-
type:
|
|
2582
|
-
}, i =
|
|
2585
|
+
type: q(n.name, this.schema)
|
|
2586
|
+
}, i = H(n, "dispatchTransaction", r);
|
|
2583
2587
|
return i ? (t) => {
|
|
2584
2588
|
i.call(r, {
|
|
2585
2589
|
transaction: t,
|
|
@@ -2590,14 +2594,14 @@ var Vr = class {
|
|
|
2590
2594
|
}
|
|
2591
2595
|
transformPastedHTML(e) {
|
|
2592
2596
|
let { editor: t } = this;
|
|
2593
|
-
return
|
|
2597
|
+
return K([...this.extensions]).reduce((e, n) => {
|
|
2594
2598
|
let r = {
|
|
2595
2599
|
name: n.name,
|
|
2596
2600
|
options: n.options,
|
|
2597
2601
|
storage: this.editor.extensionStorage[n.name],
|
|
2598
2602
|
editor: t,
|
|
2599
|
-
type:
|
|
2600
|
-
}, i =
|
|
2603
|
+
type: q(n.name, this.schema)
|
|
2604
|
+
}, i = H(n, "transformPastedHTML", r);
|
|
2601
2605
|
return i ? (t, n) => {
|
|
2602
2606
|
let a = e(t, n);
|
|
2603
2607
|
return i.call(r, a);
|
|
@@ -2605,17 +2609,17 @@ var Vr = class {
|
|
|
2605
2609
|
}, e || ((e) => e));
|
|
2606
2610
|
}
|
|
2607
2611
|
get markViews() {
|
|
2608
|
-
let { editor: e } = this, { markExtensions: t } =
|
|
2609
|
-
return Object.fromEntries(t.filter((e) => !!
|
|
2610
|
-
let n = this.attributes.filter((e) => e.type === t.name), r =
|
|
2612
|
+
let { editor: e } = this, { markExtensions: t } = W(this.extensions);
|
|
2613
|
+
return Object.fromEntries(t.filter((e) => !!H(e, "addMarkView")).map((t) => {
|
|
2614
|
+
let n = this.attributes.filter((e) => e.type === t.name), r = H(t, "addMarkView", {
|
|
2611
2615
|
name: t.name,
|
|
2612
2616
|
options: t.options,
|
|
2613
2617
|
storage: this.editor.extensionStorage[t.name],
|
|
2614
2618
|
editor: e,
|
|
2615
|
-
type:
|
|
2619
|
+
type: P(t.name, this.schema)
|
|
2616
2620
|
});
|
|
2617
2621
|
return r ? [t.name, (i, a, o) => {
|
|
2618
|
-
let s =
|
|
2622
|
+
let s = G(i, n);
|
|
2619
2623
|
return r()({
|
|
2620
2624
|
mark: i,
|
|
2621
2625
|
view: a,
|
|
@@ -2648,28 +2652,28 @@ var Vr = class {
|
|
|
2648
2652
|
options: e.options,
|
|
2649
2653
|
storage: this.editor.extensionStorage[e.name],
|
|
2650
2654
|
editor: this.editor,
|
|
2651
|
-
type:
|
|
2655
|
+
type: q(e.name, this.schema)
|
|
2652
2656
|
};
|
|
2653
|
-
e.type === "mark" && ((
|
|
2654
|
-
let n =
|
|
2657
|
+
e.type === "mark" && ((U(H(e, "keepOnSplit", t)) ?? !0) && this.splittableMarks.push(e.name), (U(H(e, "clearable", t)) ?? !0) || this.nonClearableMarks.push(e.name));
|
|
2658
|
+
let n = H(e, "onBeforeCreate", t), r = H(e, "onCreate", t), i = H(e, "onUpdate", t), a = H(e, "onSelectionUpdate", t), o = H(e, "onTransaction", t), s = H(e, "onFocus", t), c = H(e, "onBlur", t), l = H(e, "onDestroy", t);
|
|
2655
2659
|
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);
|
|
2656
2660
|
});
|
|
2657
2661
|
}
|
|
2658
2662
|
};
|
|
2659
|
-
|
|
2660
|
-
ClipboardTextSerializer: () =>
|
|
2661
|
-
Commands: () =>
|
|
2662
|
-
Delete: () =>
|
|
2663
|
-
Drop: () =>
|
|
2664
|
-
Editable: () =>
|
|
2665
|
-
FocusEvents: () =>
|
|
2666
|
-
Keymap: () =>
|
|
2667
|
-
Paste: () =>
|
|
2668
|
-
Tabindex: () =>
|
|
2669
|
-
TextDirection: () =>
|
|
2670
|
-
focusEventsPluginKey: () =>
|
|
2663
|
+
Hr.resolve = Ut, Hr.sort = K, Hr.flatten = kt, _e({}, {
|
|
2664
|
+
ClipboardTextSerializer: () => Ur,
|
|
2665
|
+
Commands: () => Wr,
|
|
2666
|
+
Delete: () => Gr,
|
|
2667
|
+
Drop: () => Kr,
|
|
2668
|
+
Editable: () => qr,
|
|
2669
|
+
FocusEvents: () => Yr,
|
|
2670
|
+
Keymap: () => Xr,
|
|
2671
|
+
Paste: () => Zr,
|
|
2672
|
+
Tabindex: () => Qr,
|
|
2673
|
+
TextDirection: () => $r,
|
|
2674
|
+
focusEventsPluginKey: () => Jr
|
|
2671
2675
|
});
|
|
2672
|
-
var $ = class e extends
|
|
2676
|
+
var $ = class e extends Pr {
|
|
2673
2677
|
constructor() {
|
|
2674
2678
|
super(...arguments), this.type = "extension";
|
|
2675
2679
|
}
|
|
@@ -2684,39 +2688,39 @@ var $ = class e extends Nr {
|
|
|
2684
2688
|
let t = typeof e == "function" ? e() : e;
|
|
2685
2689
|
return super.extend(t);
|
|
2686
2690
|
}
|
|
2687
|
-
},
|
|
2691
|
+
}, Ur = $.create({
|
|
2688
2692
|
name: "clipboardTextSerializer",
|
|
2689
2693
|
addOptions() {
|
|
2690
2694
|
return { blockSeparator: void 0 };
|
|
2691
2695
|
},
|
|
2692
2696
|
addProseMirrorPlugins() {
|
|
2693
|
-
return [new
|
|
2694
|
-
key: new
|
|
2697
|
+
return [new C({
|
|
2698
|
+
key: new w("clipboardTextSerializer"),
|
|
2695
2699
|
props: { clipboardTextSerializer: () => {
|
|
2696
|
-
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a =
|
|
2700
|
+
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a = Kt(n), { blockSeparator: o } = this.options, s = {
|
|
2697
2701
|
...o === void 0 ? {} : { blockSeparator: o },
|
|
2698
2702
|
textSerializers: a
|
|
2699
2703
|
};
|
|
2700
|
-
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) =>
|
|
2704
|
+
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) => Wt(r, {
|
|
2701
2705
|
from: e.pos,
|
|
2702
2706
|
to: t.pos
|
|
2703
2707
|
}, s)).join(o ?? "\n\n");
|
|
2704
2708
|
} }
|
|
2705
2709
|
})];
|
|
2706
2710
|
}
|
|
2707
|
-
}),
|
|
2711
|
+
}), Wr = $.create({
|
|
2708
2712
|
name: "commands",
|
|
2709
2713
|
addCommands() {
|
|
2710
|
-
return { ...
|
|
2714
|
+
return { ...ve };
|
|
2711
2715
|
}
|
|
2712
|
-
}),
|
|
2716
|
+
}), Gr = $.create({
|
|
2713
2717
|
name: "delete",
|
|
2714
2718
|
onUpdate({ transaction: t, appendedTransactions: n }) {
|
|
2715
2719
|
let r = () => {
|
|
2716
2720
|
var r;
|
|
2717
2721
|
if (((r = this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(r, t) ?? t.getMeta("y-sync$")) return;
|
|
2718
|
-
let i =
|
|
2719
|
-
|
|
2722
|
+
let i = Et(t.before, [t, ...n]);
|
|
2723
|
+
Zt(i).forEach((e) => {
|
|
2720
2724
|
i.mapping.mapResult(e.oldRange.from).deletedAfter && i.mapping.mapResult(e.oldRange.to).deletedBefore && i.before.nodesBetween(e.oldRange.from, e.oldRange.to, (n, r) => {
|
|
2721
2725
|
let a = r + n.nodeSize - 2, o = e.oldRange.from <= r && a <= e.oldRange.to;
|
|
2722
2726
|
this.editor.emit("delete", {
|
|
@@ -2762,11 +2766,11 @@ var $ = class e extends Nr {
|
|
|
2762
2766
|
};
|
|
2763
2767
|
this.editor.options.coreExtensionOptions?.delete?.async ?? !0 ? setTimeout(r, 0) : r();
|
|
2764
2768
|
}
|
|
2765
|
-
}),
|
|
2769
|
+
}), Kr = $.create({
|
|
2766
2770
|
name: "drop",
|
|
2767
2771
|
addProseMirrorPlugins() {
|
|
2768
|
-
return [new
|
|
2769
|
-
key: new
|
|
2772
|
+
return [new C({
|
|
2773
|
+
key: new w("tiptapDrop"),
|
|
2770
2774
|
props: { handleDrop: (e, t, n, r) => {
|
|
2771
2775
|
this.editor.emit("drop", {
|
|
2772
2776
|
editor: this.editor,
|
|
@@ -2777,20 +2781,20 @@ var $ = class e extends Nr {
|
|
|
2777
2781
|
} }
|
|
2778
2782
|
})];
|
|
2779
2783
|
}
|
|
2780
|
-
}),
|
|
2784
|
+
}), qr = $.create({
|
|
2781
2785
|
name: "editable",
|
|
2782
2786
|
addProseMirrorPlugins() {
|
|
2783
|
-
return [new
|
|
2784
|
-
key: new
|
|
2787
|
+
return [new C({
|
|
2788
|
+
key: new w("editable"),
|
|
2785
2789
|
props: { editable: () => this.editor.options.editable }
|
|
2786
2790
|
})];
|
|
2787
2791
|
}
|
|
2788
|
-
}),
|
|
2792
|
+
}), Jr = new w("focusEvents"), Yr = $.create({
|
|
2789
2793
|
name: "focusEvents",
|
|
2790
2794
|
addProseMirrorPlugins() {
|
|
2791
2795
|
let { editor: e } = this;
|
|
2792
|
-
return [new
|
|
2793
|
-
key:
|
|
2796
|
+
return [new C({
|
|
2797
|
+
key: Jr,
|
|
2794
2798
|
props: { handleDOMEvents: {
|
|
2795
2799
|
focus: (t, n) => {
|
|
2796
2800
|
e.isFocused = !0;
|
|
@@ -2805,13 +2809,13 @@ var $ = class e extends Nr {
|
|
|
2805
2809
|
} }
|
|
2806
2810
|
})];
|
|
2807
2811
|
}
|
|
2808
|
-
}),
|
|
2812
|
+
}), Xr = $.create({
|
|
2809
2813
|
name: "keymap",
|
|
2810
2814
|
addKeyboardShortcuts() {
|
|
2811
2815
|
let e = () => this.editor.commands.first(({ commands: e }) => [
|
|
2812
2816
|
() => e.undoInputRule(),
|
|
2813
2817
|
() => e.command(({ tr: t }) => {
|
|
2814
|
-
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 :
|
|
2818
|
+
let { selection: n, doc: r } = t, { empty: i, $anchor: a } = n, { pos: o, parent: s } = a, c = a.parent.isTextblock && o > 0 ? t.doc.resolve(o - 1) : a, l = c.parent.type.spec.isolating, u = a.pos - a.parentOffset, d = l && c.parent.childCount === 1 ? u === a.pos : T.atStart(r).from === o;
|
|
2815
2819
|
return !i || !s.type.isTextblock || s.textContent.length || !d || d && a.parent.type.name === "paragraph" ? !1 : e.clearNodes();
|
|
2816
2820
|
}),
|
|
2817
2821
|
() => e.deleteSelection(),
|
|
@@ -2847,21 +2851,21 @@ var $ = class e extends Nr {
|
|
|
2847
2851
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
2848
2852
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
2849
2853
|
};
|
|
2850
|
-
return
|
|
2854
|
+
return I() || st() ? i : r;
|
|
2851
2855
|
},
|
|
2852
2856
|
addProseMirrorPlugins() {
|
|
2853
|
-
return [new
|
|
2854
|
-
key: new
|
|
2857
|
+
return [new C({
|
|
2858
|
+
key: new w("clearDocument"),
|
|
2855
2859
|
appendTransaction: (e, t, n) => {
|
|
2856
2860
|
if (e.some((e) => e.getMeta("composition"))) return;
|
|
2857
2861
|
let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = e.some((e) => e.getMeta("preventClearDocument"));
|
|
2858
2862
|
if (!r || i) return;
|
|
2859
|
-
let { empty: a, from: o, to: s } = t.selection, c =
|
|
2860
|
-
if (a || o !== c || s !== l || !
|
|
2861
|
-
let u = n.tr, d =
|
|
2863
|
+
let { empty: a, from: o, to: s } = t.selection, c = T.atStart(t.doc).from, l = T.atEnd(t.doc).to;
|
|
2864
|
+
if (a || o !== c || s !== l || !Y(n.doc)) return;
|
|
2865
|
+
let u = n.tr, d = k({
|
|
2862
2866
|
state: n,
|
|
2863
2867
|
transaction: u
|
|
2864
|
-
}), { commands: f } = new
|
|
2868
|
+
}), { commands: f } = new A({
|
|
2865
2869
|
editor: this.editor,
|
|
2866
2870
|
state: d
|
|
2867
2871
|
});
|
|
@@ -2869,11 +2873,11 @@ var $ = class e extends Nr {
|
|
|
2869
2873
|
}
|
|
2870
2874
|
})];
|
|
2871
2875
|
}
|
|
2872
|
-
}),
|
|
2876
|
+
}), Zr = $.create({
|
|
2873
2877
|
name: "paste",
|
|
2874
2878
|
addProseMirrorPlugins() {
|
|
2875
|
-
return [new
|
|
2876
|
-
key: new
|
|
2879
|
+
return [new C({
|
|
2880
|
+
key: new w("tiptapPaste"),
|
|
2877
2881
|
props: { handlePaste: (e, t, n) => {
|
|
2878
2882
|
this.editor.emit("paste", {
|
|
2879
2883
|
editor: this.editor,
|
|
@@ -2883,25 +2887,25 @@ var $ = class e extends Nr {
|
|
|
2883
2887
|
} }
|
|
2884
2888
|
})];
|
|
2885
2889
|
}
|
|
2886
|
-
}),
|
|
2890
|
+
}), Qr = $.create({
|
|
2887
2891
|
name: "tabindex",
|
|
2888
2892
|
addOptions() {
|
|
2889
2893
|
return { value: void 0 };
|
|
2890
2894
|
},
|
|
2891
2895
|
addProseMirrorPlugins() {
|
|
2892
|
-
return [new
|
|
2893
|
-
key: new
|
|
2896
|
+
return [new C({
|
|
2897
|
+
key: new w("tabindex"),
|
|
2894
2898
|
props: { attributes: () => !this.editor.isEditable && this.options.value === void 0 ? {} : { tabindex: this.options.value ?? "0" } }
|
|
2895
2899
|
})];
|
|
2896
2900
|
}
|
|
2897
|
-
}),
|
|
2901
|
+
}), $r = $.create({
|
|
2898
2902
|
name: "textDirection",
|
|
2899
2903
|
addOptions() {
|
|
2900
2904
|
return { direction: void 0 };
|
|
2901
2905
|
},
|
|
2902
2906
|
addGlobalAttributes() {
|
|
2903
2907
|
if (!this.options.direction) return [];
|
|
2904
|
-
let { nodeExtensions: e } =
|
|
2908
|
+
let { nodeExtensions: e } = W(this.extensions);
|
|
2905
2909
|
return [{
|
|
2906
2910
|
types: e.filter((e) => e.name !== "text").map((e) => e.name),
|
|
2907
2911
|
attributes: { dir: {
|
|
@@ -2915,18 +2919,18 @@ var $ = class e extends Nr {
|
|
|
2915
2919
|
}];
|
|
2916
2920
|
},
|
|
2917
2921
|
addProseMirrorPlugins() {
|
|
2918
|
-
return [new
|
|
2919
|
-
key: new
|
|
2922
|
+
return [new C({
|
|
2923
|
+
key: new w("textDirection"),
|
|
2920
2924
|
props: { attributes: () => {
|
|
2921
2925
|
let e = this.options.direction;
|
|
2922
2926
|
return e ? { dir: e } : {};
|
|
2923
2927
|
} }
|
|
2924
2928
|
})];
|
|
2925
2929
|
}
|
|
2926
|
-
}),
|
|
2927
|
-
function
|
|
2928
|
-
if (
|
|
2929
|
-
|
|
2930
|
+
}), ei = !1;
|
|
2931
|
+
function ti(e) {
|
|
2932
|
+
if (ei) return;
|
|
2933
|
+
ei = !0;
|
|
2930
2934
|
let t;
|
|
2931
2935
|
try {
|
|
2932
2936
|
t = n.fromJSON(e, {
|
|
@@ -2936,9 +2940,9 @@ function ei(e) {
|
|
|
2936
2940
|
} catch {
|
|
2937
2941
|
return;
|
|
2938
2942
|
}
|
|
2939
|
-
t instanceof
|
|
2943
|
+
t instanceof D || console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.");
|
|
2940
2944
|
}
|
|
2941
|
-
var
|
|
2945
|
+
var ni = class e {
|
|
2942
2946
|
constructor(e, t, n = !1, r = null) {
|
|
2943
2947
|
this.currentNode = null, this.actualDepth = null, this.isBlock = n, this.resolvedPos = e, this.editor = t, this.currentNode = r;
|
|
2944
2948
|
}
|
|
@@ -3060,7 +3064,7 @@ var ti = class e {
|
|
|
3060
3064
|
...e
|
|
3061
3065
|
}), this.editor.view.dispatch(t);
|
|
3062
3066
|
}
|
|
3063
|
-
},
|
|
3067
|
+
}, ri = ".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}", ii = class extends Gn {
|
|
3064
3068
|
constructor(e = {}) {
|
|
3065
3069
|
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 = {
|
|
3066
3070
|
element: typeof document < "u" ? document.createElement("div") : null,
|
|
@@ -3097,19 +3101,19 @@ var ti = class e {
|
|
|
3097
3101
|
onDelete: () => null,
|
|
3098
3102
|
enableExtensionDispatchTransaction: !0
|
|
3099
3103
|
}, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
|
|
3100
|
-
getUpdatedPosition:
|
|
3101
|
-
createMappablePosition:
|
|
3104
|
+
getUpdatedPosition: fn,
|
|
3105
|
+
createMappablePosition: pn
|
|
3102
3106
|
}, 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);
|
|
3103
3107
|
let t = this.createDoc();
|
|
3104
3108
|
if (!this.editorState) {
|
|
3105
|
-
let e =
|
|
3109
|
+
let e = Be(t, this.options.autofocus);
|
|
3106
3110
|
this.editorState = oe.create({
|
|
3107
3111
|
doc: t,
|
|
3108
3112
|
schema: this.schema,
|
|
3109
3113
|
selection: e || void 0
|
|
3110
3114
|
});
|
|
3111
3115
|
}
|
|
3112
|
-
|
|
3116
|
+
ti(this.schema), this.options.element && this.mount(this.options.element);
|
|
3113
3117
|
}
|
|
3114
3118
|
mount(e) {
|
|
3115
3119
|
if (typeof document > "u") throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");
|
|
@@ -3143,7 +3147,7 @@ var ti = class e {
|
|
|
3143
3147
|
return this.commandManager.can();
|
|
3144
3148
|
}
|
|
3145
3149
|
injectCSS() {
|
|
3146
|
-
this.options.injectCSS && typeof document < "u" && (this.css =
|
|
3150
|
+
this.options.injectCSS && typeof document < "u" && (this.css = pr(ri, this.options.injectNonce));
|
|
3147
3151
|
}
|
|
3148
3152
|
setOptions(e = {}) {
|
|
3149
3153
|
this.options = {
|
|
@@ -3182,10 +3186,10 @@ var ti = class e {
|
|
|
3182
3186
|
} });
|
|
3183
3187
|
}
|
|
3184
3188
|
get state() {
|
|
3185
|
-
return
|
|
3189
|
+
return Kn && !this.hasWarnedStaleDecorationRead && Wn(this) && (this.hasWarnedStaleDecorationRead = !0, console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")), this.editorView && (this.editorState = this.view.state), this.editorState;
|
|
3186
3190
|
}
|
|
3187
3191
|
registerPlugin(e, t) {
|
|
3188
|
-
let n =
|
|
3192
|
+
let n = jt(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
|
|
3189
3193
|
return this.view.updateState(r), r;
|
|
3190
3194
|
}
|
|
3191
3195
|
unregisterPlugin(e) {
|
|
@@ -3200,25 +3204,25 @@ var ti = class e {
|
|
|
3200
3204
|
}
|
|
3201
3205
|
createExtensionManager() {
|
|
3202
3206
|
let e = [...this.options.enableCoreExtensions ? [
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
Jr,
|
|
3207
|
+
qr,
|
|
3208
|
+
Ur.configure({ blockSeparator: this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator }),
|
|
3209
|
+
Wr,
|
|
3207
3210
|
Yr,
|
|
3208
|
-
Zr.configure({ value: this.options.coreExtensionOptions?.tabindex?.value }),
|
|
3209
|
-
Gr,
|
|
3210
3211
|
Xr,
|
|
3211
|
-
|
|
3212
|
-
|
|
3212
|
+
Qr.configure({ value: this.options.coreExtensionOptions?.tabindex?.value }),
|
|
3213
|
+
Kr,
|
|
3214
|
+
Zr,
|
|
3215
|
+
Gr,
|
|
3216
|
+
$r.configure({ direction: this.options.textDirection })
|
|
3213
3217
|
].filter((e) => typeof this.options.enableCoreExtensions != "object" || this.options.enableCoreExtensions[e.name] !== !1) : [], ...this.options.extensions].filter((e) => [
|
|
3214
3218
|
"extension",
|
|
3215
3219
|
"node",
|
|
3216
3220
|
"mark"
|
|
3217
3221
|
].includes(e?.type));
|
|
3218
|
-
this.extensionManager = new
|
|
3222
|
+
this.extensionManager = new Hr(e, this);
|
|
3219
3223
|
}
|
|
3220
3224
|
createCommandManager() {
|
|
3221
|
-
this.commandManager = new
|
|
3225
|
+
this.commandManager = new A({ editor: this });
|
|
3222
3226
|
}
|
|
3223
3227
|
createSchema() {
|
|
3224
3228
|
this.schema = this.extensionManager.schema;
|
|
@@ -3226,14 +3230,14 @@ var ti = class e {
|
|
|
3226
3230
|
createDoc() {
|
|
3227
3231
|
let e;
|
|
3228
3232
|
try {
|
|
3229
|
-
e =
|
|
3233
|
+
e = Ct(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
3230
3234
|
} catch (e) {
|
|
3231
3235
|
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) throw e;
|
|
3232
|
-
let t =
|
|
3236
|
+
let t = Ct(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
3233
3237
|
return this.editorState = oe.create({
|
|
3234
3238
|
doc: t,
|
|
3235
3239
|
schema: this.schema,
|
|
3236
|
-
selection:
|
|
3240
|
+
selection: Be(t, this.options.autofocus) || void 0
|
|
3237
3241
|
}), this.emit("contentError", {
|
|
3238
3242
|
editor: this,
|
|
3239
3243
|
error: e,
|
|
@@ -3246,7 +3250,7 @@ var ti = class e {
|
|
|
3246
3250
|
}
|
|
3247
3251
|
createView(e) {
|
|
3248
3252
|
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);
|
|
3249
|
-
this.editorView = new
|
|
3253
|
+
this.editorView = new me(e, {
|
|
3250
3254
|
...t,
|
|
3251
3255
|
attributes: {
|
|
3252
3256
|
role: "textbox",
|
|
@@ -3317,30 +3321,30 @@ var ti = class e {
|
|
|
3317
3321
|
});
|
|
3318
3322
|
}
|
|
3319
3323
|
getAttributes(e) {
|
|
3320
|
-
return
|
|
3324
|
+
return Jt(this.state, e);
|
|
3321
3325
|
}
|
|
3322
3326
|
isActive(e, t) {
|
|
3323
3327
|
let n = typeof e == "string" ? e : null, r = typeof e == "string" ? t : e;
|
|
3324
|
-
return
|
|
3328
|
+
return rn(this.state, n, r);
|
|
3325
3329
|
}
|
|
3326
3330
|
getJSON() {
|
|
3327
3331
|
return this.state.doc.toJSON();
|
|
3328
3332
|
}
|
|
3329
3333
|
getHTML() {
|
|
3330
|
-
return
|
|
3334
|
+
return At(this.state.doc.content, this.schema);
|
|
3331
3335
|
}
|
|
3332
3336
|
getText(e) {
|
|
3333
3337
|
let { blockSeparator: t = "\n\n", textSerializers: n = {} } = e || {};
|
|
3334
|
-
return
|
|
3338
|
+
return Gt(this.state.doc, {
|
|
3335
3339
|
blockSeparator: t,
|
|
3336
3340
|
textSerializers: {
|
|
3337
|
-
...
|
|
3341
|
+
...Kt(this.schema),
|
|
3338
3342
|
...n
|
|
3339
3343
|
}
|
|
3340
3344
|
});
|
|
3341
3345
|
}
|
|
3342
3346
|
get isEmpty() {
|
|
3343
|
-
return
|
|
3347
|
+
return Y(this.state.doc);
|
|
3344
3348
|
}
|
|
3345
3349
|
destroy() {
|
|
3346
3350
|
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 = {});
|
|
@@ -3356,22 +3360,22 @@ var ti = class e {
|
|
|
3356
3360
|
}
|
|
3357
3361
|
$pos(e) {
|
|
3358
3362
|
let t = this.state.doc.resolve(e), n = e > 0 && t.nodeAfter && !t.nodeAfter.isText && t.nodeAfter.isAtom ? t.nodeAfter : null;
|
|
3359
|
-
return new
|
|
3363
|
+
return new ni(t, this, !1, n);
|
|
3360
3364
|
}
|
|
3361
3365
|
get $doc() {
|
|
3362
3366
|
return this.$pos(0);
|
|
3363
3367
|
}
|
|
3364
3368
|
};
|
|
3365
|
-
function
|
|
3366
|
-
return new
|
|
3369
|
+
function ai(e) {
|
|
3370
|
+
return new Q({
|
|
3367
3371
|
find: e.find,
|
|
3368
3372
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3369
|
-
let i =
|
|
3373
|
+
let i = U(e.getAttributes, void 0, r);
|
|
3370
3374
|
if (i === !1 || i === null) return null;
|
|
3371
3375
|
let { tr: a } = t, o = r[r.length - 1], s = r[0];
|
|
3372
3376
|
if (o) {
|
|
3373
3377
|
let r = s.search(/\S/), c = n.from + s.indexOf(o), l = c + o.length;
|
|
3374
|
-
if (
|
|
3378
|
+
if (Qt(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > c).length) return null;
|
|
3375
3379
|
l < n.to && a.delete(l, n.to), c > n.from && a.delete(n.from + r, c);
|
|
3376
3380
|
let u = n.from + r + o.length;
|
|
3377
3381
|
a.addMark(n.from + r, u, e.type.create(i || {})), a.removeStoredMark(e.type);
|
|
@@ -3380,11 +3384,11 @@ function ii(e) {
|
|
|
3380
3384
|
undoable: e.undoable
|
|
3381
3385
|
});
|
|
3382
3386
|
}
|
|
3383
|
-
function
|
|
3384
|
-
return new
|
|
3387
|
+
function oi(e) {
|
|
3388
|
+
return new Q({
|
|
3385
3389
|
find: e.find,
|
|
3386
3390
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3387
|
-
let i =
|
|
3391
|
+
let i = U(e.getAttributes, void 0, r) || {}, { tr: a } = t, o = n.from, s = n.to, c = e.type.create(i);
|
|
3388
3392
|
if (r[1]) {
|
|
3389
3393
|
let e = o + r[0].lastIndexOf(r[1]);
|
|
3390
3394
|
e > s ? e = s : s = e + r[1].length;
|
|
@@ -3399,19 +3403,19 @@ function ai(e) {
|
|
|
3399
3403
|
undoable: e.undoable
|
|
3400
3404
|
});
|
|
3401
3405
|
}
|
|
3402
|
-
function
|
|
3403
|
-
return new
|
|
3406
|
+
function si(e) {
|
|
3407
|
+
return new Q({
|
|
3404
3408
|
find: e.find,
|
|
3405
3409
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3406
|
-
let i = t.doc.resolve(n.from), a =
|
|
3410
|
+
let i = t.doc.resolve(n.from), a = U(e.getAttributes, void 0, r) || {};
|
|
3407
3411
|
if (!i.node(-1).canReplaceWith(i.index(-1), i.indexAfter(-1), e.type)) return null;
|
|
3408
3412
|
t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, a);
|
|
3409
3413
|
},
|
|
3410
3414
|
undoable: e.undoable
|
|
3411
3415
|
});
|
|
3412
3416
|
}
|
|
3413
|
-
function
|
|
3414
|
-
return new
|
|
3417
|
+
function ci(e) {
|
|
3418
|
+
return new Q({
|
|
3415
3419
|
find: e.find,
|
|
3416
3420
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3417
3421
|
let i = e.replace, a = n.from, o = n.to;
|
|
@@ -3426,11 +3430,11 @@ function si(e) {
|
|
|
3426
3430
|
undoable: e.undoable
|
|
3427
3431
|
});
|
|
3428
3432
|
}
|
|
3429
|
-
function
|
|
3430
|
-
return new
|
|
3433
|
+
function li(e) {
|
|
3434
|
+
return new Q({
|
|
3431
3435
|
find: e.find,
|
|
3432
3436
|
handler: ({ state: t, range: n, match: r, chain: a }) => {
|
|
3433
|
-
let s =
|
|
3437
|
+
let s = U(e.getAttributes, void 0, r) || {}, c = t.tr.delete(n.from, n.to), l = c.doc.resolve(n.from).blockRange(), u = l && o(l, e.type, s);
|
|
3434
3438
|
if (!u) return null;
|
|
3435
3439
|
if (c.wrap(l, u), e.keepMarks && e.editor) {
|
|
3436
3440
|
let { selection: n, storedMarks: r } = t, { splittableMarks: i } = e.editor.extensionManager, a = r || n.$to.parentOffset && n.$from.marks();
|
|
@@ -3449,7 +3453,7 @@ function ci(e) {
|
|
|
3449
3453
|
undoable: e.undoable
|
|
3450
3454
|
});
|
|
3451
3455
|
}
|
|
3452
|
-
var
|
|
3456
|
+
var ui = (e) => "touches" in e, di = class {
|
|
3453
3457
|
constructor(e) {
|
|
3454
3458
|
this.directions = [
|
|
3455
3459
|
"bottom-left",
|
|
@@ -3538,7 +3542,7 @@ var li = (e) => "touches" in e, ui = class {
|
|
|
3538
3542
|
e ? (this.element.style.width = `${e}px`, this.initialWidth = e) : this.initialWidth = this.element.offsetWidth, t ? (this.element.style.height = `${t}px`, this.initialHeight = t) : this.initialHeight = this.element.offsetHeight, this.initialWidth > 0 && this.initialHeight > 0 && (this.aspectRatio = this.initialWidth / this.initialHeight);
|
|
3539
3543
|
}
|
|
3540
3544
|
handleResizeStart(e, t) {
|
|
3541
|
-
e.preventDefault(), e.stopPropagation(), this.isResizing = !0, this.activeHandle = t,
|
|
3545
|
+
e.preventDefault(), e.stopPropagation(), this.isResizing = !0, this.activeHandle = t, ui(e) ? (this.startX = e.touches[0].clientX, this.startY = e.touches[0].clientY) : (this.startX = e.clientX, this.startY = e.clientY), this.startWidth = this.element.offsetWidth, this.startHeight = this.element.offsetHeight, this.startWidth > 0 && this.startHeight > 0 && (this.aspectRatio = this.startWidth / this.startHeight), this.getPos(), this.container.dataset.resizeState = "true", this.classNames.resizing && this.container.classList.add(this.classNames.resizing), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("touchmove", this.handleTouchMove), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp);
|
|
3542
3546
|
}
|
|
3543
3547
|
handleResize(e, t) {
|
|
3544
3548
|
if (!this.activeHandle) return;
|
|
@@ -3578,7 +3582,7 @@ var li = (e) => "touches" in e, ui = class {
|
|
|
3578
3582
|
height: e / this.aspectRatio
|
|
3579
3583
|
};
|
|
3580
3584
|
}
|
|
3581
|
-
},
|
|
3585
|
+
}, fi = class e extends Pr {
|
|
3582
3586
|
constructor() {
|
|
3583
3587
|
super(...arguments), this.type = "node";
|
|
3584
3588
|
}
|
|
@@ -3593,21 +3597,118 @@ var li = (e) => "touches" in e, ui = class {
|
|
|
3593
3597
|
let t = typeof e == "function" ? e() : e;
|
|
3594
3598
|
return super.extend(t);
|
|
3595
3599
|
}
|
|
3600
|
+
}, pi = class {
|
|
3601
|
+
constructor(e, t, n) {
|
|
3602
|
+
this.isDragging = !1, this.component = e, this.editor = t.editor, this.options = {
|
|
3603
|
+
stopEvent: null,
|
|
3604
|
+
ignoreMutation: null,
|
|
3605
|
+
...n
|
|
3606
|
+
}, this.extension = t.extension, this.node = t.node, this.decorations = t.decorations, this.innerDecorations = t.innerDecorations, this.view = t.view, this.HTMLAttributes = t.HTMLAttributes, this.getPos = () => {
|
|
3607
|
+
try {
|
|
3608
|
+
return t.getPos();
|
|
3609
|
+
} catch {
|
|
3610
|
+
return;
|
|
3611
|
+
}
|
|
3612
|
+
}, this.mount();
|
|
3613
|
+
}
|
|
3614
|
+
mount() {}
|
|
3615
|
+
get dom() {
|
|
3616
|
+
return this.editor.view.dom;
|
|
3617
|
+
}
|
|
3618
|
+
get contentDOM() {
|
|
3619
|
+
return null;
|
|
3620
|
+
}
|
|
3621
|
+
onDragStart(e) {
|
|
3622
|
+
var t;
|
|
3623
|
+
let { view: n } = this.editor, r = e.target, i = r.nodeType === 3 ? r.parentElement?.closest("[data-drag-handle]") : r.closest("[data-drag-handle]");
|
|
3624
|
+
if (!this.dom || this.contentDOM?.contains(r) || !i) return;
|
|
3625
|
+
let a = 0, o = 0;
|
|
3626
|
+
if (this.dom !== i) {
|
|
3627
|
+
let t = this.dom.getBoundingClientRect(), n = i.getBoundingClientRect(), r = e.offsetX ?? e.nativeEvent?.offsetX, s = e.offsetY ?? e.nativeEvent?.offsetY;
|
|
3628
|
+
a = n.x - t.x + r, o = n.y - t.y + s;
|
|
3629
|
+
}
|
|
3630
|
+
let s = this.dom.cloneNode(!0);
|
|
3631
|
+
try {
|
|
3632
|
+
let e = this.dom.getBoundingClientRect();
|
|
3633
|
+
s.style.width = `${Math.round(e.width)}px`, s.style.height = `${Math.round(e.height)}px`, s.style.boxSizing = "border-box", s.style.pointerEvents = "none";
|
|
3634
|
+
} catch {}
|
|
3635
|
+
let c = null;
|
|
3636
|
+
try {
|
|
3637
|
+
c = document.createElement("div"), c.style.position = "absolute", c.style.top = "-9999px", c.style.left = "-9999px", c.style.pointerEvents = "none", c.appendChild(s), document.body.appendChild(c), (t = e.dataTransfer) == null || t.setDragImage(s, a, o);
|
|
3638
|
+
} finally {
|
|
3639
|
+
c && setTimeout(() => {
|
|
3640
|
+
try {
|
|
3641
|
+
c?.remove();
|
|
3642
|
+
} catch {}
|
|
3643
|
+
}, 0);
|
|
3644
|
+
}
|
|
3645
|
+
let l = this.getPos();
|
|
3646
|
+
if (typeof l != "number") return;
|
|
3647
|
+
let u = S.create(n.state.doc, l), d = n.state.tr.setSelection(u);
|
|
3648
|
+
n.dispatch(d);
|
|
3649
|
+
}
|
|
3650
|
+
stopEvent(e) {
|
|
3651
|
+
if (!this.dom) return !1;
|
|
3652
|
+
if (typeof this.options.stopEvent == "function") return this.options.stopEvent({ event: e });
|
|
3653
|
+
let t = e.target;
|
|
3654
|
+
if (!(this.dom.contains(t) && !this.contentDOM?.contains(t))) return !1;
|
|
3655
|
+
let n = e.type.startsWith("drag"), r = e.type === "dragover" || e.type === "dragenter", i = e.type === "drop";
|
|
3656
|
+
if (([
|
|
3657
|
+
"INPUT",
|
|
3658
|
+
"BUTTON",
|
|
3659
|
+
"SELECT",
|
|
3660
|
+
"TEXTAREA"
|
|
3661
|
+
].includes(t.tagName) || t.isContentEditable) && !i && !n) return !0;
|
|
3662
|
+
let { isEditable: a } = this.editor, { isDragging: o } = this, s = !!this.node.type.spec.draggable, c = S.isSelectable(this.node), l = e.type === "copy", u = e.type === "paste", d = e.type === "cut", f = e.type === "mousedown";
|
|
3663
|
+
if (!s && c && n && e.target === this.dom && e.preventDefault(), s && n && !o && e.target === this.dom) return e.preventDefault(), !1;
|
|
3664
|
+
if (s && a && !o && f) {
|
|
3665
|
+
let e = t.closest("[data-drag-handle]");
|
|
3666
|
+
e && (this.dom === e || this.dom.contains(e)) && (this.isDragging = !0, document.addEventListener("dragend", () => {
|
|
3667
|
+
this.isDragging = !1;
|
|
3668
|
+
}, { once: !0 }), document.addEventListener("drop", () => {
|
|
3669
|
+
this.isDragging = !1;
|
|
3670
|
+
}, { once: !0 }), document.addEventListener("mouseup", () => {
|
|
3671
|
+
this.isDragging = !1;
|
|
3672
|
+
}, { once: !0 }));
|
|
3673
|
+
}
|
|
3674
|
+
return !(o || r || i || l || u || d || f && c);
|
|
3675
|
+
}
|
|
3676
|
+
ignoreMutation(e) {
|
|
3677
|
+
return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: e }) : this.node.isLeaf || this.node.isAtom ? !0 : e.type === "selection" || this.dom.contains(e.target) && e.type === "childList" && (I() || Ve()) && this.editor.isFocused && [...Array.from(e.addedNodes), ...Array.from(e.removedNodes)].every((e) => e.isContentEditable) ? !1 : this.contentDOM === e.target && e.type === "attributes" || !this.contentDOM.contains(e.target);
|
|
3678
|
+
}
|
|
3679
|
+
updateAttributes(e) {
|
|
3680
|
+
this.editor.commands.command(({ tr: t }) => {
|
|
3681
|
+
let n = this.getPos();
|
|
3682
|
+
return typeof n == "number" && (t.setNodeMarkup(n, void 0, {
|
|
3683
|
+
...this.node.attrs,
|
|
3684
|
+
...e
|
|
3685
|
+
}), !0);
|
|
3686
|
+
});
|
|
3687
|
+
}
|
|
3688
|
+
deleteNode() {
|
|
3689
|
+
let e = this.getPos();
|
|
3690
|
+
if (typeof e != "number") return;
|
|
3691
|
+
let t = e + this.node.nodeSize;
|
|
3692
|
+
this.editor.commands.deleteRange({
|
|
3693
|
+
from: e,
|
|
3694
|
+
to: t
|
|
3695
|
+
});
|
|
3696
|
+
}
|
|
3596
3697
|
};
|
|
3597
|
-
function
|
|
3598
|
-
return new
|
|
3698
|
+
function mi(e) {
|
|
3699
|
+
return new Ir({
|
|
3599
3700
|
find: e.find,
|
|
3600
3701
|
handler: ({ state: t, range: n, match: r, pasteEvent: i }) => {
|
|
3601
|
-
let a =
|
|
3702
|
+
let a = U(e.getAttributes, void 0, r, i);
|
|
3602
3703
|
if (a === !1 || a === null) return null;
|
|
3603
3704
|
let { tr: o } = t, s = r[r.length - 1], c = r[0], l = n.to;
|
|
3604
3705
|
if (s) {
|
|
3605
3706
|
let i = c.search(/\S/), u = n.from + c.indexOf(s), d = u + s.length;
|
|
3606
|
-
if (
|
|
3707
|
+
if (Qt(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > u).length) return null;
|
|
3607
3708
|
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);
|
|
3608
3709
|
}
|
|
3609
3710
|
}
|
|
3610
3711
|
});
|
|
3611
3712
|
}
|
|
3612
3713
|
//#endregion
|
|
3613
|
-
export {
|
|
3714
|
+
export { z as A, mn as B, G as C, an as D, Kt as E, ai as F, ci as H, mi as I, It as L, ln as M, un as N, on as O, ze as P, oi as R, en as S, Gt as T, si as U, Or as V, li as W, H as _, fi as a, $t as b, di as c, Et as d, mr as f, Zt as g, Jt as h, Fr as i, Y as j, gr as k, U as l, Ot as m, $ as n, pi as o, Dt as p, Q as r, Ir as s, ii as t, fr as u, N as v, hr as w, j as x, Qt as y, Dr as z };
|