@blocknote/core 0.50.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote.cjs +1 -1
- package/dist/blocknote.js +4 -4
- package/dist/{blocks-UU7EM-QM.js → blocks-D0lMxErU.js} +397 -368
- package/dist/blocks-D0lMxErU.js.map +1 -0
- package/dist/blocks-KyMOxPT3.cjs +11 -0
- package/dist/blocks-KyMOxPT3.cjs.map +1 -0
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/{extensions-CkLT--Nc.js → extensions-CQFfm5f5.js} +619 -353
- package/dist/extensions-CQFfm5f5.js.map +1 -0
- package/dist/extensions-Cuw3zOdC.cjs +52 -0
- package/dist/extensions-Cuw3zOdC.cjs.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +3 -3
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +1 -1
- package/dist/locales.js.map +1 -1
- package/dist/{src-SVFpMAWE.js → src-DK_8q1j5.js} +1070 -564
- package/dist/src-DK_8q1j5.js.map +1 -0
- package/dist/src-_83jmA7A.cjs +21 -0
- package/dist/src-_83jmA7A.cjs.map +1 -0
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/dist/yjs.cjs +1 -1
- package/dist/yjs.js +8 -8
- package/package.json +1 -13
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +7 -7
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +5 -3
- package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +5 -5
- package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +2550 -291
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +83 -2
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +103 -42
- package/src/api/blockManipulation/commands/nestBlock/__snapshots__/nestBlock.test.ts.snap +0 -143
- package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +12 -12
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +5 -3
- package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +6 -6
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +22 -22
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +12 -8
- package/src/api/blockManipulation/setupTestEnv.ts +1 -1
- package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +2 -6
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +7 -2
- package/src/api/exporters/markdown/htmlToMarkdown.ts +813 -0
- package/src/api/exporters/markdown/markdownExporter.ts +2 -21
- package/src/api/nodeConversions/blockToNode.ts +3 -2
- package/src/api/parsers/html/util/__snapshots__/nestedLists.test.ts.snap +122 -107
- package/src/api/parsers/html/util/nestedLists.test.ts +1 -12
- package/src/api/parsers/markdown/markdownToHtml.ts +1194 -0
- package/src/api/parsers/markdown/parseMarkdown.ts +2 -101
- package/src/blocks/Audio/block.ts +1 -4
- package/src/blocks/Code/block.test.ts +258 -0
- package/src/blocks/File/block.ts +1 -4
- package/src/blocks/File/helpers/render/createFileBlockWrapper.ts +7 -2
- package/src/blocks/Image/block.ts +9 -6
- package/src/blocks/ListItem/BulletListItem/block.ts +7 -4
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +3 -4
- package/src/blocks/Video/block.ts +4 -5
- package/src/blocks/Video/parseVideoElement.ts +2 -1
- package/src/editor/Block.css +8 -0
- package/src/editor/BlockNoteEditor.test.ts +10 -4
- package/src/editor/BlockNoteEditor.ts +30 -13
- package/src/editor/managers/BlockManager.ts +10 -6
- package/src/editor/managers/ExtensionManager/index.ts +80 -25
- package/src/editor/performance.test.ts +2 -2
- package/src/editor/transformPasted.test.ts +295 -0
- package/src/editor/transformPasted.ts +77 -0
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor-forked.json +1 -12
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor.json +0 -11
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-forked.html +1 -1
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap.html +1 -1
- package/src/extensions/SideMenu/dragging.ts +7 -10
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +21 -0
- package/src/extensions/TrailingNode/TrailingNode.ts +124 -65
- package/src/i18n/locales/fr.ts +1 -1
- package/types/src/api/blockManipulation/commands/moveBlocks/moveBlocks.d.ts +13 -2
- package/types/src/api/clipboard/fromClipboard/handleVSCodePaste.d.ts +1 -1
- package/types/src/api/exporters/markdown/htmlToMarkdown.d.ts +11 -0
- package/types/src/api/parsers/markdown/markdownToHtml.d.ts +5 -0
- package/types/src/blocks/Code/block.test.d.ts +1 -0
- package/types/src/blocks/Video/block.d.ts +2 -0
- package/types/src/blocks/Video/parseVideoElement.d.ts +1 -0
- package/types/src/editor/BlockNoteEditor.d.ts +20 -6
- package/types/src/editor/managers/BlockManager.d.ts +8 -4
- package/types/src/editor/transformPasted.test.d.ts +1 -0
- package/types/src/extensions/TrailingNode/TrailingNode.d.ts +8 -3
- package/dist/blocks-BFnTypT-.cjs +0 -11
- package/dist/blocks-BFnTypT-.cjs.map +0 -1
- package/dist/blocks-UU7EM-QM.js.map +0 -1
- package/dist/extensions-CYsFi5Is.cjs +0 -2
- package/dist/extensions-CYsFi5Is.cjs.map +0 -1
- package/dist/extensions-CkLT--Nc.js.map +0 -1
- package/dist/src-DsJ6yzs9.cjs +0 -5
- package/dist/src-DsJ6yzs9.cjs.map +0 -1
- package/dist/src-SVFpMAWE.js.map +0 -1
- package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +0 -42
- package/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.ts +0 -19
- package/src/api/exporters/markdown/util/removeUnderlinesRehypePlugin.ts +0 -39
- package/types/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.d.ts +0 -7
- package/types/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.d.ts +0 -2
- package/types/src/api/exporters/markdown/util/removeUnderlinesRehypePlugin.d.ts +0 -6
|
@@ -2,7 +2,7 @@ import { n as e, t } from "./BlockNoteExtension-B6RhuQ3V.js";
|
|
|
2
2
|
import { DOMParser as n, Fragment as r, Slice as i } from "prosemirror-model";
|
|
3
3
|
import { Mapping as a, ReplaceStep as o } from "prosemirror-transform";
|
|
4
4
|
import { Extension as s, InputRule as c, Mark as l, Node as u, callOrReturn as d, combineTransactionSteps as f, findChildrenInRange as p, findParentNode as m, getChangedRanges as h, getExtensionField as g, markInputRule as _, mergeAttributes as v } from "@tiptap/core";
|
|
5
|
-
import { Plugin as
|
|
5
|
+
import { Plugin as ee, PluginKey as te, TextSelection as y } from "prosemirror-state";
|
|
6
6
|
import { uuidv4 as ne } from "lib0/random";
|
|
7
7
|
import { DOMParser as re, DOMSerializer as ie, Fragment as ae } from "@tiptap/pm/model";
|
|
8
8
|
import { CellSelection as oe, TableMap as se, TableView as ce, columnResizing as le, goToNextCell as ue, isInTable as de, moveCellForward as fe, nextCell as pe, selectionCell as me, tableEditing as he } from "prosemirror-tables";
|
|
@@ -65,8 +65,8 @@ var Pe = s.create({
|
|
|
65
65
|
},
|
|
66
66
|
addProseMirrorPlugins() {
|
|
67
67
|
let { isWithinEditor: e } = this.options, t = null, n = !1;
|
|
68
|
-
return [new
|
|
69
|
-
key: new
|
|
68
|
+
return [new ee({
|
|
69
|
+
key: new te("uniqueID"),
|
|
70
70
|
appendTransaction: (e, t, n) => {
|
|
71
71
|
let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = this.options.filterTransaction && e.some((e) => !this.options.filterTransaction?.(e));
|
|
72
72
|
if (!r || i) return;
|
|
@@ -454,7 +454,7 @@ function j(e, t, n) {
|
|
|
454
454
|
}
|
|
455
455
|
//#endregion
|
|
456
456
|
//#region src/api/getBlockInfoFromPos.ts
|
|
457
|
-
function
|
|
457
|
+
function Qe(e, t) {
|
|
458
458
|
let n = e.resolve(t);
|
|
459
459
|
if (n.nodeAfter && n.nodeAfter.type.isInGroup("bnBlock")) return {
|
|
460
460
|
posBeforeNode: n.pos,
|
|
@@ -478,7 +478,7 @@ function M(e, t) {
|
|
|
478
478
|
node: o.nodeAfter
|
|
479
479
|
};
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function $e(e, t) {
|
|
482
482
|
if (!e.type.isInGroup("bnBlock")) throw Error(`Attempted to get bnBlock node at position but found node of different type ${e.type.name}`);
|
|
483
483
|
let n = e, r = t, i = {
|
|
484
484
|
node: n,
|
|
@@ -521,41 +521,41 @@ function Qe(e, t) {
|
|
|
521
521
|
};
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
|
-
function
|
|
525
|
-
return
|
|
526
|
-
}
|
|
527
|
-
function $e(e) {
|
|
528
|
-
if (!e.nodeAfter) throw Error(`Attempted to get blockContainer node at position ${e.pos} but a node at this position does not exist`);
|
|
529
|
-
return Qe(e.nodeAfter, e.pos);
|
|
524
|
+
function M(e) {
|
|
525
|
+
return $e(e.node, e.posBeforeNode);
|
|
530
526
|
}
|
|
531
527
|
function et(e) {
|
|
532
|
-
|
|
528
|
+
if (!e.nodeAfter) throw Error(`Attempted to get blockContainer node at position ${e.pos} but a node at this position does not exist`);
|
|
529
|
+
return $e(e.nodeAfter, e.pos);
|
|
533
530
|
}
|
|
534
531
|
function tt(e) {
|
|
535
|
-
return
|
|
532
|
+
return M(Qe(e.doc, e.selection.anchor));
|
|
533
|
+
}
|
|
534
|
+
function nt(e) {
|
|
535
|
+
return M(Qe(e.doc, e.selection.anchor));
|
|
536
536
|
}
|
|
537
537
|
//#endregion
|
|
538
538
|
//#region src/api/pmUtil.ts
|
|
539
|
-
function
|
|
539
|
+
function N(e) {
|
|
540
540
|
return "doc" in e ? e.doc.type.schema : e.type.schema;
|
|
541
541
|
}
|
|
542
|
-
function nt(e) {
|
|
543
|
-
return e.cached.blockNoteEditor;
|
|
544
|
-
}
|
|
545
542
|
function rt(e) {
|
|
546
|
-
return
|
|
543
|
+
return e.cached.blockNoteEditor;
|
|
547
544
|
}
|
|
548
545
|
function it(e) {
|
|
549
|
-
return rt(e).
|
|
546
|
+
return rt(e).schema;
|
|
550
547
|
}
|
|
551
548
|
function at(e) {
|
|
552
|
-
return
|
|
553
|
-
}
|
|
554
|
-
function F(e) {
|
|
555
|
-
return rt(e).styleSchema;
|
|
549
|
+
return it(e).blockSchema;
|
|
556
550
|
}
|
|
557
551
|
function ot(e) {
|
|
558
|
-
return
|
|
552
|
+
return it(e).inlineContentSchema;
|
|
553
|
+
}
|
|
554
|
+
function P(e) {
|
|
555
|
+
return it(e).styleSchema;
|
|
556
|
+
}
|
|
557
|
+
function F(e) {
|
|
558
|
+
return rt(e).blockCache;
|
|
559
559
|
}
|
|
560
560
|
//#endregion
|
|
561
561
|
//#region src/api/nodeConversions/nodeToBlock.ts
|
|
@@ -683,11 +683,11 @@ function ct(e, t, n) {
|
|
|
683
683
|
content: a
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
|
-
function L(e, t, n =
|
|
686
|
+
function L(e, t, n = at(t), r = ot(t), i = P(t), a = F(t)) {
|
|
687
687
|
if (!e.type.isInGroup("bnBlock")) throw Error("Node should be a bnBlock, but is instead: " + e.type.name);
|
|
688
688
|
let o = a?.get(e);
|
|
689
689
|
if (o) return o;
|
|
690
|
-
let s =
|
|
690
|
+
let s = $e(e, 0), c = s.bnBlock.node.attrs.id;
|
|
691
691
|
c === null && (c = Pe.options.generateID());
|
|
692
692
|
let l = n[s.blockNoteType];
|
|
693
693
|
if (!l) throw Error("Block is of an unrecognized type: " + s.blockNoteType);
|
|
@@ -721,11 +721,11 @@ function L(e, t, n = it(t), r = at(t), i = F(t), a = ot(t)) {
|
|
|
721
721
|
};
|
|
722
722
|
return a?.set(e, m), m;
|
|
723
723
|
}
|
|
724
|
-
function lt(e, t =
|
|
724
|
+
function lt(e, t = N(e), n = at(t), r = ot(t), i = P(t), a = F(t)) {
|
|
725
725
|
let o = [];
|
|
726
726
|
return e.firstChild && e.firstChild.descendants((e) => (o.push(L(e, t, n, r, i, a)), !1)), o;
|
|
727
727
|
}
|
|
728
|
-
function ut(e, t, n =
|
|
728
|
+
function ut(e, t, n = at(t), r = ot(t), i = P(t), a = F(t)) {
|
|
729
729
|
function o(e, s, c) {
|
|
730
730
|
if (e.type.name !== "blockGroup") throw Error("unexpected");
|
|
731
731
|
let l = [], u, d;
|
|
@@ -740,14 +740,14 @@ function ut(e, t, n = it(t), r = at(t), i = F(t), a = ot(t)) {
|
|
|
740
740
|
u = e.blockCutAtStart, g && (d = e.blockCutAtEnd), l.push(...e.blocks);
|
|
741
741
|
return;
|
|
742
742
|
}
|
|
743
|
-
let _ = L(f, t, n, r, i, a), v = f.childCount > 1 ? f.child(1) : void 0,
|
|
743
|
+
let _ = L(f, t, n, r, i, a), v = f.childCount > 1 ? f.child(1) : void 0, ee = [];
|
|
744
744
|
if (v) {
|
|
745
745
|
let e = o(v, 0, g ? Math.max(0, c - 1) : 0);
|
|
746
|
-
|
|
746
|
+
ee = e.blocks, g && (d = e.blockCutAtEnd);
|
|
747
747
|
}
|
|
748
748
|
g && !v && c > 1 && (d = _.id), h && s > 1 && (u = _.id), l.push({
|
|
749
749
|
..._,
|
|
750
|
-
children:
|
|
750
|
+
children: ee
|
|
751
751
|
});
|
|
752
752
|
}), {
|
|
753
753
|
blocks: l,
|
|
@@ -1210,12 +1210,12 @@ function Gt(e, t, n, r) {
|
|
|
1210
1210
|
for (let a of e) i.push(...Ut(a, t, n, r));
|
|
1211
1211
|
return i;
|
|
1212
1212
|
}
|
|
1213
|
-
function U(e, t, n, r =
|
|
1213
|
+
function U(e, t, n, r = P(t)) {
|
|
1214
1214
|
let i = [];
|
|
1215
1215
|
for (let a of e) typeof a == "string" ? i.push(...Gt(a, t, r, n)) : Ie(a) ? i.push(...Wt(a, t, r)) : b(a) ? i.push(...Gt([a], t, r, n)) : i.push(qt(a, t, r));
|
|
1216
1216
|
return i;
|
|
1217
1217
|
}
|
|
1218
|
-
function Kt(e, t, n =
|
|
1218
|
+
function Kt(e, t, n = P(t)) {
|
|
1219
1219
|
let r = [], i = Array(e.headerRows ?? 0).fill(!0), a = Array(e.headerCols ?? 0).fill(!0), o = e.columnWidths ?? [];
|
|
1220
1220
|
for (let s = 0; s < e.rows.length; s++) {
|
|
1221
1221
|
let c = e.rows[s], l = [], u = i[s];
|
|
@@ -1260,7 +1260,7 @@ function qt(e, t, n) {
|
|
|
1260
1260
|
} else throw new T(e.content.type);
|
|
1261
1261
|
return r;
|
|
1262
1262
|
}
|
|
1263
|
-
function W(e, t, n =
|
|
1263
|
+
function W(e, t, n = P(t)) {
|
|
1264
1264
|
let r = e.id;
|
|
1265
1265
|
r === void 0 && (r = Pe.options.generateID());
|
|
1266
1266
|
let i = [];
|
|
@@ -1271,7 +1271,7 @@ function W(e, t, n = F(t)) {
|
|
|
1271
1271
|
id: r,
|
|
1272
1272
|
...e.props
|
|
1273
1273
|
}, o ? [a, o] : a);
|
|
1274
|
-
} else if (t.nodes[e.type].isInGroup("bnBlock")) return t.nodes[e.type].
|
|
1274
|
+
} else if (t.nodes[e.type].isInGroup("bnBlock")) return t.nodes[e.type].create({
|
|
1275
1275
|
id: r,
|
|
1276
1276
|
...e.props
|
|
1277
1277
|
}, i);
|
|
@@ -1291,32 +1291,32 @@ function Yt(e) {
|
|
|
1291
1291
|
}
|
|
1292
1292
|
//#endregion
|
|
1293
1293
|
//#region src/api/blockManipulation/commands/updateBlock/updateBlock.ts
|
|
1294
|
-
var Xt = (e, t) => ({ tr: n, dispatch: r }) => (r &&
|
|
1295
|
-
function
|
|
1296
|
-
let a =
|
|
1297
|
-
a.blockNoteType === "table" && (o =
|
|
1298
|
-
let s =
|
|
1294
|
+
var Xt = (e, t) => ({ tr: n, dispatch: r }) => (r && Zt(n, e, t), !0);
|
|
1295
|
+
function Zt(e, t, n, r, i) {
|
|
1296
|
+
let a = et(e.doc.resolve(t)), o = null;
|
|
1297
|
+
a.blockNoteType === "table" && (o = tn(e));
|
|
1298
|
+
let s = N(e);
|
|
1299
1299
|
if (r !== void 0 && i !== void 0 && r > i) throw Error("Invalid replaceFromPos or replaceToPos");
|
|
1300
1300
|
let c = s.nodes[a.blockNoteType], l = s.nodes[n.type || a.blockNoteType], u = l.isInGroup("bnBlock") ? l : s.nodes.blockContainer;
|
|
1301
1301
|
if (a.isBlockContainer && l.isInGroup("blockContent")) {
|
|
1302
1302
|
let t = r !== void 0 && r > a.blockContent.beforePos && r < a.blockContent.afterPos ? r - a.blockContent.beforePos - 1 : void 0, o = i !== void 0 && i > a.blockContent.beforePos && i < a.blockContent.afterPos ? i - a.blockContent.beforePos - 1 : void 0;
|
|
1303
|
-
|
|
1304
|
-
} else if (!a.isBlockContainer && l.isInGroup("bnBlock"))
|
|
1303
|
+
$t(n, e, a), Qt(n, e, c, l, a, t, o);
|
|
1304
|
+
} else if (!a.isBlockContainer && l.isInGroup("bnBlock")) $t(n, e, a);
|
|
1305
1305
|
else {
|
|
1306
|
-
let t =
|
|
1307
|
-
|
|
1308
|
-
children: t.children,
|
|
1306
|
+
let t = W({
|
|
1307
|
+
children: L(a.bnBlock.node, s).children,
|
|
1309
1308
|
...n
|
|
1310
|
-
}, s)
|
|
1309
|
+
}, s);
|
|
1310
|
+
t.check(), e.replaceWith(a.bnBlock.beforePos, a.bnBlock.afterPos, t);
|
|
1311
1311
|
return;
|
|
1312
1312
|
}
|
|
1313
1313
|
e.setNodeMarkup(a.bnBlock.beforePos, u, {
|
|
1314
1314
|
...a.bnBlock.node.attrs,
|
|
1315
1315
|
...n.props
|
|
1316
|
-
}), o &&
|
|
1316
|
+
}), o && nn(e, a, o);
|
|
1317
1317
|
}
|
|
1318
|
-
function
|
|
1319
|
-
let l =
|
|
1318
|
+
function Qt(e, t, n, a, o, s, c) {
|
|
1319
|
+
let l = N(t), u = "keep";
|
|
1320
1320
|
if (e.content) if (typeof e.content == "string") u = U([e.content], l, a.name);
|
|
1321
1321
|
else if (Array.isArray(e.content)) u = U(e.content, l, a.name);
|
|
1322
1322
|
else if (e.content.type === "tableContent") u = Kt(e.content, l);
|
|
@@ -1338,10 +1338,13 @@ function Zt(e, t, n, a, o, s, c) {
|
|
|
1338
1338
|
...e.props
|
|
1339
1339
|
}, u));
|
|
1340
1340
|
}
|
|
1341
|
-
function
|
|
1342
|
-
let a =
|
|
1341
|
+
function $t(e, t, n) {
|
|
1342
|
+
let a = N(t);
|
|
1343
1343
|
if (e.children !== void 0 && e.children.length > 0) {
|
|
1344
|
-
let s = e.children.map((e) =>
|
|
1344
|
+
let s = e.children.map((e) => {
|
|
1345
|
+
let t = W(e, a);
|
|
1346
|
+
return t.check(), t;
|
|
1347
|
+
});
|
|
1345
1348
|
if (n.childContainer) t.step(new o(n.childContainer.beforePos + 1, n.childContainer.afterPos - 1, new i(r.from(s), 0, 0)));
|
|
1346
1349
|
else {
|
|
1347
1350
|
if (!n.isBlockContainer) throw Error("impossible");
|
|
@@ -1349,14 +1352,14 @@ function Qt(e, t, n) {
|
|
|
1349
1352
|
}
|
|
1350
1353
|
}
|
|
1351
1354
|
}
|
|
1352
|
-
function
|
|
1355
|
+
function en(e, t, n, r, i) {
|
|
1353
1356
|
let a = typeof t == "string" ? t : t.id, o = Jt(a, e.doc);
|
|
1354
1357
|
if (!o) throw Error(`Block with ID ${a} not found`);
|
|
1355
|
-
return
|
|
1358
|
+
return Zt(e, o.posBeforeNode, n, r, i), L(e.doc.resolve(o.posBeforeNode + 1).node(), N(e));
|
|
1356
1359
|
}
|
|
1357
|
-
function
|
|
1360
|
+
function tn(e) {
|
|
1358
1361
|
let t = "selection" in e ? e.selection : null;
|
|
1359
|
-
if (!(t instanceof
|
|
1362
|
+
if (!(t instanceof y)) return null;
|
|
1360
1363
|
let n = e.doc.resolve(t.head), r = -1, i = -1;
|
|
1361
1364
|
for (let e = n.depth; e >= 0; e--) {
|
|
1362
1365
|
let t = n.node(e).type.name;
|
|
@@ -1377,7 +1380,7 @@ function en(e) {
|
|
|
1377
1380
|
offset: Math.max(0, t.head - p)
|
|
1378
1381
|
};
|
|
1379
1382
|
}
|
|
1380
|
-
function
|
|
1383
|
+
function nn(e, t, n) {
|
|
1381
1384
|
if (t.blockNoteType !== "table") return !1;
|
|
1382
1385
|
let r = -1;
|
|
1383
1386
|
if (t.isBlockContainer) r = e.mapping.map(t.blockContent.beforePos);
|
|
@@ -1390,11 +1393,11 @@ function tn(e, t, n) {
|
|
|
1390
1393
|
let a = se.get(i), o = Math.max(0, Math.min(n.row, a.height - 1)), s = Math.max(0, Math.min(n.col, a.width - 1)), c = o * a.width + s, l = a.map[c];
|
|
1391
1394
|
if (l == null) return !1;
|
|
1392
1395
|
let u = r + 1 + l + 1, d = e.doc.nodeAt(u), f = u + 1, p = d ? d.content.size : 0, m = f + Math.max(0, Math.min(n.offset, p));
|
|
1393
|
-
return "selection" in e && e.setSelection(
|
|
1396
|
+
return "selection" in e && e.setSelection(y.create(e.doc, m)), !0;
|
|
1394
1397
|
}
|
|
1395
1398
|
//#endregion
|
|
1396
1399
|
//#region src/editor/defaultColors.ts
|
|
1397
|
-
var
|
|
1400
|
+
var G = {
|
|
1398
1401
|
gray: {
|
|
1399
1402
|
text: "#9b9a97",
|
|
1400
1403
|
background: "#ebeced"
|
|
@@ -1431,7 +1434,7 @@ var K = {
|
|
|
1431
1434
|
text: "#ad1a72",
|
|
1432
1435
|
background: "#f4dfeb"
|
|
1433
1436
|
}
|
|
1434
|
-
},
|
|
1437
|
+
}, rn = {
|
|
1435
1438
|
gray: {
|
|
1436
1439
|
text: "#bebdb8",
|
|
1437
1440
|
background: "#9b9a97"
|
|
@@ -1468,7 +1471,7 @@ var K = {
|
|
|
1468
1471
|
text: "#da208f",
|
|
1469
1472
|
background: "#ad1a72"
|
|
1470
1473
|
}
|
|
1471
|
-
},
|
|
1474
|
+
}, K = {
|
|
1472
1475
|
backgroundColor: { default: "default" },
|
|
1473
1476
|
textColor: { default: "default" },
|
|
1474
1477
|
textAlignment: {
|
|
@@ -1480,30 +1483,30 @@ var K = {
|
|
|
1480
1483
|
"justify"
|
|
1481
1484
|
]
|
|
1482
1485
|
}
|
|
1483
|
-
},
|
|
1486
|
+
}, q = (e) => {
|
|
1484
1487
|
let t = {};
|
|
1485
|
-
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 =
|
|
1486
|
-
},
|
|
1487
|
-
e.backgroundColor && e.backgroundColor !==
|
|
1488
|
-
},
|
|
1489
|
-
default:
|
|
1490
|
-
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : e.style.backgroundColor ? e.style.backgroundColor :
|
|
1491
|
-
renderHTML: (t) => t[e] ===
|
|
1492
|
-
}),
|
|
1493
|
-
default:
|
|
1494
|
-
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : e.style.color ? e.style.color :
|
|
1495
|
-
renderHTML: (t) => t[e] ===
|
|
1496
|
-
}),
|
|
1497
|
-
default:
|
|
1498
|
-
parseHTML: (e) => e.hasAttribute("data-text-alignment") ? e.getAttribute("data-text-alignment") : e.style.textAlign ? e.style.textAlign :
|
|
1499
|
-
renderHTML: (t) => t[e] ===
|
|
1500
|
-
}),
|
|
1488
|
+
return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment = K.textAlignment.values.includes(e.style.textAlign) ? e.style.textAlign : void 0, t;
|
|
1489
|
+
}, J = (e, t) => {
|
|
1490
|
+
e.backgroundColor && e.backgroundColor !== K.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in G ? G[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== K.textColor.default && (t.style.color = e.textColor in G ? G[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== K.textAlignment.default && (t.style.textAlign = e.textAlignment);
|
|
1491
|
+
}, an = (e = "backgroundColor") => ({
|
|
1492
|
+
default: K.backgroundColor.default,
|
|
1493
|
+
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : e.style.backgroundColor ? e.style.backgroundColor : K.backgroundColor.default,
|
|
1494
|
+
renderHTML: (t) => t[e] === K.backgroundColor.default ? {} : { "data-background-color": t[e] }
|
|
1495
|
+
}), on = (e = "textColor") => ({
|
|
1496
|
+
default: K.textColor.default,
|
|
1497
|
+
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : e.style.color ? e.style.color : K.textColor.default,
|
|
1498
|
+
renderHTML: (t) => t[e] === K.textColor.default ? {} : { "data-text-color": t[e] }
|
|
1499
|
+
}), sn = (e = "textAlignment") => ({
|
|
1500
|
+
default: K.textAlignment.default,
|
|
1501
|
+
parseHTML: (e) => e.hasAttribute("data-text-alignment") ? e.getAttribute("data-text-alignment") : e.style.textAlign ? e.style.textAlign : K.textAlignment.default,
|
|
1502
|
+
renderHTML: (t) => t[e] === K.textAlignment.default ? {} : { "data-text-alignment": t[e] }
|
|
1503
|
+
}), cn = (e, t) => {
|
|
1501
1504
|
let n = e.querySelector(t);
|
|
1502
1505
|
if (n) return {
|
|
1503
1506
|
targetElement: n,
|
|
1504
1507
|
caption: e.querySelector("figcaption")?.textContent ?? void 0
|
|
1505
1508
|
};
|
|
1506
|
-
},
|
|
1509
|
+
}, Y = t(({ editor: t }) => {
|
|
1507
1510
|
let n = e(void 0);
|
|
1508
1511
|
function r() {
|
|
1509
1512
|
n.setState(void 0);
|
|
@@ -1522,7 +1525,7 @@ var K = {
|
|
|
1522
1525
|
n.setState(e);
|
|
1523
1526
|
}
|
|
1524
1527
|
};
|
|
1525
|
-
}),
|
|
1528
|
+
}), ln = (e, t, n) => {
|
|
1526
1529
|
let r = document.createElement("div");
|
|
1527
1530
|
r.className = "bn-add-file-button";
|
|
1528
1531
|
let i = document.createElement("div");
|
|
@@ -1532,7 +1535,7 @@ var K = {
|
|
|
1532
1535
|
let o = (e) => {
|
|
1533
1536
|
e.preventDefault(), e.stopPropagation();
|
|
1534
1537
|
}, s = () => {
|
|
1535
|
-
t.isEditable && t.getExtension(
|
|
1538
|
+
t.isEditable && t.getExtension(Y)?.showMenu(e.id);
|
|
1536
1539
|
};
|
|
1537
1540
|
return r.addEventListener("mousedown", o, !0), r.addEventListener("click", s, !0), {
|
|
1538
1541
|
dom: r,
|
|
@@ -1540,110 +1543,107 @@ var K = {
|
|
|
1540
1543
|
r.removeEventListener("mousedown", o, !0), r.removeEventListener("click", s, !0);
|
|
1541
1544
|
}
|
|
1542
1545
|
};
|
|
1543
|
-
},
|
|
1546
|
+
}, un = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z\"></path></svg>", dn = (e) => {
|
|
1544
1547
|
let t = document.createElement("div");
|
|
1545
1548
|
t.className = "bn-file-name-with-icon";
|
|
1546
1549
|
let n = document.createElement("div");
|
|
1547
|
-
n.className = "bn-file-icon", n.innerHTML =
|
|
1550
|
+
n.className = "bn-file-icon", n.innerHTML = un, t.appendChild(n);
|
|
1548
1551
|
let r = document.createElement("p");
|
|
1549
1552
|
return r.className = "bn-file-name", r.textContent = e.props.name, t.appendChild(r), { dom: t };
|
|
1550
|
-
},
|
|
1551
|
-
let i = document.createElement("div");
|
|
1552
|
-
if (
|
|
1553
|
-
let n =
|
|
1554
|
-
|
|
1555
|
-
let
|
|
1553
|
+
}, fn = (e, t, n, r) => {
|
|
1554
|
+
let i = e.props.url !== "" && !!e.props.caption, a = document.createElement(i ? "figure" : "div");
|
|
1555
|
+
if (a.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
1556
|
+
let n = ln(e, t, r);
|
|
1557
|
+
a.appendChild(n.dom);
|
|
1558
|
+
let i = t.onUploadStart((t) => {
|
|
1556
1559
|
if (t === e.id) {
|
|
1557
|
-
|
|
1560
|
+
a.removeChild(n.dom);
|
|
1558
1561
|
let e = document.createElement("div");
|
|
1559
|
-
e.className = "bn-file-loading-preview", e.textContent = "Loading...",
|
|
1562
|
+
e.className = "bn-file-loading-preview", e.textContent = "Loading...", a.appendChild(e);
|
|
1560
1563
|
}
|
|
1561
1564
|
});
|
|
1562
1565
|
return {
|
|
1563
|
-
dom:
|
|
1566
|
+
dom: a,
|
|
1564
1567
|
destroy: () => {
|
|
1565
|
-
|
|
1568
|
+
i(), n.destroy();
|
|
1566
1569
|
}
|
|
1567
1570
|
};
|
|
1568
1571
|
}
|
|
1569
|
-
let
|
|
1572
|
+
let o = { dom: a };
|
|
1570
1573
|
if (e.props.showPreview === !1 || !n) {
|
|
1571
|
-
let t =
|
|
1572
|
-
|
|
1574
|
+
let t = dn(e);
|
|
1575
|
+
a.appendChild(t.dom), o.destroy = () => {
|
|
1573
1576
|
t.destroy?.();
|
|
1574
1577
|
};
|
|
1575
|
-
} else
|
|
1578
|
+
} else a.appendChild(n.dom);
|
|
1576
1579
|
if (e.props.caption) {
|
|
1577
|
-
let t = document.createElement("
|
|
1578
|
-
t.className = "bn-file-caption", t.textContent = e.props.caption,
|
|
1580
|
+
let t = document.createElement("figcaption");
|
|
1581
|
+
t.className = "bn-file-caption", t.textContent = e.props.caption, a.appendChild(t);
|
|
1579
1582
|
}
|
|
1580
|
-
return
|
|
1581
|
-
},
|
|
1583
|
+
return o;
|
|
1584
|
+
}, pn = (e, t) => {
|
|
1582
1585
|
let n = document.createElement("figure"), r = document.createElement("figcaption");
|
|
1583
1586
|
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
1584
|
-
},
|
|
1587
|
+
}, mn = (e, t) => {
|
|
1585
1588
|
let n = document.createElement("div"), r = document.createElement("p");
|
|
1586
1589
|
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
1587
|
-
},
|
|
1590
|
+
}, hn = (e) => ({ url: e.src || void 0 }), gn = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>", _n = A((e) => ({
|
|
1588
1591
|
type: "audio",
|
|
1589
1592
|
propSchema: {
|
|
1590
|
-
backgroundColor:
|
|
1593
|
+
backgroundColor: K.backgroundColor,
|
|
1591
1594
|
name: { default: "" },
|
|
1592
1595
|
url: { default: "" },
|
|
1593
1596
|
caption: { default: "" },
|
|
1594
1597
|
showPreview: { default: !0 }
|
|
1595
1598
|
},
|
|
1596
1599
|
content: "none"
|
|
1597
|
-
})),
|
|
1600
|
+
})), vn = (e = {}) => (e) => {
|
|
1598
1601
|
if (e.tagName === "AUDIO") {
|
|
1599
1602
|
if (e.closest("figure")) return;
|
|
1600
|
-
let { backgroundColor: t } =
|
|
1603
|
+
let { backgroundColor: t } = q(e);
|
|
1601
1604
|
return {
|
|
1602
|
-
...
|
|
1605
|
+
...hn(e),
|
|
1603
1606
|
backgroundColor: t
|
|
1604
1607
|
};
|
|
1605
1608
|
}
|
|
1606
1609
|
if (e.tagName === "FIGURE") {
|
|
1607
|
-
let t =
|
|
1610
|
+
let t = cn(e, "audio");
|
|
1608
1611
|
if (!t) return;
|
|
1609
|
-
let { targetElement: n, caption: r } = t, { backgroundColor: i } =
|
|
1612
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
|
|
1610
1613
|
return {
|
|
1611
|
-
...
|
|
1614
|
+
...hn(n),
|
|
1612
1615
|
backgroundColor: i,
|
|
1613
1616
|
caption: r
|
|
1614
1617
|
};
|
|
1615
1618
|
}
|
|
1616
|
-
},
|
|
1619
|
+
}, yn = (e = {}) => (t, n) => {
|
|
1617
1620
|
let r = document.createElement("div");
|
|
1618
1621
|
r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>";
|
|
1619
1622
|
let i = document.createElement("audio");
|
|
1620
1623
|
return i.className = "bn-audio", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
1621
1624
|
i.src = e;
|
|
1622
|
-
}) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1,
|
|
1623
|
-
},
|
|
1624
|
-
if (!e.props.url) {
|
|
1625
|
-
let e = document.createElement("p");
|
|
1626
|
-
return e.textContent = "Add audio", { dom: e };
|
|
1627
|
-
}
|
|
1625
|
+
}) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1, fn(t, n, { dom: i }, r.firstElementChild);
|
|
1626
|
+
}, bn = (e = {}) => (e, t) => {
|
|
1627
|
+
if (!e.props.url) return { dom: document.createElement("audio") };
|
|
1628
1628
|
let n;
|
|
1629
|
-
return e.props.showPreview ? (n = document.createElement("audio"), n.src = e.props.url) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
1630
|
-
},
|
|
1629
|
+
return e.props.showPreview ? (n = document.createElement("audio"), n.src = e.props.url) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? pn(n, e.props.caption) : mn(n, e.props.caption) : { dom: n };
|
|
1630
|
+
}, xn = j(_n, (e) => ({
|
|
1631
1631
|
meta: { fileBlockAccept: ["audio/*"] },
|
|
1632
|
-
parse:
|
|
1633
|
-
render:
|
|
1634
|
-
toExternalHTML:
|
|
1632
|
+
parse: vn(e),
|
|
1633
|
+
render: yn(e),
|
|
1634
|
+
toExternalHTML: bn(e),
|
|
1635
1635
|
runsBefore: ["file"]
|
|
1636
|
-
})),
|
|
1637
|
-
function
|
|
1636
|
+
})), Sn = Symbol.for("blocknote.shikiParser"), Cn = Symbol.for("blocknote.shikiHighlighterPromise");
|
|
1637
|
+
function wn(e) {
|
|
1638
1638
|
let t = globalThis, n, r, i = !1;
|
|
1639
1639
|
return ge({
|
|
1640
1640
|
parser: (a) => {
|
|
1641
1641
|
if (!e.createHighlighter) return process.env.NODE_ENV === "development" && !i && (console.log("For syntax highlighting of code blocks, you must provide a `createCodeBlockSpec({ createHighlighter: () => ... })` function"), i = !0), [];
|
|
1642
|
-
if (!n) return t[
|
|
1642
|
+
if (!n) return t[Cn] = t[Cn] || e.createHighlighter(), t[Cn].then((e) => {
|
|
1643
1643
|
n = e;
|
|
1644
1644
|
});
|
|
1645
|
-
let o =
|
|
1646
|
-
return !o || o === "text" || o === "none" || o === "plaintext" || o === "txt" ? [] : n.getLoadedLanguages().includes(o) ? (r || (r = t[
|
|
1645
|
+
let o = Dn(e, a.language);
|
|
1646
|
+
return !o || o === "text" || o === "none" || o === "plaintext" || o === "txt" ? [] : n.getLoadedLanguages().includes(o) ? (r || (r = t[Sn] || _e(n), t[Sn] = r), r(a)) : n.loadLanguage(o);
|
|
1647
1647
|
},
|
|
1648
1648
|
languageExtractor: (e) => e.attrs.language,
|
|
1649
1649
|
nodeTypes: ["codeBlock"]
|
|
@@ -1651,11 +1651,11 @@ function Cn(e) {
|
|
|
1651
1651
|
}
|
|
1652
1652
|
//#endregion
|
|
1653
1653
|
//#region src/blocks/Code/block.ts
|
|
1654
|
-
var
|
|
1654
|
+
var Tn = A(({ defaultLanguage: e = "text" }) => ({
|
|
1655
1655
|
type: "codeBlock",
|
|
1656
1656
|
propSchema: { language: { default: e } },
|
|
1657
1657
|
content: "inline"
|
|
1658
|
-
})),
|
|
1658
|
+
})), En = j(Tn, (e) => ({
|
|
1659
1659
|
meta: {
|
|
1660
1660
|
code: !0,
|
|
1661
1661
|
defining: !0,
|
|
@@ -1709,7 +1709,7 @@ var wn = A(({ defaultLanguage: e = "text" }) => ({
|
|
|
1709
1709
|
}
|
|
1710
1710
|
}), (e) => [t({
|
|
1711
1711
|
key: "code-block-highlighter",
|
|
1712
|
-
prosemirrorPlugins: [
|
|
1712
|
+
prosemirrorPlugins: [wn(e)]
|
|
1713
1713
|
}), t({
|
|
1714
1714
|
key: "code-block-keyboard-shortcuts",
|
|
1715
1715
|
keyboardShortcuts: {
|
|
@@ -1747,22 +1747,22 @@ var wn = A(({ defaultLanguage: e = "text" }) => ({
|
|
|
1747
1747
|
let n = t[1].trim();
|
|
1748
1748
|
return {
|
|
1749
1749
|
type: "codeBlock",
|
|
1750
|
-
props: { language: { language:
|
|
1750
|
+
props: { language: { language: Dn(e, n) ?? n }.language },
|
|
1751
1751
|
content: []
|
|
1752
1752
|
};
|
|
1753
1753
|
}
|
|
1754
1754
|
}]
|
|
1755
1755
|
})]);
|
|
1756
|
-
function
|
|
1756
|
+
function Dn(e, t) {
|
|
1757
1757
|
return Object.entries(e.supportedLanguages ?? {}).find(([e, { aliases: n }]) => n?.includes(t) || e === t)?.[0];
|
|
1758
1758
|
}
|
|
1759
1759
|
//#endregion
|
|
1760
1760
|
//#region src/blocks/Divider/block.ts
|
|
1761
|
-
var
|
|
1761
|
+
var On = A(() => ({
|
|
1762
1762
|
type: "divider",
|
|
1763
1763
|
propSchema: {},
|
|
1764
1764
|
content: "none"
|
|
1765
|
-
})),
|
|
1765
|
+
})), kn = j(On, {
|
|
1766
1766
|
meta: { isolating: !1 },
|
|
1767
1767
|
parse(e) {
|
|
1768
1768
|
if (e.tagName === "HR") return {};
|
|
@@ -1782,52 +1782,49 @@ var Dn = A(() => ({
|
|
|
1782
1782
|
};
|
|
1783
1783
|
}
|
|
1784
1784
|
}]
|
|
1785
|
-
})]),
|
|
1785
|
+
})]), An = (e) => ({ url: e.src || void 0 }), jn = A(() => ({
|
|
1786
1786
|
type: "file",
|
|
1787
1787
|
propSchema: {
|
|
1788
|
-
backgroundColor:
|
|
1788
|
+
backgroundColor: K.backgroundColor,
|
|
1789
1789
|
name: { default: "" },
|
|
1790
1790
|
url: { default: "" },
|
|
1791
1791
|
caption: { default: "" }
|
|
1792
1792
|
},
|
|
1793
1793
|
content: "none"
|
|
1794
|
-
})),
|
|
1794
|
+
})), Mn = () => (e) => {
|
|
1795
1795
|
if (e.tagName === "EMBED") {
|
|
1796
1796
|
if (e.closest("figure")) return;
|
|
1797
|
-
let { backgroundColor: t } =
|
|
1797
|
+
let { backgroundColor: t } = q(e);
|
|
1798
1798
|
return {
|
|
1799
|
-
...
|
|
1799
|
+
...An(e),
|
|
1800
1800
|
backgroundColor: t
|
|
1801
1801
|
};
|
|
1802
1802
|
}
|
|
1803
1803
|
if (e.tagName === "FIGURE") {
|
|
1804
|
-
let t =
|
|
1804
|
+
let t = cn(e, "embed");
|
|
1805
1805
|
if (!t) return;
|
|
1806
|
-
let { targetElement: n, caption: r } = t, { backgroundColor: i } =
|
|
1806
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
|
|
1807
1807
|
return {
|
|
1808
|
-
...
|
|
1808
|
+
...An(n),
|
|
1809
1809
|
backgroundColor: i,
|
|
1810
1810
|
caption: r
|
|
1811
1811
|
};
|
|
1812
1812
|
}
|
|
1813
|
-
},
|
|
1813
|
+
}, Nn = j(jn, {
|
|
1814
1814
|
meta: { fileBlockAccept: ["*/*"] },
|
|
1815
|
-
parse:
|
|
1815
|
+
parse: Mn(),
|
|
1816
1816
|
render(e, t) {
|
|
1817
|
-
return
|
|
1817
|
+
return fn(e, t);
|
|
1818
1818
|
},
|
|
1819
1819
|
toExternalHTML(e) {
|
|
1820
|
-
if (!e.props.url) {
|
|
1821
|
-
let e = document.createElement("p");
|
|
1822
|
-
return e.textContent = "Add file", { dom: e };
|
|
1823
|
-
}
|
|
1820
|
+
if (!e.props.url) return { dom: document.createElement("embed") };
|
|
1824
1821
|
let t = document.createElement("a");
|
|
1825
|
-
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ?
|
|
1822
|
+
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? mn(t, e.props.caption) : { dom: t };
|
|
1826
1823
|
}
|
|
1827
1824
|
});
|
|
1828
1825
|
//#endregion
|
|
1829
1826
|
//#region src/blocks/getDetailsContent.ts
|
|
1830
|
-
function
|
|
1827
|
+
function Pn(e, t, i) {
|
|
1831
1828
|
let a = n.fromSchema(t), o = e.querySelector(":scope > summary"), s;
|
|
1832
1829
|
if (o) {
|
|
1833
1830
|
let e = o.cloneNode(!0);
|
|
@@ -1847,10 +1844,10 @@ function Nn(e, t, i) {
|
|
|
1847
1844
|
}
|
|
1848
1845
|
//#endregion
|
|
1849
1846
|
//#region src/blocks/ToggleWrapper/createToggleWrapper.ts
|
|
1850
|
-
var
|
|
1847
|
+
var Fn = {
|
|
1851
1848
|
set: (e, t) => window.localStorage.setItem(`toggle-${e.id}`, t ? "true" : "false"),
|
|
1852
1849
|
get: (e) => window.localStorage.getItem(`toggle-${e.id}`) === "true"
|
|
1853
|
-
},
|
|
1850
|
+
}, In = (e, t, n, r = Fn) => {
|
|
1854
1851
|
if ("isToggleable" in e.props && !e.props.isToggleable) return { dom: n };
|
|
1855
1852
|
let i = document.createElement("div"), a = document.createElement("div");
|
|
1856
1853
|
a.className = "bn-toggle-wrapper";
|
|
@@ -1884,23 +1881,23 @@ var Pn = {
|
|
|
1884
1881
|
o.removeEventListener("mousedown", s), o.removeEventListener("click", c), l.removeEventListener("mousedown", u), l.removeEventListener("click", d), p?.();
|
|
1885
1882
|
}
|
|
1886
1883
|
};
|
|
1887
|
-
},
|
|
1884
|
+
}, Ln = [
|
|
1888
1885
|
1,
|
|
1889
1886
|
2,
|
|
1890
1887
|
3,
|
|
1891
1888
|
4,
|
|
1892
1889
|
5,
|
|
1893
1890
|
6
|
|
1894
|
-
],
|
|
1891
|
+
], Rn = (e) => ({ editor: t }) => {
|
|
1895
1892
|
let n = t.getTextCursorPosition();
|
|
1896
1893
|
return t.schema.blockSchema[n.block.type].content === "inline" ? (t.updateBlock(n.block, {
|
|
1897
1894
|
type: "heading",
|
|
1898
1895
|
props: { level: e }
|
|
1899
1896
|
}), !0) : !1;
|
|
1900
|
-
},
|
|
1897
|
+
}, zn = A(({ defaultLevel: e = 1, levels: t = Ln, allowToggleHeadings: n = !0 } = {}) => ({
|
|
1901
1898
|
type: "heading",
|
|
1902
1899
|
propSchema: {
|
|
1903
|
-
...
|
|
1900
|
+
...K,
|
|
1904
1901
|
level: {
|
|
1905
1902
|
default: e,
|
|
1906
1903
|
values: t
|
|
@@ -1911,7 +1908,7 @@ var Pn = {
|
|
|
1911
1908
|
} } : {}
|
|
1912
1909
|
},
|
|
1913
1910
|
content: "inline"
|
|
1914
|
-
})),
|
|
1911
|
+
})), Bn = j(zn, ({ allowToggleHeadings: e = !0 } = {}) => ({
|
|
1915
1912
|
meta: { isolating: !1 },
|
|
1916
1913
|
parse(t) {
|
|
1917
1914
|
if (e && t.tagName === "DETAILS") {
|
|
@@ -1919,7 +1916,7 @@ var Pn = {
|
|
|
1919
1916
|
if (!e) return;
|
|
1920
1917
|
let n = e.querySelector("h1, h2, h3, h4, h5, h6");
|
|
1921
1918
|
return n ? {
|
|
1922
|
-
...
|
|
1919
|
+
...q(n),
|
|
1923
1920
|
level: parseInt(n.tagName[1]),
|
|
1924
1921
|
isToggleable: !0
|
|
1925
1922
|
} : void 0;
|
|
@@ -1947,18 +1944,18 @@ var Pn = {
|
|
|
1947
1944
|
default: return;
|
|
1948
1945
|
}
|
|
1949
1946
|
return {
|
|
1950
|
-
...
|
|
1947
|
+
...q(t),
|
|
1951
1948
|
level: n
|
|
1952
1949
|
};
|
|
1953
1950
|
},
|
|
1954
1951
|
...e ? { parseContent: ({ el: e, schema: t }) => {
|
|
1955
|
-
if (e.tagName === "DETAILS") return
|
|
1952
|
+
if (e.tagName === "DETAILS") return Pn(e, t, "heading");
|
|
1956
1953
|
} } : {},
|
|
1957
1954
|
runsBefore: ["toggleListItem"],
|
|
1958
1955
|
render(t, n) {
|
|
1959
1956
|
let r = document.createElement(`h${t.props.level}`);
|
|
1960
1957
|
return e ? {
|
|
1961
|
-
...
|
|
1958
|
+
...In(t, n, r),
|
|
1962
1959
|
contentDOM: r
|
|
1963
1960
|
} : {
|
|
1964
1961
|
dom: r,
|
|
@@ -1967,7 +1964,7 @@ var Pn = {
|
|
|
1967
1964
|
},
|
|
1968
1965
|
toExternalHTML(t) {
|
|
1969
1966
|
let n = document.createElement(`h${t.props.level}`);
|
|
1970
|
-
if (
|
|
1967
|
+
if (J(t.props, n), e && t.props.isToggleable) {
|
|
1971
1968
|
let e = document.createElement("details");
|
|
1972
1969
|
e.setAttribute("open", "");
|
|
1973
1970
|
let t = document.createElement("summary");
|
|
@@ -1982,9 +1979,9 @@ var Pn = {
|
|
|
1982
1979
|
contentDOM: n
|
|
1983
1980
|
};
|
|
1984
1981
|
}
|
|
1985
|
-
}), ({ levels: e =
|
|
1982
|
+
}), ({ levels: e = Ln } = {}) => [t({
|
|
1986
1983
|
key: "heading-shortcuts",
|
|
1987
|
-
keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`,
|
|
1984
|
+
keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`, Rn(e)]) ?? []),
|
|
1988
1985
|
inputRules: e.map((e) => ({
|
|
1989
1986
|
find: RegExp(`^(#{${e}})\\s$`),
|
|
1990
1987
|
replace({ match: e }) {
|
|
@@ -1994,8 +1991,8 @@ var Pn = {
|
|
|
1994
1991
|
};
|
|
1995
1992
|
}
|
|
1996
1993
|
}))
|
|
1997
|
-
})]),
|
|
1998
|
-
let { dom: a, destroy: o } =
|
|
1994
|
+
})]), Vn = (e, t, n, r, i) => {
|
|
1995
|
+
let { dom: a, destroy: o } = fn(e, t, n, i), s = a;
|
|
1999
1996
|
s.style.position = "relative", e.props.url && e.props.showPreview && (e.props.previewWidth ? s.style.width = `${e.props.previewWidth}px` : s.style.width = "fit-content");
|
|
2000
1997
|
let c = document.createElement("div");
|
|
2001
1998
|
c.className = "bn-resize-handle", c.style.left = "4px", c.style.display = "none", r.appendChild(c);
|
|
@@ -2039,15 +2036,15 @@ var Pn = {
|
|
|
2039
2036
|
o?.(), window.removeEventListener("mousemove", p), window.removeEventListener("touchmove", p), window.removeEventListener("mouseup", m), window.removeEventListener("touchend", m), s.removeEventListener("mouseenter", h), s.removeEventListener("mouseleave", g), c.removeEventListener("mousedown", _), c.removeEventListener("touchstart", _), l.removeEventListener("mousedown", v), l.removeEventListener("touchstart", v);
|
|
2040
2037
|
}
|
|
2041
2038
|
};
|
|
2042
|
-
},
|
|
2039
|
+
}, Hn = (e) => ({
|
|
2043
2040
|
url: e.src || void 0,
|
|
2044
2041
|
previewWidth: e.width || void 0,
|
|
2045
2042
|
name: e.alt || void 0
|
|
2046
|
-
}),
|
|
2043
|
+
}), Un = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>", Wn = A((e = {}) => ({
|
|
2047
2044
|
type: "image",
|
|
2048
2045
|
propSchema: {
|
|
2049
|
-
textAlignment:
|
|
2050
|
-
backgroundColor:
|
|
2046
|
+
textAlignment: K.textAlignment,
|
|
2047
|
+
backgroundColor: K.backgroundColor,
|
|
2051
2048
|
name: { default: "" },
|
|
2052
2049
|
url: { default: "" },
|
|
2053
2050
|
caption: { default: "" },
|
|
@@ -2058,26 +2055,26 @@ var Pn = {
|
|
|
2058
2055
|
}
|
|
2059
2056
|
},
|
|
2060
2057
|
content: "none"
|
|
2061
|
-
})),
|
|
2058
|
+
})), Gn = (e = {}) => (e) => {
|
|
2062
2059
|
if (e.tagName === "IMG") {
|
|
2063
2060
|
if (e.closest("figure")) return;
|
|
2064
|
-
let { backgroundColor: t } =
|
|
2061
|
+
let { backgroundColor: t } = q(e);
|
|
2065
2062
|
return {
|
|
2066
|
-
...
|
|
2063
|
+
...Hn(e),
|
|
2067
2064
|
backgroundColor: t
|
|
2068
2065
|
};
|
|
2069
2066
|
}
|
|
2070
2067
|
if (e.tagName === "FIGURE") {
|
|
2071
|
-
let t =
|
|
2068
|
+
let t = cn(e, "img");
|
|
2072
2069
|
if (!t) return;
|
|
2073
|
-
let { targetElement: n, caption: r } = t, { backgroundColor: i } =
|
|
2070
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
|
|
2074
2071
|
return {
|
|
2075
|
-
...
|
|
2072
|
+
...Hn(n),
|
|
2076
2073
|
backgroundColor: i,
|
|
2077
2074
|
caption: r
|
|
2078
2075
|
};
|
|
2079
2076
|
}
|
|
2080
|
-
},
|
|
2077
|
+
}, Kn = (e = {}) => (t, n) => {
|
|
2081
2078
|
let r = document.createElement("div");
|
|
2082
2079
|
r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>";
|
|
2083
2080
|
let i = document.createElement("div");
|
|
@@ -2085,24 +2082,21 @@ var Pn = {
|
|
|
2085
2082
|
let a = document.createElement("img");
|
|
2086
2083
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
2087
2084
|
a.src = e;
|
|
2088
|
-
}) : a.src = t.props.url, a.alt = t.props.name ||
|
|
2089
|
-
},
|
|
2090
|
-
if (!e.props.url) {
|
|
2091
|
-
let e = document.createElement("p");
|
|
2092
|
-
return e.textContent = "Add image", { dom: e };
|
|
2093
|
-
}
|
|
2085
|
+
}) : a.src = t.props.url, a.alt = t.props.name || "", a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a), Vn(t, n, { dom: i }, i, r.firstElementChild);
|
|
2086
|
+
}, qn = (e = {}) => (e, t) => {
|
|
2087
|
+
if (!e.props.url) return { dom: document.createElement("img") };
|
|
2094
2088
|
let n;
|
|
2095
|
-
return e.props.showPreview ? (n = document.createElement("img"), n.src = e.props.url, n.alt = e.props.name ||
|
|
2096
|
-
},
|
|
2089
|
+
return e.props.showPreview ? (n = document.createElement("img"), n.src = e.props.url, n.alt = e.props.name || "", e.props.previewWidth && (n.width = e.props.previewWidth)) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? pn(n, e.props.caption) : mn(n, e.props.caption) : { dom: n };
|
|
2090
|
+
}, Jn = j(Wn, (e) => ({
|
|
2097
2091
|
meta: { fileBlockAccept: ["image/*"] },
|
|
2098
|
-
parse:
|
|
2099
|
-
render:
|
|
2100
|
-
toExternalHTML:
|
|
2092
|
+
parse: Gn(e),
|
|
2093
|
+
render: Kn(e),
|
|
2094
|
+
toExternalHTML: qn(e),
|
|
2101
2095
|
runsBefore: ["file"]
|
|
2102
|
-
})),
|
|
2103
|
-
let i =
|
|
2096
|
+
})), Yn = (e, t, n) => ({ state: r, dispatch: i }) => i ? Xn(r.tr, e, t, n) : !0, Xn = (e, t, n, r) => {
|
|
2097
|
+
let i = M(Qe(e.doc, t));
|
|
2104
2098
|
if (!i.isBlockContainer) return !1;
|
|
2105
|
-
let a =
|
|
2099
|
+
let a = N(e), o = [{
|
|
2106
2100
|
type: i.bnBlock.node.type,
|
|
2107
2101
|
attrs: r ? {
|
|
2108
2102
|
...i.bnBlock.node.attrs,
|
|
@@ -2113,23 +2107,23 @@ var Pn = {
|
|
|
2113
2107
|
attrs: r ? { ...i.blockContent.node.attrs } : {}
|
|
2114
2108
|
}];
|
|
2115
2109
|
return e.split(t, 2, o), !0;
|
|
2116
|
-
},
|
|
2110
|
+
}, Zn = (e, t) => {
|
|
2117
2111
|
let { blockInfo: n, selectionEmpty: r } = e.transact((e) => ({
|
|
2118
|
-
blockInfo:
|
|
2112
|
+
blockInfo: nt(e),
|
|
2119
2113
|
selectionEmpty: e.selection.anchor === e.selection.head
|
|
2120
2114
|
}));
|
|
2121
2115
|
if (!n.isBlockContainer) return !1;
|
|
2122
2116
|
let { bnBlock: i, blockContent: a } = n;
|
|
2123
2117
|
return a.node.type.name !== t || !r ? !1 : a.node.childCount === 0 ? (e.transact((e) => {
|
|
2124
|
-
|
|
2118
|
+
Zt(e, i.beforePos, {
|
|
2125
2119
|
type: "paragraph",
|
|
2126
2120
|
props: {}
|
|
2127
2121
|
});
|
|
2128
|
-
}), !0) : a.node.childCount > 0 ? e.transact((e) => (e.deleteSelection(),
|
|
2122
|
+
}), !0) : a.node.childCount > 0 ? e.transact((e) => (e.deleteSelection(), Xn(e, e.selection.from, !0))) : !1;
|
|
2129
2123
|
};
|
|
2130
2124
|
//#endregion
|
|
2131
2125
|
//#region src/blocks/ListItem/getListItemContent.ts
|
|
2132
|
-
function
|
|
2126
|
+
function Qn(e, t, i) {
|
|
2133
2127
|
let a = n.fromSchema(t), o = e, s = document.createElement("div");
|
|
2134
2128
|
s.setAttribute("data-node-type", "blockGroup");
|
|
2135
2129
|
for (let e of Array.from(o.childNodes)) s.appendChild(e.cloneNode(!0));
|
|
@@ -2146,18 +2140,18 @@ function Zn(e, t, i) {
|
|
|
2146
2140
|
}
|
|
2147
2141
|
//#endregion
|
|
2148
2142
|
//#region src/blocks/ListItem/BulletListItem/block.ts
|
|
2149
|
-
var
|
|
2143
|
+
var $n = A(() => ({
|
|
2150
2144
|
type: "bulletListItem",
|
|
2151
|
-
propSchema: { ...
|
|
2145
|
+
propSchema: { ...K },
|
|
2152
2146
|
content: "inline"
|
|
2153
|
-
})),
|
|
2147
|
+
})), er = j($n, {
|
|
2154
2148
|
meta: { isolating: !1 },
|
|
2155
2149
|
parse(e) {
|
|
2156
2150
|
if (e.tagName !== "LI") return;
|
|
2157
2151
|
let t = e.parentElement;
|
|
2158
|
-
if (t
|
|
2152
|
+
if (t === null || t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL" || !e.closest("ul, ol")) return q(e);
|
|
2159
2153
|
},
|
|
2160
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2154
|
+
parseContent: ({ el: e, schema: t }) => Qn(e, t, "bulletListItem"),
|
|
2161
2155
|
render() {
|
|
2162
2156
|
let e = document.createElement("p");
|
|
2163
2157
|
return {
|
|
@@ -2167,7 +2161,7 @@ var Qn = A(() => ({
|
|
|
2167
2161
|
},
|
|
2168
2162
|
toExternalHTML(e) {
|
|
2169
2163
|
let t = document.createElement("li"), n = document.createElement("p");
|
|
2170
|
-
return
|
|
2164
|
+
return J(e.props, t), t.appendChild(n), {
|
|
2171
2165
|
dom: t,
|
|
2172
2166
|
contentDOM: n
|
|
2173
2167
|
};
|
|
@@ -2175,7 +2169,7 @@ var Qn = A(() => ({
|
|
|
2175
2169
|
}, [t({
|
|
2176
2170
|
key: "bullet-list-item-shortcuts",
|
|
2177
2171
|
keyboardShortcuts: {
|
|
2178
|
-
Enter: ({ editor: e }) =>
|
|
2172
|
+
Enter: ({ editor: e }) => Zn(e, "bulletListItem"),
|
|
2179
2173
|
"Mod-Shift-8": ({ editor: e }) => {
|
|
2180
2174
|
let t = e.getTextCursorPosition();
|
|
2181
2175
|
return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
|
|
@@ -2187,23 +2181,23 @@ var Qn = A(() => ({
|
|
|
2187
2181
|
inputRules: [{
|
|
2188
2182
|
find: /^\s?[-+*]\s$/,
|
|
2189
2183
|
replace({ editor: e }) {
|
|
2190
|
-
if (
|
|
2184
|
+
if (tt(e.prosemirrorState).blockNoteType !== "heading") return {
|
|
2191
2185
|
type: "bulletListItem",
|
|
2192
2186
|
props: {}
|
|
2193
2187
|
};
|
|
2194
2188
|
}
|
|
2195
2189
|
}]
|
|
2196
|
-
})]),
|
|
2190
|
+
})]), tr = A(() => ({
|
|
2197
2191
|
type: "checkListItem",
|
|
2198
2192
|
propSchema: {
|
|
2199
|
-
...
|
|
2193
|
+
...K,
|
|
2200
2194
|
checked: {
|
|
2201
2195
|
default: !1,
|
|
2202
2196
|
type: "boolean"
|
|
2203
2197
|
}
|
|
2204
2198
|
},
|
|
2205
2199
|
content: "inline"
|
|
2206
|
-
})),
|
|
2200
|
+
})), nr = j(tr, {
|
|
2207
2201
|
meta: { isolating: !1 },
|
|
2208
2202
|
parse(e) {
|
|
2209
2203
|
if (e.tagName === "input") return e.closest("[data-content-type]") || e.closest("li") ? void 0 : e.type === "checkbox" ? { checked: e.checked } : void 0;
|
|
@@ -2212,12 +2206,12 @@ var Qn = A(() => ({
|
|
|
2212
2206
|
if (t !== null && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL")) {
|
|
2213
2207
|
let t = e.querySelector("input[type=checkbox]") || null;
|
|
2214
2208
|
return t === null ? void 0 : {
|
|
2215
|
-
...
|
|
2209
|
+
...q(e),
|
|
2216
2210
|
checked: t.checked
|
|
2217
2211
|
};
|
|
2218
2212
|
}
|
|
2219
2213
|
},
|
|
2220
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2214
|
+
parseContent: ({ el: e, schema: t }) => Qn(e, t, "checkListItem"),
|
|
2221
2215
|
render(e, t) {
|
|
2222
2216
|
let n = document.createDocumentFragment(), r = document.createElement("input");
|
|
2223
2217
|
r.type = "checkbox", r.checked = e.props.checked, e.props.checked && r.setAttribute("checked", ""), r.disabled = !t.isEditable, r.addEventListener("change", () => {
|
|
@@ -2233,7 +2227,7 @@ var Qn = A(() => ({
|
|
|
2233
2227
|
let t = document.createElement("li"), n = document.createElement("input");
|
|
2234
2228
|
n.type = "checkbox", n.checked = e.props.checked, e.props.checked && n.setAttribute("checked", "");
|
|
2235
2229
|
let r = document.createElement("p");
|
|
2236
|
-
return
|
|
2230
|
+
return J(e.props, t), t.appendChild(n), t.appendChild(r), {
|
|
2237
2231
|
dom: t,
|
|
2238
2232
|
contentDOM: r
|
|
2239
2233
|
};
|
|
@@ -2242,7 +2236,7 @@ var Qn = A(() => ({
|
|
|
2242
2236
|
}, [t({
|
|
2243
2237
|
key: "check-list-item-shortcuts",
|
|
2244
2238
|
keyboardShortcuts: {
|
|
2245
|
-
Enter: ({ editor: e }) =>
|
|
2239
|
+
Enter: ({ editor: e }) => Zn(e, "checkListItem"),
|
|
2246
2240
|
"Mod-Shift-9": ({ editor: e }) => {
|
|
2247
2241
|
let t = e.getTextCursorPosition();
|
|
2248
2242
|
return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
|
|
@@ -2271,8 +2265,8 @@ var Qn = A(() => ({
|
|
|
2271
2265
|
})]);
|
|
2272
2266
|
//#endregion
|
|
2273
2267
|
//#region src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts
|
|
2274
|
-
function
|
|
2275
|
-
let i = !!e.firstChild.attrs.start, a =
|
|
2268
|
+
function rr(e, t, n, r) {
|
|
2269
|
+
let i = !!e.firstChild.attrs.start, a = M({
|
|
2276
2270
|
posBeforeNode: t,
|
|
2277
2271
|
node: e
|
|
2278
2272
|
});
|
|
@@ -2291,7 +2285,7 @@ function nr(e, t, n, r) {
|
|
|
2291
2285
|
pos: t
|
|
2292
2286
|
}], l = o, u = a.bnBlock.beforePos;
|
|
2293
2287
|
for (; l && r.get(l) === void 0;) {
|
|
2294
|
-
let e =
|
|
2288
|
+
let e = M({
|
|
2295
2289
|
posBeforeNode: u - l.nodeSize,
|
|
2296
2290
|
node: l
|
|
2297
2291
|
});
|
|
@@ -2303,7 +2297,7 @@ function nr(e, t, n, r) {
|
|
|
2303
2297
|
let t = n.doc.resolve(e.bnBlock.beforePos).nodeBefore;
|
|
2304
2298
|
u = e.bnBlock.beforePos, l = t;
|
|
2305
2299
|
}
|
|
2306
|
-
let d, f, p = c[c.length - 1], m =
|
|
2300
|
+
let d, f, p = c[c.length - 1], m = M({
|
|
2307
2301
|
posBeforeNode: p.pos,
|
|
2308
2302
|
node: p.node
|
|
2309
2303
|
});
|
|
@@ -2320,14 +2314,15 @@ function nr(e, t, n, r) {
|
|
|
2320
2314
|
hasStart: i
|
|
2321
2315
|
};
|
|
2322
2316
|
}
|
|
2323
|
-
function
|
|
2324
|
-
let n = /* @__PURE__ */ new Map(), r = t.decorations.map(e.mapping, e.doc), i = e.changedRange()
|
|
2325
|
-
|
|
2326
|
-
|
|
2317
|
+
function ir(e, t) {
|
|
2318
|
+
let n = /* @__PURE__ */ new Map(), r = t.decorations.map(e.mapping, e.doc), i = e.changedRange() ?? {
|
|
2319
|
+
from: 0,
|
|
2320
|
+
to: e.doc.nodeSize - 2
|
|
2321
|
+
}, a = [], o = /* @__PURE__ */ new Set();
|
|
2327
2322
|
e.doc.nodesBetween(i.from, e.doc.nodeSize - 2, (t, s, c) => {
|
|
2328
2323
|
if (c && o.has(c)) return !1;
|
|
2329
2324
|
if (t.type.name === "blockContainer" && t.firstChild.type.name === "numberedListItem") {
|
|
2330
|
-
let { index: l, isFirst: u, hasStart: d } =
|
|
2325
|
+
let { index: l, isFirst: u, hasStart: d } = rr(t, s, e, n), f = e.doc.nodeAt(s + 1);
|
|
2331
2326
|
if (r.find(s + 1, s + 1 + f.nodeSize, (e) => e.index === l && e.isFirst === u && e.hasStart === d).length === 0) a.push(be.node(s + 1, s + 1 + f.nodeSize, { "data-index": l.toString() }, {
|
|
2332
2327
|
index: l,
|
|
2333
2328
|
isFirst: u,
|
|
@@ -2339,43 +2334,43 @@ function rr(e, t) {
|
|
|
2339
2334
|
let s = a.flatMap((e) => r.find(e.from, e.to));
|
|
2340
2335
|
return { decorations: r.remove(s).add(e.doc, a) };
|
|
2341
2336
|
}
|
|
2342
|
-
var
|
|
2337
|
+
var ar = () => new ve({
|
|
2343
2338
|
key: new ye("numbered-list-indexing-decorations"),
|
|
2344
2339
|
state: {
|
|
2345
2340
|
init(e, t) {
|
|
2346
|
-
return
|
|
2341
|
+
return ir(t.tr, { decorations: xe.empty });
|
|
2347
2342
|
},
|
|
2348
2343
|
apply(e, t) {
|
|
2349
|
-
return !e.docChanged && t.decorations ? t :
|
|
2344
|
+
return !e.docChanged && t.decorations ? t : ir(e, t);
|
|
2350
2345
|
}
|
|
2351
2346
|
},
|
|
2352
2347
|
props: { decorations(e) {
|
|
2353
2348
|
return this.getState(e)?.decorations ?? xe.empty;
|
|
2354
2349
|
} }
|
|
2355
|
-
}),
|
|
2350
|
+
}), or = A(() => ({
|
|
2356
2351
|
type: "numberedListItem",
|
|
2357
2352
|
propSchema: {
|
|
2358
|
-
...
|
|
2353
|
+
...K,
|
|
2359
2354
|
start: {
|
|
2360
2355
|
default: void 0,
|
|
2361
2356
|
type: "number"
|
|
2362
2357
|
}
|
|
2363
2358
|
},
|
|
2364
2359
|
content: "inline"
|
|
2365
|
-
})),
|
|
2360
|
+
})), sr = j(or, {
|
|
2366
2361
|
meta: { isolating: !1 },
|
|
2367
2362
|
parse(e) {
|
|
2368
2363
|
if (e.tagName !== "LI") return;
|
|
2369
2364
|
let t = e.parentElement;
|
|
2370
2365
|
if (t !== null && (t.tagName === "OL" || t.tagName === "DIV" && t.parentElement?.tagName === "OL")) {
|
|
2371
|
-
let n = parseInt(t.getAttribute("start") || "1"), r =
|
|
2366
|
+
let n = parseInt(t.getAttribute("start") || "1"), r = q(e);
|
|
2372
2367
|
return e.previousElementSibling || n === 1 ? r : {
|
|
2373
2368
|
...r,
|
|
2374
2369
|
start: n
|
|
2375
2370
|
};
|
|
2376
2371
|
}
|
|
2377
2372
|
},
|
|
2378
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2373
|
+
parseContent: ({ el: e, schema: t }) => Qn(e, t, "numberedListItem"),
|
|
2379
2374
|
render() {
|
|
2380
2375
|
let e = document.createElement("p");
|
|
2381
2376
|
return {
|
|
@@ -2385,7 +2380,7 @@ var ir = () => new ve({
|
|
|
2385
2380
|
},
|
|
2386
2381
|
toExternalHTML(e) {
|
|
2387
2382
|
let t = document.createElement("li"), n = document.createElement("p");
|
|
2388
|
-
return
|
|
2383
|
+
return J(e.props, t), t.appendChild(n), {
|
|
2389
2384
|
dom: t,
|
|
2390
2385
|
contentDOM: n
|
|
2391
2386
|
};
|
|
@@ -2395,7 +2390,7 @@ var ir = () => new ve({
|
|
|
2395
2390
|
inputRules: [{
|
|
2396
2391
|
find: /^\s?(\d+)\.\s$/,
|
|
2397
2392
|
replace({ match: e, editor: t }) {
|
|
2398
|
-
if (
|
|
2393
|
+
if (tt(t.prosemirrorState).blockNoteType === "heading") return;
|
|
2399
2394
|
let n = parseInt(e[1]);
|
|
2400
2395
|
return {
|
|
2401
2396
|
type: "numberedListItem",
|
|
@@ -2404,7 +2399,7 @@ var ir = () => new ve({
|
|
|
2404
2399
|
}
|
|
2405
2400
|
}],
|
|
2406
2401
|
keyboardShortcuts: {
|
|
2407
|
-
Enter: ({ editor: e }) =>
|
|
2402
|
+
Enter: ({ editor: e }) => Zn(e, "numberedListItem"),
|
|
2408
2403
|
"Mod-Shift-7": ({ editor: e }) => {
|
|
2409
2404
|
let t = e.getTextCursorPosition();
|
|
2410
2405
|
return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
|
|
@@ -2413,30 +2408,30 @@ var ir = () => new ve({
|
|
|
2413
2408
|
}), !0) : !1;
|
|
2414
2409
|
}
|
|
2415
2410
|
},
|
|
2416
|
-
prosemirrorPlugins: [
|
|
2417
|
-
})]),
|
|
2411
|
+
prosemirrorPlugins: [ar()]
|
|
2412
|
+
})]), cr = A(() => ({
|
|
2418
2413
|
type: "toggleListItem",
|
|
2419
|
-
propSchema: { ...
|
|
2414
|
+
propSchema: { ...K },
|
|
2420
2415
|
content: "inline"
|
|
2421
|
-
})),
|
|
2416
|
+
})), lr = j(cr, {
|
|
2422
2417
|
meta: { isolating: !1 },
|
|
2423
2418
|
parse(e) {
|
|
2424
|
-
if (e.tagName === "DETAILS") return
|
|
2419
|
+
if (e.tagName === "DETAILS") return q(e);
|
|
2425
2420
|
if (e.tagName === "LI") {
|
|
2426
2421
|
let t = e.parentElement;
|
|
2427
|
-
if (t && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL") && e.querySelector(":scope > details")) return
|
|
2422
|
+
if (t && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL") && e.querySelector(":scope > details")) return q(e);
|
|
2428
2423
|
}
|
|
2429
2424
|
},
|
|
2430
2425
|
parseContent: ({ el: e, schema: t }) => {
|
|
2431
2426
|
let n = e.tagName === "DETAILS" ? e : e.querySelector(":scope > details");
|
|
2432
2427
|
if (!n) throw Error("No details found in toggleListItem parseContent");
|
|
2433
|
-
return
|
|
2428
|
+
return Pn(n, t, "toggleListItem");
|
|
2434
2429
|
},
|
|
2435
2430
|
runsBefore: ["bulletListItem"],
|
|
2436
2431
|
render(e, t) {
|
|
2437
2432
|
let n = document.createElement("p");
|
|
2438
2433
|
return {
|
|
2439
|
-
...
|
|
2434
|
+
...In(e, t, n),
|
|
2440
2435
|
contentDOM: n
|
|
2441
2436
|
};
|
|
2442
2437
|
},
|
|
@@ -2444,7 +2439,7 @@ var ir = () => new ve({
|
|
|
2444
2439
|
let t = document.createElement("li"), n = document.createElement("details");
|
|
2445
2440
|
n.setAttribute("open", "");
|
|
2446
2441
|
let r = document.createElement("summary"), i = document.createElement("p");
|
|
2447
|
-
return r.appendChild(i), n.appendChild(r),
|
|
2442
|
+
return r.appendChild(i), n.appendChild(r), J(e.props, t), t.appendChild(n), {
|
|
2448
2443
|
dom: t,
|
|
2449
2444
|
contentDOM: i,
|
|
2450
2445
|
childrenDOM: n
|
|
@@ -2453,7 +2448,7 @@ var ir = () => new ve({
|
|
|
2453
2448
|
}, [t({
|
|
2454
2449
|
key: "toggle-list-item-shortcuts",
|
|
2455
2450
|
keyboardShortcuts: {
|
|
2456
|
-
Enter: ({ editor: e }) =>
|
|
2451
|
+
Enter: ({ editor: e }) => Zn(e, "toggleListItem"),
|
|
2457
2452
|
"Mod-Shift-6": ({ editor: e }) => {
|
|
2458
2453
|
let t = e.getTextCursorPosition();
|
|
2459
2454
|
return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
|
|
@@ -2462,11 +2457,11 @@ var ir = () => new ve({
|
|
|
2462
2457
|
}), !0) : !1;
|
|
2463
2458
|
}
|
|
2464
2459
|
}
|
|
2465
|
-
})]),
|
|
2460
|
+
})]), ur = A(() => ({
|
|
2466
2461
|
type: "pageBreak",
|
|
2467
2462
|
propSchema: {},
|
|
2468
2463
|
content: "none"
|
|
2469
|
-
})),
|
|
2464
|
+
})), dr = j(ur, {
|
|
2470
2465
|
parse(e) {
|
|
2471
2466
|
if (e.tagName === "DIV" && e.hasAttribute("data-page-break")) return {};
|
|
2472
2467
|
},
|
|
@@ -2478,14 +2473,14 @@ var ir = () => new ve({
|
|
|
2478
2473
|
let e = document.createElement("div");
|
|
2479
2474
|
return e.setAttribute("data-page-break", ""), { dom: e };
|
|
2480
2475
|
}
|
|
2481
|
-
}),
|
|
2476
|
+
}), fr = (e) => e.extend({ blockSpecs: { pageBreak: dr() } }), pr = A(() => ({
|
|
2482
2477
|
type: "paragraph",
|
|
2483
|
-
propSchema:
|
|
2478
|
+
propSchema: K,
|
|
2484
2479
|
content: "inline"
|
|
2485
|
-
})),
|
|
2480
|
+
})), mr = j(pr, {
|
|
2486
2481
|
meta: { isolating: !1 },
|
|
2487
2482
|
parse: (e) => {
|
|
2488
|
-
if (e.tagName === "P" && e.textContent?.trim()) return
|
|
2483
|
+
if (e.tagName === "P" && e.textContent?.trim()) return q(e);
|
|
2489
2484
|
},
|
|
2490
2485
|
render: () => {
|
|
2491
2486
|
let e = document.createElement("p");
|
|
@@ -2496,7 +2491,7 @@ var ir = () => new ve({
|
|
|
2496
2491
|
},
|
|
2497
2492
|
toExternalHTML: (e) => {
|
|
2498
2493
|
let t = document.createElement("p");
|
|
2499
|
-
return
|
|
2494
|
+
return J(e.props, t), {
|
|
2500
2495
|
dom: t,
|
|
2501
2496
|
contentDOM: t
|
|
2502
2497
|
};
|
|
@@ -2511,18 +2506,18 @@ var ir = () => new ve({
|
|
|
2511
2506
|
props: {}
|
|
2512
2507
|
}), !0) : !1;
|
|
2513
2508
|
} }
|
|
2514
|
-
})]),
|
|
2509
|
+
})]), hr = A(() => ({
|
|
2515
2510
|
type: "quote",
|
|
2516
2511
|
propSchema: {
|
|
2517
|
-
backgroundColor:
|
|
2518
|
-
textColor:
|
|
2512
|
+
backgroundColor: K.backgroundColor,
|
|
2513
|
+
textColor: K.textColor
|
|
2519
2514
|
},
|
|
2520
2515
|
content: "inline"
|
|
2521
|
-
})),
|
|
2516
|
+
})), gr = j(hr, {
|
|
2522
2517
|
meta: { isolating: !1 },
|
|
2523
2518
|
parse(e) {
|
|
2524
2519
|
if (e.tagName === "BLOCKQUOTE") {
|
|
2525
|
-
let { backgroundColor: t, textColor: n } =
|
|
2520
|
+
let { backgroundColor: t, textColor: n } = q(e);
|
|
2526
2521
|
return {
|
|
2527
2522
|
backgroundColor: t,
|
|
2528
2523
|
textColor: n
|
|
@@ -2538,7 +2533,7 @@ var ir = () => new ve({
|
|
|
2538
2533
|
},
|
|
2539
2534
|
toExternalHTML(e) {
|
|
2540
2535
|
let t = document.createElement("blockquote");
|
|
2541
|
-
return
|
|
2536
|
+
return J(e.props, t), {
|
|
2542
2537
|
dom: t,
|
|
2543
2538
|
contentDOM: t
|
|
2544
2539
|
};
|
|
@@ -2569,7 +2564,7 @@ var ir = () => new ve({
|
|
|
2569
2564
|
};
|
|
2570
2565
|
}
|
|
2571
2566
|
}]
|
|
2572
|
-
})]),
|
|
2567
|
+
})]), _r = 120, vr = 31, yr = s.create({
|
|
2573
2568
|
name: "BlockNoteTableExtension",
|
|
2574
2569
|
addProseMirrorPlugins: () => [le({
|
|
2575
2570
|
cellMinWidth: 35,
|
|
@@ -2581,7 +2576,7 @@ var ir = () => new ve({
|
|
|
2581
2576
|
Enter: () => this.editor.state.selection.$head.parent.type.name === "tableParagraph" ? this.editor.commands.command(({ state: e, dispatch: t }) => {
|
|
2582
2577
|
if (!de(e)) return !1;
|
|
2583
2578
|
let n = pe(me(e), "vert", 1);
|
|
2584
|
-
return n ? (t && t(e.tr.setSelection(
|
|
2579
|
+
return n ? (t && t(e.tr.setSelection(y.between(n, fe(n))).scrollIntoView()), !0) : !1;
|
|
2585
2580
|
}) : !1,
|
|
2586
2581
|
Backspace: () => {
|
|
2587
2582
|
let e = this.editor.state.selection, t = e.empty, n = e.$head.parentOffset === 0, r = e.$head.node().type.name === "tableParagraph";
|
|
@@ -2598,7 +2593,7 @@ var ir = () => new ve({
|
|
|
2598
2593
|
storage: e.storage
|
|
2599
2594
|
})) };
|
|
2600
2595
|
}
|
|
2601
|
-
}),
|
|
2596
|
+
}), br = { textColor: K.textColor }, xr = u.create({
|
|
2602
2597
|
name: "tableHeader",
|
|
2603
2598
|
addOptions() {
|
|
2604
2599
|
return { HTMLAttributes: {} };
|
|
@@ -2622,7 +2617,7 @@ var ir = () => new ve({
|
|
|
2622
2617
|
parseHTML() {
|
|
2623
2618
|
return [{
|
|
2624
2619
|
tag: "th",
|
|
2625
|
-
getContent: (e, t) =>
|
|
2620
|
+
getContent: (e, t) => Er(e, t)
|
|
2626
2621
|
}];
|
|
2627
2622
|
},
|
|
2628
2623
|
renderHTML({ HTMLAttributes: e }) {
|
|
@@ -2632,7 +2627,7 @@ var ir = () => new ve({
|
|
|
2632
2627
|
0
|
|
2633
2628
|
];
|
|
2634
2629
|
}
|
|
2635
|
-
}),
|
|
2630
|
+
}), Sr = u.create({
|
|
2636
2631
|
name: "tableCell",
|
|
2637
2632
|
addOptions() {
|
|
2638
2633
|
return { HTMLAttributes: {} };
|
|
@@ -2656,7 +2651,7 @@ var ir = () => new ve({
|
|
|
2656
2651
|
parseHTML() {
|
|
2657
2652
|
return [{
|
|
2658
2653
|
tag: "td",
|
|
2659
|
-
getContent: (e, t) =>
|
|
2654
|
+
getContent: (e, t) => Er(e, t)
|
|
2660
2655
|
}];
|
|
2661
2656
|
},
|
|
2662
2657
|
renderHTML({ HTMLAttributes: e }) {
|
|
@@ -2666,7 +2661,7 @@ var ir = () => new ve({
|
|
|
2666
2661
|
0
|
|
2667
2662
|
];
|
|
2668
2663
|
}
|
|
2669
|
-
}),
|
|
2664
|
+
}), Cr = u.create({
|
|
2670
2665
|
name: "table",
|
|
2671
2666
|
content: "tableRow+",
|
|
2672
2667
|
group: "blockContent",
|
|
@@ -2706,7 +2701,7 @@ var ir = () => new ve({
|
|
|
2706
2701
|
}
|
|
2707
2702
|
update(e) {
|
|
2708
2703
|
if (!super.update(e)) return !1;
|
|
2709
|
-
for (let [t, n] of Object.entries(
|
|
2704
|
+
for (let [t, n] of Object.entries(br)) {
|
|
2710
2705
|
let r = O(t), i = e.attrs[t];
|
|
2711
2706
|
i === n.default ? this.dom.removeAttribute(r) : this.dom.setAttribute(r, String(i));
|
|
2712
2707
|
}
|
|
@@ -2719,7 +2714,7 @@ var ir = () => new ve({
|
|
|
2719
2714
|
});
|
|
2720
2715
|
};
|
|
2721
2716
|
}
|
|
2722
|
-
}),
|
|
2717
|
+
}), wr = u.create({
|
|
2723
2718
|
name: "tableParagraph",
|
|
2724
2719
|
group: "tableContent",
|
|
2725
2720
|
content: "inline*",
|
|
@@ -2741,7 +2736,7 @@ var ir = () => new ve({
|
|
|
2741
2736
|
0
|
|
2742
2737
|
];
|
|
2743
2738
|
}
|
|
2744
|
-
}),
|
|
2739
|
+
}), Tr = u.create({
|
|
2745
2740
|
name: "tableRow",
|
|
2746
2741
|
addOptions() {
|
|
2747
2742
|
return { HTMLAttributes: {} };
|
|
@@ -2760,24 +2755,24 @@ var ir = () => new ve({
|
|
|
2760
2755
|
];
|
|
2761
2756
|
}
|
|
2762
2757
|
});
|
|
2763
|
-
function
|
|
2758
|
+
function Er(e, t) {
|
|
2764
2759
|
let i = n.fromSchema(t).parse(e, { topNode: t.nodes.blockGroup.create() }), a = [];
|
|
2765
2760
|
return i.content.descendants((e) => {
|
|
2766
2761
|
if (e.isInline) return a.push(e), !1;
|
|
2767
2762
|
}), r.fromArray(a);
|
|
2768
2763
|
}
|
|
2769
|
-
var
|
|
2770
|
-
node:
|
|
2764
|
+
var Dr = () => Je({
|
|
2765
|
+
node: Cr,
|
|
2771
2766
|
type: "table",
|
|
2772
2767
|
content: "table"
|
|
2773
|
-
},
|
|
2768
|
+
}, br, [t({
|
|
2774
2769
|
key: "table-extensions",
|
|
2775
2770
|
tiptapExtensions: [
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
br,
|
|
2771
|
+
yr,
|
|
2772
|
+
wr,
|
|
2779
2773
|
xr,
|
|
2780
|
-
|
|
2774
|
+
Sr,
|
|
2775
|
+
Tr
|
|
2781
2776
|
]
|
|
2782
2777
|
}), t({
|
|
2783
2778
|
key: "table-keyboard-delete",
|
|
@@ -2795,14 +2790,15 @@ var Er = () => Je({
|
|
|
2795
2790
|
(e.getPrevBlock(t) || e.getNextBlock(t)) && e.setTextCursorPosition(t), e.removeBlocks([t]);
|
|
2796
2791
|
}), !0);
|
|
2797
2792
|
} }
|
|
2798
|
-
})]),
|
|
2793
|
+
})]), Or = (e) => ({
|
|
2799
2794
|
url: e.src || void 0,
|
|
2800
|
-
previewWidth: e.width || void 0
|
|
2801
|
-
|
|
2795
|
+
previewWidth: e.width || void 0,
|
|
2796
|
+
name: e.getAttribute("data-name") || void 0
|
|
2797
|
+
}), kr = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z\"></path></svg>", Ar = A((e) => ({
|
|
2802
2798
|
type: "video",
|
|
2803
2799
|
propSchema: {
|
|
2804
|
-
textAlignment:
|
|
2805
|
-
backgroundColor:
|
|
2800
|
+
textAlignment: K.textAlignment,
|
|
2801
|
+
backgroundColor: K.backgroundColor,
|
|
2806
2802
|
name: { default: "" },
|
|
2807
2803
|
url: { default: "" },
|
|
2808
2804
|
caption: { default: "" },
|
|
@@ -2813,28 +2809,28 @@ var Er = () => Je({
|
|
|
2813
2809
|
}
|
|
2814
2810
|
},
|
|
2815
2811
|
content: "none"
|
|
2816
|
-
})),
|
|
2812
|
+
})), jr = (e) => (e) => {
|
|
2817
2813
|
if (e.tagName === "VIDEO") {
|
|
2818
2814
|
if (e.closest("figure")) return;
|
|
2819
|
-
let { backgroundColor: t } =
|
|
2815
|
+
let { backgroundColor: t } = q(e);
|
|
2820
2816
|
return {
|
|
2821
|
-
...
|
|
2817
|
+
...Or(e),
|
|
2822
2818
|
backgroundColor: t
|
|
2823
2819
|
};
|
|
2824
2820
|
}
|
|
2825
2821
|
if (e.tagName === "FIGURE") {
|
|
2826
|
-
let t =
|
|
2822
|
+
let t = cn(e, "video");
|
|
2827
2823
|
if (!t) return;
|
|
2828
|
-
let { targetElement: n, caption: r } = t, { backgroundColor: i } =
|
|
2824
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
|
|
2829
2825
|
return {
|
|
2830
|
-
...
|
|
2826
|
+
...Or(n),
|
|
2831
2827
|
backgroundColor: i,
|
|
2832
2828
|
caption: r
|
|
2833
2829
|
};
|
|
2834
2830
|
}
|
|
2835
|
-
},
|
|
2831
|
+
}, Mr = j(Ar, (e) => ({
|
|
2836
2832
|
meta: { fileBlockAccept: ["video/*"] },
|
|
2837
|
-
parse:
|
|
2833
|
+
parse: jr(e),
|
|
2838
2834
|
render(t, n) {
|
|
2839
2835
|
let r = document.createElement("div");
|
|
2840
2836
|
r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z\"></path></svg>";
|
|
@@ -2843,18 +2839,15 @@ var Er = () => Je({
|
|
|
2843
2839
|
let a = document.createElement("video");
|
|
2844
2840
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
2845
2841
|
a.src = e;
|
|
2846
|
-
}) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, a.width = t.props.previewWidth, i.appendChild(a),
|
|
2842
|
+
}) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a), Vn(t, n, { dom: i }, i, r.firstElementChild);
|
|
2847
2843
|
},
|
|
2848
2844
|
toExternalHTML(e) {
|
|
2849
|
-
if (!e.props.url) {
|
|
2850
|
-
let e = document.createElement("p");
|
|
2851
|
-
return e.textContent = "Add video", { dom: e };
|
|
2852
|
-
}
|
|
2845
|
+
if (!e.props.url) return { dom: document.createElement("video") };
|
|
2853
2846
|
let t;
|
|
2854
|
-
return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, e.props.previewWidth && (t.width = e.props.previewWidth)) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
2847
|
+
return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, e.props.previewWidth && (t.width = e.props.previewWidth)) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? pn(t, e.props.caption) : mn(t, e.props.caption) : { dom: t };
|
|
2855
2848
|
},
|
|
2856
2849
|
runsBefore: ["file"]
|
|
2857
|
-
})),
|
|
2850
|
+
})), Nr = async (e) => {
|
|
2858
2851
|
let t = new FormData();
|
|
2859
2852
|
return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
2860
2853
|
method: "POST",
|
|
@@ -2863,7 +2856,7 @@ var Er = () => Je({
|
|
|
2863
2856
|
};
|
|
2864
2857
|
//#endregion
|
|
2865
2858
|
//#region src/blocks/defaultBlockTypeGuards.ts
|
|
2866
|
-
function
|
|
2859
|
+
function X(e, t, n) {
|
|
2867
2860
|
if (!(t in e.schema.blockSpecs)) return !1;
|
|
2868
2861
|
if (!n) return !0;
|
|
2869
2862
|
for (let [r, i] of Object.entries(n)) {
|
|
@@ -2879,28 +2872,64 @@ function Z(e, t, n) {
|
|
|
2879
2872
|
}
|
|
2880
2873
|
return !0;
|
|
2881
2874
|
}
|
|
2882
|
-
function
|
|
2883
|
-
return
|
|
2875
|
+
function Pr(e, t, n, r) {
|
|
2876
|
+
return X(t, n, r) && e.type === n;
|
|
2884
2877
|
}
|
|
2885
|
-
function
|
|
2878
|
+
function Fr(e) {
|
|
2886
2879
|
return e instanceof oe;
|
|
2887
2880
|
}
|
|
2888
2881
|
//#endregion
|
|
2889
|
-
//#region src/
|
|
2890
|
-
var
|
|
2891
|
-
|
|
2892
|
-
|
|
2882
|
+
//#region src/extensions/FormattingToolbar/FormattingToolbar.ts
|
|
2883
|
+
var Z = t(({ editor: t }) => {
|
|
2884
|
+
let n = e(!1), r = () => t.transact((e) => {
|
|
2885
|
+
if (e.selection.empty || e.selection instanceof y && e.doc.textBetween(e.selection.from, e.selection.to).length === 0) return !1;
|
|
2886
|
+
let t = !1;
|
|
2887
|
+
return e.selection.content().content.descendants((e) => (e.type.spec.code && (t = !0), !t)), !t;
|
|
2888
|
+
});
|
|
2889
|
+
return {
|
|
2890
|
+
key: "formattingToolbar",
|
|
2891
|
+
store: n,
|
|
2892
|
+
mount({ dom: e, signal: i }) {
|
|
2893
|
+
let a = !1, o = !1, s = t.onChange(() => {
|
|
2894
|
+
a || o || n.setState(r());
|
|
2895
|
+
}), c = t.onSelectionChange(() => {
|
|
2896
|
+
a || o || n.setState(r());
|
|
2897
|
+
});
|
|
2898
|
+
e.addEventListener("pointerdown", () => {
|
|
2899
|
+
a = !0, n.setState(!1);
|
|
2900
|
+
}, { signal: i }), t.prosemirrorView.root.addEventListener("pointerup", () => {
|
|
2901
|
+
a = !1, t.isFocused() && n.setState(r());
|
|
2902
|
+
}, {
|
|
2903
|
+
signal: i,
|
|
2904
|
+
capture: !0
|
|
2905
|
+
}), e.addEventListener("pointercancel", () => {
|
|
2906
|
+
a = !0;
|
|
2907
|
+
}, {
|
|
2908
|
+
signal: i,
|
|
2909
|
+
capture: !0
|
|
2910
|
+
}), t.prosemirrorView.root.addEventListener("dragstart", () => {
|
|
2911
|
+
o = !0, n.setState(!1);
|
|
2912
|
+
}, { signal: i }), t.prosemirrorView.root.addEventListener("dragend", () => {
|
|
2913
|
+
o = !1;
|
|
2914
|
+
}, { signal: i }), i.addEventListener("abort", () => {
|
|
2915
|
+
s(), c();
|
|
2916
|
+
});
|
|
2917
|
+
}
|
|
2918
|
+
};
|
|
2919
|
+
}), Ir = /* @__PURE__ */ new Map();
|
|
2920
|
+
function Lr(e) {
|
|
2921
|
+
if (Ir.has(e)) return Ir.get(e);
|
|
2893
2922
|
let t = new a();
|
|
2894
2923
|
return e._tiptapEditor.on("transaction", ({ transaction: e }) => {
|
|
2895
2924
|
t.appendMapping(e.mapping);
|
|
2896
2925
|
}), e._tiptapEditor.on("destroy", () => {
|
|
2897
|
-
|
|
2898
|
-
}),
|
|
2926
|
+
Ir.delete(e);
|
|
2927
|
+
}), Ir.set(e, t), t;
|
|
2899
2928
|
}
|
|
2900
|
-
function
|
|
2929
|
+
function Rr(e, t, n = "left") {
|
|
2901
2930
|
let r = Ee.getState(e.prosemirrorState);
|
|
2902
2931
|
if (!r) {
|
|
2903
|
-
let r =
|
|
2932
|
+
let r = Lr(e), i = r.maps.length;
|
|
2904
2933
|
return () => r.slice(i).map(t, n === "left" ? -1 : 1);
|
|
2905
2934
|
}
|
|
2906
2935
|
let i = we(t + (n === "right" ? 1 : -1), r.binding.type, r.binding.mapping);
|
|
@@ -2912,7 +2941,7 @@ function Lr(e, t, n = "left") {
|
|
|
2912
2941
|
}
|
|
2913
2942
|
//#endregion
|
|
2914
2943
|
//#region src/extensions/SuggestionMenu/SuggestionMenu.ts
|
|
2915
|
-
var
|
|
2944
|
+
var zr = m((e) => e.type.name === "blockContainer"), Br = class {
|
|
2916
2945
|
state;
|
|
2917
2946
|
emitUpdate;
|
|
2918
2947
|
rootEl;
|
|
@@ -2959,7 +2988,7 @@ var Rr = m((e) => e.type.name === "blockContainer"), zr = class {
|
|
|
2959
2988
|
to: this.editor.transact((e) => e.selection.from)
|
|
2960
2989
|
}).run();
|
|
2961
2990
|
};
|
|
2962
|
-
}, Q = new
|
|
2991
|
+
}, Q = new te("SuggestionMenuPlugin"), Vr = t(({ editor: t }) => {
|
|
2963
2992
|
let n = /* @__PURE__ */ new Map(), r, i = e(void 0);
|
|
2964
2993
|
return {
|
|
2965
2994
|
key: "suggestionMenu",
|
|
@@ -2986,9 +3015,9 @@ var Rr = m((e) => e.type.name === "blockContainer"), zr = class {
|
|
|
2986
3015
|
});
|
|
2987
3016
|
}));
|
|
2988
3017
|
},
|
|
2989
|
-
prosemirrorPlugins: [new
|
|
3018
|
+
prosemirrorPlugins: [new ee({
|
|
2990
3019
|
key: Q,
|
|
2991
|
-
view: (e) => (r = new
|
|
3020
|
+
view: (e) => (r = new Br(t, (e, t) => {
|
|
2992
3021
|
i.setState({
|
|
2993
3022
|
...t,
|
|
2994
3023
|
triggerCharacter: e
|
|
@@ -3001,7 +3030,7 @@ var Rr = m((e) => e.type.name === "blockContainer"), zr = class {
|
|
|
3001
3030
|
let o = e.getMeta(Q);
|
|
3002
3031
|
if (typeof o == "object" && o) {
|
|
3003
3032
|
n && r?.closeMenu();
|
|
3004
|
-
let e =
|
|
3033
|
+
let e = Rr(t, a.selection.from - o.triggerCharacter.length);
|
|
3005
3034
|
return {
|
|
3006
3035
|
triggerCharacter: o.triggerCharacter,
|
|
3007
3036
|
deleteTriggerCharacter: o.deleteTriggerCharacter !== !1,
|
|
@@ -3035,7 +3064,7 @@ var Rr = m((e) => e.type.name === "blockContainer"), zr = class {
|
|
|
3035
3064
|
let t = this.getState(e);
|
|
3036
3065
|
if (t === void 0) return null;
|
|
3037
3066
|
if (!t.deleteTriggerCharacter) {
|
|
3038
|
-
let n =
|
|
3067
|
+
let n = zr(e.selection);
|
|
3039
3068
|
if (n) return Ce.create(e.doc, [Se.node(n.pos, n.pos + n.node.nodeSize, {
|
|
3040
3069
|
nodeName: "span",
|
|
3041
3070
|
class: "bn-suggestion-decorator",
|
|
@@ -3054,7 +3083,7 @@ var Rr = m((e) => e.type.name === "blockContainer"), zr = class {
|
|
|
3054
3083
|
});
|
|
3055
3084
|
//#endregion
|
|
3056
3085
|
//#region src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts
|
|
3057
|
-
function
|
|
3086
|
+
function Hr(e) {
|
|
3058
3087
|
let t = e.getTextCursorPosition().block, n = e.schema.blockSchema[t.type].content;
|
|
3059
3088
|
for (; n === "none";) {
|
|
3060
3089
|
if (t = e.getTextCursorPosition().nextBlock, t === void 0) return;
|
|
@@ -3065,11 +3094,11 @@ function $(e, t) {
|
|
|
3065
3094
|
let n = e.getTextCursorPosition().block;
|
|
3066
3095
|
if (n.content === void 0) throw Error("Slash Menu open in a block that doesn't contain content.");
|
|
3067
3096
|
let r;
|
|
3068
|
-
return Array.isArray(n.content) && (n.content.length === 1 && b(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (r = e.updateBlock(n, t), e.setTextCursorPosition(r)) : (r = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)),
|
|
3097
|
+
return Array.isArray(n.content) && (n.content.length === 1 && b(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (r = e.updateBlock(n, t), e.setTextCursorPosition(r)) : (r = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)), Hr(e), r;
|
|
3069
3098
|
}
|
|
3070
|
-
function
|
|
3099
|
+
function Ur(e) {
|
|
3071
3100
|
let t = [];
|
|
3072
|
-
return
|
|
3101
|
+
return X(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((e) => e <= 3).forEach((n) => {
|
|
3073
3102
|
t.push({
|
|
3074
3103
|
onItemClick: () => {
|
|
3075
3104
|
$(e, {
|
|
@@ -3081,61 +3110,61 @@ function Hr(e) {
|
|
|
3081
3110
|
key: n === 1 ? "heading" : `heading_${n}`,
|
|
3082
3111
|
...e.dictionary.slash_menu[n === 1 ? "heading" : `heading_${n}`]
|
|
3083
3112
|
});
|
|
3084
|
-
}),
|
|
3113
|
+
}), X(e, "quote") && t.push({
|
|
3085
3114
|
onItemClick: () => {
|
|
3086
3115
|
$(e, { type: "quote" });
|
|
3087
3116
|
},
|
|
3088
3117
|
key: "quote",
|
|
3089
3118
|
...e.dictionary.slash_menu.quote
|
|
3090
|
-
}),
|
|
3119
|
+
}), X(e, "toggleListItem") && t.push({
|
|
3091
3120
|
onItemClick: () => {
|
|
3092
3121
|
$(e, { type: "toggleListItem" });
|
|
3093
3122
|
},
|
|
3094
3123
|
badge: E("Mod-Shift-6"),
|
|
3095
3124
|
key: "toggle_list",
|
|
3096
3125
|
...e.dictionary.slash_menu.toggle_list
|
|
3097
|
-
}),
|
|
3126
|
+
}), X(e, "numberedListItem") && t.push({
|
|
3098
3127
|
onItemClick: () => {
|
|
3099
3128
|
$(e, { type: "numberedListItem" });
|
|
3100
3129
|
},
|
|
3101
3130
|
badge: E("Mod-Shift-7"),
|
|
3102
3131
|
key: "numbered_list",
|
|
3103
3132
|
...e.dictionary.slash_menu.numbered_list
|
|
3104
|
-
}),
|
|
3133
|
+
}), X(e, "bulletListItem") && t.push({
|
|
3105
3134
|
onItemClick: () => {
|
|
3106
3135
|
$(e, { type: "bulletListItem" });
|
|
3107
3136
|
},
|
|
3108
3137
|
badge: E("Mod-Shift-8"),
|
|
3109
3138
|
key: "bullet_list",
|
|
3110
3139
|
...e.dictionary.slash_menu.bullet_list
|
|
3111
|
-
}),
|
|
3140
|
+
}), X(e, "checkListItem") && t.push({
|
|
3112
3141
|
onItemClick: () => {
|
|
3113
3142
|
$(e, { type: "checkListItem" });
|
|
3114
3143
|
},
|
|
3115
3144
|
badge: E("Mod-Shift-9"),
|
|
3116
3145
|
key: "check_list",
|
|
3117
3146
|
...e.dictionary.slash_menu.check_list
|
|
3118
|
-
}),
|
|
3147
|
+
}), X(e, "paragraph") && t.push({
|
|
3119
3148
|
onItemClick: () => {
|
|
3120
3149
|
$(e, { type: "paragraph" });
|
|
3121
3150
|
},
|
|
3122
3151
|
badge: E("Mod-Alt-0"),
|
|
3123
3152
|
key: "paragraph",
|
|
3124
3153
|
...e.dictionary.slash_menu.paragraph
|
|
3125
|
-
}),
|
|
3154
|
+
}), X(e, "codeBlock") && t.push({
|
|
3126
3155
|
onItemClick: () => {
|
|
3127
3156
|
$(e, { type: "codeBlock" });
|
|
3128
3157
|
},
|
|
3129
3158
|
badge: E("Mod-Alt-c"),
|
|
3130
3159
|
key: "code_block",
|
|
3131
3160
|
...e.dictionary.slash_menu.code_block
|
|
3132
|
-
}),
|
|
3161
|
+
}), X(e, "divider") && t.push({
|
|
3133
3162
|
onItemClick: () => {
|
|
3134
3163
|
$(e, { type: "divider" });
|
|
3135
3164
|
},
|
|
3136
3165
|
key: "divider",
|
|
3137
3166
|
...e.dictionary.slash_menu.divider
|
|
3138
|
-
}),
|
|
3167
|
+
}), X(e, "table") && t.push({
|
|
3139
3168
|
onItemClick: () => {
|
|
3140
3169
|
$(e, {
|
|
3141
3170
|
type: "table",
|
|
@@ -3156,35 +3185,35 @@ function Hr(e) {
|
|
|
3156
3185
|
badge: void 0,
|
|
3157
3186
|
key: "table",
|
|
3158
3187
|
...e.dictionary.slash_menu.table
|
|
3159
|
-
}),
|
|
3188
|
+
}), X(e, "image", { url: "string" }) && t.push({
|
|
3160
3189
|
onItemClick: () => {
|
|
3161
3190
|
let t = $(e, { type: "image" });
|
|
3162
|
-
e.getExtension(
|
|
3191
|
+
e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3163
3192
|
},
|
|
3164
3193
|
key: "image",
|
|
3165
3194
|
...e.dictionary.slash_menu.image
|
|
3166
|
-
}),
|
|
3195
|
+
}), X(e, "video", { url: "string" }) && t.push({
|
|
3167
3196
|
onItemClick: () => {
|
|
3168
3197
|
let t = $(e, { type: "video" });
|
|
3169
|
-
e.getExtension(
|
|
3198
|
+
e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3170
3199
|
},
|
|
3171
3200
|
key: "video",
|
|
3172
3201
|
...e.dictionary.slash_menu.video
|
|
3173
|
-
}),
|
|
3202
|
+
}), X(e, "audio", { url: "string" }) && t.push({
|
|
3174
3203
|
onItemClick: () => {
|
|
3175
3204
|
let t = $(e, { type: "audio" });
|
|
3176
|
-
e.getExtension(
|
|
3205
|
+
e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3177
3206
|
},
|
|
3178
3207
|
key: "audio",
|
|
3179
3208
|
...e.dictionary.slash_menu.audio
|
|
3180
|
-
}),
|
|
3209
|
+
}), X(e, "file", { url: "string" }) && t.push({
|
|
3181
3210
|
onItemClick: () => {
|
|
3182
3211
|
let t = $(e, { type: "file" });
|
|
3183
|
-
e.getExtension(
|
|
3212
|
+
e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3184
3213
|
},
|
|
3185
3214
|
key: "file",
|
|
3186
3215
|
...e.dictionary.slash_menu.file
|
|
3187
|
-
}),
|
|
3216
|
+
}), X(e, "heading", {
|
|
3188
3217
|
level: "number",
|
|
3189
3218
|
isToggleable: "boolean"
|
|
3190
3219
|
}) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((e) => e <= 3).forEach((n) => {
|
|
@@ -3201,7 +3230,7 @@ function Hr(e) {
|
|
|
3201
3230
|
key: n === 1 ? "toggle_heading" : `toggle_heading_${n}`,
|
|
3202
3231
|
...e.dictionary.slash_menu[n === 1 ? "toggle_heading" : `toggle_heading_${n}`]
|
|
3203
3232
|
});
|
|
3204
|
-
}),
|
|
3233
|
+
}), X(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((e) => e > 3).forEach((n) => {
|
|
3205
3234
|
t.push({
|
|
3206
3235
|
onItemClick: () => {
|
|
3207
3236
|
$(e, {
|
|
@@ -3215,7 +3244,7 @@ function Hr(e) {
|
|
|
3215
3244
|
});
|
|
3216
3245
|
}), t.push({
|
|
3217
3246
|
onItemClick: () => {
|
|
3218
|
-
e.getExtension(
|
|
3247
|
+
e.getExtension(Vr)?.openSuggestionMenu(":", {
|
|
3219
3248
|
deleteTriggerCharacter: !0,
|
|
3220
3249
|
ignoreQueryLength: !0
|
|
3221
3250
|
});
|
|
@@ -3224,17 +3253,17 @@ function Hr(e) {
|
|
|
3224
3253
|
...e.dictionary.slash_menu.emoji
|
|
3225
3254
|
}), t;
|
|
3226
3255
|
}
|
|
3227
|
-
function
|
|
3256
|
+
function Wr(e, t) {
|
|
3228
3257
|
return e.filter(({ title: e, aliases: n }) => e.toLowerCase().includes(t.toLowerCase()) || n && n.filter((e) => e.toLowerCase().includes(t.toLowerCase())).length !== 0);
|
|
3229
3258
|
}
|
|
3230
3259
|
//#endregion
|
|
3231
3260
|
//#region src/blocks/PageBreak/getPageBreakSlashMenuItems.ts
|
|
3232
|
-
function
|
|
3261
|
+
function Gr(e) {
|
|
3233
3262
|
return "pageBreak" in e.schema.blockSchema;
|
|
3234
3263
|
}
|
|
3235
|
-
function
|
|
3264
|
+
function Kr(e) {
|
|
3236
3265
|
let t = [];
|
|
3237
|
-
return
|
|
3266
|
+
return Gr(e) && t.push({
|
|
3238
3267
|
...e.dictionary.slash_menu.page_break,
|
|
3239
3268
|
onItemClick: () => {
|
|
3240
3269
|
$(e, { type: "pageBreak" });
|
|
@@ -3244,22 +3273,22 @@ function Gr(e) {
|
|
|
3244
3273
|
}
|
|
3245
3274
|
//#endregion
|
|
3246
3275
|
//#region src/blocks/defaultBlocks.ts
|
|
3247
|
-
var
|
|
3248
|
-
audio:
|
|
3249
|
-
bulletListItem:
|
|
3250
|
-
checkListItem:
|
|
3251
|
-
codeBlock:
|
|
3252
|
-
divider:
|
|
3253
|
-
file:
|
|
3254
|
-
heading:
|
|
3255
|
-
image:
|
|
3256
|
-
numberedListItem:
|
|
3257
|
-
paragraph:
|
|
3258
|
-
quote:
|
|
3259
|
-
table:
|
|
3260
|
-
toggleListItem:
|
|
3261
|
-
video:
|
|
3262
|
-
},
|
|
3276
|
+
var qr = {
|
|
3277
|
+
audio: xn(),
|
|
3278
|
+
bulletListItem: er(),
|
|
3279
|
+
checkListItem: nr(),
|
|
3280
|
+
codeBlock: En(),
|
|
3281
|
+
divider: kn(),
|
|
3282
|
+
file: Nn(),
|
|
3283
|
+
heading: Bn(),
|
|
3284
|
+
image: Jn(),
|
|
3285
|
+
numberedListItem: sr(),
|
|
3286
|
+
paragraph: mr(),
|
|
3287
|
+
quote: gr(),
|
|
3288
|
+
table: Dr(),
|
|
3289
|
+
toggleListItem: lr(),
|
|
3290
|
+
video: Mr()
|
|
3291
|
+
}, Jr = bt({
|
|
3263
3292
|
type: "textColor",
|
|
3264
3293
|
propSchema: "string"
|
|
3265
3294
|
}, {
|
|
@@ -3272,7 +3301,7 @@ var Kr = {
|
|
|
3272
3301
|
},
|
|
3273
3302
|
toExternalHTML: (e) => {
|
|
3274
3303
|
let t = document.createElement("span");
|
|
3275
|
-
return e !==
|
|
3304
|
+
return e !== K.textColor.default && (t.style.color = e in G ? G[e].text : e), {
|
|
3276
3305
|
dom: t,
|
|
3277
3306
|
contentDOM: t
|
|
3278
3307
|
};
|
|
@@ -3280,7 +3309,7 @@ var Kr = {
|
|
|
3280
3309
|
parse: (e) => {
|
|
3281
3310
|
if (e.tagName === "SPAN" && e.style.color) return e.style.color;
|
|
3282
3311
|
}
|
|
3283
|
-
}),
|
|
3312
|
+
}), Yr = bt({
|
|
3284
3313
|
type: "backgroundColor",
|
|
3285
3314
|
propSchema: "string"
|
|
3286
3315
|
}, {
|
|
@@ -3293,7 +3322,7 @@ var Kr = {
|
|
|
3293
3322
|
},
|
|
3294
3323
|
toExternalHTML: (e) => {
|
|
3295
3324
|
let t = document.createElement("span");
|
|
3296
|
-
return e !==
|
|
3325
|
+
return e !== K.backgroundColor.default && (t.style.backgroundColor = e in G ? G[e].background : e), {
|
|
3297
3326
|
dom: t,
|
|
3298
3327
|
contentDOM: t
|
|
3299
3328
|
};
|
|
@@ -3301,7 +3330,7 @@ var Kr = {
|
|
|
3301
3330
|
parse: (e) => {
|
|
3302
3331
|
if (e.tagName === "SPAN" && e.style.backgroundColor) return e.style.backgroundColor;
|
|
3303
3332
|
}
|
|
3304
|
-
}),
|
|
3333
|
+
}), Xr = {
|
|
3305
3334
|
bold: z(De, "boolean"),
|
|
3306
3335
|
italic: z(ke, "boolean"),
|
|
3307
3336
|
underline: z(je, "boolean"),
|
|
@@ -3318,9 +3347,9 @@ var Kr = {
|
|
|
3318
3347
|
}
|
|
3319
3348
|
})];
|
|
3320
3349
|
} }), "boolean"),
|
|
3321
|
-
textColor:
|
|
3322
|
-
backgroundColor:
|
|
3323
|
-
},
|
|
3350
|
+
textColor: Jr,
|
|
3351
|
+
backgroundColor: Yr
|
|
3352
|
+
}, Zr = vt(Xr), Qr = {
|
|
3324
3353
|
text: {
|
|
3325
3354
|
config: "text",
|
|
3326
3355
|
implementation: {}
|
|
@@ -3329,16 +3358,16 @@ var Kr = {
|
|
|
3329
3358
|
config: "link",
|
|
3330
3359
|
implementation: {}
|
|
3331
3360
|
}
|
|
3332
|
-
},
|
|
3361
|
+
}, $r = ht(Qr), ei = class e extends At {
|
|
3333
3362
|
static create(t) {
|
|
3334
3363
|
return new e({
|
|
3335
|
-
blockSpecs: t?.blockSpecs ??
|
|
3336
|
-
inlineContentSpecs: t?.inlineContentSpecs ??
|
|
3337
|
-
styleSpecs: t?.styleSpecs ??
|
|
3364
|
+
blockSpecs: t?.blockSpecs ?? qr,
|
|
3365
|
+
inlineContentSpecs: t?.inlineContentSpecs ?? Qr,
|
|
3366
|
+
styleSpecs: t?.styleSpecs ?? Xr
|
|
3338
3367
|
});
|
|
3339
3368
|
}
|
|
3340
3369
|
};
|
|
3341
3370
|
//#endregion
|
|
3342
|
-
export {
|
|
3371
|
+
export { jn as $, mt as $t, mr as A, We as An, U as At, $n as B, Re as Bn, Ft as Bt, Dr as C, j as Cn, tn as Ct, hr as D, Ke as Dn, Jt as Dt, _r as E, qe as En, Zt as Et, lr as F, E as Fn, Bt as Ft, Jn as G, x as Gn, yt as Gt, Yn as H, Le as Hn, At as Ht, or as I, ze as In, Rt as It, qn as J, b as Jn, z as Jt, Gn as K, Fe as Kn, R as Kt, sr as L, Be as Ln, Pt as Lt, dr as M, Ve as Mn, zt as Mt, fr as N, He as Nn, Ht as Nt, gr as O, k as On, Yt as Ot, cr as P, Ue as Pn, Vt as Pt, Fn as Q, ft as Qt, nr as R, D as Rn, Nt as Rt, jr as S, A as Sn, G as St, vr as T, Je as Tn, Xt as Tt, Un as U, S as Un, Ot as Ut, er as V, w as Vn, It as Vt, Wn as W, C as Wn, bt as Wt, Bn as X, gt as Xt, zn as Y, Pe as Yn, vt as Yt, In as Z, dt as Zt, Fr as _, nt as _n, an as _t, Zr as a, L as an, En as at, Ar as b, Ze as bn, q as bt, Kr as c, F as cn, vn as ct, $ as d, ot as dn, _n as dt, pt as en, Nn as et, Vr as f, N as fn, xn as ft, X as g, tt as gn, K as gt, Pr as h, et as hn, J as ht, Qr as i, lt as in, Tn as it, ur as j, Ge as jn, Kt as jt, pr as k, O as kn, W as kt, Wr as l, it as ln, yn as lt, Z as m, M as mn, Y as mt, qr as n, I as nn, On as nt, Xr as o, ct as on, Dn as ot, Rr as p, P as pn, hn as pt, Kn as q, Ie as qn, _t as qt, $r as r, st as rn, kn as rt, Gr as s, ut as sn, gn as st, ei as t, ht as tn, Mn as tt, Ur as u, at as un, bn as ut, Nr as v, $e as vn, sn as vt, br as w, Xe as wn, en as wt, Mr as x, Ye as xn, rn as xt, kr as y, Qe as yn, on as yt, tr as z, T as zn, jt as zt };
|
|
3343
3372
|
|
|
3344
|
-
//# sourceMappingURL=blocks-
|
|
3373
|
+
//# sourceMappingURL=blocks-D0lMxErU.js.map
|