@blocknote/core 0.49.0 → 0.50.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 +3 -3
- package/dist/{blocks-_lpGWKOa.cjs → blocks-BFnTypT-.cjs} +2 -2
- package/dist/{blocks-_lpGWKOa.cjs.map → blocks-BFnTypT-.cjs.map} +1 -1
- package/dist/{blocks-CSfJen16.js → blocks-UU7EM-QM.js} +587 -572
- package/dist/{blocks-CSfJen16.js.map → blocks-UU7EM-QM.js.map} +1 -1
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +1 -1
- package/dist/comments.cjs +1 -1
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.js +17 -14
- package/dist/comments.js.map +1 -1
- package/dist/{en-QsSI16s5.js → en-B9hMApn4.js} +4 -2
- package/dist/en-B9hMApn4.js.map +1 -0
- package/dist/{en-C4ykW581.cjs → en-Cj5r8sW_.cjs} +2 -2
- package/dist/en-Cj5r8sW_.cjs.map +1 -0
- package/dist/{extensions-BfYaEv6F.cjs → extensions-CYsFi5Is.cjs} +2 -2
- package/dist/{extensions-BfYaEv6F.cjs.map → extensions-CYsFi5Is.cjs.map} +1 -1
- package/dist/{extensions-C3nguvVr.js → extensions-CkLT--Nc.js} +6 -4
- package/dist/{extensions-C3nguvVr.js.map → extensions-CkLT--Nc.js.map} +1 -1
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +2 -2
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +67 -23
- package/dist/locales.js.map +1 -1
- package/dist/{src-ChTwrMcE.cjs → src-DsJ6yzs9.cjs} +5 -5
- package/dist/src-DsJ6yzs9.cjs.map +1 -0
- package/dist/{src-DQfz4zLM.js → src-SVFpMAWE.js} +380 -376
- package/dist/src-SVFpMAWE.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/dist/yjs.cjs +1 -1
- package/dist/yjs.js +1 -1
- package/package.json +1 -1
- package/src/api/clipboard/toClipboard/copyExtension.ts +21 -16
- package/src/blocks/Table/TableExtension.ts +38 -9
- package/src/blocks/defaultBlocks.ts +34 -1
- package/src/comments/extension.ts +30 -11
- package/src/editor/Block.css +14 -18
- package/src/editor/managers/ExtensionManager/extensions.ts +8 -9
- package/src/extensions/SideMenu/SideMenu.ts +2 -2
- package/src/extensions/TableHandles/TableHandles.ts +2 -0
- package/src/extensions/tiptap-extensions/Link/index.ts +1 -1
- package/src/extensions/tiptap-extensions/Link/link.ts +49 -18
- package/src/i18n/locales/ar.ts +3 -1
- package/src/i18n/locales/de.ts +3 -1
- package/src/i18n/locales/en.ts +3 -1
- package/src/i18n/locales/es.ts +3 -1
- package/src/i18n/locales/fa.ts +3 -1
- package/src/i18n/locales/fr.ts +3 -1
- package/src/i18n/locales/he.ts +3 -1
- package/src/i18n/locales/hr.ts +3 -1
- package/src/i18n/locales/is.ts +3 -1
- package/src/i18n/locales/it.ts +3 -1
- package/src/i18n/locales/ja.ts +3 -1
- package/src/i18n/locales/ko.ts +3 -1
- package/src/i18n/locales/nl.ts +3 -1
- package/src/i18n/locales/no.ts +3 -1
- package/src/i18n/locales/pl.ts +3 -1
- package/src/i18n/locales/pt.ts +3 -1
- package/src/i18n/locales/ru.ts +3 -1
- package/src/i18n/locales/sk.ts +3 -1
- package/src/i18n/locales/uk.ts +3 -1
- package/src/i18n/locales/uz.ts +3 -1
- package/src/i18n/locales/vi.ts +3 -1
- package/src/i18n/locales/zh-tw.ts +3 -1
- package/src/i18n/locales/zh.ts +3 -1
- package/types/src/comments/extension.d.ts +2 -1
- package/types/src/extensions/tiptap-extensions/Link/index.d.ts +1 -1
- package/types/src/extensions/tiptap-extensions/Link/link.d.ts +12 -0
- package/types/src/i18n/locales/en.d.ts +2 -0
- package/types/src/i18n/locales/fa.d.ts +2 -0
- package/types/src/i18n/locales/sk.d.ts +2 -0
- package/dist/en-C4ykW581.cjs.map +0 -1
- package/dist/en-QsSI16s5.js.map +0 -1
- package/dist/src-ChTwrMcE.cjs.map +0 -1
- package/dist/src-DQfz4zLM.js.map +0 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { An as e, At as t, Ct as n, En as r, Et as i, Ht as a, Jn as o, Ln as s, Ot as c, Qt as l, Rn as u, Tt as d, V as f, Xt as p, Zt as m, an as h, cn as ee, dn as g, f as te, gn as _, gt as ne, hn as v, in as y, kt as b, mn as x, nn as re, on as ie, pn as
|
|
2
|
-
import { C as
|
|
3
|
-
import { r as
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import { DOMParser as
|
|
8
|
-
import { ReplaceAroundStep as
|
|
9
|
-
import { Editor as
|
|
10
|
-
import { NodeSelection as
|
|
11
|
-
import { Fragment as
|
|
12
|
-
import { CellSelection as
|
|
13
|
-
import { Plugin as
|
|
14
|
-
import
|
|
15
|
-
import { unified as
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { InputRule as
|
|
20
|
-
import { keymap as
|
|
21
|
-
import { Gapcursor as
|
|
22
|
-
import { Text as
|
|
1
|
+
import { An as e, At as t, Ct as n, En as r, Et as i, Ht as a, Jn as o, Ln as s, Ot as c, Qt as l, Rn as u, Tt as d, V as f, Xt as p, Zt as m, an as h, cn as ee, dn as g, f as te, gn as _, gt as ne, hn as v, in as y, kt as b, mn as x, nn as re, on as ie, pn as S, pt as ae, rn as oe, t as se, tn as ce, vn as C, vt as le, wt as ue } from "./blocks-UU7EM-QM.js";
|
|
2
|
+
import { C as de, D as fe, E as pe, O as me, S as he, T as ge, _ as _e, d as ve, f as ye, k as be, l as xe, m as Se, n as Ce, o as we, p as Te, t as Ee, u as De, v as Oe, w as ke, x as Ae, y as w } from "./extensions-CkLT--Nc.js";
|
|
3
|
+
import { r as je, t as Me } from "./BlockNoteExtension-B6RhuQ3V.js";
|
|
4
|
+
import { t as Ne } from "./ShowSelection-BsHFfdMi.js";
|
|
5
|
+
import { t as Pe } from "./en-B9hMApn4.js";
|
|
6
|
+
import { t as Fe } from "./EventEmitter-CuPnGDYt.js";
|
|
7
|
+
import { DOMParser as Ie, DOMSerializer as Le, Fragment as T, Node as Re, NodeRange as ze, Slice as E } from "prosemirror-model";
|
|
8
|
+
import { ReplaceAroundStep as D, ReplaceStep as Be, canJoin as Ve, liftTarget as He } from "prosemirror-transform";
|
|
9
|
+
import { Editor as Ue, Extension as O, Mark as k, Node as A, combineTransactionSteps as We, createDocument as Ge, extensions as j, findChildrenInRange as Ke, findParentNodeClosestToPos as qe, getAttributes as Je, getChangedRanges as Ye, getMarkRange as Xe, getMarksBetween as Ze, getSchema as Qe, isNodeSelection as $e, markPasteRule as et, mergeAttributes as M, posToDOMRect as tt, selectionToInsertionEnd as nt } from "@tiptap/core";
|
|
10
|
+
import { NodeSelection as N, Plugin as P, TextSelection as F } from "prosemirror-state";
|
|
11
|
+
import { Fragment as I, Slice as L } from "@tiptap/pm/model";
|
|
12
|
+
import { CellSelection as R, TableMap as rt } from "prosemirror-tables";
|
|
13
|
+
import { Plugin as z, PluginKey as B } from "@tiptap/pm/state";
|
|
14
|
+
import it from "remark-gfm";
|
|
15
|
+
import { unified as at } from "unified";
|
|
16
|
+
import ot from "remark-parse";
|
|
17
|
+
import st, { defaultHandlers as ct } from "remark-rehype";
|
|
18
|
+
import lt from "rehype-stringify";
|
|
19
|
+
import { InputRule as ut, inputRules as dt } from "@handlewithcare/prosemirror-inputrules";
|
|
20
|
+
import { keymap as ft } from "@tiptap/pm/keymap";
|
|
21
|
+
import { Gapcursor as pt } from "@tiptap/extensions/gap-cursor";
|
|
22
|
+
import { Text as mt } from "@tiptap/extension-text";
|
|
23
23
|
//#region src/schema/inlineContent/createSpec.ts
|
|
24
|
-
function
|
|
24
|
+
function ht(e, t) {
|
|
25
25
|
let n = [{
|
|
26
26
|
tag: `[data-inline-content-type="${e.type}"]`,
|
|
27
27
|
contentElement: (e) => {
|
|
@@ -38,8 +38,8 @@ function vt(e, t) {
|
|
|
38
38
|
}
|
|
39
39
|
}), n;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
return l(
|
|
41
|
+
function gt(e, t) {
|
|
42
|
+
return l(A.create({
|
|
43
43
|
name: e.type,
|
|
44
44
|
inline: !0,
|
|
45
45
|
group: "inline",
|
|
@@ -54,7 +54,7 @@ function yt(e, t) {
|
|
|
54
54
|
return m(e);
|
|
55
55
|
},
|
|
56
56
|
parseHTML() {
|
|
57
|
-
return
|
|
57
|
+
return ht(e, t.parse);
|
|
58
58
|
},
|
|
59
59
|
renderHTML({ node: n }) {
|
|
60
60
|
let r = this.options.editor;
|
|
@@ -85,15 +85,15 @@ function yt(e, t) {
|
|
|
85
85
|
}
|
|
86
86
|
//#endregion
|
|
87
87
|
//#region src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts
|
|
88
|
-
function
|
|
88
|
+
function _t(e, t, n, r = "before") {
|
|
89
89
|
let a = typeof n == "string" ? n : n.id, o = g(e), s = t.map((e) => c(e, o)), l = i(a, e.doc);
|
|
90
90
|
if (!l) throw Error(`Block with ID ${a} not found`);
|
|
91
91
|
let u = l.posBeforeNode;
|
|
92
|
-
return r === "after" && (u += l.node.nodeSize), e.step(new
|
|
92
|
+
return r === "after" && (u += l.node.nodeSize), e.step(new Be(u, u, new E(T.from(s), 0, 0))), s.map((e) => y(e, o));
|
|
93
93
|
}
|
|
94
94
|
//#endregion
|
|
95
95
|
//#region src/api/blockManipulation/commands/replaceBlocks/util/fixColumnList.ts
|
|
96
|
-
function
|
|
96
|
+
function V(e) {
|
|
97
97
|
if (!e || e.type.name !== "column") throw Error("Invalid columnPos: does not point to column node.");
|
|
98
98
|
let t = e.firstChild;
|
|
99
99
|
if (!t) throw Error("Invalid column: does not have child node.");
|
|
@@ -101,40 +101,40 @@ function R(e) {
|
|
|
101
101
|
if (!n) throw Error("Invalid blockContainer: does not have child node.");
|
|
102
102
|
return e.childCount === 1 && t.childCount === 1 && n.type.name === "paragraph" && n.content.content.length === 0;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function vt(e, t) {
|
|
105
105
|
let n = e.doc.resolve(t), r = n.nodeAfter;
|
|
106
106
|
if (!r || r.type.name !== "columnList") throw Error("Invalid columnListPos: does not point to columnList node.");
|
|
107
107
|
for (let t = r.childCount - 1; t >= 0; t--) {
|
|
108
108
|
let r = e.doc.resolve(n.pos + 1).posAtIndex(t), i = e.doc.resolve(r).nodeAfter;
|
|
109
109
|
if (!i || i.type.name !== "column") throw Error("Invalid columnPos: does not point to column node.");
|
|
110
|
-
|
|
110
|
+
V(i) && e.delete(r, r + i.nodeSize);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
|
|
113
|
+
function H(e, t) {
|
|
114
|
+
vt(e, t);
|
|
115
115
|
let n = e.doc.resolve(t).nodeAfter;
|
|
116
116
|
if (!n || n.type.name !== "columnList") throw Error("Invalid columnListPos: does not point to columnList node.");
|
|
117
117
|
if (n.childCount > 2) return;
|
|
118
118
|
if (n.childCount < 2) throw Error("Invalid columnList: contains fewer than two children.");
|
|
119
119
|
let r = t + 1, i = e.doc.resolve(r).nodeAfter, a = t + n.nodeSize - 1, o = e.doc.resolve(a).nodeBefore;
|
|
120
120
|
if (!i || !o) throw Error("Invalid columnList: does not contain children.");
|
|
121
|
-
let s =
|
|
121
|
+
let s = V(i), c = V(o);
|
|
122
122
|
if (s && c) {
|
|
123
123
|
e.delete(t, t + n.nodeSize);
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
126
|
if (s) {
|
|
127
|
-
e.step(new
|
|
127
|
+
e.step(new D(t, t + n.nodeSize, a - o.nodeSize + 1, a - 1, E.empty, 0, !1));
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
130
|
if (c) {
|
|
131
|
-
e.step(new
|
|
131
|
+
e.step(new D(t, t + n.nodeSize, r + 1, r + i.nodeSize - 1, E.empty, 0, !1));
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts
|
|
137
|
-
function
|
|
137
|
+
function U(e, t, n) {
|
|
138
138
|
let r = g(e), i = n.map((e) => c(e, r)), a = new Set(t.map((e) => typeof e == "string" ? e : e.id)), o = [], s = /* @__PURE__ */ new Set(), l = typeof t[0] == "string" ? t[0] : t[0].id, u = 0;
|
|
139
139
|
if (e.doc.descendants((t, c) => {
|
|
140
140
|
if (a.size === 0) return !1;
|
|
@@ -153,14 +153,14 @@ function B(e, t, n) {
|
|
|
153
153
|
let e = [...a].join("\n");
|
|
154
154
|
throw Error("Blocks with the following IDs could not be found in the editor: " + e);
|
|
155
155
|
}
|
|
156
|
-
return s.forEach((t) =>
|
|
156
|
+
return s.forEach((t) => H(e, t)), {
|
|
157
157
|
insertedBlocks: i.map((e) => y(e, r)),
|
|
158
158
|
removedBlocks: o
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
//#endregion
|
|
162
162
|
//#region src/api/exporters/html/util/serializeBlocksInternalHTML.ts
|
|
163
|
-
function
|
|
163
|
+
function yt(e, n, r, i, a) {
|
|
164
164
|
let o;
|
|
165
165
|
if (!n) throw Error("blockContent is required");
|
|
166
166
|
if (typeof n == "string") o = b([n], e.pmSchema, i);
|
|
@@ -189,17 +189,17 @@ function St(e, n, r, i, a) {
|
|
|
189
189
|
let t = e.schema.styleSpecs[r.type.name].implementation.render(r.attrs.stringValue, e);
|
|
190
190
|
t.contentDOM.appendChild(n), n = t.dom;
|
|
191
191
|
} else {
|
|
192
|
-
let e = r.type.spec.toDOM(r, !0), t =
|
|
192
|
+
let e = r.type.spec.toDOM(r, !0), t = Le.renderSpec(document, e);
|
|
193
193
|
t.contentDOM.appendChild(n), n = t.dom;
|
|
194
194
|
}
|
|
195
195
|
s.appendChild(n);
|
|
196
196
|
} else {
|
|
197
|
-
let e = r.serializeFragment(
|
|
197
|
+
let e = r.serializeFragment(T.from([t]), a);
|
|
198
198
|
s.appendChild(e);
|
|
199
199
|
}
|
|
200
200
|
return s;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function bt(e, t, n, r) {
|
|
203
203
|
let i = e.pmSchema.nodes.blockContainer, a = t.props || {};
|
|
204
204
|
for (let [n, r] of Object.entries(e.schema.blockSchema[t.type].propSchema)) !(n in a) && r.default !== void 0 && (a[n] = r.default);
|
|
205
205
|
let o = t.children || [], s = e.blockImplementations[t.type].implementation.render.call({
|
|
@@ -211,12 +211,12 @@ function Ct(e, t, n, r) {
|
|
|
211
211
|
children: o
|
|
212
212
|
}, e);
|
|
213
213
|
if (s.contentDOM && t.content) {
|
|
214
|
-
let i =
|
|
214
|
+
let i = yt(e, t.content, n, t.type, r);
|
|
215
215
|
s.contentDOM.appendChild(i);
|
|
216
216
|
}
|
|
217
217
|
if (e.pmSchema.nodes[t.type].isInGroup("bnBlock")) {
|
|
218
218
|
if (t.children && t.children.length > 0) {
|
|
219
|
-
let i =
|
|
219
|
+
let i = xt(e, t.children, n, r);
|
|
220
220
|
s.contentDOM?.append(i);
|
|
221
221
|
}
|
|
222
222
|
return s.dom;
|
|
@@ -225,72 +225,72 @@ function Ct(e, t, n, r) {
|
|
|
225
225
|
id: t.id,
|
|
226
226
|
...a
|
|
227
227
|
}));
|
|
228
|
-
return c.contentDOM?.appendChild(s.dom), t.children && t.children.length > 0 && c.contentDOM?.appendChild(
|
|
228
|
+
return c.contentDOM?.appendChild(s.dom), t.children && t.children.length > 0 && c.contentDOM?.appendChild(St(e, t.children, n, r)), c.dom;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function xt(e, t, n, r) {
|
|
231
231
|
let i = (r?.document ?? document).createDocumentFragment();
|
|
232
232
|
for (let a of t) {
|
|
233
|
-
let t =
|
|
233
|
+
let t = bt(e, a, n, r);
|
|
234
234
|
i.appendChild(t);
|
|
235
235
|
}
|
|
236
236
|
return i;
|
|
237
237
|
}
|
|
238
|
-
var
|
|
239
|
-
let i = e.pmSchema.nodes.blockGroup, a = i.spec.toDOM(i.create({})), o =
|
|
238
|
+
var St = (e, t, n, r) => {
|
|
239
|
+
let i = e.pmSchema.nodes.blockGroup, a = i.spec.toDOM(i.create({})), o = xt(e, t, n, r);
|
|
240
240
|
return a.contentDOM?.appendChild(o), a.dom;
|
|
241
|
-
},
|
|
241
|
+
}, Ct = (e) => (e.querySelectorAll("[data-content-type=\"numberedListItem\"]").forEach((e) => {
|
|
242
242
|
let t = e.closest(".bn-block-outer")?.previousElementSibling?.querySelector("[data-content-type=\"numberedListItem\"]");
|
|
243
243
|
if (!t) e.setAttribute("data-index", e.getAttribute("data-start") || "1");
|
|
244
244
|
else {
|
|
245
245
|
let n = t.getAttribute("data-index");
|
|
246
246
|
e.setAttribute("data-index", (parseInt(n || "0") + 1).toString());
|
|
247
247
|
}
|
|
248
|
-
}), e),
|
|
248
|
+
}), e), wt = (e) => (e.querySelectorAll("[data-content-type=\"checkListItem\"] input").forEach((e) => {
|
|
249
249
|
e.disabled = !0;
|
|
250
|
-
}), e),
|
|
250
|
+
}), e), Tt = (e) => (e.querySelectorAll(".bn-toggle-wrapper[data-show-children=\"false\"]").forEach((e) => {
|
|
251
251
|
e.setAttribute("data-show-children", "true");
|
|
252
|
-
}), e),
|
|
252
|
+
}), e), Et = (e) => (e.querySelectorAll("[data-content-type=\"table\"] table").forEach((e) => {
|
|
253
253
|
e.setAttribute("style", "--default-cell-min-width: 120px;"), e.setAttribute("data-show-children", "true");
|
|
254
|
-
}), e),
|
|
254
|
+
}), e), Dt = (e) => (e.querySelectorAll("[data-content-type=\"table\"] table").forEach((e) => {
|
|
255
255
|
let t = document.createElement("div");
|
|
256
256
|
t.className = "tableWrapper";
|
|
257
257
|
let n = document.createElement("div");
|
|
258
258
|
n.className = "tableWrapper-inner", t.appendChild(n), e.parentElement?.appendChild(t), t.appendChild(e);
|
|
259
|
-
}), e),
|
|
259
|
+
}), e), Ot = (e) => (e.querySelectorAll(".bn-inline-content:empty").forEach((e) => {
|
|
260
260
|
let t = document.createElement("span");
|
|
261
261
|
t.className = "ProseMirror-trailingBreak", t.setAttribute("style", "display: inline-block;"), e.appendChild(t);
|
|
262
|
-
}), e),
|
|
263
|
-
let n =
|
|
262
|
+
}), e), kt = (e, t) => {
|
|
263
|
+
let n = Le.fromSchema(e), r = [
|
|
264
|
+
Ct,
|
|
265
|
+
wt,
|
|
266
|
+
Tt,
|
|
264
267
|
Et,
|
|
265
268
|
Dt,
|
|
266
|
-
Ot
|
|
267
|
-
kt,
|
|
268
|
-
At,
|
|
269
|
-
jt
|
|
269
|
+
Ot
|
|
270
270
|
];
|
|
271
271
|
return { serializeBlocks: (e, i) => {
|
|
272
|
-
let a =
|
|
272
|
+
let a = St(t, e, n, i);
|
|
273
273
|
for (let e of r) a = e(a);
|
|
274
274
|
return a.outerHTML;
|
|
275
275
|
} };
|
|
276
276
|
};
|
|
277
277
|
//#endregion
|
|
278
278
|
//#region src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts
|
|
279
|
-
function
|
|
279
|
+
function At(e) {
|
|
280
280
|
return e.transact((e) => {
|
|
281
|
-
let t =
|
|
282
|
-
if (e.selection instanceof
|
|
281
|
+
let t = C(e.doc, e.selection.anchor);
|
|
282
|
+
if (e.selection instanceof R) return {
|
|
283
283
|
type: "cell",
|
|
284
284
|
anchorBlockId: t.node.attrs.id,
|
|
285
285
|
anchorCellOffset: e.selection.$anchorCell.pos - t.posBeforeNode,
|
|
286
286
|
headCellOffset: e.selection.$headCell.pos - t.posBeforeNode
|
|
287
287
|
};
|
|
288
|
-
if (e.selection instanceof
|
|
288
|
+
if (e.selection instanceof N) return {
|
|
289
289
|
type: "node",
|
|
290
290
|
anchorBlockId: t.node.attrs.id
|
|
291
291
|
};
|
|
292
292
|
{
|
|
293
|
-
let n =
|
|
293
|
+
let n = C(e.doc, e.selection.head);
|
|
294
294
|
return {
|
|
295
295
|
type: "text",
|
|
296
296
|
anchorBlockId: t.node.attrs.id,
|
|
@@ -301,105 +301,105 @@ function Nt(e) {
|
|
|
301
301
|
}
|
|
302
302
|
});
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function jt(e, t) {
|
|
305
305
|
let n = i(t.anchorBlockId, e.doc)?.posBeforeNode;
|
|
306
306
|
if (n === void 0) throw Error(`Could not find block with ID ${t.anchorBlockId} to update selection`);
|
|
307
307
|
let r;
|
|
308
|
-
if (t.type === "cell") r =
|
|
309
|
-
else if (t.type === "node") r =
|
|
308
|
+
if (t.type === "cell") r = R.create(e.doc, n + t.anchorCellOffset, n + t.headCellOffset);
|
|
309
|
+
else if (t.type === "node") r = N.create(e.doc, n + 1);
|
|
310
310
|
else {
|
|
311
311
|
let a = i(t.headBlockId, e.doc)?.posBeforeNode;
|
|
312
312
|
if (a === void 0) throw Error(`Could not find block with ID ${t.headBlockId} to update selection`);
|
|
313
|
-
r =
|
|
313
|
+
r = F.create(e.doc, n + t.anchorOffset, a + t.headOffset);
|
|
314
314
|
}
|
|
315
315
|
e.setSelection(r);
|
|
316
316
|
}
|
|
317
|
-
function
|
|
318
|
-
return e.map((e) => e.type === "columnList" ? e.children.map((e) =>
|
|
317
|
+
function W(e) {
|
|
318
|
+
return e.map((e) => e.type === "columnList" ? e.children.map((e) => W(e.children)).flat() : {
|
|
319
319
|
...e,
|
|
320
|
-
children:
|
|
320
|
+
children: W(e.children)
|
|
321
321
|
}).flat();
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function Mt(e, t, n) {
|
|
324
324
|
e.transact((r) => {
|
|
325
|
-
let i = e.getSelection()?.blocks || [e.getTextCursorPosition().block], a =
|
|
326
|
-
e.removeBlocks(i), e.insertBlocks(
|
|
325
|
+
let i = e.getSelection()?.blocks || [e.getTextCursorPosition().block], a = At(e);
|
|
326
|
+
e.removeBlocks(i), e.insertBlocks(W(i), t, n), jt(r, a);
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function Nt(e) {
|
|
330
330
|
return !e || e.type !== "columnList";
|
|
331
331
|
}
|
|
332
|
-
function
|
|
332
|
+
function Pt(e, t, n) {
|
|
333
333
|
let r, i;
|
|
334
334
|
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;
|
|
335
335
|
let a = e.getParentBlock(r);
|
|
336
|
-
return
|
|
336
|
+
return Nt(a) ? {
|
|
337
337
|
referenceBlock: r,
|
|
338
338
|
placement: i
|
|
339
|
-
} :
|
|
339
|
+
} : Pt(e, i === "after" ? r : e.getPrevBlock(r), a);
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function Ft(e, t, n) {
|
|
342
342
|
let r, i;
|
|
343
343
|
if (t ? t.children.length > 0 ? (r = t.children[0], i = "before") : (r = t, i = "after") : n && (r = n, i = "after"), !r || !i) return;
|
|
344
344
|
let a = e.getParentBlock(r);
|
|
345
|
-
return
|
|
345
|
+
return Nt(a) ? {
|
|
346
346
|
referenceBlock: r,
|
|
347
347
|
placement: i
|
|
348
|
-
} :
|
|
348
|
+
} : Ft(e, i === "before" ? r : e.getNextBlock(r), a);
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function It(e) {
|
|
351
351
|
e.transact(() => {
|
|
352
|
-
let t = e.getSelection()?.blocks[0] || e.getTextCursorPosition().block, n =
|
|
353
|
-
n &&
|
|
352
|
+
let t = e.getSelection()?.blocks[0] || e.getTextCursorPosition().block, n = Pt(e, e.getPrevBlock(t), e.getParentBlock(t));
|
|
353
|
+
n && Mt(e, n.referenceBlock, n.placement);
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function Lt(e) {
|
|
357
357
|
e.transact(() => {
|
|
358
|
-
let t = e.getSelection(), n = t?.blocks[t?.blocks.length - 1] || e.getTextCursorPosition().block, r =
|
|
359
|
-
r &&
|
|
358
|
+
let t = e.getSelection(), n = t?.blocks[t?.blocks.length - 1] || e.getTextCursorPosition().block, r = Ft(e, e.getNextBlock(n), e.getParentBlock(n));
|
|
359
|
+
r && Mt(e, r.referenceBlock, r.placement);
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
362
|
//#endregion
|
|
363
363
|
//#region src/api/blockManipulation/commands/nestBlock/nestBlock.ts
|
|
364
|
-
function
|
|
364
|
+
function Rt(e, t, n) {
|
|
365
365
|
let { $from: r, $to: i } = e.selection, a = r.blockRange(i, (e) => e.childCount > 0 && (e.type.name === "blockGroup" || e.type.name === "column"));
|
|
366
366
|
if (!a) return !1;
|
|
367
367
|
let o = a.startIndex;
|
|
368
368
|
if (o === 0) return !1;
|
|
369
369
|
let s = a.parent.child(o - 1);
|
|
370
370
|
if (s.type !== t) return !1;
|
|
371
|
-
let c = s.lastChild && s.lastChild.type === n, l =
|
|
372
|
-
return e.step(new
|
|
371
|
+
let c = s.lastChild && s.lastChild.type === n, l = T.from(c ? t.create() : null), u = new E(T.from(t.create(null, T.from(n.create(null, l)))), c ? 3 : 1, 0), d = a.start, f = a.end;
|
|
372
|
+
return e.step(new D(d - (c ? 3 : 1), f, d, f, u, 1, !0)).scrollIntoView(), !0;
|
|
373
373
|
}
|
|
374
|
-
function
|
|
375
|
-
return e.transact((t) =>
|
|
374
|
+
function zt(e) {
|
|
375
|
+
return e.transact((t) => Rt(t, e.pmSchema.nodes.blockContainer, e.pmSchema.nodes.blockGroup));
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function Bt(e, t, n, r) {
|
|
378
378
|
let i = r.end, a = r.$to.end(r.depth);
|
|
379
379
|
if (i < a) {
|
|
380
380
|
let o = r.parent.child(r.endIndex - 1), s = o.lastChild && o.lastChild.type === n;
|
|
381
|
-
e.step(new
|
|
381
|
+
e.step(new D(i - (s ? 2 : 1), a, i, a, new E(T.from(t.create(null, n.create())), s ? 2 : 1, 0), +!s, !0)), r = new ze(e.doc.resolve(r.$from.pos), e.doc.resolve(a), r.depth);
|
|
382
382
|
}
|
|
383
|
-
let o =
|
|
383
|
+
let o = He(r);
|
|
384
384
|
if (o == null) return !1;
|
|
385
385
|
e.lift(r, o);
|
|
386
386
|
let s = e.doc.resolve(e.mapping.map(i, -1) - 1);
|
|
387
|
-
return
|
|
387
|
+
return Ve(e.doc, s.pos) && s.nodeBefore.type === s.nodeAfter.type && e.join(s.pos), e.scrollIntoView(), !0;
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function G(e, t, n) {
|
|
390
390
|
let { $from: r, $to: i } = e.selection, a = r.blockRange(i, (e) => e.childCount > 0 && (e.type.name === "blockGroup" || e.type.name === "column"));
|
|
391
|
-
return a && r.node(a.depth - 1).type === t ?
|
|
391
|
+
return a && r.node(a.depth - 1).type === t ? Bt(e, t, n, a) : !1;
|
|
392
392
|
}
|
|
393
|
-
function
|
|
394
|
-
return e.transact((t) =>
|
|
393
|
+
function Vt(e) {
|
|
394
|
+
return e.transact((t) => G(t, e.pmSchema.nodes.blockContainer, e.pmSchema.nodes.blockGroup));
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function Ht(e) {
|
|
397
397
|
return e.transact((e) => {
|
|
398
398
|
let { bnBlock: t } = _(e);
|
|
399
399
|
return e.doc.resolve(t.beforePos).nodeBefore !== null;
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function Ut(e) {
|
|
403
403
|
return e.transact((e) => {
|
|
404
404
|
let { bnBlock: t } = _(e);
|
|
405
405
|
return e.doc.resolve(t.beforePos).depth > 1;
|
|
@@ -407,23 +407,23 @@ function Kt(e) {
|
|
|
407
407
|
}
|
|
408
408
|
//#endregion
|
|
409
409
|
//#region src/api/blockManipulation/getBlock/getBlock.ts
|
|
410
|
-
function
|
|
410
|
+
function Wt(e, t) {
|
|
411
411
|
let n = typeof t == "string" ? t : t.id, r = g(e), a = i(n, e);
|
|
412
412
|
if (a) return y(a.node, r);
|
|
413
413
|
}
|
|
414
|
-
function
|
|
414
|
+
function Gt(e, t) {
|
|
415
415
|
let n = i(typeof t == "string" ? t : t.id, e), r = g(e);
|
|
416
416
|
if (!n) return;
|
|
417
417
|
let a = e.resolve(n.posBeforeNode).nodeBefore;
|
|
418
418
|
if (a) return y(a, r);
|
|
419
419
|
}
|
|
420
|
-
function
|
|
420
|
+
function Kt(e, t) {
|
|
421
421
|
let n = i(typeof t == "string" ? t : t.id, e), r = g(e);
|
|
422
422
|
if (!n) return;
|
|
423
423
|
let a = e.resolve(n.posBeforeNode + n.node.nodeSize).nodeAfter;
|
|
424
424
|
if (a) return y(a, r);
|
|
425
425
|
}
|
|
426
|
-
function
|
|
426
|
+
function qt(e, t) {
|
|
427
427
|
let n = typeof t == "string" ? t : t.id, r = g(e), a = i(n, e);
|
|
428
428
|
if (!a) return;
|
|
429
429
|
let o = e.resolve(a.posBeforeNode), s = o.node(), c = o.node(-1), l = c.type.name === "doc" ? void 0 : s.type.name === "blockGroup" ? c : s;
|
|
@@ -431,24 +431,24 @@ function Xt(e, t) {
|
|
|
431
431
|
}
|
|
432
432
|
//#endregion
|
|
433
433
|
//#region src/editor/managers/BlockManager.ts
|
|
434
|
-
var
|
|
434
|
+
var Jt = class {
|
|
435
435
|
constructor(e) {
|
|
436
436
|
this.editor = e;
|
|
437
437
|
}
|
|
438
438
|
get document() {
|
|
439
|
-
return this.editor.transact((e) =>
|
|
439
|
+
return this.editor.transact((e) => oe(e.doc, this.editor.pmSchema));
|
|
440
440
|
}
|
|
441
441
|
getBlock(e) {
|
|
442
|
-
return this.editor.transact((t) =>
|
|
442
|
+
return this.editor.transact((t) => Wt(t.doc, e));
|
|
443
443
|
}
|
|
444
444
|
getPrevBlock(e) {
|
|
445
|
-
return this.editor.transact((t) =>
|
|
445
|
+
return this.editor.transact((t) => Gt(t.doc, e));
|
|
446
446
|
}
|
|
447
447
|
getNextBlock(e) {
|
|
448
|
-
return this.editor.transact((t) =>
|
|
448
|
+
return this.editor.transact((t) => Kt(t.doc, e));
|
|
449
449
|
}
|
|
450
450
|
getParentBlock(e) {
|
|
451
|
-
return this.editor.transact((t) =>
|
|
451
|
+
return this.editor.transact((t) => qt(t.doc, e));
|
|
452
452
|
}
|
|
453
453
|
forEachBlock(e, t = !1) {
|
|
454
454
|
let n = this.document.slice();
|
|
@@ -460,36 +460,36 @@ var Zt = class {
|
|
|
460
460
|
r(n);
|
|
461
461
|
}
|
|
462
462
|
insertBlocks(e, t, n = "before") {
|
|
463
|
-
return this.editor.transact((r) =>
|
|
463
|
+
return this.editor.transact((r) => _t(r, e, t, n));
|
|
464
464
|
}
|
|
465
465
|
updateBlock(e, t) {
|
|
466
466
|
return this.editor.transact((r) => n(r, e, t));
|
|
467
467
|
}
|
|
468
468
|
removeBlocks(e) {
|
|
469
|
-
return this.editor.transact((t) =>
|
|
469
|
+
return this.editor.transact((t) => U(t, e, []).removedBlocks);
|
|
470
470
|
}
|
|
471
471
|
replaceBlocks(e, t) {
|
|
472
|
-
return this.editor.transact((n) =>
|
|
472
|
+
return this.editor.transact((n) => U(n, e, t));
|
|
473
473
|
}
|
|
474
474
|
canNestBlock() {
|
|
475
|
-
return
|
|
475
|
+
return Ht(this.editor);
|
|
476
476
|
}
|
|
477
477
|
nestBlock() {
|
|
478
|
-
|
|
478
|
+
zt(this.editor);
|
|
479
479
|
}
|
|
480
480
|
canUnnestBlock() {
|
|
481
|
-
return
|
|
481
|
+
return Ut(this.editor);
|
|
482
482
|
}
|
|
483
483
|
unnestBlock() {
|
|
484
|
-
|
|
484
|
+
Vt(this.editor);
|
|
485
485
|
}
|
|
486
486
|
moveBlocksUp() {
|
|
487
|
-
return
|
|
487
|
+
return It(this.editor);
|
|
488
488
|
}
|
|
489
489
|
moveBlocksDown() {
|
|
490
|
-
return
|
|
490
|
+
return Lt(this.editor);
|
|
491
491
|
}
|
|
492
|
-
},
|
|
492
|
+
}, Yt = class extends Fe {
|
|
493
493
|
constructor(e) {
|
|
494
494
|
super(), this.editor = e, e.on("create", () => {
|
|
495
495
|
e._tiptapEditor.on("update", ({ transaction: t, appendedTransactions: n }) => {
|
|
@@ -512,8 +512,8 @@ var Zt = class {
|
|
|
512
512
|
}
|
|
513
513
|
onChange(e, t = !0) {
|
|
514
514
|
let n = ({ transaction: n, appendedTransactions: r }) => {
|
|
515
|
-
!t &&
|
|
516
|
-
return
|
|
515
|
+
!t && Xt(n) || e(this.editor, { getChanges() {
|
|
516
|
+
return me(n, r);
|
|
517
517
|
} });
|
|
518
518
|
};
|
|
519
519
|
return this.on("onChange", n), () => {
|
|
@@ -522,7 +522,7 @@ var Zt = class {
|
|
|
522
522
|
}
|
|
523
523
|
onSelectionChange(e, t = !1) {
|
|
524
524
|
let n = (n) => {
|
|
525
|
-
!t &&
|
|
525
|
+
!t && Xt(n.transaction) || e(this.editor);
|
|
526
526
|
};
|
|
527
527
|
return this.on("onSelectionChange", n), () => {
|
|
528
528
|
this.off("onSelectionChange", n);
|
|
@@ -539,30 +539,30 @@ var Zt = class {
|
|
|
539
539
|
};
|
|
540
540
|
}
|
|
541
541
|
};
|
|
542
|
-
function
|
|
542
|
+
function Xt(e) {
|
|
543
543
|
return !!e.getMeta("y-sync$");
|
|
544
544
|
}
|
|
545
545
|
//#endregion
|
|
546
546
|
//#region src/api/parsers/html/util/nestedLists.ts
|
|
547
|
-
function
|
|
547
|
+
function Zt(e) {
|
|
548
548
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
549
549
|
}
|
|
550
|
-
function
|
|
550
|
+
function Qt(e) {
|
|
551
551
|
return e.nodeType === 3 && !/\S/.test(e.nodeValue || "");
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function $t(e) {
|
|
554
554
|
e.querySelectorAll("li > ul, li > ol").forEach((e) => {
|
|
555
|
-
let t =
|
|
555
|
+
let t = Zt(e), n = e.parentElement, r = Array.from(n.childNodes).slice(t + 1);
|
|
556
556
|
e.remove(), r.forEach((e) => {
|
|
557
557
|
e.remove();
|
|
558
558
|
}), n.insertAdjacentElement("afterend", e), r.reverse().forEach((t) => {
|
|
559
|
-
if (
|
|
559
|
+
if (Qt(t)) return;
|
|
560
560
|
let n = document.createElement("li");
|
|
561
561
|
n.append(t), e.insertAdjacentElement("afterend", n);
|
|
562
562
|
}), n.childNodes.length === 0 && n.remove();
|
|
563
563
|
});
|
|
564
564
|
}
|
|
565
|
-
function
|
|
565
|
+
function en(e) {
|
|
566
566
|
e.querySelectorAll("li + ul, li + ol").forEach((e) => {
|
|
567
567
|
let t = e.previousElementSibling, n = document.createElement("div");
|
|
568
568
|
t.insertAdjacentElement("afterend", n), n.append(t);
|
|
@@ -570,25 +570,25 @@ function rn(e) {
|
|
|
570
570
|
for (r.setAttribute("data-node-type", "blockGroup"), n.append(r); n.nextElementSibling?.nodeName === "UL" || n.nextElementSibling?.nodeName === "OL";) r.append(n.nextElementSibling);
|
|
571
571
|
});
|
|
572
572
|
}
|
|
573
|
-
var
|
|
574
|
-
function
|
|
575
|
-
return
|
|
573
|
+
var tn = null;
|
|
574
|
+
function nn() {
|
|
575
|
+
return tn ||= document.implementation.createHTMLDocument("title");
|
|
576
576
|
}
|
|
577
|
-
function
|
|
577
|
+
function rn(e) {
|
|
578
578
|
if (typeof e == "string") {
|
|
579
|
-
let t =
|
|
579
|
+
let t = nn().createElement("div");
|
|
580
580
|
t.innerHTML = e, e = t;
|
|
581
581
|
}
|
|
582
|
-
return
|
|
582
|
+
return $t(e), en(e), e;
|
|
583
583
|
}
|
|
584
584
|
//#endregion
|
|
585
585
|
//#region src/api/parsers/html/util/normalizeWhitespace.ts
|
|
586
|
-
function
|
|
586
|
+
function an(e) {
|
|
587
587
|
let t = e.ownerDocument.createTreeWalker(e, 128), n;
|
|
588
588
|
for (; n = t.nextNode();) if (/^\s*notionvc:/.test(n.nodeValue || "")) return !0;
|
|
589
589
|
return !1;
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function on(e) {
|
|
592
592
|
let t = new Set(["PRE", "CODE"]), n = e.ownerDocument.createTreeWalker(e, 4, { acceptNode(n) {
|
|
593
593
|
let r = n.parentElement;
|
|
594
594
|
for (; r && r !== e;) {
|
|
@@ -600,21 +600,21 @@ function ln(e) {
|
|
|
600
600
|
for (; i = n.nextNode();) r.push(i);
|
|
601
601
|
for (let e of r) e.nodeValue && /[\r\n]/.test(e.nodeValue) && (e.nodeValue = e.nodeValue.replace(/[ \t\r\n\f]+/g, " "));
|
|
602
602
|
}
|
|
603
|
-
function
|
|
604
|
-
|
|
603
|
+
function sn(e) {
|
|
604
|
+
an(e) || on(e);
|
|
605
605
|
}
|
|
606
606
|
//#endregion
|
|
607
607
|
//#region src/api/parsers/html/parseHTML.ts
|
|
608
|
-
function
|
|
609
|
-
let n =
|
|
610
|
-
|
|
611
|
-
let r =
|
|
608
|
+
function K(e, t) {
|
|
609
|
+
let n = rn(e);
|
|
610
|
+
sn(n);
|
|
611
|
+
let r = Ie.fromSchema(t).parse(n, { topNode: t.nodes.blockGroup.create() }), i = [];
|
|
612
612
|
for (let e = 0; e < r.childCount; e++) i.push(y(r.child(e), t));
|
|
613
613
|
return i;
|
|
614
614
|
}
|
|
615
615
|
//#endregion
|
|
616
616
|
//#region src/api/parsers/markdown/parseMarkdown.ts
|
|
617
|
-
function
|
|
617
|
+
function cn(e, t) {
|
|
618
618
|
let n = t.value ? t.value : "", r = {};
|
|
619
619
|
t.lang && (r["data-language"] = t.lang);
|
|
620
620
|
let i = {
|
|
@@ -633,7 +633,7 @@ function dn(e, t) {
|
|
|
633
633
|
children: [i]
|
|
634
634
|
}, e.patch(t, i), i;
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function ln(e, t) {
|
|
637
637
|
let n = String(t?.url || ""), r = {
|
|
638
638
|
type: "element",
|
|
639
639
|
tagName: "video",
|
|
@@ -647,11 +647,11 @@ function fn(e, t) {
|
|
|
647
647
|
};
|
|
648
648
|
return e.patch?.(t, r), r = e.applyData ? e.applyData(t, r) : r, r;
|
|
649
649
|
}
|
|
650
|
-
function
|
|
651
|
-
return
|
|
652
|
-
...
|
|
653
|
-
image: (t, n) => e(String(n?.url || "")) ?
|
|
654
|
-
code:
|
|
650
|
+
function q(t) {
|
|
651
|
+
return at().use(ot).use(it).use(st, { handlers: {
|
|
652
|
+
...ct,
|
|
653
|
+
image: (t, n) => e(String(n?.url || "")) ? ln(t, n) : ct.image(t, n),
|
|
654
|
+
code: cn,
|
|
655
655
|
blockquote: (e, t) => {
|
|
656
656
|
let n = {
|
|
657
657
|
type: "element",
|
|
@@ -661,31 +661,31 @@ function W(t) {
|
|
|
661
661
|
};
|
|
662
662
|
return e.patch(t, n), e.applyData(t, n);
|
|
663
663
|
}
|
|
664
|
-
} }).use(
|
|
664
|
+
} }).use(lt).processSync(t).value;
|
|
665
665
|
}
|
|
666
|
-
function
|
|
667
|
-
return
|
|
666
|
+
function un(e, t) {
|
|
667
|
+
return K(q(e), t);
|
|
668
668
|
}
|
|
669
669
|
//#endregion
|
|
670
670
|
//#region src/editor/managers/ExportManager.ts
|
|
671
|
-
var
|
|
671
|
+
var dn = class {
|
|
672
672
|
constructor(e) {
|
|
673
673
|
this.editor = e;
|
|
674
674
|
}
|
|
675
675
|
blocksToHTMLLossy(e = this.editor.document) {
|
|
676
|
-
return
|
|
676
|
+
return be(this.editor.pmSchema, this.editor).exportBlocks(e, {});
|
|
677
677
|
}
|
|
678
678
|
blocksToFullHTML(e = this.editor.document) {
|
|
679
|
-
return
|
|
679
|
+
return kt(this.editor.pmSchema, this.editor).serializeBlocks(e, {});
|
|
680
680
|
}
|
|
681
681
|
tryParseHTMLToBlocks(e) {
|
|
682
|
-
return
|
|
682
|
+
return K(e, this.editor.pmSchema);
|
|
683
683
|
}
|
|
684
684
|
blocksToMarkdownLossy(e = this.editor.document) {
|
|
685
|
-
return
|
|
685
|
+
return De(e, this.editor.pmSchema, this.editor, {});
|
|
686
686
|
}
|
|
687
687
|
tryParseMarkdownToBlocks(e) {
|
|
688
|
-
return
|
|
688
|
+
return un(e, this.editor.pmSchema);
|
|
689
689
|
}
|
|
690
690
|
pasteHTML(e, t = !1) {
|
|
691
691
|
let n = e;
|
|
@@ -699,13 +699,13 @@ var mn = class {
|
|
|
699
699
|
return this.editor.prosemirrorView?.pasteText(e);
|
|
700
700
|
}
|
|
701
701
|
pasteMarkdown(e) {
|
|
702
|
-
let t =
|
|
702
|
+
let t = q(e);
|
|
703
703
|
return this.pasteHTML(t);
|
|
704
704
|
}
|
|
705
|
-
},
|
|
705
|
+
}, fn = "aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2";
|
|
706
706
|
//#endregion
|
|
707
707
|
//#region src/extensions/tiptap-extensions/Link/helpers/linkDetector.ts
|
|
708
|
-
function
|
|
708
|
+
function pn(e) {
|
|
709
709
|
let t = [], n = [], r = 0;
|
|
710
710
|
for (; r < e.length;) {
|
|
711
711
|
let i = 0;
|
|
@@ -719,59 +719,59 @@ function gn(e) {
|
|
|
719
719
|
}
|
|
720
720
|
return t;
|
|
721
721
|
}
|
|
722
|
-
var
|
|
723
|
-
function
|
|
722
|
+
var mn = new Set(pn(fn)), hn = new Set(["localhost"]), gn = /[.,;:!?"']+$/, _n = /(?:https?|ftp|ftps):\/\/[^\s]+/g, vn = /mailto:[^\s]+/g, yn = /[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}/g, bn = /(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?::\d{1,5})?(?:[/?#][^\s]*)?/g;
|
|
723
|
+
function xn(e) {
|
|
724
724
|
let t = e, n = !0;
|
|
725
725
|
for (; n;) {
|
|
726
726
|
n = !1;
|
|
727
727
|
let e = t;
|
|
728
|
-
t = t.replace(
|
|
728
|
+
t = t.replace(gn, ""), t !== e && (n = !0);
|
|
729
729
|
for (let [e, r] of [["(", ")"], ["[", "]"]]) for (; t.endsWith(r);) {
|
|
730
|
-
let i =
|
|
731
|
-
if (
|
|
730
|
+
let i = Sn(t, e);
|
|
731
|
+
if (Sn(t, r) > i) t = t.slice(0, -1), n = !0;
|
|
732
732
|
else break;
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
735
|
return t;
|
|
736
736
|
}
|
|
737
|
-
function
|
|
737
|
+
function Sn(e, t) {
|
|
738
738
|
let n = 0;
|
|
739
739
|
for (let r = 0; r < e.length; r++) e[r] === t && n++;
|
|
740
740
|
return n;
|
|
741
741
|
}
|
|
742
|
-
function
|
|
742
|
+
function Cn(e) {
|
|
743
743
|
let t = e.split(".");
|
|
744
744
|
return t[t.length - 1].toLowerCase();
|
|
745
745
|
}
|
|
746
|
-
function
|
|
747
|
-
let t =
|
|
748
|
-
return
|
|
746
|
+
function wn(e) {
|
|
747
|
+
let t = Cn(e);
|
|
748
|
+
return mn.has(t);
|
|
749
749
|
}
|
|
750
|
-
function
|
|
750
|
+
function Tn(e, t, n) {
|
|
751
751
|
return t === "email" ? "mailto:" + e : /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(e) || /^mailto:/i.test(e) ? e : n + "://" + e;
|
|
752
752
|
}
|
|
753
|
-
function
|
|
753
|
+
function En(e, t) {
|
|
754
754
|
if (!e) return [];
|
|
755
755
|
let n = t?.defaultProtocol || "http", r = [];
|
|
756
|
-
for (let t of e.matchAll(
|
|
756
|
+
for (let t of e.matchAll(_n)) r.push({
|
|
757
757
|
type: "url",
|
|
758
758
|
value: t[0],
|
|
759
759
|
start: t.index,
|
|
760
760
|
end: t.index + t[0].length
|
|
761
761
|
});
|
|
762
|
-
for (let t of e.matchAll(
|
|
762
|
+
for (let t of e.matchAll(vn)) r.push({
|
|
763
763
|
type: "url",
|
|
764
764
|
value: t[0],
|
|
765
765
|
start: t.index,
|
|
766
766
|
end: t.index + t[0].length
|
|
767
767
|
});
|
|
768
|
-
for (let t of e.matchAll(
|
|
768
|
+
for (let t of e.matchAll(yn)) r.push({
|
|
769
769
|
type: "email",
|
|
770
770
|
value: t[0],
|
|
771
771
|
start: t.index,
|
|
772
772
|
end: t.index + t[0].length
|
|
773
773
|
});
|
|
774
|
-
for (let t of e.matchAll(
|
|
774
|
+
for (let t of e.matchAll(bn)) r.push({
|
|
775
775
|
type: "url",
|
|
776
776
|
value: t[0],
|
|
777
777
|
start: t.index,
|
|
@@ -782,18 +782,18 @@ function kn(e, t) {
|
|
|
782
782
|
for (let e of r) e.start >= a && (i.push(e), a = e.end);
|
|
783
783
|
let o = [];
|
|
784
784
|
for (let e of i) {
|
|
785
|
-
let t =
|
|
785
|
+
let t = xn(e.value);
|
|
786
786
|
if (!t) continue;
|
|
787
787
|
let r = e.start, i = r + t.length;
|
|
788
788
|
if (e.type === "url" && !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t)) {
|
|
789
789
|
let e = new URL("http://" + t).hostname;
|
|
790
|
-
if (!
|
|
790
|
+
if (!wn(e)) continue;
|
|
791
791
|
}
|
|
792
792
|
if (e.type === "email") {
|
|
793
793
|
let e = t.split("@")[1];
|
|
794
|
-
if (!
|
|
794
|
+
if (!wn(e)) continue;
|
|
795
795
|
}
|
|
796
|
-
let a =
|
|
796
|
+
let a = Tn(t, e.type, n);
|
|
797
797
|
o.push({
|
|
798
798
|
type: e.type,
|
|
799
799
|
value: t,
|
|
@@ -805,47 +805,47 @@ function kn(e, t) {
|
|
|
805
805
|
}
|
|
806
806
|
return o;
|
|
807
807
|
}
|
|
808
|
-
function
|
|
809
|
-
if (!e) return [
|
|
808
|
+
function Dn(e, t = "http") {
|
|
809
|
+
if (!e) return [X(e, 0, 0)];
|
|
810
810
|
for (let [n, r] of [
|
|
811
811
|
["(", ")"],
|
|
812
812
|
["[", "]"],
|
|
813
813
|
["{", "}"]
|
|
814
814
|
]) if (e.startsWith(n) && e.endsWith(r) && e.length > 2) {
|
|
815
815
|
let i = e.slice(1, -1);
|
|
816
|
-
if (
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
816
|
+
if (J(i)) return [
|
|
817
|
+
X(n, 0, 1),
|
|
818
|
+
Y(i, 1, 1 + i.length, t),
|
|
819
|
+
X(r, 1 + i.length, e.length)
|
|
820
820
|
];
|
|
821
821
|
}
|
|
822
822
|
if (e.endsWith(".") && e.length > 1) {
|
|
823
823
|
let n = e.slice(0, -1);
|
|
824
|
-
if (
|
|
824
|
+
if (J(n)) return [Y(n, 0, n.length, t), X(".", n.length, e.length)];
|
|
825
825
|
}
|
|
826
|
-
return
|
|
826
|
+
return J(e) ? [Y(e, 0, e.length, t)] : [X(e, 0, e.length)];
|
|
827
827
|
}
|
|
828
|
-
function
|
|
829
|
-
if (/^(?:https?|ftp|ftps):\/\/[^\s]+$/.test(e) || /^mailto:[^\s]+$/.test(e) ||
|
|
828
|
+
function J(e) {
|
|
829
|
+
if (/^(?:https?|ftp|ftps):\/\/[^\s]+$/.test(e) || /^mailto:[^\s]+$/.test(e) || hn.has(e.toLowerCase())) return !0;
|
|
830
830
|
let t = e.match(/^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+([a-zA-Z]{2,})(?::\d{1,5})?(?:[/?#][^\s]*)?$/);
|
|
831
831
|
if (t) {
|
|
832
832
|
let e = t[1].toLowerCase();
|
|
833
|
-
if (
|
|
833
|
+
if (mn.has(e)) return !0;
|
|
834
834
|
}
|
|
835
835
|
return !1;
|
|
836
836
|
}
|
|
837
|
-
function
|
|
837
|
+
function Y(e, t, n, r) {
|
|
838
838
|
let i = e.includes("@") && !e.includes("://") && !e.startsWith("mailto:") ? "email" : "url";
|
|
839
839
|
return {
|
|
840
840
|
type: i,
|
|
841
841
|
value: e,
|
|
842
842
|
isLink: !0,
|
|
843
|
-
href:
|
|
843
|
+
href: Tn(e, i, r),
|
|
844
844
|
start: t,
|
|
845
845
|
end: n
|
|
846
846
|
};
|
|
847
847
|
}
|
|
848
|
-
function
|
|
848
|
+
function X(e, t, n) {
|
|
849
849
|
return {
|
|
850
850
|
type: "text",
|
|
851
851
|
value: e,
|
|
@@ -857,40 +857,40 @@ function q(e, t, n) {
|
|
|
857
857
|
}
|
|
858
858
|
//#endregion
|
|
859
859
|
//#region src/extensions/tiptap-extensions/Link/helpers/whitespace.ts
|
|
860
|
-
var
|
|
860
|
+
var Z = "[\0- \xA0 -\u2029 ]", On = new RegExp(Z), kn = RegExp(`${Z}$`), An = new RegExp(Z, "g");
|
|
861
861
|
//#endregion
|
|
862
862
|
//#region src/extensions/tiptap-extensions/Link/helpers/autolink.ts
|
|
863
|
-
function
|
|
863
|
+
function jn(e) {
|
|
864
864
|
return e.length === 1 ? e[0].isLink : e.length === 3 && e[1].isLink ? ["()", "[]"].includes(e[0].value + e[2].value) : !1;
|
|
865
865
|
}
|
|
866
|
-
function
|
|
867
|
-
return new
|
|
868
|
-
key: new
|
|
866
|
+
function Mn(e) {
|
|
867
|
+
return new z({
|
|
868
|
+
key: new B("autolink"),
|
|
869
869
|
appendTransaction: (t, n, r) => {
|
|
870
870
|
let i = t.some((e) => e.docChanged) && !n.doc.eq(r.doc), a = t.some((e) => e.getMeta("preventAutolink"));
|
|
871
871
|
if (!i || a) return;
|
|
872
872
|
let { tr: o } = r;
|
|
873
|
-
if (
|
|
874
|
-
let n =
|
|
873
|
+
if (Ye(We(n.doc, [...t])).forEach(({ newRange: t }) => {
|
|
874
|
+
let n = Ke(r.doc, t, (e) => e.isTextblock), i, a;
|
|
875
875
|
if (n.length > 1) i = n[0], a = r.doc.textBetween(i.pos, i.pos + i.node.nodeSize, void 0, " ");
|
|
876
876
|
else if (n.length) {
|
|
877
877
|
let e = r.doc.textBetween(t.from, t.to, " ", " ");
|
|
878
|
-
if (!
|
|
878
|
+
if (!kn.test(e)) return;
|
|
879
879
|
i = n[0], a = r.doc.textBetween(i.pos, t.to, void 0, " ");
|
|
880
880
|
}
|
|
881
881
|
if (i && a) {
|
|
882
|
-
let t = a.split(
|
|
882
|
+
let t = a.split(On).filter(Boolean);
|
|
883
883
|
if (t.length <= 0) return;
|
|
884
884
|
let n = t[t.length - 1], s = i.pos + a.lastIndexOf(n);
|
|
885
885
|
if (!n) return;
|
|
886
|
-
let c =
|
|
887
|
-
if (!
|
|
886
|
+
let c = Dn(n, e.defaultProtocol);
|
|
887
|
+
if (!jn(c)) return;
|
|
888
888
|
c.filter((e) => e.isLink).map((e) => ({
|
|
889
889
|
...e,
|
|
890
890
|
from: s + e.start + 1,
|
|
891
891
|
to: s + e.end + 1
|
|
892
892
|
})).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) => {
|
|
893
|
-
|
|
893
|
+
Ze(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 }));
|
|
894
894
|
});
|
|
895
895
|
}
|
|
896
896
|
}), o.steps.length) return o;
|
|
@@ -899,9 +899,9 @@ function Fn(e) {
|
|
|
899
899
|
}
|
|
900
900
|
//#endregion
|
|
901
901
|
//#region src/extensions/tiptap-extensions/Link/helpers/clickHandler.ts
|
|
902
|
-
function
|
|
903
|
-
return new
|
|
904
|
-
key: new
|
|
902
|
+
function Nn(e) {
|
|
903
|
+
return new z({
|
|
904
|
+
key: new B("handleClickLink"),
|
|
905
905
|
props: { handleClick: (t, n, r) => {
|
|
906
906
|
if (r.button !== 0 || !t.editable) return !1;
|
|
907
907
|
let i = null;
|
|
@@ -917,16 +917,16 @@ function In(e) {
|
|
|
917
917
|
if (!e.editor) throw Error("BlockNoteEditor not found in Link click handler");
|
|
918
918
|
return e.onClick(r, e.editor) ?? !0;
|
|
919
919
|
}
|
|
920
|
-
let a =
|
|
920
|
+
let a = Je(t.state, e.type.name), o = i.href ?? a.href, s = i.target ?? a.target;
|
|
921
921
|
return o ? (window.open(o, s), !0) : !1;
|
|
922
922
|
} }
|
|
923
923
|
});
|
|
924
924
|
}
|
|
925
925
|
//#endregion
|
|
926
926
|
//#region src/extensions/tiptap-extensions/Link/helpers/pasteHandler.ts
|
|
927
|
-
function
|
|
928
|
-
return new
|
|
929
|
-
key: new
|
|
927
|
+
function Pn(e) {
|
|
928
|
+
return new z({
|
|
929
|
+
key: new B("handlePasteLink"),
|
|
930
930
|
props: { handlePaste: (t, n, r) => {
|
|
931
931
|
let { shouldAutoLink: i, isValidLink: a } = e, { state: o } = t, { selection: s } = o, { empty: c } = s;
|
|
932
932
|
if (c) return !1;
|
|
@@ -934,55 +934,50 @@ function Ln(e) {
|
|
|
934
934
|
r.content.forEach((e) => {
|
|
935
935
|
l += e.textContent;
|
|
936
936
|
});
|
|
937
|
-
let u =
|
|
937
|
+
let u = En(l, { defaultProtocol: e.defaultProtocol }).find((e) => e.isLink && e.value === l);
|
|
938
938
|
return !l || !u || !a(u.value) || i !== void 0 && !i(u.value) ? !1 : e.editor.commands.setMark(e.type, { href: u.href });
|
|
939
939
|
} }
|
|
940
940
|
});
|
|
941
941
|
}
|
|
942
942
|
//#endregion
|
|
943
943
|
//#region src/extensions/tiptap-extensions/Link/link.ts
|
|
944
|
-
var
|
|
945
|
-
|
|
946
|
-
rel: "noopener noreferrer nofollow",
|
|
947
|
-
className: "bn-inline-content-section",
|
|
948
|
-
"data-inline-content-type": "link"
|
|
949
|
-
}, Rn = /^(?:(?:http|https|ftp|ftps|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z0-9+.\-]+(?:[^a-z+.\-:]|$))/i;
|
|
950
|
-
function zn(e) {
|
|
944
|
+
var Fn = "https", In = /^(?:(?:http|https|ftp|ftps|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z0-9+.\-]+(?:[^a-z+.\-:]|$))/i;
|
|
945
|
+
function Ln(e) {
|
|
951
946
|
if (!e) return !0;
|
|
952
|
-
let t = e.replace(
|
|
953
|
-
return
|
|
947
|
+
let t = e.replace(An, "");
|
|
948
|
+
return In.test(t);
|
|
954
949
|
}
|
|
955
|
-
function
|
|
950
|
+
function Rn(e) {
|
|
956
951
|
let t = /^[a-z][a-z0-9+.-]*:\/\//i.test(e), n = /^[a-z][a-z0-9+.-]*:/i.test(e);
|
|
957
952
|
if (t || n && !e.includes("@")) return !0;
|
|
958
953
|
let r = (e.includes("@") ? e.split("@").pop() : e).split(/[/?#:]/)[0];
|
|
959
954
|
return !(/^\d{1,3}(\.\d{1,3}){3}$/.test(r) || !/\./.test(r));
|
|
960
955
|
}
|
|
961
|
-
var
|
|
956
|
+
var zn = k.create({
|
|
962
957
|
name: "link",
|
|
963
|
-
priority: 1e3,
|
|
964
958
|
keepOnSplit: !1,
|
|
965
959
|
exitable: !0,
|
|
966
960
|
inclusive: !1,
|
|
967
961
|
addOptions() {
|
|
968
962
|
return {
|
|
969
|
-
HTMLAttributes: {
|
|
963
|
+
HTMLAttributes: {
|
|
964
|
+
target: "_blank",
|
|
965
|
+
rel: "noopener noreferrer nofollow",
|
|
966
|
+
className: "bn-inline-content-section",
|
|
967
|
+
"data-inline-content-type": "link"
|
|
968
|
+
},
|
|
970
969
|
editor: void 0,
|
|
971
970
|
onClick: void 0,
|
|
972
|
-
isValidLink:
|
|
971
|
+
isValidLink: Ln
|
|
973
972
|
};
|
|
974
973
|
},
|
|
975
974
|
addAttributes() {
|
|
976
|
-
return {
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
},
|
|
983
|
-
target: { default: X.target },
|
|
984
|
-
rel: { default: X.rel }
|
|
985
|
-
};
|
|
975
|
+
return { href: {
|
|
976
|
+
default: null,
|
|
977
|
+
parseHTML(e) {
|
|
978
|
+
return e.getAttribute("href");
|
|
979
|
+
}
|
|
980
|
+
} };
|
|
986
981
|
},
|
|
987
982
|
parseHTML() {
|
|
988
983
|
let e = this.options.isValidLink;
|
|
@@ -997,25 +992,25 @@ var Bn = O.create({
|
|
|
997
992
|
renderHTML({ HTMLAttributes: e }) {
|
|
998
993
|
return this.options.isValidLink(e.href) ? [
|
|
999
994
|
"a",
|
|
1000
|
-
|
|
995
|
+
M(e, this.options.HTMLAttributes),
|
|
1001
996
|
0
|
|
1002
997
|
] : [
|
|
1003
998
|
"a",
|
|
1004
|
-
|
|
999
|
+
M({
|
|
1005
1000
|
...e,
|
|
1006
1001
|
href: ""
|
|
1007
|
-
}),
|
|
1002
|
+
}, this.options.HTMLAttributes),
|
|
1008
1003
|
0
|
|
1009
1004
|
];
|
|
1010
1005
|
},
|
|
1011
1006
|
addPasteRules() {
|
|
1012
1007
|
let e = this.options.isValidLink;
|
|
1013
|
-
return [
|
|
1008
|
+
return [et({
|
|
1014
1009
|
find: (t) => {
|
|
1015
1010
|
let n = [];
|
|
1016
1011
|
if (t) {
|
|
1017
|
-
let r =
|
|
1018
|
-
for (let e of r)
|
|
1012
|
+
let r = En(t, { defaultProtocol: Fn }).filter((t) => t.isLink && e(t.value));
|
|
1013
|
+
for (let e of r) Rn(e.value) && n.push({
|
|
1019
1014
|
text: e.value,
|
|
1020
1015
|
data: { href: e.href },
|
|
1021
1016
|
index: e.start
|
|
@@ -1029,25 +1024,33 @@ var Bn = O.create({
|
|
|
1029
1024
|
},
|
|
1030
1025
|
addProseMirrorPlugins() {
|
|
1031
1026
|
let e = [];
|
|
1032
|
-
return e.push(
|
|
1027
|
+
return e.push(Mn({
|
|
1033
1028
|
type: this.type,
|
|
1034
|
-
defaultProtocol:
|
|
1029
|
+
defaultProtocol: Fn,
|
|
1035
1030
|
validate: this.options.isValidLink,
|
|
1036
|
-
shouldAutoLink:
|
|
1037
|
-
})), e.push(
|
|
1031
|
+
shouldAutoLink: Rn
|
|
1032
|
+
})), e.push(Nn({
|
|
1038
1033
|
type: this.type,
|
|
1039
1034
|
tiptapEditor: this.editor,
|
|
1040
1035
|
editor: this.options.editor,
|
|
1041
1036
|
onClick: this.options.onClick
|
|
1042
|
-
})), e.push(
|
|
1037
|
+
})), e.push(Pn({
|
|
1043
1038
|
editor: this.editor,
|
|
1044
|
-
defaultProtocol:
|
|
1039
|
+
defaultProtocol: Fn,
|
|
1045
1040
|
type: this.type,
|
|
1046
|
-
shouldAutoLink:
|
|
1041
|
+
shouldAutoLink: Rn,
|
|
1047
1042
|
isValidLink: this.options.isValidLink
|
|
1048
1043
|
})), e;
|
|
1049
1044
|
}
|
|
1050
|
-
}),
|
|
1045
|
+
}), Bn = Me(({ editor: e, options: t }) => ({
|
|
1046
|
+
key: "link",
|
|
1047
|
+
tiptapExtensions: [zn.configure({
|
|
1048
|
+
HTMLAttributes: t.HTMLAttributes ?? {},
|
|
1049
|
+
editor: e,
|
|
1050
|
+
onClick: t.onClick,
|
|
1051
|
+
...t.isValidLink ? { isValidLink: t.isValidLink } : {}
|
|
1052
|
+
})]
|
|
1053
|
+
})), Vn = [
|
|
1051
1054
|
"vscode-editor-data",
|
|
1052
1055
|
"blocknote/html",
|
|
1053
1056
|
"text/markdown",
|
|
@@ -1112,7 +1115,7 @@ async function Gn(e, t) {
|
|
|
1112
1115
|
}, a = t.prosemirrorView.posAtCoords(r);
|
|
1113
1116
|
if (!a) return;
|
|
1114
1117
|
i = t.transact((e) => {
|
|
1115
|
-
let i =
|
|
1118
|
+
let i = C(e.doc, a.pos), o = (t.domElement?.querySelector(`[data-id="${i.node.attrs.id}"]`))?.getBoundingClientRect();
|
|
1116
1119
|
return Wn(t, t.getBlock(i.node.attrs.id), n, o && (o.top + o.bottom) / 2 > r.top ? "before" : "after");
|
|
1117
1120
|
});
|
|
1118
1121
|
} else return;
|
|
@@ -1124,10 +1127,10 @@ async function Gn(e, t) {
|
|
|
1124
1127
|
}
|
|
1125
1128
|
//#endregion
|
|
1126
1129
|
//#region src/api/clipboard/fromClipboard/fileDropExtension.ts
|
|
1127
|
-
var Kn = (e) =>
|
|
1130
|
+
var Kn = (e) => O.create({
|
|
1128
1131
|
name: "dropFile",
|
|
1129
1132
|
addProseMirrorPlugins() {
|
|
1130
|
-
return [new
|
|
1133
|
+
return [new P({ props: { handleDOMEvents: { drop(t, n) {
|
|
1131
1134
|
if (!e.isEditable) return;
|
|
1132
1135
|
let r = null;
|
|
1133
1136
|
for (let e of Vn) if (n.dataTransfer.types.includes(e)) {
|
|
@@ -1173,10 +1176,10 @@ function cr({ event: e, editor: t, prioritizeMarkdownOverHTML: n, plainTextAsMar
|
|
|
1173
1176
|
}
|
|
1174
1177
|
return i === "text/html" ? (t.pasteHTML(a), !0) : r ? (t.pasteMarkdown(a), !0) : (t.pasteText(a), !0);
|
|
1175
1178
|
}
|
|
1176
|
-
var lr = (e, t) =>
|
|
1179
|
+
var lr = (e, t) => O.create({
|
|
1177
1180
|
name: "pasteFromClipboard",
|
|
1178
1181
|
addProseMirrorPlugins() {
|
|
1179
|
-
return [new
|
|
1182
|
+
return [new P({ props: { handleDOMEvents: { paste(n, r) {
|
|
1180
1183
|
if (r.preventDefault(), e.isEditable) return t({
|
|
1181
1184
|
event: r,
|
|
1182
1185
|
editor: e,
|
|
@@ -1193,67 +1196,69 @@ var lr = (e, t) => D.create({
|
|
|
1193
1196
|
//#endregion
|
|
1194
1197
|
//#region src/api/clipboard/toClipboard/copyExtension.ts
|
|
1195
1198
|
function ur(e, t, n) {
|
|
1196
|
-
let r = !1, i = e.state.selection instanceof
|
|
1199
|
+
let r = !1, i = e.state.selection instanceof R;
|
|
1197
1200
|
if (!i) {
|
|
1198
1201
|
let n = e.state.doc.slice(e.state.selection.from, e.state.selection.to, !1).content, i = [];
|
|
1199
1202
|
for (let e = 0; e < n.childCount; e++) i.push(n.child(e));
|
|
1200
1203
|
r = i.find((e) => e.type.isInGroup("bnBlock") || e.type.name === "blockGroup" || e.type.spec.group === "blockContent") === void 0, r && (t = n);
|
|
1201
1204
|
}
|
|
1202
|
-
let a, o =
|
|
1205
|
+
let a, o = be(e.state.schema, n);
|
|
1203
1206
|
if (i) {
|
|
1204
1207
|
t.firstChild?.type.name === "table" && (t = t.firstChild.content);
|
|
1205
1208
|
let e = re(t, n.schema.inlineContentSchema, n.schema.styleSchema);
|
|
1206
1209
|
a = `<table>${o.exportInlineContent(e, {})}</table>`;
|
|
1207
1210
|
} else if (r) {
|
|
1208
|
-
let e =
|
|
1211
|
+
let e = ce(t, n.schema.inlineContentSchema, n.schema.styleSchema);
|
|
1209
1212
|
a = o.exportInlineContent(e, {});
|
|
1210
1213
|
} else {
|
|
1211
|
-
let e =
|
|
1214
|
+
let e = xe(t);
|
|
1212
1215
|
a = o.exportBlocks(e, {});
|
|
1213
1216
|
}
|
|
1214
1217
|
return a;
|
|
1215
1218
|
}
|
|
1216
1219
|
function dr(e, t) {
|
|
1217
|
-
"node" in e.state.selection && e.state.selection.node.type.spec.group === "blockContent" && t.transact((t) => t.setSelection(new
|
|
1220
|
+
"node" in e.state.selection && e.state.selection.node.type.spec.group === "blockContent" && t.transact((t) => t.setSelection(new N(t.doc.resolve(e.state.selection.from - 1))));
|
|
1218
1221
|
let n = e.serializeForClipboard(e.state.selection.content()).dom.innerHTML, r = e.state.selection.content().content, i = ur(e, r, t);
|
|
1219
1222
|
return {
|
|
1220
1223
|
clipboardHTML: n,
|
|
1221
1224
|
externalHTML: i,
|
|
1222
|
-
markdown:
|
|
1225
|
+
markdown: ve(i)
|
|
1223
1226
|
};
|
|
1224
1227
|
}
|
|
1225
|
-
var fr = () => {
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1228
|
+
var fr = (e) => {
|
|
1229
|
+
if (e.state.selection.empty) return !0;
|
|
1230
|
+
let t = window.getSelection();
|
|
1231
|
+
if (t && !t.isCollapsed) {
|
|
1232
|
+
let e = t.focusNode;
|
|
1233
|
+
for (; e;) {
|
|
1234
|
+
if (e instanceof HTMLElement && e.getAttribute("contenteditable") === "false") return !0;
|
|
1235
|
+
e = e.parentElement;
|
|
1236
|
+
}
|
|
1232
1237
|
}
|
|
1233
1238
|
return !1;
|
|
1234
1239
|
}, pr = (e, t, n) => {
|
|
1235
1240
|
n.preventDefault(), n.clipboardData.clearData();
|
|
1236
1241
|
let { clipboardHTML: r, externalHTML: i, markdown: a } = dr(t, e);
|
|
1237
1242
|
n.clipboardData.setData("blocknote/html", r), n.clipboardData.setData("text/html", i), n.clipboardData.setData("text/plain", a);
|
|
1238
|
-
}, mr = (e) =>
|
|
1243
|
+
}, mr = (e) => O.create({
|
|
1239
1244
|
name: "copyToClipboard",
|
|
1240
1245
|
addProseMirrorPlugins() {
|
|
1241
|
-
return [new
|
|
1246
|
+
return [new P({ props: { handleDOMEvents: {
|
|
1242
1247
|
copy(t, n) {
|
|
1243
|
-
return fr() || pr(e, t, n), !0;
|
|
1248
|
+
return fr(t) || pr(e, t, n), !0;
|
|
1244
1249
|
},
|
|
1245
1250
|
cut(t, n) {
|
|
1246
|
-
return fr() ? !0 : (pr(e, t, n), t.editable && t.dispatch(t.state.tr.deleteSelection()), !0);
|
|
1251
|
+
return fr(t) ? !0 : (pr(e, t, n), t.editable && t.dispatch(t.state.tr.deleteSelection()), !0);
|
|
1247
1252
|
},
|
|
1248
1253
|
dragstart(t, n) {
|
|
1249
1254
|
if (!("node" in t.state.selection) || t.state.selection.node.type.spec.group !== "blockContent") return;
|
|
1250
|
-
e.transact((e) => e.setSelection(new
|
|
1255
|
+
e.transact((e) => e.setSelection(new N(e.doc.resolve(t.state.selection.from - 1)))), n.preventDefault(), n.dataTransfer.clearData();
|
|
1251
1256
|
let { clipboardHTML: r, externalHTML: i, markdown: a } = dr(t, e);
|
|
1252
1257
|
return n.dataTransfer.setData("blocknote/html", r), n.dataTransfer.setData("text/html", i), n.dataTransfer.setData("text/plain", a), !0;
|
|
1253
1258
|
}
|
|
1254
1259
|
} } })];
|
|
1255
1260
|
}
|
|
1256
|
-
}), hr =
|
|
1261
|
+
}), hr = O.create({
|
|
1257
1262
|
name: "blockBackgroundColor",
|
|
1258
1263
|
addGlobalAttributes() {
|
|
1259
1264
|
return [{
|
|
@@ -1261,7 +1266,7 @@ var fr = () => {
|
|
|
1261
1266
|
attributes: { backgroundColor: ne() }
|
|
1262
1267
|
}];
|
|
1263
1268
|
}
|
|
1264
|
-
}), gr =
|
|
1269
|
+
}), gr = A.create({
|
|
1265
1270
|
name: "hardBreak",
|
|
1266
1271
|
inline: !0,
|
|
1267
1272
|
group: "inline",
|
|
@@ -1272,7 +1277,7 @@ var fr = () => {
|
|
|
1272
1277
|
return [{ tag: "br" }];
|
|
1273
1278
|
},
|
|
1274
1279
|
renderHTML({ HTMLAttributes: e }) {
|
|
1275
|
-
return ["br",
|
|
1280
|
+
return ["br", M(this.options.HTMLAttributes, e)];
|
|
1276
1281
|
},
|
|
1277
1282
|
renderText() {
|
|
1278
1283
|
return "\n";
|
|
@@ -1317,7 +1322,7 @@ var fr = () => {
|
|
|
1317
1322
|
if (!i) return !1;
|
|
1318
1323
|
let a = vr(t.doc, i);
|
|
1319
1324
|
return yr(a, r) ? br(t, n, a, r) : !1;
|
|
1320
|
-
}, Sr =
|
|
1325
|
+
}, Sr = O.create({
|
|
1321
1326
|
priority: 50,
|
|
1322
1327
|
addKeyboardShortcuts() {
|
|
1323
1328
|
let e = () => this.editor.commands.first(({ chain: e, commands: t }) => [
|
|
@@ -1327,7 +1332,7 @@ var fr = () => {
|
|
|
1327
1332
|
let n = v(e);
|
|
1328
1333
|
if (!n.isBlockContainer) return !1;
|
|
1329
1334
|
let r = e.selection.from === n.blockContent.beforePos + 1, i = n.blockContent.node.type.name === "paragraph";
|
|
1330
|
-
return r && !i ? t.command(
|
|
1335
|
+
return r && !i ? t.command(ue(n.bnBlock.beforePos, {
|
|
1331
1336
|
type: "paragraph",
|
|
1332
1337
|
props: {}
|
|
1333
1338
|
})) : !1;
|
|
@@ -1336,7 +1341,7 @@ var fr = () => {
|
|
|
1336
1341
|
let n = v(e);
|
|
1337
1342
|
if (!n.isBlockContainer) return !1;
|
|
1338
1343
|
let { blockContent: r } = n;
|
|
1339
|
-
return e.selection.from === r.beforePos + 1 ?
|
|
1344
|
+
return e.selection.from === r.beforePos + 1 ? G(t, t.doc.type.schema.nodes.blockContainer, t.doc.type.schema.nodes.blockGroup) : !1;
|
|
1340
1345
|
}),
|
|
1341
1346
|
() => t.command(({ state: t }) => {
|
|
1342
1347
|
let n = v(t);
|
|
@@ -1353,7 +1358,7 @@ var fr = () => {
|
|
|
1353
1358
|
if (!i || i.isBlockContainer) return !1;
|
|
1354
1359
|
if (n) {
|
|
1355
1360
|
let e = i.bnBlock.afterPos - 1, n = t.doc.resolve(e - 1);
|
|
1356
|
-
return t.delete(r.bnBlock.beforePos, r.bnBlock.afterPos), t.insert(n.pos, r.bnBlock.node), t.setSelection(
|
|
1361
|
+
return t.delete(r.bnBlock.beforePos, r.bnBlock.afterPos), t.insert(n.pos, r.bnBlock.node), t.setSelection(F.near(t.doc.resolve(n.pos + 1))), !0;
|
|
1357
1362
|
}
|
|
1358
1363
|
return !1;
|
|
1359
1364
|
}),
|
|
@@ -1363,7 +1368,7 @@ var fr = () => {
|
|
|
1363
1368
|
let i = t.doc.resolve(r.bnBlock.beforePos);
|
|
1364
1369
|
if (i.nodeBefore || i.node().type.name !== "column") return !1;
|
|
1365
1370
|
let a = t.doc.resolve(r.bnBlock.beforePos), o = t.doc.resolve(a.before()), s = o.before();
|
|
1366
|
-
return n && (t.delete(r.bnBlock.beforePos, r.bnBlock.afterPos),
|
|
1371
|
+
return n && (t.delete(r.bnBlock.beforePos, r.bnBlock.afterPos), H(t, s), o.pos === s + 1 ? (t.insert(s, r.bnBlock.node), t.setSelection(F.near(t.doc.resolve(s)))) : (t.insert(o.pos - 1, r.bnBlock.node), t.setSelection(F.near(t.doc.resolve(o.pos))))), !0;
|
|
1367
1372
|
}),
|
|
1368
1373
|
() => t.command(({ state: t }) => {
|
|
1369
1374
|
let n = v(t);
|
|
@@ -1415,7 +1420,7 @@ var fr = () => {
|
|
|
1415
1420
|
if (!s.isBlockContainer) return !1;
|
|
1416
1421
|
if (a && o) {
|
|
1417
1422
|
let n = s.blockContent.node, a = n.type.spec.content === "inline*", o = r.node.type.spec.content === "inline*";
|
|
1418
|
-
return e().insertContentAt(s.bnBlock.afterPos, s.childContainer?.node.content ||
|
|
1423
|
+
return e().insertContentAt(s.bnBlock.afterPos, s.childContainer?.node.content || T.empty).deleteRange(i.node.childCount === 1 ? {
|
|
1419
1424
|
from: i.beforePos,
|
|
1420
1425
|
to: i.afterPos
|
|
1421
1426
|
} : {
|
|
@@ -1440,7 +1445,7 @@ var fr = () => {
|
|
|
1440
1445
|
if (!i || i.isBlockContainer) return !1;
|
|
1441
1446
|
if (n) {
|
|
1442
1447
|
let e = i.bnBlock.beforePos + 1, n = t.doc.resolve(e + 1);
|
|
1443
|
-
return t.delete(n.pos, n.pos + n.nodeAfter.nodeSize),
|
|
1448
|
+
return t.delete(n.pos, n.pos + n.nodeAfter.nodeSize), H(t, i.bnBlock.beforePos), t.insert(r.bnBlock.afterPos, n.nodeAfter), t.setSelection(F.near(t.doc.resolve(n.pos))), !0;
|
|
1444
1449
|
}
|
|
1445
1450
|
return !1;
|
|
1446
1451
|
}),
|
|
@@ -1452,7 +1457,7 @@ var fr = () => {
|
|
|
1452
1457
|
let a = t.doc.resolve(r.bnBlock.afterPos), o = t.doc.resolve(a.after()), s = o.after();
|
|
1453
1458
|
if (n) {
|
|
1454
1459
|
let e = o.pos === s - 1 ? s : o.pos + 1, n = x(t.doc.resolve(e));
|
|
1455
|
-
t.delete(n.bnBlock.beforePos, n.bnBlock.afterPos),
|
|
1460
|
+
t.delete(n.bnBlock.beforePos, n.bnBlock.afterPos), H(t, s - o.node().nodeSize), t.insert(a.pos, n.bnBlock.node), t.setSelection(F.near(t.doc.resolve(e)));
|
|
1456
1461
|
}
|
|
1457
1462
|
return !0;
|
|
1458
1463
|
}),
|
|
@@ -1469,7 +1474,7 @@ var fr = () => {
|
|
|
1469
1474
|
}, a = i(t.doc, n.bnBlock.beforePos);
|
|
1470
1475
|
if (!a || !a.isBlockContainer) return !1;
|
|
1471
1476
|
let o = a.blockContent.node, s = o.type.spec.content === "inline*", c = r.node.type.spec.content === "inline*";
|
|
1472
|
-
return e().insertContentAt(a.bnBlock.afterPos, a.childContainer?.node.content ||
|
|
1477
|
+
return e().insertContentAt(a.bnBlock.afterPos, a.childContainer?.node.content || T.empty).deleteRange({
|
|
1473
1478
|
from: a.bnBlock.beforePos,
|
|
1474
1479
|
to: a.bnBlock.afterPos
|
|
1475
1480
|
}).insertContentAt(t.selection.from, s && c ? o.content : null).setTextSelection(t.selection.from).scrollIntoView().run();
|
|
@@ -1513,7 +1518,7 @@ var fr = () => {
|
|
|
1513
1518
|
let n = v(e);
|
|
1514
1519
|
if (!n.isBlockContainer) return !1;
|
|
1515
1520
|
let { bnBlock: r, blockContent: i } = n, { depth: a } = e.doc.resolve(r.beforePos), o = e.selection.$anchor.parentOffset === 0, s = e.selection.anchor === e.selection.head, c = i.node.childCount === 0;
|
|
1516
|
-
return o && s && c && a > 1 ?
|
|
1521
|
+
return o && s && c && a > 1 ? G(t, t.doc.type.schema.nodes.blockContainer, t.doc.type.schema.nodes.blockGroup) : !1;
|
|
1517
1522
|
}),
|
|
1518
1523
|
() => t.command(({ state: t }) => {
|
|
1519
1524
|
let r = v(t), i = this.options.editor.schema.blockSchema[r.blockNoteType].meta?.hardBreakShortcut ?? "shift+enter";
|
|
@@ -1532,7 +1537,7 @@ var fr = () => {
|
|
|
1532
1537
|
let a = i.afterPos, o = a + 2;
|
|
1533
1538
|
if (t) {
|
|
1534
1539
|
let t = e.schema.nodes.blockContainer.createAndFill(void 0, [e.schema.nodes.paragraph.createAndFill() || void 0, r.childContainer?.node].filter((e) => e !== void 0));
|
|
1535
|
-
n.insert(a, t).setSelection(new
|
|
1540
|
+
n.insert(a, t).setSelection(new F(n.doc.resolve(o))).scrollIntoView(), r.childContainer && n.delete(r.childContainer.beforePos, r.childContainer.afterPos);
|
|
1536
1541
|
}
|
|
1537
1542
|
return !0;
|
|
1538
1543
|
}
|
|
@@ -1550,8 +1555,8 @@ var fr = () => {
|
|
|
1550
1555
|
Delete: t,
|
|
1551
1556
|
Enter: () => n(),
|
|
1552
1557
|
"Shift-Enter": () => n(!0),
|
|
1553
|
-
Tab: () => this.options.tabBehavior !== "prefer-indent" && (this.options.editor.getExtension(
|
|
1554
|
-
"Shift-Tab": () => this.options.tabBehavior !== "prefer-indent" && (this.options.editor.getExtension(
|
|
1558
|
+
Tab: () => this.options.tabBehavior !== "prefer-indent" && (this.options.editor.getExtension(w)?.store.state || this.options.editor.getExtension(ae)?.store.state !== void 0) ? !1 : zt(this.options.editor),
|
|
1559
|
+
"Shift-Tab": () => this.options.tabBehavior !== "prefer-indent" && (this.options.editor.getExtension(w)?.store.state || this.options.editor.getExtension(ae)?.store.state !== void 0) ? !1 : Vt(this.options.editor),
|
|
1555
1560
|
"Shift-Mod-ArrowUp": () => (this.options.editor.moveBlocksUp(), !0),
|
|
1556
1561
|
"Shift-Mod-ArrowDown": () => (this.options.editor.moveBlocksDown(), !0),
|
|
1557
1562
|
"Mod-z": () => this.options.editor.undo(),
|
|
@@ -1559,7 +1564,7 @@ var fr = () => {
|
|
|
1559
1564
|
"Shift-Mod-z": () => this.options.editor.redo()
|
|
1560
1565
|
};
|
|
1561
1566
|
}
|
|
1562
|
-
}), Cr =
|
|
1567
|
+
}), Cr = k.create({
|
|
1563
1568
|
name: "insertion",
|
|
1564
1569
|
inclusive: !1,
|
|
1565
1570
|
excludes: "deletion modification insertion",
|
|
@@ -1592,7 +1597,7 @@ var fr = () => {
|
|
|
1592
1597
|
}]
|
|
1593
1598
|
} : {};
|
|
1594
1599
|
}
|
|
1595
|
-
}), wr =
|
|
1600
|
+
}), wr = k.create({
|
|
1596
1601
|
name: "deletion",
|
|
1597
1602
|
inclusive: !1,
|
|
1598
1603
|
excludes: "insertion modification deletion",
|
|
@@ -1625,7 +1630,7 @@ var fr = () => {
|
|
|
1625
1630
|
}]
|
|
1626
1631
|
} : {};
|
|
1627
1632
|
}
|
|
1628
|
-
}), Tr =
|
|
1633
|
+
}), Tr = k.create({
|
|
1629
1634
|
name: "modification",
|
|
1630
1635
|
inclusive: !1,
|
|
1631
1636
|
excludes: "deletion insertion",
|
|
@@ -1683,7 +1688,7 @@ var fr = () => {
|
|
|
1683
1688
|
}]
|
|
1684
1689
|
} : {};
|
|
1685
1690
|
}
|
|
1686
|
-
}), Er =
|
|
1691
|
+
}), Er = O.create({
|
|
1687
1692
|
name: "textAlignment",
|
|
1688
1693
|
addGlobalAttributes() {
|
|
1689
1694
|
return [{
|
|
@@ -1695,7 +1700,7 @@ var fr = () => {
|
|
|
1695
1700
|
} }
|
|
1696
1701
|
}];
|
|
1697
1702
|
}
|
|
1698
|
-
}), Dr =
|
|
1703
|
+
}), Dr = O.create({
|
|
1699
1704
|
name: "blockTextColor",
|
|
1700
1705
|
addGlobalAttributes() {
|
|
1701
1706
|
return [{
|
|
@@ -1704,7 +1709,7 @@ var fr = () => {
|
|
|
1704
1709
|
"tableCell",
|
|
1705
1710
|
"tableHeader"
|
|
1706
1711
|
],
|
|
1707
|
-
attributes: { textColor:
|
|
1712
|
+
attributes: { textColor: le() }
|
|
1708
1713
|
}];
|
|
1709
1714
|
}
|
|
1710
1715
|
}), Or = {
|
|
@@ -1713,7 +1718,7 @@ var fr = () => {
|
|
|
1713
1718
|
id: "data-id",
|
|
1714
1719
|
depth: "data-depth",
|
|
1715
1720
|
depthChange: "data-depth-change"
|
|
1716
|
-
}, kr =
|
|
1721
|
+
}, kr = A.create({
|
|
1717
1722
|
name: "blockContainer",
|
|
1718
1723
|
group: "blockGroupChild bnBlock",
|
|
1719
1724
|
content: "blockContent blockGroup?",
|
|
@@ -1749,7 +1754,7 @@ var fr = () => {
|
|
|
1749
1754
|
contentDOM: r
|
|
1750
1755
|
};
|
|
1751
1756
|
}
|
|
1752
|
-
}), Ar =
|
|
1757
|
+
}), Ar = A.create({
|
|
1753
1758
|
name: "blockGroup",
|
|
1754
1759
|
group: "childContainer",
|
|
1755
1760
|
content: "blockGroupChild+",
|
|
@@ -1772,31 +1777,31 @@ var fr = () => {
|
|
|
1772
1777
|
contentDOM: n
|
|
1773
1778
|
};
|
|
1774
1779
|
}
|
|
1775
|
-
}), jr =
|
|
1780
|
+
}), jr = A.create({
|
|
1776
1781
|
name: "doc",
|
|
1777
1782
|
topNode: !0,
|
|
1778
1783
|
content: "blockGroup",
|
|
1779
1784
|
marks: "insertion modification deletion"
|
|
1780
|
-
}), Mr =
|
|
1785
|
+
}), Mr = Me(({ options: e }) => ({
|
|
1781
1786
|
key: "collaboration",
|
|
1782
1787
|
blockNoteExtensions: [
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
+
de(e),
|
|
1789
|
+
pe(e),
|
|
1790
|
+
ge(e),
|
|
1791
|
+
ke(),
|
|
1792
|
+
he(e)
|
|
1788
1793
|
]
|
|
1789
1794
|
}));
|
|
1790
1795
|
//#endregion
|
|
1791
1796
|
//#region src/editor/managers/ExtensionManager/extensions.ts
|
|
1792
1797
|
function Nr(e, t) {
|
|
1793
1798
|
return [
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1799
|
+
j.ClipboardTextSerializer,
|
|
1800
|
+
j.Commands,
|
|
1801
|
+
j.Editable,
|
|
1802
|
+
j.FocusEvents,
|
|
1803
|
+
j.Tabindex,
|
|
1804
|
+
pt,
|
|
1800
1805
|
o.configure({
|
|
1801
1806
|
types: [
|
|
1802
1807
|
"blockContainer",
|
|
@@ -1807,21 +1812,15 @@ function Nr(e, t) {
|
|
|
1807
1812
|
isWithinEditor: e.isWithinEditor
|
|
1808
1813
|
}),
|
|
1809
1814
|
gr,
|
|
1810
|
-
|
|
1815
|
+
mt,
|
|
1811
1816
|
Cr,
|
|
1812
1817
|
wr,
|
|
1813
1818
|
Tr,
|
|
1814
|
-
Bn.configure({
|
|
1815
|
-
HTMLAttributes: t.links?.HTMLAttributes ?? {},
|
|
1816
|
-
editor: e,
|
|
1817
|
-
onClick: t.links?.onClick,
|
|
1818
|
-
...t.links?.isValidLink ? { isValidLink: t.links.isValidLink } : {}
|
|
1819
|
-
}),
|
|
1820
1819
|
...Object.values(e.schema.styleSpecs).map((t) => t.implementation.mark.configure({ editor: e })),
|
|
1821
1820
|
Dr,
|
|
1822
1821
|
hr,
|
|
1823
1822
|
Er,
|
|
1824
|
-
|
|
1823
|
+
O.create({
|
|
1825
1824
|
name: "OverrideEscape",
|
|
1826
1825
|
addKeyboardShortcuts: () => ({ Escape: () => e.getExtension(te)?.shown() ? !1 : (e.blur(), !0) })
|
|
1827
1826
|
}),
|
|
@@ -1847,19 +1846,24 @@ function Nr(e, t) {
|
|
|
1847
1846
|
}
|
|
1848
1847
|
function Pr(e, t) {
|
|
1849
1848
|
let n = [
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1849
|
+
fe(),
|
|
1850
|
+
Ae(t),
|
|
1851
|
+
ae(t),
|
|
1852
|
+
w(t),
|
|
1853
|
+
Bn({
|
|
1854
|
+
HTMLAttributes: t.links?.HTMLAttributes ?? {},
|
|
1855
|
+
onClick: t.links?.onClick,
|
|
1856
|
+
...t.links?.isValidLink ? { isValidLink: t.links.isValidLink } : {}
|
|
1857
|
+
}),
|
|
1858
|
+
_e(t),
|
|
1859
|
+
Se(),
|
|
1858
1860
|
Te(t),
|
|
1861
|
+
Ne(t),
|
|
1862
|
+
we(t),
|
|
1859
1863
|
te(t),
|
|
1860
|
-
...t.trailingBlock === !1 ? [] : [
|
|
1864
|
+
...t.trailingBlock === !1 ? [] : [Ee()]
|
|
1861
1865
|
];
|
|
1862
|
-
return t.collaboration ? n.push(Mr(t.collaboration)) : n.push(
|
|
1866
|
+
return t.collaboration ? n.push(Mr(t.collaboration)) : n.push(Oe()), "table" in e.schema.blockSpecs && n.push(Ce(t)), t.animations !== !1 && n.push(ye()), n;
|
|
1863
1867
|
}
|
|
1864
1868
|
//#endregion
|
|
1865
1869
|
//#region src/editor/managers/ExtensionManager/index.ts
|
|
@@ -1904,7 +1908,7 @@ var Fr = class {
|
|
|
1904
1908
|
let t;
|
|
1905
1909
|
if (t = typeof e == "function" ? e({ editor: this.editor }) : e, !(!t || this.disabledExtensions.has(t.key))) {
|
|
1906
1910
|
if (typeof e == "function") {
|
|
1907
|
-
let e = t[
|
|
1911
|
+
let e = t[je];
|
|
1908
1912
|
typeof e == "function" && this.extensionFactories.set(e, t);
|
|
1909
1913
|
}
|
|
1910
1914
|
if (this.extensions.push(t), t.blockNoteExtensions) for (let e of t.blockNoteExtensions) this.addExtension(e);
|
|
@@ -1947,19 +1951,19 @@ var Fr = class {
|
|
|
1947
1951
|
for (let r of this.extensions) {
|
|
1948
1952
|
r.tiptapExtensions && e.push(...r.tiptapExtensions);
|
|
1949
1953
|
let i = t(r.key), { plugins: a, inputRules: o } = this.getProsemirrorPluginsFromExtension(r);
|
|
1950
|
-
a.length && e.push(
|
|
1954
|
+
a.length && e.push(O.create({
|
|
1951
1955
|
name: r.key,
|
|
1952
1956
|
priority: i,
|
|
1953
1957
|
addProseMirrorPlugins: () => a
|
|
1954
1958
|
})), o.length && (n.has(i) || n.set(i, []), n.get(i).push(...o));
|
|
1955
1959
|
}
|
|
1956
|
-
e.push(
|
|
1960
|
+
e.push(O.create({
|
|
1957
1961
|
name: "blocknote-input-rules",
|
|
1958
1962
|
addProseMirrorPlugins() {
|
|
1959
1963
|
let e = [];
|
|
1960
1964
|
return Array.from(n.keys()).sort().reverse().forEach((t) => {
|
|
1961
1965
|
e.push(...n.get(t));
|
|
1962
|
-
}), [
|
|
1966
|
+
}), [dt({ rules: e })];
|
|
1963
1967
|
}
|
|
1964
1968
|
}));
|
|
1965
1969
|
for (let t of this.options._tiptapOptions?.extensions ?? []) e.push(t);
|
|
@@ -1970,7 +1974,7 @@ var Fr = class {
|
|
|
1970
1974
|
return !e.prosemirrorPlugins?.length && !Object.keys(e.keyboardShortcuts || {}).length && !e.inputRules?.length ? {
|
|
1971
1975
|
plugins: t,
|
|
1972
1976
|
inputRules: n
|
|
1973
|
-
} : (this.extensionPlugins.set(e, t), e.inputRules?.length && n.push(...e.inputRules.map((e) => new
|
|
1977
|
+
} : (this.extensionPlugins.set(e, t), e.inputRules?.length && n.push(...e.inputRules.map((e) => new ut(e.find, (t, n, r, i) => {
|
|
1974
1978
|
let a = e.replace({
|
|
1975
1979
|
match: n,
|
|
1976
1980
|
range: {
|
|
@@ -1986,7 +1990,7 @@ var Fr = class {
|
|
|
1986
1990
|
return d(o, n.bnBlock.beforePos, a), o;
|
|
1987
1991
|
}
|
|
1988
1992
|
return null;
|
|
1989
|
-
}))), Object.keys(e.keyboardShortcuts || {}).length && t.push(
|
|
1993
|
+
}))), Object.keys(e.keyboardShortcuts || {}).length && t.push(ft(Object.fromEntries(Object.entries(e.keyboardShortcuts).map(([e, t]) => [e, () => t({ editor: this.editor })])))), {
|
|
1990
1994
|
plugins: t,
|
|
1991
1995
|
inputRules: n
|
|
1992
1996
|
});
|
|
@@ -2033,7 +2037,7 @@ function Ir(e, t) {
|
|
|
2033
2037
|
function Lr(e) {
|
|
2034
2038
|
let t = g(e);
|
|
2035
2039
|
if (e.selection.empty || "node" in e.selection) return;
|
|
2036
|
-
let n = e.doc.resolve(
|
|
2040
|
+
let n = e.doc.resolve(C(e.doc, e.selection.from).posBeforeNode), r = e.doc.resolve(C(e.doc, e.selection.to).posBeforeNode), i = (r, i) => {
|
|
2037
2041
|
let a = n.posAtIndex(r, i), o = e.doc.resolve(a).nodeAfter;
|
|
2038
2042
|
if (!o) throw Error(`Error getting selection - node not found at position ${a}`);
|
|
2039
2043
|
return y(o, t);
|
|
@@ -2056,19 +2060,19 @@ function Rr(e, t, n) {
|
|
|
2056
2060
|
if (!s) throw Error(`Block with ID ${r} not found`);
|
|
2057
2061
|
let c = i(a, e.doc);
|
|
2058
2062
|
if (!c) throw Error(`Block with ID ${a} not found`);
|
|
2059
|
-
let l =
|
|
2063
|
+
let l = S(s), u = S(c), d = o.blockSchema[l.blockNoteType], f = o.blockSchema[u.blockNoteType];
|
|
2060
2064
|
if (!l.isBlockContainer || d.content === "none") throw Error(`Attempting to set selection anchor in block without content (id ${r})`);
|
|
2061
2065
|
if (!u.isBlockContainer || f.content === "none") throw Error(`Attempting to set selection anchor in block without content (id ${a})`);
|
|
2062
2066
|
let p, m;
|
|
2063
2067
|
if (d.content === "table") {
|
|
2064
|
-
let e =
|
|
2068
|
+
let e = rt.get(l.blockContent.node);
|
|
2065
2069
|
p = l.blockContent.beforePos + e.positionAt(0, 0, l.blockContent.node) + 1 + 2;
|
|
2066
2070
|
} else p = l.blockContent.beforePos + 1;
|
|
2067
2071
|
if (f.content === "table") {
|
|
2068
|
-
let t =
|
|
2072
|
+
let t = rt.get(u.blockContent.node), n = u.blockContent.beforePos + t.positionAt(t.height - 1, t.width - 1, u.blockContent.node) + 1;
|
|
2069
2073
|
m = n + e.doc.resolve(n).nodeAfter.nodeSize - 2;
|
|
2070
2074
|
} else m = u.blockContent.afterPos - 1;
|
|
2071
|
-
e.setSelection(
|
|
2075
|
+
e.setSelection(F.create(e.doc, p, m));
|
|
2072
2076
|
}
|
|
2073
2077
|
function zr(e, t = !1) {
|
|
2074
2078
|
let n = g(e), r = t ? Ir(e.doc, e.selection) : e.selection, i = r.$from, a = r.$to;
|
|
@@ -2099,15 +2103,15 @@ function Br(e) {
|
|
|
2099
2103
|
function Vr(e, t, n = "start") {
|
|
2100
2104
|
let r = typeof t == "string" ? t : t.id, a = ee(g(e.doc)), o = i(r, e.doc);
|
|
2101
2105
|
if (!o) throw Error(`Block with ID ${r} not found`);
|
|
2102
|
-
let s =
|
|
2106
|
+
let s = S(o), c = a.blockSchema[s.blockNoteType].content;
|
|
2103
2107
|
if (s.isBlockContainer) {
|
|
2104
2108
|
let t = s.blockContent;
|
|
2105
2109
|
if (c === "none") {
|
|
2106
|
-
e.setSelection(
|
|
2110
|
+
e.setSelection(N.create(e.doc, t.beforePos));
|
|
2107
2111
|
return;
|
|
2108
2112
|
}
|
|
2109
|
-
if (c === "inline") n === "start" ? e.setSelection(
|
|
2110
|
-
else if (c === "table") n === "start" ? e.setSelection(
|
|
2113
|
+
if (c === "inline") n === "start" ? e.setSelection(F.create(e.doc, t.beforePos + 1)) : e.setSelection(F.create(e.doc, t.afterPos - 1));
|
|
2114
|
+
else if (c === "table") n === "start" ? e.setSelection(F.create(e.doc, t.beforePos + 4)) : e.setSelection(F.create(e.doc, t.afterPos - 4));
|
|
2111
2115
|
else throw new u(c);
|
|
2112
2116
|
} else Vr(e, (n === "start" ? s.childContainer.node.firstChild : s.childContainer.node.lastChild).attrs.id, n);
|
|
2113
2117
|
}
|
|
@@ -2135,11 +2139,11 @@ var Hr = class {
|
|
|
2135
2139
|
getSelectionBoundingBox() {
|
|
2136
2140
|
if (!this.editor.prosemirrorView) return;
|
|
2137
2141
|
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));
|
|
2138
|
-
if (
|
|
2142
|
+
if ($e(e)) {
|
|
2139
2143
|
let e = this.editor.prosemirrorView.nodeDOM(n);
|
|
2140
2144
|
if (e) return e.getBoundingClientRect();
|
|
2141
2145
|
}
|
|
2142
|
-
return
|
|
2146
|
+
return tt(this.editor.prosemirrorView, n, r).toJSON();
|
|
2143
2147
|
}
|
|
2144
2148
|
}, Ur = class {
|
|
2145
2149
|
constructor(e) {
|
|
@@ -2233,7 +2237,7 @@ function Wr(e, t, n, r = { updateSelection: !0 }) {
|
|
|
2233
2237
|
let { parent: t } = e.doc.resolve(i);
|
|
2234
2238
|
t.isTextblock && !t.type.spec.code && !t.childCount && (--i, a += 1);
|
|
2235
2239
|
}
|
|
2236
|
-
return o ? e.insertText(c, i, a) : e.replaceWith(i, a, n), r.updateSelection &&
|
|
2240
|
+
return o ? e.insertText(c, i, a) : e.replaceWith(i, a, n), r.updateSelection && nt(e, e.steps.length - 1, -1), !0;
|
|
2237
2241
|
}
|
|
2238
2242
|
//#endregion
|
|
2239
2243
|
//#region src/editor/managers/StyleManager.ts
|
|
@@ -2292,7 +2296,7 @@ var Gr = class {
|
|
|
2292
2296
|
return this.editor.transact((t) => {
|
|
2293
2297
|
let n = t.doc.resolve(e), r = n.marks().find((e) => e.type.name === "link");
|
|
2294
2298
|
if (!r) return;
|
|
2295
|
-
let i =
|
|
2299
|
+
let i = Xe(n, r.type);
|
|
2296
2300
|
if (i) return {
|
|
2297
2301
|
href: r.attrs.href,
|
|
2298
2302
|
from: i.from,
|
|
@@ -2332,10 +2336,10 @@ var Gr = class {
|
|
|
2332
2336
|
//#endregion
|
|
2333
2337
|
//#region src/editor/transformPasted.ts
|
|
2334
2338
|
function Kr(e) {
|
|
2335
|
-
return
|
|
2339
|
+
return qe(e.state.selection.$from, (e) => e.type.name === "tableCell" || e.type.name === "tableHeader") !== void 0;
|
|
2336
2340
|
}
|
|
2337
2341
|
function qr(e, t) {
|
|
2338
|
-
let n = t.nodes.hardBreak, r =
|
|
2342
|
+
let n = t.nodes.hardBreak, r = I.empty;
|
|
2339
2343
|
return e.forEach((e) => {
|
|
2340
2344
|
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(qr(e.content, t)), r = r.addToEnd(n.create()));
|
|
2341
2345
|
}), r.lastChild?.type === n && (r = r.cut(0, r.size - 1)), r;
|
|
@@ -2344,7 +2348,7 @@ function Jr(e, t) {
|
|
|
2344
2348
|
let n = [];
|
|
2345
2349
|
return e.forEach((e, r, i) => {
|
|
2346
2350
|
i !== t && n.push(e);
|
|
2347
|
-
}),
|
|
2351
|
+
}), I.from(n);
|
|
2348
2352
|
}
|
|
2349
2353
|
function Yr(e, t) {
|
|
2350
2354
|
let n = [];
|
|
@@ -2356,17 +2360,17 @@ function Yr(e, t) {
|
|
|
2356
2360
|
n.push(i);
|
|
2357
2361
|
}
|
|
2358
2362
|
else n.push(e.child(r));
|
|
2359
|
-
return e =
|
|
2363
|
+
return e = I.from(n), e;
|
|
2360
2364
|
}
|
|
2361
2365
|
function Xr(e, t) {
|
|
2362
|
-
let n =
|
|
2366
|
+
let n = I.from(e.content);
|
|
2363
2367
|
if (n = Yr(n, t.state.schema), Kr(t)) {
|
|
2364
2368
|
let e = !1;
|
|
2365
2369
|
if (n.descendants((t) => {
|
|
2366
2370
|
t.type.isInGroup("tableContent") && (e = !0);
|
|
2367
|
-
}), !e && !t.state.schema.nodes.tableParagraph.validContent(n)) return new
|
|
2371
|
+
}), !e && !t.state.schema.nodes.tableParagraph.validContent(n)) return new L(qr(n, t.state.schema), 0, 0);
|
|
2368
2372
|
}
|
|
2369
|
-
if (!Zr(n, t)) return new
|
|
2373
|
+
if (!Zr(n, t)) return new L(n, e.openStart, e.openEnd);
|
|
2370
2374
|
for (let e = 0; e < n.childCount; e++) if (n.child(e).type.spec.group === "blockContent") {
|
|
2371
2375
|
let r = [n.child(e)];
|
|
2372
2376
|
if (e + 1 < n.childCount && n.child(e + 1).type.name === "blockGroup") {
|
|
@@ -2376,7 +2380,7 @@ function Xr(e, t) {
|
|
|
2376
2380
|
let i = t.state.schema.nodes.blockContainer.createChecked(void 0, r);
|
|
2377
2381
|
n = n.replaceChild(e, i);
|
|
2378
2382
|
}
|
|
2379
|
-
return new
|
|
2383
|
+
return new L(n, e.openStart, e.openEnd);
|
|
2380
2384
|
}
|
|
2381
2385
|
function Zr(e, t) {
|
|
2382
2386
|
let n = e.childCount === 1, r = e.firstChild?.type.spec.content === "inline*", i = e.firstChild?.type.spec.content === "tableRow+";
|
|
@@ -2395,7 +2399,7 @@ var Qr = {
|
|
|
2395
2399
|
enableInputRules: !0,
|
|
2396
2400
|
enablePasteRules: !0,
|
|
2397
2401
|
enableCoreExtensions: !1
|
|
2398
|
-
}, $r = class e extends
|
|
2402
|
+
}, $r = class e extends Fe {
|
|
2399
2403
|
pmSchema;
|
|
2400
2404
|
_tiptapEditor;
|
|
2401
2405
|
elementRenderer = null;
|
|
@@ -2414,7 +2418,7 @@ var Qr = {
|
|
|
2414
2418
|
return new e(t ?? {});
|
|
2415
2419
|
}
|
|
2416
2420
|
constructor(e) {
|
|
2417
|
-
super(), this.options = e, this.dictionary = e.dictionary ||
|
|
2421
|
+
super(), this.options = e, this.dictionary = e.dictionary || Pe, this.settings = { tables: {
|
|
2418
2422
|
splitCells: e?.tables?.splitCells ?? !1,
|
|
2419
2423
|
cellBackgroundColor: e?.tables?.cellBackgroundColor ?? !1,
|
|
2420
2424
|
cellTextColor: e?.tables?.cellTextColor ?? !1,
|
|
@@ -2422,7 +2426,7 @@ var Qr = {
|
|
|
2422
2426
|
} };
|
|
2423
2427
|
let t = {
|
|
2424
2428
|
defaultStyles: !0,
|
|
2425
|
-
schema: e.schema ||
|
|
2429
|
+
schema: e.schema || se.create(),
|
|
2426
2430
|
...e,
|
|
2427
2431
|
placeholders: {
|
|
2428
2432
|
...this.dictionary.placeholders,
|
|
@@ -2440,7 +2444,7 @@ var Qr = {
|
|
|
2440
2444
|
}
|
|
2441
2445
|
};
|
|
2442
2446
|
}
|
|
2443
|
-
this.resolveFileUrl = t.resolveFileUrl, this._eventManager = new
|
|
2447
|
+
this.resolveFileUrl = t.resolveFileUrl, this._eventManager = new Yt(this), this._extensionManager = new Fr(this, t);
|
|
2444
2448
|
let n = this._extensionManager.getTiptapExtensions(), r = this._extensionManager.hasExtension("ySync") || this._extensionManager.hasExtension("liveblocksExtension");
|
|
2445
2449
|
r && t.initialContent && console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");
|
|
2446
2450
|
let i = {
|
|
@@ -2469,14 +2473,14 @@ var Qr = {
|
|
|
2469
2473
|
id: o.options.generateID()
|
|
2470
2474
|
}]);
|
|
2471
2475
|
if (!Array.isArray(e) || e.length === 0) throw Error("initialContent must be a non-empty array of blocks, received: " + e);
|
|
2472
|
-
let n =
|
|
2476
|
+
let n = Qe(i.extensions), a = Ge({
|
|
2473
2477
|
type: "doc",
|
|
2474
2478
|
content: [{
|
|
2475
2479
|
type: "blockGroup",
|
|
2476
2480
|
content: e.map((e) => c(e, n, this.schema.styleSchema).toJSON())
|
|
2477
2481
|
}]
|
|
2478
2482
|
}, n, i.parseOptions);
|
|
2479
|
-
this._tiptapEditor = new
|
|
2483
|
+
this._tiptapEditor = new Ue({
|
|
2480
2484
|
...i,
|
|
2481
2485
|
content: a.toJSON()
|
|
2482
2486
|
}), this.pmSchema = this._tiptapEditor.schema;
|
|
@@ -2487,12 +2491,12 @@ var Qr = {
|
|
|
2487
2491
|
this.pmSchema.nodes.doc.createAndFill = (...e) => {
|
|
2488
2492
|
if (a) return a;
|
|
2489
2493
|
let t = l.apply(this.pmSchema.nodes.doc, e), n = JSON.parse(JSON.stringify(t.toJSON()));
|
|
2490
|
-
return n.content[0].content[0].attrs.id = "initialBlockId", a =
|
|
2494
|
+
return n.content[0].content[0].attrs.id = "initialBlockId", a = Re.fromJSON(this.pmSchema, n), a;
|
|
2491
2495
|
}, this.pmSchema.cached.blockNoteEditor = this, this._tiptapEditor.on("mount", () => {
|
|
2492
2496
|
this.headless = !1;
|
|
2493
2497
|
}), this._tiptapEditor.on("unmount", () => {
|
|
2494
2498
|
this.headless = !0;
|
|
2495
|
-
}), this._blockManager = new
|
|
2499
|
+
}), this._blockManager = new Jt(this), this._exportManager = new dn(this), this._selectionManager = new Hr(this), this._stateManager = new Ur(this), this._styleManager = new Gr(this), this.emit("create");
|
|
2496
2500
|
}
|
|
2497
2501
|
_blockManager;
|
|
2498
2502
|
_eventManager;
|
|
@@ -2588,7 +2592,7 @@ var Qr = {
|
|
|
2588
2592
|
this._tiptapEditor.on("selectionUpdate", e);
|
|
2589
2593
|
}
|
|
2590
2594
|
onBeforeChange(e) {
|
|
2591
|
-
return this._extensionManager.getExtension(
|
|
2595
|
+
return this._extensionManager.getExtension(fe).subscribe(e);
|
|
2592
2596
|
}
|
|
2593
2597
|
getTextCursorPosition() {
|
|
2594
2598
|
return this._selectionManager.getTextCursorPosition();
|
|
@@ -2765,6 +2769,6 @@ function ni(e, ...t) {
|
|
|
2765
2769
|
return n;
|
|
2766
2770
|
}
|
|
2767
2771
|
//#endregion
|
|
2768
|
-
export {
|
|
2772
|
+
export { V as _, Ir as a, gt as b, q as c, Kt as d, qt as f, H as g, U as h, $r as i, K as l, kt as m, ti as n, dr as o, Gt as p, ei as r, un as s, ni as t, Wt as u, vt as v, ht as x, _t as y };
|
|
2769
2773
|
|
|
2770
|
-
//# sourceMappingURL=src-
|
|
2774
|
+
//# sourceMappingURL=src-SVFpMAWE.js.map
|