@blocknote/core 0.40.0 → 0.41.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BlockNoteSchema-COA0fsXW.cjs +11 -0
- package/dist/BlockNoteSchema-COA0fsXW.cjs.map +1 -0
- package/dist/{BlockNoteSchema-oR047ACf.js → BlockNoteSchema-CYRHak18.js} +681 -581
- package/dist/BlockNoteSchema-CYRHak18.js.map +1 -0
- package/dist/blocknote.cjs +4 -4
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +3663 -2817
- package/dist/blocknote.js.map +1 -1
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +51 -49
- package/dist/en-Cl87Uuyf.cjs +2 -0
- package/dist/en-Cl87Uuyf.cjs.map +1 -0
- package/dist/{en-Bq3Es3Np.js → en-njEqD7AG.js} +9 -3
- package/dist/en-njEqD7AG.js.map +1 -0
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +122 -2
- package/dist/locales.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +4 -3
- package/src/api/exporters/html/externalHTMLExporter.ts +1 -1
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +2 -1
- package/src/api/exporters/markdown/markdownExporter.ts +3 -1
- package/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.ts +19 -0
- package/src/api/parsers/markdown/parseMarkdown.ts +31 -0
- package/src/blocks/Code/block.ts +14 -14
- package/src/blocks/Divider/block.ts +49 -0
- package/src/blocks/ListItem/BulletListItem/block.ts +9 -1
- package/src/blocks/ListItem/CheckListItem/block.ts +1 -0
- package/src/blocks/ListItem/NumberedListItem/block.ts +9 -1
- package/src/blocks/Table/block.ts +56 -1
- package/src/blocks/ToggleWrapper/createToggleWrapper.ts +1 -1
- package/src/blocks/defaultBlocks.ts +16 -14
- package/src/blocks/index.ts +1 -0
- package/src/editor/Block.css +14 -20
- package/src/editor/BlockNoteEditor.test.ts +40 -0
- package/src/editor/BlockNoteEditor.ts +248 -465
- package/src/editor/BlockNoteExtensions.ts +3 -1
- package/src/editor/managers/BlockManager.ts +251 -0
- package/src/editor/managers/CollaborationManager.ts +212 -0
- package/src/editor/managers/EventManager.ts +134 -0
- package/src/editor/managers/ExportManager.ts +137 -0
- package/src/editor/managers/ExtensionManager.ts +130 -0
- package/src/editor/managers/SelectionManager.ts +114 -0
- package/src/editor/managers/StateManager.ts +238 -0
- package/src/editor/managers/StyleManager.ts +182 -0
- package/src/editor/managers/index.ts +11 -0
- package/src/extensions/Comments/CommentsPlugin.ts +7 -4
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +10 -0
- package/src/i18n/locales/ar.ts +6 -0
- package/src/i18n/locales/de.ts +6 -0
- package/src/i18n/locales/en.ts +6 -0
- package/src/i18n/locales/es.ts +6 -0
- package/src/i18n/locales/fr.ts +6 -0
- package/src/i18n/locales/he.ts +6 -0
- package/src/i18n/locales/hr.ts +6 -0
- package/src/i18n/locales/is.ts +6 -0
- package/src/i18n/locales/it.ts +6 -0
- package/src/i18n/locales/ja.ts +6 -0
- package/src/i18n/locales/ko.ts +6 -0
- package/src/i18n/locales/nl.ts +6 -0
- package/src/i18n/locales/no.ts +6 -0
- package/src/i18n/locales/pl.ts +6 -0
- package/src/i18n/locales/pt.ts +6 -0
- package/src/i18n/locales/ru.ts +6 -0
- package/src/i18n/locales/sk.ts +6 -0
- package/src/i18n/locales/uk.ts +6 -0
- package/src/i18n/locales/vi.ts +6 -0
- package/src/i18n/locales/zh-tw.ts +6 -0
- package/src/i18n/locales/zh.ts +6 -0
- package/src/schema/blocks/createSpec.ts +1 -0
- package/src/util/string.ts +21 -0
- package/types/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.d.ts +2 -0
- package/types/src/blocks/Divider/block.d.ts +3 -0
- package/types/src/blocks/Heading/block.d.ts +3 -3
- package/types/src/blocks/defaultBlocks.d.ts +2 -1
- package/types/src/blocks/index.d.ts +1 -0
- package/types/src/editor/BlockNoteEditor.d.ts +68 -47
- package/types/src/editor/BlockNoteExtensions.d.ts +2 -1
- package/types/src/editor/managers/BlockManager.d.ts +114 -0
- package/types/src/editor/managers/CollaborationManager.d.ts +115 -0
- package/types/src/editor/managers/EventManager.d.ts +58 -0
- package/types/src/editor/managers/ExportManager.d.ts +64 -0
- package/types/src/editor/managers/ExtensionManager.d.ts +68 -0
- package/types/src/editor/managers/SelectionManager.d.ts +54 -0
- package/types/src/editor/managers/StateManager.d.ts +115 -0
- package/types/src/editor/managers/StyleManager.d.ts +48 -0
- package/types/src/editor/managers/index.d.ts +8 -0
- package/types/src/extensions/Comments/CommentsPlugin.d.ts +4 -3
- package/types/src/i18n/locales/en.d.ts +6 -0
- package/types/src/i18n/locales/sk.d.ts +6 -0
- package/types/src/util/string.d.ts +1 -0
- package/dist/BlockNoteSchema-DmZ6UQfY.cjs +0 -11
- package/dist/BlockNoteSchema-DmZ6UQfY.cjs.map +0 -1
- package/dist/BlockNoteSchema-oR047ACf.js.map +0 -1
- package/dist/en-Bq3Es3Np.js.map +0 -1
- package/dist/en-D3B48eJ7.cjs +0 -2
- package/dist/en-D3B48eJ7.cjs.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- /package/src/api/exporters/markdown/{removeUnderlinesRehypePlugin.ts → util/removeUnderlinesRehypePlugin.ts} +0 -0
- /package/types/src/api/exporters/markdown/{removeUnderlinesRehypePlugin.d.ts → util/removeUnderlinesRehypePlugin.d.ts} +0 -0
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var x = (e, t, n) =>
|
|
4
|
-
import { TableMap as We, goToNextCell as Se, columnResizing as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { Extension as
|
|
1
|
+
var mt = Object.defineProperty;
|
|
2
|
+
var gt = (e, t, n) => t in e ? mt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var x = (e, t, n) => gt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { TableMap as We, goToNextCell as Se, columnResizing as bt, tableEditing as kt, CellSelection as Fe, TableView as Ct } from "prosemirror-tables";
|
|
5
|
+
import yt from "@tiptap/extension-bold";
|
|
6
|
+
import wt from "@tiptap/extension-code";
|
|
7
|
+
import vt from "@tiptap/extension-italic";
|
|
8
|
+
import Et from "@tiptap/extension-strike";
|
|
9
|
+
import xt from "@tiptap/extension-underline";
|
|
10
|
+
import { Extension as $e, combineTransactionSteps as St, getChangedRanges as Bt, findChildrenInRange as Mt, Node as D, Mark as Lt, callOrReturn as Tt, getExtensionField as At, mergeAttributes as ue } from "@tiptap/core";
|
|
11
11
|
import { Slice as de, Fragment as _, DOMParser as Q, DOMSerializer as Be } from "prosemirror-model";
|
|
12
|
-
import { Plugin as je, PluginKey as
|
|
13
|
-
import { v4 as
|
|
14
|
-
import { createHighlightPlugin as
|
|
15
|
-
import { createParser as
|
|
12
|
+
import { Plugin as je, PluginKey as Ue, TextSelection as ze } from "prosemirror-state";
|
|
13
|
+
import { v4 as Nt } from "uuid";
|
|
14
|
+
import { createHighlightPlugin as It } from "prosemirror-highlight";
|
|
15
|
+
import { createParser as Pt } from "prosemirror-highlight/shiki";
|
|
16
16
|
import { ReplaceStep as Ht } from "prosemirror-transform";
|
|
17
|
-
import { DecorationSet as Me, Decoration as
|
|
18
|
-
function
|
|
17
|
+
import { DecorationSet as Me, Decoration as Ot } from "prosemirror-view";
|
|
18
|
+
function Dt(e, t = JSON.stringify) {
|
|
19
19
|
const n = {};
|
|
20
20
|
return e.filter((o) => {
|
|
21
21
|
const r = t(o);
|
|
22
22
|
return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function _t(e) {
|
|
26
26
|
const t = e.filter(
|
|
27
27
|
(o, r) => e.indexOf(o) !== r
|
|
28
28
|
);
|
|
29
|
-
return
|
|
29
|
+
return Dt(t);
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const qe = $e.create({
|
|
32
32
|
name: "uniqueID",
|
|
33
33
|
// we’ll set a very high priority to make sure this runs first
|
|
34
34
|
// and is compatible with `appendTransaction` hooks of other extensions
|
|
@@ -43,7 +43,7 @@ const ze = Fe.create({
|
|
|
43
43
|
const e = window.__TEST_OPTIONS;
|
|
44
44
|
return e.mockID === void 0 ? e.mockID = 0 : e.mockID++, e.mockID.toString();
|
|
45
45
|
}
|
|
46
|
-
return
|
|
46
|
+
return Nt();
|
|
47
47
|
},
|
|
48
48
|
filterTransaction: null
|
|
49
49
|
};
|
|
@@ -104,28 +104,28 @@ const ze = Fe.create({
|
|
|
104
104
|
let e = null, t = !1;
|
|
105
105
|
return [
|
|
106
106
|
new je({
|
|
107
|
-
key: new
|
|
107
|
+
key: new Ue("uniqueID"),
|
|
108
108
|
appendTransaction: (n, o, r) => {
|
|
109
109
|
const s = n.some((h) => h.docChanged) && !o.doc.eq(r.doc), a = this.options.filterTransaction && n.some((h) => {
|
|
110
|
-
var
|
|
111
|
-
return !((m = (
|
|
110
|
+
var k, m;
|
|
111
|
+
return !((m = (k = this.options).filterTransaction) != null && m.call(k, h));
|
|
112
112
|
});
|
|
113
113
|
if (!s || a)
|
|
114
114
|
return;
|
|
115
|
-
const { tr: i } = r, { types: c, attributeName: l, generateID: d } = this.options, u =
|
|
115
|
+
const { tr: i } = r, { types: c, attributeName: l, generateID: d } = this.options, u = St(
|
|
116
116
|
o.doc,
|
|
117
117
|
n
|
|
118
118
|
), { mapping: p } = u;
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
119
|
+
if (Bt(u).forEach(({ newRange: h }) => {
|
|
120
|
+
const k = Mt(
|
|
121
121
|
r.doc,
|
|
122
122
|
h,
|
|
123
123
|
(y) => c.includes(y.type.name)
|
|
124
|
-
), m =
|
|
125
|
-
|
|
124
|
+
), m = k.map(({ node: y }) => y.attrs[l]).filter((y) => y !== null), b = _t(m);
|
|
125
|
+
k.forEach(({ node: y, pos: g }) => {
|
|
126
126
|
var V;
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
127
|
+
const v = (V = i.doc.nodeAt(g)) == null ? void 0 : V.attrs[l];
|
|
128
|
+
if (v === null) {
|
|
129
129
|
const W = o.doc.type.createAndFill().content;
|
|
130
130
|
if (o.doc.content.findDiffStart(W) === null) {
|
|
131
131
|
const xe = JSON.parse(
|
|
@@ -146,7 +146,7 @@ const ze = Fe.create({
|
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
const { deleted: S } = p.invert().mapResult(g);
|
|
149
|
-
S && b.includes(
|
|
149
|
+
S && b.includes(v) && i.setNodeMarkup(g, void 0, {
|
|
150
150
|
...y.attrs,
|
|
151
151
|
[l]: d()
|
|
152
152
|
});
|
|
@@ -221,7 +221,7 @@ const ze = Fe.create({
|
|
|
221
221
|
function Le(e) {
|
|
222
222
|
return e.type === "link";
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function Ze(e) {
|
|
225
225
|
return typeof e != "string" && e.type === "link";
|
|
226
226
|
}
|
|
227
227
|
function I(e) {
|
|
@@ -229,7 +229,7 @@ function I(e) {
|
|
|
229
229
|
}
|
|
230
230
|
function se(e) {
|
|
231
231
|
var t, n, o, r, s;
|
|
232
|
-
return pe(e) ? { ...e } :
|
|
232
|
+
return pe(e) ? { ...e } : $(e) ? {
|
|
233
233
|
type: "tableCell",
|
|
234
234
|
content: [].concat(e.content),
|
|
235
235
|
props: {
|
|
@@ -251,13 +251,13 @@ function se(e) {
|
|
|
251
251
|
}
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function $(e) {
|
|
255
255
|
return e != null && typeof e != "string" && !Array.isArray(e) && e.type === "tableCell";
|
|
256
256
|
}
|
|
257
257
|
function pe(e) {
|
|
258
|
-
return
|
|
258
|
+
return $(e) && e.props !== void 0 && e.content !== void 0;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function j(e) {
|
|
261
261
|
return pe(e) ? e.props.colspan ?? 1 : 1;
|
|
262
262
|
}
|
|
263
263
|
function ae(e) {
|
|
@@ -268,14 +268,14 @@ class Z extends Error {
|
|
|
268
268
|
super(`Unreachable case: ${t}`);
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function Vo(e, t = !0) {
|
|
272
272
|
const { "data-test": n, ...o } = e;
|
|
273
273
|
if (Object.keys(o).length > 0 && t)
|
|
274
274
|
throw new Error("Object must be empty " + JSON.stringify(e));
|
|
275
275
|
}
|
|
276
|
-
const
|
|
276
|
+
const Rt = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
277
277
|
function T(e, t = "Ctrl") {
|
|
278
|
-
return
|
|
278
|
+
return Rt() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
|
|
279
279
|
}
|
|
280
280
|
function U(...e) {
|
|
281
281
|
return [
|
|
@@ -285,8 +285,8 @@ function U(...e) {
|
|
|
285
285
|
)
|
|
286
286
|
].join(" ");
|
|
287
287
|
}
|
|
288
|
-
const
|
|
289
|
-
function
|
|
288
|
+
const Wo = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
289
|
+
function Vt(e, t, n, o) {
|
|
290
290
|
const r = document.createElement("div");
|
|
291
291
|
r.className = U(
|
|
292
292
|
"bn-block-content",
|
|
@@ -323,7 +323,7 @@ const Te = (e, t) => {
|
|
|
323
323
|
);
|
|
324
324
|
return r;
|
|
325
325
|
};
|
|
326
|
-
function
|
|
326
|
+
function Wt(e, t = "<br>") {
|
|
327
327
|
const n = e.querySelectorAll("p");
|
|
328
328
|
if (n.length > 1) {
|
|
329
329
|
const o = n[0];
|
|
@@ -336,12 +336,32 @@ function Vt(e, t = "<br>") {
|
|
|
336
336
|
function K(e) {
|
|
337
337
|
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function Fo(e) {
|
|
340
340
|
const t = e.split("/");
|
|
341
341
|
return !t.length || // invalid?
|
|
342
342
|
t[t.length - 1] === "" ? e : t[t.length - 1];
|
|
343
343
|
}
|
|
344
|
-
function
|
|
344
|
+
function $o(e) {
|
|
345
|
+
var n;
|
|
346
|
+
const t = [
|
|
347
|
+
"mp4",
|
|
348
|
+
"webm",
|
|
349
|
+
"ogg",
|
|
350
|
+
"mov",
|
|
351
|
+
"mkv",
|
|
352
|
+
"flv",
|
|
353
|
+
"avi",
|
|
354
|
+
"wmv",
|
|
355
|
+
"m4v"
|
|
356
|
+
];
|
|
357
|
+
try {
|
|
358
|
+
const r = ((n = new URL(e).pathname.split(".").pop()) == null ? void 0 : n.toLowerCase()) || "";
|
|
359
|
+
return t.includes(r);
|
|
360
|
+
} catch {
|
|
361
|
+
return !1;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
function Ft(e) {
|
|
345
365
|
const t = {};
|
|
346
366
|
return Object.entries(e).forEach(([n, o]) => {
|
|
347
367
|
t[n] = {
|
|
@@ -368,7 +388,7 @@ function Wt(e) {
|
|
|
368
388
|
};
|
|
369
389
|
}), t;
|
|
370
390
|
}
|
|
371
|
-
function
|
|
391
|
+
function $t(e, t, n, o) {
|
|
372
392
|
const r = e();
|
|
373
393
|
if (r === void 0)
|
|
374
394
|
throw new Error("Cannot find node position");
|
|
@@ -416,12 +436,12 @@ function jt(e, t, n) {
|
|
|
416
436
|
extensions: n
|
|
417
437
|
};
|
|
418
438
|
}
|
|
419
|
-
function
|
|
439
|
+
function Ut(e, t) {
|
|
420
440
|
e.stopEvent = (n) => (n.type === "mousedown" && setTimeout(() => {
|
|
421
441
|
t.view.dom.blur();
|
|
422
442
|
}, 10), !0);
|
|
423
443
|
}
|
|
424
|
-
function
|
|
444
|
+
function zt(e, t) {
|
|
425
445
|
const n = [
|
|
426
446
|
{
|
|
427
447
|
tag: "[data-content-type=" + e.type + "]",
|
|
@@ -446,7 +466,7 @@ function Ut(e, t) {
|
|
|
446
466
|
});
|
|
447
467
|
if (e.content === "inline") {
|
|
448
468
|
const i = o.cloneNode(!0);
|
|
449
|
-
return
|
|
469
|
+
return Wt(
|
|
450
470
|
i,
|
|
451
471
|
(s = t.meta) != null && s.code ? `
|
|
452
472
|
` : "<br>"
|
|
@@ -458,7 +478,7 @@ function Ut(e, t) {
|
|
|
458
478
|
} : void 0
|
|
459
479
|
}), n;
|
|
460
480
|
}
|
|
461
|
-
function
|
|
481
|
+
function qt(e, t, n, o) {
|
|
462
482
|
var s, a, i, c;
|
|
463
483
|
const r = t.node || D.create({
|
|
464
484
|
name: e.type,
|
|
@@ -470,10 +490,10 @@ function zt(e, t, n, o) {
|
|
|
470
490
|
defining: ((c = t.meta) == null ? void 0 : c.defining) ?? !0,
|
|
471
491
|
priority: o,
|
|
472
492
|
addAttributes() {
|
|
473
|
-
return
|
|
493
|
+
return Ft(e.propSchema);
|
|
474
494
|
},
|
|
475
495
|
parseHTML() {
|
|
476
|
-
return
|
|
496
|
+
return zt(e, t);
|
|
477
497
|
},
|
|
478
498
|
renderHTML({ HTMLAttributes: l }) {
|
|
479
499
|
var u;
|
|
@@ -492,8 +512,8 @@ function zt(e, t, n, o) {
|
|
|
492
512
|
},
|
|
493
513
|
addNodeView() {
|
|
494
514
|
return (l) => {
|
|
495
|
-
var h,
|
|
496
|
-
const d = this.options.editor, u =
|
|
515
|
+
var h, k;
|
|
516
|
+
const d = this.options.editor, u = $t(
|
|
497
517
|
l.getPos,
|
|
498
518
|
d,
|
|
499
519
|
this.editor,
|
|
@@ -503,7 +523,7 @@ function zt(e, t, n, o) {
|
|
|
503
523
|
u,
|
|
504
524
|
d
|
|
505
525
|
);
|
|
506
|
-
return ((
|
|
526
|
+
return ((k = t.meta) == null ? void 0 : k.selectable) === !1 && Ut(f, this.editor), f;
|
|
507
527
|
};
|
|
508
528
|
}
|
|
509
529
|
});
|
|
@@ -514,6 +534,7 @@ function zt(e, t, n, o) {
|
|
|
514
534
|
return {
|
|
515
535
|
config: e,
|
|
516
536
|
implementation: {
|
|
537
|
+
...t,
|
|
517
538
|
node: r,
|
|
518
539
|
render(l, d) {
|
|
519
540
|
var p;
|
|
@@ -547,7 +568,7 @@ function zt(e, t, n, o) {
|
|
|
547
568
|
extensions: n
|
|
548
569
|
};
|
|
549
570
|
}
|
|
550
|
-
function
|
|
571
|
+
function jo(e) {
|
|
551
572
|
return e;
|
|
552
573
|
}
|
|
553
574
|
function M(e, t, n) {
|
|
@@ -683,29 +704,29 @@ function he(e, t) {
|
|
|
683
704
|
function z(e) {
|
|
684
705
|
return he(e.node, e.posBeforeNode);
|
|
685
706
|
}
|
|
686
|
-
function
|
|
707
|
+
function Zt(e) {
|
|
687
708
|
if (!e.nodeAfter)
|
|
688
709
|
throw new Error(
|
|
689
710
|
`Attempted to get blockContainer node at position ${e.pos} but a node at this position does not exist`
|
|
690
711
|
);
|
|
691
712
|
return he(e.nodeAfter, e.pos);
|
|
692
713
|
}
|
|
693
|
-
function
|
|
714
|
+
function Ge(e) {
|
|
694
715
|
const t = fe(e.doc, e.selection.anchor);
|
|
695
716
|
return z(t);
|
|
696
717
|
}
|
|
697
|
-
function
|
|
718
|
+
function Gt(e) {
|
|
698
719
|
const t = fe(e.doc, e.selection.anchor);
|
|
699
720
|
return z(t);
|
|
700
721
|
}
|
|
701
722
|
function G(e) {
|
|
702
723
|
return "doc" in e ? e.doc.type.schema : e.type.schema;
|
|
703
724
|
}
|
|
704
|
-
function
|
|
725
|
+
function Xe(e) {
|
|
705
726
|
return e.cached.blockNoteEditor;
|
|
706
727
|
}
|
|
707
728
|
function me(e) {
|
|
708
|
-
return
|
|
729
|
+
return Xe(e).schema;
|
|
709
730
|
}
|
|
710
731
|
function ge(e) {
|
|
711
732
|
return me(e).blockSchema;
|
|
@@ -716,10 +737,10 @@ function be(e) {
|
|
|
716
737
|
function R(e) {
|
|
717
738
|
return me(e).styleSchema;
|
|
718
739
|
}
|
|
719
|
-
function
|
|
720
|
-
return
|
|
740
|
+
function ke(e) {
|
|
741
|
+
return Xe(e).blockCache;
|
|
721
742
|
}
|
|
722
|
-
function
|
|
743
|
+
function Xt(e, t, n) {
|
|
723
744
|
var s, a;
|
|
724
745
|
const o = {
|
|
725
746
|
type: "tableContent",
|
|
@@ -738,14 +759,14 @@ function Gt(e, t, n) {
|
|
|
738
759
|
}), d.cells = i.content.content.map((u, p) => (r[l] || (r[l] = []), r[l][p] = u.type.name === "tableHeader", {
|
|
739
760
|
type: "tableCell",
|
|
740
761
|
content: u.content.content.map(
|
|
741
|
-
(h) =>
|
|
762
|
+
(h) => Ce(h, t, n)
|
|
742
763
|
).reduce(
|
|
743
|
-
(h,
|
|
764
|
+
(h, k) => {
|
|
744
765
|
if (!h.length)
|
|
745
|
-
return
|
|
746
|
-
const m = h[h.length - 1], b =
|
|
766
|
+
return k;
|
|
767
|
+
const m = h[h.length - 1], b = k[0];
|
|
747
768
|
return b && I(m) && I(b) && JSON.stringify(m.styles) === JSON.stringify(b.styles) ? (m.text += `
|
|
748
|
-
` + b.text, h.push(...
|
|
769
|
+
` + b.text, h.push(...k.slice(1)), h) : (h.push(...k), h);
|
|
749
770
|
},
|
|
750
771
|
[]
|
|
751
772
|
),
|
|
@@ -764,7 +785,7 @@ function Gt(e, t, n) {
|
|
|
764
785
|
r != null && r.every((c) => c[i]) && (o.headerCols = (o.headerCols ?? 0) + 1);
|
|
765
786
|
return o;
|
|
766
787
|
}
|
|
767
|
-
function
|
|
788
|
+
function Ce(e, t, n) {
|
|
768
789
|
const o = [];
|
|
769
790
|
let r;
|
|
770
791
|
return e.content.forEach((s) => {
|
|
@@ -793,7 +814,7 @@ function ke(e, t, n) {
|
|
|
793
814
|
return;
|
|
794
815
|
}
|
|
795
816
|
r && (o.push(r), r = void 0), o.push(
|
|
796
|
-
|
|
817
|
+
Jt(s, t, n)
|
|
797
818
|
);
|
|
798
819
|
return;
|
|
799
820
|
}
|
|
@@ -867,7 +888,7 @@ function ke(e, t, n) {
|
|
|
867
888
|
};
|
|
868
889
|
}), r && o.push(r), o;
|
|
869
890
|
}
|
|
870
|
-
function
|
|
891
|
+
function Jt(e, t, n) {
|
|
871
892
|
if (e.type.name === "text" || e.type.name === "link")
|
|
872
893
|
throw new Error("unexpected");
|
|
873
894
|
const o = {}, r = t[e.type.name];
|
|
@@ -878,7 +899,7 @@ function Xt(e, t, n) {
|
|
|
878
899
|
i in l && (o[i] = c);
|
|
879
900
|
}
|
|
880
901
|
let s;
|
|
881
|
-
return r.content === "styled" ? s =
|
|
902
|
+
return r.content === "styled" ? s = Ce(
|
|
882
903
|
e,
|
|
883
904
|
t,
|
|
884
905
|
n
|
|
@@ -888,8 +909,8 @@ function Xt(e, t, n) {
|
|
|
888
909
|
content: s
|
|
889
910
|
};
|
|
890
911
|
}
|
|
891
|
-
function X(e, t, n = ge(t), o = be(t), r = R(t), s =
|
|
892
|
-
var
|
|
912
|
+
function X(e, t, n = ge(t), o = be(t), r = R(t), s = ke(t)) {
|
|
913
|
+
var k;
|
|
893
914
|
if (!e.type.isInGroup("bnBlock"))
|
|
894
915
|
throw Error("Node should be a bnBlock, but is instead: " + e.type.name);
|
|
895
916
|
const a = s == null ? void 0 : s.get(e);
|
|
@@ -897,7 +918,7 @@ function X(e, t, n = ge(t), o = be(t), r = R(t), s = Ce(t)) {
|
|
|
897
918
|
return a;
|
|
898
919
|
const i = he(e, 0);
|
|
899
920
|
let c = i.bnBlock.node.attrs.id;
|
|
900
|
-
c === null && (c =
|
|
921
|
+
c === null && (c = qe.options.generateID());
|
|
901
922
|
const l = n[i.blockNoteType];
|
|
902
923
|
if (!l)
|
|
903
924
|
throw Error("Block is of an unrecognized type: " + i.blockNoteType);
|
|
@@ -910,7 +931,7 @@ function X(e, t, n = ge(t), o = be(t), r = R(t), s = Ce(t)) {
|
|
|
910
931
|
m in y && !(y[m].default === void 0 && b === void 0) && (d[m] = b);
|
|
911
932
|
}
|
|
912
933
|
const u = n[i.blockNoteType], p = [];
|
|
913
|
-
(
|
|
934
|
+
(k = i.childContainer) == null || k.node.forEach((m) => {
|
|
914
935
|
p.push(
|
|
915
936
|
X(
|
|
916
937
|
m,
|
|
@@ -926,7 +947,7 @@ function X(e, t, n = ge(t), o = be(t), r = R(t), s = Ce(t)) {
|
|
|
926
947
|
if (u.content === "inline") {
|
|
927
948
|
if (!i.isBlockContainer)
|
|
928
949
|
throw new Error("impossible");
|
|
929
|
-
f =
|
|
950
|
+
f = Ce(
|
|
930
951
|
i.blockContent.node,
|
|
931
952
|
o,
|
|
932
953
|
r
|
|
@@ -934,7 +955,7 @@ function X(e, t, n = ge(t), o = be(t), r = R(t), s = Ce(t)) {
|
|
|
934
955
|
} else if (u.content === "table") {
|
|
935
956
|
if (!i.isBlockContainer)
|
|
936
957
|
throw new Error("impossible");
|
|
937
|
-
f =
|
|
958
|
+
f = Xt(
|
|
938
959
|
i.blockContent.node,
|
|
939
960
|
o,
|
|
940
961
|
r
|
|
@@ -952,7 +973,7 @@ function X(e, t, n = ge(t), o = be(t), r = R(t), s = Ce(t)) {
|
|
|
952
973
|
};
|
|
953
974
|
return s == null || s.set(e, h), h;
|
|
954
975
|
}
|
|
955
|
-
function
|
|
976
|
+
function Uo(e, t, n = ge(t), o = be(t), r = R(t), s = ke(t)) {
|
|
956
977
|
const a = [];
|
|
957
978
|
return e.firstChild.descendants((i) => (a.push(
|
|
958
979
|
X(
|
|
@@ -965,13 +986,13 @@ function Fo(e, t, n = ge(t), o = be(t), r = R(t), s = Ce(t)) {
|
|
|
965
986
|
)
|
|
966
987
|
), !1)), a;
|
|
967
988
|
}
|
|
968
|
-
function
|
|
989
|
+
function zo(e, t, n = ge(t), o = be(t), r = R(t), s = ke(t)) {
|
|
969
990
|
function a(i, c, l) {
|
|
970
991
|
if (i.type.name !== "blockGroup")
|
|
971
992
|
throw new Error("unexpected");
|
|
972
993
|
const d = [];
|
|
973
994
|
let u, p;
|
|
974
|
-
return i.forEach((f, h,
|
|
995
|
+
return i.forEach((f, h, k) => {
|
|
975
996
|
if (f.type.name !== "blockContainer")
|
|
976
997
|
throw new Error("unexpected");
|
|
977
998
|
if (f.childCount === 0)
|
|
@@ -980,7 +1001,7 @@ function jo(e, t, n = ge(t), o = be(t), r = R(t), s = Ce(t)) {
|
|
|
980
1001
|
throw new Error(
|
|
981
1002
|
"unexpected, blockContainer.childCount: " + f.childCount
|
|
982
1003
|
);
|
|
983
|
-
const m =
|
|
1004
|
+
const m = k === 0, b = k === i.childCount - 1;
|
|
984
1005
|
if (f.firstChild.type.name === "blockGroup") {
|
|
985
1006
|
if (!m)
|
|
986
1007
|
throw new Error("unexpected");
|
|
@@ -1000,7 +1021,7 @@ function jo(e, t, n = ge(t), o = be(t), r = R(t), s = Ce(t)) {
|
|
|
1000
1021
|
r,
|
|
1001
1022
|
s
|
|
1002
1023
|
), g = f.childCount > 1 ? f.child(1) : void 0;
|
|
1003
|
-
let
|
|
1024
|
+
let v = [];
|
|
1004
1025
|
if (g) {
|
|
1005
1026
|
const S = a(
|
|
1006
1027
|
g,
|
|
@@ -1008,11 +1029,11 @@ function jo(e, t, n = ge(t), o = be(t), r = R(t), s = Ce(t)) {
|
|
|
1008
1029
|
// TODO: can this be anything other than 0?
|
|
1009
1030
|
b ? Math.max(0, l - 1) : 0
|
|
1010
1031
|
);
|
|
1011
|
-
|
|
1032
|
+
v = S.blocks, b && (p = S.blockCutAtEnd);
|
|
1012
1033
|
}
|
|
1013
1034
|
b && !g && l > 1 && (p = y.id), m && c > 1 && (u = y.id), d.push({
|
|
1014
1035
|
...y,
|
|
1015
|
-
children:
|
|
1036
|
+
children: v
|
|
1016
1037
|
});
|
|
1017
1038
|
}), { blocks: d, blockCutAtStart: u, blockCutAtEnd: p };
|
|
1018
1039
|
}
|
|
@@ -1032,13 +1053,13 @@ function jo(e, t, n = ge(t), o = be(t), r = R(t), s = Ce(t)) {
|
|
|
1032
1053
|
Math.max(e.openEnd - 1, 0)
|
|
1033
1054
|
);
|
|
1034
1055
|
}
|
|
1035
|
-
function
|
|
1056
|
+
function qo(e, t, n, o) {
|
|
1036
1057
|
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([r, s]) => {
|
|
1037
1058
|
const a = o[r];
|
|
1038
1059
|
return s !== a.default;
|
|
1039
1060
|
}).map(([r, s]) => [K(r), s]).forEach(([r, s]) => e.dom.setAttribute(r, s)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
1040
1061
|
}
|
|
1041
|
-
function
|
|
1062
|
+
function Zo(e) {
|
|
1042
1063
|
return {
|
|
1043
1064
|
Backspace: ({ editor: t }) => {
|
|
1044
1065
|
const n = t.state.selection.$from;
|
|
@@ -1046,14 +1067,14 @@ function Uo(e) {
|
|
|
1046
1067
|
}
|
|
1047
1068
|
};
|
|
1048
1069
|
}
|
|
1049
|
-
function
|
|
1070
|
+
function Kt(e, t) {
|
|
1050
1071
|
return {
|
|
1051
1072
|
config: e,
|
|
1052
1073
|
implementation: t
|
|
1053
1074
|
};
|
|
1054
1075
|
}
|
|
1055
|
-
function
|
|
1056
|
-
return
|
|
1076
|
+
function Go(e, t, n) {
|
|
1077
|
+
return Kt(
|
|
1057
1078
|
{
|
|
1058
1079
|
type: e.name,
|
|
1059
1080
|
propSchema: t,
|
|
@@ -1065,12 +1086,12 @@ function zo(e, t, n) {
|
|
|
1065
1086
|
}
|
|
1066
1087
|
);
|
|
1067
1088
|
}
|
|
1068
|
-
function
|
|
1089
|
+
function Je(e) {
|
|
1069
1090
|
return Object.fromEntries(
|
|
1070
1091
|
Object.entries(e).map(([t, n]) => [t, n.config])
|
|
1071
1092
|
);
|
|
1072
1093
|
}
|
|
1073
|
-
function
|
|
1094
|
+
function Qt(e) {
|
|
1074
1095
|
return e === "boolean" ? {} : {
|
|
1075
1096
|
stringValue: {
|
|
1076
1097
|
default: void 0,
|
|
@@ -1085,14 +1106,14 @@ function Kt(e) {
|
|
|
1085
1106
|
function J(e, t, n, o) {
|
|
1086
1107
|
return e.dom.setAttribute("data-style-type", t), o === "string" && e.dom.setAttribute("data-value", n), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
1087
1108
|
}
|
|
1088
|
-
function
|
|
1109
|
+
function Ke(e, t) {
|
|
1089
1110
|
return {
|
|
1090
1111
|
config: e,
|
|
1091
1112
|
implementation: t
|
|
1092
1113
|
};
|
|
1093
1114
|
}
|
|
1094
1115
|
function F(e, t) {
|
|
1095
|
-
return
|
|
1116
|
+
return Ke(
|
|
1096
1117
|
{
|
|
1097
1118
|
type: e.name,
|
|
1098
1119
|
propSchema: t
|
|
@@ -1138,12 +1159,12 @@ function F(e, t) {
|
|
|
1138
1159
|
}
|
|
1139
1160
|
);
|
|
1140
1161
|
}
|
|
1141
|
-
function
|
|
1162
|
+
function Qe(e) {
|
|
1142
1163
|
return Object.fromEntries(
|
|
1143
1164
|
Object.entries(e).map(([t, n]) => [t, n.config])
|
|
1144
1165
|
);
|
|
1145
1166
|
}
|
|
1146
|
-
function
|
|
1167
|
+
function Yt(e, t) {
|
|
1147
1168
|
const n = [
|
|
1148
1169
|
{
|
|
1149
1170
|
tag: `[data-style-type="${e.type}"]`,
|
|
@@ -1163,14 +1184,14 @@ function Qt(e, t) {
|
|
|
1163
1184
|
}
|
|
1164
1185
|
}), n;
|
|
1165
1186
|
}
|
|
1166
|
-
function
|
|
1167
|
-
const n =
|
|
1187
|
+
function Ye(e, t) {
|
|
1188
|
+
const n = Lt.create({
|
|
1168
1189
|
name: e.type,
|
|
1169
1190
|
addAttributes() {
|
|
1170
|
-
return
|
|
1191
|
+
return Qt(e.propSchema);
|
|
1171
1192
|
},
|
|
1172
1193
|
parseHTML() {
|
|
1173
|
-
return
|
|
1194
|
+
return Yt(e, t.parse);
|
|
1174
1195
|
},
|
|
1175
1196
|
renderHTML({ mark: o }) {
|
|
1176
1197
|
const r = (t.toExternalHTML || t.render)(o.attrs.stringValue);
|
|
@@ -1193,7 +1214,7 @@ function Ke(e, t) {
|
|
|
1193
1214
|
};
|
|
1194
1215
|
}
|
|
1195
1216
|
});
|
|
1196
|
-
return
|
|
1217
|
+
return Ke(e, {
|
|
1197
1218
|
mark: n,
|
|
1198
1219
|
render: (o) => {
|
|
1199
1220
|
const r = t.render(o);
|
|
@@ -1215,8 +1236,8 @@ function Ke(e, t) {
|
|
|
1215
1236
|
}
|
|
1216
1237
|
});
|
|
1217
1238
|
}
|
|
1218
|
-
function
|
|
1219
|
-
const t =
|
|
1239
|
+
function en(e) {
|
|
1240
|
+
const t = nn(e);
|
|
1220
1241
|
let { roots: n, nonRoots: o } = Ae(t);
|
|
1221
1242
|
const r = [];
|
|
1222
1243
|
for (; n.size; ) {
|
|
@@ -1241,11 +1262,11 @@ function Yt(e) {
|
|
|
1241
1262
|
);
|
|
1242
1263
|
return r;
|
|
1243
1264
|
}
|
|
1244
|
-
function en(e) {
|
|
1245
|
-
const t = nn(e);
|
|
1246
|
-
return Yt(t);
|
|
1247
|
-
}
|
|
1248
1265
|
function tn(e) {
|
|
1266
|
+
const t = on(e);
|
|
1267
|
+
return en(t);
|
|
1268
|
+
}
|
|
1269
|
+
function nn(e) {
|
|
1249
1270
|
const t = /* @__PURE__ */ new Map();
|
|
1250
1271
|
for (const [n, o] of e.entries()) {
|
|
1251
1272
|
t.has(n) || t.set(n, 0);
|
|
@@ -1262,7 +1283,7 @@ function Ae(e) {
|
|
|
1262
1283
|
r === 0 ? t.add(o) : n.add(o);
|
|
1263
1284
|
return { roots: t, nonRoots: n };
|
|
1264
1285
|
}
|
|
1265
|
-
function
|
|
1286
|
+
function on(e) {
|
|
1266
1287
|
const t = /* @__PURE__ */ new Map();
|
|
1267
1288
|
for (const [n, o] of e.entries()) {
|
|
1268
1289
|
t.has(n) || t.set(n, /* @__PURE__ */ new Set());
|
|
@@ -1271,7 +1292,7 @@ function nn(e) {
|
|
|
1271
1292
|
}
|
|
1272
1293
|
return t;
|
|
1273
1294
|
}
|
|
1274
|
-
function
|
|
1295
|
+
function rn() {
|
|
1275
1296
|
return /* @__PURE__ */ new Map();
|
|
1276
1297
|
}
|
|
1277
1298
|
function Ne(e) {
|
|
@@ -1279,7 +1300,7 @@ function Ne(e) {
|
|
|
1279
1300
|
Object.entries(e).filter(([, t]) => t !== void 0)
|
|
1280
1301
|
);
|
|
1281
1302
|
}
|
|
1282
|
-
class
|
|
1303
|
+
class sn {
|
|
1283
1304
|
constructor(t) {
|
|
1284
1305
|
// Helper so that you can use typeof schema.BlockNoteEditor
|
|
1285
1306
|
x(this, "BlockNoteEditor", "only for types");
|
|
@@ -1303,14 +1324,14 @@ class rn {
|
|
|
1303
1324
|
this.blockSpecs = n, this.styleSpecs = r, this.styleSchema = i, this.inlineContentSpecs = o, this.blockSchema = s, this.inlineContentSchema = a;
|
|
1304
1325
|
}
|
|
1305
1326
|
init() {
|
|
1306
|
-
const t =
|
|
1327
|
+
const t = rn(), n = /* @__PURE__ */ new Set();
|
|
1307
1328
|
t.set("default", n);
|
|
1308
1329
|
for (const [i, c] of Object.entries(this.opts.blockSpecs))
|
|
1309
1330
|
c.implementation.runsBefore ? t.set(i, new Set(c.implementation.runsBefore)) : n.add(i);
|
|
1310
|
-
const o =
|
|
1331
|
+
const o = tn(t), r = o.findIndex((i) => i.has("default")), s = (i) => 91 + (o.findIndex((l) => l.has(i)) + r) * 10, a = Object.fromEntries(
|
|
1311
1332
|
Object.entries(this.opts.blockSpecs).map(([i, c]) => [
|
|
1312
1333
|
i,
|
|
1313
|
-
|
|
1334
|
+
qt(
|
|
1314
1335
|
c.config,
|
|
1315
1336
|
c.implementation,
|
|
1316
1337
|
c.extensions,
|
|
@@ -1325,10 +1346,10 @@ class rn {
|
|
|
1325
1346
|
),
|
|
1326
1347
|
inlineContentSpecs: Ne(this.opts.inlineContentSpecs),
|
|
1327
1348
|
styleSpecs: Ne(this.opts.styleSpecs),
|
|
1328
|
-
inlineContentSchema:
|
|
1349
|
+
inlineContentSchema: Je(
|
|
1329
1350
|
this.opts.inlineContentSpecs
|
|
1330
1351
|
),
|
|
1331
|
-
styleSchema:
|
|
1352
|
+
styleSchema: Qe(this.opts.styleSpecs)
|
|
1332
1353
|
};
|
|
1333
1354
|
}
|
|
1334
1355
|
/**
|
|
@@ -1352,7 +1373,7 @@ class rn {
|
|
|
1352
1373
|
}
|
|
1353
1374
|
}
|
|
1354
1375
|
function N(e) {
|
|
1355
|
-
const { height: t, width: n } =
|
|
1376
|
+
const { height: t, width: n } = et(e), o = new Array(t).fill(!1).map(() => new Array(n).fill(null)), r = (s, a) => {
|
|
1356
1377
|
for (let i = s; i < t; i++)
|
|
1357
1378
|
for (let c = a; c < n; c++)
|
|
1358
1379
|
if (!o[i][c])
|
|
@@ -1363,7 +1384,7 @@ function N(e) {
|
|
|
1363
1384
|
};
|
|
1364
1385
|
for (let s = 0; s < e.content.rows.length; s++)
|
|
1365
1386
|
for (let a = 0; a < e.content.rows[s].cells.length; a++) {
|
|
1366
|
-
const i = se(e.content.rows[s].cells[a]), c = ae(i), l =
|
|
1387
|
+
const i = se(e.content.rows[s].cells[a]), c = ae(i), l = j(i), { row: d, col: u } = r(s, a);
|
|
1367
1388
|
for (let p = d; p < d + c; p++)
|
|
1368
1389
|
for (let f = u; f < u + l; f++) {
|
|
1369
1390
|
if (o[p][f])
|
|
@@ -1387,7 +1408,7 @@ function q(e) {
|
|
|
1387
1408
|
cells: n.map((o) => t.has(o.row + ":" + o.col) ? !1 : (t.add(o.row + ":" + o.col), o.cell)).filter((o) => o !== !1)
|
|
1388
1409
|
}));
|
|
1389
1410
|
}
|
|
1390
|
-
function
|
|
1411
|
+
function P(e, t, n = N(t)) {
|
|
1391
1412
|
for (let o = 0; o < n.length; o++)
|
|
1392
1413
|
for (let r = 0; r < n[o].length; r++) {
|
|
1393
1414
|
const s = n[o][r];
|
|
@@ -1398,17 +1419,17 @@ function H(e, t, n = N(t)) {
|
|
|
1398
1419
|
`Unable to resolve relative table cell indices for table, cell at ${e.row},${e.col} is not occupied`
|
|
1399
1420
|
);
|
|
1400
1421
|
}
|
|
1401
|
-
function
|
|
1422
|
+
function et(e) {
|
|
1402
1423
|
const t = e.content.rows.length;
|
|
1403
1424
|
let n = 0;
|
|
1404
1425
|
return e.content.rows.forEach((o) => {
|
|
1405
1426
|
let r = 0;
|
|
1406
1427
|
o.cells.forEach((s) => {
|
|
1407
|
-
r +=
|
|
1428
|
+
r += j(s);
|
|
1408
1429
|
}), n = Math.max(n, r);
|
|
1409
1430
|
}), { height: t, width: n };
|
|
1410
1431
|
}
|
|
1411
|
-
function
|
|
1432
|
+
function tt(e, t, n = N(t)) {
|
|
1412
1433
|
var r;
|
|
1413
1434
|
const o = (r = n[e.row]) == null ? void 0 : r[e.col];
|
|
1414
1435
|
if (o)
|
|
@@ -1418,7 +1439,7 @@ function Ye(e, t, n = N(t)) {
|
|
|
1418
1439
|
cell: o.cell
|
|
1419
1440
|
};
|
|
1420
1441
|
}
|
|
1421
|
-
function
|
|
1442
|
+
function an(e, t) {
|
|
1422
1443
|
var s;
|
|
1423
1444
|
const n = N(e);
|
|
1424
1445
|
if (t < 0 || t >= n.length)
|
|
@@ -1430,7 +1451,7 @@ function sn(e, t) {
|
|
|
1430
1451
|
return [];
|
|
1431
1452
|
o += i.rowspan;
|
|
1432
1453
|
}
|
|
1433
|
-
const r = new Array(n[0].length).fill(!1).map((a, i) =>
|
|
1454
|
+
const r = new Array(n[0].length).fill(!1).map((a, i) => tt(
|
|
1434
1455
|
{ row: o, col: i },
|
|
1435
1456
|
e,
|
|
1436
1457
|
n
|
|
@@ -1439,7 +1460,7 @@ function sn(e, t) {
|
|
|
1439
1460
|
);
|
|
1440
1461
|
return r.filter((a, i) => r.findIndex((c) => c.row === a.row && c.col === a.col) === i);
|
|
1441
1462
|
}
|
|
1442
|
-
function
|
|
1463
|
+
function cn(e, t) {
|
|
1443
1464
|
var s;
|
|
1444
1465
|
const n = N(e);
|
|
1445
1466
|
if (t < 0 || t >= n[0].length)
|
|
@@ -1451,7 +1472,7 @@ function an(e, t) {
|
|
|
1451
1472
|
return [];
|
|
1452
1473
|
o += i.colspan;
|
|
1453
1474
|
}
|
|
1454
|
-
const r = new Array(n.length).fill(!1).map((a, i) =>
|
|
1475
|
+
const r = new Array(n.length).fill(!1).map((a, i) => tt(
|
|
1455
1476
|
{ row: i, col: o },
|
|
1456
1477
|
e,
|
|
1457
1478
|
n
|
|
@@ -1460,15 +1481,15 @@ function an(e, t) {
|
|
|
1460
1481
|
);
|
|
1461
1482
|
return r.filter((a, i) => r.findIndex((c) => c.row === a.row && c.col === a.col) === i);
|
|
1462
1483
|
}
|
|
1463
|
-
function
|
|
1464
|
-
const { col: r } =
|
|
1484
|
+
function Xo(e, t, n, o = N(e)) {
|
|
1485
|
+
const { col: r } = P(
|
|
1465
1486
|
{
|
|
1466
1487
|
row: 0,
|
|
1467
1488
|
col: t
|
|
1468
1489
|
},
|
|
1469
1490
|
e,
|
|
1470
1491
|
o
|
|
1471
|
-
), { col: s } =
|
|
1492
|
+
), { col: s } = P(
|
|
1472
1493
|
{
|
|
1473
1494
|
row: 0,
|
|
1474
1495
|
col: n
|
|
@@ -1481,15 +1502,15 @@ function qo(e, t, n, o = N(e)) {
|
|
|
1481
1502
|
a.splice(s, 0, i);
|
|
1482
1503
|
}), q(o);
|
|
1483
1504
|
}
|
|
1484
|
-
function
|
|
1485
|
-
const { row: r } =
|
|
1505
|
+
function Jo(e, t, n, o = N(e)) {
|
|
1506
|
+
const { row: r } = P(
|
|
1486
1507
|
{
|
|
1487
1508
|
row: t,
|
|
1488
1509
|
col: 0
|
|
1489
1510
|
},
|
|
1490
1511
|
e,
|
|
1491
1512
|
o
|
|
1492
|
-
), { row: s } =
|
|
1513
|
+
), { row: s } = P(
|
|
1493
1514
|
{
|
|
1494
1515
|
row: n,
|
|
1495
1516
|
col: 0
|
|
@@ -1500,11 +1521,11 @@ function Zo(e, t, n, o = N(e)) {
|
|
|
1500
1521
|
return o.splice(s, 0, a), q(o);
|
|
1501
1522
|
}
|
|
1502
1523
|
function ce(e) {
|
|
1503
|
-
return e ?
|
|
1504
|
-
(t) => typeof t == "string" ? t.length === 0 : I(t) ? t.text.length === 0 :
|
|
1524
|
+
return e ? $(e) ? ce(e.content) : typeof e == "string" ? e.length === 0 : Array.isArray(e) ? e.every(
|
|
1525
|
+
(t) => typeof t == "string" ? t.length === 0 : I(t) ? t.text.length === 0 : Ze(t) ? typeof t.content == "string" ? t.content.length === 0 : t.content.every((n) => n.text.length === 0) : !1
|
|
1505
1526
|
) : !1 : !0;
|
|
1506
1527
|
}
|
|
1507
|
-
function
|
|
1528
|
+
function Ko(e, t, n = N(e)) {
|
|
1508
1529
|
if (t === "columns") {
|
|
1509
1530
|
let s = 0;
|
|
1510
1531
|
for (let a = n[0].length - 1; a >= 0 && n.every(
|
|
@@ -1528,8 +1549,8 @@ function Go(e, t, n = N(e)) {
|
|
|
1528
1549
|
const r = Math.min(o, n.length - 1);
|
|
1529
1550
|
return n.splice(n.length - r, r), q(n);
|
|
1530
1551
|
}
|
|
1531
|
-
function
|
|
1532
|
-
const { width: r, height: s } =
|
|
1552
|
+
function Qo(e, t, n, o = N(e)) {
|
|
1553
|
+
const { width: r, height: s } = et(e);
|
|
1533
1554
|
if (t === "columns")
|
|
1534
1555
|
o.forEach((a, i) => {
|
|
1535
1556
|
if (n >= 0)
|
|
@@ -1558,8 +1579,8 @@ function Xo(e, t, n, o = N(e)) {
|
|
|
1558
1579
|
else n < 0 && o.splice(s + n, -1 * n);
|
|
1559
1580
|
return q(o);
|
|
1560
1581
|
}
|
|
1561
|
-
function
|
|
1562
|
-
const o =
|
|
1582
|
+
function Yo(e, t, n) {
|
|
1583
|
+
const o = an(e, n);
|
|
1563
1584
|
if (!o.some((c) => ae(c.cell) > 1))
|
|
1564
1585
|
return !0;
|
|
1565
1586
|
let s = n, a = n;
|
|
@@ -1568,18 +1589,18 @@ function Jo(e, t, n) {
|
|
|
1568
1589
|
s = Math.max(s, c.row + l - 1), a = Math.min(a, c.row);
|
|
1569
1590
|
}), t < n ? n === s : n === a;
|
|
1570
1591
|
}
|
|
1571
|
-
function
|
|
1572
|
-
const o =
|
|
1573
|
-
if (!o.some((c) =>
|
|
1592
|
+
function er(e, t, n) {
|
|
1593
|
+
const o = cn(e, n);
|
|
1594
|
+
if (!o.some((c) => j(c.cell) > 1))
|
|
1574
1595
|
return !0;
|
|
1575
1596
|
let s = n, a = n;
|
|
1576
1597
|
return o.forEach((c) => {
|
|
1577
|
-
const l =
|
|
1598
|
+
const l = j(c.cell);
|
|
1578
1599
|
s = Math.max(s, c.col + l - 1), a = Math.min(a, c.col);
|
|
1579
1600
|
}), t < n ? n === s : n === a;
|
|
1580
1601
|
}
|
|
1581
|
-
function
|
|
1582
|
-
const o =
|
|
1602
|
+
function tr(e, t, n) {
|
|
1603
|
+
const o = P(e, n), r = P(t, n);
|
|
1583
1604
|
return o.col === r.col;
|
|
1584
1605
|
}
|
|
1585
1606
|
function Ie(e, t, n, o) {
|
|
@@ -1598,7 +1619,7 @@ function Ie(e, t, n, o) {
|
|
|
1598
1619
|
return !o || !t.nodes[o].spec.code ? e.text.split(/(\n)/g).filter((a) => a.length > 0).map((a) => a === `
|
|
1599
1620
|
` ? t.nodes.hardBreak.createChecked() : t.text(a, r)) : e.text.length > 0 ? [t.text(e.text, r)] : [];
|
|
1600
1621
|
}
|
|
1601
|
-
function
|
|
1622
|
+
function ln(e, t, n) {
|
|
1602
1623
|
const o = t.marks.link.create({
|
|
1603
1624
|
href: e.href
|
|
1604
1625
|
});
|
|
@@ -1634,21 +1655,21 @@ function O(e, t, n, o = R(t)) {
|
|
|
1634
1655
|
for (const s of e)
|
|
1635
1656
|
typeof s == "string" ? r.push(
|
|
1636
1657
|
...le(s, t, o, n)
|
|
1637
|
-
) :
|
|
1658
|
+
) : Ze(s) ? r.push(...ln(s, t, o)) : I(s) ? r.push(
|
|
1638
1659
|
...le([s], t, o, n)
|
|
1639
1660
|
) : r.push(
|
|
1640
|
-
|
|
1661
|
+
ot(s, t, o)
|
|
1641
1662
|
);
|
|
1642
1663
|
return r;
|
|
1643
1664
|
}
|
|
1644
|
-
function
|
|
1665
|
+
function nt(e, t, n = R(t)) {
|
|
1645
1666
|
const o = [], r = new Array(e.headerRows ?? 0).fill(!0), s = new Array(e.headerCols ?? 0).fill(!0), a = e.columnWidths ?? [];
|
|
1646
1667
|
for (let i = 0; i < e.rows.length; i++) {
|
|
1647
1668
|
const c = e.rows[i], l = [], d = r[i];
|
|
1648
1669
|
for (let p = 0; p < c.cells.length; p++) {
|
|
1649
|
-
const f = c.cells[p], h = s[p],
|
|
1670
|
+
const f = c.cells[p], h = s[p], k = void 0;
|
|
1650
1671
|
let m = null;
|
|
1651
|
-
const b =
|
|
1672
|
+
const b = P(
|
|
1652
1673
|
{
|
|
1653
1674
|
row: i,
|
|
1654
1675
|
col: p
|
|
@@ -1658,15 +1679,15 @@ function et(e, t, n = R(t)) {
|
|
|
1658
1679
|
let y = a[b.col] ? [a[b.col]] : null;
|
|
1659
1680
|
if (f) if (typeof f == "string")
|
|
1660
1681
|
m = t.text(f);
|
|
1661
|
-
else if (
|
|
1682
|
+
else if ($(f)) {
|
|
1662
1683
|
f.content && (m = O(
|
|
1663
1684
|
f.content,
|
|
1664
1685
|
t,
|
|
1665
1686
|
"tableParagraph",
|
|
1666
1687
|
n
|
|
1667
1688
|
));
|
|
1668
|
-
const
|
|
1669
|
-
|
|
1689
|
+
const v = j(f);
|
|
1690
|
+
v > 1 && (y = new Array(v).fill(!1).map((S, oe) => a[b.col + oe] ?? void 0));
|
|
1670
1691
|
} else
|
|
1671
1692
|
m = O(
|
|
1672
1693
|
f,
|
|
@@ -1676,10 +1697,10 @@ function et(e, t, n = R(t)) {
|
|
|
1676
1697
|
);
|
|
1677
1698
|
const g = t.nodes[h || d ? "tableHeader" : "tableCell"].createChecked(
|
|
1678
1699
|
{
|
|
1679
|
-
|
|
1700
|
+
...$(f) ? f.props : {},
|
|
1680
1701
|
colwidth: y
|
|
1681
1702
|
},
|
|
1682
|
-
t.nodes.tableParagraph.createChecked(
|
|
1703
|
+
t.nodes.tableParagraph.createChecked(k, m)
|
|
1683
1704
|
);
|
|
1684
1705
|
l.push(g);
|
|
1685
1706
|
}
|
|
@@ -1688,7 +1709,7 @@ function et(e, t, n = R(t)) {
|
|
|
1688
1709
|
}
|
|
1689
1710
|
return o;
|
|
1690
1711
|
}
|
|
1691
|
-
function
|
|
1712
|
+
function ot(e, t, n) {
|
|
1692
1713
|
let o, r = e.type;
|
|
1693
1714
|
if (r === void 0 && (r = "paragraph"), !t.nodes[r])
|
|
1694
1715
|
throw new Error(`node type ${r} not found in schema`);
|
|
@@ -1711,7 +1732,7 @@ function tt(e, t, n) {
|
|
|
1711
1732
|
);
|
|
1712
1733
|
o = t.nodes[r].createChecked(e.props, s);
|
|
1713
1734
|
} else if (e.content.type === "tableContent") {
|
|
1714
|
-
const s =
|
|
1735
|
+
const s = nt(e.content, t, n);
|
|
1715
1736
|
o = t.nodes[r].createChecked(e.props, s);
|
|
1716
1737
|
} else
|
|
1717
1738
|
throw new Z(e.content.type);
|
|
@@ -1719,14 +1740,14 @@ function tt(e, t, n) {
|
|
|
1719
1740
|
}
|
|
1720
1741
|
function Y(e, t, n = R(t)) {
|
|
1721
1742
|
let o = e.id;
|
|
1722
|
-
o === void 0 && (o =
|
|
1743
|
+
o === void 0 && (o = qe.options.generateID());
|
|
1723
1744
|
const r = [];
|
|
1724
1745
|
if (e.children)
|
|
1725
1746
|
for (const a of e.children)
|
|
1726
1747
|
r.push(Y(a, t, n));
|
|
1727
1748
|
if (!e.type || // can happen if block.type is not defined (this should create the default node)
|
|
1728
1749
|
t.nodes[e.type].isInGroup("blockContent")) {
|
|
1729
|
-
const a =
|
|
1750
|
+
const a = ot(
|
|
1730
1751
|
e,
|
|
1731
1752
|
t,
|
|
1732
1753
|
n
|
|
@@ -1752,32 +1773,32 @@ function Y(e, t, n = R(t)) {
|
|
|
1752
1773
|
);
|
|
1753
1774
|
}
|
|
1754
1775
|
}
|
|
1755
|
-
function
|
|
1776
|
+
function un(e, t) {
|
|
1756
1777
|
let n, o;
|
|
1757
|
-
if (t.firstChild.descendants((r, s) => n ? !1 : !
|
|
1778
|
+
if (t.firstChild.descendants((r, s) => n ? !1 : !dn(r) || r.attrs.id !== e ? !0 : (n = r, o = s + 1, !1)), !(n === void 0 || o === void 0))
|
|
1758
1779
|
return {
|
|
1759
1780
|
node: n,
|
|
1760
1781
|
posBeforeNode: o
|
|
1761
1782
|
};
|
|
1762
1783
|
}
|
|
1763
|
-
function
|
|
1784
|
+
function dn(e) {
|
|
1764
1785
|
return e.type.isInGroup("bnBlock");
|
|
1765
1786
|
}
|
|
1766
|
-
const
|
|
1787
|
+
const nr = (e, t) => ({
|
|
1767
1788
|
tr: n,
|
|
1768
1789
|
dispatch: o
|
|
1769
1790
|
}) => (o && ye(n, e, t), !0);
|
|
1770
1791
|
function ye(e, t, n, o, r) {
|
|
1771
|
-
const s =
|
|
1792
|
+
const s = Zt(e.doc.resolve(t));
|
|
1772
1793
|
let a = null;
|
|
1773
|
-
s.blockNoteType === "table" && (a =
|
|
1794
|
+
s.blockNoteType === "table" && (a = fn(e));
|
|
1774
1795
|
const i = G(e);
|
|
1775
1796
|
if (o !== void 0 && r !== void 0 && o > r)
|
|
1776
1797
|
throw new Error("Invalid replaceFromPos or replaceToPos");
|
|
1777
1798
|
const c = i.nodes[s.blockNoteType], l = i.nodes[n.type || s.blockNoteType], d = l.isInGroup("bnBlock") ? l : i.nodes.blockContainer;
|
|
1778
1799
|
if (s.isBlockContainer && l.isInGroup("blockContent")) {
|
|
1779
1800
|
const u = o !== void 0 && o > s.blockContent.beforePos && o < s.blockContent.afterPos ? o - s.blockContent.beforePos - 1 : void 0, p = r !== void 0 && r > s.blockContent.beforePos && r < s.blockContent.afterPos ? r - s.blockContent.beforePos - 1 : void 0;
|
|
1780
|
-
|
|
1801
|
+
Pe(n, e, s), pn(
|
|
1781
1802
|
n,
|
|
1782
1803
|
e,
|
|
1783
1804
|
c,
|
|
@@ -1787,7 +1808,7 @@ function ye(e, t, n, o, r) {
|
|
|
1787
1808
|
p
|
|
1788
1809
|
);
|
|
1789
1810
|
} else if (!s.isBlockContainer && l.isInGroup("bnBlock"))
|
|
1790
|
-
|
|
1811
|
+
Pe(n, e, s);
|
|
1791
1812
|
else {
|
|
1792
1813
|
const u = X(s.bnBlock.node, i);
|
|
1793
1814
|
e.replaceWith(
|
|
@@ -1807,9 +1828,9 @@ function ye(e, t, n, o, r) {
|
|
|
1807
1828
|
e.setNodeMarkup(s.bnBlock.beforePos, d, {
|
|
1808
1829
|
...s.bnBlock.node.attrs,
|
|
1809
1830
|
...n.props
|
|
1810
|
-
}), a &&
|
|
1831
|
+
}), a && hn(e, s, a);
|
|
1811
1832
|
}
|
|
1812
|
-
function
|
|
1833
|
+
function pn(e, t, n, o, r, s, a) {
|
|
1813
1834
|
const i = G(t);
|
|
1814
1835
|
let c = "keep";
|
|
1815
1836
|
if (e.content)
|
|
@@ -1822,7 +1843,7 @@ function dn(e, t, n, o, r, s, a) {
|
|
|
1822
1843
|
else if (Array.isArray(e.content))
|
|
1823
1844
|
c = O(e.content, i, o.name);
|
|
1824
1845
|
else if (e.content.type === "tableContent")
|
|
1825
|
-
c =
|
|
1846
|
+
c = nt(e.content, i);
|
|
1826
1847
|
else
|
|
1827
1848
|
throw new Z(e.content.type);
|
|
1828
1849
|
else
|
|
@@ -1860,7 +1881,7 @@ function dn(e, t, n, o, r, s, a) {
|
|
|
1860
1881
|
)
|
|
1861
1882
|
);
|
|
1862
1883
|
}
|
|
1863
|
-
function
|
|
1884
|
+
function Pe(e, t, n) {
|
|
1864
1885
|
const o = G(t);
|
|
1865
1886
|
if (e.children !== void 0 && e.children.length > 0) {
|
|
1866
1887
|
const r = e.children.map((s) => Y(s, o));
|
|
@@ -1882,8 +1903,8 @@ function He(e, t, n) {
|
|
|
1882
1903
|
}
|
|
1883
1904
|
}
|
|
1884
1905
|
}
|
|
1885
|
-
function
|
|
1886
|
-
const s = typeof t == "string" ? t : t.id, a =
|
|
1906
|
+
function or(e, t, n, o, r) {
|
|
1907
|
+
const s = typeof t == "string" ? t : t.id, a = un(s, e.doc);
|
|
1887
1908
|
if (!a)
|
|
1888
1909
|
throw new Error(`Block with ID ${s} not found`);
|
|
1889
1910
|
ye(
|
|
@@ -1896,9 +1917,9 @@ function er(e, t, n, o, r) {
|
|
|
1896
1917
|
const i = e.doc.resolve(a.posBeforeNode + 1).node(), c = G(e);
|
|
1897
1918
|
return X(i, c);
|
|
1898
1919
|
}
|
|
1899
|
-
function
|
|
1920
|
+
function fn(e) {
|
|
1900
1921
|
const t = "selection" in e ? e.selection : null;
|
|
1901
|
-
if (!(t instanceof
|
|
1922
|
+
if (!(t instanceof ze))
|
|
1902
1923
|
return null;
|
|
1903
1924
|
const n = e.doc.resolve(t.head);
|
|
1904
1925
|
let o = -1, r = -1;
|
|
@@ -1917,10 +1938,10 @@ function pn(e) {
|
|
|
1917
1938
|
const c = We.get(i), l = s - (a + 1), d = c.map.indexOf(l);
|
|
1918
1939
|
if (d < 0)
|
|
1919
1940
|
return null;
|
|
1920
|
-
const u = Math.floor(d / c.width), p = d % c.width, h = s + 1 + 1,
|
|
1921
|
-
return { row: u, col: p, offset:
|
|
1941
|
+
const u = Math.floor(d / c.width), p = d % c.width, h = s + 1 + 1, k = Math.max(0, t.head - h);
|
|
1942
|
+
return { row: u, col: p, offset: k };
|
|
1922
1943
|
}
|
|
1923
|
-
function
|
|
1944
|
+
function hn(e, t, n) {
|
|
1924
1945
|
var m;
|
|
1925
1946
|
if (t.blockNoteType !== "table")
|
|
1926
1947
|
return !1;
|
|
@@ -1929,7 +1950,7 @@ function fn(e, t, n) {
|
|
|
1929
1950
|
o = e.mapping.map(t.blockContent.beforePos);
|
|
1930
1951
|
else {
|
|
1931
1952
|
const b = e.mapping.map(t.bnBlock.beforePos), y = b + (((m = e.doc.nodeAt(b)) == null ? void 0 : m.nodeSize) || 0);
|
|
1932
|
-
e.doc.nodesBetween(b, y, (g,
|
|
1953
|
+
e.doc.nodesBetween(b, y, (g, v) => g.type.name === "table" ? (o = v, !1) : !0);
|
|
1933
1954
|
}
|
|
1934
1955
|
const r = o >= 0 ? e.doc.nodeAt(o) : null;
|
|
1935
1956
|
if (!r || r.type.name !== "table")
|
|
@@ -1937,8 +1958,8 @@ function fn(e, t, n) {
|
|
|
1937
1958
|
const s = We.get(r), a = Math.max(0, Math.min(n.row, s.height - 1)), i = Math.max(0, Math.min(n.col, s.width - 1)), c = a * s.width + i, l = s.map[c];
|
|
1938
1959
|
if (l == null)
|
|
1939
1960
|
return !1;
|
|
1940
|
-
const u = o + 1 + l + 1, p = e.doc.nodeAt(u), f = u + 1, h = p ? p.content.size : 0,
|
|
1941
|
-
return "selection" in e && e.setSelection(
|
|
1961
|
+
const u = o + 1 + l + 1, p = e.doc.nodeAt(u), f = u + 1, h = p ? p.content.size : 0, k = f + Math.max(0, Math.min(n.offset, h));
|
|
1962
|
+
return "selection" in e && e.setSelection(ze.create(e.doc, k)), !0;
|
|
1942
1963
|
}
|
|
1943
1964
|
const A = {
|
|
1944
1965
|
gray: {
|
|
@@ -1977,7 +1998,7 @@ const A = {
|
|
|
1977
1998
|
text: "#ad1a72",
|
|
1978
1999
|
background: "#f4dfeb"
|
|
1979
2000
|
}
|
|
1980
|
-
},
|
|
2001
|
+
}, rr = {
|
|
1981
2002
|
gray: {
|
|
1982
2003
|
text: "#bebdb8",
|
|
1983
2004
|
background: "#9b9a97"
|
|
@@ -2014,7 +2035,7 @@ const A = {
|
|
|
2014
2035
|
text: "#da208f",
|
|
2015
2036
|
background: "#ad1a72"
|
|
2016
2037
|
}
|
|
2017
|
-
},
|
|
2038
|
+
}, C = {
|
|
2018
2039
|
backgroundColor: {
|
|
2019
2040
|
default: "default"
|
|
2020
2041
|
},
|
|
@@ -2027,27 +2048,27 @@ const A = {
|
|
|
2027
2048
|
}
|
|
2028
2049
|
}, B = (e) => {
|
|
2029
2050
|
const t = {};
|
|
2030
|
-
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 =
|
|
2051
|
+
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 = C.textAlignment.values.includes(
|
|
2031
2052
|
e.style.textAlign
|
|
2032
2053
|
) ? e.style.textAlign : void 0, t;
|
|
2033
|
-
},
|
|
2034
|
-
e.backgroundColor && e.backgroundColor !==
|
|
2035
|
-
},
|
|
2036
|
-
default:
|
|
2037
|
-
parseHTML: (t) => t.hasAttribute("data-background-color") ? t.getAttribute("data-background-color") : t.style.backgroundColor ? t.style.backgroundColor :
|
|
2038
|
-
renderHTML: (t) => t[e] ===
|
|
2054
|
+
}, H = (e, t) => {
|
|
2055
|
+
e.backgroundColor && e.backgroundColor !== C.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in A ? A[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== C.textColor.default && (t.style.color = e.textColor in A ? A[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== C.textAlignment.default && (t.style.textAlign = e.textAlignment);
|
|
2056
|
+
}, sr = (e = "backgroundColor") => ({
|
|
2057
|
+
default: C.backgroundColor.default,
|
|
2058
|
+
parseHTML: (t) => t.hasAttribute("data-background-color") ? t.getAttribute("data-background-color") : t.style.backgroundColor ? t.style.backgroundColor : C.backgroundColor.default,
|
|
2059
|
+
renderHTML: (t) => t[e] === C.backgroundColor.default ? {} : {
|
|
2039
2060
|
"data-background-color": t[e]
|
|
2040
2061
|
}
|
|
2041
|
-
}),
|
|
2042
|
-
default:
|
|
2043
|
-
parseHTML: (t) => t.hasAttribute("data-text-color") ? t.getAttribute("data-text-color") : t.style.color ? t.style.color :
|
|
2044
|
-
renderHTML: (t) => t[e] ===
|
|
2062
|
+
}), ar = (e = "textColor") => ({
|
|
2063
|
+
default: C.textColor.default,
|
|
2064
|
+
parseHTML: (t) => t.hasAttribute("data-text-color") ? t.getAttribute("data-text-color") : t.style.color ? t.style.color : C.textColor.default,
|
|
2065
|
+
renderHTML: (t) => t[e] === C.textColor.default ? {} : {
|
|
2045
2066
|
"data-text-color": t[e]
|
|
2046
2067
|
}
|
|
2047
|
-
}),
|
|
2048
|
-
default:
|
|
2049
|
-
parseHTML: (t) => t.hasAttribute("data-text-alignment") ? t.getAttribute("data-text-alignment") : t.style.textAlign ? t.style.textAlign :
|
|
2050
|
-
renderHTML: (t) => t[e] ===
|
|
2068
|
+
}), ir = (e = "textAlignment") => ({
|
|
2069
|
+
default: C.textAlignment.default,
|
|
2070
|
+
parseHTML: (t) => t.hasAttribute("data-text-alignment") ? t.getAttribute("data-text-alignment") : t.style.textAlign ? t.style.textAlign : C.textAlignment.default,
|
|
2071
|
+
renderHTML: (t) => t[e] === C.textAlignment.default ? {} : {
|
|
2051
2072
|
"data-text-alignment": t[e]
|
|
2052
2073
|
}
|
|
2053
2074
|
}), ee = (e, t) => {
|
|
@@ -2058,7 +2079,7 @@ const A = {
|
|
|
2058
2079
|
return;
|
|
2059
2080
|
const o = e.querySelector("figcaption"), r = (o == null ? void 0 : o.textContent) ?? void 0;
|
|
2060
2081
|
return { targetElement: n, caption: r };
|
|
2061
|
-
},
|
|
2082
|
+
}, mn = (e, t, n) => {
|
|
2062
2083
|
const o = document.createElement("div");
|
|
2063
2084
|
o.className = "bn-add-file-button";
|
|
2064
2085
|
const r = document.createElement("div");
|
|
@@ -2092,11 +2113,11 @@ const A = {
|
|
|
2092
2113
|
);
|
|
2093
2114
|
}
|
|
2094
2115
|
};
|
|
2095
|
-
},
|
|
2116
|
+
}, gn = '<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>', bn = (e) => {
|
|
2096
2117
|
const t = document.createElement("div");
|
|
2097
2118
|
t.className = "bn-file-name-with-icon";
|
|
2098
2119
|
const n = document.createElement("div");
|
|
2099
|
-
n.className = "bn-file-icon", n.innerHTML =
|
|
2120
|
+
n.className = "bn-file-icon", n.innerHTML = gn, t.appendChild(n);
|
|
2100
2121
|
const o = document.createElement("p");
|
|
2101
2122
|
return o.className = "bn-file-name", o.textContent = e.props.name, t.appendChild(o), {
|
|
2102
2123
|
dom: t
|
|
@@ -2104,7 +2125,7 @@ const A = {
|
|
|
2104
2125
|
}, we = (e, t, n, o) => {
|
|
2105
2126
|
const r = document.createElement("div");
|
|
2106
2127
|
if (r.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
2107
|
-
const a =
|
|
2128
|
+
const a = mn(e, t, o);
|
|
2108
2129
|
r.appendChild(a.dom);
|
|
2109
2130
|
const i = t.onUploadStart((c) => {
|
|
2110
2131
|
if (c === e.id) {
|
|
@@ -2122,7 +2143,7 @@ const A = {
|
|
|
2122
2143
|
}
|
|
2123
2144
|
const s = { dom: r };
|
|
2124
2145
|
if (e.props.showPreview === !1 || !n) {
|
|
2125
|
-
const a =
|
|
2146
|
+
const a = bn(e);
|
|
2126
2147
|
r.appendChild(a.dom), s.destroy = () => {
|
|
2127
2148
|
var i;
|
|
2128
2149
|
(i = a.destroy) == null || i.call(a);
|
|
@@ -2142,10 +2163,10 @@ const A = {
|
|
|
2142
2163
|
return o.textContent = t, n.appendChild(e), n.appendChild(o), {
|
|
2143
2164
|
dom: n
|
|
2144
2165
|
};
|
|
2145
|
-
},
|
|
2166
|
+
}, He = (e) => ({ url: e.src || void 0 }), kn = '<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>', Cn = (e) => ({
|
|
2146
2167
|
type: "audio",
|
|
2147
2168
|
propSchema: {
|
|
2148
|
-
backgroundColor:
|
|
2169
|
+
backgroundColor: C.backgroundColor,
|
|
2149
2170
|
// File name.
|
|
2150
2171
|
name: {
|
|
2151
2172
|
default: ""
|
|
@@ -2163,13 +2184,13 @@ const A = {
|
|
|
2163
2184
|
}
|
|
2164
2185
|
},
|
|
2165
2186
|
content: "none"
|
|
2166
|
-
}),
|
|
2187
|
+
}), yn = (e = {}) => (t) => {
|
|
2167
2188
|
if (t.tagName === "AUDIO") {
|
|
2168
2189
|
if (t.closest("figure"))
|
|
2169
2190
|
return;
|
|
2170
2191
|
const { backgroundColor: n } = B(t);
|
|
2171
2192
|
return {
|
|
2172
|
-
...
|
|
2193
|
+
...He(t),
|
|
2173
2194
|
backgroundColor: n
|
|
2174
2195
|
};
|
|
2175
2196
|
}
|
|
@@ -2179,14 +2200,14 @@ const A = {
|
|
|
2179
2200
|
return;
|
|
2180
2201
|
const { targetElement: o, caption: r } = n, { backgroundColor: s } = B(t);
|
|
2181
2202
|
return {
|
|
2182
|
-
...
|
|
2203
|
+
...He(o),
|
|
2183
2204
|
backgroundColor: s,
|
|
2184
2205
|
caption: r
|
|
2185
2206
|
};
|
|
2186
2207
|
}
|
|
2187
|
-
},
|
|
2208
|
+
}, wn = (e = {}) => (t, n) => {
|
|
2188
2209
|
const o = document.createElement("div");
|
|
2189
|
-
o.innerHTML = e.icon ??
|
|
2210
|
+
o.innerHTML = e.icon ?? kn;
|
|
2190
2211
|
const r = document.createElement("audio");
|
|
2191
2212
|
return r.className = "bn-audio", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((s) => {
|
|
2192
2213
|
r.src = s;
|
|
@@ -2196,7 +2217,7 @@ const A = {
|
|
|
2196
2217
|
{ dom: r },
|
|
2197
2218
|
o.firstElementChild
|
|
2198
2219
|
);
|
|
2199
|
-
},
|
|
2220
|
+
}, vn = (e = {}) => (t, n) => {
|
|
2200
2221
|
if (!t.props.url) {
|
|
2201
2222
|
const r = document.createElement("p");
|
|
2202
2223
|
return r.textContent = "Add audio", {
|
|
@@ -2207,19 +2228,19 @@ const A = {
|
|
|
2207
2228
|
return t.props.showPreview ? (o = document.createElement("audio"), o.src = t.props.url) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? ve(o, t.props.caption) : te(o, t.props.caption) : {
|
|
2208
2229
|
dom: o
|
|
2209
2230
|
};
|
|
2210
|
-
},
|
|
2231
|
+
}, En = M(
|
|
2211
2232
|
Cn,
|
|
2212
2233
|
(e) => ({
|
|
2213
2234
|
meta: {
|
|
2214
2235
|
fileBlockAccept: ["audio/*"]
|
|
2215
2236
|
},
|
|
2216
|
-
parse:
|
|
2217
|
-
render:
|
|
2218
|
-
toExternalHTML:
|
|
2237
|
+
parse: yn(e),
|
|
2238
|
+
render: wn(e),
|
|
2239
|
+
toExternalHTML: vn(e),
|
|
2219
2240
|
runsBefore: ["file"]
|
|
2220
2241
|
})
|
|
2221
2242
|
);
|
|
2222
|
-
class
|
|
2243
|
+
class xn {
|
|
2223
2244
|
constructor() {
|
|
2224
2245
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
2225
2246
|
x(this, "callbacks", {});
|
|
@@ -2239,7 +2260,7 @@ class En {
|
|
|
2239
2260
|
this.callbacks = {};
|
|
2240
2261
|
}
|
|
2241
2262
|
}
|
|
2242
|
-
class
|
|
2263
|
+
class Sn extends xn {
|
|
2243
2264
|
// eslint-disable-next-line
|
|
2244
2265
|
constructor(...n) {
|
|
2245
2266
|
super();
|
|
@@ -2283,16 +2304,16 @@ class xn extends En {
|
|
|
2283
2304
|
}
|
|
2284
2305
|
}
|
|
2285
2306
|
function L(e) {
|
|
2286
|
-
const t = Object.create(
|
|
2307
|
+
const t = Object.create(Sn.prototype);
|
|
2287
2308
|
return t.key = e.key, t.inputRules = e.inputRules, t.keyboardShortcuts = e.keyboardShortcuts, t.plugins = e.plugins ?? [], t.tiptapExtensions = e.tiptapExtensions, t;
|
|
2288
2309
|
}
|
|
2289
2310
|
const Oe = Symbol.for("blocknote.shikiParser"), re = Symbol.for(
|
|
2290
2311
|
"blocknote.shikiHighlighterPromise"
|
|
2291
2312
|
);
|
|
2292
|
-
function
|
|
2313
|
+
function Bn(e) {
|
|
2293
2314
|
const t = globalThis;
|
|
2294
2315
|
let n, o, r = !1;
|
|
2295
|
-
return
|
|
2316
|
+
return It({
|
|
2296
2317
|
parser: (a) => {
|
|
2297
2318
|
if (!e.createHighlighter)
|
|
2298
2319
|
return process.env.NODE_ENV === "development" && !r && (console.log(
|
|
@@ -2304,14 +2325,14 @@ function Sn(e) {
|
|
|
2304
2325
|
n = c;
|
|
2305
2326
|
}
|
|
2306
2327
|
);
|
|
2307
|
-
const i =
|
|
2308
|
-
return !i || i === "text" || i === "none" || i === "plaintext" || i === "txt" ? [] : n.getLoadedLanguages().includes(i) ? (o || (o = t[Oe] ||
|
|
2328
|
+
const i = rt(e, a.language);
|
|
2329
|
+
return !i || i === "text" || i === "none" || i === "plaintext" || i === "txt" ? [] : n.getLoadedLanguages().includes(i) ? (o || (o = t[Oe] || Pt(n), t[Oe] = o), o(a)) : n.loadLanguage(i);
|
|
2309
2330
|
},
|
|
2310
2331
|
languageExtractor: (a) => a.attrs.language,
|
|
2311
2332
|
nodeTypes: ["codeBlock"]
|
|
2312
2333
|
});
|
|
2313
2334
|
}
|
|
2314
|
-
const
|
|
2335
|
+
const Mn = ({ defaultLanguage: e = "text" }) => ({
|
|
2315
2336
|
type: "codeBlock",
|
|
2316
2337
|
propSchema: {
|
|
2317
2338
|
language: {
|
|
@@ -2319,8 +2340,8 @@ const Bn = ({ defaultLanguage: e = "text" }) => ({
|
|
|
2319
2340
|
}
|
|
2320
2341
|
},
|
|
2321
2342
|
content: "inline"
|
|
2322
|
-
}),
|
|
2323
|
-
|
|
2343
|
+
}), Ln = M(
|
|
2344
|
+
Mn,
|
|
2324
2345
|
(e) => ({
|
|
2325
2346
|
meta: {
|
|
2326
2347
|
code: !0,
|
|
@@ -2345,18 +2366,20 @@ const Bn = ({ defaultLanguage: e = "text" }) => ({
|
|
|
2345
2366
|
r.appendChild(s);
|
|
2346
2367
|
let a;
|
|
2347
2368
|
if (e.supportedLanguages) {
|
|
2348
|
-
const i = document.createElement("select")
|
|
2349
|
-
|
|
2350
|
-
n.updateBlock(t.id, { props: { language: u } });
|
|
2351
|
-
};
|
|
2352
|
-
i.addEventListener("change", c);
|
|
2353
|
-
const l = document.createElement("div");
|
|
2354
|
-
l.contentEditable = "false", i.value = t.props.language || e.defaultLanguage || "text", Object.entries(e.supportedLanguages ?? {}).forEach(
|
|
2369
|
+
const i = document.createElement("select");
|
|
2370
|
+
Object.entries(e.supportedLanguages ?? {}).forEach(
|
|
2355
2371
|
([d, { name: u }]) => {
|
|
2356
2372
|
const p = document.createElement("option");
|
|
2357
2373
|
p.value = d, p.text = u, i.appendChild(p);
|
|
2358
2374
|
}
|
|
2359
|
-
),
|
|
2375
|
+
), i.value = t.props.language || e.defaultLanguage || "text";
|
|
2376
|
+
const c = (d) => {
|
|
2377
|
+
const u = d.target.value;
|
|
2378
|
+
n.updateBlock(t.id, { props: { language: u } });
|
|
2379
|
+
};
|
|
2380
|
+
i.addEventListener("change", c), a = () => i.removeEventListener("change", c);
|
|
2381
|
+
const l = document.createElement("div");
|
|
2382
|
+
l.contentEditable = "false", l.appendChild(i), o.appendChild(l);
|
|
2360
2383
|
}
|
|
2361
2384
|
return o.appendChild(r), {
|
|
2362
2385
|
dom: o,
|
|
@@ -2377,7 +2400,7 @@ const Bn = ({ defaultLanguage: e = "text" }) => ({
|
|
|
2377
2400
|
(e) => [
|
|
2378
2401
|
L({
|
|
2379
2402
|
key: "code-block-highlighter",
|
|
2380
|
-
plugins: [
|
|
2403
|
+
plugins: [Bn(e)]
|
|
2381
2404
|
}),
|
|
2382
2405
|
L({
|
|
2383
2406
|
key: "code-block-keyboard-shortcuts",
|
|
@@ -2435,7 +2458,7 @@ const Bn = ({ defaultLanguage: e = "text" }) => ({
|
|
|
2435
2458
|
type: "codeBlock",
|
|
2436
2459
|
props: {
|
|
2437
2460
|
language: {
|
|
2438
|
-
language:
|
|
2461
|
+
language: rt(e, n) ?? n
|
|
2439
2462
|
}.language
|
|
2440
2463
|
},
|
|
2441
2464
|
content: []
|
|
@@ -2446,16 +2469,49 @@ const Bn = ({ defaultLanguage: e = "text" }) => ({
|
|
|
2446
2469
|
})
|
|
2447
2470
|
]
|
|
2448
2471
|
);
|
|
2449
|
-
function
|
|
2472
|
+
function rt(e, t) {
|
|
2450
2473
|
var n;
|
|
2451
2474
|
return (n = Object.entries(e.supportedLanguages ?? {}).find(
|
|
2452
2475
|
([o, { aliases: r }]) => (r == null ? void 0 : r.includes(t)) || o === t
|
|
2453
2476
|
)) == null ? void 0 : n[0];
|
|
2454
2477
|
}
|
|
2455
|
-
const
|
|
2478
|
+
const Tn = () => ({
|
|
2479
|
+
type: "divider",
|
|
2480
|
+
propSchema: {},
|
|
2481
|
+
content: "none"
|
|
2482
|
+
}), An = M(
|
|
2483
|
+
Tn,
|
|
2484
|
+
{
|
|
2485
|
+
meta: {
|
|
2486
|
+
isolating: !1
|
|
2487
|
+
},
|
|
2488
|
+
parse(e) {
|
|
2489
|
+
if (e.tagName === "HR")
|
|
2490
|
+
return {};
|
|
2491
|
+
},
|
|
2492
|
+
render() {
|
|
2493
|
+
return {
|
|
2494
|
+
dom: document.createElement("hr")
|
|
2495
|
+
};
|
|
2496
|
+
}
|
|
2497
|
+
},
|
|
2498
|
+
[
|
|
2499
|
+
L({
|
|
2500
|
+
key: "divider-block-shortcuts",
|
|
2501
|
+
inputRules: [
|
|
2502
|
+
{
|
|
2503
|
+
find: new RegExp("^---$"),
|
|
2504
|
+
replace() {
|
|
2505
|
+
return { type: "divider", props: {}, content: [] };
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
]
|
|
2509
|
+
})
|
|
2510
|
+
]
|
|
2511
|
+
), De = (e) => ({ url: e.src || void 0 }), Nn = () => ({
|
|
2456
2512
|
type: "file",
|
|
2457
2513
|
propSchema: {
|
|
2458
|
-
backgroundColor:
|
|
2514
|
+
backgroundColor: C.backgroundColor,
|
|
2459
2515
|
// File name.
|
|
2460
2516
|
name: {
|
|
2461
2517
|
default: ""
|
|
@@ -2470,7 +2526,7 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2470
2526
|
}
|
|
2471
2527
|
},
|
|
2472
2528
|
content: "none"
|
|
2473
|
-
}),
|
|
2529
|
+
}), In = () => (e) => {
|
|
2474
2530
|
if (e.tagName === "EMBED") {
|
|
2475
2531
|
if (e.closest("figure"))
|
|
2476
2532
|
return;
|
|
@@ -2491,11 +2547,11 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2491
2547
|
caption: o
|
|
2492
2548
|
};
|
|
2493
2549
|
}
|
|
2494
|
-
},
|
|
2550
|
+
}, Pn = M(Nn, {
|
|
2495
2551
|
meta: {
|
|
2496
2552
|
fileBlockAccept: ["*/*"]
|
|
2497
2553
|
},
|
|
2498
|
-
parse:
|
|
2554
|
+
parse: In(),
|
|
2499
2555
|
render(e, t) {
|
|
2500
2556
|
return we(e, t);
|
|
2501
2557
|
},
|
|
@@ -2511,14 +2567,14 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2511
2567
|
dom: t
|
|
2512
2568
|
};
|
|
2513
2569
|
}
|
|
2514
|
-
}),
|
|
2570
|
+
}), Hn = {
|
|
2515
2571
|
set: (e, t) => window.localStorage.setItem(
|
|
2516
2572
|
`toggle-${e.id}`,
|
|
2517
2573
|
t ? "true" : "false"
|
|
2518
2574
|
),
|
|
2519
2575
|
get: (e) => window.localStorage.getItem(`toggle-${e.id}`) === "true"
|
|
2520
|
-
},
|
|
2521
|
-
if (
|
|
2576
|
+
}, st = (e, t, n, o = Hn) => {
|
|
2577
|
+
if ("isToggleable" in e.props && !e.props.isToggleable)
|
|
2522
2578
|
return {
|
|
2523
2579
|
dom: n
|
|
2524
2580
|
};
|
|
@@ -2553,8 +2609,8 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2553
2609
|
l.addEventListener("click", u), r.appendChild(s);
|
|
2554
2610
|
let p = e.children.length;
|
|
2555
2611
|
const f = t.onChange(() => {
|
|
2556
|
-
var
|
|
2557
|
-
const h = ((
|
|
2612
|
+
var k;
|
|
2613
|
+
const h = ((k = t.getBlock(e)) == null ? void 0 : k.children.length) ?? 0;
|
|
2558
2614
|
h > p ? (s.getAttribute("data-show-children") === "false" && (s.setAttribute("data-show-children", "true"), o.set(t.getBlock(e), !0)), r.contains(l) && r.removeChild(l)) : h === 0 && h < p && (s.getAttribute("data-show-children") === "true" && (s.setAttribute("data-show-children", "false"), o.set(t.getBlock(e), !1)), r.contains(l) && r.removeChild(l)), p = h;
|
|
2559
2615
|
});
|
|
2560
2616
|
return o.get(e) ? (s.setAttribute("data-show-children", "true"), e.children.length === 0 && r.appendChild(l)) : s.setAttribute("data-show-children", "false"), {
|
|
@@ -2574,20 +2630,20 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2574
2630
|
), f == null || f();
|
|
2575
2631
|
}
|
|
2576
2632
|
};
|
|
2577
|
-
},
|
|
2633
|
+
}, at = [1, 2, 3, 4, 5, 6], On = ({
|
|
2578
2634
|
defaultLevel: e = 1,
|
|
2579
|
-
levels: t =
|
|
2635
|
+
levels: t = at,
|
|
2580
2636
|
allowToggleHeadings: n = !0
|
|
2581
2637
|
} = {}) => ({
|
|
2582
2638
|
type: "heading",
|
|
2583
2639
|
propSchema: {
|
|
2584
|
-
...
|
|
2640
|
+
...C,
|
|
2585
2641
|
level: { default: e, values: t },
|
|
2586
2642
|
...n ? { isToggleable: { default: !1, optional: !0 } } : {}
|
|
2587
2643
|
},
|
|
2588
2644
|
content: "inline"
|
|
2589
|
-
}),
|
|
2590
|
-
|
|
2645
|
+
}), Dn = M(
|
|
2646
|
+
On,
|
|
2591
2647
|
({ allowToggleHeadings: e = !0 } = {}) => ({
|
|
2592
2648
|
meta: {
|
|
2593
2649
|
isolating: !1
|
|
@@ -2623,20 +2679,20 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2623
2679
|
},
|
|
2624
2680
|
render(t, n) {
|
|
2625
2681
|
const o = document.createElement(`h${t.props.level}`);
|
|
2626
|
-
return e ? { ...
|
|
2682
|
+
return e ? { ...st(t, n, o), contentDOM: o } : {
|
|
2627
2683
|
dom: o,
|
|
2628
2684
|
contentDOM: o
|
|
2629
2685
|
};
|
|
2630
2686
|
},
|
|
2631
2687
|
toExternalHTML(t) {
|
|
2632
2688
|
const n = document.createElement(`h${t.props.level}`);
|
|
2633
|
-
return
|
|
2689
|
+
return H(t.props, n), {
|
|
2634
2690
|
dom: n,
|
|
2635
2691
|
contentDOM: n
|
|
2636
2692
|
};
|
|
2637
2693
|
}
|
|
2638
2694
|
}),
|
|
2639
|
-
({ levels: e =
|
|
2695
|
+
({ levels: e = at } = {}) => [
|
|
2640
2696
|
L({
|
|
2641
2697
|
key: "heading-shortcuts",
|
|
2642
2698
|
keyboardShortcuts: Object.fromEntries(
|
|
@@ -2666,7 +2722,7 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2666
2722
|
}))
|
|
2667
2723
|
})
|
|
2668
2724
|
]
|
|
2669
|
-
),
|
|
2725
|
+
), it = (e, t, n, o, r) => {
|
|
2670
2726
|
const { dom: s, destroy: a } = we(
|
|
2671
2727
|
e,
|
|
2672
2728
|
t,
|
|
@@ -2687,10 +2743,10 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2687
2743
|
!t.isEditable && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l));
|
|
2688
2744
|
return;
|
|
2689
2745
|
}
|
|
2690
|
-
let
|
|
2746
|
+
let v;
|
|
2691
2747
|
const S = "touches" in g ? g.touches[0].clientX : g.clientX;
|
|
2692
|
-
e.props.textAlignment === "center" ? u.handleUsed === "left" ?
|
|
2693
|
-
Math.max(
|
|
2748
|
+
e.props.textAlignment === "center" ? u.handleUsed === "left" ? v = u.initialWidth + (u.initialClientX - S) * 2 : v = u.initialWidth + (S - u.initialClientX) * 2 : u.handleUsed === "left" ? v = u.initialWidth + u.initialClientX - S : v = u.initialWidth + S - u.initialClientX, p = Math.min(
|
|
2749
|
+
Math.max(v, 64),
|
|
2694
2750
|
((W = (V = t.domElement) == null ? void 0 : V.firstElementChild) == null ? void 0 : W.clientWidth) || Number.MAX_VALUE
|
|
2695
2751
|
), i.style.width = `${p}px`;
|
|
2696
2752
|
}, h = (g) => {
|
|
@@ -2699,28 +2755,28 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2699
2755
|
previewWidth: p
|
|
2700
2756
|
}
|
|
2701
2757
|
}));
|
|
2702
|
-
},
|
|
2758
|
+
}, k = () => {
|
|
2703
2759
|
t.isEditable && (o.appendChild(c), o.appendChild(l));
|
|
2704
2760
|
}, m = (g) => {
|
|
2705
2761
|
g.relatedTarget === c || g.relatedTarget === l || u || t.isEditable && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l));
|
|
2706
2762
|
}, b = (g) => {
|
|
2707
2763
|
g.preventDefault(), i.contains(d) || i.appendChild(d);
|
|
2708
|
-
const
|
|
2764
|
+
const v = "touches" in g ? g.touches[0].clientX : g.clientX;
|
|
2709
2765
|
u = {
|
|
2710
2766
|
handleUsed: "left",
|
|
2711
2767
|
initialWidth: i.clientWidth,
|
|
2712
|
-
initialClientX:
|
|
2768
|
+
initialClientX: v
|
|
2713
2769
|
};
|
|
2714
2770
|
}, y = (g) => {
|
|
2715
2771
|
g.preventDefault(), i.contains(d) || i.appendChild(d);
|
|
2716
|
-
const
|
|
2772
|
+
const v = "touches" in g ? g.touches[0].clientX : g.clientX;
|
|
2717
2773
|
u = {
|
|
2718
2774
|
handleUsed: "right",
|
|
2719
2775
|
initialWidth: i.clientWidth,
|
|
2720
|
-
initialClientX:
|
|
2776
|
+
initialClientX: v
|
|
2721
2777
|
};
|
|
2722
2778
|
};
|
|
2723
|
-
return window.addEventListener("mousemove", f), window.addEventListener("touchmove", f), window.addEventListener("mouseup", h), window.addEventListener("touchend", h), i.addEventListener("mouseenter",
|
|
2779
|
+
return window.addEventListener("mousemove", f), window.addEventListener("touchmove", f), window.addEventListener("mouseup", h), window.addEventListener("touchend", h), i.addEventListener("mouseenter", k), i.addEventListener("mouseleave", m), c.addEventListener(
|
|
2724
2780
|
"mousedown",
|
|
2725
2781
|
b
|
|
2726
2782
|
), c.addEventListener(
|
|
@@ -2735,7 +2791,7 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2735
2791
|
), {
|
|
2736
2792
|
dom: i,
|
|
2737
2793
|
destroy: () => {
|
|
2738
|
-
a == null || a(), window.removeEventListener("mousemove", f), window.removeEventListener("touchmove", f), window.removeEventListener("mouseup", h), window.removeEventListener("touchend", h), i.removeEventListener("mouseenter",
|
|
2794
|
+
a == null || a(), window.removeEventListener("mousemove", f), window.removeEventListener("touchmove", f), window.removeEventListener("mouseup", h), window.removeEventListener("touchend", h), i.removeEventListener("mouseenter", k), i.removeEventListener("mouseleave", m), c.removeEventListener(
|
|
2739
2795
|
"mousedown",
|
|
2740
2796
|
b
|
|
2741
2797
|
), c.removeEventListener(
|
|
@@ -2753,11 +2809,11 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2753
2809
|
}, _e = (e) => {
|
|
2754
2810
|
const t = e.src || void 0, n = e.width || void 0, o = e.alt || void 0;
|
|
2755
2811
|
return { url: t, previewWidth: n, name: o };
|
|
2756
|
-
},
|
|
2812
|
+
}, _n = '<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>', Rn = (e = {}) => ({
|
|
2757
2813
|
type: "image",
|
|
2758
2814
|
propSchema: {
|
|
2759
|
-
textAlignment:
|
|
2760
|
-
backgroundColor:
|
|
2815
|
+
textAlignment: C.textAlignment,
|
|
2816
|
+
backgroundColor: C.backgroundColor,
|
|
2761
2817
|
// File name.
|
|
2762
2818
|
name: {
|
|
2763
2819
|
default: ""
|
|
@@ -2780,7 +2836,7 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2780
2836
|
}
|
|
2781
2837
|
},
|
|
2782
2838
|
content: "none"
|
|
2783
|
-
}),
|
|
2839
|
+
}), Vn = (e = {}) => (t) => {
|
|
2784
2840
|
if (t.tagName === "IMG") {
|
|
2785
2841
|
if (t.closest("figure"))
|
|
2786
2842
|
return;
|
|
@@ -2801,22 +2857,22 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2801
2857
|
caption: r
|
|
2802
2858
|
};
|
|
2803
2859
|
}
|
|
2804
|
-
},
|
|
2860
|
+
}, Wn = (e = {}) => (t, n) => {
|
|
2805
2861
|
const o = document.createElement("div");
|
|
2806
|
-
o.innerHTML = e.icon ??
|
|
2862
|
+
o.innerHTML = e.icon ?? _n;
|
|
2807
2863
|
const r = document.createElement("div");
|
|
2808
2864
|
r.className = "bn-visual-media-wrapper";
|
|
2809
2865
|
const s = document.createElement("img");
|
|
2810
2866
|
return s.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((a) => {
|
|
2811
2867
|
s.src = a;
|
|
2812
|
-
}) : s.src = t.props.url, s.alt = t.props.name || t.props.caption || "BlockNote image", s.contentEditable = "false", s.draggable = !1, r.appendChild(s),
|
|
2868
|
+
}) : s.src = t.props.url, s.alt = t.props.name || t.props.caption || "BlockNote image", s.contentEditable = "false", s.draggable = !1, r.appendChild(s), it(
|
|
2813
2869
|
t,
|
|
2814
2870
|
n,
|
|
2815
2871
|
{ dom: r },
|
|
2816
2872
|
r,
|
|
2817
2873
|
o.firstElementChild
|
|
2818
2874
|
);
|
|
2819
|
-
},
|
|
2875
|
+
}, Fn = (e = {}) => (t, n) => {
|
|
2820
2876
|
if (!t.props.url) {
|
|
2821
2877
|
const r = document.createElement("p");
|
|
2822
2878
|
return r.textContent = "Add image", {
|
|
@@ -2827,21 +2883,21 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2827
2883
|
return t.props.showPreview ? (o = document.createElement("img"), o.src = t.props.url, o.alt = t.props.name || t.props.caption || "BlockNote image", t.props.previewWidth && (o.width = t.props.previewWidth)) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? ve(o, t.props.caption) : te(o, t.props.caption) : {
|
|
2828
2884
|
dom: o
|
|
2829
2885
|
};
|
|
2830
|
-
},
|
|
2831
|
-
|
|
2886
|
+
}, $n = M(
|
|
2887
|
+
Rn,
|
|
2832
2888
|
(e) => ({
|
|
2833
2889
|
meta: {
|
|
2834
2890
|
fileBlockAccept: ["image/*"]
|
|
2835
2891
|
},
|
|
2836
|
-
parse:
|
|
2837
|
-
render:
|
|
2838
|
-
toExternalHTML:
|
|
2892
|
+
parse: Vn(e),
|
|
2893
|
+
render: Wn(e),
|
|
2894
|
+
toExternalHTML: Fn(e),
|
|
2839
2895
|
runsBefore: ["file"]
|
|
2840
2896
|
})
|
|
2841
|
-
),
|
|
2897
|
+
), cr = (e, t, n) => ({
|
|
2842
2898
|
state: o,
|
|
2843
2899
|
dispatch: r
|
|
2844
|
-
}) => r ?
|
|
2900
|
+
}) => r ? ct(o.tr, e, t, n) : !0, ct = (e, t, n, o) => {
|
|
2845
2901
|
const r = fe(e.doc, t), s = z(r);
|
|
2846
2902
|
if (!s.isBlockContainer)
|
|
2847
2903
|
return !1;
|
|
@@ -2859,7 +2915,7 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2859
2915
|
return e.split(t, 2, i), !0;
|
|
2860
2916
|
}, ne = (e, t) => {
|
|
2861
2917
|
const { blockInfo: n, selectionEmpty: o } = e.transact((a) => ({
|
|
2862
|
-
blockInfo:
|
|
2918
|
+
blockInfo: Gt(a),
|
|
2863
2919
|
selectionEmpty: a.selection.anchor === a.selection.head
|
|
2864
2920
|
}));
|
|
2865
2921
|
if (!n.isBlockContainer)
|
|
@@ -2870,7 +2926,7 @@ const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
|
2870
2926
|
type: "paragraph",
|
|
2871
2927
|
props: {}
|
|
2872
2928
|
});
|
|
2873
|
-
}), !0) : s.node.childCount > 0 ? e.transact((a) => (a.deleteSelection(),
|
|
2929
|
+
}), !0) : s.node.childCount > 0 ? e.transact((a) => (a.deleteSelection(), ct(a, a.selection.from, !0))) : !1;
|
|
2874
2930
|
};
|
|
2875
2931
|
function Ee(e, t, n) {
|
|
2876
2932
|
var u, p, f;
|
|
@@ -2902,14 +2958,14 @@ function Ee(e, t, n) {
|
|
|
2902
2958
|
}
|
|
2903
2959
|
return c.content;
|
|
2904
2960
|
}
|
|
2905
|
-
const
|
|
2961
|
+
const jn = () => ({
|
|
2906
2962
|
type: "bulletListItem",
|
|
2907
2963
|
propSchema: {
|
|
2908
|
-
...
|
|
2964
|
+
...C
|
|
2909
2965
|
},
|
|
2910
2966
|
content: "inline"
|
|
2911
|
-
}),
|
|
2912
|
-
|
|
2967
|
+
}), Un = M(
|
|
2968
|
+
jn,
|
|
2913
2969
|
{
|
|
2914
2970
|
meta: {
|
|
2915
2971
|
isolating: !1
|
|
@@ -2934,7 +2990,7 @@ const Wn = () => ({
|
|
|
2934
2990
|
},
|
|
2935
2991
|
toExternalHTML(e) {
|
|
2936
2992
|
const t = document.createElement("li"), n = document.createElement("p");
|
|
2937
|
-
return
|
|
2993
|
+
return H(e.props, t), t.appendChild(n), {
|
|
2938
2994
|
dom: t,
|
|
2939
2995
|
contentDOM: n
|
|
2940
2996
|
};
|
|
@@ -2956,25 +3012,28 @@ const Wn = () => ({
|
|
|
2956
3012
|
inputRules: [
|
|
2957
3013
|
{
|
|
2958
3014
|
find: new RegExp("^[-+*]\\s$"),
|
|
2959
|
-
replace() {
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
3015
|
+
replace({ editor: e }) {
|
|
3016
|
+
if (Ge(
|
|
3017
|
+
e.prosemirrorState
|
|
3018
|
+
).blockNoteType !== "heading")
|
|
3019
|
+
return {
|
|
3020
|
+
type: "bulletListItem",
|
|
3021
|
+
props: {}
|
|
3022
|
+
};
|
|
2964
3023
|
}
|
|
2965
3024
|
}
|
|
2966
3025
|
]
|
|
2967
3026
|
})
|
|
2968
3027
|
]
|
|
2969
|
-
),
|
|
3028
|
+
), zn = () => ({
|
|
2970
3029
|
type: "checkListItem",
|
|
2971
3030
|
propSchema: {
|
|
2972
|
-
...
|
|
3031
|
+
...C,
|
|
2973
3032
|
checked: { default: !1, type: "boolean" }
|
|
2974
3033
|
},
|
|
2975
3034
|
content: "inline"
|
|
2976
|
-
}),
|
|
2977
|
-
|
|
3035
|
+
}), qn = M(
|
|
3036
|
+
zn,
|
|
2978
3037
|
{
|
|
2979
3038
|
meta: {
|
|
2980
3039
|
isolating: !1
|
|
@@ -3009,7 +3068,7 @@ const Wn = () => ({
|
|
|
3009
3068
|
const t = document.createElement("li"), n = document.createElement("input");
|
|
3010
3069
|
n.type = "checkbox", n.checked = e.props.checked, e.props.checked && n.setAttribute("checked", "");
|
|
3011
3070
|
const o = document.createElement("p");
|
|
3012
|
-
return
|
|
3071
|
+
return H(e.props, t), t.appendChild(n), t.appendChild(o), {
|
|
3013
3072
|
dom: t,
|
|
3014
3073
|
contentDOM: o
|
|
3015
3074
|
};
|
|
@@ -3057,7 +3116,7 @@ const Wn = () => ({
|
|
|
3057
3116
|
})
|
|
3058
3117
|
]
|
|
3059
3118
|
);
|
|
3060
|
-
function
|
|
3119
|
+
function lt(e, t, n, o) {
|
|
3061
3120
|
let r = e.firstChild.attrs.start || 1, s = !0;
|
|
3062
3121
|
const a = !!e.firstChild.attrs.start, i = z({
|
|
3063
3122
|
posBeforeNode: t,
|
|
@@ -3069,7 +3128,7 @@ function it(e, t, n, o) {
|
|
|
3069
3128
|
return l !== void 0 ? (r = l + 1, s = !1) : c && z({
|
|
3070
3129
|
posBeforeNode: i.bnBlock.beforePos - c.nodeSize,
|
|
3071
3130
|
node: c
|
|
3072
|
-
}).blockNoteType === "numberedListItem" && (r =
|
|
3131
|
+
}).blockNoteType === "numberedListItem" && (r = lt(
|
|
3073
3132
|
c,
|
|
3074
3133
|
i.bnBlock.beforePos - c.nodeSize,
|
|
3075
3134
|
n,
|
|
@@ -3083,7 +3142,7 @@ function Re(e, t) {
|
|
|
3083
3142
|
), r = [];
|
|
3084
3143
|
e.doc.nodesBetween(0, e.doc.nodeSize - 2, (a, i) => {
|
|
3085
3144
|
if (a.type.name === "blockContainer" && a.firstChild.type.name === "numberedListItem") {
|
|
3086
|
-
const { index: c, isFirst: l, hasStart: d } =
|
|
3145
|
+
const { index: c, isFirst: l, hasStart: d } = lt(
|
|
3087
3146
|
a,
|
|
3088
3147
|
i,
|
|
3089
3148
|
e,
|
|
@@ -3095,7 +3154,7 @@ function Re(e, t) {
|
|
|
3095
3154
|
(p) => p.index === c && p.isFirst === l && p.hasStart === d
|
|
3096
3155
|
).length === 0 && r.push(
|
|
3097
3156
|
// move in by 1 to account for the block container
|
|
3098
|
-
|
|
3157
|
+
Ot.node(i + 1, i + a.nodeSize - 1, {
|
|
3099
3158
|
"data-index": c.toString()
|
|
3100
3159
|
})
|
|
3101
3160
|
);
|
|
@@ -3108,8 +3167,8 @@ function Re(e, t) {
|
|
|
3108
3167
|
decorations: o.remove(s).add(e.doc, r)
|
|
3109
3168
|
};
|
|
3110
3169
|
}
|
|
3111
|
-
const
|
|
3112
|
-
key: new
|
|
3170
|
+
const Zn = () => new je({
|
|
3171
|
+
key: new Ue("numbered-list-indexing-decorations"),
|
|
3113
3172
|
state: {
|
|
3114
3173
|
init(e, t) {
|
|
3115
3174
|
return Re(t.tr, {
|
|
@@ -3126,15 +3185,15 @@ const Un = () => new je({
|
|
|
3126
3185
|
return ((t = this.getState(e)) == null ? void 0 : t.decorations) ?? Me.empty;
|
|
3127
3186
|
}
|
|
3128
3187
|
}
|
|
3129
|
-
}),
|
|
3188
|
+
}), Gn = () => ({
|
|
3130
3189
|
type: "numberedListItem",
|
|
3131
3190
|
propSchema: {
|
|
3132
|
-
...
|
|
3191
|
+
...C,
|
|
3133
3192
|
start: { default: void 0, type: "number" }
|
|
3134
3193
|
},
|
|
3135
3194
|
content: "inline"
|
|
3136
|
-
}),
|
|
3137
|
-
|
|
3195
|
+
}), Xn = M(
|
|
3196
|
+
Gn,
|
|
3138
3197
|
{
|
|
3139
3198
|
meta: {
|
|
3140
3199
|
isolating: !1
|
|
@@ -3164,7 +3223,7 @@ const Un = () => new je({
|
|
|
3164
3223
|
},
|
|
3165
3224
|
toExternalHTML(e) {
|
|
3166
3225
|
const t = document.createElement("li"), n = document.createElement("p");
|
|
3167
|
-
return
|
|
3226
|
+
return H(e.props, t), t.appendChild(n), {
|
|
3168
3227
|
dom: t,
|
|
3169
3228
|
contentDOM: n
|
|
3170
3229
|
};
|
|
@@ -3176,12 +3235,16 @@ const Un = () => new je({
|
|
|
3176
3235
|
inputRules: [
|
|
3177
3236
|
{
|
|
3178
3237
|
find: new RegExp("^(\\d+)\\.\\s$"),
|
|
3179
|
-
replace({ match: e }) {
|
|
3180
|
-
|
|
3238
|
+
replace({ match: e, editor: t }) {
|
|
3239
|
+
if (Ge(
|
|
3240
|
+
t.prosemirrorState
|
|
3241
|
+
).blockNoteType === "heading")
|
|
3242
|
+
return;
|
|
3243
|
+
const o = parseInt(e[1]);
|
|
3181
3244
|
return {
|
|
3182
3245
|
type: "numberedListItem",
|
|
3183
3246
|
props: {
|
|
3184
|
-
start:
|
|
3247
|
+
start: o !== 1 ? o : void 0
|
|
3185
3248
|
}
|
|
3186
3249
|
};
|
|
3187
3250
|
}
|
|
@@ -3197,24 +3260,24 @@ const Un = () => new je({
|
|
|
3197
3260
|
}), !0);
|
|
3198
3261
|
}
|
|
3199
3262
|
},
|
|
3200
|
-
plugins: [
|
|
3263
|
+
plugins: [Zn()]
|
|
3201
3264
|
})
|
|
3202
3265
|
]
|
|
3203
|
-
),
|
|
3266
|
+
), Jn = () => ({
|
|
3204
3267
|
type: "toggleListItem",
|
|
3205
3268
|
propSchema: {
|
|
3206
|
-
...
|
|
3269
|
+
...C
|
|
3207
3270
|
},
|
|
3208
3271
|
content: "inline"
|
|
3209
|
-
}),
|
|
3210
|
-
|
|
3272
|
+
}), Kn = M(
|
|
3273
|
+
Jn,
|
|
3211
3274
|
{
|
|
3212
3275
|
meta: {
|
|
3213
3276
|
isolating: !1
|
|
3214
3277
|
},
|
|
3215
3278
|
render(e, t) {
|
|
3216
3279
|
const n = document.createElement("p");
|
|
3217
|
-
return { ...
|
|
3280
|
+
return { ...st(
|
|
3218
3281
|
e,
|
|
3219
3282
|
t,
|
|
3220
3283
|
n
|
|
@@ -3222,7 +3285,7 @@ const Un = () => new je({
|
|
|
3222
3285
|
},
|
|
3223
3286
|
toExternalHTML(e) {
|
|
3224
3287
|
const t = document.createElement("li"), n = document.createElement("p");
|
|
3225
|
-
return
|
|
3288
|
+
return H(e.props, t), t.appendChild(n), {
|
|
3226
3289
|
dom: t,
|
|
3227
3290
|
contentDOM: n
|
|
3228
3291
|
};
|
|
@@ -3243,12 +3306,12 @@ const Un = () => new je({
|
|
|
3243
3306
|
}
|
|
3244
3307
|
})
|
|
3245
3308
|
]
|
|
3246
|
-
),
|
|
3309
|
+
), Qn = () => ({
|
|
3247
3310
|
type: "pageBreak",
|
|
3248
3311
|
propSchema: {},
|
|
3249
3312
|
content: "none"
|
|
3250
|
-
}),
|
|
3251
|
-
|
|
3313
|
+
}), Yn = M(
|
|
3314
|
+
Qn,
|
|
3252
3315
|
{
|
|
3253
3316
|
parse(e) {
|
|
3254
3317
|
if (e.tagName === "DIV" && e.hasAttribute("data-page-break"))
|
|
@@ -3267,16 +3330,16 @@ const Un = () => new je({
|
|
|
3267
3330
|
};
|
|
3268
3331
|
}
|
|
3269
3332
|
}
|
|
3270
|
-
),
|
|
3333
|
+
), lr = (e) => e.extend({
|
|
3271
3334
|
blockSpecs: {
|
|
3272
|
-
pageBreak:
|
|
3335
|
+
pageBreak: Yn()
|
|
3273
3336
|
}
|
|
3274
|
-
}),
|
|
3337
|
+
}), eo = () => ({
|
|
3275
3338
|
type: "paragraph",
|
|
3276
|
-
propSchema:
|
|
3339
|
+
propSchema: C,
|
|
3277
3340
|
content: "inline"
|
|
3278
|
-
}),
|
|
3279
|
-
|
|
3341
|
+
}), to = M(
|
|
3342
|
+
eo,
|
|
3280
3343
|
{
|
|
3281
3344
|
meta: {
|
|
3282
3345
|
isolating: !1
|
|
@@ -3295,7 +3358,7 @@ const Un = () => new je({
|
|
|
3295
3358
|
},
|
|
3296
3359
|
toExternalHTML: (e) => {
|
|
3297
3360
|
const t = document.createElement("p");
|
|
3298
|
-
return
|
|
3361
|
+
return H(e.props, t), {
|
|
3299
3362
|
dom: t,
|
|
3300
3363
|
contentDOM: t
|
|
3301
3364
|
};
|
|
@@ -3316,15 +3379,15 @@ const Un = () => new je({
|
|
|
3316
3379
|
}
|
|
3317
3380
|
})
|
|
3318
3381
|
]
|
|
3319
|
-
),
|
|
3382
|
+
), no = () => ({
|
|
3320
3383
|
type: "quote",
|
|
3321
3384
|
propSchema: {
|
|
3322
|
-
backgroundColor:
|
|
3323
|
-
textColor:
|
|
3385
|
+
backgroundColor: C.backgroundColor,
|
|
3386
|
+
textColor: C.textColor
|
|
3324
3387
|
},
|
|
3325
3388
|
content: "inline"
|
|
3326
|
-
}),
|
|
3327
|
-
|
|
3389
|
+
}), oo = M(
|
|
3390
|
+
no,
|
|
3328
3391
|
{
|
|
3329
3392
|
meta: {
|
|
3330
3393
|
isolating: !1
|
|
@@ -3344,7 +3407,7 @@ const Un = () => new je({
|
|
|
3344
3407
|
},
|
|
3345
3408
|
toExternalHTML(e) {
|
|
3346
3409
|
const t = document.createElement("blockquote");
|
|
3347
|
-
return
|
|
3410
|
+
return H(e.props, t), {
|
|
3348
3411
|
dom: t,
|
|
3349
3412
|
contentDOM: t
|
|
3350
3413
|
};
|
|
@@ -3375,18 +3438,18 @@ const Un = () => new je({
|
|
|
3375
3438
|
]
|
|
3376
3439
|
})
|
|
3377
3440
|
]
|
|
3378
|
-
),
|
|
3441
|
+
), ro = 35, ut = 120, ur = 31, so = $e.create({
|
|
3379
3442
|
name: "BlockNoteTableExtension",
|
|
3380
3443
|
addProseMirrorPlugins: () => [
|
|
3381
|
-
|
|
3382
|
-
cellMinWidth:
|
|
3383
|
-
defaultCellMinWidth:
|
|
3444
|
+
bt({
|
|
3445
|
+
cellMinWidth: ro,
|
|
3446
|
+
defaultCellMinWidth: ut,
|
|
3384
3447
|
// We set this to null as we implement our own node view in the table
|
|
3385
3448
|
// block content. This node view is the same as what's used by default,
|
|
3386
3449
|
// but is wrapped in a `blockContent` HTML element.
|
|
3387
3450
|
View: null
|
|
3388
3451
|
}),
|
|
3389
|
-
|
|
3452
|
+
kt()
|
|
3390
3453
|
],
|
|
3391
3454
|
addKeyboardShortcuts() {
|
|
3392
3455
|
return {
|
|
@@ -3414,14 +3477,14 @@ const Un = () => new je({
|
|
|
3414
3477
|
storage: e.storage
|
|
3415
3478
|
};
|
|
3416
3479
|
return {
|
|
3417
|
-
tableRole:
|
|
3418
|
-
|
|
3480
|
+
tableRole: Tt(
|
|
3481
|
+
At(e, "tableRole", t)
|
|
3419
3482
|
)
|
|
3420
3483
|
};
|
|
3421
3484
|
}
|
|
3422
|
-
}),
|
|
3423
|
-
textColor:
|
|
3424
|
-
},
|
|
3485
|
+
}), ao = {
|
|
3486
|
+
textColor: C.textColor
|
|
3487
|
+
}, io = D.create({
|
|
3425
3488
|
name: "tableHeader",
|
|
3426
3489
|
addOptions() {
|
|
3427
3490
|
return {
|
|
@@ -3461,7 +3524,7 @@ const Un = () => new je({
|
|
|
3461
3524
|
tag: "th",
|
|
3462
3525
|
// As `th` elements can contain multiple paragraphs, we need to merge their contents
|
|
3463
3526
|
// into a single one so that ProseMirror can parse everything correctly.
|
|
3464
|
-
getContent: (e, t) =>
|
|
3527
|
+
getContent: (e, t) => dt(e, t)
|
|
3465
3528
|
}
|
|
3466
3529
|
];
|
|
3467
3530
|
},
|
|
@@ -3472,7 +3535,7 @@ const Un = () => new je({
|
|
|
3472
3535
|
0
|
|
3473
3536
|
];
|
|
3474
3537
|
}
|
|
3475
|
-
}),
|
|
3538
|
+
}), co = D.create({
|
|
3476
3539
|
name: "tableCell",
|
|
3477
3540
|
addOptions() {
|
|
3478
3541
|
return {
|
|
@@ -3505,7 +3568,7 @@ const Un = () => new je({
|
|
|
3505
3568
|
tag: "td",
|
|
3506
3569
|
// As `td` elements can contain multiple paragraphs, we need to merge their contents
|
|
3507
3570
|
// into a single one so that ProseMirror can parse everything correctly.
|
|
3508
|
-
getContent: (e, t) =>
|
|
3571
|
+
getContent: (e, t) => dt(e, t)
|
|
3509
3572
|
}
|
|
3510
3573
|
];
|
|
3511
3574
|
},
|
|
@@ -3516,7 +3579,7 @@ const Un = () => new je({
|
|
|
3516
3579
|
0
|
|
3517
3580
|
];
|
|
3518
3581
|
}
|
|
3519
|
-
}),
|
|
3582
|
+
}), lo = D.create({
|
|
3520
3583
|
name: "table",
|
|
3521
3584
|
content: "tableRow+",
|
|
3522
3585
|
group: "blockContent",
|
|
@@ -3532,7 +3595,7 @@ const Un = () => new je({
|
|
|
3532
3595
|
},
|
|
3533
3596
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
3534
3597
|
var r, s, a;
|
|
3535
|
-
const n =
|
|
3598
|
+
const n = Vt(
|
|
3536
3599
|
this.name,
|
|
3537
3600
|
"table",
|
|
3538
3601
|
{
|
|
@@ -3561,7 +3624,7 @@ const Un = () => new je({
|
|
|
3561
3624
|
addNodeView() {
|
|
3562
3625
|
return ({ node: e, HTMLAttributes: t }) => {
|
|
3563
3626
|
var o;
|
|
3564
|
-
class n extends
|
|
3627
|
+
class n extends Ct {
|
|
3565
3628
|
constructor(s, a, i) {
|
|
3566
3629
|
super(s, a), this.node = s, this.cellMinWidth = a, this.blockContentHTMLAttributes = i;
|
|
3567
3630
|
const c = document.createElement("div");
|
|
@@ -3582,13 +3645,13 @@ const Un = () => new je({
|
|
|
3582
3645
|
return !s.target.closest(".tableWrapper-inner") || super.ignoreMutation(s);
|
|
3583
3646
|
}
|
|
3584
3647
|
}
|
|
3585
|
-
return new n(e,
|
|
3648
|
+
return new n(e, ut, {
|
|
3586
3649
|
...((o = this.options.domAttributes) == null ? void 0 : o.blockContent) || {},
|
|
3587
3650
|
...t
|
|
3588
3651
|
});
|
|
3589
3652
|
};
|
|
3590
3653
|
}
|
|
3591
|
-
}),
|
|
3654
|
+
}), uo = D.create({
|
|
3592
3655
|
name: "tableParagraph",
|
|
3593
3656
|
group: "tableContent",
|
|
3594
3657
|
content: "inline*",
|
|
@@ -3609,7 +3672,7 @@ const Un = () => new je({
|
|
|
3609
3672
|
renderHTML({ HTMLAttributes: e }) {
|
|
3610
3673
|
return ["p", e, 0];
|
|
3611
3674
|
}
|
|
3612
|
-
}),
|
|
3675
|
+
}), po = D.create({
|
|
3613
3676
|
name: "tableRow",
|
|
3614
3677
|
addOptions() {
|
|
3615
3678
|
return {
|
|
@@ -3630,7 +3693,7 @@ const Un = () => new je({
|
|
|
3630
3693
|
];
|
|
3631
3694
|
}
|
|
3632
3695
|
});
|
|
3633
|
-
function
|
|
3696
|
+
function dt(e, t) {
|
|
3634
3697
|
const o = Q.fromSchema(t).parse(e, {
|
|
3635
3698
|
topNode: t.nodes.blockGroup.create()
|
|
3636
3699
|
}), r = [];
|
|
@@ -3639,29 +3702,56 @@ function lt(e, t) {
|
|
|
3639
3702
|
return r.push(s), !1;
|
|
3640
3703
|
}), _.fromArray(r);
|
|
3641
3704
|
}
|
|
3642
|
-
const
|
|
3643
|
-
{ node:
|
|
3644
|
-
|
|
3705
|
+
const fo = () => jt(
|
|
3706
|
+
{ node: lo, type: "table", content: "table" },
|
|
3707
|
+
ao,
|
|
3645
3708
|
[
|
|
3646
3709
|
L({
|
|
3647
3710
|
key: "table-extensions",
|
|
3648
3711
|
tiptapExtensions: [
|
|
3649
|
-
no,
|
|
3650
|
-
io,
|
|
3651
|
-
ro,
|
|
3652
3712
|
so,
|
|
3653
|
-
|
|
3713
|
+
uo,
|
|
3714
|
+
io,
|
|
3715
|
+
co,
|
|
3716
|
+
po
|
|
3654
3717
|
]
|
|
3718
|
+
}),
|
|
3719
|
+
// Extension for keyboard shortcut which deletes the table if it's empty
|
|
3720
|
+
// and all cells are selected. Uses a separate extension as it needs
|
|
3721
|
+
// priority over keyboard handlers in the `TableExtension`'s
|
|
3722
|
+
// `tableEditing` plugin.
|
|
3723
|
+
L({
|
|
3724
|
+
key: "table-keyboard-delete",
|
|
3725
|
+
keyboardShortcuts: {
|
|
3726
|
+
Backspace: ({ editor: e }) => {
|
|
3727
|
+
if (!(e.prosemirrorState.selection instanceof Fe))
|
|
3728
|
+
return !1;
|
|
3729
|
+
const t = e.getTextCursorPosition().block, n = t.content;
|
|
3730
|
+
let o = 0;
|
|
3731
|
+
for (const s of n.rows)
|
|
3732
|
+
for (const a of s.cells) {
|
|
3733
|
+
if ("type" in a && a.content.length > 0 || !("type" in a) && a.length > 0)
|
|
3734
|
+
return !1;
|
|
3735
|
+
o++;
|
|
3736
|
+
}
|
|
3737
|
+
let r = 0;
|
|
3738
|
+
return e.prosemirrorState.selection.forEachCell(() => {
|
|
3739
|
+
r++;
|
|
3740
|
+
}), r < o ? !1 : (e.transact(() => {
|
|
3741
|
+
(e.getPrevBlock(t) || e.getNextBlock(t)) && e.setTextCursorPosition(t), e.removeBlocks([t]);
|
|
3742
|
+
}), !0);
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3655
3745
|
})
|
|
3656
3746
|
]
|
|
3657
3747
|
), Ve = (e) => {
|
|
3658
3748
|
const t = e.src || void 0, n = e.width || void 0;
|
|
3659
3749
|
return { url: t, previewWidth: n };
|
|
3660
|
-
},
|
|
3750
|
+
}, ho = '<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>', mo = (e) => ({
|
|
3661
3751
|
type: "video",
|
|
3662
3752
|
propSchema: {
|
|
3663
|
-
textAlignment:
|
|
3664
|
-
backgroundColor:
|
|
3753
|
+
textAlignment: C.textAlignment,
|
|
3754
|
+
backgroundColor: C.backgroundColor,
|
|
3665
3755
|
name: { default: "" },
|
|
3666
3756
|
url: { default: "" },
|
|
3667
3757
|
caption: { default: "" },
|
|
@@ -3669,7 +3759,7 @@ const lo = () => jt(
|
|
|
3669
3759
|
previewWidth: { default: void 0, type: "number" }
|
|
3670
3760
|
},
|
|
3671
3761
|
content: "none"
|
|
3672
|
-
}),
|
|
3762
|
+
}), go = (e) => (t) => {
|
|
3673
3763
|
if (t.tagName === "VIDEO") {
|
|
3674
3764
|
if (t.closest("figure"))
|
|
3675
3765
|
return;
|
|
@@ -3690,22 +3780,22 @@ const lo = () => jt(
|
|
|
3690
3780
|
caption: r
|
|
3691
3781
|
};
|
|
3692
3782
|
}
|
|
3693
|
-
},
|
|
3694
|
-
|
|
3783
|
+
}, bo = M(
|
|
3784
|
+
mo,
|
|
3695
3785
|
(e) => ({
|
|
3696
3786
|
meta: {
|
|
3697
3787
|
fileBlockAccept: ["video/*"]
|
|
3698
3788
|
},
|
|
3699
|
-
parse:
|
|
3789
|
+
parse: go(),
|
|
3700
3790
|
render(t, n) {
|
|
3701
3791
|
const o = document.createElement("div");
|
|
3702
|
-
o.innerHTML = e.icon ??
|
|
3792
|
+
o.innerHTML = e.icon ?? ho;
|
|
3703
3793
|
const r = document.createElement("div");
|
|
3704
3794
|
r.className = "bn-visual-media-wrapper";
|
|
3705
3795
|
const s = document.createElement("video");
|
|
3706
3796
|
return s.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((a) => {
|
|
3707
3797
|
s.src = a;
|
|
3708
|
-
}) : s.src = t.props.url, s.controls = !0, s.contentEditable = "false", s.draggable = !1, s.width = t.props.previewWidth, r.appendChild(s),
|
|
3798
|
+
}) : s.src = t.props.url, s.controls = !0, s.contentEditable = "false", s.draggable = !1, s.width = t.props.previewWidth, r.appendChild(s), it(
|
|
3709
3799
|
t,
|
|
3710
3800
|
n,
|
|
3711
3801
|
{ dom: r },
|
|
@@ -3727,7 +3817,7 @@ const lo = () => jt(
|
|
|
3727
3817
|
},
|
|
3728
3818
|
runsBefore: ["file"]
|
|
3729
3819
|
})
|
|
3730
|
-
),
|
|
3820
|
+
), dr = async (e) => {
|
|
3731
3821
|
const t = new FormData();
|
|
3732
3822
|
return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
3733
3823
|
method: "POST",
|
|
@@ -3762,13 +3852,13 @@ function E(e, t, n) {
|
|
|
3762
3852
|
}
|
|
3763
3853
|
return !0;
|
|
3764
3854
|
}
|
|
3765
|
-
function
|
|
3855
|
+
function pr(e, t, n, o) {
|
|
3766
3856
|
return E(t, n, o) && e.type === n;
|
|
3767
3857
|
}
|
|
3768
|
-
function
|
|
3769
|
-
return e instanceof
|
|
3858
|
+
function fr(e) {
|
|
3859
|
+
return e instanceof Fe;
|
|
3770
3860
|
}
|
|
3771
|
-
function
|
|
3861
|
+
function ko(e) {
|
|
3772
3862
|
let t = e.getTextCursorPosition().block, n = e.schema.blockSchema[t.type].content;
|
|
3773
3863
|
for (; n === "none"; ) {
|
|
3774
3864
|
if (t = e.getTextCursorPosition().nextBlock, t === void 0)
|
|
@@ -3776,19 +3866,19 @@ function mo(e) {
|
|
|
3776
3866
|
n = e.schema.blockSchema[t.type].content, e.setTextCursorPosition(t, "end");
|
|
3777
3867
|
}
|
|
3778
3868
|
}
|
|
3779
|
-
function
|
|
3869
|
+
function w(e, t) {
|
|
3780
3870
|
const n = e.getTextCursorPosition().block;
|
|
3781
3871
|
if (n.content === void 0)
|
|
3782
3872
|
throw new Error("Slash Menu open in a block that doesn't contain content.");
|
|
3783
3873
|
let o;
|
|
3784
|
-
return Array.isArray(n.content) && (n.content.length === 1 && I(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (o = e.updateBlock(n, t), e.setTextCursorPosition(o)) : (o = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)),
|
|
3874
|
+
return Array.isArray(n.content) && (n.content.length === 1 && I(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (o = e.updateBlock(n, t), e.setTextCursorPosition(o)) : (o = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)), ko(e), o;
|
|
3785
3875
|
}
|
|
3786
|
-
function
|
|
3876
|
+
function hr(e) {
|
|
3787
3877
|
const t = [];
|
|
3788
3878
|
return E(e, "heading", { level: "number" }) && t.push(
|
|
3789
3879
|
{
|
|
3790
3880
|
onItemClick: () => {
|
|
3791
|
-
|
|
3881
|
+
w(e, {
|
|
3792
3882
|
type: "heading",
|
|
3793
3883
|
props: { level: 1 }
|
|
3794
3884
|
});
|
|
@@ -3799,7 +3889,7 @@ function dr(e) {
|
|
|
3799
3889
|
},
|
|
3800
3890
|
{
|
|
3801
3891
|
onItemClick: () => {
|
|
3802
|
-
|
|
3892
|
+
w(e, {
|
|
3803
3893
|
type: "heading",
|
|
3804
3894
|
props: { level: 2 }
|
|
3805
3895
|
});
|
|
@@ -3810,7 +3900,7 @@ function dr(e) {
|
|
|
3810
3900
|
},
|
|
3811
3901
|
{
|
|
3812
3902
|
onItemClick: () => {
|
|
3813
|
-
|
|
3903
|
+
w(e, {
|
|
3814
3904
|
type: "heading",
|
|
3815
3905
|
props: { level: 3 }
|
|
3816
3906
|
});
|
|
@@ -3821,7 +3911,7 @@ function dr(e) {
|
|
|
3821
3911
|
}
|
|
3822
3912
|
), E(e, "quote") && t.push({
|
|
3823
3913
|
onItemClick: () => {
|
|
3824
|
-
|
|
3914
|
+
w(e, {
|
|
3825
3915
|
type: "quote"
|
|
3826
3916
|
});
|
|
3827
3917
|
},
|
|
@@ -3829,7 +3919,7 @@ function dr(e) {
|
|
|
3829
3919
|
...e.dictionary.slash_menu.quote
|
|
3830
3920
|
}), E(e, "toggleListItem") && t.push({
|
|
3831
3921
|
onItemClick: () => {
|
|
3832
|
-
|
|
3922
|
+
w(e, {
|
|
3833
3923
|
type: "toggleListItem"
|
|
3834
3924
|
});
|
|
3835
3925
|
},
|
|
@@ -3838,7 +3928,7 @@ function dr(e) {
|
|
|
3838
3928
|
...e.dictionary.slash_menu.toggle_list
|
|
3839
3929
|
}), E(e, "numberedListItem") && t.push({
|
|
3840
3930
|
onItemClick: () => {
|
|
3841
|
-
|
|
3931
|
+
w(e, {
|
|
3842
3932
|
type: "numberedListItem"
|
|
3843
3933
|
});
|
|
3844
3934
|
},
|
|
@@ -3847,7 +3937,7 @@ function dr(e) {
|
|
|
3847
3937
|
...e.dictionary.slash_menu.numbered_list
|
|
3848
3938
|
}), E(e, "bulletListItem") && t.push({
|
|
3849
3939
|
onItemClick: () => {
|
|
3850
|
-
|
|
3940
|
+
w(e, {
|
|
3851
3941
|
type: "bulletListItem"
|
|
3852
3942
|
});
|
|
3853
3943
|
},
|
|
@@ -3856,7 +3946,7 @@ function dr(e) {
|
|
|
3856
3946
|
...e.dictionary.slash_menu.bullet_list
|
|
3857
3947
|
}), E(e, "checkListItem") && t.push({
|
|
3858
3948
|
onItemClick: () => {
|
|
3859
|
-
|
|
3949
|
+
w(e, {
|
|
3860
3950
|
type: "checkListItem"
|
|
3861
3951
|
});
|
|
3862
3952
|
},
|
|
@@ -3865,7 +3955,7 @@ function dr(e) {
|
|
|
3865
3955
|
...e.dictionary.slash_menu.check_list
|
|
3866
3956
|
}), E(e, "paragraph") && t.push({
|
|
3867
3957
|
onItemClick: () => {
|
|
3868
|
-
|
|
3958
|
+
w(e, {
|
|
3869
3959
|
type: "paragraph"
|
|
3870
3960
|
});
|
|
3871
3961
|
},
|
|
@@ -3874,16 +3964,22 @@ function dr(e) {
|
|
|
3874
3964
|
...e.dictionary.slash_menu.paragraph
|
|
3875
3965
|
}), E(e, "codeBlock") && t.push({
|
|
3876
3966
|
onItemClick: () => {
|
|
3877
|
-
|
|
3967
|
+
w(e, {
|
|
3878
3968
|
type: "codeBlock"
|
|
3879
3969
|
});
|
|
3880
3970
|
},
|
|
3881
3971
|
badge: T("Mod-Alt-c"),
|
|
3882
3972
|
key: "code_block",
|
|
3883
3973
|
...e.dictionary.slash_menu.code_block
|
|
3974
|
+
}), E(e, "divider") && t.push({
|
|
3975
|
+
onItemClick: () => {
|
|
3976
|
+
w(e, { type: "divider" });
|
|
3977
|
+
},
|
|
3978
|
+
key: "divider",
|
|
3979
|
+
...e.dictionary.slash_menu.divider
|
|
3884
3980
|
}), E(e, "table") && t.push({
|
|
3885
3981
|
onItemClick: () => {
|
|
3886
|
-
|
|
3982
|
+
w(e, {
|
|
3887
3983
|
type: "table",
|
|
3888
3984
|
content: {
|
|
3889
3985
|
type: "tableContent",
|
|
@@ -3903,7 +3999,7 @@ function dr(e) {
|
|
|
3903
3999
|
...e.dictionary.slash_menu.table
|
|
3904
4000
|
}), E(e, "image", { url: "string" }) && t.push({
|
|
3905
4001
|
onItemClick: () => {
|
|
3906
|
-
const n =
|
|
4002
|
+
const n = w(e, {
|
|
3907
4003
|
type: "image"
|
|
3908
4004
|
});
|
|
3909
4005
|
e.transact(
|
|
@@ -3916,7 +4012,7 @@ function dr(e) {
|
|
|
3916
4012
|
...e.dictionary.slash_menu.image
|
|
3917
4013
|
}), E(e, "video", { url: "string" }) && t.push({
|
|
3918
4014
|
onItemClick: () => {
|
|
3919
|
-
const n =
|
|
4015
|
+
const n = w(e, {
|
|
3920
4016
|
type: "video"
|
|
3921
4017
|
});
|
|
3922
4018
|
e.transact(
|
|
@@ -3929,7 +4025,7 @@ function dr(e) {
|
|
|
3929
4025
|
...e.dictionary.slash_menu.video
|
|
3930
4026
|
}), E(e, "audio", { url: "string" }) && t.push({
|
|
3931
4027
|
onItemClick: () => {
|
|
3932
|
-
const n =
|
|
4028
|
+
const n = w(e, {
|
|
3933
4029
|
type: "audio"
|
|
3934
4030
|
});
|
|
3935
4031
|
e.transact(
|
|
@@ -3942,7 +4038,7 @@ function dr(e) {
|
|
|
3942
4038
|
...e.dictionary.slash_menu.audio
|
|
3943
4039
|
}), E(e, "file", { url: "string" }) && t.push({
|
|
3944
4040
|
onItemClick: () => {
|
|
3945
|
-
const n =
|
|
4041
|
+
const n = w(e, {
|
|
3946
4042
|
type: "file"
|
|
3947
4043
|
});
|
|
3948
4044
|
e.transact(
|
|
@@ -3959,7 +4055,7 @@ function dr(e) {
|
|
|
3959
4055
|
}) && t.push(
|
|
3960
4056
|
{
|
|
3961
4057
|
onItemClick: () => {
|
|
3962
|
-
|
|
4058
|
+
w(e, {
|
|
3963
4059
|
type: "heading",
|
|
3964
4060
|
props: { level: 1, isToggleable: !0 }
|
|
3965
4061
|
});
|
|
@@ -3969,7 +4065,7 @@ function dr(e) {
|
|
|
3969
4065
|
},
|
|
3970
4066
|
{
|
|
3971
4067
|
onItemClick: () => {
|
|
3972
|
-
|
|
4068
|
+
w(e, {
|
|
3973
4069
|
type: "heading",
|
|
3974
4070
|
props: { level: 2, isToggleable: !0 }
|
|
3975
4071
|
});
|
|
@@ -3979,7 +4075,7 @@ function dr(e) {
|
|
|
3979
4075
|
},
|
|
3980
4076
|
{
|
|
3981
4077
|
onItemClick: () => {
|
|
3982
|
-
|
|
4078
|
+
w(e, {
|
|
3983
4079
|
type: "heading",
|
|
3984
4080
|
props: { level: 3, isToggleable: !0 }
|
|
3985
4081
|
});
|
|
@@ -3990,7 +4086,7 @@ function dr(e) {
|
|
|
3990
4086
|
), E(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((n) => n > 3).forEach((n) => {
|
|
3991
4087
|
t.push({
|
|
3992
4088
|
onItemClick: () => {
|
|
3993
|
-
|
|
4089
|
+
w(e, {
|
|
3994
4090
|
type: "heading",
|
|
3995
4091
|
props: { level: n }
|
|
3996
4092
|
});
|
|
@@ -4009,43 +4105,44 @@ function dr(e) {
|
|
|
4009
4105
|
...e.dictionary.slash_menu.emoji
|
|
4010
4106
|
}), t;
|
|
4011
4107
|
}
|
|
4012
|
-
function
|
|
4108
|
+
function mr(e, t) {
|
|
4013
4109
|
return e.filter(
|
|
4014
4110
|
({ title: n, aliases: o }) => n.toLowerCase().includes(t.toLowerCase()) || o && o.filter(
|
|
4015
4111
|
(r) => r.toLowerCase().includes(t.toLowerCase())
|
|
4016
4112
|
).length !== 0
|
|
4017
4113
|
);
|
|
4018
4114
|
}
|
|
4019
|
-
function
|
|
4115
|
+
function Co(e) {
|
|
4020
4116
|
return "pageBreak" in e.schema.blockSchema;
|
|
4021
4117
|
}
|
|
4022
|
-
function
|
|
4118
|
+
function gr(e) {
|
|
4023
4119
|
const t = [];
|
|
4024
|
-
return
|
|
4120
|
+
return Co(e) && t.push({
|
|
4025
4121
|
...e.dictionary.slash_menu.page_break,
|
|
4026
4122
|
onItemClick: () => {
|
|
4027
|
-
|
|
4123
|
+
w(e, {
|
|
4028
4124
|
type: "pageBreak"
|
|
4029
4125
|
});
|
|
4030
4126
|
},
|
|
4031
4127
|
key: "page_break"
|
|
4032
4128
|
}), t;
|
|
4033
4129
|
}
|
|
4034
|
-
const
|
|
4035
|
-
audio:
|
|
4036
|
-
bulletListItem:
|
|
4037
|
-
checkListItem:
|
|
4038
|
-
codeBlock:
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4130
|
+
const yo = {
|
|
4131
|
+
audio: En(),
|
|
4132
|
+
bulletListItem: Un(),
|
|
4133
|
+
checkListItem: qn(),
|
|
4134
|
+
codeBlock: Ln(),
|
|
4135
|
+
divider: An(),
|
|
4136
|
+
file: Pn(),
|
|
4137
|
+
heading: Dn(),
|
|
4138
|
+
image: $n(),
|
|
4139
|
+
numberedListItem: Xn(),
|
|
4140
|
+
paragraph: to(),
|
|
4141
|
+
quote: oo(),
|
|
4142
|
+
table: fo(),
|
|
4143
|
+
toggleListItem: Kn(),
|
|
4144
|
+
video: bo()
|
|
4145
|
+
}, wo = Ye(
|
|
4049
4146
|
{
|
|
4050
4147
|
type: "textColor",
|
|
4051
4148
|
propSchema: "string"
|
|
@@ -4060,7 +4157,7 @@ const bo = {
|
|
|
4060
4157
|
},
|
|
4061
4158
|
toExternalHTML: (e) => {
|
|
4062
4159
|
const t = document.createElement("span");
|
|
4063
|
-
return e !==
|
|
4160
|
+
return e !== C.textColor.default && (t.style.color = e in A ? A[e].text : e), {
|
|
4064
4161
|
dom: t,
|
|
4065
4162
|
contentDOM: t
|
|
4066
4163
|
};
|
|
@@ -4070,7 +4167,7 @@ const bo = {
|
|
|
4070
4167
|
return e.style.color;
|
|
4071
4168
|
}
|
|
4072
4169
|
}
|
|
4073
|
-
),
|
|
4170
|
+
), vo = Ye(
|
|
4074
4171
|
{
|
|
4075
4172
|
type: "backgroundColor",
|
|
4076
4173
|
propSchema: "string"
|
|
@@ -4085,7 +4182,7 @@ const bo = {
|
|
|
4085
4182
|
},
|
|
4086
4183
|
toExternalHTML: (e) => {
|
|
4087
4184
|
const t = document.createElement("span");
|
|
4088
|
-
return e !==
|
|
4185
|
+
return e !== C.backgroundColor.default && (t.style.backgroundColor = e in A ? A[e].background : e), {
|
|
4089
4186
|
dom: t,
|
|
4090
4187
|
contentDOM: t
|
|
4091
4188
|
};
|
|
@@ -4095,181 +4192,184 @@ const bo = {
|
|
|
4095
4192
|
return e.style.backgroundColor;
|
|
4096
4193
|
}
|
|
4097
4194
|
}
|
|
4098
|
-
),
|
|
4099
|
-
bold: F(
|
|
4100
|
-
italic: F(
|
|
4101
|
-
underline: F(
|
|
4102
|
-
strike: F(
|
|
4103
|
-
code: F(
|
|
4104
|
-
textColor:
|
|
4105
|
-
backgroundColor:
|
|
4106
|
-
},
|
|
4195
|
+
), pt = {
|
|
4196
|
+
bold: F(yt, "boolean"),
|
|
4197
|
+
italic: F(vt, "boolean"),
|
|
4198
|
+
underline: F(xt, "boolean"),
|
|
4199
|
+
strike: F(Et, "boolean"),
|
|
4200
|
+
code: F(wt, "boolean"),
|
|
4201
|
+
textColor: wo,
|
|
4202
|
+
backgroundColor: vo
|
|
4203
|
+
}, br = Qe(pt), ft = {
|
|
4107
4204
|
text: { config: "text", implementation: {} },
|
|
4108
4205
|
link: { config: "link", implementation: {} }
|
|
4109
|
-
},
|
|
4110
|
-
|
|
4206
|
+
}, kr = Je(
|
|
4207
|
+
ft
|
|
4111
4208
|
);
|
|
4112
|
-
class
|
|
4209
|
+
class ht extends sn {
|
|
4113
4210
|
static create(t) {
|
|
4114
|
-
return new
|
|
4115
|
-
blockSpecs: (t == null ? void 0 : t.blockSpecs) ??
|
|
4116
|
-
inlineContentSpecs: (t == null ? void 0 : t.inlineContentSpecs) ??
|
|
4117
|
-
styleSpecs: (t == null ? void 0 : t.styleSpecs) ??
|
|
4211
|
+
return new ht({
|
|
4212
|
+
blockSpecs: (t == null ? void 0 : t.blockSpecs) ?? yo,
|
|
4213
|
+
inlineContentSpecs: (t == null ? void 0 : t.inlineContentSpecs) ?? ft,
|
|
4214
|
+
styleSpecs: (t == null ? void 0 : t.styleSpecs) ?? pt
|
|
4118
4215
|
});
|
|
4119
4216
|
}
|
|
4120
4217
|
}
|
|
4121
4218
|
export {
|
|
4122
|
-
|
|
4219
|
+
Te as $,
|
|
4123
4220
|
qn as A,
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4221
|
+
Gn as B,
|
|
4222
|
+
Xn as C,
|
|
4223
|
+
Jn as D,
|
|
4224
|
+
ur as E,
|
|
4225
|
+
kn as F,
|
|
4226
|
+
Kn as G,
|
|
4227
|
+
Qn as H,
|
|
4228
|
+
Yn as I,
|
|
4229
|
+
lr as J,
|
|
4230
|
+
eo as K,
|
|
4231
|
+
to as L,
|
|
4232
|
+
no as M,
|
|
4233
|
+
oo as N,
|
|
4234
|
+
ao as O,
|
|
4235
|
+
fo as P,
|
|
4236
|
+
ho as Q,
|
|
4237
|
+
mo as R,
|
|
4238
|
+
go as S,
|
|
4239
|
+
bo as T,
|
|
4240
|
+
Hn as U,
|
|
4241
|
+
st as V,
|
|
4242
|
+
dr as W,
|
|
4243
|
+
Co as X,
|
|
4244
|
+
gr as Y,
|
|
4245
|
+
ht as Z,
|
|
4149
4246
|
Vt as _,
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4247
|
+
ut as a,
|
|
4248
|
+
ke as a$,
|
|
4249
|
+
Wt as a0,
|
|
4250
|
+
yo as a1,
|
|
4251
|
+
pt as a2,
|
|
4252
|
+
br as a3,
|
|
4253
|
+
ft as a4,
|
|
4254
|
+
kr as a5,
|
|
4255
|
+
E as a6,
|
|
4256
|
+
pr as a7,
|
|
4257
|
+
fr as a8,
|
|
4258
|
+
C as a9,
|
|
4259
|
+
cr as aA,
|
|
4260
|
+
nr as aB,
|
|
4164
4261
|
Yo as aC,
|
|
4165
4262
|
Jo as aD,
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4263
|
+
er as aE,
|
|
4264
|
+
Xo as aF,
|
|
4265
|
+
et as aG,
|
|
4266
|
+
an as aH,
|
|
4267
|
+
cn as aI,
|
|
4268
|
+
tr as aJ,
|
|
4269
|
+
Ko as aK,
|
|
4270
|
+
Qo as aL,
|
|
4271
|
+
U as aM,
|
|
4272
|
+
qe as aN,
|
|
4273
|
+
Uo as aO,
|
|
4274
|
+
or as aP,
|
|
4275
|
+
$o as aQ,
|
|
4276
|
+
zo as aR,
|
|
4277
|
+
me as aS,
|
|
4278
|
+
z as aT,
|
|
4279
|
+
ye as aU,
|
|
4280
|
+
Vo as aV,
|
|
4281
|
+
fn as aW,
|
|
4282
|
+
he as aX,
|
|
4283
|
+
ge as aY,
|
|
4284
|
+
be as aZ,
|
|
4285
|
+
R as a_,
|
|
4286
|
+
B as aa,
|
|
4287
|
+
H as ab,
|
|
4288
|
+
sr as ac,
|
|
4289
|
+
ar as ad,
|
|
4290
|
+
ir as ae,
|
|
4291
|
+
Jt as af,
|
|
4292
|
+
O as ag,
|
|
4293
|
+
qo as ah,
|
|
4294
|
+
Zo as ai,
|
|
4295
|
+
Ft as aj,
|
|
4296
|
+
Go as ak,
|
|
4297
|
+
G as al,
|
|
4298
|
+
Y as am,
|
|
4299
|
+
un as an,
|
|
4300
|
+
X as ao,
|
|
4301
|
+
nt as ap,
|
|
4302
|
+
Z as aq,
|
|
4303
|
+
dn as ar,
|
|
4304
|
+
fe as as,
|
|
4305
|
+
Xt as at,
|
|
4306
|
+
Ce as au,
|
|
4307
|
+
Sn as av,
|
|
4308
|
+
xn as aw,
|
|
4309
|
+
Zt as ax,
|
|
4310
|
+
Gt as ay,
|
|
4311
|
+
Ge as az,
|
|
4312
|
+
yn as b,
|
|
4313
|
+
L as b0,
|
|
4314
|
+
A as b1,
|
|
4315
|
+
rr as b2,
|
|
4316
|
+
w as b3,
|
|
4317
|
+
hr as b4,
|
|
4318
|
+
mr as b5,
|
|
4319
|
+
Ut as b6,
|
|
4320
|
+
zt as b7,
|
|
4321
|
+
qt as b8,
|
|
4322
|
+
jo as b9,
|
|
4323
|
+
ae as bA,
|
|
4324
|
+
M as ba,
|
|
4325
|
+
$t as bb,
|
|
4326
|
+
ie as bc,
|
|
4327
|
+
jt as bd,
|
|
4328
|
+
Kt as be,
|
|
4329
|
+
Je as bf,
|
|
4330
|
+
Le as bg,
|
|
4331
|
+
Ze as bh,
|
|
4332
|
+
I as bi,
|
|
4333
|
+
Yt as bj,
|
|
4334
|
+
Ye as bk,
|
|
4335
|
+
Qt as bl,
|
|
4336
|
+
J as bm,
|
|
4337
|
+
Ke as bn,
|
|
4338
|
+
F as bo,
|
|
4339
|
+
Qe as bp,
|
|
4340
|
+
sn as bq,
|
|
4341
|
+
Rt as br,
|
|
4342
|
+
T as bs,
|
|
4343
|
+
Wo as bt,
|
|
4344
|
+
K as bu,
|
|
4345
|
+
Fo as bv,
|
|
4346
|
+
se as bw,
|
|
4347
|
+
$ as bx,
|
|
4348
|
+
pe as by,
|
|
4349
|
+
j as bz,
|
|
4250
4350
|
Cn as c,
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4351
|
+
wn as d,
|
|
4352
|
+
vn as e,
|
|
4353
|
+
En as f,
|
|
4354
|
+
Mn as g,
|
|
4355
|
+
Ln as h,
|
|
4356
|
+
rt as i,
|
|
4357
|
+
Tn as j,
|
|
4358
|
+
An as k,
|
|
4359
|
+
Nn as l,
|
|
4260
4360
|
In as m,
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4361
|
+
Pn as n,
|
|
4362
|
+
On as o,
|
|
4363
|
+
He as p,
|
|
4364
|
+
Dn as q,
|
|
4365
|
+
_n as r,
|
|
4366
|
+
Rn as s,
|
|
4367
|
+
Vn as t,
|
|
4368
|
+
Wn as u,
|
|
4369
|
+
Fn as v,
|
|
4370
|
+
$n as w,
|
|
4271
4371
|
jn as x,
|
|
4272
|
-
|
|
4372
|
+
Un as y,
|
|
4273
4373
|
zn as z
|
|
4274
4374
|
};
|
|
4275
|
-
//# sourceMappingURL=BlockNoteSchema-
|
|
4375
|
+
//# sourceMappingURL=BlockNoteSchema-CYRHak18.js.map
|