@blocknote/core 0.49.0 → 0.51.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 +4 -4
- package/dist/{blocks-CSfJen16.js → blocks-D0lMxErU.js} +612 -568
- package/dist/blocks-D0lMxErU.js.map +1 -0
- package/dist/blocks-KyMOxPT3.cjs +11 -0
- package/dist/blocks-KyMOxPT3.cjs.map +1 -0
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- 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-C3nguvVr.js → extensions-CQFfm5f5.js} +621 -353
- package/dist/extensions-CQFfm5f5.js.map +1 -0
- package/dist/extensions-Cuw3zOdC.cjs +52 -0
- package/dist/extensions-Cuw3zOdC.cjs.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +3 -3
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +68 -24
- package/dist/locales.js.map +1 -1
- package/dist/{src-DQfz4zLM.js → src-DK_8q1j5.js} +1135 -625
- package/dist/src-DK_8q1j5.js.map +1 -0
- package/dist/src-_83jmA7A.cjs +21 -0
- package/dist/src-_83jmA7A.cjs.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 +8 -8
- package/package.json +1 -13
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +7 -7
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +5 -3
- package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +5 -5
- package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +2550 -291
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +83 -2
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +103 -42
- package/src/api/blockManipulation/commands/nestBlock/__snapshots__/nestBlock.test.ts.snap +0 -143
- package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +12 -12
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +5 -3
- package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +6 -6
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +22 -22
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +12 -8
- package/src/api/blockManipulation/setupTestEnv.ts +1 -1
- package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +2 -6
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +7 -2
- package/src/api/clipboard/toClipboard/copyExtension.ts +21 -16
- package/src/api/exporters/markdown/htmlToMarkdown.ts +813 -0
- package/src/api/exporters/markdown/markdownExporter.ts +2 -21
- package/src/api/nodeConversions/blockToNode.ts +3 -2
- package/src/api/parsers/html/util/__snapshots__/nestedLists.test.ts.snap +122 -107
- package/src/api/parsers/html/util/nestedLists.test.ts +1 -12
- package/src/api/parsers/markdown/markdownToHtml.ts +1194 -0
- package/src/api/parsers/markdown/parseMarkdown.ts +2 -101
- package/src/blocks/Audio/block.ts +1 -4
- package/src/blocks/Code/block.test.ts +258 -0
- package/src/blocks/File/block.ts +1 -4
- package/src/blocks/File/helpers/render/createFileBlockWrapper.ts +7 -2
- package/src/blocks/Image/block.ts +9 -6
- package/src/blocks/ListItem/BulletListItem/block.ts +7 -4
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +3 -4
- package/src/blocks/Table/TableExtension.ts +38 -9
- package/src/blocks/Video/block.ts +4 -5
- package/src/blocks/Video/parseVideoElement.ts +2 -1
- package/src/blocks/defaultBlocks.ts +34 -1
- package/src/comments/extension.ts +30 -11
- package/src/editor/Block.css +22 -18
- package/src/editor/BlockNoteEditor.test.ts +10 -4
- package/src/editor/BlockNoteEditor.ts +30 -13
- package/src/editor/managers/BlockManager.ts +10 -6
- package/src/editor/managers/ExtensionManager/extensions.ts +8 -9
- package/src/editor/managers/ExtensionManager/index.ts +80 -25
- package/src/editor/performance.test.ts +2 -2
- package/src/editor/transformPasted.test.ts +295 -0
- package/src/editor/transformPasted.ts +77 -0
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor-forked.json +1 -12
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor.json +0 -11
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-forked.html +1 -1
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap.html +1 -1
- package/src/extensions/SideMenu/SideMenu.ts +2 -2
- package/src/extensions/SideMenu/dragging.ts +7 -10
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +21 -0
- package/src/extensions/TableHandles/TableHandles.ts +2 -0
- package/src/extensions/TrailingNode/TrailingNode.ts +124 -65
- 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 +4 -2
- 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/api/blockManipulation/commands/moveBlocks/moveBlocks.d.ts +13 -2
- package/types/src/api/clipboard/fromClipboard/handleVSCodePaste.d.ts +1 -1
- package/types/src/api/exporters/markdown/htmlToMarkdown.d.ts +11 -0
- package/types/src/api/parsers/markdown/markdownToHtml.d.ts +5 -0
- package/types/src/blocks/Code/block.test.d.ts +1 -0
- package/types/src/blocks/Video/block.d.ts +2 -0
- package/types/src/blocks/Video/parseVideoElement.d.ts +1 -0
- package/types/src/comments/extension.d.ts +2 -1
- package/types/src/editor/BlockNoteEditor.d.ts +20 -6
- package/types/src/editor/managers/BlockManager.d.ts +8 -4
- package/types/src/editor/transformPasted.test.d.ts +1 -0
- package/types/src/extensions/TrailingNode/TrailingNode.d.ts +8 -3
- 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/blocks-CSfJen16.js.map +0 -1
- package/dist/blocks-_lpGWKOa.cjs +0 -11
- package/dist/blocks-_lpGWKOa.cjs.map +0 -1
- package/dist/en-C4ykW581.cjs.map +0 -1
- package/dist/en-QsSI16s5.js.map +0 -1
- package/dist/extensions-BfYaEv6F.cjs +0 -2
- package/dist/extensions-BfYaEv6F.cjs.map +0 -1
- package/dist/extensions-C3nguvVr.js.map +0 -1
- package/dist/src-ChTwrMcE.cjs +0 -5
- package/dist/src-ChTwrMcE.cjs.map +0 -1
- package/dist/src-DQfz4zLM.js.map +0 -1
- package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +0 -42
- package/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.ts +0 -19
- package/src/api/exporters/markdown/util/removeUnderlinesRehypePlugin.ts +0 -39
- package/types/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.d.ts +0 -7
- package/types/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.d.ts +0 -2
- package/types/src/api/exporters/markdown/util/removeUnderlinesRehypePlugin.d.ts +0 -6
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { n as e, t } from "./BlockNoteExtension-B6RhuQ3V.js";
|
|
2
2
|
import { DOMParser as n, Fragment as r, Slice as i } from "prosemirror-model";
|
|
3
3
|
import { Mapping as a, ReplaceStep as o } from "prosemirror-transform";
|
|
4
|
-
import { Extension as s,
|
|
5
|
-
import { Plugin as
|
|
6
|
-
import { uuidv4 as
|
|
7
|
-
import { DOMParser as
|
|
8
|
-
import { CellSelection as
|
|
9
|
-
import { createHighlightPlugin as
|
|
10
|
-
import { createParser as
|
|
11
|
-
import { Plugin as
|
|
12
|
-
import { Decoration as
|
|
13
|
-
import { Decoration as
|
|
14
|
-
import { absolutePositionToRelativePosition as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
4
|
+
import { Extension as s, InputRule as c, Mark as l, Node as u, callOrReturn as d, combineTransactionSteps as f, findChildrenInRange as p, findParentNode as m, getChangedRanges as h, getExtensionField as g, markInputRule as _, mergeAttributes as v } from "@tiptap/core";
|
|
5
|
+
import { Plugin as ee, PluginKey as te, TextSelection as y } from "prosemirror-state";
|
|
6
|
+
import { uuidv4 as ne } from "lib0/random";
|
|
7
|
+
import { DOMParser as re, DOMSerializer as ie, Fragment as ae } from "@tiptap/pm/model";
|
|
8
|
+
import { CellSelection as oe, TableMap as se, TableView as ce, columnResizing as le, goToNextCell as ue, isInTable as de, moveCellForward as fe, nextCell as pe, selectionCell as me, tableEditing as he } from "prosemirror-tables";
|
|
9
|
+
import { createHighlightPlugin as ge } from "prosemirror-highlight";
|
|
10
|
+
import { createParser as _e } from "prosemirror-highlight/shiki";
|
|
11
|
+
import { Plugin as ve, PluginKey as ye } from "@tiptap/pm/state";
|
|
12
|
+
import { Decoration as be, DecorationSet as xe } from "@tiptap/pm/view";
|
|
13
|
+
import { Decoration as Se, DecorationSet as Ce } from "prosemirror-view";
|
|
14
|
+
import { absolutePositionToRelativePosition as we, relativePositionToAbsolutePosition as Te, ySyncPluginKey as Ee } from "y-prosemirror";
|
|
15
|
+
import De from "@tiptap/extension-bold";
|
|
16
|
+
import Oe from "@tiptap/extension-code";
|
|
17
|
+
import ke from "@tiptap/extension-italic";
|
|
18
|
+
import Ae from "@tiptap/extension-strike";
|
|
19
|
+
import je from "@tiptap/extension-underline";
|
|
20
20
|
//#region src/extensions/tiptap-extensions/UniqueID/UniqueID.ts
|
|
21
|
-
function
|
|
21
|
+
function Me(e, t = JSON.stringify) {
|
|
22
22
|
let n = {};
|
|
23
23
|
return e.filter((e) => {
|
|
24
24
|
let r = t(e);
|
|
25
25
|
return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
28
|
+
function Ne(e) {
|
|
29
|
+
return Me(e.filter((t, n) => e.indexOf(t) !== n));
|
|
30
30
|
}
|
|
31
|
-
var
|
|
31
|
+
var Pe = s.create({
|
|
32
32
|
name: "uniqueID",
|
|
33
33
|
priority: 1e4,
|
|
34
34
|
addOptions() {
|
|
@@ -42,7 +42,7 @@ var ke = s.create({
|
|
|
42
42
|
let e = window.__TEST_OPTIONS;
|
|
43
43
|
return e.mockID === void 0 ? e.mockID = 0 : e.mockID++, e.mockID.toString();
|
|
44
44
|
}
|
|
45
|
-
return
|
|
45
|
+
return ne();
|
|
46
46
|
},
|
|
47
47
|
filterTransaction: null
|
|
48
48
|
};
|
|
@@ -65,14 +65,14 @@ var ke = s.create({
|
|
|
65
65
|
},
|
|
66
66
|
addProseMirrorPlugins() {
|
|
67
67
|
let { isWithinEditor: e } = this.options, t = null, n = !1;
|
|
68
|
-
return [new
|
|
69
|
-
key: new
|
|
68
|
+
return [new ee({
|
|
69
|
+
key: new te("uniqueID"),
|
|
70
70
|
appendTransaction: (e, t, n) => {
|
|
71
71
|
let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = this.options.filterTransaction && e.some((e) => !this.options.filterTransaction?.(e));
|
|
72
72
|
if (!r || i) return;
|
|
73
|
-
let { tr: a } = n, { types: o, attributeName: s, generateID: c } = this.options, l =
|
|
74
|
-
if (
|
|
75
|
-
let r =
|
|
73
|
+
let { tr: a } = n, { types: o, attributeName: s, generateID: c } = this.options, l = f(t.doc, e), { mapping: u } = l;
|
|
74
|
+
if (h(l).forEach(({ newRange: e }) => {
|
|
75
|
+
let r = p(n.doc, e, (e) => o.includes(e.type.name)), i = Ne(r.map(({ node: e }) => e.attrs[s]).filter((e) => e !== null));
|
|
76
76
|
r.forEach(({ node: e, pos: r }) => {
|
|
77
77
|
let o = a.doc.nodeAt(r)?.attrs[s];
|
|
78
78
|
if (o === null) {
|
|
@@ -143,19 +143,19 @@ var ke = s.create({
|
|
|
143
143
|
});
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region src/schema/inlineContent/types.ts
|
|
146
|
-
function
|
|
146
|
+
function Fe(e) {
|
|
147
147
|
return e.type === "link";
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function Ie(e) {
|
|
150
150
|
return typeof e != "string" && e.type === "link";
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function b(e) {
|
|
153
153
|
return typeof e != "string" && e.type === "text";
|
|
154
154
|
}
|
|
155
155
|
//#endregion
|
|
156
156
|
//#region src/util/table.ts
|
|
157
|
-
function
|
|
158
|
-
return
|
|
157
|
+
function x(e) {
|
|
158
|
+
return C(e) ? { ...e } : S(e) ? {
|
|
159
159
|
type: "tableCell",
|
|
160
160
|
content: [].concat(e.content),
|
|
161
161
|
props: {
|
|
@@ -177,55 +177,55 @@ function Me(e) {
|
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function S(e) {
|
|
181
181
|
return e != null && typeof e != "string" && !Array.isArray(e) && e.type === "tableCell";
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
return
|
|
183
|
+
function C(e) {
|
|
184
|
+
return S(e) && e.props !== void 0 && e.content !== void 0;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
187
|
-
return
|
|
186
|
+
function w(e) {
|
|
187
|
+
return C(e) ? e.props.colspan ?? 1 : 1;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
return
|
|
189
|
+
function Le(e) {
|
|
190
|
+
return C(e) ? e.props.rowspan ?? 1 : 1;
|
|
191
191
|
}
|
|
192
192
|
//#endregion
|
|
193
193
|
//#region src/util/typescript.ts
|
|
194
|
-
var
|
|
194
|
+
var T = class extends Error {
|
|
195
195
|
constructor(e) {
|
|
196
196
|
super(`Unreachable case: ${e}`);
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
|
-
function
|
|
199
|
+
function Re(e, t = !0) {
|
|
200
200
|
let { "data-test": n, ...r } = e;
|
|
201
201
|
if (Object.keys(r).length > 0 && t) throw Error("Object must be empty " + JSON.stringify(e));
|
|
202
202
|
}
|
|
203
203
|
//#endregion
|
|
204
204
|
//#region src/util/browser.ts
|
|
205
|
-
var
|
|
206
|
-
function
|
|
207
|
-
return
|
|
205
|
+
var ze = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
206
|
+
function E(e, t = "Ctrl") {
|
|
207
|
+
return ze() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function D(...e) {
|
|
210
210
|
return [...new Set(e.filter((e) => e).join(" ").split(" "))].join(" ");
|
|
211
211
|
}
|
|
212
|
-
var
|
|
212
|
+
var Be = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
213
213
|
//#endregion
|
|
214
214
|
//#region src/blocks/defaultBlockHelpers.ts
|
|
215
|
-
function
|
|
215
|
+
function Ve(e, t, n, r) {
|
|
216
216
|
let i = document.createElement("div");
|
|
217
|
-
i.className =
|
|
217
|
+
i.className = D("bn-block-content", n.class), i.setAttribute("data-content-type", e);
|
|
218
218
|
for (let [e, t] of Object.entries(n)) e !== "class" && i.setAttribute(e, t);
|
|
219
219
|
let a = document.createElement(t);
|
|
220
|
-
a.className =
|
|
220
|
+
a.className = D("bn-inline-content", r.class);
|
|
221
221
|
for (let [e, t] of Object.entries(r)) e !== "class" && a.setAttribute(e, t);
|
|
222
222
|
return i.appendChild(a), {
|
|
223
223
|
dom: i,
|
|
224
224
|
contentDOM: a
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
|
-
var
|
|
228
|
-
let n =
|
|
227
|
+
var He = (e, t) => {
|
|
228
|
+
let n = W(e, t.pmSchema);
|
|
229
229
|
n.type.name === "blockContainer" && (n = n.firstChild);
|
|
230
230
|
let r = t.pmSchema.nodes[n.type.name].spec.toDOM;
|
|
231
231
|
if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
|
|
@@ -233,7 +233,7 @@ var ze = (e, t) => {
|
|
|
233
233
|
if (typeof i != "object" || !("dom" in i)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");
|
|
234
234
|
return i;
|
|
235
235
|
};
|
|
236
|
-
function
|
|
236
|
+
function Ue(e, t = "<br>") {
|
|
237
237
|
let n = e.querySelectorAll("p");
|
|
238
238
|
if (n.length > 1) {
|
|
239
239
|
let e = n[0];
|
|
@@ -245,14 +245,14 @@ function Be(e, t = "<br>") {
|
|
|
245
245
|
}
|
|
246
246
|
//#endregion
|
|
247
247
|
//#region src/util/string.ts
|
|
248
|
-
function
|
|
248
|
+
function O(e) {
|
|
249
249
|
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function We(e) {
|
|
252
252
|
let t = e.split("/");
|
|
253
253
|
return !t.length || t[t.length - 1] === "" ? e : t[t.length - 1];
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function Ge(e) {
|
|
256
256
|
let t = [
|
|
257
257
|
"mp4",
|
|
258
258
|
"webm",
|
|
@@ -273,14 +273,14 @@ function He(e) {
|
|
|
273
273
|
}
|
|
274
274
|
//#endregion
|
|
275
275
|
//#region src/schema/blocks/internal.ts
|
|
276
|
-
function
|
|
276
|
+
function Ke(e) {
|
|
277
277
|
let t = {};
|
|
278
278
|
return Object.entries(e).forEach(([e, n]) => {
|
|
279
279
|
t[e] = {
|
|
280
280
|
default: n.default,
|
|
281
281
|
keepOnSplit: !0,
|
|
282
282
|
parseHTML: (t) => {
|
|
283
|
-
let r = t.getAttribute(
|
|
283
|
+
let r = t.getAttribute(O(e));
|
|
284
284
|
if (r === null) return null;
|
|
285
285
|
if (n.default === void 0 && n.type === "boolean" || n.default !== void 0 && typeof n.default == "boolean") return r === "true" ? !0 : r === "false" ? !1 : null;
|
|
286
286
|
if (n.default === void 0 && n.type === "number" || n.default !== void 0 && typeof n.default == "number") {
|
|
@@ -289,11 +289,11 @@ function Ue(e) {
|
|
|
289
289
|
}
|
|
290
290
|
return r;
|
|
291
291
|
},
|
|
292
|
-
renderHTML: (t) => t[e] === n.default ? {} : { [
|
|
292
|
+
renderHTML: (t) => t[e] === n.default ? {} : { [O(e)]: t[e] }
|
|
293
293
|
};
|
|
294
294
|
}), t;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function qe(e, t, n, r) {
|
|
297
297
|
let i = e();
|
|
298
298
|
if (i === void 0) throw Error("Cannot find node position");
|
|
299
299
|
let a = n.state.doc.resolve(i).node().attrs.id;
|
|
@@ -302,17 +302,17 @@ function We(e, t, n, r) {
|
|
|
302
302
|
if (o.type !== r) throw Error("Block type does not match");
|
|
303
303
|
return o;
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function k(e, t, n, r, i = !1, a) {
|
|
306
306
|
let o = document.createElement("div");
|
|
307
307
|
if (a !== void 0) for (let [e, t] of Object.entries(a)) e !== "class" && o.setAttribute(e, t);
|
|
308
|
-
o.className =
|
|
309
|
-
for (let [e, t] of Object.entries(n)) t !== r[e].default && o.setAttribute(
|
|
310
|
-
return i && o.setAttribute("data-file-block", ""), o.appendChild(e.dom), e.contentDOM && (e.contentDOM.className =
|
|
308
|
+
o.className = D("bn-block-content", a?.class || ""), o.setAttribute("data-content-type", t);
|
|
309
|
+
for (let [e, t] of Object.entries(n)) t !== r[e].default && o.setAttribute(O(e), t);
|
|
310
|
+
return i && o.setAttribute("data-file-block", ""), o.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = D("bn-inline-content", e.contentDOM.className)), {
|
|
311
311
|
...e,
|
|
312
312
|
dom: o
|
|
313
313
|
};
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function Je(e, t, n) {
|
|
316
316
|
return {
|
|
317
317
|
config: {
|
|
318
318
|
type: e.type,
|
|
@@ -321,20 +321,20 @@ function Ge(e, t, n) {
|
|
|
321
321
|
},
|
|
322
322
|
implementation: {
|
|
323
323
|
node: e.node,
|
|
324
|
-
render:
|
|
325
|
-
toExternalHTML:
|
|
324
|
+
render: He,
|
|
325
|
+
toExternalHTML: He
|
|
326
326
|
},
|
|
327
327
|
extensions: n
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
330
|
//#endregion
|
|
331
331
|
//#region src/schema/blocks/createSpec.ts
|
|
332
|
-
function
|
|
332
|
+
function Ye(e, t) {
|
|
333
333
|
e.stopEvent = (e) => (e.type === "mousedown" && setTimeout(() => {
|
|
334
334
|
t.view.dom.blur();
|
|
335
335
|
}, 10), !0);
|
|
336
336
|
}
|
|
337
|
-
function
|
|
337
|
+
function Xe(e, t) {
|
|
338
338
|
let n = [{
|
|
339
339
|
tag: "[data-content-type=" + e.type + "]",
|
|
340
340
|
contentElement: ".bn-inline-content"
|
|
@@ -357,17 +357,17 @@ function qe(e, t) {
|
|
|
357
357
|
}
|
|
358
358
|
if (e.content === "inline") {
|
|
359
359
|
let e = n.cloneNode(!0);
|
|
360
|
-
return
|
|
360
|
+
return Ue(e, t.meta?.code ? "\n" : "<br>"), re.fromSchema(r).parse(e, {
|
|
361
361
|
topNode: r.nodes.paragraph.create(),
|
|
362
362
|
preserveWhitespace: !0
|
|
363
363
|
}).content;
|
|
364
364
|
}
|
|
365
|
-
return
|
|
365
|
+
return ae.empty;
|
|
366
366
|
} : void 0
|
|
367
367
|
}), n;
|
|
368
368
|
}
|
|
369
|
-
function
|
|
370
|
-
let i = t.node ||
|
|
369
|
+
function Ze(e, t, n, r) {
|
|
370
|
+
let i = t.node || u.create({
|
|
371
371
|
name: e.type,
|
|
372
372
|
content: e.content === "inline" ? "inline*" : e.content === "none" ? "" : e.content,
|
|
373
373
|
group: "blockContent",
|
|
@@ -377,26 +377,26 @@ function Je(e, t, n, r) {
|
|
|
377
377
|
defining: t.meta?.defining ?? !0,
|
|
378
378
|
priority: r,
|
|
379
379
|
addAttributes() {
|
|
380
|
-
return
|
|
380
|
+
return Ke(e.propSchema);
|
|
381
381
|
},
|
|
382
382
|
parseHTML() {
|
|
383
|
-
return
|
|
383
|
+
return Xe(e, t);
|
|
384
384
|
},
|
|
385
385
|
renderHTML({ HTMLAttributes: n }) {
|
|
386
386
|
let r = document.createElement("div");
|
|
387
|
-
return
|
|
387
|
+
return k({
|
|
388
388
|
dom: r,
|
|
389
389
|
contentDOM: e.content === "inline" ? r : void 0
|
|
390
390
|
}, e.type, {}, e.propSchema, t.meta?.fileBlockAccept !== void 0, n);
|
|
391
391
|
},
|
|
392
392
|
addNodeView() {
|
|
393
393
|
return (n) => {
|
|
394
|
-
let r = this.options.editor, i =
|
|
394
|
+
let r = this.options.editor, i = qe(n.getPos, r, this.editor, e.type), a = this.options.domAttributes?.blockContent || {}, o = t.render.call({
|
|
395
395
|
blockContentDOMAttributes: a,
|
|
396
396
|
props: n,
|
|
397
397
|
renderType: "nodeView"
|
|
398
398
|
}, i, r);
|
|
399
|
-
return t.meta?.selectable === !1 &&
|
|
399
|
+
return t.meta?.selectable === !1 && Ye(o, this.editor), o;
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
402
|
});
|
|
@@ -426,10 +426,10 @@ function Je(e, t, n, r) {
|
|
|
426
426
|
extensions: n
|
|
427
427
|
};
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function A(e) {
|
|
430
430
|
return e;
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function j(e, t, n) {
|
|
433
433
|
return (r = {}) => {
|
|
434
434
|
let i = typeof e == "function" ? e(r) : e, a = typeof t == "function" ? t(r) : t, o = n ? typeof n == "function" ? n(r) : n : void 0;
|
|
435
435
|
return {
|
|
@@ -438,10 +438,10 @@ function O(e, t, n) {
|
|
|
438
438
|
...a,
|
|
439
439
|
toExternalHTML(e, t, n) {
|
|
440
440
|
let r = a.toExternalHTML?.call({ blockContentDOMAttributes: this.blockContentDOMAttributes }, e, t, n);
|
|
441
|
-
if (r !== void 0) return
|
|
441
|
+
if (r !== void 0) return k(r, e.type, e.props, i.propSchema, a.meta?.fileBlockAccept !== void 0);
|
|
442
442
|
},
|
|
443
443
|
render(e, t) {
|
|
444
|
-
return
|
|
444
|
+
return k(a.render.call({
|
|
445
445
|
blockContentDOMAttributes: this.blockContentDOMAttributes,
|
|
446
446
|
renderType: this.renderType,
|
|
447
447
|
props: this.props
|
|
@@ -454,7 +454,7 @@ function O(e, t, n) {
|
|
|
454
454
|
}
|
|
455
455
|
//#endregion
|
|
456
456
|
//#region src/api/getBlockInfoFromPos.ts
|
|
457
|
-
function
|
|
457
|
+
function Qe(e, t) {
|
|
458
458
|
let n = e.resolve(t);
|
|
459
459
|
if (n.nodeAfter && n.nodeAfter.type.isInGroup("bnBlock")) return {
|
|
460
460
|
posBeforeNode: n.pos,
|
|
@@ -478,7 +478,7 @@ function Ye(e, t) {
|
|
|
478
478
|
node: o.nodeAfter
|
|
479
479
|
};
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function $e(e, t) {
|
|
482
482
|
if (!e.type.isInGroup("bnBlock")) throw Error(`Attempted to get bnBlock node at position but found node of different type ${e.type.name}`);
|
|
483
483
|
let n = e, r = t, i = {
|
|
484
484
|
node: n,
|
|
@@ -521,45 +521,45 @@ function Xe(e, t) {
|
|
|
521
521
|
};
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
|
-
function
|
|
525
|
-
return
|
|
524
|
+
function M(e) {
|
|
525
|
+
return $e(e.node, e.posBeforeNode);
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function et(e) {
|
|
528
528
|
if (!e.nodeAfter) throw Error(`Attempted to get blockContainer node at position ${e.pos} but a node at this position does not exist`);
|
|
529
|
-
return
|
|
529
|
+
return $e(e.nodeAfter, e.pos);
|
|
530
530
|
}
|
|
531
|
-
function
|
|
532
|
-
return
|
|
531
|
+
function tt(e) {
|
|
532
|
+
return M(Qe(e.doc, e.selection.anchor));
|
|
533
533
|
}
|
|
534
|
-
function
|
|
535
|
-
return
|
|
534
|
+
function nt(e) {
|
|
535
|
+
return M(Qe(e.doc, e.selection.anchor));
|
|
536
536
|
}
|
|
537
537
|
//#endregion
|
|
538
538
|
//#region src/api/pmUtil.ts
|
|
539
|
-
function
|
|
539
|
+
function N(e) {
|
|
540
540
|
return "doc" in e ? e.doc.type.schema : e.type.schema;
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function rt(e) {
|
|
543
543
|
return e.cached.blockNoteEditor;
|
|
544
544
|
}
|
|
545
|
-
function
|
|
546
|
-
return
|
|
545
|
+
function it(e) {
|
|
546
|
+
return rt(e).schema;
|
|
547
547
|
}
|
|
548
|
-
function
|
|
549
|
-
return
|
|
548
|
+
function at(e) {
|
|
549
|
+
return it(e).blockSchema;
|
|
550
550
|
}
|
|
551
|
-
function
|
|
552
|
-
return
|
|
551
|
+
function ot(e) {
|
|
552
|
+
return it(e).inlineContentSchema;
|
|
553
553
|
}
|
|
554
554
|
function P(e) {
|
|
555
|
-
return
|
|
555
|
+
return it(e).styleSchema;
|
|
556
556
|
}
|
|
557
557
|
function F(e) {
|
|
558
|
-
return
|
|
558
|
+
return rt(e).blockCache;
|
|
559
559
|
}
|
|
560
560
|
//#endregion
|
|
561
561
|
//#region src/api/nodeConversions/nodeToBlock.ts
|
|
562
|
-
function
|
|
562
|
+
function st(e, t, n) {
|
|
563
563
|
let r = {
|
|
564
564
|
type: "tableContent",
|
|
565
565
|
columnWidths: [],
|
|
@@ -574,10 +574,10 @@ function tt(e, t, n) {
|
|
|
574
574
|
t ??= Array(e.attrs.colspan ?? 1).fill(void 0), r.columnWidths.push(...t);
|
|
575
575
|
}), s.cells = e.content.content.map((e, r) => (i[o] || (i[o] = []), i[o][r] = e.type.name === "tableHeader", {
|
|
576
576
|
type: "tableCell",
|
|
577
|
-
content: e.content.content.map((e) =>
|
|
577
|
+
content: e.content.content.map((e) => I(e, t, n)).reduce((e, t) => {
|
|
578
578
|
if (!e.length) return t;
|
|
579
579
|
let n = e[e.length - 1], r = t[0];
|
|
580
|
-
return r &&
|
|
580
|
+
return r && b(n) && b(r) && JSON.stringify(n.styles) === JSON.stringify(r.styles) ? (n.text += "\n" + r.text, e.push(...t.slice(1)), e) : (e.push(...t), e);
|
|
581
581
|
}, []),
|
|
582
582
|
props: {
|
|
583
583
|
colspan: e.attrs.colspan,
|
|
@@ -592,12 +592,12 @@ function tt(e, t, n) {
|
|
|
592
592
|
for (let e = 0; e < i[0]?.length; e++) i?.every((t) => t[e]) && (r.headerCols = (r.headerCols ?? 0) + 1);
|
|
593
593
|
return r;
|
|
594
594
|
}
|
|
595
|
-
function
|
|
595
|
+
function I(e, t, n) {
|
|
596
596
|
let r = [], i;
|
|
597
597
|
return e.content.forEach((e) => {
|
|
598
598
|
if (e.type.name === "hardBreak") {
|
|
599
|
-
if (i) if (
|
|
600
|
-
else if (
|
|
599
|
+
if (i) if (b(i)) i.text += "\n";
|
|
600
|
+
else if (Fe(i)) i.content[i.content.length - 1].text += "\n";
|
|
601
601
|
else throw Error("unexpected");
|
|
602
602
|
else i = {
|
|
603
603
|
type: "text",
|
|
@@ -611,7 +611,7 @@ function nt(e, t, n) {
|
|
|
611
611
|
console.warn("unrecognized inline content type", e.type.name);
|
|
612
612
|
return;
|
|
613
613
|
}
|
|
614
|
-
i &&= (r.push(i), void 0), r.push(
|
|
614
|
+
i &&= (r.push(i), void 0), r.push(ct(e, t, n));
|
|
615
615
|
return;
|
|
616
616
|
}
|
|
617
617
|
let a = {}, o;
|
|
@@ -624,9 +624,9 @@ function nt(e, t, n) {
|
|
|
624
624
|
}
|
|
625
625
|
if (e.propSchema === "boolean") a[e.type] = !0;
|
|
626
626
|
else if (e.propSchema === "string") a[e.type] = t.attrs.stringValue;
|
|
627
|
-
else throw new
|
|
627
|
+
else throw new T(e.propSchema);
|
|
628
628
|
}
|
|
629
|
-
i ?
|
|
629
|
+
i ? b(i) ? o ? (r.push(i), i = {
|
|
630
630
|
type: "link",
|
|
631
631
|
href: o.attrs.href,
|
|
632
632
|
content: [{
|
|
@@ -638,7 +638,7 @@ function nt(e, t, n) {
|
|
|
638
638
|
type: "text",
|
|
639
639
|
text: e.textContent,
|
|
640
640
|
styles: a
|
|
641
|
-
}) :
|
|
641
|
+
}) : Fe(i) && (o ? i.href === o.attrs.href ? JSON.stringify(i.content[i.content.length - 1].styles) === JSON.stringify(a) ? i.content[i.content.length - 1].text += e.textContent : i.content.push({
|
|
642
642
|
type: "text",
|
|
643
643
|
text: e.textContent,
|
|
644
644
|
styles: a
|
|
@@ -669,7 +669,7 @@ function nt(e, t, n) {
|
|
|
669
669
|
};
|
|
670
670
|
}), i && r.push(i), r;
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function ct(e, t, n) {
|
|
673
673
|
if (e.type.name === "text" || e.type.name === "link") throw Error("unexpected");
|
|
674
674
|
let r = {}, i = t[e.type.name];
|
|
675
675
|
for (let [t, n] of Object.entries(e.attrs)) {
|
|
@@ -677,18 +677,18 @@ function rt(e, t, n) {
|
|
|
677
677
|
t in i.propSchema && (r[t] = n);
|
|
678
678
|
}
|
|
679
679
|
let a;
|
|
680
|
-
return a = i.content === "styled" ?
|
|
680
|
+
return a = i.content === "styled" ? I(e, t, n) : void 0, {
|
|
681
681
|
type: e.type.name,
|
|
682
682
|
props: r,
|
|
683
683
|
content: a
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function L(e, t, n = at(t), r = ot(t), i = P(t), a = F(t)) {
|
|
687
687
|
if (!e.type.isInGroup("bnBlock")) throw Error("Node should be a bnBlock, but is instead: " + e.type.name);
|
|
688
688
|
let o = a?.get(e);
|
|
689
689
|
if (o) return o;
|
|
690
|
-
let s =
|
|
691
|
-
c === null && (c =
|
|
690
|
+
let s = $e(e, 0), c = s.bnBlock.node.attrs.id;
|
|
691
|
+
c === null && (c = Pe.options.generateID());
|
|
692
692
|
let l = n[s.blockNoteType];
|
|
693
693
|
if (!l) throw Error("Block is of an unrecognized type: " + s.blockNoteType);
|
|
694
694
|
let u = {};
|
|
@@ -701,17 +701,17 @@ function I(e, t, n = M(t), r = N(t), i = P(t), a = F(t)) {
|
|
|
701
701
|
}
|
|
702
702
|
let d = n[s.blockNoteType], f = [];
|
|
703
703
|
s.childContainer?.node.forEach((e) => {
|
|
704
|
-
f.push(
|
|
704
|
+
f.push(L(e, t, n, r, i, a));
|
|
705
705
|
});
|
|
706
706
|
let p;
|
|
707
707
|
if (d.content === "inline") {
|
|
708
708
|
if (!s.isBlockContainer) throw Error("impossible");
|
|
709
|
-
p =
|
|
709
|
+
p = I(s.blockContent.node, r, i);
|
|
710
710
|
} else if (d.content === "table") {
|
|
711
711
|
if (!s.isBlockContainer) throw Error("impossible");
|
|
712
|
-
p =
|
|
712
|
+
p = st(s.blockContent.node, r, i);
|
|
713
713
|
} else if (d.content === "none") p = void 0;
|
|
714
|
-
else throw new
|
|
714
|
+
else throw new T(d.content);
|
|
715
715
|
let m = {
|
|
716
716
|
id: c,
|
|
717
717
|
type: d.type,
|
|
@@ -721,11 +721,11 @@ function I(e, t, n = M(t), r = N(t), i = P(t), a = F(t)) {
|
|
|
721
721
|
};
|
|
722
722
|
return a?.set(e, m), m;
|
|
723
723
|
}
|
|
724
|
-
function
|
|
724
|
+
function lt(e, t = N(e), n = at(t), r = ot(t), i = P(t), a = F(t)) {
|
|
725
725
|
let o = [];
|
|
726
|
-
return e.firstChild && e.firstChild.descendants((e) => (o.push(
|
|
726
|
+
return e.firstChild && e.firstChild.descendants((e) => (o.push(L(e, t, n, r, i, a)), !1)), o;
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function ut(e, t, n = at(t), r = ot(t), i = P(t), a = F(t)) {
|
|
729
729
|
function o(e, s, c) {
|
|
730
730
|
if (e.type.name !== "blockGroup") throw Error("unexpected");
|
|
731
731
|
let l = [], u, d;
|
|
@@ -740,7 +740,7 @@ function at(e, t, n = M(t), r = N(t), i = P(t), a = F(t)) {
|
|
|
740
740
|
u = e.blockCutAtStart, g && (d = e.blockCutAtEnd), l.push(...e.blocks);
|
|
741
741
|
return;
|
|
742
742
|
}
|
|
743
|
-
let _ =
|
|
743
|
+
let _ = L(f, t, n, r, i, a), v = f.childCount > 1 ? f.child(1) : void 0, ee = [];
|
|
744
744
|
if (v) {
|
|
745
745
|
let e = o(v, 0, g ? Math.max(0, c - 1) : 0);
|
|
746
746
|
ee = e.blocks, g && (d = e.blockCutAtEnd);
|
|
@@ -765,23 +765,23 @@ function at(e, t, n = M(t), r = N(t), i = P(t), a = F(t)) {
|
|
|
765
765
|
}
|
|
766
766
|
//#endregion
|
|
767
767
|
//#region src/schema/inlineContent/internal.ts
|
|
768
|
-
function
|
|
769
|
-
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([e, t]) => t !== r[e].default).map(([e, t]) => [
|
|
768
|
+
function dt(e, t, n, r) {
|
|
769
|
+
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([e, t]) => t !== r[e].default).map(([e, t]) => [O(e), t]).forEach(([t, n]) => e.dom.setAttribute(t, n)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function ft(e) {
|
|
772
772
|
return { Backspace: ({ editor: t }) => {
|
|
773
773
|
let n = t.state.selection.$from;
|
|
774
774
|
return t.state.selection.empty && n.node().type.name === e.type && n.parentOffset === 0;
|
|
775
775
|
} };
|
|
776
776
|
}
|
|
777
|
-
function
|
|
777
|
+
function pt(e, t) {
|
|
778
778
|
return {
|
|
779
779
|
config: e,
|
|
780
780
|
implementation: t
|
|
781
781
|
};
|
|
782
782
|
}
|
|
783
|
-
function
|
|
784
|
-
return
|
|
783
|
+
function mt(e, t, n) {
|
|
784
|
+
return pt({
|
|
785
785
|
type: e.name,
|
|
786
786
|
propSchema: t,
|
|
787
787
|
content: e.config.content === "inline*" ? "styled" : "none"
|
|
@@ -790,12 +790,12 @@ function lt(e, t, n) {
|
|
|
790
790
|
node: e
|
|
791
791
|
});
|
|
792
792
|
}
|
|
793
|
-
function
|
|
793
|
+
function ht(e) {
|
|
794
794
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
|
|
795
795
|
}
|
|
796
796
|
//#endregion
|
|
797
797
|
//#region src/schema/styles/internal.ts
|
|
798
|
-
function
|
|
798
|
+
function gt(e) {
|
|
799
799
|
return e === "boolean" ? {} : { stringValue: {
|
|
800
800
|
default: void 0,
|
|
801
801
|
keepOnSplit: !0,
|
|
@@ -803,17 +803,17 @@ function dt(e) {
|
|
|
803
803
|
renderHTML: (e) => e.stringValue === void 0 ? {} : { "data-value": e.stringValue }
|
|
804
804
|
} };
|
|
805
805
|
}
|
|
806
|
-
function
|
|
806
|
+
function R(e, t, n, r) {
|
|
807
807
|
return e.dom.setAttribute("data-style-type", t), r === "string" && e.dom.setAttribute("data-value", n), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
808
808
|
}
|
|
809
|
-
function
|
|
809
|
+
function _t(e, t) {
|
|
810
810
|
return {
|
|
811
811
|
config: e,
|
|
812
812
|
implementation: t
|
|
813
813
|
};
|
|
814
814
|
}
|
|
815
|
-
function
|
|
816
|
-
return
|
|
815
|
+
function z(e, t) {
|
|
816
|
+
return _t({
|
|
817
817
|
type: e.name,
|
|
818
818
|
propSchema: t
|
|
819
819
|
}, {
|
|
@@ -821,25 +821,25 @@ function R(e, t) {
|
|
|
821
821
|
render(t, n) {
|
|
822
822
|
let r = n.pmSchema.marks[e.name].spec.toDOM;
|
|
823
823
|
if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
|
|
824
|
-
let i = n.pmSchema.mark(e.name, { stringValue: t }), a =
|
|
824
|
+
let i = n.pmSchema.mark(e.name, { stringValue: t }), a = ie.renderSpec(document, r(i, !0));
|
|
825
825
|
if (typeof a != "object" || !("dom" in a)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");
|
|
826
826
|
return a;
|
|
827
827
|
},
|
|
828
828
|
toExternalHTML(t, n) {
|
|
829
829
|
let r = n.pmSchema.marks[e.name].spec.toDOM;
|
|
830
830
|
if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
|
|
831
|
-
let i = n.pmSchema.mark(e.name, { stringValue: t }), a =
|
|
831
|
+
let i = n.pmSchema.mark(e.name, { stringValue: t }), a = ie.renderSpec(document, r(i, !0));
|
|
832
832
|
if (typeof a != "object" || !("dom" in a)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");
|
|
833
833
|
return a;
|
|
834
834
|
}
|
|
835
835
|
});
|
|
836
836
|
}
|
|
837
|
-
function
|
|
837
|
+
function vt(e) {
|
|
838
838
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
|
|
839
839
|
}
|
|
840
840
|
//#endregion
|
|
841
841
|
//#region src/schema/styles/createSpec.ts
|
|
842
|
-
function
|
|
842
|
+
function yt(e, t) {
|
|
843
843
|
let n = [{
|
|
844
844
|
tag: `[data-style-type="${e.type}"]`,
|
|
845
845
|
contentElement: (e) => {
|
|
@@ -857,33 +857,33 @@ function mt(e, t) {
|
|
|
857
857
|
}
|
|
858
858
|
}), n;
|
|
859
859
|
}
|
|
860
|
-
function
|
|
861
|
-
let n =
|
|
860
|
+
function bt(e, t) {
|
|
861
|
+
let n = l.create({
|
|
862
862
|
name: e.type,
|
|
863
863
|
addAttributes() {
|
|
864
|
-
return
|
|
864
|
+
return gt(e.propSchema);
|
|
865
865
|
},
|
|
866
866
|
parseHTML() {
|
|
867
|
-
return
|
|
867
|
+
return yt(e, t.parse);
|
|
868
868
|
},
|
|
869
869
|
renderHTML({ mark: n }) {
|
|
870
|
-
return
|
|
870
|
+
return R((t.toExternalHTML || t.render)(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
|
|
871
871
|
},
|
|
872
872
|
addMarkView() {
|
|
873
|
-
return ({ mark: n }) =>
|
|
873
|
+
return ({ mark: n }) => R(t.render(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
|
|
874
874
|
}
|
|
875
875
|
});
|
|
876
|
-
return
|
|
876
|
+
return _t(e, {
|
|
877
877
|
...t,
|
|
878
878
|
mark: n,
|
|
879
|
-
render: (n) =>
|
|
880
|
-
toExternalHTML: (n) =>
|
|
879
|
+
render: (n) => R(t.render(n), e.type, n, e.propSchema),
|
|
880
|
+
toExternalHTML: (n) => R((t.toExternalHTML || t.render)(n), e.type, n, e.propSchema)
|
|
881
881
|
});
|
|
882
882
|
}
|
|
883
883
|
//#endregion
|
|
884
884
|
//#region src/util/topo-sort.ts
|
|
885
|
-
function
|
|
886
|
-
let t =
|
|
885
|
+
function xt(e) {
|
|
886
|
+
let t = Ct(e), { roots: n, nonRoots: r } = wt(t), i = [];
|
|
887
887
|
for (; n.size;) {
|
|
888
888
|
i.push(n);
|
|
889
889
|
let r = /* @__PURE__ */ new Set();
|
|
@@ -898,13 +898,13 @@ function gt(e) {
|
|
|
898
898
|
}
|
|
899
899
|
n = r;
|
|
900
900
|
}
|
|
901
|
-
if (r =
|
|
901
|
+
if (r = wt(t).nonRoots, r.size) throw Error(`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(r).join(", ")}`);
|
|
902
902
|
return i;
|
|
903
903
|
}
|
|
904
|
-
function
|
|
905
|
-
return
|
|
904
|
+
function St(e) {
|
|
905
|
+
return xt(Tt(e));
|
|
906
906
|
}
|
|
907
|
-
function
|
|
907
|
+
function Ct(e) {
|
|
908
908
|
let t = /* @__PURE__ */ new Map();
|
|
909
909
|
for (let [n, r] of e.entries()) {
|
|
910
910
|
t.has(n) || t.set(n, 0);
|
|
@@ -915,7 +915,7 @@ function vt(e) {
|
|
|
915
915
|
}
|
|
916
916
|
return t;
|
|
917
917
|
}
|
|
918
|
-
function
|
|
918
|
+
function wt(e) {
|
|
919
919
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
920
920
|
for (let [r, i] of e.entries()) i === 0 ? t.add(r) : n.add(r);
|
|
921
921
|
return {
|
|
@@ -923,7 +923,7 @@ function yt(e) {
|
|
|
923
923
|
nonRoots: n
|
|
924
924
|
};
|
|
925
925
|
}
|
|
926
|
-
function
|
|
926
|
+
function Tt(e) {
|
|
927
927
|
let t = /* @__PURE__ */ new Map();
|
|
928
928
|
for (let [n, r] of e.entries()) {
|
|
929
929
|
t.has(n) || t.set(n, /* @__PURE__ */ new Set());
|
|
@@ -931,26 +931,26 @@ function bt(e) {
|
|
|
931
931
|
}
|
|
932
932
|
return t;
|
|
933
933
|
}
|
|
934
|
-
function
|
|
934
|
+
function Et() {
|
|
935
935
|
return /* @__PURE__ */ new Map();
|
|
936
936
|
}
|
|
937
|
-
function
|
|
937
|
+
function Dt(e, t, n) {
|
|
938
938
|
return e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n), e;
|
|
939
939
|
}
|
|
940
|
-
function
|
|
941
|
-
let t =
|
|
940
|
+
function Ot(e) {
|
|
941
|
+
let t = Et();
|
|
942
942
|
for (let n of e) Array.isArray(n.runsBefore) && n.runsBefore.length > 0 ? n.runsBefore.forEach((e) => {
|
|
943
|
-
|
|
944
|
-
}) :
|
|
945
|
-
let n =
|
|
943
|
+
Dt(t, n.key, e);
|
|
944
|
+
}) : Dt(t, "default", n.key);
|
|
945
|
+
let n = St(t), r = n.findIndex((e) => e.has("default"));
|
|
946
946
|
return (e) => 91 + (n.findIndex((t) => t.has(e)) + r) * 10;
|
|
947
947
|
}
|
|
948
948
|
//#endregion
|
|
949
949
|
//#region src/schema/schema.ts
|
|
950
|
-
function
|
|
950
|
+
function kt(e) {
|
|
951
951
|
return e && Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
|
|
952
952
|
}
|
|
953
|
-
var
|
|
953
|
+
var At = class {
|
|
954
954
|
BlockNoteEditor = "only for types";
|
|
955
955
|
Block = "only for types";
|
|
956
956
|
PartialBlock = "only for types";
|
|
@@ -966,14 +966,14 @@ var Tt = class {
|
|
|
966
966
|
this.blockSpecs = t, this.styleSpecs = r, this.styleSchema = o, this.inlineContentSpecs = n, this.blockSchema = i, this.inlineContentSchema = a;
|
|
967
967
|
}
|
|
968
968
|
init() {
|
|
969
|
-
let e =
|
|
969
|
+
let e = Ot(Object.entries({
|
|
970
970
|
...this.opts.blockSpecs,
|
|
971
971
|
...this.opts.inlineContentSpecs,
|
|
972
972
|
...this.opts.styleSpecs
|
|
973
973
|
}).map(([e, t]) => ({
|
|
974
974
|
key: e,
|
|
975
975
|
runsBefore: t.implementation?.runsBefore ?? []
|
|
976
|
-
}))), t = Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([t, n]) => [t,
|
|
976
|
+
}))), t = Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([t, n]) => [t, Ze(n.config, n.implementation, n.extensions, e(t))])), n = Object.fromEntries(Object.entries(this.opts.inlineContentSpecs).map(([t, n]) => typeof n.config == "object" ? [t, {
|
|
977
977
|
...n,
|
|
978
978
|
implementation: {
|
|
979
979
|
...n.implementation,
|
|
@@ -989,10 +989,10 @@ var Tt = class {
|
|
|
989
989
|
return {
|
|
990
990
|
blockSpecs: t,
|
|
991
991
|
blockSchema: Object.fromEntries(Object.entries(t).map(([e, t]) => [e, t.config])),
|
|
992
|
-
inlineContentSpecs:
|
|
993
|
-
styleSpecs:
|
|
994
|
-
inlineContentSchema:
|
|
995
|
-
styleSchema:
|
|
992
|
+
inlineContentSpecs: kt(n),
|
|
993
|
+
styleSpecs: kt(r),
|
|
994
|
+
inlineContentSchema: ht(n),
|
|
995
|
+
styleSchema: vt(r)
|
|
996
996
|
};
|
|
997
997
|
}
|
|
998
998
|
extend(e) {
|
|
@@ -1003,8 +1003,8 @@ var Tt = class {
|
|
|
1003
1003
|
};
|
|
1004
1004
|
//#endregion
|
|
1005
1005
|
//#region src/api/blockManipulation/tables/tables.ts
|
|
1006
|
-
function
|
|
1007
|
-
let { height: t, width: n } =
|
|
1006
|
+
function B(e) {
|
|
1007
|
+
let { height: t, width: n } = jt(e), r = Array(t).fill(!1).map(() => Array(n).fill(null)), i = (e, i) => {
|
|
1008
1008
|
for (let a = e; a < t; a++) for (let e = i; e < n; e++) if (!r[a][e]) return {
|
|
1009
1009
|
row: a,
|
|
1010
1010
|
col: e
|
|
@@ -1012,7 +1012,7 @@ function z(e) {
|
|
|
1012
1012
|
throw Error("Unable to create occupancy grid for table, no more available cells");
|
|
1013
1013
|
};
|
|
1014
1014
|
for (let t = 0; t < e.content.rows.length; t++) for (let n = 0; n < e.content.rows[t].cells.length; n++) {
|
|
1015
|
-
let a =
|
|
1015
|
+
let a = x(e.content.rows[t].cells[n]), o = Le(a), s = w(a), { row: c, col: l } = i(t, n);
|
|
1016
1016
|
for (let e = c; e < c + o; e++) for (let i = l; i < l + s; i++) {
|
|
1017
1017
|
if (r[e][i]) throw Error(`Unable to create occupancy grid for table, cell at ${e},${i} is already occupied`);
|
|
1018
1018
|
r[e][i] = {
|
|
@@ -1026,11 +1026,11 @@ function z(e) {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
return r;
|
|
1028
1028
|
}
|
|
1029
|
-
function
|
|
1029
|
+
function V(e) {
|
|
1030
1030
|
let t = /* @__PURE__ */ new Set();
|
|
1031
1031
|
return e.map((e) => ({ cells: e.map((e) => t.has(e.row + ":" + e.col) ? !1 : (t.add(e.row + ":" + e.col), e.cell)).filter((e) => e !== !1) }));
|
|
1032
1032
|
}
|
|
1033
|
-
function
|
|
1033
|
+
function H(e, t, n = B(t)) {
|
|
1034
1034
|
for (let t = 0; t < n.length; t++) for (let r = 0; r < n[t].length; r++) {
|
|
1035
1035
|
let i = n[t][r];
|
|
1036
1036
|
if (i && i.row === e.row && i.col === e.col) return {
|
|
@@ -1041,19 +1041,19 @@ function V(e, t, n = z(t)) {
|
|
|
1041
1041
|
}
|
|
1042
1042
|
throw Error(`Unable to resolve relative table cell indices for table, cell at ${e.row},${e.col} is not occupied`);
|
|
1043
1043
|
}
|
|
1044
|
-
function
|
|
1044
|
+
function jt(e) {
|
|
1045
1045
|
let t = e.content.rows.length, n = 0;
|
|
1046
1046
|
return e.content.rows.forEach((e) => {
|
|
1047
1047
|
let t = 0;
|
|
1048
1048
|
e.cells.forEach((e) => {
|
|
1049
|
-
t +=
|
|
1049
|
+
t += w(e);
|
|
1050
1050
|
}), n = Math.max(n, t);
|
|
1051
1051
|
}), {
|
|
1052
1052
|
height: t,
|
|
1053
1053
|
width: n
|
|
1054
1054
|
};
|
|
1055
1055
|
}
|
|
1056
|
-
function
|
|
1056
|
+
function Mt(e, t, n = B(t)) {
|
|
1057
1057
|
let r = n[e.row]?.[e.col];
|
|
1058
1058
|
if (r) return {
|
|
1059
1059
|
row: r.row,
|
|
@@ -1061,8 +1061,8 @@ function Dt(e, t, n = z(t)) {
|
|
|
1061
1061
|
cell: r.cell
|
|
1062
1062
|
};
|
|
1063
1063
|
}
|
|
1064
|
-
function
|
|
1065
|
-
let n =
|
|
1064
|
+
function Nt(e, t) {
|
|
1065
|
+
let n = B(e);
|
|
1066
1066
|
if (t < 0 || t >= n.length) return [];
|
|
1067
1067
|
let r = 0;
|
|
1068
1068
|
for (let e = 0; e < t; e++) {
|
|
@@ -1070,14 +1070,14 @@ function Ot(e, t) {
|
|
|
1070
1070
|
if (!e) return [];
|
|
1071
1071
|
r += e.rowspan;
|
|
1072
1072
|
}
|
|
1073
|
-
let i = Array(n[0].length).fill(!1).map((t, i) =>
|
|
1073
|
+
let i = Array(n[0].length).fill(!1).map((t, i) => Mt({
|
|
1074
1074
|
row: r,
|
|
1075
1075
|
col: i
|
|
1076
1076
|
}, e, n)).filter((e) => e !== void 0);
|
|
1077
1077
|
return i.filter((e, t) => i.findIndex((t) => t.row === e.row && t.col === e.col) === t);
|
|
1078
1078
|
}
|
|
1079
|
-
function
|
|
1080
|
-
let n =
|
|
1079
|
+
function Pt(e, t) {
|
|
1080
|
+
let n = B(e);
|
|
1081
1081
|
if (t < 0 || t >= n[0].length) return [];
|
|
1082
1082
|
let r = 0;
|
|
1083
1083
|
for (let e = 0; e < t; e++) {
|
|
@@ -1085,62 +1085,62 @@ function kt(e, t) {
|
|
|
1085
1085
|
if (!e) return [];
|
|
1086
1086
|
r += e.colspan;
|
|
1087
1087
|
}
|
|
1088
|
-
let i = Array(n.length).fill(!1).map((t, i) =>
|
|
1088
|
+
let i = Array(n.length).fill(!1).map((t, i) => Mt({
|
|
1089
1089
|
row: i,
|
|
1090
1090
|
col: r
|
|
1091
1091
|
}, e, n)).filter((e) => e !== void 0);
|
|
1092
1092
|
return i.filter((e, t) => i.findIndex((t) => t.row === e.row && t.col === e.col) === t);
|
|
1093
1093
|
}
|
|
1094
|
-
function
|
|
1095
|
-
let { col: i } =
|
|
1094
|
+
function Ft(e, t, n, r = B(e)) {
|
|
1095
|
+
let { col: i } = H({
|
|
1096
1096
|
row: 0,
|
|
1097
1097
|
col: t
|
|
1098
|
-
}, e, r), { col: a } =
|
|
1098
|
+
}, e, r), { col: a } = H({
|
|
1099
1099
|
row: 0,
|
|
1100
1100
|
col: n
|
|
1101
1101
|
}, e, r);
|
|
1102
1102
|
return r.forEach((e) => {
|
|
1103
1103
|
let [t] = e.splice(i, 1);
|
|
1104
1104
|
e.splice(a, 0, t);
|
|
1105
|
-
}),
|
|
1105
|
+
}), V(r);
|
|
1106
1106
|
}
|
|
1107
|
-
function
|
|
1108
|
-
let { row: i } =
|
|
1107
|
+
function It(e, t, n, r = B(e)) {
|
|
1108
|
+
let { row: i } = H({
|
|
1109
1109
|
row: t,
|
|
1110
1110
|
col: 0
|
|
1111
|
-
}, e, r), { row: a } =
|
|
1111
|
+
}, e, r), { row: a } = H({
|
|
1112
1112
|
row: n,
|
|
1113
1113
|
col: 0
|
|
1114
1114
|
}, e, r), [o] = r.splice(i, 1);
|
|
1115
|
-
return r.splice(a, 0, o),
|
|
1115
|
+
return r.splice(a, 0, o), V(r);
|
|
1116
1116
|
}
|
|
1117
|
-
function
|
|
1118
|
-
return e ?
|
|
1117
|
+
function Lt(e) {
|
|
1118
|
+
return e ? S(e) ? Lt(e.content) : typeof e == "string" ? e.length === 0 : Array.isArray(e) ? e.every((e) => typeof e == "string" ? e.length === 0 : b(e) ? e.text.length === 0 : Ie(e) ? typeof e.content == "string" ? e.content.length === 0 : e.content.every((e) => e.text.length === 0) : !1) : !1 : !0;
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function Rt(e, t, n = B(e)) {
|
|
1121
1121
|
if (t === "columns") {
|
|
1122
1122
|
let e = 0;
|
|
1123
|
-
for (let t = n[0].length - 1; t >= 0 && n.every((e) =>
|
|
1123
|
+
for (let t = n[0].length - 1; t >= 0 && n.every((e) => Lt(e[t].cell) && e[t].colspan === 1); t--) e++;
|
|
1124
1124
|
for (let t = n.length - 1; t >= 0; t--) {
|
|
1125
1125
|
let r = Math.max(n[t].length - e, 1);
|
|
1126
1126
|
n[t] = n[t].slice(0, r);
|
|
1127
1127
|
}
|
|
1128
|
-
return
|
|
1128
|
+
return V(n);
|
|
1129
1129
|
}
|
|
1130
1130
|
let r = 0;
|
|
1131
|
-
for (let e = n.length - 1; e >= 0 && n[e].every((e) =>
|
|
1131
|
+
for (let e = n.length - 1; e >= 0 && n[e].every((e) => Lt(e.cell) && e.rowspan === 1); e--) r++;
|
|
1132
1132
|
let i = Math.min(r, n.length - 1);
|
|
1133
|
-
return n.splice(n.length - i, i),
|
|
1133
|
+
return n.splice(n.length - i, i), V(n);
|
|
1134
1134
|
}
|
|
1135
|
-
function
|
|
1136
|
-
let { width: i, height: a } =
|
|
1135
|
+
function zt(e, t, n, r = B(e)) {
|
|
1136
|
+
let { width: i, height: a } = jt(e);
|
|
1137
1137
|
if (t === "columns") r.forEach((e, t) => {
|
|
1138
1138
|
if (n >= 0) for (let r = 0; r < n; r++) e.push({
|
|
1139
1139
|
row: t,
|
|
1140
1140
|
col: Math.max(...e.map((e) => e.col)) + 1,
|
|
1141
1141
|
rowspan: 1,
|
|
1142
1142
|
colspan: 1,
|
|
1143
|
-
cell:
|
|
1143
|
+
cell: x("")
|
|
1144
1144
|
});
|
|
1145
1145
|
else e.splice(i + n, -1 * n);
|
|
1146
1146
|
});
|
|
@@ -1150,77 +1150,77 @@ function Pt(e, t, n, r = z(e)) {
|
|
|
1150
1150
|
col: n,
|
|
1151
1151
|
rowspan: 1,
|
|
1152
1152
|
colspan: 1,
|
|
1153
|
-
cell:
|
|
1153
|
+
cell: x("")
|
|
1154
1154
|
}));
|
|
1155
1155
|
r.push(t);
|
|
1156
1156
|
}
|
|
1157
1157
|
else n < 0 && r.splice(a + n, -1 * n);
|
|
1158
|
-
return
|
|
1158
|
+
return V(r);
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1161
|
-
let r =
|
|
1162
|
-
if (!r.some((e) =>
|
|
1160
|
+
function Bt(e, t, n) {
|
|
1161
|
+
let r = Nt(e, n);
|
|
1162
|
+
if (!r.some((e) => Le(e.cell) > 1)) return !0;
|
|
1163
1163
|
let i = n, a = n;
|
|
1164
1164
|
return r.forEach((e) => {
|
|
1165
|
-
let t =
|
|
1165
|
+
let t = Le(e.cell);
|
|
1166
1166
|
i = Math.max(i, e.row + t - 1), a = Math.min(a, e.row);
|
|
1167
1167
|
}), t < n ? n === i : n === a;
|
|
1168
1168
|
}
|
|
1169
|
-
function
|
|
1170
|
-
let r =
|
|
1171
|
-
if (!r.some((e) =>
|
|
1169
|
+
function Vt(e, t, n) {
|
|
1170
|
+
let r = Pt(e, n);
|
|
1171
|
+
if (!r.some((e) => w(e.cell) > 1)) return !0;
|
|
1172
1172
|
let i = n, a = n;
|
|
1173
1173
|
return r.forEach((e) => {
|
|
1174
|
-
let t =
|
|
1174
|
+
let t = w(e.cell);
|
|
1175
1175
|
i = Math.max(i, e.col + t - 1), a = Math.min(a, e.col);
|
|
1176
1176
|
}), t < n ? n === i : n === a;
|
|
1177
1177
|
}
|
|
1178
|
-
function
|
|
1179
|
-
let r =
|
|
1178
|
+
function Ht(e, t, n) {
|
|
1179
|
+
let r = H(e, n), i = H(t, n);
|
|
1180
1180
|
return r.col === i.col;
|
|
1181
1181
|
}
|
|
1182
1182
|
//#endregion
|
|
1183
1183
|
//#region src/api/nodeConversions/blockToNode.ts
|
|
1184
|
-
function
|
|
1184
|
+
function Ut(e, t, n, r) {
|
|
1185
1185
|
let i = [];
|
|
1186
1186
|
for (let [r, a] of Object.entries(e.styles || {})) {
|
|
1187
1187
|
let e = n[r];
|
|
1188
1188
|
if (!e) throw Error(`style ${r} not found in styleSchema`);
|
|
1189
1189
|
if (e.propSchema === "boolean") a && i.push(t.mark(r));
|
|
1190
1190
|
else if (e.propSchema === "string") a && i.push(t.mark(r, { stringValue: a }));
|
|
1191
|
-
else throw new
|
|
1191
|
+
else throw new T(e.propSchema);
|
|
1192
1192
|
}
|
|
1193
1193
|
return !r || !t.nodes[r].spec.code ? e.text.split(/(\n)/g).filter((e) => e.length > 0).map((e) => e === "\n" ? t.nodes.hardBreak.createChecked() : t.text(e, i)) : e.text.length > 0 ? [t.text(e.text, i)] : [];
|
|
1194
1194
|
}
|
|
1195
|
-
function
|
|
1195
|
+
function Wt(e, t, n) {
|
|
1196
1196
|
let r = t.marks.link.create({ href: e.href });
|
|
1197
|
-
return
|
|
1197
|
+
return Gt(e.content, t, n).map((e) => {
|
|
1198
1198
|
if (e.type.name === "text") return e.mark([...e.marks, r]);
|
|
1199
1199
|
if (e.type.name === "hardBreak") return e;
|
|
1200
1200
|
throw Error("unexpected node type");
|
|
1201
1201
|
});
|
|
1202
1202
|
}
|
|
1203
|
-
function
|
|
1203
|
+
function Gt(e, t, n, r) {
|
|
1204
1204
|
let i = [];
|
|
1205
|
-
if (typeof e == "string") return i.push(...
|
|
1205
|
+
if (typeof e == "string") return i.push(...Ut({
|
|
1206
1206
|
type: "text",
|
|
1207
1207
|
text: e,
|
|
1208
1208
|
styles: {}
|
|
1209
1209
|
}, t, n, r)), i;
|
|
1210
|
-
for (let a of e) i.push(...
|
|
1210
|
+
for (let a of e) i.push(...Ut(a, t, n, r));
|
|
1211
1211
|
return i;
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1213
|
+
function U(e, t, n, r = P(t)) {
|
|
1214
1214
|
let i = [];
|
|
1215
|
-
for (let a of e) typeof a == "string" ? i.push(...
|
|
1215
|
+
for (let a of e) typeof a == "string" ? i.push(...Gt(a, t, r, n)) : Ie(a) ? i.push(...Wt(a, t, r)) : b(a) ? i.push(...Gt([a], t, r, n)) : i.push(qt(a, t, r));
|
|
1216
1216
|
return i;
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1218
|
+
function Kt(e, t, n = P(t)) {
|
|
1219
1219
|
let r = [], i = Array(e.headerRows ?? 0).fill(!0), a = Array(e.headerCols ?? 0).fill(!0), o = e.columnWidths ?? [];
|
|
1220
1220
|
for (let s = 0; s < e.rows.length; s++) {
|
|
1221
1221
|
let c = e.rows[s], l = [], u = i[s];
|
|
1222
1222
|
for (let r = 0; r < c.cells.length; r++) {
|
|
1223
|
-
let i = c.cells[r], d = a[r], f = null, p =
|
|
1223
|
+
let i = c.cells[r], d = a[r], f = null, p = H({
|
|
1224
1224
|
row: s,
|
|
1225
1225
|
col: r
|
|
1226
1226
|
}, {
|
|
@@ -1228,13 +1228,13 @@ function Vt(e, t, n = P(t)) {
|
|
|
1228
1228
|
content: e
|
|
1229
1229
|
}), m = o[p.col] ? [o[p.col]] : null;
|
|
1230
1230
|
if (i) if (typeof i == "string") f = t.text(i);
|
|
1231
|
-
else if (
|
|
1232
|
-
i.content && (f =
|
|
1233
|
-
let e =
|
|
1231
|
+
else if (S(i)) {
|
|
1232
|
+
i.content && (f = U(i.content, t, "tableParagraph", n));
|
|
1233
|
+
let e = w(i);
|
|
1234
1234
|
e > 1 && (m = Array(e).fill(!1).map((e, t) => o[p.col + t] ?? void 0));
|
|
1235
|
-
} else f =
|
|
1235
|
+
} else f = U(i, t, "tableParagraph", n);
|
|
1236
1236
|
let h = t.nodes[d || u ? "tableHeader" : "tableCell"].createChecked({
|
|
1237
|
-
...
|
|
1237
|
+
...S(i) ? i.props : {},
|
|
1238
1238
|
colwidth: m
|
|
1239
1239
|
}, t.nodes.tableParagraph.createChecked(void 0, f));
|
|
1240
1240
|
l.push(h);
|
|
@@ -1244,34 +1244,34 @@ function Vt(e, t, n = P(t)) {
|
|
|
1244
1244
|
}
|
|
1245
1245
|
return r;
|
|
1246
1246
|
}
|
|
1247
|
-
function
|
|
1247
|
+
function qt(e, t, n) {
|
|
1248
1248
|
let r, i = e.type;
|
|
1249
1249
|
if (i === void 0 && (i = "paragraph"), !t.nodes[i]) throw Error(`node type ${i} not found in schema`);
|
|
1250
1250
|
if (!e.content) r = t.nodes[i].createChecked(e.props);
|
|
1251
1251
|
else if (typeof e.content == "string") {
|
|
1252
|
-
let a =
|
|
1252
|
+
let a = U([e.content], t, i, n);
|
|
1253
1253
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1254
1254
|
} else if (Array.isArray(e.content)) {
|
|
1255
|
-
let a =
|
|
1255
|
+
let a = U(e.content, t, i, n);
|
|
1256
1256
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1257
1257
|
} else if (e.content.type === "tableContent") {
|
|
1258
|
-
let a =
|
|
1258
|
+
let a = Kt(e.content, t, n);
|
|
1259
1259
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1260
|
-
} else throw new
|
|
1260
|
+
} else throw new T(e.content.type);
|
|
1261
1261
|
return r;
|
|
1262
1262
|
}
|
|
1263
|
-
function
|
|
1263
|
+
function W(e, t, n = P(t)) {
|
|
1264
1264
|
let r = e.id;
|
|
1265
|
-
r === void 0 && (r =
|
|
1265
|
+
r === void 0 && (r = Pe.options.generateID());
|
|
1266
1266
|
let i = [];
|
|
1267
|
-
if (e.children) for (let r of e.children) i.push(
|
|
1267
|
+
if (e.children) for (let r of e.children) i.push(W(r, t, n));
|
|
1268
1268
|
if (!e.type || t.nodes[e.type].isInGroup("blockContent")) {
|
|
1269
|
-
let a =
|
|
1269
|
+
let a = qt(e, t, n), o = i.length > 0 ? t.nodes.blockGroup.createChecked({}, i) : void 0;
|
|
1270
1270
|
return t.nodes.blockContainer.createChecked({
|
|
1271
1271
|
id: r,
|
|
1272
1272
|
...e.props
|
|
1273
1273
|
}, o ? [a, o] : a);
|
|
1274
|
-
} else if (t.nodes[e.type].isInGroup("bnBlock")) return t.nodes[e.type].
|
|
1274
|
+
} else if (t.nodes[e.type].isInGroup("bnBlock")) return t.nodes[e.type].create({
|
|
1275
1275
|
id: r,
|
|
1276
1276
|
...e.props
|
|
1277
1277
|
}, i);
|
|
@@ -1279,48 +1279,48 @@ function U(e, t, n = P(t)) {
|
|
|
1279
1279
|
}
|
|
1280
1280
|
//#endregion
|
|
1281
1281
|
//#region src/api/nodeUtil.ts
|
|
1282
|
-
function
|
|
1282
|
+
function Jt(e, t) {
|
|
1283
1283
|
let n, r;
|
|
1284
|
-
if (t.firstChild.descendants((t, i) => n ? !1 : !
|
|
1284
|
+
if (t.firstChild.descendants((t, i) => n ? !1 : !Yt(t) || t.attrs.id !== e ? !0 : (n = t, r = i + 1, !1)), !(n === void 0 || r === void 0)) return {
|
|
1285
1285
|
node: n,
|
|
1286
1286
|
posBeforeNode: r
|
|
1287
1287
|
};
|
|
1288
1288
|
}
|
|
1289
|
-
function
|
|
1289
|
+
function Yt(e) {
|
|
1290
1290
|
return e.type.isInGroup("bnBlock");
|
|
1291
1291
|
}
|
|
1292
1292
|
//#endregion
|
|
1293
1293
|
//#region src/api/blockManipulation/commands/updateBlock/updateBlock.ts
|
|
1294
|
-
var
|
|
1295
|
-
function
|
|
1296
|
-
let a =
|
|
1297
|
-
a.blockNoteType === "table" && (o =
|
|
1298
|
-
let s =
|
|
1294
|
+
var Xt = (e, t) => ({ tr: n, dispatch: r }) => (r && Zt(n, e, t), !0);
|
|
1295
|
+
function Zt(e, t, n, r, i) {
|
|
1296
|
+
let a = et(e.doc.resolve(t)), o = null;
|
|
1297
|
+
a.blockNoteType === "table" && (o = tn(e));
|
|
1298
|
+
let s = N(e);
|
|
1299
1299
|
if (r !== void 0 && i !== void 0 && r > i) throw Error("Invalid replaceFromPos or replaceToPos");
|
|
1300
1300
|
let c = s.nodes[a.blockNoteType], l = s.nodes[n.type || a.blockNoteType], u = l.isInGroup("bnBlock") ? l : s.nodes.blockContainer;
|
|
1301
1301
|
if (a.isBlockContainer && l.isInGroup("blockContent")) {
|
|
1302
1302
|
let t = r !== void 0 && r > a.blockContent.beforePos && r < a.blockContent.afterPos ? r - a.blockContent.beforePos - 1 : void 0, o = i !== void 0 && i > a.blockContent.beforePos && i < a.blockContent.afterPos ? i - a.blockContent.beforePos - 1 : void 0;
|
|
1303
|
-
|
|
1304
|
-
} else if (!a.isBlockContainer && l.isInGroup("bnBlock"))
|
|
1303
|
+
$t(n, e, a), Qt(n, e, c, l, a, t, o);
|
|
1304
|
+
} else if (!a.isBlockContainer && l.isInGroup("bnBlock")) $t(n, e, a);
|
|
1305
1305
|
else {
|
|
1306
|
-
let t =
|
|
1307
|
-
|
|
1308
|
-
children: t.children,
|
|
1306
|
+
let t = W({
|
|
1307
|
+
children: L(a.bnBlock.node, s).children,
|
|
1309
1308
|
...n
|
|
1310
|
-
}, s)
|
|
1309
|
+
}, s);
|
|
1310
|
+
t.check(), e.replaceWith(a.bnBlock.beforePos, a.bnBlock.afterPos, t);
|
|
1311
1311
|
return;
|
|
1312
1312
|
}
|
|
1313
1313
|
e.setNodeMarkup(a.bnBlock.beforePos, u, {
|
|
1314
1314
|
...a.bnBlock.node.attrs,
|
|
1315
1315
|
...n.props
|
|
1316
|
-
}), o &&
|
|
1317
|
-
}
|
|
1318
|
-
function
|
|
1319
|
-
let l =
|
|
1320
|
-
if (e.content) if (typeof e.content == "string") u =
|
|
1321
|
-
else if (Array.isArray(e.content)) u =
|
|
1322
|
-
else if (e.content.type === "tableContent") u =
|
|
1323
|
-
else throw new
|
|
1316
|
+
}), o && nn(e, a, o);
|
|
1317
|
+
}
|
|
1318
|
+
function Qt(e, t, n, a, o, s, c) {
|
|
1319
|
+
let l = N(t), u = "keep";
|
|
1320
|
+
if (e.content) if (typeof e.content == "string") u = U([e.content], l, a.name);
|
|
1321
|
+
else if (Array.isArray(e.content)) u = U(e.content, l, a.name);
|
|
1322
|
+
else if (e.content.type === "tableContent") u = Kt(e.content, l);
|
|
1323
|
+
else throw new T(e.content.type);
|
|
1324
1324
|
else n.spec.content === "" || a.spec.content !== n.spec.content && (u = []);
|
|
1325
1325
|
if (u === "keep") t.setNodeMarkup(o.blockContent.beforePos, a, {
|
|
1326
1326
|
...o.blockContent.node.attrs,
|
|
@@ -1338,10 +1338,13 @@ function Kt(e, t, n, a, o, s, c) {
|
|
|
1338
1338
|
...e.props
|
|
1339
1339
|
}, u));
|
|
1340
1340
|
}
|
|
1341
|
-
function
|
|
1342
|
-
let a =
|
|
1341
|
+
function $t(e, t, n) {
|
|
1342
|
+
let a = N(t);
|
|
1343
1343
|
if (e.children !== void 0 && e.children.length > 0) {
|
|
1344
|
-
let s = e.children.map((e) =>
|
|
1344
|
+
let s = e.children.map((e) => {
|
|
1345
|
+
let t = W(e, a);
|
|
1346
|
+
return t.check(), t;
|
|
1347
|
+
});
|
|
1345
1348
|
if (n.childContainer) t.step(new o(n.childContainer.beforePos + 1, n.childContainer.afterPos - 1, new i(r.from(s), 0, 0)));
|
|
1346
1349
|
else {
|
|
1347
1350
|
if (!n.isBlockContainer) throw Error("impossible");
|
|
@@ -1349,14 +1352,14 @@ function qt(e, t, n) {
|
|
|
1349
1352
|
}
|
|
1350
1353
|
}
|
|
1351
1354
|
}
|
|
1352
|
-
function
|
|
1353
|
-
let a = typeof t == "string" ? t : t.id, o =
|
|
1355
|
+
function en(e, t, n, r, i) {
|
|
1356
|
+
let a = typeof t == "string" ? t : t.id, o = Jt(a, e.doc);
|
|
1354
1357
|
if (!o) throw Error(`Block with ID ${a} not found`);
|
|
1355
|
-
return
|
|
1358
|
+
return Zt(e, o.posBeforeNode, n, r, i), L(e.doc.resolve(o.posBeforeNode + 1).node(), N(e));
|
|
1356
1359
|
}
|
|
1357
|
-
function
|
|
1360
|
+
function tn(e) {
|
|
1358
1361
|
let t = "selection" in e ? e.selection : null;
|
|
1359
|
-
if (!(t instanceof
|
|
1362
|
+
if (!(t instanceof y)) return null;
|
|
1360
1363
|
let n = e.doc.resolve(t.head), r = -1, i = -1;
|
|
1361
1364
|
for (let e = n.depth; e >= 0; e--) {
|
|
1362
1365
|
let t = n.node(e).type.name;
|
|
@@ -1368,7 +1371,7 @@ function Yt(e) {
|
|
|
1368
1371
|
if (r < 0 || i < 0) return null;
|
|
1369
1372
|
let a = n.before(r), o = n.before(i), s = e.doc.nodeAt(o);
|
|
1370
1373
|
if (!s || s.type.name !== "table") return null;
|
|
1371
|
-
let c =
|
|
1374
|
+
let c = se.get(s), l = a - (o + 1), u = c.map.indexOf(l);
|
|
1372
1375
|
if (u < 0) return null;
|
|
1373
1376
|
let d = Math.floor(u / c.width), f = u % c.width, p = a + 1 + 1;
|
|
1374
1377
|
return {
|
|
@@ -1377,7 +1380,7 @@ function Yt(e) {
|
|
|
1377
1380
|
offset: Math.max(0, t.head - p)
|
|
1378
1381
|
};
|
|
1379
1382
|
}
|
|
1380
|
-
function
|
|
1383
|
+
function nn(e, t, n) {
|
|
1381
1384
|
if (t.blockNoteType !== "table") return !1;
|
|
1382
1385
|
let r = -1;
|
|
1383
1386
|
if (t.isBlockContainer) r = e.mapping.map(t.blockContent.beforePos);
|
|
@@ -1387,10 +1390,10 @@ function Xt(e, t, n) {
|
|
|
1387
1390
|
}
|
|
1388
1391
|
let i = r >= 0 ? e.doc.nodeAt(r) : null;
|
|
1389
1392
|
if (!i || i.type.name !== "table") return !1;
|
|
1390
|
-
let a =
|
|
1393
|
+
let a = se.get(i), o = Math.max(0, Math.min(n.row, a.height - 1)), s = Math.max(0, Math.min(n.col, a.width - 1)), c = o * a.width + s, l = a.map[c];
|
|
1391
1394
|
if (l == null) return !1;
|
|
1392
1395
|
let u = r + 1 + l + 1, d = e.doc.nodeAt(u), f = u + 1, p = d ? d.content.size : 0, m = f + Math.max(0, Math.min(n.offset, p));
|
|
1393
|
-
return "selection" in e && e.setSelection(
|
|
1396
|
+
return "selection" in e && e.setSelection(y.create(e.doc, m)), !0;
|
|
1394
1397
|
}
|
|
1395
1398
|
//#endregion
|
|
1396
1399
|
//#region src/editor/defaultColors.ts
|
|
@@ -1431,7 +1434,7 @@ var G = {
|
|
|
1431
1434
|
text: "#ad1a72",
|
|
1432
1435
|
background: "#f4dfeb"
|
|
1433
1436
|
}
|
|
1434
|
-
},
|
|
1437
|
+
}, rn = {
|
|
1435
1438
|
gray: {
|
|
1436
1439
|
text: "#bebdb8",
|
|
1437
1440
|
background: "#9b9a97"
|
|
@@ -1485,19 +1488,19 @@ var G = {
|
|
|
1485
1488
|
return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment = K.textAlignment.values.includes(e.style.textAlign) ? e.style.textAlign : void 0, t;
|
|
1486
1489
|
}, J = (e, t) => {
|
|
1487
1490
|
e.backgroundColor && e.backgroundColor !== K.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in G ? G[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== K.textColor.default && (t.style.color = e.textColor in G ? G[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== K.textAlignment.default && (t.style.textAlign = e.textAlignment);
|
|
1488
|
-
},
|
|
1491
|
+
}, an = (e = "backgroundColor") => ({
|
|
1489
1492
|
default: K.backgroundColor.default,
|
|
1490
1493
|
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : e.style.backgroundColor ? e.style.backgroundColor : K.backgroundColor.default,
|
|
1491
1494
|
renderHTML: (t) => t[e] === K.backgroundColor.default ? {} : { "data-background-color": t[e] }
|
|
1492
|
-
}),
|
|
1495
|
+
}), on = (e = "textColor") => ({
|
|
1493
1496
|
default: K.textColor.default,
|
|
1494
1497
|
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : e.style.color ? e.style.color : K.textColor.default,
|
|
1495
1498
|
renderHTML: (t) => t[e] === K.textColor.default ? {} : { "data-text-color": t[e] }
|
|
1496
|
-
}),
|
|
1499
|
+
}), sn = (e = "textAlignment") => ({
|
|
1497
1500
|
default: K.textAlignment.default,
|
|
1498
1501
|
parseHTML: (e) => e.hasAttribute("data-text-alignment") ? e.getAttribute("data-text-alignment") : e.style.textAlign ? e.style.textAlign : K.textAlignment.default,
|
|
1499
1502
|
renderHTML: (t) => t[e] === K.textAlignment.default ? {} : { "data-text-alignment": t[e] }
|
|
1500
|
-
}),
|
|
1503
|
+
}), cn = (e, t) => {
|
|
1501
1504
|
let n = e.querySelector(t);
|
|
1502
1505
|
if (n) return {
|
|
1503
1506
|
targetElement: n,
|
|
@@ -1522,7 +1525,7 @@ var G = {
|
|
|
1522
1525
|
n.setState(e);
|
|
1523
1526
|
}
|
|
1524
1527
|
};
|
|
1525
|
-
}),
|
|
1528
|
+
}), ln = (e, t, n) => {
|
|
1526
1529
|
let r = document.createElement("div");
|
|
1527
1530
|
r.className = "bn-add-file-button";
|
|
1528
1531
|
let i = document.createElement("div");
|
|
@@ -1540,51 +1543,51 @@ var G = {
|
|
|
1540
1543
|
r.removeEventListener("mousedown", o, !0), r.removeEventListener("click", s, !0);
|
|
1541
1544
|
}
|
|
1542
1545
|
};
|
|
1543
|
-
},
|
|
1546
|
+
}, un = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z\"></path></svg>", dn = (e) => {
|
|
1544
1547
|
let t = document.createElement("div");
|
|
1545
1548
|
t.className = "bn-file-name-with-icon";
|
|
1546
1549
|
let n = document.createElement("div");
|
|
1547
|
-
n.className = "bn-file-icon", n.innerHTML =
|
|
1550
|
+
n.className = "bn-file-icon", n.innerHTML = un, t.appendChild(n);
|
|
1548
1551
|
let r = document.createElement("p");
|
|
1549
1552
|
return r.className = "bn-file-name", r.textContent = e.props.name, t.appendChild(r), { dom: t };
|
|
1550
|
-
},
|
|
1551
|
-
let i = document.createElement("div");
|
|
1552
|
-
if (
|
|
1553
|
-
let n =
|
|
1554
|
-
|
|
1555
|
-
let
|
|
1553
|
+
}, fn = (e, t, n, r) => {
|
|
1554
|
+
let i = e.props.url !== "" && !!e.props.caption, a = document.createElement(i ? "figure" : "div");
|
|
1555
|
+
if (a.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
1556
|
+
let n = ln(e, t, r);
|
|
1557
|
+
a.appendChild(n.dom);
|
|
1558
|
+
let i = t.onUploadStart((t) => {
|
|
1556
1559
|
if (t === e.id) {
|
|
1557
|
-
|
|
1560
|
+
a.removeChild(n.dom);
|
|
1558
1561
|
let e = document.createElement("div");
|
|
1559
|
-
e.className = "bn-file-loading-preview", e.textContent = "Loading...",
|
|
1562
|
+
e.className = "bn-file-loading-preview", e.textContent = "Loading...", a.appendChild(e);
|
|
1560
1563
|
}
|
|
1561
1564
|
});
|
|
1562
1565
|
return {
|
|
1563
|
-
dom:
|
|
1566
|
+
dom: a,
|
|
1564
1567
|
destroy: () => {
|
|
1565
|
-
|
|
1568
|
+
i(), n.destroy();
|
|
1566
1569
|
}
|
|
1567
1570
|
};
|
|
1568
1571
|
}
|
|
1569
|
-
let
|
|
1572
|
+
let o = { dom: a };
|
|
1570
1573
|
if (e.props.showPreview === !1 || !n) {
|
|
1571
|
-
let t =
|
|
1572
|
-
|
|
1574
|
+
let t = dn(e);
|
|
1575
|
+
a.appendChild(t.dom), o.destroy = () => {
|
|
1573
1576
|
t.destroy?.();
|
|
1574
1577
|
};
|
|
1575
|
-
} else
|
|
1578
|
+
} else a.appendChild(n.dom);
|
|
1576
1579
|
if (e.props.caption) {
|
|
1577
|
-
let t = document.createElement("
|
|
1578
|
-
t.className = "bn-file-caption", t.textContent = e.props.caption,
|
|
1580
|
+
let t = document.createElement("figcaption");
|
|
1581
|
+
t.className = "bn-file-caption", t.textContent = e.props.caption, a.appendChild(t);
|
|
1579
1582
|
}
|
|
1580
|
-
return
|
|
1581
|
-
},
|
|
1583
|
+
return o;
|
|
1584
|
+
}, pn = (e, t) => {
|
|
1582
1585
|
let n = document.createElement("figure"), r = document.createElement("figcaption");
|
|
1583
1586
|
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
1584
|
-
},
|
|
1587
|
+
}, mn = (e, t) => {
|
|
1585
1588
|
let n = document.createElement("div"), r = document.createElement("p");
|
|
1586
1589
|
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
1587
|
-
},
|
|
1590
|
+
}, hn = (e) => ({ url: e.src || void 0 }), gn = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>", _n = A((e) => ({
|
|
1588
1591
|
type: "audio",
|
|
1589
1592
|
propSchema: {
|
|
1590
1593
|
backgroundColor: K.backgroundColor,
|
|
@@ -1594,56 +1597,53 @@ var G = {
|
|
|
1594
1597
|
showPreview: { default: !0 }
|
|
1595
1598
|
},
|
|
1596
1599
|
content: "none"
|
|
1597
|
-
})),
|
|
1600
|
+
})), vn = (e = {}) => (e) => {
|
|
1598
1601
|
if (e.tagName === "AUDIO") {
|
|
1599
1602
|
if (e.closest("figure")) return;
|
|
1600
1603
|
let { backgroundColor: t } = q(e);
|
|
1601
1604
|
return {
|
|
1602
|
-
...
|
|
1605
|
+
...hn(e),
|
|
1603
1606
|
backgroundColor: t
|
|
1604
1607
|
};
|
|
1605
1608
|
}
|
|
1606
1609
|
if (e.tagName === "FIGURE") {
|
|
1607
|
-
let t =
|
|
1610
|
+
let t = cn(e, "audio");
|
|
1608
1611
|
if (!t) return;
|
|
1609
1612
|
let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
|
|
1610
1613
|
return {
|
|
1611
|
-
...
|
|
1614
|
+
...hn(n),
|
|
1612
1615
|
backgroundColor: i,
|
|
1613
1616
|
caption: r
|
|
1614
1617
|
};
|
|
1615
1618
|
}
|
|
1616
|
-
},
|
|
1619
|
+
}, yn = (e = {}) => (t, n) => {
|
|
1617
1620
|
let r = document.createElement("div");
|
|
1618
1621
|
r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>";
|
|
1619
1622
|
let i = document.createElement("audio");
|
|
1620
1623
|
return i.className = "bn-audio", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
1621
1624
|
i.src = e;
|
|
1622
|
-
}) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1,
|
|
1623
|
-
},
|
|
1624
|
-
if (!e.props.url) {
|
|
1625
|
-
let e = document.createElement("p");
|
|
1626
|
-
return e.textContent = "Add audio", { dom: e };
|
|
1627
|
-
}
|
|
1625
|
+
}) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1, fn(t, n, { dom: i }, r.firstElementChild);
|
|
1626
|
+
}, bn = (e = {}) => (e, t) => {
|
|
1627
|
+
if (!e.props.url) return { dom: document.createElement("audio") };
|
|
1628
1628
|
let n;
|
|
1629
|
-
return e.props.showPreview ? (n = document.createElement("audio"), n.src = e.props.url) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
1630
|
-
},
|
|
1629
|
+
return e.props.showPreview ? (n = document.createElement("audio"), n.src = e.props.url) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? pn(n, e.props.caption) : mn(n, e.props.caption) : { dom: n };
|
|
1630
|
+
}, xn = j(_n, (e) => ({
|
|
1631
1631
|
meta: { fileBlockAccept: ["audio/*"] },
|
|
1632
|
-
parse:
|
|
1633
|
-
render:
|
|
1634
|
-
toExternalHTML:
|
|
1632
|
+
parse: vn(e),
|
|
1633
|
+
render: yn(e),
|
|
1634
|
+
toExternalHTML: bn(e),
|
|
1635
1635
|
runsBefore: ["file"]
|
|
1636
|
-
})),
|
|
1637
|
-
function
|
|
1636
|
+
})), Sn = Symbol.for("blocknote.shikiParser"), Cn = Symbol.for("blocknote.shikiHighlighterPromise");
|
|
1637
|
+
function wn(e) {
|
|
1638
1638
|
let t = globalThis, n, r, i = !1;
|
|
1639
|
-
return
|
|
1639
|
+
return ge({
|
|
1640
1640
|
parser: (a) => {
|
|
1641
1641
|
if (!e.createHighlighter) return process.env.NODE_ENV === "development" && !i && (console.log("For syntax highlighting of code blocks, you must provide a `createCodeBlockSpec({ createHighlighter: () => ... })` function"), i = !0), [];
|
|
1642
|
-
if (!n) return t[
|
|
1642
|
+
if (!n) return t[Cn] = t[Cn] || e.createHighlighter(), t[Cn].then((e) => {
|
|
1643
1643
|
n = e;
|
|
1644
1644
|
});
|
|
1645
|
-
let o =
|
|
1646
|
-
return !o || o === "text" || o === "none" || o === "plaintext" || o === "txt" ? [] : n.getLoadedLanguages().includes(o) ? (r || (r = t[
|
|
1645
|
+
let o = Dn(e, a.language);
|
|
1646
|
+
return !o || o === "text" || o === "none" || o === "plaintext" || o === "txt" ? [] : n.getLoadedLanguages().includes(o) ? (r || (r = t[Sn] || _e(n), t[Sn] = r), r(a)) : n.loadLanguage(o);
|
|
1647
1647
|
},
|
|
1648
1648
|
languageExtractor: (e) => e.attrs.language,
|
|
1649
1649
|
nodeTypes: ["codeBlock"]
|
|
@@ -1651,11 +1651,11 @@ function _n(e) {
|
|
|
1651
1651
|
}
|
|
1652
1652
|
//#endregion
|
|
1653
1653
|
//#region src/blocks/Code/block.ts
|
|
1654
|
-
var
|
|
1654
|
+
var Tn = A(({ defaultLanguage: e = "text" }) => ({
|
|
1655
1655
|
type: "codeBlock",
|
|
1656
1656
|
propSchema: { language: { default: e } },
|
|
1657
1657
|
content: "inline"
|
|
1658
|
-
})),
|
|
1658
|
+
})), En = j(Tn, (e) => ({
|
|
1659
1659
|
meta: {
|
|
1660
1660
|
code: !0,
|
|
1661
1661
|
defining: !0,
|
|
@@ -1667,7 +1667,7 @@ var vn = D(({ defaultLanguage: e = "text" }) => ({
|
|
|
1667
1667
|
return { language: t.getAttribute("data-language") || t.className.split(" ").find((e) => e.includes("language-"))?.replace("language-", "") };
|
|
1668
1668
|
},
|
|
1669
1669
|
parseContent: ({ el: e, schema: t }) => {
|
|
1670
|
-
let n =
|
|
1670
|
+
let n = re.fromSchema(t), r = e.firstElementChild;
|
|
1671
1671
|
return n.parse(r, {
|
|
1672
1672
|
preserveWhitespace: "full",
|
|
1673
1673
|
topNode: t.nodes.codeBlock.create()
|
|
@@ -1709,7 +1709,7 @@ var vn = D(({ defaultLanguage: e = "text" }) => ({
|
|
|
1709
1709
|
}
|
|
1710
1710
|
}), (e) => [t({
|
|
1711
1711
|
key: "code-block-highlighter",
|
|
1712
|
-
prosemirrorPlugins: [
|
|
1712
|
+
prosemirrorPlugins: [wn(e)]
|
|
1713
1713
|
}), t({
|
|
1714
1714
|
key: "code-block-keyboard-shortcuts",
|
|
1715
1715
|
keyboardShortcuts: {
|
|
@@ -1747,22 +1747,22 @@ var vn = D(({ defaultLanguage: e = "text" }) => ({
|
|
|
1747
1747
|
let n = t[1].trim();
|
|
1748
1748
|
return {
|
|
1749
1749
|
type: "codeBlock",
|
|
1750
|
-
props: { language: { language:
|
|
1750
|
+
props: { language: { language: Dn(e, n) ?? n }.language },
|
|
1751
1751
|
content: []
|
|
1752
1752
|
};
|
|
1753
1753
|
}
|
|
1754
1754
|
}]
|
|
1755
1755
|
})]);
|
|
1756
|
-
function
|
|
1756
|
+
function Dn(e, t) {
|
|
1757
1757
|
return Object.entries(e.supportedLanguages ?? {}).find(([e, { aliases: n }]) => n?.includes(t) || e === t)?.[0];
|
|
1758
1758
|
}
|
|
1759
1759
|
//#endregion
|
|
1760
1760
|
//#region src/blocks/Divider/block.ts
|
|
1761
|
-
var
|
|
1761
|
+
var On = A(() => ({
|
|
1762
1762
|
type: "divider",
|
|
1763
1763
|
propSchema: {},
|
|
1764
1764
|
content: "none"
|
|
1765
|
-
})),
|
|
1765
|
+
})), kn = j(On, {
|
|
1766
1766
|
meta: { isolating: !1 },
|
|
1767
1767
|
parse(e) {
|
|
1768
1768
|
if (e.tagName === "HR") return {};
|
|
@@ -1782,7 +1782,7 @@ var xn = D(() => ({
|
|
|
1782
1782
|
};
|
|
1783
1783
|
}
|
|
1784
1784
|
}]
|
|
1785
|
-
})]),
|
|
1785
|
+
})]), An = (e) => ({ url: e.src || void 0 }), jn = A(() => ({
|
|
1786
1786
|
type: "file",
|
|
1787
1787
|
propSchema: {
|
|
1788
1788
|
backgroundColor: K.backgroundColor,
|
|
@@ -1791,47 +1791,44 @@ var xn = D(() => ({
|
|
|
1791
1791
|
caption: { default: "" }
|
|
1792
1792
|
},
|
|
1793
1793
|
content: "none"
|
|
1794
|
-
})),
|
|
1794
|
+
})), Mn = () => (e) => {
|
|
1795
1795
|
if (e.tagName === "EMBED") {
|
|
1796
1796
|
if (e.closest("figure")) return;
|
|
1797
1797
|
let { backgroundColor: t } = q(e);
|
|
1798
1798
|
return {
|
|
1799
|
-
...
|
|
1799
|
+
...An(e),
|
|
1800
1800
|
backgroundColor: t
|
|
1801
1801
|
};
|
|
1802
1802
|
}
|
|
1803
1803
|
if (e.tagName === "FIGURE") {
|
|
1804
|
-
let t =
|
|
1804
|
+
let t = cn(e, "embed");
|
|
1805
1805
|
if (!t) return;
|
|
1806
1806
|
let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
|
|
1807
1807
|
return {
|
|
1808
|
-
...
|
|
1808
|
+
...An(n),
|
|
1809
1809
|
backgroundColor: i,
|
|
1810
1810
|
caption: r
|
|
1811
1811
|
};
|
|
1812
1812
|
}
|
|
1813
|
-
},
|
|
1813
|
+
}, Nn = j(jn, {
|
|
1814
1814
|
meta: { fileBlockAccept: ["*/*"] },
|
|
1815
|
-
parse:
|
|
1815
|
+
parse: Mn(),
|
|
1816
1816
|
render(e, t) {
|
|
1817
|
-
return
|
|
1817
|
+
return fn(e, t);
|
|
1818
1818
|
},
|
|
1819
1819
|
toExternalHTML(e) {
|
|
1820
|
-
if (!e.props.url) {
|
|
1821
|
-
let e = document.createElement("p");
|
|
1822
|
-
return e.textContent = "Add file", { dom: e };
|
|
1823
|
-
}
|
|
1820
|
+
if (!e.props.url) return { dom: document.createElement("embed") };
|
|
1824
1821
|
let t = document.createElement("a");
|
|
1825
|
-
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ?
|
|
1822
|
+
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? mn(t, e.props.caption) : { dom: t };
|
|
1826
1823
|
}
|
|
1827
1824
|
});
|
|
1828
1825
|
//#endregion
|
|
1829
1826
|
//#region src/blocks/getDetailsContent.ts
|
|
1830
|
-
function
|
|
1827
|
+
function Pn(e, t, i) {
|
|
1831
1828
|
let a = n.fromSchema(t), o = e.querySelector(":scope > summary"), s;
|
|
1832
1829
|
if (o) {
|
|
1833
1830
|
let e = o.cloneNode(!0);
|
|
1834
|
-
|
|
1831
|
+
Ue(e), s = a.parse(e, {
|
|
1835
1832
|
topNode: t.nodes.paragraph.create(),
|
|
1836
1833
|
preserveWhitespace: !0
|
|
1837
1834
|
}).content;
|
|
@@ -1847,10 +1844,10 @@ function Dn(e, t, i) {
|
|
|
1847
1844
|
}
|
|
1848
1845
|
//#endregion
|
|
1849
1846
|
//#region src/blocks/ToggleWrapper/createToggleWrapper.ts
|
|
1850
|
-
var
|
|
1847
|
+
var Fn = {
|
|
1851
1848
|
set: (e, t) => window.localStorage.setItem(`toggle-${e.id}`, t ? "true" : "false"),
|
|
1852
1849
|
get: (e) => window.localStorage.getItem(`toggle-${e.id}`) === "true"
|
|
1853
|
-
},
|
|
1850
|
+
}, In = (e, t, n, r = Fn) => {
|
|
1854
1851
|
if ("isToggleable" in e.props && !e.props.isToggleable) return { dom: n };
|
|
1855
1852
|
let i = document.createElement("div"), a = document.createElement("div");
|
|
1856
1853
|
a.className = "bn-toggle-wrapper";
|
|
@@ -1884,20 +1881,20 @@ var On = {
|
|
|
1884
1881
|
o.removeEventListener("mousedown", s), o.removeEventListener("click", c), l.removeEventListener("mousedown", u), l.removeEventListener("click", d), p?.();
|
|
1885
1882
|
}
|
|
1886
1883
|
};
|
|
1887
|
-
},
|
|
1884
|
+
}, Ln = [
|
|
1888
1885
|
1,
|
|
1889
1886
|
2,
|
|
1890
1887
|
3,
|
|
1891
1888
|
4,
|
|
1892
1889
|
5,
|
|
1893
1890
|
6
|
|
1894
|
-
],
|
|
1891
|
+
], Rn = (e) => ({ editor: t }) => {
|
|
1895
1892
|
let n = t.getTextCursorPosition();
|
|
1896
1893
|
return t.schema.blockSchema[n.block.type].content === "inline" ? (t.updateBlock(n.block, {
|
|
1897
1894
|
type: "heading",
|
|
1898
1895
|
props: { level: e }
|
|
1899
1896
|
}), !0) : !1;
|
|
1900
|
-
},
|
|
1897
|
+
}, zn = A(({ defaultLevel: e = 1, levels: t = Ln, allowToggleHeadings: n = !0 } = {}) => ({
|
|
1901
1898
|
type: "heading",
|
|
1902
1899
|
propSchema: {
|
|
1903
1900
|
...K,
|
|
@@ -1911,7 +1908,7 @@ var On = {
|
|
|
1911
1908
|
} } : {}
|
|
1912
1909
|
},
|
|
1913
1910
|
content: "inline"
|
|
1914
|
-
})),
|
|
1911
|
+
})), Bn = j(zn, ({ allowToggleHeadings: e = !0 } = {}) => ({
|
|
1915
1912
|
meta: { isolating: !1 },
|
|
1916
1913
|
parse(t) {
|
|
1917
1914
|
if (e && t.tagName === "DETAILS") {
|
|
@@ -1952,13 +1949,13 @@ var On = {
|
|
|
1952
1949
|
};
|
|
1953
1950
|
},
|
|
1954
1951
|
...e ? { parseContent: ({ el: e, schema: t }) => {
|
|
1955
|
-
if (e.tagName === "DETAILS") return
|
|
1952
|
+
if (e.tagName === "DETAILS") return Pn(e, t, "heading");
|
|
1956
1953
|
} } : {},
|
|
1957
1954
|
runsBefore: ["toggleListItem"],
|
|
1958
1955
|
render(t, n) {
|
|
1959
1956
|
let r = document.createElement(`h${t.props.level}`);
|
|
1960
1957
|
return e ? {
|
|
1961
|
-
...
|
|
1958
|
+
...In(t, n, r),
|
|
1962
1959
|
contentDOM: r
|
|
1963
1960
|
} : {
|
|
1964
1961
|
dom: r,
|
|
@@ -1982,9 +1979,9 @@ var On = {
|
|
|
1982
1979
|
contentDOM: n
|
|
1983
1980
|
};
|
|
1984
1981
|
}
|
|
1985
|
-
}), ({ levels: e =
|
|
1982
|
+
}), ({ levels: e = Ln } = {}) => [t({
|
|
1986
1983
|
key: "heading-shortcuts",
|
|
1987
|
-
keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`,
|
|
1984
|
+
keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`, Rn(e)]) ?? []),
|
|
1988
1985
|
inputRules: e.map((e) => ({
|
|
1989
1986
|
find: RegExp(`^(#{${e}})\\s$`),
|
|
1990
1987
|
replace({ match: e }) {
|
|
@@ -1994,8 +1991,8 @@ var On = {
|
|
|
1994
1991
|
};
|
|
1995
1992
|
}
|
|
1996
1993
|
}))
|
|
1997
|
-
})]),
|
|
1998
|
-
let { dom: a, destroy: o } =
|
|
1994
|
+
})]), Vn = (e, t, n, r, i) => {
|
|
1995
|
+
let { dom: a, destroy: o } = fn(e, t, n, i), s = a;
|
|
1999
1996
|
s.style.position = "relative", e.props.url && e.props.showPreview && (e.props.previewWidth ? s.style.width = `${e.props.previewWidth}px` : s.style.width = "fit-content");
|
|
2000
1997
|
let c = document.createElement("div");
|
|
2001
1998
|
c.className = "bn-resize-handle", c.style.left = "4px", c.style.display = "none", r.appendChild(c);
|
|
@@ -2039,11 +2036,11 @@ var On = {
|
|
|
2039
2036
|
o?.(), window.removeEventListener("mousemove", p), window.removeEventListener("touchmove", p), window.removeEventListener("mouseup", m), window.removeEventListener("touchend", m), s.removeEventListener("mouseenter", h), s.removeEventListener("mouseleave", g), c.removeEventListener("mousedown", _), c.removeEventListener("touchstart", _), l.removeEventListener("mousedown", v), l.removeEventListener("touchstart", v);
|
|
2040
2037
|
}
|
|
2041
2038
|
};
|
|
2042
|
-
},
|
|
2039
|
+
}, Hn = (e) => ({
|
|
2043
2040
|
url: e.src || void 0,
|
|
2044
2041
|
previewWidth: e.width || void 0,
|
|
2045
2042
|
name: e.alt || void 0
|
|
2046
|
-
}),
|
|
2043
|
+
}), Un = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>", Wn = A((e = {}) => ({
|
|
2047
2044
|
type: "image",
|
|
2048
2045
|
propSchema: {
|
|
2049
2046
|
textAlignment: K.textAlignment,
|
|
@@ -2058,26 +2055,26 @@ var On = {
|
|
|
2058
2055
|
}
|
|
2059
2056
|
},
|
|
2060
2057
|
content: "none"
|
|
2061
|
-
})),
|
|
2058
|
+
})), Gn = (e = {}) => (e) => {
|
|
2062
2059
|
if (e.tagName === "IMG") {
|
|
2063
2060
|
if (e.closest("figure")) return;
|
|
2064
2061
|
let { backgroundColor: t } = q(e);
|
|
2065
2062
|
return {
|
|
2066
|
-
...
|
|
2063
|
+
...Hn(e),
|
|
2067
2064
|
backgroundColor: t
|
|
2068
2065
|
};
|
|
2069
2066
|
}
|
|
2070
2067
|
if (e.tagName === "FIGURE") {
|
|
2071
|
-
let t =
|
|
2068
|
+
let t = cn(e, "img");
|
|
2072
2069
|
if (!t) return;
|
|
2073
2070
|
let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
|
|
2074
2071
|
return {
|
|
2075
|
-
...
|
|
2072
|
+
...Hn(n),
|
|
2076
2073
|
backgroundColor: i,
|
|
2077
2074
|
caption: r
|
|
2078
2075
|
};
|
|
2079
2076
|
}
|
|
2080
|
-
},
|
|
2077
|
+
}, Kn = (e = {}) => (t, n) => {
|
|
2081
2078
|
let r = document.createElement("div");
|
|
2082
2079
|
r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>";
|
|
2083
2080
|
let i = document.createElement("div");
|
|
@@ -2085,24 +2082,21 @@ var On = {
|
|
|
2085
2082
|
let a = document.createElement("img");
|
|
2086
2083
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
2087
2084
|
a.src = e;
|
|
2088
|
-
}) : a.src = t.props.url, a.alt = t.props.name ||
|
|
2089
|
-
},
|
|
2090
|
-
if (!e.props.url) {
|
|
2091
|
-
let e = document.createElement("p");
|
|
2092
|
-
return e.textContent = "Add image", { dom: e };
|
|
2093
|
-
}
|
|
2085
|
+
}) : a.src = t.props.url, a.alt = t.props.name || "", a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a), Vn(t, n, { dom: i }, i, r.firstElementChild);
|
|
2086
|
+
}, qn = (e = {}) => (e, t) => {
|
|
2087
|
+
if (!e.props.url) return { dom: document.createElement("img") };
|
|
2094
2088
|
let n;
|
|
2095
|
-
return e.props.showPreview ? (n = document.createElement("img"), n.src = e.props.url, n.alt = e.props.name ||
|
|
2096
|
-
},
|
|
2089
|
+
return e.props.showPreview ? (n = document.createElement("img"), n.src = e.props.url, n.alt = e.props.name || "", e.props.previewWidth && (n.width = e.props.previewWidth)) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? pn(n, e.props.caption) : mn(n, e.props.caption) : { dom: n };
|
|
2090
|
+
}, Jn = j(Wn, (e) => ({
|
|
2097
2091
|
meta: { fileBlockAccept: ["image/*"] },
|
|
2098
|
-
parse:
|
|
2099
|
-
render:
|
|
2100
|
-
toExternalHTML:
|
|
2092
|
+
parse: Gn(e),
|
|
2093
|
+
render: Kn(e),
|
|
2094
|
+
toExternalHTML: qn(e),
|
|
2101
2095
|
runsBefore: ["file"]
|
|
2102
|
-
})),
|
|
2103
|
-
let i =
|
|
2096
|
+
})), Yn = (e, t, n) => ({ state: r, dispatch: i }) => i ? Xn(r.tr, e, t, n) : !0, Xn = (e, t, n, r) => {
|
|
2097
|
+
let i = M(Qe(e.doc, t));
|
|
2104
2098
|
if (!i.isBlockContainer) return !1;
|
|
2105
|
-
let a =
|
|
2099
|
+
let a = N(e), o = [{
|
|
2106
2100
|
type: i.bnBlock.node.type,
|
|
2107
2101
|
attrs: r ? {
|
|
2108
2102
|
...i.bnBlock.node.attrs,
|
|
@@ -2113,23 +2107,23 @@ var On = {
|
|
|
2113
2107
|
attrs: r ? { ...i.blockContent.node.attrs } : {}
|
|
2114
2108
|
}];
|
|
2115
2109
|
return e.split(t, 2, o), !0;
|
|
2116
|
-
},
|
|
2110
|
+
}, Zn = (e, t) => {
|
|
2117
2111
|
let { blockInfo: n, selectionEmpty: r } = e.transact((e) => ({
|
|
2118
|
-
blockInfo:
|
|
2112
|
+
blockInfo: nt(e),
|
|
2119
2113
|
selectionEmpty: e.selection.anchor === e.selection.head
|
|
2120
2114
|
}));
|
|
2121
2115
|
if (!n.isBlockContainer) return !1;
|
|
2122
2116
|
let { bnBlock: i, blockContent: a } = n;
|
|
2123
2117
|
return a.node.type.name !== t || !r ? !1 : a.node.childCount === 0 ? (e.transact((e) => {
|
|
2124
|
-
|
|
2118
|
+
Zt(e, i.beforePos, {
|
|
2125
2119
|
type: "paragraph",
|
|
2126
2120
|
props: {}
|
|
2127
2121
|
});
|
|
2128
|
-
}), !0) : a.node.childCount > 0 ? e.transact((e) => (e.deleteSelection(),
|
|
2122
|
+
}), !0) : a.node.childCount > 0 ? e.transact((e) => (e.deleteSelection(), Xn(e, e.selection.from, !0))) : !1;
|
|
2129
2123
|
};
|
|
2130
2124
|
//#endregion
|
|
2131
2125
|
//#region src/blocks/ListItem/getListItemContent.ts
|
|
2132
|
-
function
|
|
2126
|
+
function Qn(e, t, i) {
|
|
2133
2127
|
let a = n.fromSchema(t), o = e, s = document.createElement("div");
|
|
2134
2128
|
s.setAttribute("data-node-type", "blockGroup");
|
|
2135
2129
|
for (let e of Array.from(o.childNodes)) s.appendChild(e.cloneNode(!0));
|
|
@@ -2146,18 +2140,18 @@ function Gn(e, t, i) {
|
|
|
2146
2140
|
}
|
|
2147
2141
|
//#endregion
|
|
2148
2142
|
//#region src/blocks/ListItem/BulletListItem/block.ts
|
|
2149
|
-
var
|
|
2143
|
+
var $n = A(() => ({
|
|
2150
2144
|
type: "bulletListItem",
|
|
2151
2145
|
propSchema: { ...K },
|
|
2152
2146
|
content: "inline"
|
|
2153
|
-
})),
|
|
2147
|
+
})), er = j($n, {
|
|
2154
2148
|
meta: { isolating: !1 },
|
|
2155
2149
|
parse(e) {
|
|
2156
2150
|
if (e.tagName !== "LI") return;
|
|
2157
2151
|
let t = e.parentElement;
|
|
2158
|
-
if (t
|
|
2152
|
+
if (t === null || t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL" || !e.closest("ul, ol")) return q(e);
|
|
2159
2153
|
},
|
|
2160
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2154
|
+
parseContent: ({ el: e, schema: t }) => Qn(e, t, "bulletListItem"),
|
|
2161
2155
|
render() {
|
|
2162
2156
|
let e = document.createElement("p");
|
|
2163
2157
|
return {
|
|
@@ -2175,7 +2169,7 @@ var Kn = D(() => ({
|
|
|
2175
2169
|
}, [t({
|
|
2176
2170
|
key: "bullet-list-item-shortcuts",
|
|
2177
2171
|
keyboardShortcuts: {
|
|
2178
|
-
Enter: ({ editor: e }) =>
|
|
2172
|
+
Enter: ({ editor: e }) => Zn(e, "bulletListItem"),
|
|
2179
2173
|
"Mod-Shift-8": ({ editor: e }) => {
|
|
2180
2174
|
let t = e.getTextCursorPosition();
|
|
2181
2175
|
return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
|
|
@@ -2187,13 +2181,13 @@ var Kn = D(() => ({
|
|
|
2187
2181
|
inputRules: [{
|
|
2188
2182
|
find: /^\s?[-+*]\s$/,
|
|
2189
2183
|
replace({ editor: e }) {
|
|
2190
|
-
if (
|
|
2184
|
+
if (tt(e.prosemirrorState).blockNoteType !== "heading") return {
|
|
2191
2185
|
type: "bulletListItem",
|
|
2192
2186
|
props: {}
|
|
2193
2187
|
};
|
|
2194
2188
|
}
|
|
2195
2189
|
}]
|
|
2196
|
-
})]),
|
|
2190
|
+
})]), tr = A(() => ({
|
|
2197
2191
|
type: "checkListItem",
|
|
2198
2192
|
propSchema: {
|
|
2199
2193
|
...K,
|
|
@@ -2203,7 +2197,7 @@ var Kn = D(() => ({
|
|
|
2203
2197
|
}
|
|
2204
2198
|
},
|
|
2205
2199
|
content: "inline"
|
|
2206
|
-
})),
|
|
2200
|
+
})), nr = j(tr, {
|
|
2207
2201
|
meta: { isolating: !1 },
|
|
2208
2202
|
parse(e) {
|
|
2209
2203
|
if (e.tagName === "input") return e.closest("[data-content-type]") || e.closest("li") ? void 0 : e.type === "checkbox" ? { checked: e.checked } : void 0;
|
|
@@ -2217,7 +2211,7 @@ var Kn = D(() => ({
|
|
|
2217
2211
|
};
|
|
2218
2212
|
}
|
|
2219
2213
|
},
|
|
2220
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2214
|
+
parseContent: ({ el: e, schema: t }) => Qn(e, t, "checkListItem"),
|
|
2221
2215
|
render(e, t) {
|
|
2222
2216
|
let n = document.createDocumentFragment(), r = document.createElement("input");
|
|
2223
2217
|
r.type = "checkbox", r.checked = e.props.checked, e.props.checked && r.setAttribute("checked", ""), r.disabled = !t.isEditable, r.addEventListener("change", () => {
|
|
@@ -2242,7 +2236,7 @@ var Kn = D(() => ({
|
|
|
2242
2236
|
}, [t({
|
|
2243
2237
|
key: "check-list-item-shortcuts",
|
|
2244
2238
|
keyboardShortcuts: {
|
|
2245
|
-
Enter: ({ editor: e }) =>
|
|
2239
|
+
Enter: ({ editor: e }) => Zn(e, "checkListItem"),
|
|
2246
2240
|
"Mod-Shift-9": ({ editor: e }) => {
|
|
2247
2241
|
let t = e.getTextCursorPosition();
|
|
2248
2242
|
return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
|
|
@@ -2271,8 +2265,8 @@ var Kn = D(() => ({
|
|
|
2271
2265
|
})]);
|
|
2272
2266
|
//#endregion
|
|
2273
2267
|
//#region src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts
|
|
2274
|
-
function
|
|
2275
|
-
let i = !!e.firstChild.attrs.start, a =
|
|
2268
|
+
function rr(e, t, n, r) {
|
|
2269
|
+
let i = !!e.firstChild.attrs.start, a = M({
|
|
2276
2270
|
posBeforeNode: t,
|
|
2277
2271
|
node: e
|
|
2278
2272
|
});
|
|
@@ -2291,7 +2285,7 @@ function Xn(e, t, n, r) {
|
|
|
2291
2285
|
pos: t
|
|
2292
2286
|
}], l = o, u = a.bnBlock.beforePos;
|
|
2293
2287
|
for (; l && r.get(l) === void 0;) {
|
|
2294
|
-
let e =
|
|
2288
|
+
let e = M({
|
|
2295
2289
|
posBeforeNode: u - l.nodeSize,
|
|
2296
2290
|
node: l
|
|
2297
2291
|
});
|
|
@@ -2303,7 +2297,7 @@ function Xn(e, t, n, r) {
|
|
|
2303
2297
|
let t = n.doc.resolve(e.bnBlock.beforePos).nodeBefore;
|
|
2304
2298
|
u = e.bnBlock.beforePos, l = t;
|
|
2305
2299
|
}
|
|
2306
|
-
let d, f, p = c[c.length - 1], m =
|
|
2300
|
+
let d, f, p = c[c.length - 1], m = M({
|
|
2307
2301
|
posBeforeNode: p.pos,
|
|
2308
2302
|
node: p.node
|
|
2309
2303
|
});
|
|
@@ -2320,15 +2314,16 @@ function Xn(e, t, n, r) {
|
|
|
2320
2314
|
hasStart: i
|
|
2321
2315
|
};
|
|
2322
2316
|
}
|
|
2323
|
-
function
|
|
2324
|
-
let n = /* @__PURE__ */ new Map(), r = t.decorations.map(e.mapping, e.doc), i = e.changedRange()
|
|
2325
|
-
|
|
2326
|
-
|
|
2317
|
+
function ir(e, t) {
|
|
2318
|
+
let n = /* @__PURE__ */ new Map(), r = t.decorations.map(e.mapping, e.doc), i = e.changedRange() ?? {
|
|
2319
|
+
from: 0,
|
|
2320
|
+
to: e.doc.nodeSize - 2
|
|
2321
|
+
}, a = [], o = /* @__PURE__ */ new Set();
|
|
2327
2322
|
e.doc.nodesBetween(i.from, e.doc.nodeSize - 2, (t, s, c) => {
|
|
2328
2323
|
if (c && o.has(c)) return !1;
|
|
2329
2324
|
if (t.type.name === "blockContainer" && t.firstChild.type.name === "numberedListItem") {
|
|
2330
|
-
let { index: l, isFirst: u, hasStart: d } =
|
|
2331
|
-
if (r.find(s + 1, s + 1 + f.nodeSize, (e) => e.index === l && e.isFirst === u && e.hasStart === d).length === 0) a.push(
|
|
2325
|
+
let { index: l, isFirst: u, hasStart: d } = rr(t, s, e, n), f = e.doc.nodeAt(s + 1);
|
|
2326
|
+
if (r.find(s + 1, s + 1 + f.nodeSize, (e) => e.index === l && e.isFirst === u && e.hasStart === d).length === 0) a.push(be.node(s + 1, s + 1 + f.nodeSize, { "data-index": l.toString() }, {
|
|
2332
2327
|
index: l,
|
|
2333
2328
|
isFirst: u,
|
|
2334
2329
|
hasStart: d
|
|
@@ -2339,20 +2334,20 @@ function Zn(e, t) {
|
|
|
2339
2334
|
let s = a.flatMap((e) => r.find(e.from, e.to));
|
|
2340
2335
|
return { decorations: r.remove(s).add(e.doc, a) };
|
|
2341
2336
|
}
|
|
2342
|
-
var
|
|
2343
|
-
key: new
|
|
2337
|
+
var ar = () => new ve({
|
|
2338
|
+
key: new ye("numbered-list-indexing-decorations"),
|
|
2344
2339
|
state: {
|
|
2345
2340
|
init(e, t) {
|
|
2346
|
-
return
|
|
2341
|
+
return ir(t.tr, { decorations: xe.empty });
|
|
2347
2342
|
},
|
|
2348
2343
|
apply(e, t) {
|
|
2349
|
-
return !e.docChanged && t.decorations ? t :
|
|
2344
|
+
return !e.docChanged && t.decorations ? t : ir(e, t);
|
|
2350
2345
|
}
|
|
2351
2346
|
},
|
|
2352
2347
|
props: { decorations(e) {
|
|
2353
|
-
return this.getState(e)?.decorations ??
|
|
2348
|
+
return this.getState(e)?.decorations ?? xe.empty;
|
|
2354
2349
|
} }
|
|
2355
|
-
}),
|
|
2350
|
+
}), or = A(() => ({
|
|
2356
2351
|
type: "numberedListItem",
|
|
2357
2352
|
propSchema: {
|
|
2358
2353
|
...K,
|
|
@@ -2362,7 +2357,7 @@ var Qn = () => new pe({
|
|
|
2362
2357
|
}
|
|
2363
2358
|
},
|
|
2364
2359
|
content: "inline"
|
|
2365
|
-
})),
|
|
2360
|
+
})), sr = j(or, {
|
|
2366
2361
|
meta: { isolating: !1 },
|
|
2367
2362
|
parse(e) {
|
|
2368
2363
|
if (e.tagName !== "LI") return;
|
|
@@ -2375,7 +2370,7 @@ var Qn = () => new pe({
|
|
|
2375
2370
|
};
|
|
2376
2371
|
}
|
|
2377
2372
|
},
|
|
2378
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2373
|
+
parseContent: ({ el: e, schema: t }) => Qn(e, t, "numberedListItem"),
|
|
2379
2374
|
render() {
|
|
2380
2375
|
let e = document.createElement("p");
|
|
2381
2376
|
return {
|
|
@@ -2395,7 +2390,7 @@ var Qn = () => new pe({
|
|
|
2395
2390
|
inputRules: [{
|
|
2396
2391
|
find: /^\s?(\d+)\.\s$/,
|
|
2397
2392
|
replace({ match: e, editor: t }) {
|
|
2398
|
-
if (
|
|
2393
|
+
if (tt(t.prosemirrorState).blockNoteType === "heading") return;
|
|
2399
2394
|
let n = parseInt(e[1]);
|
|
2400
2395
|
return {
|
|
2401
2396
|
type: "numberedListItem",
|
|
@@ -2404,7 +2399,7 @@ var Qn = () => new pe({
|
|
|
2404
2399
|
}
|
|
2405
2400
|
}],
|
|
2406
2401
|
keyboardShortcuts: {
|
|
2407
|
-
Enter: ({ editor: e }) =>
|
|
2402
|
+
Enter: ({ editor: e }) => Zn(e, "numberedListItem"),
|
|
2408
2403
|
"Mod-Shift-7": ({ editor: e }) => {
|
|
2409
2404
|
let t = e.getTextCursorPosition();
|
|
2410
2405
|
return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
|
|
@@ -2413,12 +2408,12 @@ var Qn = () => new pe({
|
|
|
2413
2408
|
}), !0) : !1;
|
|
2414
2409
|
}
|
|
2415
2410
|
},
|
|
2416
|
-
prosemirrorPlugins: [
|
|
2417
|
-
})]),
|
|
2411
|
+
prosemirrorPlugins: [ar()]
|
|
2412
|
+
})]), cr = A(() => ({
|
|
2418
2413
|
type: "toggleListItem",
|
|
2419
2414
|
propSchema: { ...K },
|
|
2420
2415
|
content: "inline"
|
|
2421
|
-
})),
|
|
2416
|
+
})), lr = j(cr, {
|
|
2422
2417
|
meta: { isolating: !1 },
|
|
2423
2418
|
parse(e) {
|
|
2424
2419
|
if (e.tagName === "DETAILS") return q(e);
|
|
@@ -2430,13 +2425,13 @@ var Qn = () => new pe({
|
|
|
2430
2425
|
parseContent: ({ el: e, schema: t }) => {
|
|
2431
2426
|
let n = e.tagName === "DETAILS" ? e : e.querySelector(":scope > details");
|
|
2432
2427
|
if (!n) throw Error("No details found in toggleListItem parseContent");
|
|
2433
|
-
return
|
|
2428
|
+
return Pn(n, t, "toggleListItem");
|
|
2434
2429
|
},
|
|
2435
2430
|
runsBefore: ["bulletListItem"],
|
|
2436
2431
|
render(e, t) {
|
|
2437
2432
|
let n = document.createElement("p");
|
|
2438
2433
|
return {
|
|
2439
|
-
...
|
|
2434
|
+
...In(e, t, n),
|
|
2440
2435
|
contentDOM: n
|
|
2441
2436
|
};
|
|
2442
2437
|
},
|
|
@@ -2453,7 +2448,7 @@ var Qn = () => new pe({
|
|
|
2453
2448
|
}, [t({
|
|
2454
2449
|
key: "toggle-list-item-shortcuts",
|
|
2455
2450
|
keyboardShortcuts: {
|
|
2456
|
-
Enter: ({ editor: e }) =>
|
|
2451
|
+
Enter: ({ editor: e }) => Zn(e, "toggleListItem"),
|
|
2457
2452
|
"Mod-Shift-6": ({ editor: e }) => {
|
|
2458
2453
|
let t = e.getTextCursorPosition();
|
|
2459
2454
|
return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
|
|
@@ -2462,11 +2457,11 @@ var Qn = () => new pe({
|
|
|
2462
2457
|
}), !0) : !1;
|
|
2463
2458
|
}
|
|
2464
2459
|
}
|
|
2465
|
-
})]),
|
|
2460
|
+
})]), ur = A(() => ({
|
|
2466
2461
|
type: "pageBreak",
|
|
2467
2462
|
propSchema: {},
|
|
2468
2463
|
content: "none"
|
|
2469
|
-
})),
|
|
2464
|
+
})), dr = j(ur, {
|
|
2470
2465
|
parse(e) {
|
|
2471
2466
|
if (e.tagName === "DIV" && e.hasAttribute("data-page-break")) return {};
|
|
2472
2467
|
},
|
|
@@ -2478,11 +2473,11 @@ var Qn = () => new pe({
|
|
|
2478
2473
|
let e = document.createElement("div");
|
|
2479
2474
|
return e.setAttribute("data-page-break", ""), { dom: e };
|
|
2480
2475
|
}
|
|
2481
|
-
}),
|
|
2476
|
+
}), fr = (e) => e.extend({ blockSpecs: { pageBreak: dr() } }), pr = A(() => ({
|
|
2482
2477
|
type: "paragraph",
|
|
2483
2478
|
propSchema: K,
|
|
2484
2479
|
content: "inline"
|
|
2485
|
-
})),
|
|
2480
|
+
})), mr = j(pr, {
|
|
2486
2481
|
meta: { isolating: !1 },
|
|
2487
2482
|
parse: (e) => {
|
|
2488
2483
|
if (e.tagName === "P" && e.textContent?.trim()) return q(e);
|
|
@@ -2511,14 +2506,14 @@ var Qn = () => new pe({
|
|
|
2511
2506
|
props: {}
|
|
2512
2507
|
}), !0) : !1;
|
|
2513
2508
|
} }
|
|
2514
|
-
})]),
|
|
2509
|
+
})]), hr = A(() => ({
|
|
2515
2510
|
type: "quote",
|
|
2516
2511
|
propSchema: {
|
|
2517
2512
|
backgroundColor: K.backgroundColor,
|
|
2518
2513
|
textColor: K.textColor
|
|
2519
2514
|
},
|
|
2520
2515
|
content: "inline"
|
|
2521
|
-
})),
|
|
2516
|
+
})), gr = j(hr, {
|
|
2522
2517
|
meta: { isolating: !1 },
|
|
2523
2518
|
parse(e) {
|
|
2524
2519
|
if (e.tagName === "BLOCKQUOTE") {
|
|
@@ -2569,32 +2564,36 @@ var Qn = () => new pe({
|
|
|
2569
2564
|
};
|
|
2570
2565
|
}
|
|
2571
2566
|
}]
|
|
2572
|
-
})]),
|
|
2567
|
+
})]), _r = 120, vr = 31, yr = s.create({
|
|
2573
2568
|
name: "BlockNoteTableExtension",
|
|
2574
|
-
addProseMirrorPlugins: () => [
|
|
2569
|
+
addProseMirrorPlugins: () => [le({
|
|
2575
2570
|
cellMinWidth: 35,
|
|
2576
2571
|
defaultCellMinWidth: 120,
|
|
2577
2572
|
View: null
|
|
2578
|
-
}),
|
|
2573
|
+
}), he()],
|
|
2579
2574
|
addKeyboardShortcuts() {
|
|
2580
2575
|
return {
|
|
2581
|
-
Enter: () => this.editor.state.selection
|
|
2576
|
+
Enter: () => this.editor.state.selection.$head.parent.type.name === "tableParagraph" ? this.editor.commands.command(({ state: e, dispatch: t }) => {
|
|
2577
|
+
if (!de(e)) return !1;
|
|
2578
|
+
let n = pe(me(e), "vert", 1);
|
|
2579
|
+
return n ? (t && t(e.tr.setSelection(y.between(n, fe(n))).scrollIntoView()), !0) : !1;
|
|
2580
|
+
}) : !1,
|
|
2582
2581
|
Backspace: () => {
|
|
2583
2582
|
let e = this.editor.state.selection, t = e.empty, n = e.$head.parentOffset === 0, r = e.$head.node().type.name === "tableParagraph";
|
|
2584
2583
|
return t && n && r;
|
|
2585
2584
|
},
|
|
2586
|
-
Tab: () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) =>
|
|
2587
|
-
"Shift-Tab": () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) =>
|
|
2585
|
+
Tab: () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) => ue(1)(e, t, n)),
|
|
2586
|
+
"Shift-Tab": () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) => ue(-1)(e, t, n))
|
|
2588
2587
|
};
|
|
2589
2588
|
},
|
|
2590
2589
|
extendNodeSchema(e) {
|
|
2591
|
-
return { tableRole:
|
|
2590
|
+
return { tableRole: d(g(e, "tableRole", {
|
|
2592
2591
|
name: e.name,
|
|
2593
2592
|
options: e.options,
|
|
2594
2593
|
storage: e.storage
|
|
2595
2594
|
})) };
|
|
2596
2595
|
}
|
|
2597
|
-
}),
|
|
2596
|
+
}), br = { textColor: K.textColor }, xr = u.create({
|
|
2598
2597
|
name: "tableHeader",
|
|
2599
2598
|
addOptions() {
|
|
2600
2599
|
return { HTMLAttributes: {} };
|
|
@@ -2618,17 +2617,17 @@ var Qn = () => new pe({
|
|
|
2618
2617
|
parseHTML() {
|
|
2619
2618
|
return [{
|
|
2620
2619
|
tag: "th",
|
|
2621
|
-
getContent: (e, t) =>
|
|
2620
|
+
getContent: (e, t) => Er(e, t)
|
|
2622
2621
|
}];
|
|
2623
2622
|
},
|
|
2624
2623
|
renderHTML({ HTMLAttributes: e }) {
|
|
2625
2624
|
return [
|
|
2626
2625
|
"th",
|
|
2627
|
-
|
|
2626
|
+
v(this.options.HTMLAttributes, e),
|
|
2628
2627
|
0
|
|
2629
2628
|
];
|
|
2630
2629
|
}
|
|
2631
|
-
}),
|
|
2630
|
+
}), Sr = u.create({
|
|
2632
2631
|
name: "tableCell",
|
|
2633
2632
|
addOptions() {
|
|
2634
2633
|
return { HTMLAttributes: {} };
|
|
@@ -2652,17 +2651,17 @@ var Qn = () => new pe({
|
|
|
2652
2651
|
parseHTML() {
|
|
2653
2652
|
return [{
|
|
2654
2653
|
tag: "td",
|
|
2655
|
-
getContent: (e, t) =>
|
|
2654
|
+
getContent: (e, t) => Er(e, t)
|
|
2656
2655
|
}];
|
|
2657
2656
|
},
|
|
2658
2657
|
renderHTML({ HTMLAttributes: e }) {
|
|
2659
2658
|
return [
|
|
2660
2659
|
"td",
|
|
2661
|
-
|
|
2660
|
+
v(this.options.HTMLAttributes, e),
|
|
2662
2661
|
0
|
|
2663
2662
|
];
|
|
2664
2663
|
}
|
|
2665
|
-
}),
|
|
2664
|
+
}), Cr = u.create({
|
|
2666
2665
|
name: "table",
|
|
2667
2666
|
content: "tableRow+",
|
|
2668
2667
|
group: "blockContent",
|
|
@@ -2673,7 +2672,7 @@ var Qn = () => new pe({
|
|
|
2673
2672
|
return [{ tag: "table" }];
|
|
2674
2673
|
},
|
|
2675
2674
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
2676
|
-
let n =
|
|
2675
|
+
let n = Ve(this.name, "table", {
|
|
2677
2676
|
...this.options.domAttributes?.blockContent || {},
|
|
2678
2677
|
...t
|
|
2679
2678
|
}, this.options.domAttributes?.inlineContent || {}), r = document.createElement("colgroup");
|
|
@@ -2686,11 +2685,11 @@ var Qn = () => new pe({
|
|
|
2686
2685
|
},
|
|
2687
2686
|
addNodeView() {
|
|
2688
2687
|
return ({ node: e, HTMLAttributes: t }) => {
|
|
2689
|
-
class n extends
|
|
2688
|
+
class n extends ce {
|
|
2690
2689
|
constructor(e, t, n) {
|
|
2691
2690
|
super(e, t), this.node = e, this.cellMinWidth = t, this.blockContentHTMLAttributes = n;
|
|
2692
2691
|
let r = document.createElement("div");
|
|
2693
|
-
r.className =
|
|
2692
|
+
r.className = D("bn-block-content", n.class), r.setAttribute("data-content-type", "table");
|
|
2694
2693
|
for (let [e, t] of Object.entries(n)) e !== "class" && r.setAttribute(e, t);
|
|
2695
2694
|
let i = this.dom, a = document.createElement("div");
|
|
2696
2695
|
a.className = "tableWrapper-inner", a.appendChild(i.firstChild), i.appendChild(a), r.appendChild(i);
|
|
@@ -2702,8 +2701,8 @@ var Qn = () => new pe({
|
|
|
2702
2701
|
}
|
|
2703
2702
|
update(e) {
|
|
2704
2703
|
if (!super.update(e)) return !1;
|
|
2705
|
-
for (let [t, n] of Object.entries(
|
|
2706
|
-
let r =
|
|
2704
|
+
for (let [t, n] of Object.entries(br)) {
|
|
2705
|
+
let r = O(t), i = e.attrs[t];
|
|
2707
2706
|
i === n.default ? this.dom.removeAttribute(r) : this.dom.setAttribute(r, String(i));
|
|
2708
2707
|
}
|
|
2709
2708
|
return !0;
|
|
@@ -2715,7 +2714,7 @@ var Qn = () => new pe({
|
|
|
2715
2714
|
});
|
|
2716
2715
|
};
|
|
2717
2716
|
}
|
|
2718
|
-
}),
|
|
2717
|
+
}), wr = u.create({
|
|
2719
2718
|
name: "tableParagraph",
|
|
2720
2719
|
group: "tableContent",
|
|
2721
2720
|
content: "inline*",
|
|
@@ -2737,7 +2736,7 @@ var Qn = () => new pe({
|
|
|
2737
2736
|
0
|
|
2738
2737
|
];
|
|
2739
2738
|
}
|
|
2740
|
-
}),
|
|
2739
|
+
}), Tr = u.create({
|
|
2741
2740
|
name: "tableRow",
|
|
2742
2741
|
addOptions() {
|
|
2743
2742
|
return { HTMLAttributes: {} };
|
|
@@ -2751,34 +2750,34 @@ var Qn = () => new pe({
|
|
|
2751
2750
|
renderHTML({ HTMLAttributes: e }) {
|
|
2752
2751
|
return [
|
|
2753
2752
|
"tr",
|
|
2754
|
-
|
|
2753
|
+
v(this.options.HTMLAttributes, e),
|
|
2755
2754
|
0
|
|
2756
2755
|
];
|
|
2757
2756
|
}
|
|
2758
2757
|
});
|
|
2759
|
-
function
|
|
2758
|
+
function Er(e, t) {
|
|
2760
2759
|
let i = n.fromSchema(t).parse(e, { topNode: t.nodes.blockGroup.create() }), a = [];
|
|
2761
2760
|
return i.content.descendants((e) => {
|
|
2762
2761
|
if (e.isInline) return a.push(e), !1;
|
|
2763
2762
|
}), r.fromArray(a);
|
|
2764
2763
|
}
|
|
2765
|
-
var
|
|
2766
|
-
node:
|
|
2764
|
+
var Dr = () => Je({
|
|
2765
|
+
node: Cr,
|
|
2767
2766
|
type: "table",
|
|
2768
2767
|
content: "table"
|
|
2769
|
-
},
|
|
2768
|
+
}, br, [t({
|
|
2770
2769
|
key: "table-extensions",
|
|
2771
2770
|
tiptapExtensions: [
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2771
|
+
yr,
|
|
2772
|
+
wr,
|
|
2773
|
+
xr,
|
|
2774
|
+
Sr,
|
|
2775
|
+
Tr
|
|
2777
2776
|
]
|
|
2778
2777
|
}), t({
|
|
2779
2778
|
key: "table-keyboard-delete",
|
|
2780
2779
|
keyboardShortcuts: { Backspace: ({ editor: e }) => {
|
|
2781
|
-
if (!(e.prosemirrorState.selection instanceof
|
|
2780
|
+
if (!(e.prosemirrorState.selection instanceof oe)) return !1;
|
|
2782
2781
|
let t = e.getTextCursorPosition().block, n = t.content, r = 0;
|
|
2783
2782
|
for (let e of n.rows) for (let t of e.cells) {
|
|
2784
2783
|
if ("type" in t && t.content.length > 0 || !("type" in t) && t.length > 0) return !1;
|
|
@@ -2791,10 +2790,11 @@ var br = () => Ge({
|
|
|
2791
2790
|
(e.getPrevBlock(t) || e.getNextBlock(t)) && e.setTextCursorPosition(t), e.removeBlocks([t]);
|
|
2792
2791
|
}), !0);
|
|
2793
2792
|
} }
|
|
2794
|
-
})]),
|
|
2793
|
+
})]), Or = (e) => ({
|
|
2795
2794
|
url: e.src || void 0,
|
|
2796
|
-
previewWidth: e.width || void 0
|
|
2797
|
-
|
|
2795
|
+
previewWidth: e.width || void 0,
|
|
2796
|
+
name: e.getAttribute("data-name") || void 0
|
|
2797
|
+
}), kr = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z\"></path></svg>", Ar = A((e) => ({
|
|
2798
2798
|
type: "video",
|
|
2799
2799
|
propSchema: {
|
|
2800
2800
|
textAlignment: K.textAlignment,
|
|
@@ -2809,28 +2809,28 @@ var br = () => Ge({
|
|
|
2809
2809
|
}
|
|
2810
2810
|
},
|
|
2811
2811
|
content: "none"
|
|
2812
|
-
})),
|
|
2812
|
+
})), jr = (e) => (e) => {
|
|
2813
2813
|
if (e.tagName === "VIDEO") {
|
|
2814
2814
|
if (e.closest("figure")) return;
|
|
2815
2815
|
let { backgroundColor: t } = q(e);
|
|
2816
2816
|
return {
|
|
2817
|
-
...
|
|
2817
|
+
...Or(e),
|
|
2818
2818
|
backgroundColor: t
|
|
2819
2819
|
};
|
|
2820
2820
|
}
|
|
2821
2821
|
if (e.tagName === "FIGURE") {
|
|
2822
|
-
let t =
|
|
2822
|
+
let t = cn(e, "video");
|
|
2823
2823
|
if (!t) return;
|
|
2824
2824
|
let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
|
|
2825
2825
|
return {
|
|
2826
|
-
...
|
|
2826
|
+
...Or(n),
|
|
2827
2827
|
backgroundColor: i,
|
|
2828
2828
|
caption: r
|
|
2829
2829
|
};
|
|
2830
2830
|
}
|
|
2831
|
-
},
|
|
2831
|
+
}, Mr = j(Ar, (e) => ({
|
|
2832
2832
|
meta: { fileBlockAccept: ["video/*"] },
|
|
2833
|
-
parse:
|
|
2833
|
+
parse: jr(e),
|
|
2834
2834
|
render(t, n) {
|
|
2835
2835
|
let r = document.createElement("div");
|
|
2836
2836
|
r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z\"></path></svg>";
|
|
@@ -2839,18 +2839,15 @@ var br = () => Ge({
|
|
|
2839
2839
|
let a = document.createElement("video");
|
|
2840
2840
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
2841
2841
|
a.src = e;
|
|
2842
|
-
}) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, a.width = t.props.previewWidth, i.appendChild(a),
|
|
2842
|
+
}) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a), Vn(t, n, { dom: i }, i, r.firstElementChild);
|
|
2843
2843
|
},
|
|
2844
2844
|
toExternalHTML(e) {
|
|
2845
|
-
if (!e.props.url) {
|
|
2846
|
-
let e = document.createElement("p");
|
|
2847
|
-
return e.textContent = "Add video", { dom: e };
|
|
2848
|
-
}
|
|
2845
|
+
if (!e.props.url) return { dom: document.createElement("video") };
|
|
2849
2846
|
let t;
|
|
2850
|
-
return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, e.props.previewWidth && (t.width = e.props.previewWidth)) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
2847
|
+
return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, e.props.previewWidth && (t.width = e.props.previewWidth)) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? pn(t, e.props.caption) : mn(t, e.props.caption) : { dom: t };
|
|
2851
2848
|
},
|
|
2852
2849
|
runsBefore: ["file"]
|
|
2853
|
-
})),
|
|
2850
|
+
})), Nr = async (e) => {
|
|
2854
2851
|
let t = new FormData();
|
|
2855
2852
|
return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
2856
2853
|
method: "POST",
|
|
@@ -2859,7 +2856,7 @@ var br = () => Ge({
|
|
|
2859
2856
|
};
|
|
2860
2857
|
//#endregion
|
|
2861
2858
|
//#region src/blocks/defaultBlockTypeGuards.ts
|
|
2862
|
-
function
|
|
2859
|
+
function X(e, t, n) {
|
|
2863
2860
|
if (!(t in e.schema.blockSpecs)) return !1;
|
|
2864
2861
|
if (!n) return !0;
|
|
2865
2862
|
for (let [r, i] of Object.entries(n)) {
|
|
@@ -2875,40 +2872,76 @@ function Z(e, t, n) {
|
|
|
2875
2872
|
}
|
|
2876
2873
|
return !0;
|
|
2877
2874
|
}
|
|
2878
|
-
function
|
|
2879
|
-
return
|
|
2875
|
+
function Pr(e, t, n, r) {
|
|
2876
|
+
return X(t, n, r) && e.type === n;
|
|
2880
2877
|
}
|
|
2881
|
-
function
|
|
2882
|
-
return e instanceof
|
|
2878
|
+
function Fr(e) {
|
|
2879
|
+
return e instanceof oe;
|
|
2883
2880
|
}
|
|
2884
2881
|
//#endregion
|
|
2885
|
-
//#region src/
|
|
2886
|
-
var
|
|
2887
|
-
|
|
2888
|
-
|
|
2882
|
+
//#region src/extensions/FormattingToolbar/FormattingToolbar.ts
|
|
2883
|
+
var Z = t(({ editor: t }) => {
|
|
2884
|
+
let n = e(!1), r = () => t.transact((e) => {
|
|
2885
|
+
if (e.selection.empty || e.selection instanceof y && e.doc.textBetween(e.selection.from, e.selection.to).length === 0) return !1;
|
|
2886
|
+
let t = !1;
|
|
2887
|
+
return e.selection.content().content.descendants((e) => (e.type.spec.code && (t = !0), !t)), !t;
|
|
2888
|
+
});
|
|
2889
|
+
return {
|
|
2890
|
+
key: "formattingToolbar",
|
|
2891
|
+
store: n,
|
|
2892
|
+
mount({ dom: e, signal: i }) {
|
|
2893
|
+
let a = !1, o = !1, s = t.onChange(() => {
|
|
2894
|
+
a || o || n.setState(r());
|
|
2895
|
+
}), c = t.onSelectionChange(() => {
|
|
2896
|
+
a || o || n.setState(r());
|
|
2897
|
+
});
|
|
2898
|
+
e.addEventListener("pointerdown", () => {
|
|
2899
|
+
a = !0, n.setState(!1);
|
|
2900
|
+
}, { signal: i }), t.prosemirrorView.root.addEventListener("pointerup", () => {
|
|
2901
|
+
a = !1, t.isFocused() && n.setState(r());
|
|
2902
|
+
}, {
|
|
2903
|
+
signal: i,
|
|
2904
|
+
capture: !0
|
|
2905
|
+
}), e.addEventListener("pointercancel", () => {
|
|
2906
|
+
a = !0;
|
|
2907
|
+
}, {
|
|
2908
|
+
signal: i,
|
|
2909
|
+
capture: !0
|
|
2910
|
+
}), t.prosemirrorView.root.addEventListener("dragstart", () => {
|
|
2911
|
+
o = !0, n.setState(!1);
|
|
2912
|
+
}, { signal: i }), t.prosemirrorView.root.addEventListener("dragend", () => {
|
|
2913
|
+
o = !1;
|
|
2914
|
+
}, { signal: i }), i.addEventListener("abort", () => {
|
|
2915
|
+
s(), c();
|
|
2916
|
+
});
|
|
2917
|
+
}
|
|
2918
|
+
};
|
|
2919
|
+
}), Ir = /* @__PURE__ */ new Map();
|
|
2920
|
+
function Lr(e) {
|
|
2921
|
+
if (Ir.has(e)) return Ir.get(e);
|
|
2889
2922
|
let t = new a();
|
|
2890
2923
|
return e._tiptapEditor.on("transaction", ({ transaction: e }) => {
|
|
2891
2924
|
t.appendMapping(e.mapping);
|
|
2892
2925
|
}), e._tiptapEditor.on("destroy", () => {
|
|
2893
|
-
|
|
2894
|
-
}),
|
|
2926
|
+
Ir.delete(e);
|
|
2927
|
+
}), Ir.set(e, t), t;
|
|
2895
2928
|
}
|
|
2896
|
-
function
|
|
2897
|
-
let r =
|
|
2929
|
+
function Rr(e, t, n = "left") {
|
|
2930
|
+
let r = Ee.getState(e.prosemirrorState);
|
|
2898
2931
|
if (!r) {
|
|
2899
|
-
let r =
|
|
2932
|
+
let r = Lr(e), i = r.maps.length;
|
|
2900
2933
|
return () => r.slice(i).map(t, n === "left" ? -1 : 1);
|
|
2901
2934
|
}
|
|
2902
|
-
let i =
|
|
2935
|
+
let i = we(t + (n === "right" ? 1 : -1), r.binding.type, r.binding.mapping);
|
|
2903
2936
|
return () => {
|
|
2904
|
-
let t =
|
|
2937
|
+
let t = Ee.getState(e.prosemirrorState), r = Te(t.doc, t.binding.type, i, t.binding.mapping);
|
|
2905
2938
|
if (r === null) throw Error("Position not found, cannot track positions");
|
|
2906
2939
|
return r + (n === "right" ? -1 : 1);
|
|
2907
2940
|
};
|
|
2908
2941
|
}
|
|
2909
2942
|
//#endregion
|
|
2910
2943
|
//#region src/extensions/SuggestionMenu/SuggestionMenu.ts
|
|
2911
|
-
var
|
|
2944
|
+
var zr = m((e) => e.type.name === "blockContainer"), Br = class {
|
|
2912
2945
|
state;
|
|
2913
2946
|
emitUpdate;
|
|
2914
2947
|
rootEl;
|
|
@@ -2955,7 +2988,7 @@ var Mr = p((e) => e.type.name === "blockContainer"), Nr = class {
|
|
|
2955
2988
|
to: this.editor.transact((e) => e.selection.from)
|
|
2956
2989
|
}).run();
|
|
2957
2990
|
};
|
|
2958
|
-
}, Q = new
|
|
2991
|
+
}, Q = new te("SuggestionMenuPlugin"), Vr = t(({ editor: t }) => {
|
|
2959
2992
|
let n = /* @__PURE__ */ new Map(), r, i = e(void 0);
|
|
2960
2993
|
return {
|
|
2961
2994
|
key: "suggestionMenu",
|
|
@@ -2982,9 +3015,9 @@ var Mr = p((e) => e.type.name === "blockContainer"), Nr = class {
|
|
|
2982
3015
|
});
|
|
2983
3016
|
}));
|
|
2984
3017
|
},
|
|
2985
|
-
prosemirrorPlugins: [new
|
|
3018
|
+
prosemirrorPlugins: [new ee({
|
|
2986
3019
|
key: Q,
|
|
2987
|
-
view: (e) => (r = new
|
|
3020
|
+
view: (e) => (r = new Br(t, (e, t) => {
|
|
2988
3021
|
i.setState({
|
|
2989
3022
|
...t,
|
|
2990
3023
|
triggerCharacter: e
|
|
@@ -2997,7 +3030,7 @@ var Mr = p((e) => e.type.name === "blockContainer"), Nr = class {
|
|
|
2997
3030
|
let o = e.getMeta(Q);
|
|
2998
3031
|
if (typeof o == "object" && o) {
|
|
2999
3032
|
n && r?.closeMenu();
|
|
3000
|
-
let e =
|
|
3033
|
+
let e = Rr(t, a.selection.from - o.triggerCharacter.length);
|
|
3001
3034
|
return {
|
|
3002
3035
|
triggerCharacter: o.triggerCharacter,
|
|
3003
3036
|
deleteTriggerCharacter: o.deleteTriggerCharacter !== !1,
|
|
@@ -3031,14 +3064,14 @@ var Mr = p((e) => e.type.name === "blockContainer"), Nr = class {
|
|
|
3031
3064
|
let t = this.getState(e);
|
|
3032
3065
|
if (t === void 0) return null;
|
|
3033
3066
|
if (!t.deleteTriggerCharacter) {
|
|
3034
|
-
let n =
|
|
3035
|
-
if (n) return
|
|
3067
|
+
let n = zr(e.selection);
|
|
3068
|
+
if (n) return Ce.create(e.doc, [Se.node(n.pos, n.pos + n.node.nodeSize, {
|
|
3036
3069
|
nodeName: "span",
|
|
3037
3070
|
class: "bn-suggestion-decorator",
|
|
3038
3071
|
"data-decoration-id": t.decorationId
|
|
3039
3072
|
})]);
|
|
3040
3073
|
}
|
|
3041
|
-
return
|
|
3074
|
+
return Ce.create(e.doc, [Se.inline(t.queryStartPos() - t.triggerCharacter.length, t.queryStartPos(), {
|
|
3042
3075
|
nodeName: "span",
|
|
3043
3076
|
class: "bn-suggestion-decorator",
|
|
3044
3077
|
"data-decoration-id": t.decorationId
|
|
@@ -3050,7 +3083,7 @@ var Mr = p((e) => e.type.name === "blockContainer"), Nr = class {
|
|
|
3050
3083
|
});
|
|
3051
3084
|
//#endregion
|
|
3052
3085
|
//#region src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts
|
|
3053
|
-
function
|
|
3086
|
+
function Hr(e) {
|
|
3054
3087
|
let t = e.getTextCursorPosition().block, n = e.schema.blockSchema[t.type].content;
|
|
3055
3088
|
for (; n === "none";) {
|
|
3056
3089
|
if (t = e.getTextCursorPosition().nextBlock, t === void 0) return;
|
|
@@ -3061,11 +3094,11 @@ function $(e, t) {
|
|
|
3061
3094
|
let n = e.getTextCursorPosition().block;
|
|
3062
3095
|
if (n.content === void 0) throw Error("Slash Menu open in a block that doesn't contain content.");
|
|
3063
3096
|
let r;
|
|
3064
|
-
return Array.isArray(n.content) && (n.content.length === 1 &&
|
|
3097
|
+
return Array.isArray(n.content) && (n.content.length === 1 && b(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (r = e.updateBlock(n, t), e.setTextCursorPosition(r)) : (r = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)), Hr(e), r;
|
|
3065
3098
|
}
|
|
3066
|
-
function
|
|
3099
|
+
function Ur(e) {
|
|
3067
3100
|
let t = [];
|
|
3068
|
-
return
|
|
3101
|
+
return X(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((e) => e <= 3).forEach((n) => {
|
|
3069
3102
|
t.push({
|
|
3070
3103
|
onItemClick: () => {
|
|
3071
3104
|
$(e, {
|
|
@@ -3073,65 +3106,65 @@ function Ir(e) {
|
|
|
3073
3106
|
props: { level: n }
|
|
3074
3107
|
});
|
|
3075
3108
|
},
|
|
3076
|
-
badge:
|
|
3109
|
+
badge: E(`Mod-Alt-${n}`),
|
|
3077
3110
|
key: n === 1 ? "heading" : `heading_${n}`,
|
|
3078
3111
|
...e.dictionary.slash_menu[n === 1 ? "heading" : `heading_${n}`]
|
|
3079
3112
|
});
|
|
3080
|
-
}),
|
|
3113
|
+
}), X(e, "quote") && t.push({
|
|
3081
3114
|
onItemClick: () => {
|
|
3082
3115
|
$(e, { type: "quote" });
|
|
3083
3116
|
},
|
|
3084
3117
|
key: "quote",
|
|
3085
3118
|
...e.dictionary.slash_menu.quote
|
|
3086
|
-
}),
|
|
3119
|
+
}), X(e, "toggleListItem") && t.push({
|
|
3087
3120
|
onItemClick: () => {
|
|
3088
3121
|
$(e, { type: "toggleListItem" });
|
|
3089
3122
|
},
|
|
3090
|
-
badge:
|
|
3123
|
+
badge: E("Mod-Shift-6"),
|
|
3091
3124
|
key: "toggle_list",
|
|
3092
3125
|
...e.dictionary.slash_menu.toggle_list
|
|
3093
|
-
}),
|
|
3126
|
+
}), X(e, "numberedListItem") && t.push({
|
|
3094
3127
|
onItemClick: () => {
|
|
3095
3128
|
$(e, { type: "numberedListItem" });
|
|
3096
3129
|
},
|
|
3097
|
-
badge:
|
|
3130
|
+
badge: E("Mod-Shift-7"),
|
|
3098
3131
|
key: "numbered_list",
|
|
3099
3132
|
...e.dictionary.slash_menu.numbered_list
|
|
3100
|
-
}),
|
|
3133
|
+
}), X(e, "bulletListItem") && t.push({
|
|
3101
3134
|
onItemClick: () => {
|
|
3102
3135
|
$(e, { type: "bulletListItem" });
|
|
3103
3136
|
},
|
|
3104
|
-
badge:
|
|
3137
|
+
badge: E("Mod-Shift-8"),
|
|
3105
3138
|
key: "bullet_list",
|
|
3106
3139
|
...e.dictionary.slash_menu.bullet_list
|
|
3107
|
-
}),
|
|
3140
|
+
}), X(e, "checkListItem") && t.push({
|
|
3108
3141
|
onItemClick: () => {
|
|
3109
3142
|
$(e, { type: "checkListItem" });
|
|
3110
3143
|
},
|
|
3111
|
-
badge:
|
|
3144
|
+
badge: E("Mod-Shift-9"),
|
|
3112
3145
|
key: "check_list",
|
|
3113
3146
|
...e.dictionary.slash_menu.check_list
|
|
3114
|
-
}),
|
|
3147
|
+
}), X(e, "paragraph") && t.push({
|
|
3115
3148
|
onItemClick: () => {
|
|
3116
3149
|
$(e, { type: "paragraph" });
|
|
3117
3150
|
},
|
|
3118
|
-
badge:
|
|
3151
|
+
badge: E("Mod-Alt-0"),
|
|
3119
3152
|
key: "paragraph",
|
|
3120
3153
|
...e.dictionary.slash_menu.paragraph
|
|
3121
|
-
}),
|
|
3154
|
+
}), X(e, "codeBlock") && t.push({
|
|
3122
3155
|
onItemClick: () => {
|
|
3123
3156
|
$(e, { type: "codeBlock" });
|
|
3124
3157
|
},
|
|
3125
|
-
badge:
|
|
3158
|
+
badge: E("Mod-Alt-c"),
|
|
3126
3159
|
key: "code_block",
|
|
3127
3160
|
...e.dictionary.slash_menu.code_block
|
|
3128
|
-
}),
|
|
3161
|
+
}), X(e, "divider") && t.push({
|
|
3129
3162
|
onItemClick: () => {
|
|
3130
3163
|
$(e, { type: "divider" });
|
|
3131
3164
|
},
|
|
3132
3165
|
key: "divider",
|
|
3133
3166
|
...e.dictionary.slash_menu.divider
|
|
3134
|
-
}),
|
|
3167
|
+
}), X(e, "table") && t.push({
|
|
3135
3168
|
onItemClick: () => {
|
|
3136
3169
|
$(e, {
|
|
3137
3170
|
type: "table",
|
|
@@ -3152,35 +3185,35 @@ function Ir(e) {
|
|
|
3152
3185
|
badge: void 0,
|
|
3153
3186
|
key: "table",
|
|
3154
3187
|
...e.dictionary.slash_menu.table
|
|
3155
|
-
}),
|
|
3188
|
+
}), X(e, "image", { url: "string" }) && t.push({
|
|
3156
3189
|
onItemClick: () => {
|
|
3157
3190
|
let t = $(e, { type: "image" });
|
|
3158
|
-
e.getExtension(Y)?.showMenu(t.id);
|
|
3191
|
+
e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3159
3192
|
},
|
|
3160
3193
|
key: "image",
|
|
3161
3194
|
...e.dictionary.slash_menu.image
|
|
3162
|
-
}),
|
|
3195
|
+
}), X(e, "video", { url: "string" }) && t.push({
|
|
3163
3196
|
onItemClick: () => {
|
|
3164
3197
|
let t = $(e, { type: "video" });
|
|
3165
|
-
e.getExtension(Y)?.showMenu(t.id);
|
|
3198
|
+
e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3166
3199
|
},
|
|
3167
3200
|
key: "video",
|
|
3168
3201
|
...e.dictionary.slash_menu.video
|
|
3169
|
-
}),
|
|
3202
|
+
}), X(e, "audio", { url: "string" }) && t.push({
|
|
3170
3203
|
onItemClick: () => {
|
|
3171
3204
|
let t = $(e, { type: "audio" });
|
|
3172
|
-
e.getExtension(Y)?.showMenu(t.id);
|
|
3205
|
+
e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3173
3206
|
},
|
|
3174
3207
|
key: "audio",
|
|
3175
3208
|
...e.dictionary.slash_menu.audio
|
|
3176
|
-
}),
|
|
3209
|
+
}), X(e, "file", { url: "string" }) && t.push({
|
|
3177
3210
|
onItemClick: () => {
|
|
3178
3211
|
let t = $(e, { type: "file" });
|
|
3179
|
-
e.getExtension(Y)?.showMenu(t.id);
|
|
3212
|
+
e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3180
3213
|
},
|
|
3181
3214
|
key: "file",
|
|
3182
3215
|
...e.dictionary.slash_menu.file
|
|
3183
|
-
}),
|
|
3216
|
+
}), X(e, "heading", {
|
|
3184
3217
|
level: "number",
|
|
3185
3218
|
isToggleable: "boolean"
|
|
3186
3219
|
}) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((e) => e <= 3).forEach((n) => {
|
|
@@ -3197,7 +3230,7 @@ function Ir(e) {
|
|
|
3197
3230
|
key: n === 1 ? "toggle_heading" : `toggle_heading_${n}`,
|
|
3198
3231
|
...e.dictionary.slash_menu[n === 1 ? "toggle_heading" : `toggle_heading_${n}`]
|
|
3199
3232
|
});
|
|
3200
|
-
}),
|
|
3233
|
+
}), X(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((e) => e > 3).forEach((n) => {
|
|
3201
3234
|
t.push({
|
|
3202
3235
|
onItemClick: () => {
|
|
3203
3236
|
$(e, {
|
|
@@ -3205,13 +3238,13 @@ function Ir(e) {
|
|
|
3205
3238
|
props: { level: n }
|
|
3206
3239
|
});
|
|
3207
3240
|
},
|
|
3208
|
-
badge:
|
|
3241
|
+
badge: E(`Mod-Alt-${n}`),
|
|
3209
3242
|
key: `heading_${n}`,
|
|
3210
3243
|
...e.dictionary.slash_menu[`heading_${n}`]
|
|
3211
3244
|
});
|
|
3212
3245
|
}), t.push({
|
|
3213
3246
|
onItemClick: () => {
|
|
3214
|
-
e.getExtension(
|
|
3247
|
+
e.getExtension(Vr)?.openSuggestionMenu(":", {
|
|
3215
3248
|
deleteTriggerCharacter: !0,
|
|
3216
3249
|
ignoreQueryLength: !0
|
|
3217
3250
|
});
|
|
@@ -3220,17 +3253,17 @@ function Ir(e) {
|
|
|
3220
3253
|
...e.dictionary.slash_menu.emoji
|
|
3221
3254
|
}), t;
|
|
3222
3255
|
}
|
|
3223
|
-
function
|
|
3256
|
+
function Wr(e, t) {
|
|
3224
3257
|
return e.filter(({ title: e, aliases: n }) => e.toLowerCase().includes(t.toLowerCase()) || n && n.filter((e) => e.toLowerCase().includes(t.toLowerCase())).length !== 0);
|
|
3225
3258
|
}
|
|
3226
3259
|
//#endregion
|
|
3227
3260
|
//#region src/blocks/PageBreak/getPageBreakSlashMenuItems.ts
|
|
3228
|
-
function
|
|
3261
|
+
function Gr(e) {
|
|
3229
3262
|
return "pageBreak" in e.schema.blockSchema;
|
|
3230
3263
|
}
|
|
3231
|
-
function
|
|
3264
|
+
function Kr(e) {
|
|
3232
3265
|
let t = [];
|
|
3233
|
-
return
|
|
3266
|
+
return Gr(e) && t.push({
|
|
3234
3267
|
...e.dictionary.slash_menu.page_break,
|
|
3235
3268
|
onItemClick: () => {
|
|
3236
3269
|
$(e, { type: "pageBreak" });
|
|
@@ -3240,22 +3273,22 @@ function zr(e) {
|
|
|
3240
3273
|
}
|
|
3241
3274
|
//#endregion
|
|
3242
3275
|
//#region src/blocks/defaultBlocks.ts
|
|
3243
|
-
var
|
|
3244
|
-
audio:
|
|
3245
|
-
bulletListItem:
|
|
3246
|
-
checkListItem:
|
|
3247
|
-
codeBlock:
|
|
3248
|
-
divider:
|
|
3249
|
-
file:
|
|
3250
|
-
heading:
|
|
3251
|
-
image:
|
|
3252
|
-
numberedListItem:
|
|
3253
|
-
paragraph:
|
|
3254
|
-
quote:
|
|
3255
|
-
table:
|
|
3256
|
-
toggleListItem:
|
|
3257
|
-
video:
|
|
3258
|
-
},
|
|
3276
|
+
var qr = {
|
|
3277
|
+
audio: xn(),
|
|
3278
|
+
bulletListItem: er(),
|
|
3279
|
+
checkListItem: nr(),
|
|
3280
|
+
codeBlock: En(),
|
|
3281
|
+
divider: kn(),
|
|
3282
|
+
file: Nn(),
|
|
3283
|
+
heading: Bn(),
|
|
3284
|
+
image: Jn(),
|
|
3285
|
+
numberedListItem: sr(),
|
|
3286
|
+
paragraph: mr(),
|
|
3287
|
+
quote: gr(),
|
|
3288
|
+
table: Dr(),
|
|
3289
|
+
toggleListItem: lr(),
|
|
3290
|
+
video: Mr()
|
|
3291
|
+
}, Jr = bt({
|
|
3259
3292
|
type: "textColor",
|
|
3260
3293
|
propSchema: "string"
|
|
3261
3294
|
}, {
|
|
@@ -3276,7 +3309,7 @@ var Br = {
|
|
|
3276
3309
|
parse: (e) => {
|
|
3277
3310
|
if (e.tagName === "SPAN" && e.style.color) return e.style.color;
|
|
3278
3311
|
}
|
|
3279
|
-
}),
|
|
3312
|
+
}), Yr = bt({
|
|
3280
3313
|
type: "backgroundColor",
|
|
3281
3314
|
propSchema: "string"
|
|
3282
3315
|
}, {
|
|
@@ -3297,15 +3330,26 @@ var Br = {
|
|
|
3297
3330
|
parse: (e) => {
|
|
3298
3331
|
if (e.tagName === "SPAN" && e.style.backgroundColor) return e.style.backgroundColor;
|
|
3299
3332
|
}
|
|
3300
|
-
}),
|
|
3301
|
-
bold:
|
|
3302
|
-
italic:
|
|
3303
|
-
underline:
|
|
3304
|
-
strike:
|
|
3305
|
-
code:
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3333
|
+
}), Xr = {
|
|
3334
|
+
bold: z(De, "boolean"),
|
|
3335
|
+
italic: z(ke, "boolean"),
|
|
3336
|
+
underline: z(je, "boolean"),
|
|
3337
|
+
strike: z(Ae, "boolean"),
|
|
3338
|
+
code: z(Oe.extend({ addInputRules() {
|
|
3339
|
+
return [_({
|
|
3340
|
+
find: /(^|[^`])`([^`]+)`(?!`)$/,
|
|
3341
|
+
type: this.type
|
|
3342
|
+
}), new c({
|
|
3343
|
+
find: /(^|[^`])`([^`]+)`(?!`) $/,
|
|
3344
|
+
handler: ({ state: e, range: t, match: n }) => {
|
|
3345
|
+
let { tr: r, schema: i } = e, a = n[1], o = n[2];
|
|
3346
|
+
r.replaceWith(t.from + a.length, t.to, [i.text(o, [this.type.create()]), i.text(" ")]);
|
|
3347
|
+
}
|
|
3348
|
+
})];
|
|
3349
|
+
} }), "boolean"),
|
|
3350
|
+
textColor: Jr,
|
|
3351
|
+
backgroundColor: Yr
|
|
3352
|
+
}, Zr = vt(Xr), Qr = {
|
|
3309
3353
|
text: {
|
|
3310
3354
|
config: "text",
|
|
3311
3355
|
implementation: {}
|
|
@@ -3314,16 +3358,16 @@ var Br = {
|
|
|
3314
3358
|
config: "link",
|
|
3315
3359
|
implementation: {}
|
|
3316
3360
|
}
|
|
3317
|
-
},
|
|
3361
|
+
}, $r = ht(Qr), ei = class e extends At {
|
|
3318
3362
|
static create(t) {
|
|
3319
3363
|
return new e({
|
|
3320
|
-
blockSpecs: t?.blockSpecs ??
|
|
3321
|
-
inlineContentSpecs: t?.inlineContentSpecs ??
|
|
3322
|
-
styleSpecs: t?.styleSpecs ??
|
|
3364
|
+
blockSpecs: t?.blockSpecs ?? qr,
|
|
3365
|
+
inlineContentSpecs: t?.inlineContentSpecs ?? Qr,
|
|
3366
|
+
styleSpecs: t?.styleSpecs ?? Xr
|
|
3323
3367
|
});
|
|
3324
3368
|
}
|
|
3325
3369
|
};
|
|
3326
3370
|
//#endregion
|
|
3327
|
-
export {
|
|
3371
|
+
export { jn as $, mt as $t, mr as A, We as An, U as At, $n as B, Re as Bn, Ft as Bt, Dr as C, j as Cn, tn as Ct, hr as D, Ke as Dn, Jt as Dt, _r as E, qe as En, Zt as Et, lr as F, E as Fn, Bt as Ft, Jn as G, x as Gn, yt as Gt, Yn as H, Le as Hn, At as Ht, or as I, ze as In, Rt as It, qn as J, b as Jn, z as Jt, Gn as K, Fe as Kn, R as Kt, sr as L, Be as Ln, Pt as Lt, dr as M, Ve as Mn, zt as Mt, fr as N, He as Nn, Ht as Nt, gr as O, k as On, Yt as Ot, cr as P, Ue as Pn, Vt as Pt, Fn as Q, ft as Qt, nr as R, D as Rn, Nt as Rt, jr as S, A as Sn, G as St, vr as T, Je as Tn, Xt as Tt, Un as U, S as Un, Ot as Ut, er as V, w as Vn, It as Vt, Wn as W, C as Wn, bt as Wt, Bn as X, gt as Xt, zn as Y, Pe as Yn, vt as Yt, In as Z, dt as Zt, Fr as _, nt as _n, an as _t, Zr as a, L as an, En as at, Ar as b, Ze as bn, q as bt, Kr as c, F as cn, vn as ct, $ as d, ot as dn, _n as dt, pt as en, Nn as et, Vr as f, N as fn, xn as ft, X as g, tt as gn, K as gt, Pr as h, et as hn, J as ht, Qr as i, lt as in, Tn as it, ur as j, Ge as jn, Kt as jt, pr as k, O as kn, W as kt, Wr as l, it as ln, yn as lt, Z as m, M as mn, Y as mt, qr as n, I as nn, On as nt, Xr as o, ct as on, Dn as ot, Rr as p, P as pn, hn as pt, Kn as q, Ie as qn, _t as qt, $r as r, st as rn, kn as rt, Gr as s, ut as sn, gn as st, ei as t, ht as tn, Mn as tt, Ur as u, at as un, bn as ut, Nr as v, $e as vn, sn as vt, br as w, Xe as wn, en as wt, Mr as x, Ye as xn, rn as xt, kr as y, Qe as yn, on as yt, tr as z, T as zn, jt as zt };
|
|
3328
3372
|
|
|
3329
|
-
//# sourceMappingURL=blocks-
|
|
3373
|
+
//# sourceMappingURL=blocks-D0lMxErU.js.map
|