@blocknote/core 0.52.0 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote.cjs +1 -1
- package/dist/blocknote.js +6 -6
- package/dist/{blocks-CiuUGa1E.js → blocks-BEJW9OM_.js} +516 -476
- package/dist/blocks-BEJW9OM_.js.map +1 -0
- package/dist/blocks-BPmJglFo.cjs +12 -0
- package/dist/blocks-BPmJglFo.cjs.map +1 -0
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/extensions-AitWbYdJ.cjs +52 -0
- package/dist/extensions-AitWbYdJ.cjs.map +1 -0
- package/dist/{extensions-CrUGDOks.js → extensions-BR5hkAio.js} +421 -391
- package/dist/extensions-BR5hkAio.js.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +3 -3
- package/dist/src-BHPuOo7W.cjs +21 -0
- package/dist/src-BHPuOo7W.cjs.map +1 -0
- package/dist/{src-DTF83Cl9.js → src-BUXut68d.js} +797 -779
- package/dist/src-BUXut68d.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/dist/y.cjs +1 -1
- package/dist/y.js +9 -9
- package/dist/yjs.cjs +1 -1
- package/dist/yjs.js +1 -1
- package/package.json +14 -14
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +10 -1
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +42 -8
- package/src/api/exporters/markdown/markdownExporter.ts +10 -1
- package/src/api/parsers/html/parseHTML.ts +43 -0
- package/src/blocks/Table/TableExtension.test.ts +102 -0
- package/src/blocks/ToggleWrapper/createToggleWrapper.ts +16 -5
- package/src/blocks/defaultBlockTypeGuards.ts +6 -0
- package/src/editor/Block.css +51 -1
- package/src/extensions/SideMenu/SideMenu.ts +20 -3
- package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +118 -0
- package/src/extensions/SuggestionMenu/SuggestionMenu.ts +40 -27
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +13 -3
- package/src/extensions/TableHandles/TableHandles.ts +25 -12
- package/src/extensions/TrailingNode/TrailingNode.ts +98 -32
- package/src/index.ts +1 -0
- package/src/schema/blocks/createSpec.ts +16 -3
- package/src/schema/blocks/internal.test.ts +86 -0
- package/src/schema/blocks/internal.ts +64 -0
- package/src/schema/inlineContent/createSpec.ts +9 -1
- package/src/schema/nodeViewMutations.test.ts +121 -0
- package/src/schema/nodeViewMutations.ts +46 -0
- package/types/src/api/exporters/html/util/serializeBlocksExternalHTML.d.ts +13 -0
- package/types/src/blocks/defaultBlockTypeGuards.d.ts +2 -0
- package/types/src/extensions/SideMenu/SideMenu.d.ts +5 -0
- package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +6 -0
- package/types/src/extensions/TrailingNode/TrailingNode.d.ts +5 -4
- package/types/src/index.d.ts +1 -0
- package/types/src/schema/blocks/internal.d.ts +21 -0
- package/types/src/schema/blocks/internal.test.d.ts +1 -0
- package/types/src/schema/nodeViewMutations.d.ts +3 -0
- package/types/src/schema/nodeViewMutations.test.d.ts +1 -0
- package/dist/blocks-BqHv0xhc.cjs +0 -12
- package/dist/blocks-BqHv0xhc.cjs.map +0 -1
- package/dist/blocks-CiuUGa1E.js.map +0 -1
- package/dist/extensions-CrUGDOks.js.map +0 -1
- package/dist/extensions-Ghr9QqqR.cjs +0 -52
- package/dist/extensions-Ghr9QqqR.cjs.map +0 -1
- package/dist/src-DTF83Cl9.js.map +0 -1
- package/dist/src-OfbaVbMw.cjs +0 -21
- package/dist/src-OfbaVbMw.cjs.map +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { $n as e,
|
|
2
|
-
import { r as
|
|
3
|
-
import { A as
|
|
4
|
-
import { r as
|
|
5
|
-
import { t as
|
|
6
|
-
import { DOMParser as
|
|
7
|
-
import { ReplaceAroundStep as E, ReplaceStep as
|
|
8
|
-
import { Editor as
|
|
1
|
+
import { $n as e, At as t, Cn as n, Dt as r, G as i, Kt as a, Mt as o, Nt as s, On as c, Ot as l, Pt as u, Qn as d, Rn as f, Sn as p, St as m, Tn as h, Xn as g, Yn as _, Zn as ee, _n as te, _t as v, bn as ne, bt as re, en as y, f as ie, jn as ae, k as b, kt as oe, m as se, nn as ce, nr as x, pn as le, t as ue, tn as de, tr as fe, vn as pe, xn as S, yn as me, zn as C } from "./blocks-BEJW9OM_.js";
|
|
2
|
+
import { r as he, t as ge } from "./BlockNoteExtension-B_IEJHS8.js";
|
|
3
|
+
import { A as _e, D as ve, O as ye, T as be, _ as xe, b as Se, c as Ce, f as we, g as Te, h as Ee, k as De, s as Oe, v as ke, w as Ae, x as je, y as Me } from "./extensions-BR5hkAio.js";
|
|
4
|
+
import { r as Ne } from "./UserStore-QbbPFj0z.js";
|
|
5
|
+
import { t as Pe } from "./en-CGKXfWma.js";
|
|
6
|
+
import { DOMParser as Fe, DOMSerializer as Ie, Fragment as w, NodeRange as Le, Slice as T } from "prosemirror-model";
|
|
7
|
+
import { ReplaceAroundStep as E, ReplaceStep as Re, canJoin as ze, liftTarget as Be } from "prosemirror-transform";
|
|
8
|
+
import { Editor as Ve, Extension as D, Mark as He, Node as O, combineTransactionSteps as Ue, createDocument as We, extensions as k, findChildrenInRange as Ge, findParentNodeClosestToPos as Ke, getAttributes as qe, getChangedRanges as Je, getMarkRange as Ye, getMarksBetween as Xe, getSchema as Ze, isNodeSelection as Qe, markPasteRule as $e, mergeAttributes as et, posToDOMRect as tt, selectionToInsertionEnd as nt } from "@tiptap/core";
|
|
9
9
|
import { NodeSelection as A, Plugin as j, TextSelection as M } from "prosemirror-state";
|
|
10
10
|
import { Fragment as N, Slice as P } from "@tiptap/pm/model";
|
|
11
|
-
import { CellSelection as F, TableMap as
|
|
12
|
-
import { Plugin as
|
|
13
|
-
import { digestString as
|
|
14
|
-
import { InputRule as
|
|
15
|
-
import { keymap as
|
|
16
|
-
import { Text as
|
|
17
|
-
import { Gapcursor as
|
|
11
|
+
import { CellSelection as F, TableMap as rt } from "prosemirror-tables";
|
|
12
|
+
import { Plugin as it, PluginKey as at } from "@tiptap/pm/state";
|
|
13
|
+
import { digestString as ot } from "lib0/hash/fnv1a";
|
|
14
|
+
import { InputRule as st, inputRules as ct } from "@handlewithcare/prosemirror-inputrules";
|
|
15
|
+
import { keymap as lt } from "@tiptap/pm/keymap";
|
|
16
|
+
import { Text as ut } from "@tiptap/extension-text";
|
|
17
|
+
import { Gapcursor as dt } from "@tiptap/extensions/gap-cursor";
|
|
18
18
|
//#region src/schema/inlineContent/createSpec.ts
|
|
19
|
-
function
|
|
19
|
+
function ft(e, t) {
|
|
20
20
|
let n = [{
|
|
21
21
|
tag: `[data-inline-content-type="${e.type}"]`,
|
|
22
22
|
contentElement: (e) => {
|
|
@@ -33,61 +33,61 @@ function dt(e, t) {
|
|
|
33
33
|
}
|
|
34
34
|
}), n;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
36
|
+
function pt(e, t) {
|
|
37
|
+
return ce(O.create({
|
|
38
38
|
name: e.type,
|
|
39
39
|
inline: !0,
|
|
40
40
|
group: "inline",
|
|
41
|
-
draggable:
|
|
41
|
+
draggable: t.meta?.draggable,
|
|
42
42
|
selectable: e.content === "styled",
|
|
43
43
|
atom: e.content === "none",
|
|
44
44
|
content: e.content === "styled" ? "inline*" : "",
|
|
45
45
|
addAttributes() {
|
|
46
|
-
return
|
|
46
|
+
return le(e.propSchema);
|
|
47
47
|
},
|
|
48
48
|
addKeyboardShortcuts() {
|
|
49
|
-
return
|
|
49
|
+
return de(e);
|
|
50
50
|
},
|
|
51
51
|
parseHTML() {
|
|
52
|
-
return
|
|
52
|
+
return ft(e, t.parse);
|
|
53
53
|
},
|
|
54
|
-
renderHTML({ node:
|
|
55
|
-
let
|
|
56
|
-
return t
|
|
54
|
+
renderHTML({ node: n }) {
|
|
55
|
+
let r = this.options.editor;
|
|
56
|
+
return y(t.render.call({
|
|
57
57
|
renderType: "dom",
|
|
58
58
|
props: void 0
|
|
59
|
-
},
|
|
59
|
+
}, p(n, r.schema.inlineContentSchema, r.schema.styleSchema), () => {}, r), e.type, n.attrs, e.propSchema);
|
|
60
60
|
},
|
|
61
61
|
addNodeView() {
|
|
62
|
-
return (
|
|
63
|
-
let { node:
|
|
64
|
-
return t(n.render.call({
|
|
62
|
+
return (n) => {
|
|
63
|
+
let { node: r, getPos: i } = n, a = this.options.editor, o = y(t.render.call({
|
|
65
64
|
renderType: "nodeView",
|
|
66
|
-
props:
|
|
67
|
-
},
|
|
68
|
-
let t =
|
|
69
|
-
n &&
|
|
70
|
-
},
|
|
65
|
+
props: n
|
|
66
|
+
}, p(r, a.schema.inlineContentSchema, a.schema.styleSchema), (e) => {
|
|
67
|
+
let t = s([e], a.pmSchema), n = i();
|
|
68
|
+
n && a.transact((e) => e.replaceWith(n, n + r.nodeSize, t));
|
|
69
|
+
}, a), e.type, r.attrs, e.propSchema);
|
|
70
|
+
return ae(o), o;
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
}), e.propSchema, {
|
|
74
|
-
...
|
|
75
|
-
toExternalHTML:
|
|
76
|
-
render(r, i
|
|
77
|
-
return t
|
|
74
|
+
...t,
|
|
75
|
+
toExternalHTML: t.toExternalHTML,
|
|
76
|
+
render(n, r, i) {
|
|
77
|
+
return y(t.render(n, r, i), e.type, n.props, e.propSchema);
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts
|
|
83
|
-
function
|
|
84
|
-
let a = typeof
|
|
85
|
-
let t =
|
|
83
|
+
function mt(e, n, r, i = "before") {
|
|
84
|
+
let a = typeof r == "string" ? r : r.id, s = c(e), l = n.map((e) => {
|
|
85
|
+
let t = o(e, s);
|
|
86
86
|
return t.check(), t;
|
|
87
|
-
}),
|
|
88
|
-
if (!
|
|
89
|
-
let
|
|
90
|
-
return
|
|
87
|
+
}), u = t(a, e.doc);
|
|
88
|
+
if (!u) throw Error(`Block with ID ${a} not found`);
|
|
89
|
+
let d = u.posBeforeNode;
|
|
90
|
+
return i === "after" && (d += u.node.nodeSize), e.step(new Re(d, d, new T(w.from(l), 0, 0))), l.map((t) => S(t, e.doc));
|
|
91
91
|
}
|
|
92
92
|
//#endregion
|
|
93
93
|
//#region src/api/blockManipulation/commands/replaceBlocks/util/fixColumnList.ts
|
|
@@ -99,7 +99,7 @@ function I(e) {
|
|
|
99
99
|
if (!n) throw Error("Invalid blockContainer: does not have child node.");
|
|
100
100
|
return e.childCount === 1 && t.childCount === 1 && n.type.name === "paragraph" && n.content.content.length === 0;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function ht(e, t) {
|
|
103
103
|
let n = e.doc.resolve(t), r = n.nodeAfter;
|
|
104
104
|
if (!r || r.type.name !== "columnList") throw Error("Invalid columnListPos: does not point to columnList node.");
|
|
105
105
|
for (let t = r.childCount - 1; t >= 0; t--) {
|
|
@@ -109,7 +109,7 @@ function mt(e, t) {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
function L(e, t) {
|
|
112
|
-
|
|
112
|
+
ht(e, t);
|
|
113
113
|
let n = e.doc.resolve(t).nodeAfter;
|
|
114
114
|
if (!n || n.type.name !== "columnList") throw Error("Invalid columnListPos: does not point to columnList node.");
|
|
115
115
|
if (n.childCount > 2) return;
|
|
@@ -132,49 +132,49 @@ function L(e, t) {
|
|
|
132
132
|
}
|
|
133
133
|
//#endregion
|
|
134
134
|
//#region src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts
|
|
135
|
-
function R(t, n, r
|
|
136
|
-
let
|
|
137
|
-
let t =
|
|
135
|
+
function R(e, t, n, r = {}) {
|
|
136
|
+
let i = c(e), a = n.map((e) => {
|
|
137
|
+
let t = o(e, i);
|
|
138
138
|
return t.check(), t;
|
|
139
|
-
}),
|
|
140
|
-
if (
|
|
141
|
-
if (
|
|
142
|
-
if (!
|
|
143
|
-
let
|
|
144
|
-
if (!
|
|
145
|
-
if (l.push(
|
|
146
|
-
let
|
|
147
|
-
|
|
148
|
-
let n =
|
|
149
|
-
f +=
|
|
139
|
+
}), s = new Set(t.map((e) => typeof e == "string" ? e : e.id)), l = [], u = /* @__PURE__ */ new Set(), d = typeof t[0] == "string" ? t[0] : t[0].id, f = 0;
|
|
140
|
+
if (e.doc.descendants((t, r) => {
|
|
141
|
+
if (s.size === 0) return !1;
|
|
142
|
+
if (!t.type.isInGroup("bnBlock")) return !0;
|
|
143
|
+
let i = x(t, e.doc);
|
|
144
|
+
if (!s.has(i)) return !0;
|
|
145
|
+
if (l.push(S(t, e.doc)), s.delete(i), n.length > 0 && i === d) {
|
|
146
|
+
let t = e.doc.nodeSize;
|
|
147
|
+
e.insert(r, a);
|
|
148
|
+
let n = e.doc.nodeSize;
|
|
149
|
+
f += t - n;
|
|
150
150
|
}
|
|
151
|
-
let o =
|
|
152
|
-
|
|
153
|
-
let
|
|
154
|
-
return f += o -
|
|
155
|
-
}),
|
|
156
|
-
let e = [...
|
|
151
|
+
let o = e.doc.nodeSize, c = e.doc.resolve(r - f);
|
|
152
|
+
c.node().type.name === "column" ? u.add(c.before(-1)) : c.node().type.name === "columnList" && u.add(c.before()), c.node().type.name === "blockGroup" && c.node(c.depth - 1).type.name !== "doc" && c.node().childCount === 1 ? e.delete(c.before(), c.after()) : e.delete(r - f, r - f + t.nodeSize);
|
|
153
|
+
let p = e.doc.nodeSize;
|
|
154
|
+
return f += o - p, !1;
|
|
155
|
+
}), s.size > 0) {
|
|
156
|
+
let e = [...s].join("\n");
|
|
157
157
|
throw Error("Blocks with the following IDs could not be found in the editor: " + e);
|
|
158
158
|
}
|
|
159
|
-
return
|
|
160
|
-
insertedBlocks:
|
|
159
|
+
return r.fixColumns !== !1 && u.forEach((t) => L(e, t)), {
|
|
160
|
+
insertedBlocks: a.map((t) => S(t, e.doc)),
|
|
161
161
|
removedBlocks: l
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
//#endregion
|
|
165
165
|
//#region src/api/exporters/html/util/serializeBlocksInternalHTML.ts
|
|
166
|
-
function
|
|
166
|
+
function gt(e, t, n, r, i) {
|
|
167
167
|
let a;
|
|
168
168
|
if (!t) throw Error("blockContent is required");
|
|
169
|
-
if (typeof t == "string") a =
|
|
170
|
-
else if (Array.isArray(t)) a =
|
|
171
|
-
else if (t.type === "tableContent") a =
|
|
172
|
-
else throw new
|
|
169
|
+
if (typeof t == "string") a = s([t], e.pmSchema, r);
|
|
170
|
+
else if (Array.isArray(t)) a = s(t, e.pmSchema, r);
|
|
171
|
+
else if (t.type === "tableContent") a = u(t, e.pmSchema);
|
|
172
|
+
else throw new C(t.type);
|
|
173
173
|
let o = (i?.document ?? document).createDocumentFragment();
|
|
174
174
|
for (let t of a) if (t.type.name !== "text" && e.schema.inlineContentSchema[t.type.name]) {
|
|
175
175
|
let r = e.schema.inlineContentSpecs[t.type.name].implementation;
|
|
176
176
|
if (r) {
|
|
177
|
-
let a =
|
|
177
|
+
let a = p(t, e.schema.inlineContentSchema, e.schema.styleSchema), s = r.render.call({
|
|
178
178
|
renderType: "dom",
|
|
179
179
|
props: void 0
|
|
180
180
|
}, a, () => {}, e);
|
|
@@ -192,7 +192,7 @@ function ht(e, t, n, r, i) {
|
|
|
192
192
|
let t = e.schema.styleSpecs[r.type.name].implementation.render(r.attrs.stringValue, e);
|
|
193
193
|
t.contentDOM.appendChild(n), n = t.dom;
|
|
194
194
|
} else {
|
|
195
|
-
let e = r.type.spec.toDOM(r, !0), t =
|
|
195
|
+
let e = r.type.spec.toDOM(r, !0), t = Ie.renderSpec(document, e);
|
|
196
196
|
t.contentDOM.appendChild(n), n = t.dom;
|
|
197
197
|
}
|
|
198
198
|
o.appendChild(n);
|
|
@@ -202,7 +202,7 @@ function ht(e, t, n, r, i) {
|
|
|
202
202
|
}
|
|
203
203
|
return o;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function _t(e, t, n, r) {
|
|
206
206
|
let i = e.pmSchema.nodes.blockContainer, a = t.props || {};
|
|
207
207
|
for (let [n, r] of Object.entries(e.schema.blockSchema[t.type].propSchema)) !(n in a) && r.default !== void 0 && (a[n] = r.default);
|
|
208
208
|
let o = t.children || [], s = e.blockImplementations[t.type].implementation.render.call({
|
|
@@ -214,12 +214,12 @@ function gt(e, t, n, r) {
|
|
|
214
214
|
children: o
|
|
215
215
|
}, e);
|
|
216
216
|
if (s.contentDOM && t.content) {
|
|
217
|
-
let i =
|
|
217
|
+
let i = gt(e, t.content, n, t.type, r);
|
|
218
218
|
s.contentDOM.appendChild(i);
|
|
219
219
|
}
|
|
220
220
|
if (e.pmSchema.nodes[t.type].isInGroup("bnBlock")) {
|
|
221
221
|
if (t.children && t.children.length > 0) {
|
|
222
|
-
let i =
|
|
222
|
+
let i = vt(e, t.children, n, r);
|
|
223
223
|
s.contentDOM?.append(i);
|
|
224
224
|
}
|
|
225
225
|
return s.dom;
|
|
@@ -228,55 +228,55 @@ function gt(e, t, n, r) {
|
|
|
228
228
|
id: t.id,
|
|
229
229
|
...a
|
|
230
230
|
}));
|
|
231
|
-
return c.contentDOM?.appendChild(s.dom), t.children && t.children.length > 0 && c.contentDOM?.appendChild(
|
|
231
|
+
return c.contentDOM?.appendChild(s.dom), t.children && t.children.length > 0 && c.contentDOM?.appendChild(yt(e, t.children, n, r)), c.dom;
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function vt(e, t, n, r) {
|
|
234
234
|
let i = (r?.document ?? document).createDocumentFragment();
|
|
235
235
|
for (let a of t) {
|
|
236
|
-
let t =
|
|
236
|
+
let t = _t(e, a, n, r);
|
|
237
237
|
i.appendChild(t);
|
|
238
238
|
}
|
|
239
239
|
return i;
|
|
240
240
|
}
|
|
241
|
-
var
|
|
242
|
-
let i = e.pmSchema.nodes.blockGroup, a = i.spec.toDOM(i.create({})), o =
|
|
241
|
+
var yt = (e, t, n, r) => {
|
|
242
|
+
let i = e.pmSchema.nodes.blockGroup, a = i.spec.toDOM(i.create({})), o = vt(e, t, n, r);
|
|
243
243
|
return a.contentDOM?.appendChild(o), a.dom;
|
|
244
|
-
},
|
|
244
|
+
}, bt = (e) => (e.querySelectorAll("[data-content-type=\"numberedListItem\"]").forEach((e) => {
|
|
245
245
|
let t = e.closest(".bn-block-outer")?.previousElementSibling?.querySelector("[data-content-type=\"numberedListItem\"]");
|
|
246
246
|
if (!t) e.setAttribute("data-index", e.getAttribute("data-start") || "1");
|
|
247
247
|
else {
|
|
248
248
|
let n = t.getAttribute("data-index");
|
|
249
249
|
e.setAttribute("data-index", (parseInt(n || "0") + 1).toString());
|
|
250
250
|
}
|
|
251
|
-
}), e),
|
|
251
|
+
}), e), xt = (e) => (e.querySelectorAll("[data-content-type=\"checkListItem\"] input").forEach((e) => {
|
|
252
252
|
e.disabled = !0;
|
|
253
|
-
}), e),
|
|
253
|
+
}), e), St = (e) => (e.querySelectorAll(".bn-toggle-wrapper[data-show-children=\"false\"]").forEach((e) => {
|
|
254
254
|
e.setAttribute("data-show-children", "true");
|
|
255
|
-
}), e), St = (e) => (e.querySelectorAll("[data-content-type=\"table\"] table").forEach((e) => {
|
|
256
|
-
e.setAttribute("style", "--default-cell-min-width: 120px;"), e.setAttribute("data-show-children", "true");
|
|
257
255
|
}), e), Ct = (e) => (e.querySelectorAll("[data-content-type=\"table\"] table").forEach((e) => {
|
|
256
|
+
e.setAttribute("style", "--default-cell-min-width: 120px;"), e.setAttribute("data-show-children", "true");
|
|
257
|
+
}), e), wt = (e) => (e.querySelectorAll("[data-content-type=\"table\"] table").forEach((e) => {
|
|
258
258
|
let t = document.createElement("div");
|
|
259
259
|
t.className = "tableWrapper";
|
|
260
260
|
let n = document.createElement("div");
|
|
261
261
|
n.className = "tableWrapper-inner", t.appendChild(n), e.parentElement?.appendChild(t), t.appendChild(e);
|
|
262
|
-
}), e),
|
|
262
|
+
}), e), Tt = (e) => (e.querySelectorAll(".bn-inline-content:empty").forEach((e) => {
|
|
263
263
|
let t = document.createElement("span");
|
|
264
264
|
t.className = "ProseMirror-trailingBreak", t.setAttribute("style", "display: inline-block;"), e.appendChild(t);
|
|
265
|
-
}), e),
|
|
266
|
-
let n =
|
|
267
|
-
yt,
|
|
265
|
+
}), e), Et = (e, t) => {
|
|
266
|
+
let n = Ie.fromSchema(e), r = [
|
|
268
267
|
bt,
|
|
269
268
|
xt,
|
|
270
269
|
St,
|
|
271
270
|
Ct,
|
|
272
|
-
wt
|
|
271
|
+
wt,
|
|
272
|
+
Tt
|
|
273
273
|
];
|
|
274
274
|
return { serializeBlocks: (e, i) => {
|
|
275
|
-
let a =
|
|
275
|
+
let a = yt(t, e, n, i);
|
|
276
276
|
for (let e of r) a = e(a);
|
|
277
277
|
return a.outerHTML;
|
|
278
278
|
} };
|
|
279
|
-
},
|
|
279
|
+
}, Dt = (e) => {
|
|
280
280
|
let t = 0;
|
|
281
281
|
for (let n = 0; n < e.length; n++) t = Math.imul(31, t) + e.charCodeAt(n);
|
|
282
282
|
return Math.abs(t);
|
|
@@ -301,15 +301,15 @@ var vt = (e, t, n, r) => {
|
|
|
301
301
|
light: "#bef3ff",
|
|
302
302
|
dark: "#0a7a8a"
|
|
303
303
|
}
|
|
304
|
-
],
|
|
304
|
+
], Ot = (e) => z[Dt(e) % z.length], kt = (e, t) => {
|
|
305
305
|
if (!t || t.length === 0) return z[0];
|
|
306
306
|
let n = t[0], r = e.getUser(n);
|
|
307
307
|
return r?.color && r.colorLight ? {
|
|
308
308
|
light: r.colorLight,
|
|
309
309
|
dark: r.color
|
|
310
|
-
} :
|
|
311
|
-
},
|
|
312
|
-
let t =
|
|
310
|
+
} : Ot(n);
|
|
311
|
+
}, At = (e) => ot(e).toString(16).padStart(8, "0"), jt = (e) => {
|
|
312
|
+
let t = At(e);
|
|
313
313
|
return {
|
|
314
314
|
light: `--user-color-${t}-light`,
|
|
315
315
|
dark: `--user-color-${t}-dark`
|
|
@@ -333,90 +333,90 @@ var vt = (e, t, n, r) => {
|
|
|
333
333
|
};
|
|
334
334
|
//#endregion
|
|
335
335
|
//#region src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts
|
|
336
|
-
function
|
|
337
|
-
return
|
|
338
|
-
let
|
|
339
|
-
if (
|
|
336
|
+
function Mt(e) {
|
|
337
|
+
return e.transact((e) => {
|
|
338
|
+
let t = ee(e, e.selection.anchor), n = x(t.bnBlock.node, e.doc);
|
|
339
|
+
if (e.selection instanceof F) return {
|
|
340
340
|
type: "cell",
|
|
341
|
-
anchorBlockId:
|
|
342
|
-
anchorCellOffset:
|
|
343
|
-
headCellOffset:
|
|
341
|
+
anchorBlockId: n,
|
|
342
|
+
anchorCellOffset: e.selection.$anchorCell.pos - t.bnBlock.beforePos,
|
|
343
|
+
headCellOffset: e.selection.$headCell.pos - t.bnBlock.beforePos
|
|
344
344
|
};
|
|
345
|
-
if (
|
|
345
|
+
if (e.selection instanceof A) return {
|
|
346
346
|
type: "node",
|
|
347
|
-
anchorBlockId:
|
|
347
|
+
anchorBlockId: n
|
|
348
348
|
};
|
|
349
349
|
{
|
|
350
|
-
let
|
|
350
|
+
let r = ee(e, e.selection.head);
|
|
351
351
|
return {
|
|
352
352
|
type: "text",
|
|
353
|
-
anchorBlockId:
|
|
354
|
-
headBlockId:
|
|
355
|
-
anchorOffset:
|
|
356
|
-
headOffset:
|
|
353
|
+
anchorBlockId: n,
|
|
354
|
+
headBlockId: x(r.bnBlock.node, e.doc),
|
|
355
|
+
anchorOffset: e.selection.anchor - t.bnBlock.beforePos,
|
|
356
|
+
headOffset: e.selection.head - r.bnBlock.beforePos
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
359
|
});
|
|
360
360
|
}
|
|
361
|
-
function
|
|
362
|
-
let
|
|
363
|
-
if (
|
|
364
|
-
let
|
|
365
|
-
if (
|
|
366
|
-
else if (
|
|
361
|
+
function Nt(e, n) {
|
|
362
|
+
let r = t(n.anchorBlockId, e.doc)?.posBeforeNode;
|
|
363
|
+
if (r === void 0) throw Error(`Could not find block with ID ${n.anchorBlockId} to update selection`);
|
|
364
|
+
let i;
|
|
365
|
+
if (n.type === "cell") i = F.create(e.doc, r + n.anchorCellOffset, r + n.headCellOffset);
|
|
366
|
+
else if (n.type === "node") i = A.create(e.doc, r + 1);
|
|
367
367
|
else {
|
|
368
|
-
let
|
|
369
|
-
if (
|
|
370
|
-
|
|
368
|
+
let a = t(n.headBlockId, e.doc)?.posBeforeNode;
|
|
369
|
+
if (a === void 0) throw Error(`Could not find block with ID ${n.headBlockId} to update selection`);
|
|
370
|
+
i = M.create(e.doc, r + n.anchorOffset, a + n.headOffset);
|
|
371
371
|
}
|
|
372
|
-
e.setSelection(
|
|
372
|
+
e.setSelection(i);
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function Pt(e) {
|
|
375
375
|
return e.flatMap((e) => e.type === "column" ? e.children : [e]);
|
|
376
376
|
}
|
|
377
377
|
function V(e, t, n, r) {
|
|
378
378
|
e.transact((e) => {
|
|
379
|
-
R(e, t, [], { fixColumns: !1 }),
|
|
379
|
+
R(e, t, [], { fixColumns: !1 }), mt(e, Pt(t), n, r);
|
|
380
380
|
});
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function Ft(e, t, n) {
|
|
383
383
|
e.transact((r) => {
|
|
384
|
-
let i = e.getSelection()?.blocks || [e.getTextCursorPosition().block], a =
|
|
385
|
-
V(e, i, t, n),
|
|
384
|
+
let i = e.getSelection()?.blocks || [e.getTextCursorPosition().block], a = Mt(e);
|
|
385
|
+
V(e, i, t, n), Nt(r, a);
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function It(e) {
|
|
389
389
|
return !e || e.type !== "columnList";
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function Lt(e, t, n) {
|
|
392
392
|
let r, i;
|
|
393
393
|
if (t ? t.children.length > 0 ? (r = t.children[t.children.length - 1], i = "after") : (r = t, i = "before") : n && (r = n, i = "before"), !r || !i) return;
|
|
394
394
|
let a = e.getParentBlock(r);
|
|
395
|
-
return
|
|
395
|
+
return It(a) ? {
|
|
396
396
|
referenceBlock: r,
|
|
397
397
|
placement: i
|
|
398
|
-
} :
|
|
398
|
+
} : Lt(e, i === "after" ? r : e.getPrevBlock(r), a);
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function Rt(e, t, n) {
|
|
401
401
|
let r, i;
|
|
402
402
|
if (t ? t.children.length > 0 ? (r = t.children[0], i = "before") : (r = t, i = "after") : n && (r = n, i = "after"), !r || !i) return;
|
|
403
403
|
let a = e.getParentBlock(r);
|
|
404
|
-
return
|
|
404
|
+
return It(a) ? {
|
|
405
405
|
referenceBlock: r,
|
|
406
406
|
placement: i
|
|
407
|
-
} :
|
|
407
|
+
} : Rt(e, i === "before" ? r : e.getNextBlock(r), a);
|
|
408
408
|
}
|
|
409
|
-
function
|
|
409
|
+
function zt(e, t) {
|
|
410
410
|
e.transact(() => {
|
|
411
411
|
let n;
|
|
412
412
|
if (t) {
|
|
413
413
|
if (n = e.getBlock(t), !n) return;
|
|
414
414
|
} else n = e.getSelection()?.blocks[0] || e.getTextCursorPosition().block;
|
|
415
|
-
let r =
|
|
416
|
-
r && (t ? V(e, [n], r.referenceBlock, r.placement) :
|
|
415
|
+
let r = Lt(e, e.getPrevBlock(n), e.getParentBlock(n));
|
|
416
|
+
r && (t ? V(e, [n], r.referenceBlock, r.placement) : Ft(e, r.referenceBlock, r.placement));
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
|
-
function
|
|
419
|
+
function Bt(e, t) {
|
|
420
420
|
e.transact(() => {
|
|
421
421
|
let n;
|
|
422
422
|
if (t) {
|
|
@@ -425,13 +425,13 @@ function zt(e, t) {
|
|
|
425
425
|
let t = e.getSelection();
|
|
426
426
|
n = t?.blocks[t?.blocks.length - 1] || e.getTextCursorPosition().block;
|
|
427
427
|
}
|
|
428
|
-
let r =
|
|
429
|
-
r && (t ? V(e, [n], r.referenceBlock, r.placement) :
|
|
428
|
+
let r = Rt(e, e.getNextBlock(n), e.getParentBlock(n));
|
|
429
|
+
r && (t ? V(e, [n], r.referenceBlock, r.placement) : Ft(e, r.referenceBlock, r.placement));
|
|
430
430
|
});
|
|
431
431
|
}
|
|
432
432
|
//#endregion
|
|
433
433
|
//#region src/api/blockManipulation/commands/nestBlock/nestBlock.ts
|
|
434
|
-
function
|
|
434
|
+
function Vt(e, t, n) {
|
|
435
435
|
let { $from: r, $to: i } = e.selection, a = r.blockRange(i, (e) => e.childCount > 0 && (e.type.name === "blockGroup" || e.type.name === "column"));
|
|
436
436
|
if (!a) return !1;
|
|
437
437
|
let o = a.startIndex;
|
|
@@ -441,85 +441,85 @@ function Bt(e, t, n) {
|
|
|
441
441
|
let c = s.lastChild && s.lastChild.type === n, l = w.from(c ? t.create() : null), u = new T(w.from(t.create(null, w.from(n.create(null, l)))), c ? 3 : 1, 0), d = a.start, f = a.end;
|
|
442
442
|
return e.step(new E(d - (c ? 3 : 1), f, d, f, u, 1, !0)).scrollIntoView(), !0;
|
|
443
443
|
}
|
|
444
|
-
function
|
|
445
|
-
return e.transact((t) =>
|
|
444
|
+
function Ht(e) {
|
|
445
|
+
return e.transact((t) => Vt(t, e.pmSchema.nodes.blockContainer, e.pmSchema.nodes.blockGroup));
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function Ut(e, t, n, r) {
|
|
448
448
|
let i = r.end, a = r.$to.end(r.depth);
|
|
449
449
|
if (i < a) {
|
|
450
450
|
let o = r.parent.child(r.endIndex - 1), s = o.lastChild && o.lastChild.type === n;
|
|
451
|
-
e.step(new E(i - (s ? 2 : 1), a, i, a, new T(w.from(t.create(null, n.create())), s ? 2 : 1, 0), +!s, !0)), r = new
|
|
451
|
+
e.step(new E(i - (s ? 2 : 1), a, i, a, new T(w.from(t.create(null, n.create())), s ? 2 : 1, 0), +!s, !0)), r = new Le(e.doc.resolve(r.$from.pos), e.doc.resolve(a), r.depth);
|
|
452
452
|
}
|
|
453
|
-
let o =
|
|
453
|
+
let o = Be(r);
|
|
454
454
|
if (o == null) return !1;
|
|
455
455
|
e.lift(r, o);
|
|
456
456
|
let s = e.doc.resolve(e.mapping.map(i, -1) - 1);
|
|
457
|
-
return
|
|
457
|
+
return ze(e.doc, s.pos) && s.nodeBefore.type === s.nodeAfter.type && e.join(s.pos), e.scrollIntoView(), !0;
|
|
458
458
|
}
|
|
459
459
|
function H(e, t, n) {
|
|
460
460
|
let { $from: r, $to: i } = e.selection, a = r.blockRange(i, (e) => e.childCount > 0 && (e.type.name === "blockGroup" || e.type.name === "column"));
|
|
461
|
-
return a && r.node(a.depth - 1).type === t ?
|
|
461
|
+
return a && r.node(a.depth - 1).type === t ? Ut(e, t, n, a) : !1;
|
|
462
462
|
}
|
|
463
|
-
function
|
|
463
|
+
function Wt(e) {
|
|
464
464
|
return e.transact((t) => H(t, e.pmSchema.nodes.blockContainer, e.pmSchema.nodes.blockGroup));
|
|
465
465
|
}
|
|
466
|
-
function
|
|
467
|
-
return
|
|
468
|
-
let { bnBlock:
|
|
469
|
-
return
|
|
466
|
+
function Gt(t) {
|
|
467
|
+
return t.transact((t) => {
|
|
468
|
+
let { bnBlock: n } = e(t);
|
|
469
|
+
return t.doc.resolve(n.beforePos).nodeBefore !== null;
|
|
470
470
|
});
|
|
471
471
|
}
|
|
472
|
-
function
|
|
473
|
-
return
|
|
474
|
-
let { bnBlock:
|
|
475
|
-
return
|
|
472
|
+
function Kt(t) {
|
|
473
|
+
return t.transact((t) => {
|
|
474
|
+
let { bnBlock: n } = e(t);
|
|
475
|
+
return t.doc.resolve(n.beforePos).depth > 1;
|
|
476
476
|
});
|
|
477
477
|
}
|
|
478
478
|
//#endregion
|
|
479
479
|
//#region src/api/blockManipulation/getBlock/getBlock.ts
|
|
480
|
-
function
|
|
481
|
-
let
|
|
482
|
-
if (
|
|
483
|
-
}
|
|
484
|
-
function
|
|
485
|
-
let
|
|
486
|
-
if (!
|
|
487
|
-
let
|
|
488
|
-
if (
|
|
489
|
-
}
|
|
490
|
-
function
|
|
491
|
-
let
|
|
492
|
-
if (!
|
|
493
|
-
let
|
|
494
|
-
if (
|
|
495
|
-
}
|
|
496
|
-
function
|
|
497
|
-
let
|
|
498
|
-
if (!
|
|
499
|
-
let
|
|
500
|
-
if (
|
|
480
|
+
function qt(e, n) {
|
|
481
|
+
let r = t(typeof n == "string" ? n : n.id, e);
|
|
482
|
+
if (r) return S(r.node, e);
|
|
483
|
+
}
|
|
484
|
+
function Jt(e, n) {
|
|
485
|
+
let r = t(typeof n == "string" ? n : n.id, e);
|
|
486
|
+
if (!r) return;
|
|
487
|
+
let i = e.resolve(r.posBeforeNode).nodeBefore;
|
|
488
|
+
if (i) return S(i, e);
|
|
489
|
+
}
|
|
490
|
+
function Yt(e, n) {
|
|
491
|
+
let r = t(typeof n == "string" ? n : n.id, e);
|
|
492
|
+
if (!r) return;
|
|
493
|
+
let i = e.resolve(r.posBeforeNode + r.node.nodeSize).nodeAfter;
|
|
494
|
+
if (i) return S(i, e);
|
|
495
|
+
}
|
|
496
|
+
function Xt(e, n) {
|
|
497
|
+
let r = t(typeof n == "string" ? n : n.id, e);
|
|
498
|
+
if (!r) return;
|
|
499
|
+
let i = e.resolve(r.posBeforeNode), a = i.node(), o = i.node(-1), s = o.type.name === "doc" ? void 0 : a.type.name === "blockGroup" ? o : a;
|
|
500
|
+
if (s) return S(s, e);
|
|
501
501
|
}
|
|
502
502
|
//#endregion
|
|
503
503
|
//#region src/editor/managers/BlockManager.ts
|
|
504
|
-
var
|
|
504
|
+
var Zt = class {
|
|
505
505
|
editor;
|
|
506
506
|
constructor(e) {
|
|
507
507
|
this.editor = e;
|
|
508
508
|
}
|
|
509
509
|
get document() {
|
|
510
|
-
return this.editor.transact((e) =>
|
|
510
|
+
return this.editor.transact((e) => ne(e.doc));
|
|
511
511
|
}
|
|
512
512
|
getBlock(e) {
|
|
513
|
-
return this.editor.transact((t) =>
|
|
513
|
+
return this.editor.transact((t) => qt(t.doc, e));
|
|
514
514
|
}
|
|
515
515
|
getPrevBlock(e) {
|
|
516
|
-
return this.editor.transact((t) =>
|
|
516
|
+
return this.editor.transact((t) => Jt(t.doc, e));
|
|
517
517
|
}
|
|
518
518
|
getNextBlock(e) {
|
|
519
|
-
return this.editor.transact((t) =>
|
|
519
|
+
return this.editor.transact((t) => Yt(t.doc, e));
|
|
520
520
|
}
|
|
521
521
|
getParentBlock(e) {
|
|
522
|
-
return this.editor.transact((t) =>
|
|
522
|
+
return this.editor.transact((t) => Xt(t.doc, e));
|
|
523
523
|
}
|
|
524
524
|
forEachBlock(e, t = !1) {
|
|
525
525
|
let n = this.document.slice();
|
|
@@ -531,10 +531,10 @@ var Xt = class {
|
|
|
531
531
|
r(n);
|
|
532
532
|
}
|
|
533
533
|
insertBlocks(e, t, n = "before") {
|
|
534
|
-
return this.editor.transact((r) =>
|
|
534
|
+
return this.editor.transact((r) => mt(r, e, t, n));
|
|
535
535
|
}
|
|
536
536
|
updateBlock(e, t) {
|
|
537
|
-
return this.editor.transact((n) =>
|
|
537
|
+
return this.editor.transact((n) => r(n, e, t));
|
|
538
538
|
}
|
|
539
539
|
removeBlocks(e) {
|
|
540
540
|
return this.editor.transact((t) => R(t, e, []).removedBlocks);
|
|
@@ -543,24 +543,24 @@ var Xt = class {
|
|
|
543
543
|
return this.editor.transact((n) => R(n, e, t));
|
|
544
544
|
}
|
|
545
545
|
canNestBlock() {
|
|
546
|
-
return
|
|
546
|
+
return Gt(this.editor);
|
|
547
547
|
}
|
|
548
548
|
nestBlock() {
|
|
549
|
-
|
|
549
|
+
Ht(this.editor);
|
|
550
550
|
}
|
|
551
551
|
canUnnestBlock() {
|
|
552
|
-
return
|
|
552
|
+
return Kt(this.editor);
|
|
553
553
|
}
|
|
554
554
|
unnestBlock() {
|
|
555
|
-
|
|
555
|
+
Wt(this.editor);
|
|
556
556
|
}
|
|
557
557
|
moveBlocksUp(e) {
|
|
558
|
-
return
|
|
558
|
+
return zt(this.editor, e);
|
|
559
559
|
}
|
|
560
560
|
moveBlocksDown(e) {
|
|
561
|
-
return
|
|
561
|
+
return Bt(this.editor, e);
|
|
562
562
|
}
|
|
563
|
-
},
|
|
563
|
+
}, Qt = class extends B {
|
|
564
564
|
editor;
|
|
565
565
|
constructor(e) {
|
|
566
566
|
super(), this.editor = e, e.on("create", () => {
|
|
@@ -584,8 +584,8 @@ var Xt = class {
|
|
|
584
584
|
}
|
|
585
585
|
onChange(e, t = !0) {
|
|
586
586
|
let n = ({ transaction: n, appendedTransactions: r }) => {
|
|
587
|
-
!t &&
|
|
588
|
-
return
|
|
587
|
+
!t && $t(n) || e(this.editor, { getChanges() {
|
|
588
|
+
return De(n, r);
|
|
589
589
|
} });
|
|
590
590
|
};
|
|
591
591
|
return this.on("onChange", n), () => {
|
|
@@ -594,7 +594,7 @@ var Xt = class {
|
|
|
594
594
|
}
|
|
595
595
|
onSelectionChange(e, t = !1) {
|
|
596
596
|
let n = (n) => {
|
|
597
|
-
!t &&
|
|
597
|
+
!t && $t(n.transaction) || e(this.editor);
|
|
598
598
|
};
|
|
599
599
|
return this.on("onSelectionChange", n), () => {
|
|
600
600
|
this.off("onSelectionChange", n);
|
|
@@ -611,30 +611,30 @@ var Xt = class {
|
|
|
611
611
|
};
|
|
612
612
|
}
|
|
613
613
|
};
|
|
614
|
-
function
|
|
614
|
+
function $t(e) {
|
|
615
615
|
return !!e.getMeta("y-sync$");
|
|
616
616
|
}
|
|
617
617
|
//#endregion
|
|
618
618
|
//#region src/api/parsers/html/util/nestedLists.ts
|
|
619
|
-
function
|
|
619
|
+
function en(e) {
|
|
620
620
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
621
621
|
}
|
|
622
|
-
function
|
|
622
|
+
function tn(e) {
|
|
623
623
|
return e.nodeType === 3 && !/\S/.test(e.nodeValue || "");
|
|
624
624
|
}
|
|
625
|
-
function
|
|
625
|
+
function nn(e) {
|
|
626
626
|
e.querySelectorAll("li > ul, li > ol").forEach((e) => {
|
|
627
|
-
let t =
|
|
627
|
+
let t = en(e), n = e.parentElement, r = Array.from(n.childNodes).slice(t + 1);
|
|
628
628
|
e.remove(), r.forEach((e) => {
|
|
629
629
|
e.remove();
|
|
630
630
|
}), n.insertAdjacentElement("afterend", e), r.reverse().forEach((t) => {
|
|
631
|
-
if (
|
|
631
|
+
if (tn(t)) return;
|
|
632
632
|
let n = document.createElement("li");
|
|
633
633
|
n.append(t), e.insertAdjacentElement("afterend", n);
|
|
634
634
|
}), n.childNodes.length === 0 && n.remove();
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
|
-
function
|
|
637
|
+
function rn(e) {
|
|
638
638
|
e.querySelectorAll("li + ul, li + ol").forEach((e) => {
|
|
639
639
|
let t = e.previousElementSibling, n = document.createElement("div");
|
|
640
640
|
t.insertAdjacentElement("afterend", n), n.append(t);
|
|
@@ -642,25 +642,25 @@ function nn(e) {
|
|
|
642
642
|
for (r.setAttribute("data-node-type", "blockGroup"), n.append(r); n.nextElementSibling?.nodeName === "UL" || n.nextElementSibling?.nodeName === "OL";) r.append(n.nextElementSibling);
|
|
643
643
|
});
|
|
644
644
|
}
|
|
645
|
-
var
|
|
646
|
-
function
|
|
647
|
-
return
|
|
645
|
+
var an = null;
|
|
646
|
+
function on() {
|
|
647
|
+
return an ||= document.implementation.createHTMLDocument("title");
|
|
648
648
|
}
|
|
649
|
-
function
|
|
649
|
+
function sn(e) {
|
|
650
650
|
if (typeof e == "string") {
|
|
651
|
-
let t =
|
|
651
|
+
let t = on().createElement("div");
|
|
652
652
|
t.innerHTML = e, e = t;
|
|
653
653
|
}
|
|
654
|
-
return
|
|
654
|
+
return nn(e), rn(e), e;
|
|
655
655
|
}
|
|
656
656
|
//#endregion
|
|
657
657
|
//#region src/api/parsers/html/util/normalizeWhitespace.ts
|
|
658
|
-
function
|
|
658
|
+
function cn(e) {
|
|
659
659
|
let t = e.ownerDocument.createTreeWalker(e, 128), n;
|
|
660
660
|
for (; n = t.nextNode();) if (/^\s*notionvc:/.test(n.nodeValue || "")) return !0;
|
|
661
661
|
return !1;
|
|
662
662
|
}
|
|
663
|
-
function
|
|
663
|
+
function ln(e) {
|
|
664
664
|
let t = new Set(["PRE", "CODE"]), n = e.ownerDocument.createTreeWalker(e, 4, { acceptNode(n) {
|
|
665
665
|
let r = n.parentElement;
|
|
666
666
|
for (; r && r !== e;) {
|
|
@@ -672,31 +672,48 @@ function cn(e) {
|
|
|
672
672
|
for (; i = n.nextNode();) r.push(i);
|
|
673
673
|
for (let e of r) e.nodeValue && /[\r\n]/.test(e.nodeValue) && (e.nodeValue = e.nodeValue.replace(/[ \t\r\n\f]+/g, " "));
|
|
674
674
|
}
|
|
675
|
-
function
|
|
676
|
-
|
|
675
|
+
function un(e) {
|
|
676
|
+
cn(e) || ln(e);
|
|
677
677
|
}
|
|
678
678
|
//#endregion
|
|
679
679
|
//#region src/api/parsers/html/parseHTML.ts
|
|
680
|
+
function dn(e) {
|
|
681
|
+
let t = [];
|
|
682
|
+
for (let n of e) if (n.type === "text") {
|
|
683
|
+
let e = n.text.split("").join("");
|
|
684
|
+
e.length > 0 && t.push({
|
|
685
|
+
...n,
|
|
686
|
+
text: e
|
|
687
|
+
});
|
|
688
|
+
} else Array.isArray(n.content) ? t.push({
|
|
689
|
+
...n,
|
|
690
|
+
content: dn(n.content)
|
|
691
|
+
}) : t.push(n);
|
|
692
|
+
return t;
|
|
693
|
+
}
|
|
694
|
+
function fn(e) {
|
|
695
|
+
for (let t of e) Array.isArray(t.content) && (t.content = dn(t.content)), t.children.length > 0 && fn(t.children);
|
|
696
|
+
}
|
|
680
697
|
function U(e, t) {
|
|
681
|
-
let n =
|
|
682
|
-
|
|
683
|
-
let r =
|
|
684
|
-
for (let e = 0; e < r.childCount; e++) i.push(
|
|
685
|
-
return i;
|
|
698
|
+
let n = sn(e);
|
|
699
|
+
un(n);
|
|
700
|
+
let r = Fe.fromSchema(t).parse(n, { topNode: t.nodes.blockGroup.create() }), i = [];
|
|
701
|
+
for (let e = 0; e < r.childCount; e++) i.push(S(r.child(e), r));
|
|
702
|
+
return fn(i), i;
|
|
686
703
|
}
|
|
687
704
|
//#endregion
|
|
688
705
|
//#region src/api/parsers/markdown/markdownToHtml.ts
|
|
689
706
|
function W(e) {
|
|
690
707
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
691
708
|
}
|
|
692
|
-
function
|
|
709
|
+
function pn(e) {
|
|
693
710
|
return e ? /\w/.test(e) : !1;
|
|
694
711
|
}
|
|
695
712
|
function G(e, t, n) {
|
|
696
713
|
let r = t > 0 ? e[t - 1] : void 0, i = t + n < e.length ? e[t + n] : void 0;
|
|
697
|
-
return
|
|
714
|
+
return pn(r) && pn(i);
|
|
698
715
|
}
|
|
699
|
-
function
|
|
716
|
+
function mn(e, t) {
|
|
700
717
|
if (e[t] !== "\\" || t + 1 >= e.length) return null;
|
|
701
718
|
let n = e[t + 1];
|
|
702
719
|
return n === "\n" ? {
|
|
@@ -707,43 +724,43 @@ function dn(e, t) {
|
|
|
707
724
|
end: t + 2
|
|
708
725
|
} : null;
|
|
709
726
|
}
|
|
710
|
-
function
|
|
711
|
-
return e[t] === "`" ?
|
|
727
|
+
function hn(e, t) {
|
|
728
|
+
return e[t] === "`" ? jn(e, t) : null;
|
|
712
729
|
}
|
|
713
|
-
function
|
|
714
|
-
return e[t] !== "!" || e[t + 1] !== "[" ? null :
|
|
730
|
+
function gn(e, t) {
|
|
731
|
+
return e[t] !== "!" || e[t + 1] !== "[" ? null : Mn(e, t);
|
|
715
732
|
}
|
|
716
|
-
function
|
|
717
|
-
return e[t] === "[" ?
|
|
733
|
+
function _n(e, t) {
|
|
734
|
+
return e[t] === "[" ? Nn(e, t) : null;
|
|
718
735
|
}
|
|
719
|
-
function
|
|
736
|
+
function vn(e, t) {
|
|
720
737
|
return e[t] !== "~" || e[t + 1] !== "~" ? null : q(e, t, "~~", "<del>", "</del>");
|
|
721
738
|
}
|
|
722
|
-
function
|
|
739
|
+
function yn(e, t) {
|
|
723
740
|
return e[t] === "*" && e[t + 1] === "*" && e[t + 2] === "*" || e[t] === "_" && e[t + 1] === "_" && e[t + 2] === "_" && !G(e, t, 3) ? q(e, t, e.substring(t, t + 3), "<strong><em>", "</em></strong>") : null;
|
|
724
741
|
}
|
|
725
|
-
function
|
|
742
|
+
function bn(e, t) {
|
|
726
743
|
return e[t] === "*" && e[t + 1] === "*" || e[t] === "_" && e[t + 1] === "_" && !G(e, t, 2) ? q(e, t, e.substring(t, t + 2), "<strong>", "</strong>") : null;
|
|
727
744
|
}
|
|
728
|
-
function
|
|
745
|
+
function xn(e, t) {
|
|
729
746
|
return e[t] === "*" || e[t] === "_" && !G(e, t, 1) ? q(e, t, e[t], "<em>", "</em>") : null;
|
|
730
747
|
}
|
|
731
|
-
function
|
|
748
|
+
function Sn(e, t) {
|
|
732
749
|
return e[t] === "\n" ? {
|
|
733
750
|
html: "<br>\n",
|
|
734
751
|
end: t + 1
|
|
735
752
|
} : null;
|
|
736
753
|
}
|
|
737
|
-
var
|
|
738
|
-
function
|
|
754
|
+
var Cn = /^<\/?[a-zA-Z][a-zA-Z0-9-]*(?:\s+[a-zA-Z_:][a-zA-Z0-9_.:-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*\s*\/?>/, wn = /^<!--[\s\S]*?-->/, Tn = /^<!\[CDATA\[[\s\S]*?\]\]>/, En = /^<\?[\s\S]*?\?>/, Dn = /^<![A-Za-z][\s\S]*?>/;
|
|
755
|
+
function On(e, t) {
|
|
739
756
|
if (e[t] !== "<") return null;
|
|
740
757
|
let n = e.substring(t);
|
|
741
758
|
for (let e of [
|
|
742
|
-
xn,
|
|
743
|
-
Sn,
|
|
744
|
-
Cn,
|
|
745
759
|
wn,
|
|
746
|
-
|
|
760
|
+
Tn,
|
|
761
|
+
En,
|
|
762
|
+
Dn,
|
|
763
|
+
Cn
|
|
747
764
|
]) {
|
|
748
765
|
let r = n.match(e);
|
|
749
766
|
if (r) return {
|
|
@@ -753,17 +770,17 @@ function Tn(e, t) {
|
|
|
753
770
|
}
|
|
754
771
|
return null;
|
|
755
772
|
}
|
|
756
|
-
var
|
|
757
|
-
dn,
|
|
758
|
-
fn,
|
|
759
|
-
pn,
|
|
773
|
+
var kn = /* @__PURE__ */ new Set("\\`![~*_\n<"), An = [
|
|
760
774
|
mn,
|
|
761
775
|
hn,
|
|
762
776
|
gn,
|
|
763
777
|
_n,
|
|
764
778
|
vn,
|
|
765
|
-
|
|
766
|
-
|
|
779
|
+
yn,
|
|
780
|
+
bn,
|
|
781
|
+
xn,
|
|
782
|
+
On,
|
|
783
|
+
Sn
|
|
767
784
|
];
|
|
768
785
|
function K(e) {
|
|
769
786
|
let t = "", n = 0;
|
|
@@ -773,7 +790,7 @@ function K(e) {
|
|
|
773
790
|
continue;
|
|
774
791
|
}
|
|
775
792
|
let r = !1;
|
|
776
|
-
if (
|
|
793
|
+
if (kn.has(e[n])) for (let i of An) {
|
|
777
794
|
let a = i(e, n);
|
|
778
795
|
if (a) {
|
|
779
796
|
t += a.html, n = a.end, r = !0;
|
|
@@ -782,13 +799,13 @@ function K(e) {
|
|
|
782
799
|
}
|
|
783
800
|
if (!r) {
|
|
784
801
|
let r = n;
|
|
785
|
-
for (n++; n < e.length && !
|
|
802
|
+
for (n++; n < e.length && !kn.has(e[n]);) n++;
|
|
786
803
|
t += W(e.substring(r, n));
|
|
787
804
|
}
|
|
788
805
|
}
|
|
789
806
|
return t;
|
|
790
807
|
}
|
|
791
|
-
function
|
|
808
|
+
function jn(e, t) {
|
|
792
809
|
let n = 0, r = t;
|
|
793
810
|
for (; r < e.length && e[r] === "`";) n++, r++;
|
|
794
811
|
let i = r;
|
|
@@ -805,15 +822,15 @@ function On(e, t) {
|
|
|
805
822
|
} else i++;
|
|
806
823
|
return null;
|
|
807
824
|
}
|
|
808
|
-
function
|
|
809
|
-
let n =
|
|
825
|
+
function Mn(e, t) {
|
|
826
|
+
let n = Pn(e, t + 1);
|
|
810
827
|
if (n === -1) return null;
|
|
811
828
|
let r = t + 2;
|
|
812
829
|
if (e[n + 1] !== "(") return null;
|
|
813
|
-
let i = n + 2, a =
|
|
830
|
+
let i = n + 2, a = Fn(e, i - 1);
|
|
814
831
|
if (a === -1) return null;
|
|
815
|
-
let o = e.substring(r, n), { url: s, title: c } =
|
|
816
|
-
if (
|
|
832
|
+
let o = e.substring(r, n), { url: s, title: c } = In(e.substring(i, a));
|
|
833
|
+
if (te(s)) {
|
|
817
834
|
let e = o || c;
|
|
818
835
|
return {
|
|
819
836
|
html: `<video src="${W(s)}"${e ? ` data-name="${W(e)}"` : ""} data-url="${W(s)}" controls></video>`,
|
|
@@ -826,18 +843,18 @@ function kn(e, t) {
|
|
|
826
843
|
end: a + 1
|
|
827
844
|
};
|
|
828
845
|
}
|
|
829
|
-
function
|
|
830
|
-
let n = t + 1, r =
|
|
846
|
+
function Nn(e, t) {
|
|
847
|
+
let n = t + 1, r = Pn(e, t);
|
|
831
848
|
if (r === -1 || e[r + 1] !== "(") return null;
|
|
832
|
-
let i = r + 2, a =
|
|
849
|
+
let i = r + 2, a = Fn(e, r + 1);
|
|
833
850
|
if (a === -1) return null;
|
|
834
|
-
let o = e.substring(n, r), { url: s, title: c } =
|
|
851
|
+
let o = e.substring(n, r), { url: s, title: c } = In(e.substring(i, a)), l = c === void 0 ? "" : ` title="${W(c)}"`;
|
|
835
852
|
return {
|
|
836
853
|
html: `<a href="${W(s)}"${l}>${K(o)}</a>`,
|
|
837
854
|
end: a + 1
|
|
838
855
|
};
|
|
839
856
|
}
|
|
840
|
-
function
|
|
857
|
+
function Pn(e, t) {
|
|
841
858
|
let n = 0;
|
|
842
859
|
for (let r = t; r < e.length; r++) {
|
|
843
860
|
if (e[r] === "\\" && r + 1 < e.length) {
|
|
@@ -848,7 +865,7 @@ function jn(e, t) {
|
|
|
848
865
|
}
|
|
849
866
|
return -1;
|
|
850
867
|
}
|
|
851
|
-
function
|
|
868
|
+
function Fn(e, t) {
|
|
852
869
|
let n = 0;
|
|
853
870
|
for (let r = t; r < e.length; r++) {
|
|
854
871
|
if (e[r] === "\\" && r + 1 < e.length) {
|
|
@@ -859,7 +876,7 @@ function Mn(e, t) {
|
|
|
859
876
|
}
|
|
860
877
|
return -1;
|
|
861
878
|
}
|
|
862
|
-
function
|
|
879
|
+
function In(e) {
|
|
863
880
|
e = e.trim();
|
|
864
881
|
let t, n;
|
|
865
882
|
if (e.startsWith("<")) {
|
|
@@ -921,11 +938,11 @@ function q(e, t, n, r, i) {
|
|
|
921
938
|
}
|
|
922
939
|
return null;
|
|
923
940
|
}
|
|
924
|
-
var
|
|
925
|
-
function
|
|
941
|
+
var Ln = new Set(/* @__PURE__ */ "address.article.aside.audio.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.section.source.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul".split("."));
|
|
942
|
+
function Rn(e) {
|
|
926
943
|
if (/^ {0,3}<(!--|\?|![A-Za-z]|!\[CDATA\[)/.test(e)) return !0;
|
|
927
944
|
let t = e.match(/^ {0,3}<\/?([a-zA-Z][a-zA-Z0-9-]*)(?:\s|\/?>|$)/);
|
|
928
|
-
return t ?
|
|
945
|
+
return t ? Ln.has(t[1].toLowerCase()) : !1;
|
|
929
946
|
}
|
|
930
947
|
function J(e) {
|
|
931
948
|
let t = e.split("\n"), n = [], r = 0, i = !0;
|
|
@@ -986,7 +1003,7 @@ function J(e) {
|
|
|
986
1003
|
continue;
|
|
987
1004
|
}
|
|
988
1005
|
}
|
|
989
|
-
let s =
|
|
1006
|
+
let s = zn(t, r);
|
|
990
1007
|
if (s) {
|
|
991
1008
|
n.push(s.token), r = s.nextLine, i = !1;
|
|
992
1009
|
continue;
|
|
@@ -1042,7 +1059,7 @@ function J(e) {
|
|
|
1042
1059
|
}), i = !1;
|
|
1043
1060
|
continue;
|
|
1044
1061
|
}
|
|
1045
|
-
if (
|
|
1062
|
+
if (Rn(e)) {
|
|
1046
1063
|
let e = [];
|
|
1047
1064
|
for (; r < t.length && t[r].trim() !== "";) e.push(t[r]), r++;
|
|
1048
1065
|
n.push({
|
|
@@ -1054,7 +1071,7 @@ function J(e) {
|
|
|
1054
1071
|
let l = [e];
|
|
1055
1072
|
for (r++; r < t.length;) {
|
|
1056
1073
|
let e = t[r];
|
|
1057
|
-
if (e.trim() === "" || /^(#{1,6})\s/.test(e) || /^(`{3,}|~{3,})/.test(e) || /^\s{0,3}>/.test(e) || /^(\s{0,3})([-*_])\s*(\2\s*){2,}$/.test(e) || /^\s*([-*+]|\d+[.)])\s+/.test(e) || /^\s*\|(.+\|)+\s*$/.test(e) ||
|
|
1074
|
+
if (e.trim() === "" || /^(#{1,6})\s/.test(e) || /^(`{3,}|~{3,})/.test(e) || /^\s{0,3}>/.test(e) || /^(\s{0,3})([-*_])\s*(\2\s*){2,}$/.test(e) || /^\s*([-*+]|\d+[.)])\s+/.test(e) || /^\s*\|(.+\|)+\s*$/.test(e) || Rn(e) || r + 1 < t.length && /^[=-]+\s*$/.test(t[r + 1]) && e.trim().length > 0) break;
|
|
1058
1075
|
l.push(e), r++;
|
|
1059
1076
|
}
|
|
1060
1077
|
n.push({
|
|
@@ -1064,11 +1081,11 @@ function J(e) {
|
|
|
1064
1081
|
}
|
|
1065
1082
|
return n;
|
|
1066
1083
|
}
|
|
1067
|
-
function
|
|
1084
|
+
function zn(e, t) {
|
|
1068
1085
|
if (t + 1 >= e.length) return null;
|
|
1069
1086
|
let n = e[t], r = e[t + 1];
|
|
1070
1087
|
if (!r.includes("|") || !/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/.test(r) || !n.includes("|")) return null;
|
|
1071
|
-
let i = Y(n), a =
|
|
1088
|
+
let i = Y(n), a = Bn(r), o = [], s = t + 2;
|
|
1072
1089
|
for (; s < e.length;) {
|
|
1073
1090
|
let t = e[s];
|
|
1074
1091
|
if (!t.includes("|")) break;
|
|
@@ -1089,13 +1106,13 @@ function Y(e) {
|
|
|
1089
1106
|
for (let e = 0; e < r.length; e++) r[e] === "\\" && e + 1 < r.length && r[e + 1] === "|" ? (a += "|", e++) : r[e] === "|" ? (i.push(a.trim()), a = "") : a += r[e];
|
|
1090
1107
|
return i.push(a.trim()), i;
|
|
1091
1108
|
}
|
|
1092
|
-
function
|
|
1109
|
+
function Bn(e) {
|
|
1093
1110
|
return Y(e).map((e) => {
|
|
1094
1111
|
let t = e.trim(), n = t.startsWith(":"), r = t.endsWith(":");
|
|
1095
1112
|
return n && r ? "center" : r ? "right" : n ? "left" : null;
|
|
1096
1113
|
});
|
|
1097
1114
|
}
|
|
1098
|
-
function
|
|
1115
|
+
function Vn(e) {
|
|
1099
1116
|
let t = "", n = 0;
|
|
1100
1117
|
for (; n < e.length;) {
|
|
1101
1118
|
let r = e[n];
|
|
@@ -1114,7 +1131,7 @@ function Rn(e) {
|
|
|
1114
1131
|
break;
|
|
1115
1132
|
}
|
|
1116
1133
|
case "blockquote": {
|
|
1117
|
-
let e =
|
|
1134
|
+
let e = Vn(J(r.content));
|
|
1118
1135
|
t += `<blockquote>${e}</blockquote>`, n++;
|
|
1119
1136
|
break;
|
|
1120
1137
|
}
|
|
@@ -1122,12 +1139,12 @@ function Rn(e) {
|
|
|
1122
1139
|
t += "<hr>", n++;
|
|
1123
1140
|
break;
|
|
1124
1141
|
case "listItem": {
|
|
1125
|
-
let r =
|
|
1142
|
+
let r = Hn(e, n);
|
|
1126
1143
|
t += r.html, n = r.nextIndex;
|
|
1127
1144
|
break;
|
|
1128
1145
|
}
|
|
1129
1146
|
case "table":
|
|
1130
|
-
t +=
|
|
1147
|
+
t += Wn(r), n++;
|
|
1131
1148
|
break;
|
|
1132
1149
|
case "rawHtml":
|
|
1133
1150
|
t += r.content, n++;
|
|
@@ -1137,10 +1154,10 @@ function Rn(e) {
|
|
|
1137
1154
|
}
|
|
1138
1155
|
return t;
|
|
1139
1156
|
}
|
|
1140
|
-
function
|
|
1157
|
+
function Hn(e, t) {
|
|
1141
1158
|
let n = "", r = t, i = null;
|
|
1142
1159
|
for (; r < e.length && e[r].type === "listItem";) {
|
|
1143
|
-
let t = e[r], a =
|
|
1160
|
+
let t = e[r], a = Un(t.listType);
|
|
1144
1161
|
if (i !== null && i !== a && (n += `</${i === "ordered" ? "ol" : "ul"}>`, i = null), i === null) {
|
|
1145
1162
|
if (a === "ordered") {
|
|
1146
1163
|
let e = t.start !== void 0 && t.start !== 1 ? ` start="${t.start}"` : "";
|
|
@@ -1154,7 +1171,7 @@ function zn(e, t) {
|
|
|
1154
1171
|
} else n += `<li><p>${K(t.content)}</p>`;
|
|
1155
1172
|
if (t.childContent) {
|
|
1156
1173
|
let e = J(t.childContent);
|
|
1157
|
-
n +=
|
|
1174
|
+
n += Vn(e);
|
|
1158
1175
|
}
|
|
1159
1176
|
n += "</li>", r++;
|
|
1160
1177
|
}
|
|
@@ -1163,10 +1180,10 @@ function zn(e, t) {
|
|
|
1163
1180
|
nextIndex: r
|
|
1164
1181
|
};
|
|
1165
1182
|
}
|
|
1166
|
-
function
|
|
1183
|
+
function Un(e) {
|
|
1167
1184
|
return e === "ordered" ? "ordered" : "bullet";
|
|
1168
1185
|
}
|
|
1169
|
-
function
|
|
1186
|
+
function Wn(e) {
|
|
1170
1187
|
let t = "<table>", n = e.headers.every((e) => e.trim() === ""), r = e.headers.length;
|
|
1171
1188
|
if (!n) {
|
|
1172
1189
|
t += "<thead><tr>";
|
|
@@ -1190,38 +1207,38 @@ function Vn(e) {
|
|
|
1190
1207
|
}
|
|
1191
1208
|
return t += "</table>", t;
|
|
1192
1209
|
}
|
|
1193
|
-
function
|
|
1194
|
-
return
|
|
1210
|
+
function Gn(e) {
|
|
1211
|
+
return Vn(J(e));
|
|
1195
1212
|
}
|
|
1196
1213
|
//#endregion
|
|
1197
1214
|
//#region src/api/parsers/markdown/parseMarkdown.ts
|
|
1198
|
-
function
|
|
1199
|
-
return
|
|
1215
|
+
function Kn(e) {
|
|
1216
|
+
return Gn(e);
|
|
1200
1217
|
}
|
|
1201
|
-
function
|
|
1202
|
-
return U(
|
|
1218
|
+
function qn(e, t) {
|
|
1219
|
+
return U(Kn(e), t);
|
|
1203
1220
|
}
|
|
1204
1221
|
//#endregion
|
|
1205
1222
|
//#region src/editor/managers/ExportManager.ts
|
|
1206
|
-
var
|
|
1223
|
+
var Jn = class {
|
|
1207
1224
|
editor;
|
|
1208
1225
|
constructor(e) {
|
|
1209
1226
|
this.editor = e;
|
|
1210
1227
|
}
|
|
1211
1228
|
blocksToHTMLLossy(e = this.editor.document) {
|
|
1212
|
-
return
|
|
1229
|
+
return _e(this.editor.pmSchema, this.editor).exportBlocks(e, {});
|
|
1213
1230
|
}
|
|
1214
1231
|
blocksToFullHTML(e = this.editor.document) {
|
|
1215
|
-
return
|
|
1232
|
+
return Et(this.editor.pmSchema, this.editor).serializeBlocks(e, {});
|
|
1216
1233
|
}
|
|
1217
1234
|
tryParseHTMLToBlocks(e) {
|
|
1218
1235
|
return U(e, this.editor.pmSchema);
|
|
1219
1236
|
}
|
|
1220
1237
|
blocksToMarkdownLossy(e = this.editor.document) {
|
|
1221
|
-
return
|
|
1238
|
+
return Te(e, this.editor.pmSchema, this.editor, {});
|
|
1222
1239
|
}
|
|
1223
1240
|
tryParseMarkdownToBlocks(e) {
|
|
1224
|
-
return
|
|
1241
|
+
return qn(e, this.editor.pmSchema);
|
|
1225
1242
|
}
|
|
1226
1243
|
pasteHTML(e, t = !1) {
|
|
1227
1244
|
let n = e;
|
|
@@ -1235,39 +1252,39 @@ var Gn = class {
|
|
|
1235
1252
|
return this.editor.prosemirrorView?.pasteText(e);
|
|
1236
1253
|
}
|
|
1237
1254
|
pasteMarkdown(e) {
|
|
1238
|
-
let t =
|
|
1255
|
+
let t = Kn(e);
|
|
1239
1256
|
return this.pasteHTML(t);
|
|
1240
1257
|
}
|
|
1241
1258
|
};
|
|
1242
1259
|
//#endregion
|
|
1243
1260
|
//#region src/api/blockManipulation/selections/textCursorPosition.ts
|
|
1244
|
-
function
|
|
1245
|
-
let { bnBlock:
|
|
1246
|
-
return
|
|
1247
|
-
block:
|
|
1248
|
-
prevBlock:
|
|
1249
|
-
nextBlock:
|
|
1250
|
-
parentBlock:
|
|
1261
|
+
function Yn(t) {
|
|
1262
|
+
let { bnBlock: n } = e(t), r = t.doc.resolve(n.beforePos), i = r.nodeBefore, a = t.doc.resolve(n.afterPos).nodeAfter, o;
|
|
1263
|
+
return r.depth > 1 && (o = r.node(), o.type.isInGroup("bnBlock") || (o = r.node(r.depth - 1))), {
|
|
1264
|
+
block: S(n.node, t.doc),
|
|
1265
|
+
prevBlock: i === null ? void 0 : S(i, t.doc),
|
|
1266
|
+
nextBlock: a === null ? void 0 : S(a, t.doc),
|
|
1267
|
+
parentBlock: o === void 0 ? void 0 : S(o, t.doc)
|
|
1251
1268
|
};
|
|
1252
1269
|
}
|
|
1253
|
-
function
|
|
1254
|
-
let
|
|
1255
|
-
if (!
|
|
1256
|
-
let
|
|
1257
|
-
if (
|
|
1258
|
-
let
|
|
1259
|
-
if (
|
|
1260
|
-
|
|
1270
|
+
function Xn(e, n, r = "start") {
|
|
1271
|
+
let i = typeof n == "string" ? n : n.id, a = h(c(e.doc)), o = t(i, e.doc);
|
|
1272
|
+
if (!o) throw Error(`Block with ID ${i} not found`);
|
|
1273
|
+
let s = g(o), l = a.blockSchema[s.blockNoteType].content;
|
|
1274
|
+
if (s.isBlockContainer) {
|
|
1275
|
+
let t = s.blockContent;
|
|
1276
|
+
if (l === "none") {
|
|
1277
|
+
e.setSelection(A.create(e.doc, t.beforePos));
|
|
1261
1278
|
return;
|
|
1262
1279
|
}
|
|
1263
|
-
if (
|
|
1264
|
-
else if (
|
|
1265
|
-
else throw new
|
|
1266
|
-
} else
|
|
1280
|
+
if (l === "inline" || l === "plain") r === "start" ? e.setSelection(M.create(e.doc, t.beforePos + 1)) : e.setSelection(M.create(e.doc, t.afterPos - 1));
|
|
1281
|
+
else if (l === "table") r === "start" ? e.setSelection(M.create(e.doc, t.beforePos + 4)) : e.setSelection(M.create(e.doc, t.afterPos - 4));
|
|
1282
|
+
else throw new C(l);
|
|
1283
|
+
} else Xn(e, x(r === "start" ? s.childContainer.node.firstChild : s.childContainer.node.lastChild, e.doc), r);
|
|
1267
1284
|
}
|
|
1268
1285
|
//#endregion
|
|
1269
1286
|
//#region src/api/clipboard/fromClipboard/acceptedMIMETypes.ts
|
|
1270
|
-
var
|
|
1287
|
+
var Zn = [
|
|
1271
1288
|
"vscode-editor-data",
|
|
1272
1289
|
"blocknote/html",
|
|
1273
1290
|
"text/markdown",
|
|
@@ -1277,90 +1294,91 @@ var Jn = [
|
|
|
1277
1294
|
];
|
|
1278
1295
|
//#endregion
|
|
1279
1296
|
//#region src/api/clipboard/fromClipboard/handleFileInsertion.ts
|
|
1280
|
-
function
|
|
1297
|
+
function Qn(e, t) {
|
|
1281
1298
|
if (!e.startsWith(".") || !t.startsWith(".")) throw Error("The strings provided are not valid file extensions.");
|
|
1282
1299
|
return e === t;
|
|
1283
1300
|
}
|
|
1284
|
-
function
|
|
1301
|
+
function $n(e, t) {
|
|
1285
1302
|
let n = e.split("/"), r = t.split("/");
|
|
1286
1303
|
if (n.length !== 2) throw Error(`The string ${e} is not a valid MIME type.`);
|
|
1287
1304
|
if (r.length !== 2) throw Error(`The string ${t} is not a valid MIME type.`);
|
|
1288
1305
|
return n[1] === "*" || r[1] === "*" ? n[0] === r[0] : (n[0] === "*" || r[0] === "*" || n[0] === r[0]) && n[1] === r[1];
|
|
1289
1306
|
}
|
|
1290
|
-
function
|
|
1307
|
+
function er(e, t, n, r = "after") {
|
|
1291
1308
|
let i;
|
|
1292
1309
|
return i = Array.isArray(t.content) && t.content.length === 0 ? e.updateBlock(t, n).id : e.insertBlocks([n], t, r)[0].id, i;
|
|
1293
1310
|
}
|
|
1294
|
-
async function
|
|
1295
|
-
if (!
|
|
1311
|
+
async function tr(e, t) {
|
|
1312
|
+
if (!t.uploadFile) {
|
|
1296
1313
|
console.warn("Attempted ot insert file, but uploadFile is not set in the BlockNote editor options");
|
|
1297
1314
|
return;
|
|
1298
1315
|
}
|
|
1299
|
-
let
|
|
1300
|
-
if (
|
|
1301
|
-
let
|
|
1302
|
-
for (let e of
|
|
1303
|
-
|
|
1316
|
+
let n = "dataTransfer" in e ? e.dataTransfer : e.clipboardData;
|
|
1317
|
+
if (n === null) return;
|
|
1318
|
+
let r = null;
|
|
1319
|
+
for (let e of Zn) if (n.types.includes(e)) {
|
|
1320
|
+
r = e;
|
|
1304
1321
|
break;
|
|
1305
1322
|
}
|
|
1306
|
-
if (
|
|
1307
|
-
let
|
|
1308
|
-
if (
|
|
1309
|
-
|
|
1310
|
-
for (let
|
|
1311
|
-
let
|
|
1312
|
-
for (let e of Object.values(
|
|
1313
|
-
let
|
|
1314
|
-
if (o && (!
|
|
1315
|
-
|
|
1323
|
+
if (r !== "Files") return;
|
|
1324
|
+
let i = n.items;
|
|
1325
|
+
if (i) {
|
|
1326
|
+
e.preventDefault();
|
|
1327
|
+
for (let n = 0; n < i.length; n++) {
|
|
1328
|
+
let r = "file";
|
|
1329
|
+
for (let e of Object.values(t.schema.blockSpecs)) for (let t of e.implementation.meta?.fileBlockAccept || []) {
|
|
1330
|
+
let a = t.startsWith("."), o = i[n].getAsFile();
|
|
1331
|
+
if (o && (!a && o.type && $n(i[n].type, t) || a && Qn("." + o.name.split(".").pop(), t))) {
|
|
1332
|
+
r = e.config.type;
|
|
1316
1333
|
break;
|
|
1317
1334
|
}
|
|
1318
1335
|
}
|
|
1319
|
-
let
|
|
1320
|
-
if (
|
|
1321
|
-
let
|
|
1322
|
-
type:
|
|
1323
|
-
props: { name:
|
|
1324
|
-
},
|
|
1325
|
-
if (
|
|
1326
|
-
let e =
|
|
1327
|
-
|
|
1328
|
-
} else if (
|
|
1329
|
-
let
|
|
1330
|
-
left:
|
|
1331
|
-
top:
|
|
1332
|
-
},
|
|
1333
|
-
if (!
|
|
1334
|
-
|
|
1335
|
-
let
|
|
1336
|
-
return
|
|
1336
|
+
let a = i[n].getAsFile();
|
|
1337
|
+
if (a) {
|
|
1338
|
+
let n = {
|
|
1339
|
+
type: r,
|
|
1340
|
+
props: { name: a.name }
|
|
1341
|
+
}, i;
|
|
1342
|
+
if (e.type === "paste") {
|
|
1343
|
+
let e = t.getTextCursorPosition().block;
|
|
1344
|
+
i = er(t, e, n);
|
|
1345
|
+
} else if (e.type === "drop") {
|
|
1346
|
+
let r = {
|
|
1347
|
+
left: e.clientX,
|
|
1348
|
+
top: e.clientY
|
|
1349
|
+
}, a = t.prosemirrorView.posAtCoords(r);
|
|
1350
|
+
if (!a) return;
|
|
1351
|
+
i = t.transact((e) => {
|
|
1352
|
+
let i = x(ee(e, a.pos).bnBlock.node, e.doc), o = (t.domElement?.querySelector(`[data-id="${i}"]`))?.getBoundingClientRect(), s = t.getBlock(i);
|
|
1353
|
+
if (s) return er(t, s, n, o && (o.top + o.bottom) / 2 > r.top ? "before" : "after");
|
|
1337
1354
|
});
|
|
1338
1355
|
} else return;
|
|
1339
|
-
|
|
1340
|
-
|
|
1356
|
+
if (!i) return;
|
|
1357
|
+
let o = await t.uploadFile(a, i), s = typeof o == "string" ? { props: { url: o } } : { ...o };
|
|
1358
|
+
t.updateBlock(i, s);
|
|
1341
1359
|
}
|
|
1342
1360
|
}
|
|
1343
1361
|
}
|
|
1344
1362
|
}
|
|
1345
1363
|
//#endregion
|
|
1346
1364
|
//#region src/api/clipboard/fromClipboard/fileDropExtension.ts
|
|
1347
|
-
var
|
|
1365
|
+
var nr = (e) => D.create({
|
|
1348
1366
|
name: "dropFile",
|
|
1349
1367
|
addProseMirrorPlugins() {
|
|
1350
1368
|
return [new j({ props: { handleDOMEvents: { drop(t, n) {
|
|
1351
1369
|
if (!e.isEditable) return;
|
|
1352
1370
|
let r = null;
|
|
1353
|
-
for (let e of
|
|
1371
|
+
for (let e of Zn) if (n.dataTransfer.types.includes(e)) {
|
|
1354
1372
|
r = e;
|
|
1355
1373
|
break;
|
|
1356
1374
|
}
|
|
1357
|
-
return r === null ? !0 : r === "Files" ? (
|
|
1375
|
+
return r === null ? !0 : r === "Files" ? (tr(n, e), !0) : !1;
|
|
1358
1376
|
} } } })];
|
|
1359
1377
|
}
|
|
1360
|
-
}),
|
|
1378
|
+
}), rr = /(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/, ir = /(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/, ar = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, or = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, sr = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, cr = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, lr = /\n{2} {0,3}-{2,48}\n{2}/, ur = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, dr = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, fr = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, pr = /^\s*\|(.+\|)+\s*$/m, mr = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, hr = /^\s*\|(.+\|)+\s*$/m, gr = (e) => rr.test(e) || ir.test(e) || ar.test(e) || or.test(e) || sr.test(e) || cr.test(e) || lr.test(e) || ur.test(e) || dr.test(e) || fr.test(e) || pr.test(e) || mr.test(e) || hr.test(e);
|
|
1361
1379
|
//#endregion
|
|
1362
1380
|
//#region src/api/clipboard/fromClipboard/handleVSCodePaste.ts
|
|
1363
|
-
function
|
|
1381
|
+
function _r(e, t) {
|
|
1364
1382
|
let { schema: n } = t.state;
|
|
1365
1383
|
if (!e.clipboardData) return !1;
|
|
1366
1384
|
let r = e.clipboardData.getData("text/plain");
|
|
@@ -1370,39 +1388,39 @@ function mr(e, t) {
|
|
|
1370
1388
|
}
|
|
1371
1389
|
//#endregion
|
|
1372
1390
|
//#region src/api/clipboard/fromClipboard/pasteExtension.ts
|
|
1373
|
-
function
|
|
1391
|
+
function vr({ event: e, editor: t, prioritizeMarkdownOverHTML: n, plainTextAsMarkdown: r }) {
|
|
1374
1392
|
if (t.transact((e) => e.selection.$from.parent.type.spec.code && e.selection.$to.parent.type.spec.code)) {
|
|
1375
1393
|
let n = e.clipboardData?.getData("text/plain");
|
|
1376
1394
|
if (n) return t.pasteText(n), !0;
|
|
1377
1395
|
}
|
|
1378
1396
|
let i;
|
|
1379
|
-
for (let t of
|
|
1397
|
+
for (let t of Zn) if (e.clipboardData.types.includes(t)) {
|
|
1380
1398
|
i = t;
|
|
1381
1399
|
break;
|
|
1382
1400
|
}
|
|
1383
1401
|
if (!i) return !0;
|
|
1384
1402
|
if (i === "vscode-editor-data") {
|
|
1385
|
-
if (
|
|
1403
|
+
if (_r(e, t.prosemirrorView)) return !0;
|
|
1386
1404
|
i = "text/plain";
|
|
1387
1405
|
}
|
|
1388
|
-
if (i === "Files") return
|
|
1406
|
+
if (i === "Files") return tr(e, t), !0;
|
|
1389
1407
|
let a = e.clipboardData.getData(i);
|
|
1390
1408
|
if (i === "blocknote/html") return t.pasteHTML(a, !0), !0;
|
|
1391
1409
|
if (i === "text/markdown") return t.pasteMarkdown(a), !0;
|
|
1392
1410
|
if (n) {
|
|
1393
1411
|
let n = e.clipboardData.getData("text/plain");
|
|
1394
|
-
if (
|
|
1412
|
+
if (gr(n)) return t.pasteMarkdown(n), !0;
|
|
1395
1413
|
}
|
|
1396
1414
|
return i === "text/html" ? (t.pasteHTML(a), !0) : r ? (t.pasteMarkdown(a), !0) : (t.pasteText(a), !0);
|
|
1397
1415
|
}
|
|
1398
|
-
var
|
|
1416
|
+
var yr = (e, t) => D.create({
|
|
1399
1417
|
name: "pasteFromClipboard",
|
|
1400
1418
|
addProseMirrorPlugins() {
|
|
1401
1419
|
return [new j({ props: { handleDOMEvents: { paste(n, r) {
|
|
1402
1420
|
if (r.preventDefault(), e.isEditable) return t({
|
|
1403
1421
|
event: r,
|
|
1404
1422
|
editor: e,
|
|
1405
|
-
defaultPasteHandler: ({ prioritizeMarkdownOverHTML: t = !0, plainTextAsMarkdown: n = !0 } = {}) =>
|
|
1423
|
+
defaultPasteHandler: ({ prioritizeMarkdownOverHTML: t = !0, plainTextAsMarkdown: n = !0 } = {}) => vr({
|
|
1406
1424
|
event: r,
|
|
1407
1425
|
editor: e,
|
|
1408
1426
|
prioritizeMarkdownOverHTML: t,
|
|
@@ -1414,37 +1432,37 @@ var gr = (e, t) => D.create({
|
|
|
1414
1432
|
});
|
|
1415
1433
|
//#endregion
|
|
1416
1434
|
//#region src/api/clipboard/toClipboard/copyExtension.ts
|
|
1417
|
-
function
|
|
1435
|
+
function br(e, t, n) {
|
|
1418
1436
|
let r = !1, i = e.state.selection instanceof F;
|
|
1419
1437
|
if (!i) {
|
|
1420
1438
|
let n = e.state.doc.slice(e.state.selection.from, e.state.selection.to, !1).content, i = [];
|
|
1421
1439
|
for (let e = 0; e < n.childCount; e++) i.push(n.child(e));
|
|
1422
1440
|
r = i.find((e) => e.type.isInGroup("bnBlock") || e.type.name === "blockGroup" || e.type.spec.group === "blockContent") === void 0, r && (t = n);
|
|
1423
1441
|
}
|
|
1424
|
-
let a, o =
|
|
1442
|
+
let a, o = _e(e.state.schema, n);
|
|
1425
1443
|
if (i) {
|
|
1426
1444
|
t.firstChild?.type.name === "table" && (t = t.firstChild.content);
|
|
1427
|
-
let e =
|
|
1445
|
+
let e = me(t, n.schema.inlineContentSchema, n.schema.styleSchema);
|
|
1428
1446
|
a = `<table>${o.exportInlineContent(e, {})}</table>`;
|
|
1429
1447
|
} else if (r) {
|
|
1430
|
-
let e =
|
|
1448
|
+
let e = pe(t, n.schema.inlineContentSchema, n.schema.styleSchema);
|
|
1431
1449
|
a = o.exportInlineContent(e, {});
|
|
1432
1450
|
} else {
|
|
1433
|
-
let e =
|
|
1451
|
+
let e = Ee(t);
|
|
1434
1452
|
a = o.exportBlocks(e, {});
|
|
1435
1453
|
}
|
|
1436
1454
|
return a;
|
|
1437
1455
|
}
|
|
1438
|
-
function
|
|
1456
|
+
function xr(e, t) {
|
|
1439
1457
|
"node" in e.state.selection && e.state.selection.node.type.spec.group === "blockContent" && t.transact((t) => t.setSelection(new A(t.doc.resolve(e.state.selection.from - 1))));
|
|
1440
|
-
let n = e.serializeForClipboard(e.state.selection.content()).dom.innerHTML, r = e.state.selection.content().content, i =
|
|
1458
|
+
let n = e.serializeForClipboard(e.state.selection.content()).dom.innerHTML, r = e.state.selection.content().content, i = br(e, r, t), { $from: a, $to: o } = e.state.selection, s = a.parent.type.name, c = t.blockImplementations[s];
|
|
1441
1459
|
return {
|
|
1442
1460
|
clipboardHTML: n,
|
|
1443
1461
|
externalHTML: i,
|
|
1444
|
-
markdown: a.sameParent(o) && c?.implementation.meta?.code === !0 ? e.state.doc.textBetween(a.pos, o.pos) :
|
|
1462
|
+
markdown: a.sameParent(o) && c?.implementation.meta?.code === !0 ? e.state.doc.textBetween(a.pos, o.pos) : xe(i)
|
|
1445
1463
|
};
|
|
1446
1464
|
}
|
|
1447
|
-
var
|
|
1465
|
+
var Sr = (e) => {
|
|
1448
1466
|
if (e.state.selection.empty) return !0;
|
|
1449
1467
|
let t = window.getSelection();
|
|
1450
1468
|
if (t && !t.isCollapsed) {
|
|
@@ -1455,37 +1473,37 @@ var yr = (e) => {
|
|
|
1455
1473
|
}
|
|
1456
1474
|
}
|
|
1457
1475
|
return !1;
|
|
1458
|
-
},
|
|
1476
|
+
}, Cr = (e, t, n) => {
|
|
1459
1477
|
n.preventDefault(), n.clipboardData.clearData();
|
|
1460
|
-
let { clipboardHTML: r, externalHTML: i, markdown: a } =
|
|
1478
|
+
let { clipboardHTML: r, externalHTML: i, markdown: a } = xr(t, e);
|
|
1461
1479
|
n.clipboardData.setData("blocknote/html", r), n.clipboardData.setData("text/html", i), n.clipboardData.setData("text/plain", a);
|
|
1462
|
-
},
|
|
1480
|
+
}, wr = (e) => D.create({
|
|
1463
1481
|
name: "copyToClipboard",
|
|
1464
1482
|
addProseMirrorPlugins() {
|
|
1465
1483
|
return [new j({ props: { handleDOMEvents: {
|
|
1466
1484
|
copy(t, n) {
|
|
1467
|
-
return
|
|
1485
|
+
return Sr(t) || Cr(e, t, n), !0;
|
|
1468
1486
|
},
|
|
1469
1487
|
cut(t, n) {
|
|
1470
|
-
return
|
|
1488
|
+
return Sr(t) ? !0 : (Cr(e, t, n), t.editable && t.dispatch(t.state.tr.deleteSelection()), !0);
|
|
1471
1489
|
},
|
|
1472
1490
|
dragstart(t, n) {
|
|
1473
1491
|
if (!("node" in t.state.selection) || t.state.selection.node.type.spec.group !== "blockContent") return;
|
|
1474
1492
|
e.transact((e) => e.setSelection(new A(e.doc.resolve(t.state.selection.from - 1)))), n.preventDefault(), n.dataTransfer.clearData();
|
|
1475
|
-
let { clipboardHTML: r, externalHTML: i, markdown: a } =
|
|
1493
|
+
let { clipboardHTML: r, externalHTML: i, markdown: a } = xr(t, e);
|
|
1476
1494
|
return n.dataTransfer.setData("blocknote/html", r), n.dataTransfer.setData("text/html", i), n.dataTransfer.setData("text/plain", a), !0;
|
|
1477
1495
|
}
|
|
1478
1496
|
} } })];
|
|
1479
1497
|
}
|
|
1480
|
-
}),
|
|
1498
|
+
}), Tr = D.create({
|
|
1481
1499
|
name: "blockBackgroundColor",
|
|
1482
1500
|
addGlobalAttributes() {
|
|
1483
1501
|
return [{
|
|
1484
1502
|
types: ["tableCell", "tableHeader"],
|
|
1485
|
-
attributes: { backgroundColor:
|
|
1503
|
+
attributes: { backgroundColor: re() }
|
|
1486
1504
|
}];
|
|
1487
1505
|
}
|
|
1488
|
-
}),
|
|
1506
|
+
}), Er = O.create({
|
|
1489
1507
|
name: "hardBreak",
|
|
1490
1508
|
inline: !0,
|
|
1491
1509
|
group: "inline",
|
|
@@ -1496,33 +1514,33 @@ var yr = (e) => {
|
|
|
1496
1514
|
return [{ tag: "br" }];
|
|
1497
1515
|
},
|
|
1498
1516
|
renderHTML({ HTMLAttributes: e }) {
|
|
1499
|
-
return ["br",
|
|
1517
|
+
return ["br", et(this.options.HTMLAttributes, e)];
|
|
1500
1518
|
},
|
|
1501
1519
|
renderText() {
|
|
1502
1520
|
return "\n";
|
|
1503
1521
|
}
|
|
1504
|
-
}),
|
|
1522
|
+
}), Dr = (e, t) => {
|
|
1505
1523
|
let n = e.resolve(t), r = n.depth - 1;
|
|
1506
1524
|
if (r < 1) return;
|
|
1507
1525
|
let i = n.before(r), a = e.resolve(i).nodeAfter;
|
|
1508
|
-
if (a) return a.type.spec.group?.includes("bnBlock") ?
|
|
1526
|
+
if (a) return a.type.spec.group?.includes("bnBlock") ? d(e.resolve(i)) : Dr(e, i);
|
|
1509
1527
|
}, X = (e, t) => {
|
|
1510
1528
|
let n = e.resolve(t), r = n.index();
|
|
1511
1529
|
if (r === 0) return;
|
|
1512
1530
|
let i = n.posAtIndex(r - 1);
|
|
1513
|
-
return
|
|
1531
|
+
return d(e.resolve(i));
|
|
1514
1532
|
}, Z = (e, t) => {
|
|
1515
1533
|
let n = e.resolve(t), r = n.index();
|
|
1516
1534
|
if (r === n.node().childCount - 1) return;
|
|
1517
1535
|
let i = n.posAtIndex(r + 1);
|
|
1518
|
-
return
|
|
1519
|
-
},
|
|
1536
|
+
return d(e.resolve(i));
|
|
1537
|
+
}, Or = (e, t) => {
|
|
1520
1538
|
for (; t.childContainer;) {
|
|
1521
1539
|
let n = t.childContainer.node, r = e.resolve(t.childContainer.beforePos + 1).posAtIndex(n.childCount - 1);
|
|
1522
|
-
t =
|
|
1540
|
+
t = d(e.resolve(r));
|
|
1523
1541
|
}
|
|
1524
1542
|
return t;
|
|
1525
|
-
},
|
|
1543
|
+
}, kr = (e, t) => e.isBlockContainer && e.blockContent.node.type.spec.content === "inline*" && e.blockContent.node.childCount > 0 && t.isBlockContainer && t.blockContent.node.type.spec.content === "inline*", Ar = (e, t, n, r) => {
|
|
1526
1544
|
if (!r.isBlockContainer) throw Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but next block is not a block container`);
|
|
1527
1545
|
if (r.childContainer) {
|
|
1528
1546
|
let n = e.doc.resolve(r.childContainer.beforePos + 1), i = e.doc.resolve(r.childContainer.afterPos - 1), a = n.blockRange(i);
|
|
@@ -1536,70 +1554,70 @@ var yr = (e) => {
|
|
|
1536
1554
|
t(e.tr.delete(n.blockContent.afterPos - 1, r.blockContent.beforePos + 1));
|
|
1537
1555
|
}
|
|
1538
1556
|
return !0;
|
|
1539
|
-
},
|
|
1540
|
-
let r =
|
|
1557
|
+
}, jr = (e) => ({ state: t, dispatch: n }) => {
|
|
1558
|
+
let r = d(t.doc.resolve(e)), i = X(t.doc, r.bnBlock.beforePos);
|
|
1541
1559
|
if (!i) return !1;
|
|
1542
|
-
let a =
|
|
1543
|
-
return
|
|
1544
|
-
},
|
|
1560
|
+
let a = Or(t.doc, i);
|
|
1561
|
+
return kr(a, r) ? Ar(t, n, a, r) : !1;
|
|
1562
|
+
}, Mr = D.create({
|
|
1545
1563
|
priority: 50,
|
|
1546
1564
|
addKeyboardShortcuts() {
|
|
1547
|
-
let
|
|
1548
|
-
() =>
|
|
1549
|
-
() =>
|
|
1550
|
-
() =>
|
|
1551
|
-
let
|
|
1552
|
-
if (!
|
|
1553
|
-
let i =
|
|
1554
|
-
return i && !a ?
|
|
1565
|
+
let t = () => this.editor.commands.first(({ chain: t, commands: n }) => [
|
|
1566
|
+
() => n.deleteSelection(),
|
|
1567
|
+
() => n.undoInputRule(),
|
|
1568
|
+
() => n.command(({ state: t }) => {
|
|
1569
|
+
let r = e(t);
|
|
1570
|
+
if (!r.isBlockContainer) return !1;
|
|
1571
|
+
let i = t.selection.from === r.blockContent.beforePos + 1, a = r.blockContent.node.type.name === "paragraph";
|
|
1572
|
+
return i && !a ? n.command(l(r.bnBlock.beforePos, {
|
|
1555
1573
|
type: "paragraph",
|
|
1556
1574
|
props: {}
|
|
1557
1575
|
})) : !1;
|
|
1558
1576
|
}),
|
|
1559
|
-
() =>
|
|
1560
|
-
let
|
|
1561
|
-
if (!
|
|
1562
|
-
let { blockContent:
|
|
1563
|
-
return
|
|
1577
|
+
() => n.command(({ state: t, tr: n }) => {
|
|
1578
|
+
let r = e(t);
|
|
1579
|
+
if (!r.isBlockContainer) return !1;
|
|
1580
|
+
let { blockContent: i } = r;
|
|
1581
|
+
return t.selection.from === i.beforePos + 1 ? H(n, n.doc.type.schema.nodes.blockContainer, n.doc.type.schema.nodes.blockGroup) : !1;
|
|
1564
1582
|
}),
|
|
1565
|
-
() =>
|
|
1566
|
-
let
|
|
1567
|
-
if (!
|
|
1568
|
-
let { bnBlock:
|
|
1569
|
-
if (!
|
|
1570
|
-
let
|
|
1571
|
-
return
|
|
1583
|
+
() => n.command(({ state: n }) => {
|
|
1584
|
+
let r = e(n);
|
|
1585
|
+
if (!r.isBlockContainer) return !1;
|
|
1586
|
+
let { bnBlock: i, blockContent: a } = r, o = X(n.doc, r.bnBlock.beforePos);
|
|
1587
|
+
if (!o || !o.isBlockContainer || o.blockContent.node.type.spec.content !== "inline*") return !1;
|
|
1588
|
+
let s = n.selection.from === a.beforePos + 1, c = n.selection.empty, l = i.beforePos;
|
|
1589
|
+
return s && c ? t().command(jr(l)).scrollIntoView().run() : !1;
|
|
1572
1590
|
}),
|
|
1573
|
-
() =>
|
|
1574
|
-
let
|
|
1575
|
-
if (!
|
|
1576
|
-
let
|
|
1577
|
-
if (!
|
|
1578
|
-
if (
|
|
1579
|
-
let e =
|
|
1580
|
-
return
|
|
1591
|
+
() => n.command(({ state: t, tr: n, dispatch: r }) => {
|
|
1592
|
+
let i = e(t);
|
|
1593
|
+
if (!i.isBlockContainer || t.selection.from !== i.blockContent.beforePos + 1) return !1;
|
|
1594
|
+
let a = X(t.doc, i.bnBlock.beforePos);
|
|
1595
|
+
if (!a || a.isBlockContainer) return !1;
|
|
1596
|
+
if (r) {
|
|
1597
|
+
let e = a.bnBlock.afterPos - 1, t = n.doc.resolve(e - 1);
|
|
1598
|
+
return n.delete(i.bnBlock.beforePos, i.bnBlock.afterPos), n.insert(t.pos, i.bnBlock.node), n.setSelection(M.near(n.doc.resolve(t.pos + 1))), !0;
|
|
1581
1599
|
}
|
|
1582
1600
|
return !1;
|
|
1583
1601
|
}),
|
|
1584
|
-
() =>
|
|
1585
|
-
let
|
|
1586
|
-
if (!
|
|
1587
|
-
let
|
|
1588
|
-
if (
|
|
1589
|
-
let
|
|
1590
|
-
return
|
|
1602
|
+
() => n.command(({ state: t, tr: n, dispatch: r }) => {
|
|
1603
|
+
let i = e(t);
|
|
1604
|
+
if (!i.isBlockContainer || n.selection.from !== i.blockContent.beforePos + 1) return !1;
|
|
1605
|
+
let a = n.doc.resolve(i.bnBlock.beforePos);
|
|
1606
|
+
if (a.nodeBefore || a.node().type.name !== "column") return !1;
|
|
1607
|
+
let o = n.doc.resolve(i.bnBlock.beforePos), s = n.doc.resolve(o.before()), c = s.before();
|
|
1608
|
+
return r && (n.delete(i.bnBlock.beforePos, i.bnBlock.afterPos), L(n, c), s.pos === c + 1 ? (n.insert(c, i.bnBlock.node), n.setSelection(M.near(n.doc.resolve(c)))) : (n.insert(s.pos - 1, i.bnBlock.node), n.setSelection(M.near(n.doc.resolve(s.pos))))), !0;
|
|
1591
1609
|
}),
|
|
1592
|
-
() =>
|
|
1593
|
-
let
|
|
1594
|
-
if (!
|
|
1595
|
-
if (
|
|
1596
|
-
let
|
|
1597
|
-
if (!
|
|
1598
|
-
let i =
|
|
1610
|
+
() => n.command(({ state: n }) => {
|
|
1611
|
+
let r = e(n);
|
|
1612
|
+
if (!r.isBlockContainer) return !1;
|
|
1613
|
+
if (r.blockContent.node.childCount === 0 && r.blockContent.node.type.spec.content === "inline*") {
|
|
1614
|
+
let e = X(n.doc, r.bnBlock.beforePos);
|
|
1615
|
+
if (!e) return !1;
|
|
1616
|
+
let i = Or(n.doc, e);
|
|
1599
1617
|
if (!i.isBlockContainer || !i || !i.isBlockContainer) return !1;
|
|
1600
|
-
let a =
|
|
1601
|
-
if (
|
|
1602
|
-
let e =
|
|
1618
|
+
let a = t();
|
|
1619
|
+
if (r.childContainer && a.insertContentAt(r.bnBlock.afterPos, r.childContainer?.node.content), i.blockContent.node.type.spec.content === "tableRow+") {
|
|
1620
|
+
let e = r.bnBlock.beforePos - 1 - 1 - 1 - 1 - 1;
|
|
1603
1621
|
a = a.setTextSelection(e);
|
|
1604
1622
|
} else if (i.blockContent.node.type.spec.content === "") a = a.setNodeSelection(i.blockContent.beforePos);
|
|
1605
1623
|
else {
|
|
@@ -1607,175 +1625,175 @@ var yr = (e) => {
|
|
|
1607
1625
|
a = a.setTextSelection(e);
|
|
1608
1626
|
}
|
|
1609
1627
|
return a.deleteRange({
|
|
1610
|
-
from:
|
|
1611
|
-
to:
|
|
1628
|
+
from: r.bnBlock.beforePos,
|
|
1629
|
+
to: r.bnBlock.afterPos
|
|
1612
1630
|
}).scrollIntoView().run();
|
|
1613
1631
|
}
|
|
1614
1632
|
return !1;
|
|
1615
1633
|
}),
|
|
1616
|
-
() =>
|
|
1617
|
-
let
|
|
1618
|
-
if (!
|
|
1619
|
-
let
|
|
1620
|
-
if (
|
|
1621
|
-
let
|
|
1622
|
-
if (!
|
|
1623
|
-
if (
|
|
1624
|
-
from: n.bnBlock.beforePos,
|
|
1625
|
-
to: n.bnBlock.afterPos
|
|
1626
|
-
}, r.bnBlock.afterPos).deleteRange({
|
|
1634
|
+
() => n.command(({ state: n }) => {
|
|
1635
|
+
let r = e(n);
|
|
1636
|
+
if (!r.isBlockContainer) return !1;
|
|
1637
|
+
let i = n.selection.from === r.blockContent.beforePos + 1, a = n.selection.empty, o = X(n.doc, r.bnBlock.beforePos);
|
|
1638
|
+
if (o && i && a) {
|
|
1639
|
+
let e = Or(n.doc, o);
|
|
1640
|
+
if (!e.isBlockContainer) return !1;
|
|
1641
|
+
if (e.blockContent.node.type.spec.content === "" || e.blockContent.node.type.spec.content === "inline*" && e.blockContent.node.childCount === 0) return t().cut({
|
|
1627
1642
|
from: r.bnBlock.beforePos,
|
|
1628
1643
|
to: r.bnBlock.afterPos
|
|
1644
|
+
}, e.bnBlock.afterPos).deleteRange({
|
|
1645
|
+
from: e.bnBlock.beforePos,
|
|
1646
|
+
to: e.bnBlock.afterPos
|
|
1629
1647
|
}).run();
|
|
1630
1648
|
}
|
|
1631
1649
|
return !1;
|
|
1632
1650
|
})
|
|
1633
|
-
]),
|
|
1634
|
-
() =>
|
|
1635
|
-
() =>
|
|
1636
|
-
let
|
|
1637
|
-
if (!
|
|
1638
|
-
let { blockContent:
|
|
1639
|
-
if (!
|
|
1640
|
-
if (
|
|
1641
|
-
let
|
|
1642
|
-
return
|
|
1643
|
-
from:
|
|
1644
|
-
to:
|
|
1651
|
+
]), n = () => this.editor.commands.first(({ chain: t, commands: n }) => [
|
|
1652
|
+
() => n.deleteSelection(),
|
|
1653
|
+
() => n.command(({ state: n }) => {
|
|
1654
|
+
let r = e(n);
|
|
1655
|
+
if (!r.isBlockContainer || !r.childContainer) return !1;
|
|
1656
|
+
let { blockContent: i, childContainer: a } = r, o = n.selection.from === i.afterPos - 1, s = n.selection.empty, c = d(n.doc.resolve(a.beforePos + 1));
|
|
1657
|
+
if (!c.isBlockContainer) return !1;
|
|
1658
|
+
if (o && s) {
|
|
1659
|
+
let e = c.blockContent.node, r = e.type.spec.content === "inline*", o = i.node.type.spec.content === "inline*";
|
|
1660
|
+
return t().insertContentAt(c.bnBlock.afterPos, c.childContainer?.node.content || w.empty).deleteRange(a.node.childCount === 1 ? {
|
|
1661
|
+
from: a.beforePos,
|
|
1662
|
+
to: a.afterPos
|
|
1645
1663
|
} : {
|
|
1646
|
-
from:
|
|
1647
|
-
to:
|
|
1648
|
-
}).insertContentAt(
|
|
1664
|
+
from: c.bnBlock.beforePos,
|
|
1665
|
+
to: c.bnBlock.afterPos
|
|
1666
|
+
}).insertContentAt(n.selection.from, r && o ? e.content : null).setTextSelection(n.selection.from).scrollIntoView().run();
|
|
1649
1667
|
}
|
|
1650
1668
|
return !1;
|
|
1651
1669
|
}),
|
|
1652
|
-
() =>
|
|
1653
|
-
let
|
|
1654
|
-
if (!
|
|
1655
|
-
let { bnBlock:
|
|
1656
|
-
if (!
|
|
1657
|
-
let
|
|
1658
|
-
return
|
|
1670
|
+
() => n.command(({ state: n }) => {
|
|
1671
|
+
let r = e(n);
|
|
1672
|
+
if (!r.isBlockContainer) return !1;
|
|
1673
|
+
let { bnBlock: i, blockContent: a } = r, o = Z(n.doc, r.bnBlock.beforePos);
|
|
1674
|
+
if (!o || !o.isBlockContainer) return !1;
|
|
1675
|
+
let s = n.selection.from === a.afterPos - 1, c = n.selection.empty, l = i.afterPos;
|
|
1676
|
+
return s && c ? t().command(jr(l)).scrollIntoView().run() : !1;
|
|
1659
1677
|
}),
|
|
1660
|
-
() =>
|
|
1661
|
-
let
|
|
1662
|
-
if (!
|
|
1663
|
-
let
|
|
1664
|
-
if (!
|
|
1665
|
-
if (
|
|
1666
|
-
let e =
|
|
1667
|
-
return
|
|
1678
|
+
() => n.command(({ state: t, tr: n, dispatch: r }) => {
|
|
1679
|
+
let i = e(t);
|
|
1680
|
+
if (!i.isBlockContainer || t.selection.from !== i.blockContent.afterPos - 1) return !1;
|
|
1681
|
+
let a = Z(t.doc, i.bnBlock.beforePos);
|
|
1682
|
+
if (!a || a.isBlockContainer) return !1;
|
|
1683
|
+
if (r) {
|
|
1684
|
+
let e = a.bnBlock.beforePos + 1, t = n.doc.resolve(e + 1);
|
|
1685
|
+
return n.delete(t.pos, t.pos + t.nodeAfter.nodeSize), L(n, a.bnBlock.beforePos), n.insert(i.bnBlock.afterPos, t.nodeAfter), n.setSelection(M.near(n.doc.resolve(t.pos))), !0;
|
|
1668
1686
|
}
|
|
1669
1687
|
return !1;
|
|
1670
1688
|
}),
|
|
1671
|
-
() =>
|
|
1672
|
-
let
|
|
1673
|
-
if (!
|
|
1674
|
-
let
|
|
1675
|
-
if (
|
|
1676
|
-
let
|
|
1677
|
-
if (
|
|
1678
|
-
let e =
|
|
1679
|
-
|
|
1689
|
+
() => n.command(({ state: t, tr: n, dispatch: r }) => {
|
|
1690
|
+
let i = e(t);
|
|
1691
|
+
if (!i.isBlockContainer || n.selection.from !== i.blockContent.afterPos - 1) return !1;
|
|
1692
|
+
let a = n.doc.resolve(i.bnBlock.afterPos);
|
|
1693
|
+
if (a.nodeAfter || a.node().type.name !== "column") return !1;
|
|
1694
|
+
let o = n.doc.resolve(i.bnBlock.afterPos), s = n.doc.resolve(o.after()), c = s.after();
|
|
1695
|
+
if (r) {
|
|
1696
|
+
let e = s.pos === c - 1 ? c : s.pos + 1, t = d(n.doc.resolve(e));
|
|
1697
|
+
n.delete(t.bnBlock.beforePos, t.bnBlock.afterPos), L(n, c - s.node().nodeSize), n.insert(o.pos, t.bnBlock.node), n.setSelection(M.near(n.doc.resolve(e)));
|
|
1680
1698
|
}
|
|
1681
1699
|
return !0;
|
|
1682
1700
|
}),
|
|
1683
|
-
() =>
|
|
1684
|
-
let
|
|
1685
|
-
if (!
|
|
1686
|
-
let { blockContent:
|
|
1687
|
-
if (
|
|
1688
|
-
let
|
|
1689
|
-
let
|
|
1690
|
-
if (
|
|
1691
|
-
let
|
|
1692
|
-
if (
|
|
1693
|
-
}, a =
|
|
1701
|
+
() => n.command(({ state: n }) => {
|
|
1702
|
+
let r = e(n);
|
|
1703
|
+
if (!r.isBlockContainer) return !1;
|
|
1704
|
+
let { blockContent: i } = r, a = n.selection.from === i.afterPos - 1, o = n.selection.empty;
|
|
1705
|
+
if (a && o) {
|
|
1706
|
+
let e = (t, n) => {
|
|
1707
|
+
let r = Z(t, n);
|
|
1708
|
+
if (r) return r;
|
|
1709
|
+
let i = Dr(t, n);
|
|
1710
|
+
if (i) return e(t, i.bnBlock.beforePos);
|
|
1711
|
+
}, a = e(n.doc, r.bnBlock.beforePos);
|
|
1694
1712
|
if (!a || !a.isBlockContainer) return !1;
|
|
1695
|
-
let o = a.blockContent.node, s = o.type.spec.content === "inline*", c =
|
|
1696
|
-
return
|
|
1713
|
+
let o = a.blockContent.node, s = o.type.spec.content === "inline*", c = i.node.type.spec.content === "inline*";
|
|
1714
|
+
return t().insertContentAt(a.bnBlock.afterPos, a.childContainer?.node.content || w.empty).deleteRange({
|
|
1697
1715
|
from: a.bnBlock.beforePos,
|
|
1698
1716
|
to: a.bnBlock.afterPos
|
|
1699
|
-
}).insertContentAt(
|
|
1717
|
+
}).insertContentAt(n.selection.from, s && c ? o.content : null).setTextSelection(n.selection.from).scrollIntoView().run();
|
|
1700
1718
|
}
|
|
1701
1719
|
return !1;
|
|
1702
1720
|
}),
|
|
1703
|
-
() =>
|
|
1704
|
-
let
|
|
1705
|
-
if (!
|
|
1706
|
-
if (
|
|
1707
|
-
let
|
|
1708
|
-
if (!
|
|
1709
|
-
let i =
|
|
1710
|
-
if (
|
|
1711
|
-
let e =
|
|
1721
|
+
() => n.command(({ state: n }) => {
|
|
1722
|
+
let r = e(n);
|
|
1723
|
+
if (!r.isBlockContainer) return !1;
|
|
1724
|
+
if (r.blockContent.node.childCount === 0 && r.blockContent.node.type.spec.content === "inline*") {
|
|
1725
|
+
let e = Z(n.doc, r.bnBlock.beforePos);
|
|
1726
|
+
if (!e || !e.isBlockContainer) return !1;
|
|
1727
|
+
let i = t();
|
|
1728
|
+
if (e.blockContent.node.type.spec.content === "tableRow+") {
|
|
1729
|
+
let e = r.bnBlock.afterPos + 1 + 1 + 1 + 1 + 1;
|
|
1712
1730
|
i = i.setTextSelection(e);
|
|
1713
|
-
} else i =
|
|
1731
|
+
} else i = e.blockContent.node.type.spec.content === "" ? i.setNodeSelection(e.blockContent.beforePos) : i.setTextSelection(e.blockContent.beforePos + 1);
|
|
1714
1732
|
return i.deleteRange({
|
|
1715
|
-
from:
|
|
1716
|
-
to:
|
|
1733
|
+
from: r.bnBlock.beforePos,
|
|
1734
|
+
to: r.bnBlock.afterPos
|
|
1717
1735
|
}).scrollIntoView().run();
|
|
1718
1736
|
}
|
|
1719
1737
|
return !1;
|
|
1720
1738
|
}),
|
|
1721
|
-
() =>
|
|
1722
|
-
let
|
|
1723
|
-
if (!
|
|
1724
|
-
let
|
|
1725
|
-
if (!
|
|
1726
|
-
if (
|
|
1727
|
-
let
|
|
1728
|
-
return
|
|
1729
|
-
from:
|
|
1730
|
-
to:
|
|
1731
|
-
}).insertContentAt(
|
|
1739
|
+
() => n.command(({ state: n }) => {
|
|
1740
|
+
let r = e(n);
|
|
1741
|
+
if (!r.isBlockContainer) return !1;
|
|
1742
|
+
let i = n.selection.from === r.blockContent.afterPos - 1, a = n.selection.empty, o = Z(n.doc, r.bnBlock.beforePos);
|
|
1743
|
+
if (!o || !o.isBlockContainer) return !1;
|
|
1744
|
+
if (o && i && a && (o.blockContent.node.type.spec.content === "" || o.blockContent.node.type.spec.content === "inline*" && o.blockContent.node.childCount === 0)) {
|
|
1745
|
+
let e = o.bnBlock.node.lastChild.content;
|
|
1746
|
+
return t().deleteRange({
|
|
1747
|
+
from: o.bnBlock.beforePos,
|
|
1748
|
+
to: o.bnBlock.afterPos
|
|
1749
|
+
}).insertContentAt(r.bnBlock.afterPos, o.bnBlock.node.childCount === 2 ? e : null).run();
|
|
1732
1750
|
}
|
|
1733
1751
|
return !1;
|
|
1734
1752
|
})
|
|
1735
|
-
]),
|
|
1736
|
-
() =>
|
|
1737
|
-
let
|
|
1738
|
-
if (!
|
|
1739
|
-
let { bnBlock:
|
|
1740
|
-
return
|
|
1753
|
+
]), r = (t = !1) => this.editor.commands.first(({ commands: n, tr: r }) => [
|
|
1754
|
+
() => n.command(({ state: t, tr: n }) => {
|
|
1755
|
+
let r = e(t);
|
|
1756
|
+
if (!r.isBlockContainer) return !1;
|
|
1757
|
+
let { bnBlock: i, blockContent: a } = r, { depth: o } = t.doc.resolve(i.beforePos), s = t.selection.$anchor.parentOffset === 0, c = t.selection.anchor === t.selection.head, l = a.node.childCount === 0;
|
|
1758
|
+
return s && c && l && o > 1 ? H(n, n.doc.type.schema.nodes.blockContainer, n.doc.type.schema.nodes.blockGroup) : !1;
|
|
1741
1759
|
}),
|
|
1742
|
-
() =>
|
|
1743
|
-
let
|
|
1744
|
-
if (
|
|
1745
|
-
if (
|
|
1746
|
-
let e =
|
|
1747
|
-
return
|
|
1760
|
+
() => n.command(({ state: n }) => {
|
|
1761
|
+
let i = e(n), a = this.options.editor.schema.blockSpecs[i.blockNoteType]?.implementation?.meta?.hardBreakShortcut ?? "shift+enter";
|
|
1762
|
+
if (a === "none") return !1;
|
|
1763
|
+
if (a === "shift+enter" && t || a === "enter") {
|
|
1764
|
+
let e = r.storedMarks || r.selection.$head.marks().filter((e) => this.editor.extensionManager.splittableMarks.includes(e.type.name));
|
|
1765
|
+
return r.insert(r.selection.head, r.doc.type.schema.nodes.hardBreak.create()).ensureMarks(e), !0;
|
|
1748
1766
|
}
|
|
1749
1767
|
return !1;
|
|
1750
1768
|
}),
|
|
1751
|
-
() =>
|
|
1752
|
-
let
|
|
1753
|
-
if (!
|
|
1754
|
-
let { bnBlock:
|
|
1755
|
-
if (
|
|
1756
|
-
let
|
|
1757
|
-
if (
|
|
1758
|
-
let
|
|
1759
|
-
|
|
1769
|
+
() => n.command(({ state: t, dispatch: n, tr: r }) => {
|
|
1770
|
+
let i = e(t);
|
|
1771
|
+
if (!i.isBlockContainer) return !1;
|
|
1772
|
+
let { bnBlock: a, blockContent: o } = i, s = t.selection.$anchor.parentOffset === 0, c = t.selection.anchor === t.selection.head, l = o.node.childCount === 0;
|
|
1773
|
+
if (s && c && l) {
|
|
1774
|
+
let e = a.afterPos, o = e + 2;
|
|
1775
|
+
if (n) {
|
|
1776
|
+
let n = t.schema.nodes.blockContainer.createAndFill(void 0, [t.schema.nodes.paragraph.createAndFill() || void 0, i.childContainer?.node].filter((e) => e !== void 0));
|
|
1777
|
+
r.insert(e, n).setSelection(new M(r.doc.resolve(o))).scrollIntoView(), i.childContainer && r.delete(i.childContainer.beforePos, i.childContainer.afterPos);
|
|
1760
1778
|
}
|
|
1761
1779
|
return !0;
|
|
1762
1780
|
}
|
|
1763
1781
|
return !1;
|
|
1764
1782
|
}),
|
|
1765
|
-
() =>
|
|
1766
|
-
let
|
|
1767
|
-
if (!
|
|
1768
|
-
let { blockContent:
|
|
1769
|
-
return
|
|
1783
|
+
() => n.command(({ state: t, chain: n }) => {
|
|
1784
|
+
let r = e(t);
|
|
1785
|
+
if (!r.isBlockContainer) return !1;
|
|
1786
|
+
let { blockContent: a } = r, o = t.selection.$anchor.parentOffset === 0;
|
|
1787
|
+
return a.node.childCount === 0 ? !1 : (n().deleteSelection().command(i(t.selection.from, o, o)).scrollIntoView().run(), !0);
|
|
1770
1788
|
})
|
|
1771
1789
|
]);
|
|
1772
1790
|
return {
|
|
1773
|
-
Backspace:
|
|
1774
|
-
Delete:
|
|
1775
|
-
Enter: () =>
|
|
1776
|
-
"Shift-Enter": () =>
|
|
1777
|
-
Tab: () => this.options.tabBehavior !== "prefer-indent" && (this.options.editor.getExtension(se)?.store.state || this.options.editor.getExtension(
|
|
1778
|
-
"Shift-Tab": () => this.options.tabBehavior !== "prefer-indent" && (this.options.editor.getExtension(se)?.store.state || this.options.editor.getExtension(
|
|
1791
|
+
Backspace: t,
|
|
1792
|
+
Delete: n,
|
|
1793
|
+
Enter: () => r(),
|
|
1794
|
+
"Shift-Enter": () => r(!0),
|
|
1795
|
+
Tab: () => this.options.tabBehavior !== "prefer-indent" && (this.options.editor.getExtension(se)?.store.state || this.options.editor.getExtension(v)?.store.state !== void 0) ? !1 : Ht(this.options.editor),
|
|
1796
|
+
"Shift-Tab": () => this.options.tabBehavior !== "prefer-indent" && (this.options.editor.getExtension(se)?.store.state || this.options.editor.getExtension(v)?.store.state !== void 0) ? !1 : Wt(this.options.editor),
|
|
1779
1797
|
"Shift-Mod-ArrowUp": () => (this.options.editor.moveBlocksUp(), !0),
|
|
1780
1798
|
"Shift-Mod-ArrowDown": () => (this.options.editor.moveBlocksDown(), !0),
|
|
1781
1799
|
"Mod-z": () => this.options.editor.undo(),
|
|
@@ -1783,7 +1801,7 @@ var yr = (e) => {
|
|
|
1783
1801
|
"Shift-Mod-z": () => this.options.editor.redo()
|
|
1784
1802
|
};
|
|
1785
1803
|
}
|
|
1786
|
-
}),
|
|
1804
|
+
}), Nr = D.create({
|
|
1787
1805
|
name: "textAlignment",
|
|
1788
1806
|
addGlobalAttributes() {
|
|
1789
1807
|
return [{
|
|
@@ -1795,7 +1813,7 @@ var yr = (e) => {
|
|
|
1795
1813
|
} }
|
|
1796
1814
|
}];
|
|
1797
1815
|
}
|
|
1798
|
-
}),
|
|
1816
|
+
}), Pr = D.create({
|
|
1799
1817
|
name: "blockTextColor",
|
|
1800
1818
|
addGlobalAttributes() {
|
|
1801
1819
|
return [{
|
|
@@ -1804,13 +1822,13 @@ var yr = (e) => {
|
|
|
1804
1822
|
"tableCell",
|
|
1805
1823
|
"tableHeader"
|
|
1806
1824
|
],
|
|
1807
|
-
attributes: { textColor:
|
|
1825
|
+
attributes: { textColor: m() }
|
|
1808
1826
|
}];
|
|
1809
1827
|
}
|
|
1810
|
-
}),
|
|
1828
|
+
}), Fr = "aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2";
|
|
1811
1829
|
//#endregion
|
|
1812
1830
|
//#region src/extensions/tiptap-extensions/Link/helpers/linkDetector.ts
|
|
1813
|
-
function
|
|
1831
|
+
function Ir(e) {
|
|
1814
1832
|
let t = [], n = [], r = 0;
|
|
1815
1833
|
for (; r < e.length;) {
|
|
1816
1834
|
let i = 0;
|
|
@@ -1824,59 +1842,59 @@ function Nr(e) {
|
|
|
1824
1842
|
}
|
|
1825
1843
|
return t;
|
|
1826
1844
|
}
|
|
1827
|
-
var
|
|
1828
|
-
function
|
|
1845
|
+
var Lr = new Set(Ir(Fr)), Rr = new Set(["localhost"]), zr = /[.,;:!?"']+$/, Br = /(?:https?|ftp|ftps):\/\/[^\s]+/g, Vr = /mailto:[^\s]+/g, Hr = /[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}/g, Ur = /(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?::\d{1,5})?(?:[/?#][^\s]*)?/g;
|
|
1846
|
+
function Wr(e) {
|
|
1829
1847
|
let t = e, n = !0;
|
|
1830
1848
|
for (; n;) {
|
|
1831
1849
|
n = !1;
|
|
1832
1850
|
let e = t;
|
|
1833
|
-
t = t.replace(
|
|
1851
|
+
t = t.replace(zr, ""), t !== e && (n = !0);
|
|
1834
1852
|
for (let [e, r] of [["(", ")"], ["[", "]"]]) for (; t.endsWith(r);) {
|
|
1835
|
-
let i =
|
|
1836
|
-
if (
|
|
1853
|
+
let i = Gr(t, e);
|
|
1854
|
+
if (Gr(t, r) > i) t = t.slice(0, -1), n = !0;
|
|
1837
1855
|
else break;
|
|
1838
1856
|
}
|
|
1839
1857
|
}
|
|
1840
1858
|
return t;
|
|
1841
1859
|
}
|
|
1842
|
-
function
|
|
1860
|
+
function Gr(e, t) {
|
|
1843
1861
|
let n = 0;
|
|
1844
1862
|
for (let r = 0; r < e.length; r++) e[r] === t && n++;
|
|
1845
1863
|
return n;
|
|
1846
1864
|
}
|
|
1847
|
-
function
|
|
1865
|
+
function Kr(e) {
|
|
1848
1866
|
let t = e.split(".");
|
|
1849
1867
|
return t[t.length - 1].toLowerCase();
|
|
1850
1868
|
}
|
|
1851
|
-
function
|
|
1852
|
-
let t =
|
|
1853
|
-
return
|
|
1869
|
+
function qr(e) {
|
|
1870
|
+
let t = Kr(e);
|
|
1871
|
+
return Lr.has(t);
|
|
1854
1872
|
}
|
|
1855
|
-
function
|
|
1873
|
+
function Jr(e, t, n) {
|
|
1856
1874
|
return t === "email" ? "mailto:" + e : /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(e) || /^mailto:/i.test(e) ? e : n + "://" + e;
|
|
1857
1875
|
}
|
|
1858
|
-
function
|
|
1876
|
+
function Yr(e, t) {
|
|
1859
1877
|
if (!e) return [];
|
|
1860
1878
|
let n = t?.defaultProtocol || "http", r = [];
|
|
1861
|
-
for (let t of e.matchAll(
|
|
1879
|
+
for (let t of e.matchAll(Br)) r.push({
|
|
1862
1880
|
type: "url",
|
|
1863
1881
|
value: t[0],
|
|
1864
1882
|
start: t.index,
|
|
1865
1883
|
end: t.index + t[0].length
|
|
1866
1884
|
});
|
|
1867
|
-
for (let t of e.matchAll(
|
|
1885
|
+
for (let t of e.matchAll(Vr)) r.push({
|
|
1868
1886
|
type: "url",
|
|
1869
1887
|
value: t[0],
|
|
1870
1888
|
start: t.index,
|
|
1871
1889
|
end: t.index + t[0].length
|
|
1872
1890
|
});
|
|
1873
|
-
for (let t of e.matchAll(
|
|
1891
|
+
for (let t of e.matchAll(Hr)) r.push({
|
|
1874
1892
|
type: "email",
|
|
1875
1893
|
value: t[0],
|
|
1876
1894
|
start: t.index,
|
|
1877
1895
|
end: t.index + t[0].length
|
|
1878
1896
|
});
|
|
1879
|
-
for (let t of e.matchAll(
|
|
1897
|
+
for (let t of e.matchAll(Ur)) r.push({
|
|
1880
1898
|
type: "url",
|
|
1881
1899
|
value: t[0],
|
|
1882
1900
|
start: t.index,
|
|
@@ -1887,18 +1905,18 @@ function Kr(e, t) {
|
|
|
1887
1905
|
for (let e of r) e.start >= a && (i.push(e), a = e.end);
|
|
1888
1906
|
let o = [];
|
|
1889
1907
|
for (let e of i) {
|
|
1890
|
-
let t =
|
|
1908
|
+
let t = Wr(e.value);
|
|
1891
1909
|
if (!t) continue;
|
|
1892
1910
|
let r = e.start, i = r + t.length;
|
|
1893
1911
|
if (e.type === "url" && !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t)) {
|
|
1894
1912
|
let e = new URL("http://" + t).hostname;
|
|
1895
|
-
if (!
|
|
1913
|
+
if (!qr(e)) continue;
|
|
1896
1914
|
}
|
|
1897
1915
|
if (e.type === "email") {
|
|
1898
1916
|
let e = t.split("@")[1];
|
|
1899
|
-
if (!
|
|
1917
|
+
if (!qr(e)) continue;
|
|
1900
1918
|
}
|
|
1901
|
-
let a =
|
|
1919
|
+
let a = Jr(t, e.type, n);
|
|
1902
1920
|
o.push({
|
|
1903
1921
|
type: e.type,
|
|
1904
1922
|
value: t,
|
|
@@ -1910,7 +1928,7 @@ function Kr(e, t) {
|
|
|
1910
1928
|
}
|
|
1911
1929
|
return o;
|
|
1912
1930
|
}
|
|
1913
|
-
function
|
|
1931
|
+
function Xr(e, t = "http") {
|
|
1914
1932
|
if (!e) return [$(e, 0, 0)];
|
|
1915
1933
|
for (let [n, r] of [
|
|
1916
1934
|
["(", ")"],
|
|
@@ -1920,32 +1938,32 @@ function qr(e, t = "http") {
|
|
|
1920
1938
|
let i = e.slice(1, -1);
|
|
1921
1939
|
if (Q(i)) return [
|
|
1922
1940
|
$(n, 0, 1),
|
|
1923
|
-
|
|
1941
|
+
Zr(i, 1, 1 + i.length, t),
|
|
1924
1942
|
$(r, 1 + i.length, e.length)
|
|
1925
1943
|
];
|
|
1926
1944
|
}
|
|
1927
1945
|
if (e.endsWith(".") && e.length > 1) {
|
|
1928
1946
|
let n = e.slice(0, -1);
|
|
1929
|
-
if (Q(n)) return [
|
|
1947
|
+
if (Q(n)) return [Zr(n, 0, n.length, t), $(".", n.length, e.length)];
|
|
1930
1948
|
}
|
|
1931
|
-
return Q(e) ? [
|
|
1949
|
+
return Q(e) ? [Zr(e, 0, e.length, t)] : [$(e, 0, e.length)];
|
|
1932
1950
|
}
|
|
1933
1951
|
function Q(e) {
|
|
1934
|
-
if (/^(?:https?|ftp|ftps):\/\/[^\s]+$/.test(e) || /^mailto:[^\s]+$/.test(e) ||
|
|
1952
|
+
if (/^(?:https?|ftp|ftps):\/\/[^\s]+$/.test(e) || /^mailto:[^\s]+$/.test(e) || Rr.has(e.toLowerCase())) return !0;
|
|
1935
1953
|
let t = e.match(/^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+([a-zA-Z]{2,})(?::\d{1,5})?(?:[/?#][^\s]*)?$/);
|
|
1936
1954
|
if (t) {
|
|
1937
1955
|
let e = t[1].toLowerCase();
|
|
1938
|
-
if (
|
|
1956
|
+
if (Lr.has(e)) return !0;
|
|
1939
1957
|
}
|
|
1940
1958
|
return !1;
|
|
1941
1959
|
}
|
|
1942
|
-
function
|
|
1960
|
+
function Zr(e, t, n, r) {
|
|
1943
1961
|
let i = e.includes("@") && !e.includes("://") && !e.startsWith("mailto:") ? "email" : "url";
|
|
1944
1962
|
return {
|
|
1945
1963
|
type: i,
|
|
1946
1964
|
value: e,
|
|
1947
1965
|
isLink: !0,
|
|
1948
|
-
href:
|
|
1966
|
+
href: Jr(e, i, r),
|
|
1949
1967
|
start: t,
|
|
1950
1968
|
end: n
|
|
1951
1969
|
};
|
|
@@ -1962,40 +1980,40 @@ function $(e, t, n) {
|
|
|
1962
1980
|
}
|
|
1963
1981
|
//#endregion
|
|
1964
1982
|
//#region src/extensions/tiptap-extensions/Link/helpers/whitespace.ts
|
|
1965
|
-
var
|
|
1983
|
+
var Qr = "[\0- \xA0 -\u2029 ]", $r = new RegExp(Qr), ei = RegExp(`${Qr}$`), ti = new RegExp(Qr, "g");
|
|
1966
1984
|
//#endregion
|
|
1967
1985
|
//#region src/extensions/tiptap-extensions/Link/helpers/autolink.ts
|
|
1968
|
-
function
|
|
1986
|
+
function ni(e) {
|
|
1969
1987
|
return e.length === 1 ? e[0].isLink : e.length === 3 && e[1].isLink ? ["()", "[]"].includes(e[0].value + e[2].value) : !1;
|
|
1970
1988
|
}
|
|
1971
|
-
function
|
|
1972
|
-
return new
|
|
1973
|
-
key: new
|
|
1989
|
+
function ri(e) {
|
|
1990
|
+
return new it({
|
|
1991
|
+
key: new at("autolink"),
|
|
1974
1992
|
appendTransaction: (t, n, r) => {
|
|
1975
1993
|
let i = t.some((e) => e.docChanged) && !n.doc.eq(r.doc), a = t.some((e) => e.getMeta("preventAutolink"));
|
|
1976
1994
|
if (!i || a) return;
|
|
1977
1995
|
let { tr: o } = r;
|
|
1978
|
-
if (
|
|
1979
|
-
let n =
|
|
1996
|
+
if (Je(Ue(n.doc, [...t])).forEach(({ newRange: t }) => {
|
|
1997
|
+
let n = Ge(r.doc, t, (e) => e.isTextblock), i, a;
|
|
1980
1998
|
if (n.length > 1) i = n[0], a = r.doc.textBetween(i.pos, i.pos + i.node.nodeSize, void 0, " ");
|
|
1981
1999
|
else if (n.length) {
|
|
1982
2000
|
let e = r.doc.textBetween(t.from, t.to, " ", " ");
|
|
1983
|
-
if (!
|
|
2001
|
+
if (!ei.test(e)) return;
|
|
1984
2002
|
i = n[0], a = r.doc.textBetween(i.pos, t.to, void 0, " ");
|
|
1985
2003
|
}
|
|
1986
2004
|
if (i && a) {
|
|
1987
|
-
let t = a.split(
|
|
2005
|
+
let t = a.split($r).filter(Boolean);
|
|
1988
2006
|
if (t.length <= 0) return;
|
|
1989
2007
|
let n = t[t.length - 1], s = i.pos + a.lastIndexOf(n);
|
|
1990
2008
|
if (!n) return;
|
|
1991
|
-
let c =
|
|
1992
|
-
if (
|
|
2009
|
+
let c = Xr(n, e.defaultProtocol);
|
|
2010
|
+
if (!ni(c)) return;
|
|
1993
2011
|
c.filter((e) => e.isLink).map((e) => ({
|
|
1994
2012
|
...e,
|
|
1995
2013
|
from: s + e.start + 1,
|
|
1996
2014
|
to: s + e.end + 1
|
|
1997
2015
|
})).filter((e) => r.schema.marks.code ? !r.doc.rangeHasMark(e.from, e.to, r.schema.marks.code) : !0).filter((t) => e.validate(t.value)).filter((t) => e.shouldAutoLink(t.value)).forEach((t) => {
|
|
1998
|
-
|
|
2016
|
+
Xe(t.from, t.to, r.doc).some((t) => t.mark.type === e.type) || o.addMark(t.from, t.to, e.type.create({ href: t.href }));
|
|
1999
2017
|
});
|
|
2000
2018
|
}
|
|
2001
2019
|
}), o.steps.length) return o;
|
|
@@ -2004,9 +2022,9 @@ function ei(e) {
|
|
|
2004
2022
|
}
|
|
2005
2023
|
//#endregion
|
|
2006
2024
|
//#region src/extensions/tiptap-extensions/Link/helpers/clickHandler.ts
|
|
2007
|
-
function
|
|
2008
|
-
return new
|
|
2009
|
-
key: new
|
|
2025
|
+
function ii(e) {
|
|
2026
|
+
return new it({
|
|
2027
|
+
key: new at("handleClickLink"),
|
|
2010
2028
|
props: { handleClick: (t, n, r) => {
|
|
2011
2029
|
if (r.button !== 0 || !t.editable) return !1;
|
|
2012
2030
|
let i = null;
|
|
@@ -2022,16 +2040,16 @@ function ti(e) {
|
|
|
2022
2040
|
if (!e.editor) throw Error("BlockNoteEditor not found in Link click handler");
|
|
2023
2041
|
return e.onClick(r, e.editor) ?? !0;
|
|
2024
2042
|
}
|
|
2025
|
-
let a =
|
|
2043
|
+
let a = qe(t.state, e.type.name), o = i.href ?? a.href, s = i.target ?? a.target;
|
|
2026
2044
|
return o ? (window.open(o, s), !0) : !1;
|
|
2027
2045
|
} }
|
|
2028
2046
|
});
|
|
2029
2047
|
}
|
|
2030
2048
|
//#endregion
|
|
2031
2049
|
//#region src/extensions/tiptap-extensions/Link/helpers/pasteHandler.ts
|
|
2032
|
-
function
|
|
2033
|
-
return new
|
|
2034
|
-
key: new
|
|
2050
|
+
function ai(e) {
|
|
2051
|
+
return new it({
|
|
2052
|
+
key: new at("handlePasteLink"),
|
|
2035
2053
|
props: { handlePaste: (t, n, r) => {
|
|
2036
2054
|
let { shouldAutoLink: i, isValidLink: a } = e, { state: o } = t, { selection: s } = o, { empty: c } = s;
|
|
2037
2055
|
if (c) return !1;
|
|
@@ -2039,26 +2057,26 @@ function ni(e) {
|
|
|
2039
2057
|
r.content.forEach((e) => {
|
|
2040
2058
|
l += e.textContent;
|
|
2041
2059
|
});
|
|
2042
|
-
let u =
|
|
2060
|
+
let u = Yr(l, { defaultProtocol: e.defaultProtocol }).find((e) => e.isLink && e.value === l);
|
|
2043
2061
|
return !l || !u || !a(u.value) || i !== void 0 && !i(u.value) ? !1 : e.editor.commands.setMark(e.type, { href: u.href });
|
|
2044
2062
|
} }
|
|
2045
2063
|
});
|
|
2046
2064
|
}
|
|
2047
2065
|
//#endregion
|
|
2048
2066
|
//#region src/extensions/tiptap-extensions/Link/link.ts
|
|
2049
|
-
var
|
|
2050
|
-
function
|
|
2067
|
+
var oi = "https", si = /^(?:(?:http|https|ftp|ftps|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z0-9+.\-]+(?:[^a-z+.\-:]|$))/i;
|
|
2068
|
+
function ci(e) {
|
|
2051
2069
|
if (!e) return !0;
|
|
2052
|
-
let t = e.replace(
|
|
2053
|
-
return
|
|
2070
|
+
let t = e.replace(ti, "");
|
|
2071
|
+
return si.test(t);
|
|
2054
2072
|
}
|
|
2055
|
-
function
|
|
2073
|
+
function li(e) {
|
|
2056
2074
|
let t = /^[a-z][a-z0-9+.-]*:\/\//i.test(e), n = /^[a-z][a-z0-9+.-]*:/i.test(e);
|
|
2057
2075
|
if (t || n && !e.includes("@")) return !0;
|
|
2058
2076
|
let r = (e.includes("@") ? e.split("@").pop() : e).split(/[/?#:]/)[0];
|
|
2059
2077
|
return !(/^\d{1,3}(\.\d{1,3}){3}$/.test(r) || !/\./.test(r));
|
|
2060
2078
|
}
|
|
2061
|
-
var
|
|
2079
|
+
var ui = He.create({
|
|
2062
2080
|
name: "link",
|
|
2063
2081
|
keepOnSplit: !1,
|
|
2064
2082
|
exitable: !0,
|
|
@@ -2073,7 +2091,7 @@ var si = Ve.create({
|
|
|
2073
2091
|
},
|
|
2074
2092
|
editor: void 0,
|
|
2075
2093
|
onClick: void 0,
|
|
2076
|
-
isValidLink:
|
|
2094
|
+
isValidLink: ci
|
|
2077
2095
|
};
|
|
2078
2096
|
},
|
|
2079
2097
|
addAttributes() {
|
|
@@ -2097,11 +2115,11 @@ var si = Ve.create({
|
|
|
2097
2115
|
renderHTML({ HTMLAttributes: e }) {
|
|
2098
2116
|
return this.options.isValidLink(e.href) ? [
|
|
2099
2117
|
"a",
|
|
2100
|
-
|
|
2118
|
+
et(e, this.options.HTMLAttributes),
|
|
2101
2119
|
0
|
|
2102
2120
|
] : [
|
|
2103
2121
|
"a",
|
|
2104
|
-
|
|
2122
|
+
et({
|
|
2105
2123
|
...e,
|
|
2106
2124
|
href: ""
|
|
2107
2125
|
}, this.options.HTMLAttributes),
|
|
@@ -2110,12 +2128,12 @@ var si = Ve.create({
|
|
|
2110
2128
|
},
|
|
2111
2129
|
addPasteRules() {
|
|
2112
2130
|
let e = this.options.isValidLink;
|
|
2113
|
-
return [
|
|
2131
|
+
return [$e({
|
|
2114
2132
|
find: (t) => {
|
|
2115
2133
|
let n = [];
|
|
2116
2134
|
if (t) {
|
|
2117
|
-
let r =
|
|
2118
|
-
for (let e of r)
|
|
2135
|
+
let r = Yr(t, { defaultProtocol: oi }).filter((t) => t.isLink && e(t.value));
|
|
2136
|
+
for (let e of r) li(e.value) && n.push({
|
|
2119
2137
|
text: e.value,
|
|
2120
2138
|
data: { href: e.href },
|
|
2121
2139
|
index: e.start
|
|
@@ -2129,46 +2147,46 @@ var si = Ve.create({
|
|
|
2129
2147
|
},
|
|
2130
2148
|
addProseMirrorPlugins() {
|
|
2131
2149
|
let e = [];
|
|
2132
|
-
return e.push(
|
|
2150
|
+
return e.push(ri({
|
|
2133
2151
|
type: this.type,
|
|
2134
|
-
defaultProtocol:
|
|
2152
|
+
defaultProtocol: oi,
|
|
2135
2153
|
validate: this.options.isValidLink,
|
|
2136
|
-
shouldAutoLink:
|
|
2137
|
-
})), e.push(
|
|
2154
|
+
shouldAutoLink: li
|
|
2155
|
+
})), e.push(ii({
|
|
2138
2156
|
type: this.type,
|
|
2139
2157
|
tiptapEditor: this.editor,
|
|
2140
2158
|
editor: this.options.editor,
|
|
2141
2159
|
onClick: this.options.onClick
|
|
2142
|
-
})), e.push(
|
|
2160
|
+
})), e.push(ai({
|
|
2143
2161
|
editor: this.editor,
|
|
2144
|
-
defaultProtocol:
|
|
2162
|
+
defaultProtocol: oi,
|
|
2145
2163
|
type: this.type,
|
|
2146
|
-
shouldAutoLink:
|
|
2164
|
+
shouldAutoLink: li,
|
|
2147
2165
|
isValidLink: this.options.isValidLink
|
|
2148
2166
|
})), e;
|
|
2149
2167
|
}
|
|
2150
|
-
}),
|
|
2168
|
+
}), di = ge(({ editor: e, options: t }) => ({
|
|
2151
2169
|
key: "link",
|
|
2152
|
-
tiptapExtensions: [
|
|
2170
|
+
tiptapExtensions: [ui.configure({
|
|
2153
2171
|
HTMLAttributes: t.HTMLAttributes ?? {},
|
|
2154
2172
|
editor: e,
|
|
2155
2173
|
onClick: t.onClick,
|
|
2156
2174
|
...t.isValidLink ? { isValidLink: t.isValidLink } : {}
|
|
2157
2175
|
})]
|
|
2158
|
-
})),
|
|
2176
|
+
})), fi = {
|
|
2159
2177
|
blockColor: "data-block-color",
|
|
2160
2178
|
blockStyle: "data-block-style",
|
|
2161
2179
|
id: "data-id",
|
|
2162
2180
|
depth: "data-depth",
|
|
2163
2181
|
depthChange: "data-depth-change"
|
|
2164
|
-
},
|
|
2182
|
+
}, pi = O.create({
|
|
2165
2183
|
name: "blockContainer",
|
|
2166
2184
|
group: "blockGroupChild bnBlock",
|
|
2167
2185
|
content: "blockContent blockGroup?",
|
|
2168
2186
|
priority: 50,
|
|
2169
2187
|
defining: !0,
|
|
2170
2188
|
marks() {
|
|
2171
|
-
return
|
|
2189
|
+
return b(this.editor);
|
|
2172
2190
|
},
|
|
2173
2191
|
parseHTML() {
|
|
2174
2192
|
return [{
|
|
@@ -2176,7 +2194,7 @@ var si = Ve.create({
|
|
|
2176
2194
|
getAttrs: (e) => {
|
|
2177
2195
|
if (typeof e == "string") return !1;
|
|
2178
2196
|
let t = {};
|
|
2179
|
-
for (let [n, r] of Object.entries(
|
|
2197
|
+
for (let [n, r] of Object.entries(fi)) e.getAttribute(r) && (t[n] = e.getAttribute(r));
|
|
2180
2198
|
return t;
|
|
2181
2199
|
}
|
|
2182
2200
|
}, {
|
|
@@ -2192,19 +2210,19 @@ var si = Ve.create({
|
|
|
2192
2210
|
...this.options.domAttributes?.block || {},
|
|
2193
2211
|
...e
|
|
2194
2212
|
}, r = document.createElement("div");
|
|
2195
|
-
r.className =
|
|
2213
|
+
r.className = f("bn-block", n.class), r.setAttribute("data-node-type", this.name);
|
|
2196
2214
|
for (let [e, t] of Object.entries(n)) e !== "class" && r.setAttribute(e, t);
|
|
2197
2215
|
return t.appendChild(r), {
|
|
2198
2216
|
dom: t,
|
|
2199
2217
|
contentDOM: r
|
|
2200
2218
|
};
|
|
2201
2219
|
}
|
|
2202
|
-
}),
|
|
2220
|
+
}), mi = O.create({
|
|
2203
2221
|
name: "blockGroup",
|
|
2204
2222
|
group: "childContainer",
|
|
2205
2223
|
content: "blockGroupChild+",
|
|
2206
2224
|
marks() {
|
|
2207
|
-
return
|
|
2225
|
+
return b(this.editor);
|
|
2208
2226
|
},
|
|
2209
2227
|
parseHTML() {
|
|
2210
2228
|
return [{
|
|
@@ -2217,32 +2235,32 @@ var si = Ve.create({
|
|
|
2217
2235
|
...this.options.domAttributes?.blockGroup || {},
|
|
2218
2236
|
...e
|
|
2219
2237
|
}, n = document.createElement("div");
|
|
2220
|
-
n.className =
|
|
2238
|
+
n.className = f("bn-block-group", t.class), n.setAttribute("data-node-type", "blockGroup");
|
|
2221
2239
|
for (let [e, r] of Object.entries(t)) e !== "class" && n.setAttribute(e, r);
|
|
2222
2240
|
return {
|
|
2223
2241
|
dom: n,
|
|
2224
2242
|
contentDOM: n
|
|
2225
2243
|
};
|
|
2226
2244
|
}
|
|
2227
|
-
}),
|
|
2245
|
+
}), hi = O.create({
|
|
2228
2246
|
name: "doc",
|
|
2229
2247
|
topNode: !0,
|
|
2230
2248
|
content: "blockGroup",
|
|
2231
2249
|
marks() {
|
|
2232
|
-
return
|
|
2250
|
+
return b(this.editor);
|
|
2233
2251
|
}
|
|
2234
2252
|
});
|
|
2235
2253
|
//#endregion
|
|
2236
2254
|
//#region src/editor/managers/ExtensionManager/extensions.ts
|
|
2237
|
-
function
|
|
2255
|
+
function gi(e, t) {
|
|
2238
2256
|
return [
|
|
2239
2257
|
k.ClipboardTextSerializer,
|
|
2240
2258
|
k.Commands,
|
|
2241
2259
|
k.Editable,
|
|
2242
2260
|
k.FocusEvents,
|
|
2243
2261
|
k.Tabindex,
|
|
2244
|
-
|
|
2245
|
-
|
|
2262
|
+
dt,
|
|
2263
|
+
_.configure({
|
|
2246
2264
|
types: [
|
|
2247
2265
|
"blockContainer",
|
|
2248
2266
|
"columnList",
|
|
@@ -2251,62 +2269,62 @@ function pi(e, t) {
|
|
|
2251
2269
|
setIdAttribute: t.setIdAttribute,
|
|
2252
2270
|
isWithinEditor: e.isWithinEditor
|
|
2253
2271
|
}),
|
|
2254
|
-
|
|
2255
|
-
|
|
2272
|
+
Er,
|
|
2273
|
+
ut,
|
|
2256
2274
|
...Object.values(e.schema.styleSpecs).map((t) => t.implementation.mark.configure({ editor: e })),
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2275
|
+
Pr,
|
|
2276
|
+
Tr,
|
|
2277
|
+
Nr,
|
|
2260
2278
|
D.create({
|
|
2261
2279
|
name: "OverrideEscape",
|
|
2262
2280
|
addKeyboardShortcuts: () => ({ Escape: () => e.getExtension(ie)?.shown() ? !1 : (e.blur(), !0) })
|
|
2263
2281
|
}),
|
|
2264
|
-
|
|
2265
|
-
|
|
2282
|
+
hi,
|
|
2283
|
+
pi.configure({
|
|
2266
2284
|
editor: e,
|
|
2267
2285
|
domAttributes: t.domAttributes
|
|
2268
2286
|
}),
|
|
2269
|
-
|
|
2287
|
+
Mr.configure({
|
|
2270
2288
|
editor: e,
|
|
2271
2289
|
tabBehavior: t.tabBehavior
|
|
2272
2290
|
}),
|
|
2273
|
-
|
|
2291
|
+
mi.configure({ domAttributes: t.domAttributes }),
|
|
2274
2292
|
...Object.values(e.schema.inlineContentSpecs).filter((e) => e.config !== "link" && e.config !== "text").map((t) => t.implementation.node.configure({ editor: e })),
|
|
2275
2293
|
...Object.values(e.schema.blockSpecs).flatMap((n) => [..."node" in n.implementation ? [n.implementation.node.configure({
|
|
2276
2294
|
editor: e,
|
|
2277
2295
|
domAttributes: t.domAttributes
|
|
2278
2296
|
})] : []]),
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2297
|
+
wr(e),
|
|
2298
|
+
yr(e, t.pasteHandler || ((e) => e.defaultPasteHandler())),
|
|
2299
|
+
nr(e)
|
|
2282
2300
|
];
|
|
2283
2301
|
}
|
|
2284
|
-
function
|
|
2302
|
+
function _i(e, t) {
|
|
2285
2303
|
let n = [
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2304
|
+
ye(),
|
|
2305
|
+
ve(t),
|
|
2306
|
+
v(t),
|
|
2289
2307
|
se(t),
|
|
2290
|
-
|
|
2308
|
+
di({
|
|
2291
2309
|
HTMLAttributes: t.links?.HTMLAttributes ?? {},
|
|
2292
2310
|
onClick: t.links?.onClick,
|
|
2293
2311
|
...t.links?.isValidLink ? { isValidLink: t.links.isValidLink } : {}
|
|
2294
2312
|
}),
|
|
2295
|
-
|
|
2296
|
-
Ae(),
|
|
2297
|
-
xe(t),
|
|
2298
|
-
Me(t),
|
|
2299
|
-
Ce(t),
|
|
2300
|
-
ie(t),
|
|
2301
|
-
ye(),
|
|
2313
|
+
Ae(t),
|
|
2302
2314
|
je(),
|
|
2303
|
-
|
|
2315
|
+
Se(t),
|
|
2316
|
+
Ne(t),
|
|
2317
|
+
we(t),
|
|
2318
|
+
ie(t),
|
|
2319
|
+
be(),
|
|
2320
|
+
Me(),
|
|
2321
|
+
...t.trailingBlock === !1 ? [] : [Oe()]
|
|
2304
2322
|
];
|
|
2305
|
-
return "table" in e.schema.blockSpecs && n.push(
|
|
2323
|
+
return "table" in e.schema.blockSpecs && n.push(Ce(t)), t.animations !== !1 && n.push(ke()), n;
|
|
2306
2324
|
}
|
|
2307
2325
|
//#endregion
|
|
2308
2326
|
//#region src/editor/managers/ExtensionManager/index.ts
|
|
2309
|
-
var
|
|
2327
|
+
var vi = class {
|
|
2310
2328
|
editor;
|
|
2311
2329
|
options;
|
|
2312
2330
|
disabledExtensions = /* @__PURE__ */ new Set();
|
|
@@ -2330,7 +2348,7 @@ var hi = class {
|
|
|
2330
2348
|
}), e.onUnmount(() => {
|
|
2331
2349
|
for (let [e, t] of this.abortMap.entries()) this.abortMap.delete(e), t.abort();
|
|
2332
2350
|
}), this.disabledExtensions = new Set(t.disableExtensions || []);
|
|
2333
|
-
for (let e of
|
|
2351
|
+
for (let e of _i(this.editor, this.options)) this.addExtension(e);
|
|
2334
2352
|
for (let e of this.options.extensions ?? []) this.addExtension(e);
|
|
2335
2353
|
for (let e of Object.values(this.editor.schema.blockSpecs)) for (let t of e.extensions ?? []) this.addExtension(t);
|
|
2336
2354
|
}
|
|
@@ -2346,7 +2364,7 @@ var hi = class {
|
|
|
2346
2364
|
}
|
|
2347
2365
|
if (!this.extensions.some((e) => e.key === n.key)) {
|
|
2348
2366
|
if (typeof e == "function") {
|
|
2349
|
-
let e = n[
|
|
2367
|
+
let e = n[he];
|
|
2350
2368
|
typeof e == "function" && this.extensionFactories.set(e, n);
|
|
2351
2369
|
}
|
|
2352
2370
|
if (this.extensions.push(n), n.blockNoteExtensions) for (let e of n.blockNoteExtensions) this.addExtension(e, n.key);
|
|
@@ -2399,7 +2417,7 @@ var hi = class {
|
|
|
2399
2417
|
this.editor.prosemirrorView.updateState(n);
|
|
2400
2418
|
}
|
|
2401
2419
|
getTiptapExtensions() {
|
|
2402
|
-
let e =
|
|
2420
|
+
let e = gi(this.editor, this.options).filter((e) => !this.disabledExtensions.has(e.name)), t = a(this.extensions.map((e) => {
|
|
2403
2421
|
let t = this.blockNoteExtensionDependents.get(e.key);
|
|
2404
2422
|
return t?.size ? {
|
|
2405
2423
|
key: e.key,
|
|
@@ -2422,7 +2440,7 @@ var hi = class {
|
|
|
2422
2440
|
Array.from(n.keys()).sort((e, t) => e - t).reverse().forEach((t) => {
|
|
2423
2441
|
e.push(...n.get(t));
|
|
2424
2442
|
});
|
|
2425
|
-
let t =
|
|
2443
|
+
let t = ct({ rules: e });
|
|
2426
2444
|
return [t, new j({ props: { handleKeyDown(e, n) {
|
|
2427
2445
|
if (n.key !== "Enter" || n.shiftKey || n.ctrlKey || n.metaKey || n.altKey) return !1;
|
|
2428
2446
|
let { $cursor: r } = e.state.selection;
|
|
@@ -2438,7 +2456,7 @@ var hi = class {
|
|
|
2438
2456
|
return !t.prosemirrorPlugins?.length && !Object.keys(t.keyboardShortcuts || {}).length && !t.inputRules?.length ? {
|
|
2439
2457
|
plugins: n,
|
|
2440
2458
|
inputRules: r
|
|
2441
|
-
} : (this.extensionPlugins.set(t, n), t.inputRules?.length && r.push(...t.inputRules.map((t) => new
|
|
2459
|
+
} : (this.extensionPlugins.set(t, n), t.inputRules?.length && r.push(...t.inputRules.map((t) => new st(t.find, (n, r, i, a) => {
|
|
2442
2460
|
let o = t.replace({
|
|
2443
2461
|
match: r,
|
|
2444
2462
|
range: {
|
|
@@ -2448,11 +2466,11 @@ var hi = class {
|
|
|
2448
2466
|
editor: this.editor
|
|
2449
2467
|
});
|
|
2450
2468
|
if (o) {
|
|
2451
|
-
let t = n.tr, r =
|
|
2452
|
-
return !r.isBlockContainer || this.editor.schema.blockSchema[r.blockNoteType]?.content !== "inline" ? null : (t.deleteRange(i, a),
|
|
2469
|
+
let t = n.tr, r = e(t);
|
|
2470
|
+
return !r.isBlockContainer || this.editor.schema.blockSchema[r.blockNoteType]?.content !== "inline" ? null : (t.deleteRange(i, a), oe(t, r.bnBlock.beforePos, o), Xn(t, x(r.bnBlock.node, t.doc), "start"), t);
|
|
2453
2471
|
}
|
|
2454
2472
|
return null;
|
|
2455
|
-
}, { undoable: !0 }))), Object.keys(t.keyboardShortcuts || {}).length && n.push(
|
|
2473
|
+
}, { undoable: !0 }))), Object.keys(t.keyboardShortcuts || {}).length && n.push(lt(Object.fromEntries(Object.entries(t.keyboardShortcuts).map(([e, t]) => [e, () => t({ editor: this.editor })])))), {
|
|
2456
2474
|
plugins: n,
|
|
2457
2475
|
inputRules: r
|
|
2458
2476
|
});
|
|
@@ -2471,7 +2489,7 @@ var hi = class {
|
|
|
2471
2489
|
};
|
|
2472
2490
|
//#endregion
|
|
2473
2491
|
//#region src/util/expandToWords.ts
|
|
2474
|
-
function
|
|
2492
|
+
function yi(e, t) {
|
|
2475
2493
|
let { $from: n, $to: r } = t;
|
|
2476
2494
|
if (n.pos > n.start() && n.pos < e.content.size) {
|
|
2477
2495
|
let t = e.textBetween(n.pos, n.pos + 1);
|
|
@@ -2496,15 +2514,15 @@ function gi(e, t) {
|
|
|
2496
2514
|
}
|
|
2497
2515
|
//#endregion
|
|
2498
2516
|
//#region src/api/blockManipulation/selections/selection.ts
|
|
2499
|
-
function
|
|
2517
|
+
function bi(e) {
|
|
2500
2518
|
if (e.selection.empty || "node" in e.selection) return;
|
|
2501
|
-
let t = e.doc.resolve(
|
|
2519
|
+
let t = e.doc.resolve(fe(e.doc, e.selection.from).posBeforeNode), n = e.doc.resolve(fe(e.doc, e.selection.to).posBeforeNode), r = (n, r) => {
|
|
2502
2520
|
let i = t.posAtIndex(n, r), a = e.doc.resolve(i).nodeAfter;
|
|
2503
2521
|
if (!a) throw Error(`Error getting selection - node not found at position ${i}`);
|
|
2504
|
-
return
|
|
2522
|
+
return S(a, e.doc);
|
|
2505
2523
|
}, i = [], a = t.sharedDepth(n.pos), o = t.index(a), s = n.index(a);
|
|
2506
2524
|
if (t.depth > a) {
|
|
2507
|
-
i.push(
|
|
2525
|
+
i.push(S(t.nodeAfter, e.doc));
|
|
2508
2526
|
for (let e = t.depth; e > a; e--) if (t.node(e).type.isInGroup("childContainer")) {
|
|
2509
2527
|
let n = t.index(e) + 1, a = t.node(e).childCount;
|
|
2510
2528
|
for (let t = n; t < a; t++) i.push(r(t, e));
|
|
@@ -2514,74 +2532,74 @@ function _i(e) {
|
|
|
2514
2532
|
if (i.length === 0) throw Error(`Error getting selection - selection doesn't span any blocks (${e.selection})`);
|
|
2515
2533
|
return { blocks: i };
|
|
2516
2534
|
}
|
|
2517
|
-
function
|
|
2518
|
-
let
|
|
2519
|
-
if (
|
|
2520
|
-
let
|
|
2521
|
-
if (!
|
|
2522
|
-
let l =
|
|
2523
|
-
if (!l) throw Error(`Block with ID ${
|
|
2524
|
-
let u =
|
|
2525
|
-
if (!u.isBlockContainer || f.content === "none") throw Error(`Attempting to set selection anchor in block without content (id ${
|
|
2526
|
-
if (!d.isBlockContainer || p.content === "none") throw Error(`Attempting to set selection anchor in block without content (id ${
|
|
2527
|
-
let m,
|
|
2535
|
+
function xi(e, n, r) {
|
|
2536
|
+
let i = typeof n == "string" ? n : n.id, a = typeof r == "string" ? r : r.id, o = h(c(e));
|
|
2537
|
+
if (i === a) throw Error(`Attempting to set selection with the same anchor and head blocks (id ${i})`);
|
|
2538
|
+
let s = t(i, e.doc);
|
|
2539
|
+
if (!s) throw Error(`Block with ID ${i} not found`);
|
|
2540
|
+
let l = t(a, e.doc);
|
|
2541
|
+
if (!l) throw Error(`Block with ID ${a} not found`);
|
|
2542
|
+
let u = g(s), d = g(l), f = o.blockSchema[u.blockNoteType], p = o.blockSchema[d.blockNoteType];
|
|
2543
|
+
if (!u.isBlockContainer || f.content === "none") throw Error(`Attempting to set selection anchor in block without content (id ${i})`);
|
|
2544
|
+
if (!d.isBlockContainer || p.content === "none") throw Error(`Attempting to set selection anchor in block without content (id ${a})`);
|
|
2545
|
+
let m, _;
|
|
2528
2546
|
if (f.content === "table") {
|
|
2529
|
-
let e =
|
|
2547
|
+
let e = rt.get(u.blockContent.node);
|
|
2530
2548
|
m = u.blockContent.beforePos + e.positionAt(0, 0, u.blockContent.node) + 1 + 2;
|
|
2531
2549
|
} else m = u.blockContent.beforePos + 1;
|
|
2532
2550
|
if (p.content === "table") {
|
|
2533
|
-
let t =
|
|
2534
|
-
|
|
2535
|
-
} else
|
|
2536
|
-
e.setSelection(M.create(e.doc, m,
|
|
2537
|
-
}
|
|
2538
|
-
function
|
|
2539
|
-
let
|
|
2540
|
-
for (;
|
|
2551
|
+
let t = rt.get(d.blockContent.node), n = d.blockContent.beforePos + t.positionAt(t.height - 1, t.width - 1, d.blockContent.node) + 1;
|
|
2552
|
+
_ = n + e.doc.resolve(n).nodeAfter.nodeSize - 2;
|
|
2553
|
+
} else _ = d.blockContent.afterPos - 1;
|
|
2554
|
+
e.setSelection(M.create(e.doc, m, _));
|
|
2555
|
+
}
|
|
2556
|
+
function Si(e, t = !1) {
|
|
2557
|
+
let r = t ? yi(e.doc, e.selection) : e.selection, i = r.$from, a = r.$to;
|
|
2558
|
+
for (; a.parentOffset >= a.parent.nodeSize - 2 && a.depth > 0;) a = e.doc.resolve(a.pos + 1);
|
|
2559
|
+
for (; a.parentOffset === 0 && a.depth > 0;) a = e.doc.resolve(a.pos - 1);
|
|
2541
2560
|
for (; i.parentOffset === 0 && i.depth > 0;) i = e.doc.resolve(i.pos - 1);
|
|
2542
|
-
for (;
|
|
2543
|
-
|
|
2544
|
-
let a = de(e.doc.slice(r.pos, i.pos, !0));
|
|
2561
|
+
for (; i.parentOffset >= i.parent.nodeSize - 2 && i.depth > 0;) i = e.doc.resolve(i.pos + 1);
|
|
2562
|
+
let o = n(e.doc.slice(i.pos, a.pos, !0));
|
|
2545
2563
|
return {
|
|
2546
2564
|
_meta: {
|
|
2547
|
-
startPos:
|
|
2548
|
-
endPos:
|
|
2565
|
+
startPos: i.pos,
|
|
2566
|
+
endPos: a.pos
|
|
2549
2567
|
},
|
|
2550
|
-
...
|
|
2568
|
+
...o
|
|
2551
2569
|
};
|
|
2552
2570
|
}
|
|
2553
2571
|
//#endregion
|
|
2554
2572
|
//#region src/editor/managers/SelectionManager.ts
|
|
2555
|
-
var
|
|
2573
|
+
var Ci = class {
|
|
2556
2574
|
editor;
|
|
2557
2575
|
constructor(e) {
|
|
2558
2576
|
this.editor = e;
|
|
2559
2577
|
}
|
|
2560
2578
|
getSelection() {
|
|
2561
|
-
return this.editor.transact((e) =>
|
|
2579
|
+
return this.editor.transact((e) => bi(e));
|
|
2562
2580
|
}
|
|
2563
2581
|
getSelectionCutBlocks(e = !1) {
|
|
2564
|
-
return this.editor.transact((t) =>
|
|
2582
|
+
return this.editor.transact((t) => Si(t, e));
|
|
2565
2583
|
}
|
|
2566
2584
|
setSelection(e, t) {
|
|
2567
|
-
return this.editor.transact((n) =>
|
|
2585
|
+
return this.editor.transact((n) => xi(n, e, t));
|
|
2568
2586
|
}
|
|
2569
2587
|
getTextCursorPosition() {
|
|
2570
|
-
return this.editor.transact((e) =>
|
|
2588
|
+
return this.editor.transact((e) => Yn(e));
|
|
2571
2589
|
}
|
|
2572
2590
|
setTextCursorPosition(e, t = "start") {
|
|
2573
|
-
return this.editor.transact((n) =>
|
|
2591
|
+
return this.editor.transact((n) => Xn(n, e, t));
|
|
2574
2592
|
}
|
|
2575
2593
|
getSelectionBoundingBox() {
|
|
2576
2594
|
if (!this.editor.prosemirrorView) return;
|
|
2577
2595
|
let { selection: e } = this.editor.prosemirrorState, { ranges: t } = e, n = Math.min(...t.map((e) => e.$from.pos)), r = Math.max(...t.map((e) => e.$to.pos));
|
|
2578
|
-
if (
|
|
2596
|
+
if (Qe(e)) {
|
|
2579
2597
|
let e = this.editor.prosemirrorView.nodeDOM(n);
|
|
2580
2598
|
if (e) return e.getBoundingClientRect();
|
|
2581
2599
|
}
|
|
2582
|
-
return
|
|
2600
|
+
return tt(this.editor.prosemirrorView, n, r).toJSON();
|
|
2583
2601
|
}
|
|
2584
|
-
},
|
|
2602
|
+
}, wi = class {
|
|
2585
2603
|
editor;
|
|
2586
2604
|
constructor(e) {
|
|
2587
2605
|
this.editor = e;
|
|
@@ -2660,7 +2678,7 @@ var bi = class {
|
|
|
2660
2678
|
};
|
|
2661
2679
|
//#endregion
|
|
2662
2680
|
//#region src/api/blockManipulation/insertContentAt.ts
|
|
2663
|
-
function
|
|
2681
|
+
function Ti(e, t, n, r = { updateSelection: !0 }) {
|
|
2664
2682
|
let { from: i, to: a } = typeof t == "number" ? {
|
|
2665
2683
|
from: t,
|
|
2666
2684
|
to: t
|
|
@@ -2674,19 +2692,19 @@ function Si(e, t, n, r = { updateSelection: !0 }) {
|
|
|
2674
2692
|
let { parent: t } = e.doc.resolve(i);
|
|
2675
2693
|
t.isTextblock && !t.type.spec.code && !t.childCount && (--i, a += 1);
|
|
2676
2694
|
}
|
|
2677
|
-
return o ? e.insertText(c, i, a) : e.replaceWith(i, a, n), r.updateSelection &&
|
|
2695
|
+
return o ? e.insertText(c, i, a) : e.replaceWith(i, a, n), r.updateSelection && nt(e, e.steps.length - 1, -1), !0;
|
|
2678
2696
|
}
|
|
2679
2697
|
//#endregion
|
|
2680
2698
|
//#region src/editor/managers/StyleManager.ts
|
|
2681
|
-
var
|
|
2699
|
+
var Ei = class {
|
|
2682
2700
|
editor;
|
|
2683
2701
|
constructor(e) {
|
|
2684
2702
|
this.editor = e;
|
|
2685
2703
|
}
|
|
2686
2704
|
insertInlineContent(e, { updateSelection: t = !1 } = {}) {
|
|
2687
|
-
let n =
|
|
2705
|
+
let n = s(e, this.editor.pmSchema);
|
|
2688
2706
|
this.editor.transact((e) => {
|
|
2689
|
-
|
|
2707
|
+
Ti(e, {
|
|
2690
2708
|
from: e.selection.from,
|
|
2691
2709
|
to: e.selection.to
|
|
2692
2710
|
}, n, { updateSelection: t });
|
|
@@ -2712,7 +2730,7 @@ var Ci = class {
|
|
|
2712
2730
|
if (!e) throw Error(`style ${t} not found in styleSchema`);
|
|
2713
2731
|
if (e.propSchema === "boolean") this.editor._tiptapEditor.commands.setMark(t);
|
|
2714
2732
|
else if (e.propSchema === "string") this.editor._tiptapEditor.commands.setMark(t, { stringValue: n });
|
|
2715
|
-
else throw new
|
|
2733
|
+
else throw new C(e.propSchema);
|
|
2716
2734
|
}
|
|
2717
2735
|
}
|
|
2718
2736
|
removeStyles(e) {
|
|
@@ -2724,7 +2742,7 @@ var Ci = class {
|
|
|
2724
2742
|
if (!e) throw Error(`style ${t} not found in styleSchema`);
|
|
2725
2743
|
if (e.propSchema === "boolean") this.editor._tiptapEditor.commands.toggleMark(t);
|
|
2726
2744
|
else if (e.propSchema === "string") this.editor._tiptapEditor.commands.toggleMark(t, { stringValue: n });
|
|
2727
|
-
else throw new
|
|
2745
|
+
else throw new C(e.propSchema);
|
|
2728
2746
|
}
|
|
2729
2747
|
}
|
|
2730
2748
|
getSelectedText() {
|
|
@@ -2734,7 +2752,7 @@ var Ci = class {
|
|
|
2734
2752
|
return this.editor.transact((t) => {
|
|
2735
2753
|
let n = t.doc.resolve(e), r = n.marks().find((e) => e.type.name === "link");
|
|
2736
2754
|
if (!r) return;
|
|
2737
|
-
let i =
|
|
2755
|
+
let i = Ye(n, r.type);
|
|
2738
2756
|
if (i) return {
|
|
2739
2757
|
href: r.attrs.href,
|
|
2740
2758
|
from: i.from,
|
|
@@ -2773,22 +2791,22 @@ var Ci = class {
|
|
|
2773
2791
|
};
|
|
2774
2792
|
//#endregion
|
|
2775
2793
|
//#region src/editor/transformPasted.ts
|
|
2776
|
-
function
|
|
2777
|
-
return
|
|
2794
|
+
function Di(e) {
|
|
2795
|
+
return Ke(e.state.selection.$from, (e) => e.type.name === "tableCell" || e.type.name === "tableHeader") !== void 0;
|
|
2778
2796
|
}
|
|
2779
|
-
function
|
|
2797
|
+
function Oi(e, t) {
|
|
2780
2798
|
let n = t.nodes.hardBreak, r = N.empty;
|
|
2781
2799
|
return e.forEach((e) => {
|
|
2782
|
-
e.isTextblock && e.childCount > 0 ? (r = r.append(e.content), r = r.addToEnd(n.create())) : e.isText ? r = r.addToEnd(e) : e.isBlock && e.childCount > 0 && (r = r.append(
|
|
2800
|
+
e.isTextblock && e.childCount > 0 ? (r = r.append(e.content), r = r.addToEnd(n.create())) : e.isText ? r = r.addToEnd(e) : e.isBlock && e.childCount > 0 && (r = r.append(Oi(e.content, t)), r = r.addToEnd(n.create()));
|
|
2783
2801
|
}), r.lastChild?.type === n && (r = r.cut(0, r.size - 1)), r;
|
|
2784
2802
|
}
|
|
2785
|
-
function
|
|
2803
|
+
function ki(e, t) {
|
|
2786
2804
|
let n = [];
|
|
2787
2805
|
return e.forEach((e, r, i) => {
|
|
2788
2806
|
i !== t && n.push(e);
|
|
2789
2807
|
}), N.from(n);
|
|
2790
2808
|
}
|
|
2791
|
-
function
|
|
2809
|
+
function Ai(e, t) {
|
|
2792
2810
|
let n = [];
|
|
2793
2811
|
for (let r = 0; r < e.childCount; r++) if (e.child(r).type.name === "tableRow") if (n.length > 0 && n[n.length - 1].type.name === "table") {
|
|
2794
2812
|
let t = n[n.length - 1], i = t.copy(t.content.addToEnd(e.child(r)));
|
|
@@ -2800,56 +2818,56 @@ function Di(e, t) {
|
|
|
2800
2818
|
else n.push(e.child(r));
|
|
2801
2819
|
return e = N.from(n), e;
|
|
2802
2820
|
}
|
|
2803
|
-
function
|
|
2821
|
+
function ji(e, t) {
|
|
2804
2822
|
let n = N.from(e.content);
|
|
2805
|
-
n =
|
|
2806
|
-
let r =
|
|
2823
|
+
n = Ai(n, t.state.schema);
|
|
2824
|
+
let r = Mi(n, t, e);
|
|
2807
2825
|
if (r) return r;
|
|
2808
|
-
if (
|
|
2826
|
+
if (Di(t)) {
|
|
2809
2827
|
let e = !1;
|
|
2810
2828
|
if (n.descendants((t) => {
|
|
2811
2829
|
t.type.isInGroup("tableContent") && (e = !0);
|
|
2812
|
-
}), !e && !t.state.schema.nodes.tableParagraph.validContent(n)) return new P(
|
|
2830
|
+
}), !e && !t.state.schema.nodes.tableParagraph.validContent(n)) return new P(Oi(n, t.state.schema), 0, 0);
|
|
2813
2831
|
}
|
|
2814
|
-
if (!
|
|
2832
|
+
if (!Ni(n, t)) return new P(n, e.openStart, e.openEnd);
|
|
2815
2833
|
for (let e = 0; e < n.childCount; e++) if (n.child(e).type.spec.group === "blockContent") {
|
|
2816
2834
|
let r = [n.child(e)];
|
|
2817
2835
|
if (e + 1 < n.childCount && n.child(e + 1).type.name === "blockGroup") {
|
|
2818
2836
|
let t = n.child(e + 1).child(0).child(0);
|
|
2819
|
-
(t.type.name === "bulletListItem" || t.type.name === "numberedListItem" || t.type.name === "checkListItem") && (r.push(n.child(e + 1)), n =
|
|
2837
|
+
(t.type.name === "bulletListItem" || t.type.name === "numberedListItem" || t.type.name === "checkListItem") && (r.push(n.child(e + 1)), n = ki(n, e + 1));
|
|
2820
2838
|
}
|
|
2821
2839
|
let i = t.state.schema.nodes.blockContainer.createChecked(void 0, r);
|
|
2822
2840
|
n = n.replaceChild(e, i);
|
|
2823
2841
|
}
|
|
2824
2842
|
return new P(n, e.openStart, e.openEnd);
|
|
2825
2843
|
}
|
|
2826
|
-
function
|
|
2827
|
-
if (
|
|
2828
|
-
let
|
|
2829
|
-
if (!
|
|
2830
|
-
let
|
|
2831
|
-
if (
|
|
2832
|
-
let
|
|
2833
|
-
return new P(
|
|
2834
|
-
}
|
|
2835
|
-
function
|
|
2836
|
-
let
|
|
2837
|
-
if (
|
|
2838
|
-
if (
|
|
2839
|
-
if (
|
|
2840
|
-
let
|
|
2841
|
-
if (
|
|
2844
|
+
function Mi(t, n, r) {
|
|
2845
|
+
if (Di(n) || n.dragging) return null;
|
|
2846
|
+
let i = e(n.state), a = i.isBlockContainer ? i.blockContent.node : null;
|
|
2847
|
+
if (!a || a.type.name === "paragraph" || a.type.spec.content !== "inline*" || a.childCount > 0) return null;
|
|
2848
|
+
let o = t.firstChild, s = o?.firstChild, c = s?.firstChild;
|
|
2849
|
+
if (o?.type.name !== "blockGroup" || s?.type.name !== "blockContainer" || c?.type.name !== "paragraph") return null;
|
|
2850
|
+
let l = a.type.create(a.attrs, c.content), u = s.copy(s.content.replaceChild(0, l)), d = o.copy(o.content.replaceChild(0, u));
|
|
2851
|
+
return new P(t.replaceChild(0, d), r.openStart, r.openEnd);
|
|
2852
|
+
}
|
|
2853
|
+
function Ni(t, n) {
|
|
2854
|
+
let r = t.childCount === 1, i = t.firstChild?.type.spec.content === "inline*", a = t.firstChild?.type.spec.content === "tableRow+";
|
|
2855
|
+
if (r) {
|
|
2856
|
+
if (i) return !1;
|
|
2857
|
+
if (a) {
|
|
2858
|
+
let t = e(n.state);
|
|
2859
|
+
if (t.isBlockContainer) return t.blockContent.node.type.spec.content !== "tableRow+";
|
|
2842
2860
|
}
|
|
2843
2861
|
}
|
|
2844
2862
|
return !0;
|
|
2845
2863
|
}
|
|
2846
2864
|
//#endregion
|
|
2847
2865
|
//#region src/editor/BlockNoteEditor.ts
|
|
2848
|
-
var
|
|
2866
|
+
var Pi = {
|
|
2849
2867
|
enableInputRules: !0,
|
|
2850
2868
|
enablePasteRules: !0,
|
|
2851
2869
|
enableCoreExtensions: !1
|
|
2852
|
-
},
|
|
2870
|
+
}, Fi = class e extends B {
|
|
2853
2871
|
options;
|
|
2854
2872
|
pmSchema;
|
|
2855
2873
|
_tiptapEditor;
|
|
@@ -2869,7 +2887,7 @@ var ji = {
|
|
|
2869
2887
|
return new e(t ?? {});
|
|
2870
2888
|
}
|
|
2871
2889
|
constructor(e) {
|
|
2872
|
-
super(), this.options = e, this.dictionary = e.dictionary ||
|
|
2890
|
+
super(), this.options = e, this.dictionary = e.dictionary || Pe, this.settings = { tables: {
|
|
2873
2891
|
splitCells: e?.tables?.splitCells ?? !1,
|
|
2874
2892
|
cellBackgroundColor: e?.tables?.cellBackgroundColor ?? !1,
|
|
2875
2893
|
cellTextColor: e?.tables?.cellTextColor ?? !1,
|
|
@@ -2877,7 +2895,7 @@ var ji = {
|
|
|
2877
2895
|
} };
|
|
2878
2896
|
let t = {
|
|
2879
2897
|
defaultStyles: !0,
|
|
2880
|
-
schema: e.schema ||
|
|
2898
|
+
schema: e.schema || ue.create(),
|
|
2881
2899
|
...e,
|
|
2882
2900
|
placeholders: {
|
|
2883
2901
|
...this.dictionary.placeholders,
|
|
@@ -2895,9 +2913,9 @@ var ji = {
|
|
|
2895
2913
|
}
|
|
2896
2914
|
};
|
|
2897
2915
|
}
|
|
2898
|
-
this.resolveFileUrl = t.resolveFileUrl, this._eventManager = new
|
|
2916
|
+
this.resolveFileUrl = t.resolveFileUrl, this._eventManager = new Qt(this), this._extensionManager = new vi(this, t);
|
|
2899
2917
|
let n = this._extensionManager.getTiptapExtensions(), r = {
|
|
2900
|
-
...
|
|
2918
|
+
...Pi,
|
|
2901
2919
|
...t._tiptapOptions,
|
|
2902
2920
|
element: null,
|
|
2903
2921
|
autofocus: t.autofocus ?? !1,
|
|
@@ -2914,27 +2932,27 @@ var ji = {
|
|
|
2914
2932
|
tabIndex: "0",
|
|
2915
2933
|
...t._tiptapOptions?.editorProps?.attributes,
|
|
2916
2934
|
...t.domAttributes?.editor,
|
|
2917
|
-
class:
|
|
2935
|
+
class: f("bn-editor", t.defaultStyles ? "bn-default-styles" : "", t.domAttributes?.editor?.class || "")
|
|
2918
2936
|
},
|
|
2919
|
-
transformPasted:
|
|
2937
|
+
transformPasted: ji
|
|
2920
2938
|
}
|
|
2921
2939
|
};
|
|
2922
2940
|
try {
|
|
2923
2941
|
let e = t.initialContent || [{
|
|
2924
2942
|
type: "paragraph",
|
|
2925
|
-
id:
|
|
2943
|
+
id: _.options.generateID()
|
|
2926
2944
|
}];
|
|
2927
2945
|
if (!Array.isArray(e) || e.length === 0) throw Error("initialContent must be a non-empty array of blocks, received: " + JSON.stringify(e));
|
|
2928
|
-
let n =
|
|
2946
|
+
let n = Ze(r.extensions);
|
|
2929
2947
|
n.cached.blockNoteEditor = this;
|
|
2930
|
-
let i =
|
|
2948
|
+
let i = We({
|
|
2931
2949
|
type: "doc",
|
|
2932
2950
|
content: [{
|
|
2933
2951
|
type: "blockGroup",
|
|
2934
|
-
content: e.map((e) =>
|
|
2952
|
+
content: e.map((e) => o(e, n, this.schema.styleSchema).toJSON())
|
|
2935
2953
|
}]
|
|
2936
2954
|
}, n, r.parseOptions);
|
|
2937
|
-
this._tiptapEditor = new
|
|
2955
|
+
this._tiptapEditor = new Ve({
|
|
2938
2956
|
...r,
|
|
2939
2957
|
content: i.toJSON()
|
|
2940
2958
|
}), this.pmSchema = this._tiptapEditor.schema;
|
|
@@ -2945,7 +2963,7 @@ var ji = {
|
|
|
2945
2963
|
this.headless = !1;
|
|
2946
2964
|
}), this._tiptapEditor.on("unmount", () => {
|
|
2947
2965
|
this.headless = !0;
|
|
2948
|
-
}), this._blockManager = new
|
|
2966
|
+
}), this._blockManager = new Zt(this), this._exportManager = new Jn(this), this._selectionManager = new Ci(this), this._stateManager = new wi(this), this._styleManager = new Ei(this), this.emit("create");
|
|
2949
2967
|
}
|
|
2950
2968
|
_blockManager;
|
|
2951
2969
|
_eventManager;
|
|
@@ -3042,7 +3060,7 @@ var ji = {
|
|
|
3042
3060
|
this._tiptapEditor.on("selectionUpdate", e);
|
|
3043
3061
|
}
|
|
3044
3062
|
onBeforeChange(e) {
|
|
3045
|
-
return this._extensionManager.getExtension(
|
|
3063
|
+
return this._extensionManager.getExtension(ye).subscribe(e);
|
|
3046
3064
|
}
|
|
3047
3065
|
getTextCursorPosition() {
|
|
3048
3066
|
return this._selectionManager.getTextCursorPosition();
|
|
@@ -3177,7 +3195,7 @@ var ji = {
|
|
|
3177
3195
|
pasteMarkdown(e) {
|
|
3178
3196
|
return this._exportManager.pasteMarkdown(e);
|
|
3179
3197
|
}
|
|
3180
|
-
},
|
|
3198
|
+
}, Ii = class {
|
|
3181
3199
|
mappings;
|
|
3182
3200
|
options;
|
|
3183
3201
|
constructor(e, t, n) {
|
|
@@ -3203,7 +3221,7 @@ var ji = {
|
|
|
3203
3221
|
};
|
|
3204
3222
|
//#endregion
|
|
3205
3223
|
//#region src/exporter/mapping.ts
|
|
3206
|
-
function
|
|
3224
|
+
function Li(e) {
|
|
3207
3225
|
return {
|
|
3208
3226
|
createBlockMapping: (e) => e,
|
|
3209
3227
|
createInlineContentMapping: (e) => e,
|
|
@@ -3212,7 +3230,7 @@ function Pi(e) {
|
|
|
3212
3230
|
}
|
|
3213
3231
|
//#endregion
|
|
3214
3232
|
//#region src/util/combineByGroup.ts
|
|
3215
|
-
function
|
|
3233
|
+
function Ri(e, ...t) {
|
|
3216
3234
|
let n = [...e];
|
|
3217
3235
|
for (let e of t) for (let t of e) {
|
|
3218
3236
|
let e = n.findLastIndex((e) => e.group === t.group);
|
|
@@ -3221,6 +3239,6 @@ function Fi(e, ...t) {
|
|
|
3221
3239
|
return n;
|
|
3222
3240
|
}
|
|
3223
3241
|
//#endregion
|
|
3224
|
-
export { I as C,
|
|
3242
|
+
export { I as C, ft as D, pt as E, L as S, mt as T, Ot as _, yi as a, Et as b, Kn as c, Yt as d, Xt as f, At as g, kt as h, Fi as i, U as l, B as m, Li as n, xr as o, Jt as p, Ii as r, qn as s, Ri as t, qt as u, z as v, ht as w, R as x, jt as y };
|
|
3225
3243
|
|
|
3226
|
-
//# sourceMappingURL=src-
|
|
3244
|
+
//# sourceMappingURL=src-BUXut68d.js.map
|