@blocknote/core 0.53.0 → 0.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BlockNoteExtension-BJCLnwrE.cjs +2 -0
- package/dist/BlockNoteExtension-BJCLnwrE.cjs.map +1 -0
- package/dist/BlockNoteExtension-CbvDA0F7.js +80 -0
- package/dist/BlockNoteExtension-CbvDA0F7.js.map +1 -0
- package/dist/{UserStore-QbbPFj0z.js → UserStore-C4TzkGEn.js} +3 -3
- package/dist/{UserStore-DCG6lsla.cjs.map → UserStore-C4TzkGEn.js.map} +1 -1
- package/dist/{UserStore-DCG6lsla.cjs → UserStore-mj3fXW4D.cjs} +2 -2
- package/dist/UserStore-mj3fXW4D.cjs.map +1 -0
- package/dist/blocknote.cjs +1 -1
- package/dist/blocknote.js +6 -6
- package/dist/blocks-CTB_5Vyj.cjs +12 -0
- package/dist/blocks-CTB_5Vyj.cjs.map +1 -0
- package/dist/{blocks-BEJW9OM_.js → blocks-Dol85hpH.js} +680 -670
- package/dist/blocks-Dol85hpH.js.map +1 -0
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/comments.cjs +1 -1
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.js +7 -7
- package/dist/comments.js.map +1 -1
- package/dist/en-BuzSuuTq.cjs +2 -0
- package/dist/en-BuzSuuTq.cjs.map +1 -0
- package/dist/{en-CGKXfWma.js → en-uzHzj6eH.js} +10 -1
- package/dist/en-uzHzj6eH.js.map +1 -0
- package/dist/extensions-B7Rsp_Ft.cjs +58 -0
- package/dist/extensions-B7Rsp_Ft.cjs.map +1 -0
- package/dist/{extensions-BR5hkAio.js → extensions-D6JcJCwd.js} +735 -457
- package/dist/extensions-D6JcJCwd.js.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +4 -4
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +199 -1
- package/dist/locales.js.map +1 -1
- package/dist/{src-BUXut68d.js → src-Buuo5l7X.js} +924 -851
- package/dist/src-Buuo5l7X.js.map +1 -0
- package/dist/src-C54Ok9E0.cjs +23 -0
- package/dist/src-C54Ok9E0.cjs.map +1 -0
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/dist/y.cjs +1 -1
- package/dist/y.cjs.map +1 -1
- package/dist/y.js +245 -242
- package/dist/y.js.map +1 -1
- package/dist/yjs.cjs +1 -1
- package/dist/yjs.cjs.map +1 -1
- package/dist/yjs.js +79 -67
- package/dist/yjs.js.map +1 -1
- package/package.json +17 -18
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +2505 -763
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +42 -0
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +16 -4
- package/src/api/exporters/markdown/htmlToMarkdown.ts +45 -10
- package/src/api/getBlocksChangedByTransaction.test.ts +211 -0
- package/src/api/getBlocksChangedByTransaction.ts +48 -12
- package/src/api/getChangedRange.ts +54 -0
- package/src/api/nodeConversions/blockToNode.ts +5 -1
- package/src/api/nodeConversions/nodeToBlock.ts +3 -0
- package/src/api/pmUtil.ts +16 -8
- package/src/blocks/Code/CodeBlockOptions.ts +83 -0
- package/src/blocks/Code/block.test.ts +1 -1
- package/src/blocks/Code/block.ts +29 -281
- package/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.ts +120 -0
- package/src/blocks/Code/helpers/parse/parsePreCode.ts +45 -0
- package/src/blocks/Code/helpers/render/createCodeBlock.ts +98 -0
- package/src/blocks/Code/helpers/toExternalHTML/createPreCode.ts +14 -0
- package/src/blocks/index.ts +3 -1
- package/src/comments/extension.ts +2 -4
- package/src/editor/Block.css +273 -2
- package/src/editor/BlockNoteEditor.ts +25 -4
- package/src/editor/BlockNoteExtension.ts +1 -1
- package/src/editor/managers/ExtensionManager/extensions.ts +6 -0
- package/src/editor/performance.test.ts +45 -0
- package/src/exporter/ExportImage.ts +50 -0
- package/src/exporter/Exporter.test.ts +186 -0
- package/src/exporter/Exporter.ts +66 -14
- package/src/exporter/index.ts +1 -0
- package/src/exporter/mapping.ts +4 -1
- package/src/extensions/FormattingToolbar/FormattingToolbar.ts +10 -8
- package/src/extensions/InlineContentBoundaryEdit/InlineContentBoundaryEdit.ts +109 -0
- package/src/extensions/PreviousBlockType/PreviousBlockType.test.ts +21 -0
- package/src/extensions/PreviousBlockType/PreviousBlockType.ts +5 -3
- package/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.ts +192 -0
- package/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.ts +142 -0
- package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.ts +120 -0
- package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.ts +89 -0
- package/src/extensions/SyntaxHighlighting/inlineHighlight.test.ts +135 -0
- package/src/extensions/SyntaxHighlighting/shiki.ts +116 -0
- package/src/extensions/TableHandles/TableHandles.browser.test.ts +305 -0
- package/src/extensions/TableHandles/TableHandles.ts +82 -41
- package/src/extensions/Versioning/inMemoryVersioning.ts +13 -3
- package/src/extensions/index.ts +4 -0
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.ts +51 -2
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +22 -2
- package/src/fonts/inter.css +9 -9
- package/src/i18n/locales/ar.ts +9 -0
- package/src/i18n/locales/de.ts +9 -0
- package/src/i18n/locales/en.ts +9 -0
- package/src/i18n/locales/es.ts +9 -0
- package/src/i18n/locales/fa.ts +9 -0
- package/src/i18n/locales/fr.ts +9 -0
- package/src/i18n/locales/he.ts +9 -0
- package/src/i18n/locales/hr.ts +9 -0
- package/src/i18n/locales/is.ts +9 -0
- package/src/i18n/locales/it.ts +9 -0
- package/src/i18n/locales/ja.ts +9 -0
- package/src/i18n/locales/ko.ts +9 -0
- package/src/i18n/locales/nl.ts +9 -0
- package/src/i18n/locales/no.ts +9 -0
- package/src/i18n/locales/pl.ts +9 -0
- package/src/i18n/locales/pt.ts +9 -0
- package/src/i18n/locales/ru.ts +9 -0
- package/src/i18n/locales/sk.ts +9 -0
- package/src/i18n/locales/uk.ts +9 -0
- package/src/i18n/locales/uz.ts +9 -0
- package/src/i18n/locales/vi.ts +9 -0
- package/src/i18n/locales/zh-tw.ts +9 -0
- package/src/i18n/locales/zh.ts +9 -0
- package/src/index.ts +5 -1
- package/src/schema/blocks/createSpec.ts +5 -7
- package/src/schema/blocks/types.ts +53 -3
- package/src/schema/contentTypePropagation.test.ts +1 -1
- package/src/schema/inlineContent/createSpec.test.ts +161 -0
- package/src/schema/inlineContent/createSpec.ts +175 -17
- package/src/schema/inlineContent/internal.ts +21 -2
- package/src/schema/inlineContent/types.ts +35 -5
- package/src/schema/nodeViewMutations.test.ts +81 -56
- package/src/schema/nodeViewMutations.ts +30 -27
- package/src/schema/schema.test.ts +110 -0
- package/src/schema/schema.ts +13 -4
- package/src/user/UserStore.ts +1 -1
- package/src/util/Store.test.ts +132 -0
- package/src/util/Store.ts +135 -0
- package/src/y/extensions/AttributionExtension.test.ts +18 -9
- package/src/y/extensions/Versioning.test.ts +20 -7
- package/src/y/versioning/__test__/yhub.test.ts +92 -59
- package/src/y/versioning/yhub.ts +35 -29
- package/src/yjs/comments/RESTYjsThreadStore.test.ts +85 -0
- package/src/yjs/comments/RESTYjsThreadStore.ts +7 -1
- package/src/yjs/extensions/ForkYDoc.test.ts +37 -0
- package/src/yjs/extensions/ForkYDoc.ts +26 -1
- package/src/yjs/extensions/RelativePositionMapping.ts +8 -2
- package/src/yjs/extensions/Versioning.test.ts +17 -5
- package/types/src/api/getChangedRange.d.ts +14 -0
- package/types/src/api/pmUtil.d.ts +7 -7
- package/types/src/blocks/Code/CodeBlockOptions.d.ts +61 -0
- package/types/src/blocks/Code/block.d.ts +3 -53
- package/types/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.d.ts +35 -0
- package/types/src/blocks/Code/helpers/parse/parsePreCode.d.ts +8 -0
- package/types/src/blocks/Code/helpers/render/createCodeBlock.d.ts +18 -0
- package/types/src/blocks/Code/helpers/toExternalHTML/createPreCode.d.ts +5 -0
- package/types/src/blocks/index.d.ts +3 -1
- package/types/src/comments/extension.d.ts +1 -15
- package/types/src/editor/BlockNoteEditor.d.ts +3 -3
- package/types/src/editor/BlockNoteExtension.d.ts +1 -1
- package/types/src/exporter/ExportImage.d.ts +36 -0
- package/types/src/exporter/Exporter.d.ts +30 -0
- package/types/src/exporter/Exporter.test.d.ts +1 -0
- package/types/src/exporter/index.d.ts +1 -0
- package/types/src/exporter/mapping.d.ts +1 -1
- package/types/src/extensions/FilePanel/FilePanel.d.ts +1 -1
- package/types/src/extensions/FormattingToolbar/FormattingToolbar.d.ts +1 -1
- package/types/src/extensions/InlineContentBoundaryEdit/InlineContentBoundaryEdit.d.ts +5 -0
- package/types/src/extensions/ShowSelection/ShowSelection.d.ts +1 -5
- package/types/src/extensions/SideMenu/SideMenu.d.ts +1 -1
- package/types/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.d.ts +45 -0
- package/types/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.d.ts +49 -0
- package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +1 -11
- package/types/src/extensions/SyntaxHighlighting/SyntaxHighlighting.d.ts +44 -0
- package/types/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.d.ts +1 -0
- package/types/src/extensions/SyntaxHighlighting/inlineHighlight.test.d.ts +1 -0
- package/types/src/extensions/SyntaxHighlighting/shiki.d.ts +13 -0
- package/types/src/extensions/TableHandles/TableHandles.browser.test.d.ts +1 -0
- package/types/src/extensions/TableHandles/TableHandles.d.ts +4 -1
- package/types/src/extensions/Versioning/Versioning.d.ts +1 -35
- package/types/src/extensions/index.d.ts +4 -0
- package/types/src/i18n/locales/en.d.ts +9 -0
- package/types/src/i18n/locales/fa.d.ts +9 -0
- package/types/src/i18n/locales/sk.d.ts +9 -0
- package/types/src/index.d.ts +2 -1
- package/types/src/schema/blocks/types.d.ts +36 -3
- package/types/src/schema/inlineContent/createSpec.d.ts +35 -3
- package/types/src/schema/inlineContent/createSpec.test.d.ts +1 -0
- package/types/src/schema/inlineContent/internal.d.ts +3 -2
- package/types/src/schema/inlineContent/types.d.ts +22 -3
- package/types/src/schema/nodeViewMutations.d.ts +2 -2
- package/types/src/schema/schema.test.d.ts +1 -0
- package/types/src/user/UserStore.d.ts +1 -1
- package/types/src/util/Store.d.ts +45 -0
- package/types/src/util/Store.test.d.ts +1 -0
- package/types/src/y/extensions/AttributionExtension.d.ts +1 -1
- package/types/src/y/extensions/DiffVersioningExtension.d.ts +1 -1
- package/types/src/y/extensions/ForkYDoc.d.ts +1 -5
- package/types/src/y/extensions/index.d.ts +2 -10
- package/types/src/y/versioning/yhub.d.ts +3 -2
- package/types/src/yjs/comments/RESTYjsThreadStore.test.d.ts +1 -0
- package/types/src/yjs/extensions/ForkYDoc.d.ts +1 -5
- package/types/src/yjs/extensions/index.d.ts +1 -5
- package/dist/BlockNoteExtension-B_IEJHS8.js +0 -38
- package/dist/BlockNoteExtension-B_IEJHS8.js.map +0 -1
- package/dist/BlockNoteExtension-M0znTzxP.cjs +0 -2
- package/dist/BlockNoteExtension-M0znTzxP.cjs.map +0 -1
- package/dist/UserStore-QbbPFj0z.js.map +0 -1
- package/dist/blocks-BEJW9OM_.js.map +0 -1
- package/dist/blocks-BPmJglFo.cjs +0 -12
- package/dist/blocks-BPmJglFo.cjs.map +0 -1
- package/dist/en-C5Z4Ag9_.cjs +0 -2
- package/dist/en-C5Z4Ag9_.cjs.map +0 -1
- package/dist/en-CGKXfWma.js.map +0 -1
- package/dist/extensions-AitWbYdJ.cjs +0 -52
- package/dist/extensions-AitWbYdJ.cjs.map +0 -1
- package/dist/extensions-BR5hkAio.js.map +0 -1
- package/dist/src-BHPuOo7W.cjs +0 -21
- package/dist/src-BHPuOo7W.cjs.map +0 -1
- package/dist/src-BUXut68d.js.map +0 -1
- package/src/blocks/Code/shiki.ts +0 -73
- package/src/blocks/File/helpers/uploadToTmpFilesDotOrg_DEV_ONLY.ts +0 -20
- package/types/src/blocks/Code/shiki.d.ts +0 -4
- package/types/src/blocks/File/helpers/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as e, o as t, t as n } from "./BlockNoteExtension-CbvDA0F7.js";
|
|
2
2
|
import { DOMParser as r, Fragment as i, Slice as a } from "prosemirror-model";
|
|
3
3
|
import { 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";
|
|
@@ -6,24 +6,22 @@ import { uuidv4 as ee } from "lib0/random";
|
|
|
6
6
|
import { Plugin as te, PluginKey as ne, TextSelection as re } from "prosemirror-state";
|
|
7
7
|
import { DOMParser as ie, DOMSerializer as ae, Fragment as oe } from "@tiptap/pm/model";
|
|
8
8
|
import { CellSelection as se, TableMap as ce, TableView as le, columnResizing as ue, goToNextCell as de, isInTable as fe, moveCellForward as pe, nextCell as me, selectionCell as he, tableEditing as ge } from "prosemirror-tables";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import Te from "@tiptap/extension-
|
|
15
|
-
import Ee from "@tiptap/extension-
|
|
16
|
-
import De from "@tiptap/extension-
|
|
17
|
-
import Oe from "@tiptap/extension-strike";
|
|
18
|
-
import ke from "@tiptap/extension-underline";
|
|
9
|
+
import { Plugin as _e, PluginKey as ve } from "@tiptap/pm/state";
|
|
10
|
+
import { Decoration as ye, DecorationSet as be } from "@tiptap/pm/view";
|
|
11
|
+
import { Decoration as xe, DecorationSet as Se } from "prosemirror-view";
|
|
12
|
+
import Ce from "@tiptap/extension-bold";
|
|
13
|
+
import we from "@tiptap/extension-code";
|
|
14
|
+
import Te from "@tiptap/extension-italic";
|
|
15
|
+
import Ee from "@tiptap/extension-strike";
|
|
16
|
+
import De from "@tiptap/extension-underline";
|
|
19
17
|
//#region src/api/getBlockInfoFromPos.ts
|
|
20
|
-
function
|
|
18
|
+
function Oe(e) {
|
|
21
19
|
return e.marks.some((e) => ["y-attributed-delete"].includes(e.type.name));
|
|
22
20
|
}
|
|
23
|
-
function
|
|
21
|
+
function ke(e, t) {
|
|
24
22
|
let n = e.attrs.id;
|
|
25
23
|
if (!n) throw Error(`Node ${e.type.name} does not have an ID`);
|
|
26
|
-
if (
|
|
24
|
+
if (Oe(e)) {
|
|
27
25
|
let r = 0, i = !1;
|
|
28
26
|
if (t.descendants((t) => {
|
|
29
27
|
if (i) return !1;
|
|
@@ -37,7 +35,7 @@ function je(e, t) {
|
|
|
37
35
|
}
|
|
38
36
|
return n;
|
|
39
37
|
}
|
|
40
|
-
function
|
|
38
|
+
function Ae(e, t) {
|
|
41
39
|
let n = e.resolve(t);
|
|
42
40
|
if (n.nodeAfter && n.nodeAfter.type.isInGroup("bnBlock")) return {
|
|
43
41
|
posBeforeNode: n.pos,
|
|
@@ -94,45 +92,44 @@ function y(e, t) {
|
|
|
94
92
|
childContainer: t,
|
|
95
93
|
blockNoteType: e.node.type.name
|
|
96
94
|
};
|
|
97
|
-
} else {
|
|
98
|
-
if (!i.node.type.isInGroup("childContainer")) throw Error(`bnBlock node is not in the childContainer group: ${i.node}`);
|
|
99
|
-
return {
|
|
100
|
-
isBlockContainer: !1,
|
|
101
|
-
bnBlock: i,
|
|
102
|
-
childContainer: i,
|
|
103
|
-
blockNoteType: i.node.type.name
|
|
104
|
-
};
|
|
105
95
|
}
|
|
96
|
+
if (!i.node.type.isInGroup("childContainer")) throw Error(`bnBlock node is not in the childContainer group: ${i.node}`);
|
|
97
|
+
return {
|
|
98
|
+
isBlockContainer: !1,
|
|
99
|
+
bnBlock: i,
|
|
100
|
+
childContainer: i,
|
|
101
|
+
blockNoteType: i.node.type.name
|
|
102
|
+
};
|
|
106
103
|
}
|
|
107
104
|
function b(e) {
|
|
108
105
|
return y(e.node, e.posBeforeNode);
|
|
109
106
|
}
|
|
110
|
-
function
|
|
107
|
+
function je(e) {
|
|
111
108
|
if (!e.nodeAfter) throw Error(`Attempted to get blockContainer node at position ${e.pos} but a node at this position does not exist`);
|
|
112
109
|
return y(e.nodeAfter, e.pos);
|
|
113
110
|
}
|
|
114
|
-
function
|
|
115
|
-
return
|
|
111
|
+
function x(e) {
|
|
112
|
+
return Me(e, e.selection.anchor);
|
|
116
113
|
}
|
|
117
|
-
function
|
|
118
|
-
return b(
|
|
114
|
+
function Me(e, t) {
|
|
115
|
+
return b(Ae(e.doc, t));
|
|
119
116
|
}
|
|
120
117
|
//#endregion
|
|
121
118
|
//#region src/extensions/tiptap-extensions/UniqueID/UniqueID.ts
|
|
122
|
-
function
|
|
119
|
+
function Ne(e, t = JSON.stringify) {
|
|
123
120
|
let n = {};
|
|
124
121
|
return e.filter((e) => {
|
|
125
122
|
let r = t(e);
|
|
126
123
|
return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
|
|
127
124
|
});
|
|
128
125
|
}
|
|
129
|
-
function
|
|
130
|
-
return
|
|
126
|
+
function Pe(e) {
|
|
127
|
+
return Ne(e.filter((t, n) => e.indexOf(t) !== n));
|
|
131
128
|
}
|
|
132
|
-
function
|
|
129
|
+
function Fe(e) {
|
|
133
130
|
return e.marks.some((e) => e.type.name === "y-attributed-delete");
|
|
134
131
|
}
|
|
135
|
-
var
|
|
132
|
+
var Ie = s.create({
|
|
136
133
|
name: "uniqueID",
|
|
137
134
|
priority: 1e4,
|
|
138
135
|
addOptions() {
|
|
@@ -173,9 +170,9 @@ var ze = s.create({
|
|
|
173
170
|
if (!(e.some((e) => e.docChanged) && !t.doc.eq(n.doc))) return;
|
|
174
171
|
let { tr: r } = n, { types: i, generateID: a } = this.options, o = f(t.doc, e), { mapping: s } = o;
|
|
175
172
|
if (h(o).forEach(({ newRange: e }) => {
|
|
176
|
-
let o = p(n.doc, e, (e) => i.includes(e.type.name)), c =
|
|
173
|
+
let o = p(n.doc, e, (e) => i.includes(e.type.name)), c = Pe(o.map(({ node: e }) => e.attrs.id).filter((e) => e !== null));
|
|
177
174
|
o.forEach(({ node: e, pos: i }) => {
|
|
178
|
-
if (
|
|
175
|
+
if (Fe(e)) return;
|
|
179
176
|
let o = r.doc.nodeAt(i)?.attrs.id;
|
|
180
177
|
if (o === null) {
|
|
181
178
|
let o = t.doc.type.createAndFill().content;
|
|
@@ -196,7 +193,7 @@ var ze = s.create({
|
|
|
196
193
|
return;
|
|
197
194
|
}
|
|
198
195
|
let { deleted: l } = s.invert().mapResult(i);
|
|
199
|
-
l && c.includes(o) && !
|
|
196
|
+
l && c.includes(o) && !Oe(e) && r.setNodeMarkup(i, void 0, {
|
|
200
197
|
...e.attrs,
|
|
201
198
|
id: a()
|
|
202
199
|
});
|
|
@@ -245,19 +242,19 @@ var ze = s.create({
|
|
|
245
242
|
});
|
|
246
243
|
//#endregion
|
|
247
244
|
//#region src/schema/inlineContent/types.ts
|
|
248
|
-
function
|
|
245
|
+
function Le(e) {
|
|
249
246
|
return e.type === "link";
|
|
250
247
|
}
|
|
251
|
-
function
|
|
248
|
+
function Re(e) {
|
|
252
249
|
return typeof e != "string" && e.type === "link";
|
|
253
250
|
}
|
|
254
|
-
function
|
|
251
|
+
function S(e) {
|
|
255
252
|
return typeof e != "string" && e.type === "text";
|
|
256
253
|
}
|
|
257
254
|
//#endregion
|
|
258
255
|
//#region src/util/table.ts
|
|
259
|
-
function
|
|
260
|
-
return
|
|
256
|
+
function C(e) {
|
|
257
|
+
return T(e) ? { ...e } : w(e) ? {
|
|
261
258
|
type: "tableCell",
|
|
262
259
|
content: [].concat(e.content),
|
|
263
260
|
props: {
|
|
@@ -279,55 +276,55 @@ function He(e) {
|
|
|
279
276
|
}
|
|
280
277
|
};
|
|
281
278
|
}
|
|
282
|
-
function
|
|
279
|
+
function w(e) {
|
|
283
280
|
return e != null && typeof e != "string" && !Array.isArray(e) && e.type === "tableCell";
|
|
284
281
|
}
|
|
285
|
-
function
|
|
286
|
-
return
|
|
282
|
+
function T(e) {
|
|
283
|
+
return w(e) && e.props !== void 0 && e.content !== void 0;
|
|
287
284
|
}
|
|
288
|
-
function
|
|
289
|
-
return
|
|
285
|
+
function E(e) {
|
|
286
|
+
return T(e) ? e.props.colspan ?? 1 : 1;
|
|
290
287
|
}
|
|
291
|
-
function
|
|
292
|
-
return
|
|
288
|
+
function D(e) {
|
|
289
|
+
return T(e) ? e.props.rowspan ?? 1 : 1;
|
|
293
290
|
}
|
|
294
291
|
//#endregion
|
|
295
292
|
//#region src/util/typescript.ts
|
|
296
|
-
var
|
|
293
|
+
var O = class extends Error {
|
|
297
294
|
constructor(e) {
|
|
298
295
|
super(`Unreachable case: ${e}`);
|
|
299
296
|
}
|
|
300
297
|
};
|
|
301
|
-
function
|
|
298
|
+
function ze(e, t = !0) {
|
|
302
299
|
let { "data-test": n, ...r } = e;
|
|
303
300
|
if (Object.keys(r).length > 0 && t) throw Error("Object must be empty " + JSON.stringify(e));
|
|
304
301
|
}
|
|
305
302
|
//#endregion
|
|
306
303
|
//#region src/util/browser.ts
|
|
307
|
-
var
|
|
308
|
-
function
|
|
309
|
-
return
|
|
304
|
+
var Be = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
305
|
+
function k(e, t = "Ctrl") {
|
|
306
|
+
return Be() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
|
|
310
307
|
}
|
|
311
|
-
function
|
|
308
|
+
function A(...e) {
|
|
312
309
|
return [...new Set(e.filter((e) => e).join(" ").split(" "))].join(" ");
|
|
313
310
|
}
|
|
314
|
-
var
|
|
311
|
+
var Ve = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
315
312
|
//#endregion
|
|
316
313
|
//#region src/blocks/defaultBlockHelpers.ts
|
|
317
|
-
function
|
|
314
|
+
function He(e, t, n, r) {
|
|
318
315
|
let i = document.createElement("div");
|
|
319
|
-
i.className =
|
|
316
|
+
i.className = A("bn-block-content", n.class), i.setAttribute("data-content-type", e);
|
|
320
317
|
for (let [e, t] of Object.entries(n)) e !== "class" && i.setAttribute(e, t);
|
|
321
318
|
let a = document.createElement(t);
|
|
322
|
-
a.className =
|
|
319
|
+
a.className = A("bn-inline-content", r.class);
|
|
323
320
|
for (let [e, t] of Object.entries(r)) e !== "class" && a.setAttribute(e, t);
|
|
324
321
|
return i.appendChild(a), {
|
|
325
322
|
dom: i,
|
|
326
323
|
contentDOM: a
|
|
327
324
|
};
|
|
328
325
|
}
|
|
329
|
-
var
|
|
330
|
-
let n =
|
|
326
|
+
var Ue = (e, t) => {
|
|
327
|
+
let n = U(e, t.pmSchema);
|
|
331
328
|
n.type.name === "blockContainer" && (n = n.firstChild);
|
|
332
329
|
let r = t.pmSchema.nodes[n.type.name].spec.toDOM;
|
|
333
330
|
if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
|
|
@@ -335,7 +332,7 @@ var qe = (e, t) => {
|
|
|
335
332
|
if (typeof i != "object" || !("dom" in i)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");
|
|
336
333
|
return i;
|
|
337
334
|
};
|
|
338
|
-
function
|
|
335
|
+
function We(e, t = "<br>") {
|
|
339
336
|
let n = e.querySelectorAll("p");
|
|
340
337
|
if (n.length > 1) {
|
|
341
338
|
let e = n[0];
|
|
@@ -347,42 +344,44 @@ function Je(e, t = "<br>") {
|
|
|
347
344
|
}
|
|
348
345
|
//#endregion
|
|
349
346
|
//#region src/schema/nodeViewMutations.ts
|
|
350
|
-
function
|
|
351
|
-
return e.type
|
|
347
|
+
function Ge(e) {
|
|
348
|
+
return e.type !== "attributes" || !e.attributeName ? !1 : e.attributeName.startsWith("data-darkreader") ? !0 : e.attributeName === "style" ? (e.target.getAttribute("style") ?? "").includes("--darkreader") || (e.oldValue ?? "").includes("--darkreader") : !1;
|
|
352
349
|
}
|
|
353
|
-
function
|
|
350
|
+
function Ke(e) {
|
|
354
351
|
let t = e.ignoreMutation?.bind(e), n = e.contentDOM;
|
|
355
|
-
e.ignoreMutation = (e) =>
|
|
352
|
+
e.ignoreMutation = (e) => Ge(e) ? !0 : t ? t(e) : !n && e.type !== "selection";
|
|
356
353
|
}
|
|
357
354
|
//#endregion
|
|
358
355
|
//#region src/api/pmUtil.ts
|
|
359
|
-
function
|
|
356
|
+
function j(e) {
|
|
360
357
|
return "doc" in e ? e.doc.type.schema : e.type.schema;
|
|
361
358
|
}
|
|
362
|
-
function
|
|
359
|
+
function qe(e) {
|
|
363
360
|
return e.cached.blockNoteEditor;
|
|
364
361
|
}
|
|
365
|
-
function
|
|
366
|
-
return
|
|
362
|
+
function Je(e) {
|
|
363
|
+
return qe(e).schema;
|
|
367
364
|
}
|
|
368
|
-
function
|
|
369
|
-
return
|
|
365
|
+
function Ye(e) {
|
|
366
|
+
return Je(e).blockSchema;
|
|
370
367
|
}
|
|
371
|
-
function
|
|
372
|
-
return
|
|
368
|
+
function Xe(e) {
|
|
369
|
+
return Je(e).inlineContentSchema;
|
|
373
370
|
}
|
|
374
|
-
function
|
|
375
|
-
return
|
|
371
|
+
function M(e) {
|
|
372
|
+
return Je(e).styleSchema;
|
|
376
373
|
}
|
|
377
|
-
function
|
|
378
|
-
return
|
|
374
|
+
function Ze(e) {
|
|
375
|
+
return qe(e).blockCache;
|
|
379
376
|
}
|
|
380
|
-
function
|
|
381
|
-
|
|
377
|
+
function Qe(e, t) {
|
|
378
|
+
if (Ye(e)[t.name]?.content === "plain") return !0;
|
|
379
|
+
let n = Xe(e)[t.name];
|
|
380
|
+
return typeof n == "object" && n.content === "plain";
|
|
382
381
|
}
|
|
383
382
|
//#endregion
|
|
384
383
|
//#region src/api/nodeConversions/nodeToBlock.ts
|
|
385
|
-
function
|
|
384
|
+
function $e(e, t, n) {
|
|
386
385
|
let r = {
|
|
387
386
|
type: "tableContent",
|
|
388
387
|
columnWidths: [],
|
|
@@ -397,10 +396,10 @@ function rt(e, t, n) {
|
|
|
397
396
|
t ??= Array(e.attrs.colspan ?? 1).fill(void 0), r.columnWidths.push(...t);
|
|
398
397
|
}), s.cells = e.content.content.map((e, r) => (i[o] || (i[o] = []), i[o][r] = e.type.name === "tableHeader", {
|
|
399
398
|
type: "tableCell",
|
|
400
|
-
content: e.content.content.map((e) =>
|
|
399
|
+
content: e.content.content.map((e) => et(e, t, n)).reduce((e, t) => {
|
|
401
400
|
if (!e.length) return t;
|
|
402
401
|
let n = e[e.length - 1], r = t[0];
|
|
403
|
-
return r &&
|
|
402
|
+
return r && S(n) && S(r) && JSON.stringify(n.styles) === JSON.stringify(r.styles) ? (n.text += "\n" + r.text, e.push(...t.slice(1)), e) : (e.push(...t), e);
|
|
404
403
|
}, []),
|
|
405
404
|
props: {
|
|
406
405
|
colspan: e.attrs.colspan,
|
|
@@ -415,14 +414,15 @@ function rt(e, t, n) {
|
|
|
415
414
|
for (let e = 0; e < i[0]?.length; e++) i?.every((t) => t[e]) && (r.headerCols = (r.headerCols ?? 0) + 1);
|
|
416
415
|
return r;
|
|
417
416
|
}
|
|
418
|
-
function
|
|
417
|
+
function et(e, t, n) {
|
|
419
418
|
let r = [], i;
|
|
420
419
|
return e.content.forEach((e) => {
|
|
421
420
|
if (e.type.name === "hardBreak") {
|
|
422
|
-
if (i)
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
421
|
+
if (i) {
|
|
422
|
+
if (S(i)) i.text += "\n";
|
|
423
|
+
else if (Le(i)) i.content[i.content.length - 1].text += "\n";
|
|
424
|
+
else throw Error("unexpected");
|
|
425
|
+
} else i = {
|
|
426
426
|
type: "text",
|
|
427
427
|
text: "\n",
|
|
428
428
|
styles: {}
|
|
@@ -434,7 +434,7 @@ function it(e, t, n) {
|
|
|
434
434
|
console.warn("unrecognized inline content type", e.type.name);
|
|
435
435
|
return;
|
|
436
436
|
}
|
|
437
|
-
i &&= (r.push(i), void 0), r.push(
|
|
437
|
+
i &&= (r.push(i), void 0), r.push(tt(e, t, n));
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
440
440
|
let a = {}, o;
|
|
@@ -447,9 +447,9 @@ function it(e, t, n) {
|
|
|
447
447
|
}
|
|
448
448
|
if (e.propSchema === "boolean") a[e.type] = !0;
|
|
449
449
|
else if (e.propSchema === "string") a[e.type] = t.attrs.stringValue;
|
|
450
|
-
else throw new
|
|
450
|
+
else throw new O(e.propSchema);
|
|
451
451
|
}
|
|
452
|
-
i ?
|
|
452
|
+
i ? S(i) ? o ? (r.push(i), i = {
|
|
453
453
|
type: "link",
|
|
454
454
|
href: o.attrs.href,
|
|
455
455
|
content: [{
|
|
@@ -461,7 +461,7 @@ function it(e, t, n) {
|
|
|
461
461
|
type: "text",
|
|
462
462
|
text: e.textContent,
|
|
463
463
|
styles: a
|
|
464
|
-
}) :
|
|
464
|
+
}) : Le(i) && (o ? i.href === o.attrs.href ? JSON.stringify(i.content[i.content.length - 1].styles) === JSON.stringify(a) ? i.content[i.content.length - 1].text += e.textContent : i.content.push({
|
|
465
465
|
type: "text",
|
|
466
466
|
text: e.textContent,
|
|
467
467
|
styles: a
|
|
@@ -492,7 +492,7 @@ function it(e, t, n) {
|
|
|
492
492
|
};
|
|
493
493
|
}), i && r.push(i), r;
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function tt(e, t, n) {
|
|
496
496
|
if (e.type.name === "text" || e.type.name === "link") throw Error("unexpected");
|
|
497
497
|
let r = {}, i = t[e.type.name];
|
|
498
498
|
for (let [t, n] of Object.entries(e.attrs)) {
|
|
@@ -500,22 +500,22 @@ function at(e, t, n) {
|
|
|
500
500
|
t in i.propSchema && (r[t] = n);
|
|
501
501
|
}
|
|
502
502
|
let a;
|
|
503
|
-
return a = i.content === "styled" ?
|
|
503
|
+
return a = i.content === "styled" ? et(e, t, n) : i.content === "plain" ? e.textContent : void 0, {
|
|
504
504
|
type: e.type.name,
|
|
505
505
|
props: r,
|
|
506
506
|
content: a
|
|
507
507
|
};
|
|
508
508
|
}
|
|
509
|
-
function
|
|
510
|
-
let n = e.type.schema, r =
|
|
509
|
+
function N(e, t) {
|
|
510
|
+
let n = e.type.schema, r = Ye(n), i = Xe(n), a = M(n), o = Ze(n);
|
|
511
511
|
if (!e.type.isInGroup("bnBlock")) throw Error("Node should be a bnBlock, but is instead: " + e.type.name);
|
|
512
512
|
let s = o?.get(e);
|
|
513
513
|
if (s) return s;
|
|
514
514
|
let c = y(e, 0), l;
|
|
515
515
|
try {
|
|
516
|
-
l =
|
|
516
|
+
l = ke(c.bnBlock.node, t);
|
|
517
517
|
} catch {
|
|
518
|
-
l =
|
|
518
|
+
l = Ie.options.generateID();
|
|
519
519
|
}
|
|
520
520
|
let u = r[c.blockNoteType];
|
|
521
521
|
if (!u) throw Error("Block is of an unrecognized type: " + c.blockNoteType);
|
|
@@ -525,19 +525,19 @@ function j(e, t) {
|
|
|
525
525
|
...c.isBlockContainer ? c.blockContent.node.attrs : {}
|
|
526
526
|
})) {
|
|
527
527
|
let e = u.propSchema;
|
|
528
|
-
t in e &&
|
|
528
|
+
t in e && (e[t].default !== void 0 || n !== void 0) && (d[t] = n);
|
|
529
529
|
}
|
|
530
530
|
let f = r[c.blockNoteType], p = [];
|
|
531
531
|
c.childContainer?.node.forEach((e) => {
|
|
532
|
-
p.push(
|
|
532
|
+
p.push(N(e, t));
|
|
533
533
|
});
|
|
534
534
|
let m;
|
|
535
535
|
if (f.content === "inline") {
|
|
536
536
|
if (!c.isBlockContainer) throw Error("impossible");
|
|
537
|
-
m =
|
|
537
|
+
m = et(c.blockContent.node, i, a);
|
|
538
538
|
} else if (f.content === "table") {
|
|
539
539
|
if (!c.isBlockContainer) throw Error("impossible");
|
|
540
|
-
m =
|
|
540
|
+
m = $e(c.blockContent.node, i, a);
|
|
541
541
|
} else if (f.content === "plain") {
|
|
542
542
|
if (!c.isBlockContainer) throw Error("impossible");
|
|
543
543
|
let e = c.blockContent.node.textContent;
|
|
@@ -547,7 +547,7 @@ function j(e, t) {
|
|
|
547
547
|
styles: {}
|
|
548
548
|
}] : [];
|
|
549
549
|
} else if (f.content === "none") m = void 0;
|
|
550
|
-
else throw new
|
|
550
|
+
else throw new O(f.content);
|
|
551
551
|
let h = {
|
|
552
552
|
id: l,
|
|
553
553
|
type: f.type,
|
|
@@ -557,11 +557,11 @@ function j(e, t) {
|
|
|
557
557
|
};
|
|
558
558
|
return o?.set(e, h), h;
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function nt(e) {
|
|
561
561
|
let t = [];
|
|
562
|
-
return e.firstChild && e.firstChild.descendants((n) => (t.push(
|
|
562
|
+
return e.firstChild && e.firstChild.descendants((n) => (t.push(N(n, e)), !1)), t;
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function rt(e) {
|
|
565
565
|
function t(n, r, i) {
|
|
566
566
|
if (n.type.name !== "blockGroup") throw Error("unexpected");
|
|
567
567
|
let a = [], o, s;
|
|
@@ -576,7 +576,7 @@ function st(e) {
|
|
|
576
576
|
o = e.blockCutAtStart, f && (s = e.blockCutAtEnd), a.push(...e.blocks);
|
|
577
577
|
return;
|
|
578
578
|
}
|
|
579
|
-
let p =
|
|
579
|
+
let p = N(c, e.content.firstChild), m = c.childCount > 1 ? c.child(1) : void 0, h = [];
|
|
580
580
|
if (m) {
|
|
581
581
|
let e = t(m, 0, f ? Math.max(0, i - 1) : 0);
|
|
582
582
|
h = e.blocks, f && (s = e.blockCutAtEnd);
|
|
@@ -601,14 +601,14 @@ function st(e) {
|
|
|
601
601
|
}
|
|
602
602
|
//#endregion
|
|
603
603
|
//#region src/util/string.ts
|
|
604
|
-
function
|
|
604
|
+
function P(e) {
|
|
605
605
|
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function it(e) {
|
|
608
608
|
let t = e.split("/");
|
|
609
609
|
return !t.length || t[t.length - 1] === "" ? e : t[t.length - 1];
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function at(e) {
|
|
612
612
|
let t = [
|
|
613
613
|
"mp4",
|
|
614
614
|
"webm",
|
|
@@ -629,53 +629,53 @@ function lt(e) {
|
|
|
629
629
|
}
|
|
630
630
|
//#endregion
|
|
631
631
|
//#region src/schema/blocks/internal.ts
|
|
632
|
-
function
|
|
632
|
+
function ot(e) {
|
|
633
633
|
let t = {};
|
|
634
634
|
return Object.entries(e).forEach(([e, n]) => {
|
|
635
635
|
t[e] = {
|
|
636
636
|
default: n.default,
|
|
637
637
|
keepOnSplit: !0,
|
|
638
638
|
parseHTML: (t) => {
|
|
639
|
-
let r = t.getAttribute(
|
|
639
|
+
let r = t.getAttribute(P(e));
|
|
640
640
|
if (r === null) return null;
|
|
641
|
-
if (n.default === void 0 && n.type === "boolean" || n.default !== void 0 && typeof n.default == "boolean") return r === "true"
|
|
641
|
+
if (n.default === void 0 && n.type === "boolean" || n.default !== void 0 && typeof n.default == "boolean") return r === "true" || r !== "false" && null;
|
|
642
642
|
if (n.default === void 0 && n.type === "number" || n.default !== void 0 && typeof n.default == "number") {
|
|
643
643
|
let e = parseFloat(r);
|
|
644
644
|
return !Number.isNaN(e) && Number.isFinite(e) ? e : null;
|
|
645
645
|
}
|
|
646
646
|
return r;
|
|
647
647
|
},
|
|
648
|
-
renderHTML: (t) => t[e] === n.default ? {} : { [
|
|
648
|
+
renderHTML: (t) => t[e] === n.default ? {} : { [P(e)]: t[e] }
|
|
649
649
|
};
|
|
650
650
|
}), t;
|
|
651
651
|
}
|
|
652
|
-
function
|
|
652
|
+
function st(e, t) {
|
|
653
653
|
let n = e();
|
|
654
654
|
if (n === void 0) throw Error("Cannot find node position");
|
|
655
655
|
let r = t.resolve(n).node();
|
|
656
656
|
if (!r) throw Error("Cannot find block container");
|
|
657
|
-
return
|
|
657
|
+
return N(r, t);
|
|
658
658
|
}
|
|
659
|
-
function
|
|
659
|
+
function ct(e, t, n) {
|
|
660
660
|
try {
|
|
661
|
-
return
|
|
661
|
+
return st(e, n);
|
|
662
662
|
} catch (e) {
|
|
663
663
|
let r = n.type.schema.nodes.blockContainer?.createAndFill(null, t);
|
|
664
|
-
if (r) return
|
|
664
|
+
if (r) return N(r, n);
|
|
665
665
|
throw e;
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
|
-
function
|
|
668
|
+
function lt(e, t, n, r, i = !1, a) {
|
|
669
669
|
let o = document.createElement("div");
|
|
670
670
|
if (a !== void 0) for (let [e, t] of Object.entries(a)) e !== "class" && o.setAttribute(e, t);
|
|
671
|
-
o.className =
|
|
672
|
-
for (let [e, t] of Object.entries(n)) t !== r[e]?.default && o.setAttribute(
|
|
673
|
-
return i && o.setAttribute("data-file-block", ""), o.appendChild(e.dom), e.contentDOM && (e.contentDOM.className =
|
|
671
|
+
o.className = A("bn-block-content", a?.class || ""), o.setAttribute("data-content-type", t);
|
|
672
|
+
for (let [e, t] of Object.entries(n)) t !== r[e]?.default && o.setAttribute(P(e), t);
|
|
673
|
+
return i && o.setAttribute("data-file-block", ""), o.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = A("bn-inline-content", e.contentDOM.className)), {
|
|
674
674
|
...e,
|
|
675
675
|
dom: o
|
|
676
676
|
};
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function ut(e, t, n) {
|
|
679
679
|
return {
|
|
680
680
|
config: {
|
|
681
681
|
type: e.type,
|
|
@@ -684,20 +684,20 @@ function pt(e, t, n) {
|
|
|
684
684
|
},
|
|
685
685
|
implementation: {
|
|
686
686
|
node: e.node,
|
|
687
|
-
render:
|
|
688
|
-
toExternalHTML:
|
|
687
|
+
render: Ue,
|
|
688
|
+
toExternalHTML: Ue
|
|
689
689
|
},
|
|
690
690
|
extensions: n
|
|
691
691
|
};
|
|
692
692
|
}
|
|
693
693
|
//#endregion
|
|
694
694
|
//#region src/schema/blocks/createSpec.ts
|
|
695
|
-
function
|
|
695
|
+
function dt(e, t) {
|
|
696
696
|
e.stopEvent = (e) => (e.type === "mousedown" && setTimeout(() => {
|
|
697
697
|
t.view.dom.blur();
|
|
698
698
|
}, 10), !0);
|
|
699
699
|
}
|
|
700
|
-
function
|
|
700
|
+
function ft(e, t) {
|
|
701
701
|
let n = [{
|
|
702
702
|
tag: "[data-content-type=" + e.type + "]",
|
|
703
703
|
contentElement: ".bn-inline-content"
|
|
@@ -707,7 +707,7 @@ function ht(e, t) {
|
|
|
707
707
|
getAttrs(e) {
|
|
708
708
|
if (typeof e == "string") return !1;
|
|
709
709
|
let n = t.parse?.(e);
|
|
710
|
-
return n
|
|
710
|
+
return n !== void 0 && n;
|
|
711
711
|
},
|
|
712
712
|
preserveWhitespace: !0,
|
|
713
713
|
getContent: e.content === "inline" || e.content === "none" || e.content === "plain" ? (n, r) => {
|
|
@@ -720,7 +720,7 @@ function ht(e, t) {
|
|
|
720
720
|
}
|
|
721
721
|
if (e.content === "inline" || e.content === "plain") {
|
|
722
722
|
let i = n.cloneNode(!0);
|
|
723
|
-
|
|
723
|
+
We(i, e.content === "plain" || t.meta?.code ? "\n" : "<br>");
|
|
724
724
|
let a = ie.fromSchema(r).parse(i, {
|
|
725
725
|
topNode: r.nodes.paragraph.create(),
|
|
726
726
|
preserveWhitespace: !0
|
|
@@ -741,12 +741,12 @@ function ht(e, t) {
|
|
|
741
741
|
} : void 0
|
|
742
742
|
}), n;
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function pt(e, n, r, i) {
|
|
745
745
|
let a = n.node || u.create({
|
|
746
|
-
name:
|
|
747
|
-
content:
|
|
746
|
+
name: e.type,
|
|
747
|
+
content: e.content === "inline" ? "inline*" : e.content === "plain" ? "text*" : e.content === "none" ? "" : e.content,
|
|
748
748
|
marks() {
|
|
749
|
-
return
|
|
749
|
+
return e.content === "plain" ? t(this.editor) : void 0;
|
|
750
750
|
},
|
|
751
751
|
group: "blockContent",
|
|
752
752
|
selectable: n.meta?.selectable ?? !0,
|
|
@@ -755,65 +755,65 @@ function gt(t, n, r, i) {
|
|
|
755
755
|
defining: n.meta?.defining ?? !0,
|
|
756
756
|
priority: i,
|
|
757
757
|
addAttributes() {
|
|
758
|
-
return
|
|
758
|
+
return ot(e.propSchema);
|
|
759
759
|
},
|
|
760
760
|
parseHTML() {
|
|
761
|
-
return
|
|
761
|
+
return ft(e, n);
|
|
762
762
|
},
|
|
763
|
-
renderHTML({ HTMLAttributes:
|
|
763
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
764
764
|
let r = document.createElement("div");
|
|
765
|
-
return
|
|
765
|
+
return lt({
|
|
766
766
|
dom: r,
|
|
767
|
-
contentDOM:
|
|
768
|
-
},
|
|
767
|
+
contentDOM: e.content === "inline" || e.content === "plain" ? r : void 0
|
|
768
|
+
}, e.type, {}, e.propSchema, n.meta?.fileBlockAccept !== void 0, t);
|
|
769
769
|
},
|
|
770
770
|
addNodeView() {
|
|
771
|
-
return (
|
|
772
|
-
let r = this.options.editor, i =
|
|
771
|
+
return (t) => {
|
|
772
|
+
let r = this.options.editor, i = ct(t.getPos, t.node, t.view.state.doc), a = this.options.domAttributes?.blockContent || {}, o = n.render.call({
|
|
773
773
|
blockContentDOMAttributes: a,
|
|
774
|
-
props:
|
|
774
|
+
props: t,
|
|
775
775
|
renderType: "nodeView",
|
|
776
|
-
propSchema:
|
|
776
|
+
propSchema: e.propSchema
|
|
777
777
|
}, i, r);
|
|
778
|
-
return n.meta?.selectable === !1 &&
|
|
778
|
+
return n.meta?.selectable === !1 && dt(o, this.editor), Ke(o), o;
|
|
779
779
|
};
|
|
780
780
|
}
|
|
781
781
|
});
|
|
782
|
-
if (a.name !==
|
|
782
|
+
if (a.name !== e.type) throw Error("Node name does not match block type. This is a bug in BlockNote.");
|
|
783
783
|
return {
|
|
784
|
-
config:
|
|
784
|
+
config: e,
|
|
785
785
|
implementation: {
|
|
786
786
|
...n,
|
|
787
787
|
node: a,
|
|
788
|
-
render(
|
|
788
|
+
render(t, r) {
|
|
789
789
|
let i = a.options.domAttributes?.blockContent || {};
|
|
790
790
|
return n.render.call({
|
|
791
791
|
blockContentDOMAttributes: i,
|
|
792
792
|
props: void 0,
|
|
793
793
|
renderType: "dom",
|
|
794
|
-
propSchema:
|
|
795
|
-
},
|
|
794
|
+
propSchema: e.propSchema
|
|
795
|
+
}, t, r);
|
|
796
796
|
},
|
|
797
|
-
toExternalHTML: (
|
|
797
|
+
toExternalHTML: (t, r, i) => {
|
|
798
798
|
let o = a.options.domAttributes?.blockContent || {};
|
|
799
799
|
return n.toExternalHTML?.call({
|
|
800
800
|
blockContentDOMAttributes: o,
|
|
801
|
-
propSchema:
|
|
802
|
-
},
|
|
801
|
+
propSchema: e.propSchema
|
|
802
|
+
}, t, r, i) ?? n.render.call({
|
|
803
803
|
blockContentDOMAttributes: o,
|
|
804
804
|
renderType: "dom",
|
|
805
805
|
props: void 0,
|
|
806
|
-
propSchema:
|
|
807
|
-
},
|
|
806
|
+
propSchema: e.propSchema
|
|
807
|
+
}, t, r);
|
|
808
808
|
}
|
|
809
809
|
},
|
|
810
810
|
extensions: r
|
|
811
811
|
};
|
|
812
812
|
}
|
|
813
|
-
function
|
|
813
|
+
function F(e) {
|
|
814
814
|
return e;
|
|
815
815
|
}
|
|
816
|
-
function
|
|
816
|
+
function I(e, t, n) {
|
|
817
817
|
return (r = {}) => {
|
|
818
818
|
let i = typeof e == "function" ? e(r) : e, a = typeof t == "function" ? t(r) : t, o = n ? typeof n == "function" ? n(r) : n : void 0;
|
|
819
819
|
return {
|
|
@@ -822,10 +822,10 @@ function F(e, t, n) {
|
|
|
822
822
|
...a,
|
|
823
823
|
toExternalHTML(e, t, n) {
|
|
824
824
|
let r = a.toExternalHTML?.call({ blockContentDOMAttributes: this.blockContentDOMAttributes }, e, t, n);
|
|
825
|
-
if (r !== void 0) return
|
|
825
|
+
if (r !== void 0) return lt(r, e.type, e.props, this.propSchema ?? i.propSchema, a.meta?.fileBlockAccept !== void 0);
|
|
826
826
|
},
|
|
827
827
|
render(e, t) {
|
|
828
|
-
return
|
|
828
|
+
return lt(a.render.call({
|
|
829
829
|
blockContentDOMAttributes: this.blockContentDOMAttributes,
|
|
830
830
|
renderType: this.renderType,
|
|
831
831
|
props: this.props
|
|
@@ -838,37 +838,38 @@ function F(e, t, n) {
|
|
|
838
838
|
}
|
|
839
839
|
//#endregion
|
|
840
840
|
//#region src/schema/inlineContent/internal.ts
|
|
841
|
-
function
|
|
842
|
-
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([e, t]) => t !== r[e]?.default).map(([e, t]) => [
|
|
841
|
+
function mt(e, t, n, r) {
|
|
842
|
+
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([e, t]) => t !== r[e]?.default).map(([e, t]) => [P(e), t]).forEach(([t, n]) => e.dom.setAttribute(t, n)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
843
843
|
}
|
|
844
|
-
function
|
|
844
|
+
function ht(e) {
|
|
845
845
|
return { Backspace: ({ editor: t }) => {
|
|
846
846
|
let n = t.state.selection.$from;
|
|
847
847
|
return t.state.selection.empty && n.node().type.name === e.type && n.parentOffset === 0;
|
|
848
848
|
} };
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function gt(e, t, n) {
|
|
851
851
|
return {
|
|
852
852
|
config: e,
|
|
853
|
-
implementation: t
|
|
853
|
+
implementation: t,
|
|
854
|
+
extensions: n
|
|
854
855
|
};
|
|
855
856
|
}
|
|
856
|
-
function
|
|
857
|
-
return
|
|
857
|
+
function _t(e, t, n) {
|
|
858
|
+
return gt({
|
|
858
859
|
type: e.name,
|
|
859
860
|
propSchema: t,
|
|
860
|
-
content: e.config.content === "inline*" ? "styled" : "none"
|
|
861
|
+
content: e.config.content === "inline*" ? "styled" : e.config.content === "text*" ? "plain" : "none"
|
|
861
862
|
}, {
|
|
862
863
|
...n,
|
|
863
864
|
node: e
|
|
864
865
|
});
|
|
865
866
|
}
|
|
866
|
-
function
|
|
867
|
+
function vt(e) {
|
|
867
868
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
|
|
868
869
|
}
|
|
869
870
|
//#endregion
|
|
870
871
|
//#region src/schema/styles/internal.ts
|
|
871
|
-
function
|
|
872
|
+
function yt(e) {
|
|
872
873
|
return e === "boolean" ? {} : { stringValue: {
|
|
873
874
|
default: void 0,
|
|
874
875
|
keepOnSplit: !0,
|
|
@@ -876,17 +877,17 @@ function St(e) {
|
|
|
876
877
|
renderHTML: (e) => e.stringValue === void 0 ? {} : { "data-value": e.stringValue }
|
|
877
878
|
} };
|
|
878
879
|
}
|
|
879
|
-
function
|
|
880
|
+
function L(e, t, n, r) {
|
|
880
881
|
return e.dom.setAttribute("data-style-type", t), r === "string" && e.dom.setAttribute("data-value", n), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
881
882
|
}
|
|
882
|
-
function
|
|
883
|
+
function bt(e, t) {
|
|
883
884
|
return {
|
|
884
885
|
config: e,
|
|
885
886
|
implementation: t
|
|
886
887
|
};
|
|
887
888
|
}
|
|
888
|
-
function
|
|
889
|
-
return
|
|
889
|
+
function R(e, t) {
|
|
890
|
+
return bt({
|
|
890
891
|
type: e.name,
|
|
891
892
|
propSchema: t
|
|
892
893
|
}, {
|
|
@@ -907,12 +908,12 @@ function L(e, t) {
|
|
|
907
908
|
}
|
|
908
909
|
});
|
|
909
910
|
}
|
|
910
|
-
function
|
|
911
|
+
function xt(e) {
|
|
911
912
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
|
|
912
913
|
}
|
|
913
914
|
//#endregion
|
|
914
915
|
//#region src/schema/styles/createSpec.ts
|
|
915
|
-
function
|
|
916
|
+
function St(e, t) {
|
|
916
917
|
let n = [{
|
|
917
918
|
tag: `[data-style-type="${e.type}"]`,
|
|
918
919
|
contentElement: (e) => {
|
|
@@ -926,37 +927,37 @@ function Tt(e, t) {
|
|
|
926
927
|
getAttrs(e) {
|
|
927
928
|
if (typeof e == "string") return !1;
|
|
928
929
|
let n = t?.(e);
|
|
929
|
-
return n
|
|
930
|
+
return n !== void 0 && { stringValue: n };
|
|
930
931
|
}
|
|
931
932
|
}), n;
|
|
932
933
|
}
|
|
933
|
-
function
|
|
934
|
+
function Ct(e, t) {
|
|
934
935
|
let n = l.create({
|
|
935
936
|
name: e.type,
|
|
936
937
|
addAttributes() {
|
|
937
|
-
return
|
|
938
|
+
return yt(e.propSchema);
|
|
938
939
|
},
|
|
939
940
|
parseHTML() {
|
|
940
|
-
return
|
|
941
|
+
return St(e, t.parse);
|
|
941
942
|
},
|
|
942
943
|
renderHTML({ mark: n }) {
|
|
943
|
-
return
|
|
944
|
+
return L((t.toExternalHTML || t.render)(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
|
|
944
945
|
},
|
|
945
946
|
addMarkView() {
|
|
946
|
-
return ({ mark: n }) =>
|
|
947
|
+
return ({ mark: n }) => L(t.render(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
|
|
947
948
|
}
|
|
948
949
|
});
|
|
949
|
-
return
|
|
950
|
+
return bt(e, {
|
|
950
951
|
...t,
|
|
951
952
|
mark: n,
|
|
952
|
-
render: (n) =>
|
|
953
|
-
toExternalHTML: (n) =>
|
|
953
|
+
render: (n) => L(t.render(n), e.type, n, e.propSchema),
|
|
954
|
+
toExternalHTML: (n) => L((t.toExternalHTML || t.render)(n), e.type, n, e.propSchema)
|
|
954
955
|
});
|
|
955
956
|
}
|
|
956
957
|
//#endregion
|
|
957
958
|
//#region src/util/topo-sort.ts
|
|
958
|
-
function
|
|
959
|
-
let t =
|
|
959
|
+
function wt(e) {
|
|
960
|
+
let t = Et(e), { roots: n, nonRoots: r } = Dt(t), i = [];
|
|
960
961
|
for (; n.size;) {
|
|
961
962
|
i.push(n);
|
|
962
963
|
let r = /* @__PURE__ */ new Set();
|
|
@@ -971,13 +972,13 @@ function Dt(e) {
|
|
|
971
972
|
}
|
|
972
973
|
n = r;
|
|
973
974
|
}
|
|
974
|
-
if (r =
|
|
975
|
+
if (r = Dt(t).nonRoots, r.size) throw Error(`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(r).join(", ")}`);
|
|
975
976
|
return i;
|
|
976
977
|
}
|
|
977
|
-
function
|
|
978
|
-
return
|
|
978
|
+
function Tt(e) {
|
|
979
|
+
return wt(Ot(e));
|
|
979
980
|
}
|
|
980
|
-
function
|
|
981
|
+
function Et(e) {
|
|
981
982
|
let t = /* @__PURE__ */ new Map();
|
|
982
983
|
for (let [n, r] of e.entries()) {
|
|
983
984
|
t.has(n) || t.set(n, 0);
|
|
@@ -988,7 +989,7 @@ function kt(e) {
|
|
|
988
989
|
}
|
|
989
990
|
return t;
|
|
990
991
|
}
|
|
991
|
-
function
|
|
992
|
+
function Dt(e) {
|
|
992
993
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
993
994
|
for (let [r, i] of e.entries()) i === 0 ? t.add(r) : n.add(r);
|
|
994
995
|
return {
|
|
@@ -996,7 +997,7 @@ function At(e) {
|
|
|
996
997
|
nonRoots: n
|
|
997
998
|
};
|
|
998
999
|
}
|
|
999
|
-
function
|
|
1000
|
+
function Ot(e) {
|
|
1000
1001
|
let t = /* @__PURE__ */ new Map();
|
|
1001
1002
|
for (let [n, r] of e.entries()) {
|
|
1002
1003
|
t.has(n) || t.set(n, /* @__PURE__ */ new Set());
|
|
@@ -1004,26 +1005,26 @@ function jt(e) {
|
|
|
1004
1005
|
}
|
|
1005
1006
|
return t;
|
|
1006
1007
|
}
|
|
1007
|
-
function
|
|
1008
|
+
function kt() {
|
|
1008
1009
|
return /* @__PURE__ */ new Map();
|
|
1009
1010
|
}
|
|
1010
|
-
function
|
|
1011
|
+
function At(e, t, n) {
|
|
1011
1012
|
return e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n), e;
|
|
1012
1013
|
}
|
|
1013
|
-
function
|
|
1014
|
-
let t =
|
|
1014
|
+
function jt(e) {
|
|
1015
|
+
let t = kt();
|
|
1015
1016
|
for (let n of e) Array.isArray(n.runsBefore) && n.runsBefore.length > 0 ? n.runsBefore.forEach((e) => {
|
|
1016
|
-
|
|
1017
|
-
}) :
|
|
1018
|
-
let n =
|
|
1017
|
+
At(t, n.key, e);
|
|
1018
|
+
}) : At(t, "default", n.key);
|
|
1019
|
+
let n = Tt(t), r = n.findIndex((e) => e.has("default"));
|
|
1019
1020
|
return (e) => 91 + (n.findIndex((t) => t.has(e)) + r) * 10;
|
|
1020
1021
|
}
|
|
1021
1022
|
//#endregion
|
|
1022
1023
|
//#region src/schema/schema.ts
|
|
1023
|
-
function
|
|
1024
|
+
function Mt(e) {
|
|
1024
1025
|
return e && Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
|
|
1025
1026
|
}
|
|
1026
|
-
var
|
|
1027
|
+
var Nt = class {
|
|
1027
1028
|
opts;
|
|
1028
1029
|
BlockNoteEditor = "only for types";
|
|
1029
1030
|
Block = "only for types";
|
|
@@ -1040,14 +1041,14 @@ var It = class {
|
|
|
1040
1041
|
this.blockSpecs = t, this.styleSpecs = r, this.styleSchema = o, this.inlineContentSpecs = n, this.blockSchema = i, this.inlineContentSchema = a;
|
|
1041
1042
|
}
|
|
1042
1043
|
init() {
|
|
1043
|
-
let e =
|
|
1044
|
+
let e = jt(Object.entries({
|
|
1044
1045
|
...this.opts.blockSpecs,
|
|
1045
1046
|
...this.opts.inlineContentSpecs,
|
|
1046
1047
|
...this.opts.styleSpecs
|
|
1047
1048
|
}).map(([e, t]) => ({
|
|
1048
1049
|
key: e,
|
|
1049
1050
|
runsBefore: t.implementation?.runsBefore ?? []
|
|
1050
|
-
}))), t = Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([t, n]) => [t,
|
|
1051
|
+
}))), t = Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([t, n]) => [t, pt(n.config, n.implementation, n.extensions, e(t))])), n = Object.fromEntries(Object.entries(this.opts.inlineContentSpecs).map(([t, n]) => typeof n.config == "object" ? [t, {
|
|
1051
1052
|
...n,
|
|
1052
1053
|
implementation: {
|
|
1053
1054
|
...n.implementation,
|
|
@@ -1063,22 +1064,35 @@ var It = class {
|
|
|
1063
1064
|
return {
|
|
1064
1065
|
blockSpecs: t,
|
|
1065
1066
|
blockSchema: Object.fromEntries(Object.entries(t).map(([e, t]) => [e, t.config])),
|
|
1066
|
-
inlineContentSpecs:
|
|
1067
|
-
styleSpecs:
|
|
1068
|
-
inlineContentSchema:
|
|
1069
|
-
styleSchema:
|
|
1067
|
+
inlineContentSpecs: Mt(n),
|
|
1068
|
+
styleSpecs: Mt(r),
|
|
1069
|
+
inlineContentSchema: vt(n),
|
|
1070
|
+
styleSchema: xt(r)
|
|
1070
1071
|
};
|
|
1071
1072
|
}
|
|
1072
1073
|
extend(e) {
|
|
1073
|
-
|
|
1074
|
+
this.opts = {
|
|
1075
|
+
blockSpecs: {
|
|
1076
|
+
...this.opts.blockSpecs,
|
|
1077
|
+
...e.blockSpecs
|
|
1078
|
+
},
|
|
1079
|
+
inlineContentSpecs: {
|
|
1080
|
+
...this.opts.inlineContentSpecs,
|
|
1081
|
+
...e.inlineContentSpecs
|
|
1082
|
+
},
|
|
1083
|
+
styleSpecs: {
|
|
1084
|
+
...this.opts.styleSpecs,
|
|
1085
|
+
...e.styleSpecs
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1074
1088
|
let { blockSpecs: t, inlineContentSpecs: n, styleSpecs: r, blockSchema: i, inlineContentSchema: a, styleSchema: o } = this.init();
|
|
1075
1089
|
return this.blockSpecs = t, this.styleSpecs = r, this.styleSchema = o, this.inlineContentSpecs = n, this.blockSchema = i, this.inlineContentSchema = a, this;
|
|
1076
1090
|
}
|
|
1077
1091
|
};
|
|
1078
1092
|
//#endregion
|
|
1079
1093
|
//#region src/api/blockManipulation/tables/tables.ts
|
|
1080
|
-
function
|
|
1081
|
-
let { height: t, width: n } =
|
|
1094
|
+
function z(e) {
|
|
1095
|
+
let { height: t, width: n } = Pt(e), r = Array(t).fill(!1).map(() => Array(n).fill(null)), i = (e, i) => {
|
|
1082
1096
|
for (let a = e; a < t; a++) for (let e = i; e < n; e++) if (!r[a][e]) return {
|
|
1083
1097
|
row: a,
|
|
1084
1098
|
col: e
|
|
@@ -1086,7 +1100,7 @@ function R(e) {
|
|
|
1086
1100
|
throw Error("Unable to create occupancy grid for table, no more available cells");
|
|
1087
1101
|
};
|
|
1088
1102
|
for (let t = 0; t < e.content.rows.length; t++) for (let n = 0; n < e.content.rows[t].cells.length; n++) {
|
|
1089
|
-
let a =
|
|
1103
|
+
let a = C(e.content.rows[t].cells[n]), o = D(a), s = E(a), { row: c, col: l } = i(t, n);
|
|
1090
1104
|
for (let e = c; e < c + o; e++) for (let i = l; i < l + s; i++) {
|
|
1091
1105
|
if (r[e][i]) throw Error(`Unable to create occupancy grid for table, cell at ${e},${i} is already occupied`);
|
|
1092
1106
|
r[e][i] = {
|
|
@@ -1100,11 +1114,11 @@ function R(e) {
|
|
|
1100
1114
|
}
|
|
1101
1115
|
return r;
|
|
1102
1116
|
}
|
|
1103
|
-
function
|
|
1117
|
+
function B(e) {
|
|
1104
1118
|
let t = /* @__PURE__ */ new Set();
|
|
1105
|
-
return e.map((e) => ({ cells: e.map((e) => t.has(e.row + ":" + e.col)
|
|
1119
|
+
return e.map((e) => ({ cells: e.map((e) => !t.has(e.row + ":" + e.col) && (t.add(e.row + ":" + e.col), e.cell)).filter((e) => e !== !1) }));
|
|
1106
1120
|
}
|
|
1107
|
-
function
|
|
1121
|
+
function V(e, t, n = z(t)) {
|
|
1108
1122
|
for (let t = 0; t < n.length; t++) for (let r = 0; r < n[t].length; r++) {
|
|
1109
1123
|
let i = n[t][r];
|
|
1110
1124
|
if (i && i.row === e.row && i.col === e.col) return {
|
|
@@ -1115,19 +1129,19 @@ function B(e, t, n = R(t)) {
|
|
|
1115
1129
|
}
|
|
1116
1130
|
throw Error(`Unable to resolve relative table cell indices for table, cell at ${e.row},${e.col} is not occupied`);
|
|
1117
1131
|
}
|
|
1118
|
-
function
|
|
1132
|
+
function Pt(e) {
|
|
1119
1133
|
let t = e.content.rows.length, n = 0;
|
|
1120
1134
|
return e.content.rows.forEach((e) => {
|
|
1121
1135
|
let t = 0;
|
|
1122
1136
|
e.cells.forEach((e) => {
|
|
1123
|
-
t +=
|
|
1137
|
+
t += E(e);
|
|
1124
1138
|
}), n = Math.max(n, t);
|
|
1125
1139
|
}), {
|
|
1126
1140
|
height: t,
|
|
1127
1141
|
width: n
|
|
1128
1142
|
};
|
|
1129
1143
|
}
|
|
1130
|
-
function
|
|
1144
|
+
function Ft(e, t, n = z(t)) {
|
|
1131
1145
|
let r = n[e.row]?.[e.col];
|
|
1132
1146
|
if (r) return {
|
|
1133
1147
|
row: r.row,
|
|
@@ -1135,8 +1149,8 @@ function Rt(e, t, n = R(t)) {
|
|
|
1135
1149
|
cell: r.cell
|
|
1136
1150
|
};
|
|
1137
1151
|
}
|
|
1138
|
-
function
|
|
1139
|
-
let n =
|
|
1152
|
+
function It(e, t) {
|
|
1153
|
+
let n = z(e);
|
|
1140
1154
|
if (t < 0 || t >= n.length) return [];
|
|
1141
1155
|
let r = 0;
|
|
1142
1156
|
for (let e = 0; e < t; e++) {
|
|
@@ -1144,14 +1158,14 @@ function zt(e, t) {
|
|
|
1144
1158
|
if (!e) return [];
|
|
1145
1159
|
r += e.rowspan;
|
|
1146
1160
|
}
|
|
1147
|
-
let i = Array(n[0].length).fill(!1).map((t, i) =>
|
|
1161
|
+
let i = Array(n[0].length).fill(!1).map((t, i) => Ft({
|
|
1148
1162
|
row: r,
|
|
1149
1163
|
col: i
|
|
1150
1164
|
}, e, n)).filter((e) => e !== void 0);
|
|
1151
1165
|
return i.filter((e, t) => i.findIndex((t) => t.row === e.row && t.col === e.col) === t);
|
|
1152
1166
|
}
|
|
1153
|
-
function
|
|
1154
|
-
let n =
|
|
1167
|
+
function Lt(e, t) {
|
|
1168
|
+
let n = z(e);
|
|
1155
1169
|
if (t < 0 || t >= n[0].length) return [];
|
|
1156
1170
|
let r = 0;
|
|
1157
1171
|
for (let e = 0; e < t; e++) {
|
|
@@ -1159,62 +1173,62 @@ function Bt(e, t) {
|
|
|
1159
1173
|
if (!e) return [];
|
|
1160
1174
|
r += e.colspan;
|
|
1161
1175
|
}
|
|
1162
|
-
let i = Array(n.length).fill(!1).map((t, i) =>
|
|
1176
|
+
let i = Array(n.length).fill(!1).map((t, i) => Ft({
|
|
1163
1177
|
row: i,
|
|
1164
1178
|
col: r
|
|
1165
1179
|
}, e, n)).filter((e) => e !== void 0);
|
|
1166
1180
|
return i.filter((e, t) => i.findIndex((t) => t.row === e.row && t.col === e.col) === t);
|
|
1167
1181
|
}
|
|
1168
|
-
function
|
|
1169
|
-
let { col: i } =
|
|
1182
|
+
function Rt(e, t, n, r = z(e)) {
|
|
1183
|
+
let { col: i } = V({
|
|
1170
1184
|
row: 0,
|
|
1171
1185
|
col: t
|
|
1172
|
-
}, e, r), { col: a } =
|
|
1186
|
+
}, e, r), { col: a } = V({
|
|
1173
1187
|
row: 0,
|
|
1174
1188
|
col: n
|
|
1175
1189
|
}, e, r);
|
|
1176
1190
|
return r.forEach((e) => {
|
|
1177
1191
|
let [t] = e.splice(i, 1);
|
|
1178
1192
|
e.splice(a, 0, t);
|
|
1179
|
-
}),
|
|
1193
|
+
}), B(r);
|
|
1180
1194
|
}
|
|
1181
|
-
function
|
|
1182
|
-
let { row: i } =
|
|
1195
|
+
function zt(e, t, n, r = z(e)) {
|
|
1196
|
+
let { row: i } = V({
|
|
1183
1197
|
row: t,
|
|
1184
1198
|
col: 0
|
|
1185
|
-
}, e, r), { row: a } =
|
|
1199
|
+
}, e, r), { row: a } = V({
|
|
1186
1200
|
row: n,
|
|
1187
1201
|
col: 0
|
|
1188
1202
|
}, e, r), [o] = r.splice(i, 1);
|
|
1189
|
-
return r.splice(a, 0, o),
|
|
1203
|
+
return r.splice(a, 0, o), B(r);
|
|
1190
1204
|
}
|
|
1191
|
-
function
|
|
1192
|
-
return e ?
|
|
1205
|
+
function Bt(e) {
|
|
1206
|
+
return e ? w(e) ? Bt(e.content) : typeof e == "string" ? e.length === 0 : Array.isArray(e) ? e.every((e) => typeof e == "string" ? e.length === 0 : S(e) ? e.text.length === 0 : Re(e) ? typeof e.content == "string" ? e.content.length === 0 : e.content.every((e) => e.text.length === 0) : !1) : !1 : !0;
|
|
1193
1207
|
}
|
|
1194
|
-
function
|
|
1208
|
+
function Vt(e, t, n = z(e)) {
|
|
1195
1209
|
if (t === "columns") {
|
|
1196
1210
|
let e = 0;
|
|
1197
|
-
for (let t = n[0].length - 1; t >= 0 && n.every((e) =>
|
|
1211
|
+
for (let t = n[0].length - 1; t >= 0 && n.every((e) => Bt(e[t].cell) && e[t].colspan === 1); t--) e++;
|
|
1198
1212
|
for (let t = n.length - 1; t >= 0; t--) {
|
|
1199
1213
|
let r = Math.max(n[t].length - e, 1);
|
|
1200
1214
|
n[t] = n[t].slice(0, r);
|
|
1201
1215
|
}
|
|
1202
|
-
return
|
|
1216
|
+
return B(n);
|
|
1203
1217
|
}
|
|
1204
1218
|
let r = 0;
|
|
1205
|
-
for (let e = n.length - 1; e >= 0 && n[e].every((e) =>
|
|
1219
|
+
for (let e = n.length - 1; e >= 0 && n[e].every((e) => Bt(e.cell) && e.rowspan === 1); e--) r++;
|
|
1206
1220
|
let i = Math.min(r, n.length - 1);
|
|
1207
|
-
return n.splice(n.length - i, i),
|
|
1221
|
+
return n.splice(n.length - i, i), B(n);
|
|
1208
1222
|
}
|
|
1209
|
-
function
|
|
1210
|
-
let { width: i, height: a } =
|
|
1223
|
+
function Ht(e, t, n, r = z(e)) {
|
|
1224
|
+
let { width: i, height: a } = Pt(e);
|
|
1211
1225
|
if (t === "columns") r.forEach((e, t) => {
|
|
1212
1226
|
if (n >= 0) for (let r = 0; r < n; r++) e.push({
|
|
1213
1227
|
row: t,
|
|
1214
1228
|
col: Math.max(...e.map((e) => e.col)) + 1,
|
|
1215
1229
|
rowspan: 1,
|
|
1216
1230
|
colspan: 1,
|
|
1217
|
-
cell:
|
|
1231
|
+
cell: C("")
|
|
1218
1232
|
});
|
|
1219
1233
|
else e.splice(i + n, -1 * n);
|
|
1220
1234
|
});
|
|
@@ -1224,92 +1238,94 @@ function Gt(e, t, n, r = R(e)) {
|
|
|
1224
1238
|
col: n,
|
|
1225
1239
|
rowspan: 1,
|
|
1226
1240
|
colspan: 1,
|
|
1227
|
-
cell:
|
|
1241
|
+
cell: C("")
|
|
1228
1242
|
}));
|
|
1229
1243
|
r.push(t);
|
|
1230
1244
|
}
|
|
1231
1245
|
else n < 0 && r.splice(a + n, -1 * n);
|
|
1232
|
-
return
|
|
1246
|
+
return B(r);
|
|
1233
1247
|
}
|
|
1234
|
-
function
|
|
1235
|
-
let r =
|
|
1236
|
-
if (!r.some((e) =>
|
|
1248
|
+
function Ut(e, t, n) {
|
|
1249
|
+
let r = It(e, n);
|
|
1250
|
+
if (!r.some((e) => D(e.cell) > 1)) return !0;
|
|
1237
1251
|
let i = n, a = n;
|
|
1238
1252
|
return r.forEach((e) => {
|
|
1239
|
-
let t =
|
|
1253
|
+
let t = D(e.cell);
|
|
1240
1254
|
i = Math.max(i, e.row + t - 1), a = Math.min(a, e.row);
|
|
1241
1255
|
}), t < n ? n === i : n === a;
|
|
1242
1256
|
}
|
|
1243
|
-
function
|
|
1244
|
-
let r =
|
|
1245
|
-
if (!r.some((e) =>
|
|
1257
|
+
function Wt(e, t, n) {
|
|
1258
|
+
let r = Lt(e, n);
|
|
1259
|
+
if (!r.some((e) => E(e.cell) > 1)) return !0;
|
|
1246
1260
|
let i = n, a = n;
|
|
1247
1261
|
return r.forEach((e) => {
|
|
1248
|
-
let t =
|
|
1262
|
+
let t = E(e.cell);
|
|
1249
1263
|
i = Math.max(i, e.col + t - 1), a = Math.min(a, e.col);
|
|
1250
1264
|
}), t < n ? n === i : n === a;
|
|
1251
1265
|
}
|
|
1252
|
-
function
|
|
1253
|
-
let r =
|
|
1266
|
+
function Gt(e, t, n) {
|
|
1267
|
+
let r = V(e, n), i = V(t, n);
|
|
1254
1268
|
return r.col === i.col;
|
|
1255
1269
|
}
|
|
1256
1270
|
//#endregion
|
|
1257
1271
|
//#region src/api/nodeConversions/blockToNode.ts
|
|
1258
|
-
function
|
|
1272
|
+
function Kt(e, t, n, r) {
|
|
1259
1273
|
let i = [];
|
|
1260
1274
|
for (let [r, a] of Object.entries(e.styles || {})) {
|
|
1261
1275
|
let e = n[r];
|
|
1262
1276
|
if (!e) throw Error(`style ${r} not found in styleSchema`);
|
|
1263
1277
|
if (e.propSchema === "boolean") a && i.push(t.mark(r));
|
|
1264
1278
|
else if (e.propSchema === "string") a && i.push(t.mark(r, { stringValue: a }));
|
|
1265
|
-
else throw new
|
|
1279
|
+
else throw new O(e.propSchema);
|
|
1266
1280
|
}
|
|
1267
|
-
let a = r && t.nodes[r] &&
|
|
1268
|
-
return !r || !t.nodes[r]
|
|
1281
|
+
let a = r && t.nodes[r] && Qe(t, t.nodes[r]) ? [...t.nodes[r].allowedMarks(i)] : i;
|
|
1282
|
+
return !r || !Qe(t, t.nodes[r]) ? e.text.split(/(\n)/g).filter((e) => e.length > 0).map((e) => e === "\n" ? t.nodes.hardBreak.createChecked() : t.text(e, a)) : e.text.length > 0 ? [t.text(e.text, a)] : [];
|
|
1269
1283
|
}
|
|
1270
|
-
function
|
|
1284
|
+
function qt(e, t, n) {
|
|
1271
1285
|
let r = t.marks.link.create({ href: e.href });
|
|
1272
|
-
return
|
|
1286
|
+
return Jt(e.content, t, n).map((e) => {
|
|
1273
1287
|
if (e.type.name === "text") return e.mark([...e.marks, r]);
|
|
1274
1288
|
if (e.type.name === "hardBreak") return e;
|
|
1275
1289
|
throw Error("unexpected node type");
|
|
1276
1290
|
});
|
|
1277
1291
|
}
|
|
1278
|
-
function
|
|
1292
|
+
function Jt(e, t, n, r) {
|
|
1279
1293
|
let i = [];
|
|
1280
|
-
if (typeof e == "string") return i.push(...
|
|
1294
|
+
if (typeof e == "string") return i.push(...Kt({
|
|
1281
1295
|
type: "text",
|
|
1282
1296
|
text: e,
|
|
1283
1297
|
styles: {}
|
|
1284
1298
|
}, t, n, r)), i;
|
|
1285
|
-
for (let a of e) i.push(...
|
|
1299
|
+
for (let a of e) i.push(...Kt(a, t, n, r));
|
|
1286
1300
|
return i;
|
|
1287
1301
|
}
|
|
1288
|
-
function
|
|
1302
|
+
function H(e, t, n, r = M(t)) {
|
|
1289
1303
|
let i = [];
|
|
1290
|
-
for (let a of e) typeof a == "string" ? i.push(...
|
|
1304
|
+
for (let a of e) typeof a == "string" ? i.push(...Jt(a, t, r, n)) : Re(a) ? i.push(...qt(a, t, r)) : S(a) ? i.push(...Jt([a], t, r, n)) : i.push(Xt(a, t, r));
|
|
1291
1305
|
return i;
|
|
1292
1306
|
}
|
|
1293
|
-
function
|
|
1307
|
+
function Yt(e, t, n = M(t)) {
|
|
1294
1308
|
let r = [], i = Array(e.headerRows ?? 0).fill(!0), a = Array(e.headerCols ?? 0).fill(!0), o = e.columnWidths ?? [];
|
|
1295
1309
|
for (let s = 0; s < e.rows.length; s++) {
|
|
1296
1310
|
let c = e.rows[s], l = [], u = i[s];
|
|
1297
1311
|
for (let r = 0; r < c.cells.length; r++) {
|
|
1298
|
-
let i = c.cells[r], d = a[r], f = null, p =
|
|
1312
|
+
let i = c.cells[r], d = a[r], f = null, p = V({
|
|
1299
1313
|
row: s,
|
|
1300
1314
|
col: r
|
|
1301
1315
|
}, {
|
|
1302
1316
|
type: "table",
|
|
1303
1317
|
content: e
|
|
1304
1318
|
}), m = o[p.col] ? [o[p.col]] : null;
|
|
1305
|
-
if (i)
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1319
|
+
if (i) {
|
|
1320
|
+
if (typeof i == "string") f = t.text(i);
|
|
1321
|
+
else if (w(i)) {
|
|
1322
|
+
i.content && (f = H(i.content, t, "tableParagraph", n));
|
|
1323
|
+
let e = E(i);
|
|
1324
|
+
e > 1 && (m = Array(e).fill(!1).map((e, t) => o[p.col + t] ?? void 0));
|
|
1325
|
+
} else f = H(i, t, "tableParagraph", n);
|
|
1326
|
+
}
|
|
1311
1327
|
let h = t.nodes[d || u ? "tableHeader" : "tableCell"].createChecked({
|
|
1312
|
-
...
|
|
1328
|
+
...w(i) ? i.props : {},
|
|
1313
1329
|
colwidth: m
|
|
1314
1330
|
}, t.nodes.tableParagraph.createChecked(void 0, f));
|
|
1315
1331
|
l.push(h);
|
|
@@ -1319,91 +1335,101 @@ function Qt(e, t, n = A(t)) {
|
|
|
1319
1335
|
}
|
|
1320
1336
|
return r;
|
|
1321
1337
|
}
|
|
1322
|
-
function
|
|
1338
|
+
function Xt(e, t, n) {
|
|
1323
1339
|
let r, i = e.type;
|
|
1324
1340
|
if (i === void 0 && (i = "paragraph"), !t.nodes[i]) throw Error(`node type ${i} not found in schema`);
|
|
1325
1341
|
if (!e.content) r = t.nodes[i].createChecked(e.props);
|
|
1326
1342
|
else if (typeof e.content == "string") {
|
|
1327
|
-
let a =
|
|
1343
|
+
let a = H([e.content], t, i, n);
|
|
1328
1344
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1329
1345
|
} else if (Array.isArray(e.content)) {
|
|
1330
|
-
let a =
|
|
1346
|
+
let a = H(e.content, t, i, n);
|
|
1331
1347
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1332
1348
|
} else if (e.content.type === "tableContent") {
|
|
1333
|
-
let a =
|
|
1349
|
+
let a = Yt(e.content, t, n);
|
|
1334
1350
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1335
|
-
} else throw new
|
|
1351
|
+
} else throw new O(e.content.type);
|
|
1336
1352
|
return r;
|
|
1337
1353
|
}
|
|
1338
|
-
function
|
|
1354
|
+
function U(e, t, n = M(t)) {
|
|
1339
1355
|
let r = e.id;
|
|
1340
|
-
r === void 0 && (r =
|
|
1356
|
+
r === void 0 && (r = Ie.options.generateID());
|
|
1341
1357
|
let i = [];
|
|
1342
|
-
if (e.children) for (let r of e.children) i.push(
|
|
1358
|
+
if (e.children) for (let r of e.children) i.push(U(r, t, n));
|
|
1343
1359
|
if (!e.type || t.nodes[e.type].isInGroup("blockContent")) {
|
|
1344
|
-
let a =
|
|
1360
|
+
let a = Xt(e, t, n), o = i.length > 0 ? t.nodes.blockGroup.createChecked({}, i) : void 0;
|
|
1345
1361
|
return t.nodes.blockContainer.createChecked({
|
|
1346
1362
|
id: r,
|
|
1347
1363
|
...e.props
|
|
1348
1364
|
}, o ? [a, o] : a);
|
|
1349
|
-
}
|
|
1365
|
+
}
|
|
1366
|
+
if (t.nodes[e.type].isInGroup("bnBlock")) return t.nodes[e.type].create({
|
|
1350
1367
|
id: r,
|
|
1351
1368
|
...e.props
|
|
1352
1369
|
}, i);
|
|
1353
|
-
|
|
1370
|
+
throw Error(`block type ${e.type} doesn't match blockContent or bnBlock group`);
|
|
1354
1371
|
}
|
|
1355
1372
|
//#endregion
|
|
1356
1373
|
//#region src/api/nodeUtil.ts
|
|
1357
|
-
function
|
|
1374
|
+
function Zt(e, t) {
|
|
1358
1375
|
let n, r;
|
|
1359
|
-
if (t.firstChild.descendants((i, a) => n ? !1 : !
|
|
1376
|
+
if (t.firstChild.descendants((i, a) => n ? !1 : !Qt(i) || !i.attrs.id || ke(i, t) !== e || (n = i, r = a + 1, !1)), n !== void 0 && r !== void 0) return {
|
|
1360
1377
|
node: n,
|
|
1361
1378
|
posBeforeNode: r
|
|
1362
1379
|
};
|
|
1363
1380
|
}
|
|
1364
|
-
function
|
|
1381
|
+
function Qt(e) {
|
|
1365
1382
|
return e.type.isInGroup("bnBlock");
|
|
1366
1383
|
}
|
|
1367
1384
|
//#endregion
|
|
1368
1385
|
//#region src/api/blockManipulation/commands/updateBlock/updateBlock.ts
|
|
1369
|
-
var
|
|
1370
|
-
function
|
|
1371
|
-
let a =
|
|
1372
|
-
a.blockNoteType === "table" && (o =
|
|
1373
|
-
let s =
|
|
1386
|
+
var $t = (e, t) => ({ tr: n, dispatch: r }) => (r && en(n, e, t), !0);
|
|
1387
|
+
function en(e, t, n, r, i) {
|
|
1388
|
+
let a = je(e.doc.resolve(t)), o = null;
|
|
1389
|
+
a.blockNoteType === "table" && (o = cn(e));
|
|
1390
|
+
let s = j(e);
|
|
1374
1391
|
if (r !== void 0 && i !== void 0 && r > i) throw Error("Invalid replaceFromPos or replaceToPos");
|
|
1375
1392
|
let c = s.nodes[a.blockNoteType], l = s.nodes[n.type || a.blockNoteType], u = l.isInGroup("bnBlock") ? l : s.nodes.blockContainer;
|
|
1376
1393
|
if (a.isBlockContainer && l.isInGroup("blockContent")) {
|
|
1377
1394
|
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;
|
|
1378
|
-
|
|
1379
|
-
} else if (!a.isBlockContainer && l.isInGroup("bnBlock"))
|
|
1395
|
+
on(n, e, a), tn(n, e, c, l, a, t, o);
|
|
1396
|
+
} else if (!a.isBlockContainer && l.isInGroup("bnBlock")) on(n, e, a);
|
|
1380
1397
|
else {
|
|
1381
|
-
let t =
|
|
1382
|
-
children:
|
|
1398
|
+
let t = U({
|
|
1399
|
+
children: N(a.bnBlock.node, e.doc).children,
|
|
1383
1400
|
...n
|
|
1384
1401
|
}, s);
|
|
1385
1402
|
t.check(), e.replaceWith(a.bnBlock.beforePos, a.bnBlock.afterPos, t);
|
|
1386
1403
|
return;
|
|
1387
1404
|
}
|
|
1388
|
-
|
|
1405
|
+
rn(e, a.bnBlock.beforePos, u, { ...n.props }), o && ln(e, a, o);
|
|
1389
1406
|
}
|
|
1390
|
-
function
|
|
1391
|
-
let l =
|
|
1392
|
-
if (e.content)
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1407
|
+
function tn(e, t, n, r, o, s, c) {
|
|
1408
|
+
let l = j(t), u = "keep";
|
|
1409
|
+
if (e.content) {
|
|
1410
|
+
if (typeof e.content == "string") u = H([e.content], l, r.name);
|
|
1411
|
+
else if (Array.isArray(e.content)) u = H(e.content, l, r.name);
|
|
1412
|
+
else if (e.content.type === "tableContent") u = Yt(e.content, l);
|
|
1413
|
+
else throw new O(e.content.type);
|
|
1414
|
+
} else {
|
|
1415
|
+
let e = o.blockContent.node.content;
|
|
1416
|
+
if (n.spec.content !== "" && r.spec.content !== n.spec.content && !r.validContent(e)) {
|
|
1417
|
+
if (r.inlineContent && n.inlineContent) {
|
|
1418
|
+
let e = o.blockContent.node.textContent;
|
|
1419
|
+
u = e.length > 0 ? [l.text(e)] : [];
|
|
1420
|
+
} else u = [];
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
if (u === "keep") rn(t, o.blockContent.beforePos, r, { ...e.props });
|
|
1398
1424
|
else if (s !== void 0 || c !== void 0) {
|
|
1399
|
-
let n =
|
|
1425
|
+
let n = an(t, o.blockContent.beforePos, r, { ...e.props }), l = n + 1 + (s ?? 0), d = n + 1 + (c ?? o.blockContent.node.content.size), f = t.doc.resolve(n).depth, p = t.doc.resolve(l).depth, m = t.doc.resolve(d).depth;
|
|
1400
1426
|
t.replace(l, d, new a(i.from(u), p - f - 1, m - f - 1));
|
|
1401
|
-
} else r === n || r.validContent(o.blockContent.node.content) ?
|
|
1427
|
+
} else r === n || r.validContent(o.blockContent.node.content) ? nn(t, an(t, o.blockContent.beforePos, r, { ...e.props }), i.from(u)) : t.replaceWith(o.blockContent.beforePos, o.blockContent.afterPos, r.createChecked({
|
|
1402
1428
|
...o.blockContent.node.attrs,
|
|
1403
1429
|
...e.props
|
|
1404
1430
|
}, u));
|
|
1405
1431
|
}
|
|
1406
|
-
function
|
|
1432
|
+
function nn(e, t, n) {
|
|
1407
1433
|
let r = e.doc.nodeAt(t);
|
|
1408
1434
|
if (!r) throw RangeError("No node at given position");
|
|
1409
1435
|
let s = r.content, c = t + 1;
|
|
@@ -1427,7 +1453,7 @@ function an(e, t, n) {
|
|
|
1427
1453
|
for (let e = d; e < p; e++) g.push(n.child(e));
|
|
1428
1454
|
e.step(new o(m, h, new a(i.from(g), 0, 0)));
|
|
1429
1455
|
}
|
|
1430
|
-
function
|
|
1456
|
+
function rn(e, t, n, r) {
|
|
1431
1457
|
let i = e.doc.nodeAt(t);
|
|
1432
1458
|
if (!i) throw RangeError("No node at given position");
|
|
1433
1459
|
let a = n.spec.attrs ?? {}, o = {};
|
|
@@ -1442,30 +1468,30 @@ function on(e, t, n, r) {
|
|
|
1442
1468
|
}
|
|
1443
1469
|
e.setNodeMarkup(t, n, s);
|
|
1444
1470
|
}
|
|
1445
|
-
function
|
|
1471
|
+
function an(e, t, n, r) {
|
|
1446
1472
|
let i = e.mapping.maps.length;
|
|
1447
|
-
return
|
|
1473
|
+
return rn(e, t, n, r), e.mapping.slice(i).map(t, -1);
|
|
1448
1474
|
}
|
|
1449
|
-
function
|
|
1450
|
-
let r =
|
|
1475
|
+
function on(e, t, n) {
|
|
1476
|
+
let r = j(t);
|
|
1451
1477
|
if (e.children !== void 0 && e.children.length > 0) {
|
|
1452
1478
|
let a = e.children.map((e) => {
|
|
1453
|
-
let t =
|
|
1479
|
+
let t = U(e, r);
|
|
1454
1480
|
return t.check(), t;
|
|
1455
1481
|
});
|
|
1456
|
-
if (n.childContainer)
|
|
1482
|
+
if (n.childContainer) nn(t, n.childContainer.beforePos, i.from(a));
|
|
1457
1483
|
else {
|
|
1458
1484
|
if (!n.isBlockContainer) throw Error("impossible");
|
|
1459
1485
|
t.insert(n.blockContent.afterPos, r.nodes.blockGroup.createChecked({}, a));
|
|
1460
1486
|
}
|
|
1461
1487
|
}
|
|
1462
1488
|
}
|
|
1463
|
-
function
|
|
1464
|
-
let a = typeof t == "string" ? t : t.id, o =
|
|
1489
|
+
function sn(e, t, n, r, i) {
|
|
1490
|
+
let a = typeof t == "string" ? t : t.id, o = Zt(a, e.doc);
|
|
1465
1491
|
if (!o) throw Error(`Block with ID ${a} not found`);
|
|
1466
|
-
return
|
|
1492
|
+
return en(e, o.posBeforeNode, n, r, i), N(e.doc.resolve(o.posBeforeNode + 1).node(), e.doc);
|
|
1467
1493
|
}
|
|
1468
|
-
function
|
|
1494
|
+
function cn(e) {
|
|
1469
1495
|
let t = "selection" in e ? e.selection : null;
|
|
1470
1496
|
if (!(t instanceof re)) return null;
|
|
1471
1497
|
let n = e.doc.resolve(t.head), r = -1, i = -1;
|
|
@@ -1488,13 +1514,13 @@ function un(e) {
|
|
|
1488
1514
|
offset: Math.max(0, t.head - p)
|
|
1489
1515
|
};
|
|
1490
1516
|
}
|
|
1491
|
-
function
|
|
1517
|
+
function ln(e, t, n) {
|
|
1492
1518
|
if (t.blockNoteType !== "table") return !1;
|
|
1493
1519
|
let r = -1;
|
|
1494
1520
|
if (t.isBlockContainer) r = e.mapping.map(t.blockContent.beforePos);
|
|
1495
1521
|
else {
|
|
1496
1522
|
let n = e.mapping.map(t.bnBlock.beforePos), i = n + (e.doc.nodeAt(n)?.nodeSize || 0);
|
|
1497
|
-
e.doc.nodesBetween(n, i, (e, t) => e.type.name
|
|
1523
|
+
e.doc.nodesBetween(n, i, (e, t) => e.type.name !== "table" || (r = t, !1));
|
|
1498
1524
|
}
|
|
1499
1525
|
let i = r >= 0 ? e.doc.nodeAt(r) : null;
|
|
1500
1526
|
if (!i || i.type.name !== "table") return !1;
|
|
@@ -1542,7 +1568,7 @@ var W = {
|
|
|
1542
1568
|
text: "#ad1a72",
|
|
1543
1569
|
background: "#f4dfeb"
|
|
1544
1570
|
}
|
|
1545
|
-
},
|
|
1571
|
+
}, un = {
|
|
1546
1572
|
gray: {
|
|
1547
1573
|
text: "#bebdb8",
|
|
1548
1574
|
background: "#9b9a97"
|
|
@@ -1596,35 +1622,35 @@ var W = {
|
|
|
1596
1622
|
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 = G.textAlignment.values.includes(e.style.textAlign) ? e.style.textAlign : void 0, t;
|
|
1597
1623
|
}, q = (e, t) => {
|
|
1598
1624
|
e.backgroundColor && e.backgroundColor !== G.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in W ? W[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== G.textColor.default && (t.style.color = e.textColor in W ? W[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== G.textAlignment.default && (t.style.textAlign = e.textAlignment);
|
|
1599
|
-
},
|
|
1625
|
+
}, dn = (e = "backgroundColor") => ({
|
|
1600
1626
|
default: G.backgroundColor.default,
|
|
1601
1627
|
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : e.style.backgroundColor ? e.style.backgroundColor : G.backgroundColor.default,
|
|
1602
1628
|
renderHTML: (t) => t[e] === G.backgroundColor.default ? {} : { "data-background-color": t[e] }
|
|
1603
|
-
}),
|
|
1629
|
+
}), fn = (e = "textColor") => ({
|
|
1604
1630
|
default: G.textColor.default,
|
|
1605
1631
|
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : e.style.color ? e.style.color : G.textColor.default,
|
|
1606
1632
|
renderHTML: (t) => t[e] === G.textColor.default ? {} : { "data-text-color": t[e] }
|
|
1607
|
-
}),
|
|
1633
|
+
}), pn = (e = "textAlignment") => ({
|
|
1608
1634
|
default: G.textAlignment.default,
|
|
1609
1635
|
parseHTML: (e) => e.hasAttribute("data-text-alignment") ? e.getAttribute("data-text-alignment") : e.style.textAlign ? e.style.textAlign : G.textAlignment.default,
|
|
1610
1636
|
renderHTML: (t) => t[e] === G.textAlignment.default ? {} : { "data-text-alignment": t[e] }
|
|
1611
|
-
}),
|
|
1637
|
+
}), mn = (e, t) => {
|
|
1612
1638
|
let n = e.querySelector(t);
|
|
1613
1639
|
if (n) return {
|
|
1614
1640
|
targetElement: n,
|
|
1615
1641
|
caption: e.querySelector("figcaption")?.textContent ?? void 0
|
|
1616
1642
|
};
|
|
1617
|
-
}, J = n(({ editor:
|
|
1618
|
-
let n =
|
|
1643
|
+
}, J = n(({ editor: t }) => {
|
|
1644
|
+
let n = e(void 0);
|
|
1619
1645
|
function r() {
|
|
1620
1646
|
n.setState(void 0);
|
|
1621
1647
|
}
|
|
1622
1648
|
return {
|
|
1623
1649
|
key: "filePanel",
|
|
1624
1650
|
store: n,
|
|
1625
|
-
mount({ signal:
|
|
1626
|
-
let n =
|
|
1627
|
-
|
|
1651
|
+
mount({ signal: e }) {
|
|
1652
|
+
let n = t.onChange(r, !1), i = t.onSelectionChange(r, !1);
|
|
1653
|
+
e.addEventListener("abort", () => {
|
|
1628
1654
|
n(), i();
|
|
1629
1655
|
});
|
|
1630
1656
|
},
|
|
@@ -1633,7 +1659,7 @@ var W = {
|
|
|
1633
1659
|
n.setState(e);
|
|
1634
1660
|
}
|
|
1635
1661
|
};
|
|
1636
|
-
}),
|
|
1662
|
+
}), hn = (e, t, n) => {
|
|
1637
1663
|
let r = document.createElement("div");
|
|
1638
1664
|
r.className = "bn-add-file-button";
|
|
1639
1665
|
let i = document.createElement("div");
|
|
@@ -1651,17 +1677,17 @@ var W = {
|
|
|
1651
1677
|
r.removeEventListener("mousedown", o, !0), r.removeEventListener("click", s, !0);
|
|
1652
1678
|
}
|
|
1653
1679
|
};
|
|
1654
|
-
},
|
|
1680
|
+
}, gn = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z\"></path></svg>", _n = (e) => {
|
|
1655
1681
|
let t = document.createElement("div");
|
|
1656
1682
|
t.className = "bn-file-name-with-icon";
|
|
1657
1683
|
let n = document.createElement("div");
|
|
1658
|
-
n.className = "bn-file-icon", n.innerHTML =
|
|
1684
|
+
n.className = "bn-file-icon", n.innerHTML = gn, t.appendChild(n);
|
|
1659
1685
|
let r = document.createElement("p");
|
|
1660
1686
|
return r.className = "bn-file-name", r.textContent = e.props.name, t.appendChild(r), { dom: t };
|
|
1661
|
-
},
|
|
1687
|
+
}, vn = (e, t, n, r) => {
|
|
1662
1688
|
let i = e.props.url !== "" && !!e.props.caption, a = document.createElement(i ? "figure" : "div");
|
|
1663
1689
|
if (a.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
1664
|
-
let n =
|
|
1690
|
+
let n = hn(e, t, r);
|
|
1665
1691
|
a.appendChild(n.dom);
|
|
1666
1692
|
let i = t.onUploadStart((t) => {
|
|
1667
1693
|
if (t === e.id) {
|
|
@@ -1679,7 +1705,7 @@ var W = {
|
|
|
1679
1705
|
}
|
|
1680
1706
|
let o = { dom: a };
|
|
1681
1707
|
if (e.props.showPreview === !1 || !n) {
|
|
1682
|
-
let t =
|
|
1708
|
+
let t = _n(e);
|
|
1683
1709
|
a.appendChild(t.dom), o.destroy = () => {
|
|
1684
1710
|
t.destroy?.();
|
|
1685
1711
|
};
|
|
@@ -1689,13 +1715,13 @@ var W = {
|
|
|
1689
1715
|
t.className = "bn-file-caption", t.textContent = e.props.caption, a.appendChild(t);
|
|
1690
1716
|
}
|
|
1691
1717
|
return o;
|
|
1692
|
-
},
|
|
1718
|
+
}, yn = (e, t) => {
|
|
1693
1719
|
let n = document.createElement("figure"), r = document.createElement("figcaption");
|
|
1694
1720
|
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
1695
|
-
},
|
|
1721
|
+
}, bn = (e, t) => {
|
|
1696
1722
|
let n = document.createElement("div"), r = document.createElement("p");
|
|
1697
1723
|
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
1698
|
-
},
|
|
1724
|
+
}, xn = (e) => ({ url: e.src || void 0 }), Sn = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>", Cn = F((e) => ({
|
|
1699
1725
|
type: "audio",
|
|
1700
1726
|
propSchema: {
|
|
1701
1727
|
backgroundColor: G.backgroundColor,
|
|
@@ -1705,146 +1731,96 @@ var W = {
|
|
|
1705
1731
|
showPreview: { default: !0 }
|
|
1706
1732
|
},
|
|
1707
1733
|
content: "none"
|
|
1708
|
-
})),
|
|
1734
|
+
})), wn = (e = {}) => (e) => {
|
|
1709
1735
|
if (e.tagName === "AUDIO") {
|
|
1710
1736
|
if (e.closest("figure")) return;
|
|
1711
1737
|
let { backgroundColor: t } = K(e);
|
|
1712
1738
|
return {
|
|
1713
|
-
...
|
|
1739
|
+
...xn(e),
|
|
1714
1740
|
backgroundColor: t
|
|
1715
1741
|
};
|
|
1716
1742
|
}
|
|
1717
1743
|
if (e.tagName === "FIGURE") {
|
|
1718
|
-
let t =
|
|
1744
|
+
let t = mn(e, "audio");
|
|
1719
1745
|
if (!t) return;
|
|
1720
1746
|
let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
|
|
1721
1747
|
return {
|
|
1722
|
-
...
|
|
1748
|
+
...xn(n),
|
|
1723
1749
|
backgroundColor: i,
|
|
1724
1750
|
caption: r
|
|
1725
1751
|
};
|
|
1726
1752
|
}
|
|
1727
|
-
},
|
|
1753
|
+
}, Tn = (e = {}) => (t, n) => {
|
|
1728
1754
|
let r = document.createElement("div");
|
|
1729
1755
|
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>";
|
|
1730
1756
|
let i = document.createElement("audio");
|
|
1731
1757
|
return i.className = "bn-audio", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
1732
1758
|
i.src = e;
|
|
1733
|
-
}) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1,
|
|
1734
|
-
},
|
|
1759
|
+
}) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1, vn(t, n, { dom: i }, r.firstElementChild);
|
|
1760
|
+
}, En = (e = {}) => (e, t) => {
|
|
1735
1761
|
if (!e.props.url) return { dom: document.createElement("audio") };
|
|
1736
1762
|
let n;
|
|
1737
|
-
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 ?
|
|
1738
|
-
},
|
|
1763
|
+
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 ? yn(n, e.props.caption) : bn(n, e.props.caption) : { dom: n };
|
|
1764
|
+
}, Dn = I(Cn, (e) => ({
|
|
1739
1765
|
meta: { fileBlockAccept: ["audio/*"] },
|
|
1740
|
-
parse:
|
|
1741
|
-
render:
|
|
1742
|
-
toExternalHTML:
|
|
1766
|
+
parse: wn(e),
|
|
1767
|
+
render: Tn(e),
|
|
1768
|
+
toExternalHTML: En(e),
|
|
1743
1769
|
runsBefore: ["file"]
|
|
1744
|
-
})),
|
|
1745
|
-
|
|
1746
|
-
let t = globalThis, n, r, i = !1;
|
|
1747
|
-
return _e({
|
|
1748
|
-
parser: (a) => {
|
|
1749
|
-
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), [];
|
|
1750
|
-
if (!n) return t[jn] = t[jn] || e.createHighlighter(), t[jn].then((e) => {
|
|
1751
|
-
n = e;
|
|
1752
|
-
});
|
|
1753
|
-
let o = Fn(e, a.language);
|
|
1754
|
-
return !o || o === "text" || o === "none" || o === "plaintext" || o === "txt" ? [] : n.getLoadedLanguages().includes(o) ? (r || (r = t[An] || ve(n), t[An] = r), r(a)) : n.loadLanguage(o);
|
|
1755
|
-
},
|
|
1756
|
-
languageExtractor: (e) => e.attrs.language,
|
|
1757
|
-
nodeTypes: ["codeBlock"]
|
|
1758
|
-
});
|
|
1759
|
-
}
|
|
1760
|
-
//#endregion
|
|
1761
|
-
//#region src/blocks/Code/block.ts
|
|
1762
|
-
var Nn = P(({ defaultLanguage: e = "text" }) => ({
|
|
1763
|
-
type: "codeBlock",
|
|
1764
|
-
propSchema: { language: { default: e } },
|
|
1765
|
-
content: "plain"
|
|
1766
|
-
})), Pn = F(Nn, (e) => ({
|
|
1767
|
-
meta: {
|
|
1768
|
-
code: !0,
|
|
1769
|
-
defining: !0,
|
|
1770
|
-
isolating: !1
|
|
1771
|
-
},
|
|
1772
|
-
parse: (e) => {
|
|
1770
|
+
})), On = (e) => {
|
|
1771
|
+
{
|
|
1773
1772
|
if (e.tagName !== "PRE" || e.childElementCount !== 1 || e.firstElementChild?.tagName !== "CODE") return;
|
|
1774
1773
|
let t = e.firstElementChild;
|
|
1775
|
-
return { language: t.getAttribute("data-language") || t.className.split(" ").find((e) => e.
|
|
1776
|
-
}
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
let a = document.createElement("div");
|
|
1801
|
-
a.contentEditable = "false", a.appendChild(i), r.appendChild(a);
|
|
1802
|
-
}
|
|
1803
|
-
return r.appendChild(i), {
|
|
1804
|
-
dom: r,
|
|
1805
|
-
contentDOM: a,
|
|
1806
|
-
destroy: () => {
|
|
1807
|
-
o?.();
|
|
1808
|
-
}
|
|
1809
|
-
};
|
|
1810
|
-
},
|
|
1811
|
-
toExternalHTML(e) {
|
|
1812
|
-
let t = document.createElement("pre"), n = document.createElement("code");
|
|
1813
|
-
return n.className = `language-${e.props.language}`, n.dataset.language = e.props.language, t.appendChild(n), {
|
|
1814
|
-
dom: t,
|
|
1815
|
-
contentDOM: n
|
|
1816
|
-
};
|
|
1817
|
-
}
|
|
1818
|
-
}), (e) => [n({
|
|
1819
|
-
key: "code-block-highlighter",
|
|
1820
|
-
prosemirrorPlugins: [Mn(e)]
|
|
1821
|
-
}), n({
|
|
1822
|
-
key: "code-block-keyboard-shortcuts",
|
|
1774
|
+
return { language: t.getAttribute("data-language") || t.className.split(" ").find((e) => e.startsWith("language-"))?.replace("language-", "") };
|
|
1775
|
+
}
|
|
1776
|
+
}, kn = ({ el: e, schema: t }, n) => {
|
|
1777
|
+
let r = ie.fromSchema(t), i = e.firstElementChild;
|
|
1778
|
+
return r.parse(i, {
|
|
1779
|
+
preserveWhitespace: "full",
|
|
1780
|
+
topNode: t.nodes[n].create()
|
|
1781
|
+
}).content;
|
|
1782
|
+
}, An = (e) => {
|
|
1783
|
+
let t = document.createElement("pre"), n = document.createElement("code");
|
|
1784
|
+
return n.className = `language-${e.props.language}`, n.dataset.language = e.props.language, t.appendChild(n), {
|
|
1785
|
+
dom: t,
|
|
1786
|
+
contentDOM: n
|
|
1787
|
+
};
|
|
1788
|
+
};
|
|
1789
|
+
//#endregion
|
|
1790
|
+
//#region src/blocks/Code/CodeBlockOptions.ts
|
|
1791
|
+
function jn(e, t) {
|
|
1792
|
+
let n = t.trim().toLowerCase();
|
|
1793
|
+
return Object.entries(e.supportedLanguages ?? {}).find(([e, { aliases: t }]) => e.toLowerCase() === n || t?.some((e) => e.toLowerCase() === n))?.[0];
|
|
1794
|
+
}
|
|
1795
|
+
//#endregion
|
|
1796
|
+
//#region src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.ts
|
|
1797
|
+
var Mn = (e) => (t, r) => n({
|
|
1798
|
+
key: t,
|
|
1823
1799
|
keyboardShortcuts: {
|
|
1824
1800
|
Delete: ({ editor: e }) => e.transact((t) => {
|
|
1825
1801
|
let { block: n } = e.getTextCursorPosition();
|
|
1826
|
-
if (n.type !==
|
|
1827
|
-
let { $from:
|
|
1828
|
-
return
|
|
1802
|
+
if (n.type !== r) return !1;
|
|
1803
|
+
let { $from: i } = t.selection;
|
|
1804
|
+
return !i.parent.textContent && (e.removeBlocks([n]), !0);
|
|
1829
1805
|
}),
|
|
1830
|
-
Tab: ({ editor: t }) => e.indentLineWithTab
|
|
1806
|
+
Tab: ({ editor: t }) => e.indentLineWithTab !== !1 && t.transact((e) => {
|
|
1831
1807
|
let { block: n } = t.getTextCursorPosition();
|
|
1832
|
-
return n.type ===
|
|
1808
|
+
return n.type === r && (e.insertText(" "), !0);
|
|
1833
1809
|
}),
|
|
1834
1810
|
Enter: ({ editor: e }) => e.transact((t) => {
|
|
1835
|
-
let { block: n, nextBlock:
|
|
1836
|
-
if (n.type !==
|
|
1837
|
-
let { $from:
|
|
1838
|
-
if (
|
|
1839
|
-
if (t.delete(
|
|
1840
|
-
let [
|
|
1841
|
-
return e.setTextCursorPosition(
|
|
1811
|
+
let { block: n, nextBlock: i } = e.getTextCursorPosition();
|
|
1812
|
+
if (n.type !== r) return !1;
|
|
1813
|
+
let { $from: a } = t.selection, o = a.parentOffset === a.parent.nodeSize - 2, s = a.parent.textContent.endsWith("\n\n");
|
|
1814
|
+
if (o && s) {
|
|
1815
|
+
if (t.delete(a.pos - 2, a.pos), i) return e.setTextCursorPosition(i, "start"), !0;
|
|
1816
|
+
let [r] = e.insertBlocks([{ type: "paragraph" }], n, "after");
|
|
1817
|
+
return e.setTextCursorPosition(r, "start"), !0;
|
|
1842
1818
|
}
|
|
1843
1819
|
return t.insertText("\n"), !0;
|
|
1844
1820
|
}),
|
|
1845
1821
|
"Shift-Enter": ({ editor: e }) => e.transact(() => {
|
|
1846
1822
|
let { block: t } = e.getTextCursorPosition();
|
|
1847
|
-
if (t.type !==
|
|
1823
|
+
if (t.type !== r) return !1;
|
|
1848
1824
|
let [n] = e.insertBlocks([{ type: "paragraph" }], t, "after");
|
|
1849
1825
|
return e.setTextCursorPosition(n, "start"), !0;
|
|
1850
1826
|
})
|
|
@@ -1854,23 +1830,62 @@ var Nn = P(({ defaultLanguage: e = "text" }) => ({
|
|
|
1854
1830
|
replace: ({ match: t }) => {
|
|
1855
1831
|
let n = t[1].trim();
|
|
1856
1832
|
return {
|
|
1857
|
-
type:
|
|
1858
|
-
props: { language: { language:
|
|
1833
|
+
type: r,
|
|
1834
|
+
props: { language: { language: jn(e, n) ?? n }.language },
|
|
1859
1835
|
content: []
|
|
1860
1836
|
};
|
|
1861
1837
|
}
|
|
1862
1838
|
}]
|
|
1863
|
-
})
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
}
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1839
|
+
}), Nn = (e, t, n, r) => {
|
|
1840
|
+
if (!(n in r)) throw Error(`Language ${n} is not supported.`);
|
|
1841
|
+
let i = document.createElement("select");
|
|
1842
|
+
Object.entries(r).forEach(([e, { name: t }]) => {
|
|
1843
|
+
let n = document.createElement("option");
|
|
1844
|
+
n.value = e, n.text = t, i.appendChild(n);
|
|
1845
|
+
}), i.value = n;
|
|
1846
|
+
let a = (n) => {
|
|
1847
|
+
t.isEditable && t.updateBlock(e.id, { props: { language: n.target.value } });
|
|
1848
|
+
};
|
|
1849
|
+
t.isEditable ? i.addEventListener("change", a) : i.disabled = !0;
|
|
1850
|
+
let o = document.createElement("div");
|
|
1851
|
+
return o.contentEditable = "false", o.appendChild(i), {
|
|
1852
|
+
dom: o,
|
|
1853
|
+
destroy: () => i.removeEventListener("change", a)
|
|
1854
|
+
};
|
|
1855
|
+
}, Pn = (e, t, n) => {
|
|
1856
|
+
let r = document.createElement("pre"), i = document.createElement("code");
|
|
1857
|
+
r.appendChild(i);
|
|
1858
|
+
let a = document.createDocumentFragment(), o;
|
|
1859
|
+
return n && Object.keys(n.supportedLanguages).length > 1 && (o = Nn(e, t, n.selectedLanguage, n.supportedLanguages), a.appendChild(o.dom)), a.appendChild(r), {
|
|
1860
|
+
dom: a,
|
|
1861
|
+
contentDOM: i,
|
|
1862
|
+
destroy: () => {
|
|
1863
|
+
o?.destroy();
|
|
1864
|
+
}
|
|
1865
|
+
};
|
|
1866
|
+
}, Fn = "code-block-keyboard-shortcuts", In = F(({ defaultLanguage: e = "text" }) => ({
|
|
1867
|
+
type: "codeBlock",
|
|
1868
|
+
propSchema: { language: { default: e } },
|
|
1869
|
+
content: "plain"
|
|
1870
|
+
})), Ln = I(In, (e) => ({
|
|
1871
|
+
meta: {
|
|
1872
|
+
code: !0,
|
|
1873
|
+
defining: !0,
|
|
1874
|
+
isolating: !1,
|
|
1875
|
+
highlight: (e) => e.props.language
|
|
1876
|
+
},
|
|
1877
|
+
parse: (e) => On(e),
|
|
1878
|
+
parseContent: (e) => kn(e, "codeBlock"),
|
|
1879
|
+
render: (t, n) => Pn(t, n, e.supportedLanguages && {
|
|
1880
|
+
selectedLanguage: t.props.language,
|
|
1881
|
+
supportedLanguages: e.supportedLanguages
|
|
1882
|
+
}),
|
|
1883
|
+
toExternalHTML: (e) => An(e)
|
|
1884
|
+
}), (e) => [Mn(e)(Fn, "codeBlock")]), Rn = F(() => ({
|
|
1870
1885
|
type: "divider",
|
|
1871
1886
|
propSchema: {},
|
|
1872
1887
|
content: "none"
|
|
1873
|
-
})),
|
|
1888
|
+
})), zn = I(Rn, {
|
|
1874
1889
|
meta: { isolating: !1 },
|
|
1875
1890
|
parse(e) {
|
|
1876
1891
|
if (e.tagName === "HR") return {};
|
|
@@ -1890,7 +1905,7 @@ var In = P(() => ({
|
|
|
1890
1905
|
};
|
|
1891
1906
|
}
|
|
1892
1907
|
}]
|
|
1893
|
-
})]),
|
|
1908
|
+
})]), Bn = (e) => ({ url: e.src || void 0 }), Vn = F(() => ({
|
|
1894
1909
|
type: "file",
|
|
1895
1910
|
propSchema: {
|
|
1896
1911
|
backgroundColor: G.backgroundColor,
|
|
@@ -1899,44 +1914,44 @@ var In = P(() => ({
|
|
|
1899
1914
|
caption: { default: "" }
|
|
1900
1915
|
},
|
|
1901
1916
|
content: "none"
|
|
1902
|
-
})),
|
|
1917
|
+
})), Hn = () => (e) => {
|
|
1903
1918
|
if (e.tagName === "EMBED") {
|
|
1904
1919
|
if (e.closest("figure")) return;
|
|
1905
1920
|
let { backgroundColor: t } = K(e);
|
|
1906
1921
|
return {
|
|
1907
|
-
...
|
|
1922
|
+
...Bn(e),
|
|
1908
1923
|
backgroundColor: t
|
|
1909
1924
|
};
|
|
1910
1925
|
}
|
|
1911
1926
|
if (e.tagName === "FIGURE") {
|
|
1912
|
-
let t =
|
|
1927
|
+
let t = mn(e, "embed");
|
|
1913
1928
|
if (!t) return;
|
|
1914
1929
|
let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
|
|
1915
1930
|
return {
|
|
1916
|
-
...
|
|
1931
|
+
...Bn(n),
|
|
1917
1932
|
backgroundColor: i,
|
|
1918
1933
|
caption: r
|
|
1919
1934
|
};
|
|
1920
1935
|
}
|
|
1921
|
-
},
|
|
1936
|
+
}, Un = I(Vn, {
|
|
1922
1937
|
meta: { fileBlockAccept: ["*/*"] },
|
|
1923
|
-
parse:
|
|
1938
|
+
parse: Hn(),
|
|
1924
1939
|
render(e, t) {
|
|
1925
|
-
return
|
|
1940
|
+
return vn(e, t);
|
|
1926
1941
|
},
|
|
1927
1942
|
toExternalHTML(e) {
|
|
1928
1943
|
if (!e.props.url) return { dom: document.createElement("embed") };
|
|
1929
1944
|
let t = document.createElement("a");
|
|
1930
|
-
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ?
|
|
1945
|
+
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? bn(t, e.props.caption) : { dom: t };
|
|
1931
1946
|
}
|
|
1932
1947
|
});
|
|
1933
1948
|
//#endregion
|
|
1934
1949
|
//#region src/blocks/getDetailsContent.ts
|
|
1935
|
-
function
|
|
1950
|
+
function Wn(e, t, n) {
|
|
1936
1951
|
let a = r.fromSchema(t), o = e.querySelector(":scope > summary"), s;
|
|
1937
1952
|
if (o) {
|
|
1938
1953
|
let e = o.cloneNode(!0);
|
|
1939
|
-
|
|
1954
|
+
We(e), s = a.parse(e, {
|
|
1940
1955
|
topNode: t.nodes.paragraph.create(),
|
|
1941
1956
|
preserveWhitespace: !0
|
|
1942
1957
|
}).content;
|
|
@@ -1952,10 +1967,10 @@ function Hn(e, t, n) {
|
|
|
1952
1967
|
}
|
|
1953
1968
|
//#endregion
|
|
1954
1969
|
//#region src/blocks/ToggleWrapper/createToggleWrapper.ts
|
|
1955
|
-
var
|
|
1970
|
+
var Gn = {
|
|
1956
1971
|
set: (e, t) => window.localStorage.setItem(`toggle-${e.id}`, t ? "true" : "false"),
|
|
1957
1972
|
get: (e) => window.localStorage.getItem(`toggle-${e.id}`) === "true"
|
|
1958
|
-
},
|
|
1973
|
+
}, Kn = (e, t, n, r = Gn) => {
|
|
1959
1974
|
if ("isToggleable" in e.props && !e.props.isToggleable) return { dom: n };
|
|
1960
1975
|
let i = document.createElement("div"), a = document.createElement("div");
|
|
1961
1976
|
a.className = "bn-toggle-wrapper";
|
|
@@ -2005,20 +2020,20 @@ var Un = {
|
|
|
2005
2020
|
o.removeEventListener("mousedown", s), o.removeEventListener("click", c), l.removeEventListener("mousedown", u), l.removeEventListener("click", d), p?.();
|
|
2006
2021
|
}
|
|
2007
2022
|
};
|
|
2008
|
-
},
|
|
2023
|
+
}, qn = [
|
|
2009
2024
|
1,
|
|
2010
2025
|
2,
|
|
2011
2026
|
3,
|
|
2012
2027
|
4,
|
|
2013
2028
|
5,
|
|
2014
2029
|
6
|
|
2015
|
-
],
|
|
2030
|
+
], Jn = (e) => ({ editor: t }) => {
|
|
2016
2031
|
let n = t.getTextCursorPosition();
|
|
2017
|
-
return t.schema.blockSchema[n.block.type].content === "inline"
|
|
2032
|
+
return t.schema.blockSchema[n.block.type].content === "inline" && (t.updateBlock(n.block, {
|
|
2018
2033
|
type: "heading",
|
|
2019
2034
|
props: { level: e }
|
|
2020
|
-
}), !0)
|
|
2021
|
-
},
|
|
2035
|
+
}), !0);
|
|
2036
|
+
}, Yn = F(({ defaultLevel: e = 1, levels: t = qn, allowToggleHeadings: n = !0 } = {}) => ({
|
|
2022
2037
|
type: "heading",
|
|
2023
2038
|
propSchema: {
|
|
2024
2039
|
...G,
|
|
@@ -2032,7 +2047,7 @@ var Un = {
|
|
|
2032
2047
|
} } : {}
|
|
2033
2048
|
},
|
|
2034
2049
|
content: "inline"
|
|
2035
|
-
})),
|
|
2050
|
+
})), Xn = I(Yn, ({ allowToggleHeadings: e = !0 } = {}) => ({
|
|
2036
2051
|
meta: { isolating: !1 },
|
|
2037
2052
|
parse(t) {
|
|
2038
2053
|
if (e && t.tagName === "DETAILS") {
|
|
@@ -2073,13 +2088,13 @@ var Un = {
|
|
|
2073
2088
|
};
|
|
2074
2089
|
},
|
|
2075
2090
|
...e ? { parseContent: ({ el: e, schema: t }) => {
|
|
2076
|
-
if (e.tagName === "DETAILS") return
|
|
2091
|
+
if (e.tagName === "DETAILS") return Wn(e, t, "heading");
|
|
2077
2092
|
} } : {},
|
|
2078
2093
|
runsBefore: ["toggleListItem"],
|
|
2079
2094
|
render(t, n) {
|
|
2080
2095
|
let r = document.createElement(`h${t.props.level}`);
|
|
2081
2096
|
return e ? {
|
|
2082
|
-
...
|
|
2097
|
+
...Kn(t, n, r),
|
|
2083
2098
|
contentDOM: r
|
|
2084
2099
|
} : {
|
|
2085
2100
|
dom: r,
|
|
@@ -2103,9 +2118,9 @@ var Un = {
|
|
|
2103
2118
|
contentDOM: n
|
|
2104
2119
|
};
|
|
2105
2120
|
}
|
|
2106
|
-
}), ({ levels: e =
|
|
2121
|
+
}), ({ levels: e = qn } = {}) => [n({
|
|
2107
2122
|
key: "heading-shortcuts",
|
|
2108
|
-
keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`,
|
|
2123
|
+
keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`, Jn(e)]) ?? []),
|
|
2109
2124
|
inputRules: e.map((e) => ({
|
|
2110
2125
|
find: RegExp(`^(#{${e}})\\s$`),
|
|
2111
2126
|
replace({ match: e }) {
|
|
@@ -2115,8 +2130,8 @@ var Un = {
|
|
|
2115
2130
|
};
|
|
2116
2131
|
}
|
|
2117
2132
|
}))
|
|
2118
|
-
})]),
|
|
2119
|
-
let { dom: a, destroy: o } =
|
|
2133
|
+
})]), Zn = (e, t, n, r, i) => {
|
|
2134
|
+
let { dom: a, destroy: o } = vn(e, t, n, i), s = a;
|
|
2120
2135
|
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");
|
|
2121
2136
|
let c = document.createElement("div");
|
|
2122
2137
|
c.className = "bn-resize-handle", c.style.left = "4px", c.style.display = "none", r.appendChild(c);
|
|
@@ -2136,7 +2151,7 @@ var Un = {
|
|
|
2136
2151
|
}, h = () => {
|
|
2137
2152
|
t.isEditable && (c.style.display = "", l.style.display = "");
|
|
2138
2153
|
}, g = (e) => {
|
|
2139
|
-
e.relatedTarget
|
|
2154
|
+
e.relatedTarget !== c && e.relatedTarget !== l && (d || t.isEditable && (c.style.display = "none", l.style.display = "none"));
|
|
2140
2155
|
}, _ = (e) => {
|
|
2141
2156
|
e.preventDefault(), s.contains(u) || s.appendChild(u);
|
|
2142
2157
|
let t = "touches" in e ? e.touches[0].clientX : e.clientX;
|
|
@@ -2160,11 +2175,11 @@ var Un = {
|
|
|
2160
2175
|
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);
|
|
2161
2176
|
}
|
|
2162
2177
|
};
|
|
2163
|
-
},
|
|
2178
|
+
}, Qn = (e) => ({
|
|
2164
2179
|
url: e.src || void 0,
|
|
2165
2180
|
previewWidth: e.width || void 0,
|
|
2166
2181
|
name: e.alt || void 0
|
|
2167
|
-
}),
|
|
2182
|
+
}), $n = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>", er = F((e = {}) => ({
|
|
2168
2183
|
type: "image",
|
|
2169
2184
|
propSchema: {
|
|
2170
2185
|
textAlignment: G.textAlignment,
|
|
@@ -2179,26 +2194,26 @@ var Un = {
|
|
|
2179
2194
|
}
|
|
2180
2195
|
},
|
|
2181
2196
|
content: "none"
|
|
2182
|
-
})),
|
|
2197
|
+
})), tr = (e = {}) => (e) => {
|
|
2183
2198
|
if (e.tagName === "IMG") {
|
|
2184
2199
|
if (e.closest("figure")) return;
|
|
2185
2200
|
let { backgroundColor: t } = K(e);
|
|
2186
2201
|
return {
|
|
2187
|
-
...
|
|
2202
|
+
...Qn(e),
|
|
2188
2203
|
backgroundColor: t
|
|
2189
2204
|
};
|
|
2190
2205
|
}
|
|
2191
2206
|
if (e.tagName === "FIGURE") {
|
|
2192
|
-
let t =
|
|
2207
|
+
let t = mn(e, "img");
|
|
2193
2208
|
if (!t) return;
|
|
2194
2209
|
let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
|
|
2195
2210
|
return {
|
|
2196
|
-
...
|
|
2211
|
+
...Qn(n),
|
|
2197
2212
|
backgroundColor: i,
|
|
2198
2213
|
caption: r
|
|
2199
2214
|
};
|
|
2200
2215
|
}
|
|
2201
|
-
},
|
|
2216
|
+
}, nr = (e = {}) => (t, n) => {
|
|
2202
2217
|
let r = document.createElement("div");
|
|
2203
2218
|
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>";
|
|
2204
2219
|
let i = document.createElement("div");
|
|
@@ -2206,21 +2221,21 @@ var Un = {
|
|
|
2206
2221
|
let a = document.createElement("img");
|
|
2207
2222
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
2208
2223
|
a.src = e;
|
|
2209
|
-
}) : 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),
|
|
2210
|
-
},
|
|
2224
|
+
}) : 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), Zn(t, n, { dom: i }, i, r.firstElementChild);
|
|
2225
|
+
}, rr = (e = {}) => (e, t) => {
|
|
2211
2226
|
if (!e.props.url) return { dom: document.createElement("img") };
|
|
2212
2227
|
let n;
|
|
2213
|
-
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 ?
|
|
2214
|
-
},
|
|
2228
|
+
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 ? yn(n, e.props.caption) : bn(n, e.props.caption) : { dom: n };
|
|
2229
|
+
}, ir = I(er, (e) => ({
|
|
2215
2230
|
meta: { fileBlockAccept: ["image/*"] },
|
|
2216
|
-
parse:
|
|
2217
|
-
render:
|
|
2218
|
-
toExternalHTML:
|
|
2231
|
+
parse: tr(e),
|
|
2232
|
+
render: nr(e),
|
|
2233
|
+
toExternalHTML: rr(e),
|
|
2219
2234
|
runsBefore: ["file"]
|
|
2220
|
-
})),
|
|
2221
|
-
let i = b(
|
|
2235
|
+
})), ar = (e, t, n) => ({ state: r, dispatch: i }) => !i || or(r.tr, e, t, n), or = (e, t, n, r) => {
|
|
2236
|
+
let i = b(Ae(e.doc, t));
|
|
2222
2237
|
if (!i.isBlockContainer) return !1;
|
|
2223
|
-
let a =
|
|
2238
|
+
let a = j(e), o = [{
|
|
2224
2239
|
type: i.bnBlock.node.type,
|
|
2225
2240
|
attrs: r ? {
|
|
2226
2241
|
...i.bnBlock.node.attrs,
|
|
@@ -2231,23 +2246,23 @@ var Un = {
|
|
|
2231
2246
|
attrs: r ? { ...i.blockContent.node.attrs } : {}
|
|
2232
2247
|
}];
|
|
2233
2248
|
return e.split(t, 2, o), !0;
|
|
2234
|
-
},
|
|
2249
|
+
}, sr = (e, t) => {
|
|
2235
2250
|
let { blockInfo: n, selectionEmpty: r } = e.transact((e) => ({
|
|
2236
|
-
blockInfo:
|
|
2251
|
+
blockInfo: x(e),
|
|
2237
2252
|
selectionEmpty: e.selection.anchor === e.selection.head
|
|
2238
2253
|
}));
|
|
2239
2254
|
if (!n.isBlockContainer) return !1;
|
|
2240
2255
|
let { bnBlock: i, blockContent: a } = n;
|
|
2241
2256
|
return a.node.type.name !== t || !r ? !1 : a.node.childCount === 0 ? (e.transact((e) => {
|
|
2242
|
-
|
|
2257
|
+
en(e, i.beforePos, {
|
|
2243
2258
|
type: "paragraph",
|
|
2244
2259
|
props: {}
|
|
2245
2260
|
});
|
|
2246
|
-
}), !0) : a.node.childCount > 0
|
|
2261
|
+
}), !0) : a.node.childCount > 0 && e.transact((e) => (e.deleteSelection(), e.scrollIntoView(), or(e, e.selection.from, !0)));
|
|
2247
2262
|
};
|
|
2248
2263
|
//#endregion
|
|
2249
2264
|
//#region src/blocks/ListItem/getListItemContent.ts
|
|
2250
|
-
function
|
|
2265
|
+
function cr(e, t, n) {
|
|
2251
2266
|
let a = r.fromSchema(t), o = e, s = document.createElement("div");
|
|
2252
2267
|
s.setAttribute("data-node-type", "blockGroup");
|
|
2253
2268
|
for (let e of Array.from(o.childNodes)) s.appendChild(e.cloneNode(!0));
|
|
@@ -2264,18 +2279,18 @@ function or(e, t, n) {
|
|
|
2264
2279
|
}
|
|
2265
2280
|
//#endregion
|
|
2266
2281
|
//#region src/blocks/ListItem/BulletListItem/block.ts
|
|
2267
|
-
var
|
|
2282
|
+
var lr = F(() => ({
|
|
2268
2283
|
type: "bulletListItem",
|
|
2269
2284
|
propSchema: { ...G },
|
|
2270
2285
|
content: "inline"
|
|
2271
|
-
})),
|
|
2286
|
+
})), ur = I(lr, {
|
|
2272
2287
|
meta: { isolating: !1 },
|
|
2273
2288
|
parse(e) {
|
|
2274
2289
|
if (e.tagName !== "LI") return;
|
|
2275
2290
|
let t = e.parentElement;
|
|
2276
2291
|
if (t === null || t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL" || !e.closest("ul, ol")) return K(e);
|
|
2277
2292
|
},
|
|
2278
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2293
|
+
parseContent: ({ el: e, schema: t }) => cr(e, t, "bulletListItem"),
|
|
2279
2294
|
render() {
|
|
2280
2295
|
let e = document.createElement("p");
|
|
2281
2296
|
return {
|
|
@@ -2293,25 +2308,25 @@ var sr = P(() => ({
|
|
|
2293
2308
|
}, [n({
|
|
2294
2309
|
key: "bullet-list-item-shortcuts",
|
|
2295
2310
|
keyboardShortcuts: {
|
|
2296
|
-
Enter: ({ editor: e }) =>
|
|
2311
|
+
Enter: ({ editor: e }) => sr(e, "bulletListItem"),
|
|
2297
2312
|
"Mod-Shift-8": ({ editor: e }) => {
|
|
2298
2313
|
let t = e.getTextCursorPosition();
|
|
2299
|
-
return e.schema.blockSchema[t.block.type].content === "inline"
|
|
2314
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
2300
2315
|
type: "bulletListItem",
|
|
2301
2316
|
props: {}
|
|
2302
|
-
}), !0)
|
|
2317
|
+
}), !0);
|
|
2303
2318
|
}
|
|
2304
2319
|
},
|
|
2305
2320
|
inputRules: [{
|
|
2306
2321
|
find: /^\s?[-+*]\s$/,
|
|
2307
2322
|
replace({ editor: e }) {
|
|
2308
|
-
if (
|
|
2323
|
+
if (x(e.prosemirrorState).blockNoteType !== "heading") return {
|
|
2309
2324
|
type: "bulletListItem",
|
|
2310
2325
|
props: {}
|
|
2311
2326
|
};
|
|
2312
2327
|
}
|
|
2313
2328
|
}]
|
|
2314
|
-
})]),
|
|
2329
|
+
})]), dr = F(() => ({
|
|
2315
2330
|
type: "checkListItem",
|
|
2316
2331
|
propSchema: {
|
|
2317
2332
|
...G,
|
|
@@ -2321,7 +2336,7 @@ var sr = P(() => ({
|
|
|
2321
2336
|
}
|
|
2322
2337
|
},
|
|
2323
2338
|
content: "inline"
|
|
2324
|
-
})),
|
|
2339
|
+
})), fr = I(dr, {
|
|
2325
2340
|
meta: { isolating: !1 },
|
|
2326
2341
|
parse(e) {
|
|
2327
2342
|
if (e.tagName === "input") return e.closest("[data-content-type]") || e.closest("li") ? void 0 : e.type === "checkbox" ? { checked: e.checked } : void 0;
|
|
@@ -2335,7 +2350,7 @@ var sr = P(() => ({
|
|
|
2335
2350
|
};
|
|
2336
2351
|
}
|
|
2337
2352
|
},
|
|
2338
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2353
|
+
parseContent: ({ el: e, schema: t }) => cr(e, t, "checkListItem"),
|
|
2339
2354
|
render(e, t) {
|
|
2340
2355
|
let n = document.createDocumentFragment(), r = document.createElement("input");
|
|
2341
2356
|
r.type = "checkbox", r.checked = e.props.checked, e.props.checked && r.setAttribute("checked", ""), r.disabled = !t.isEditable, r.addEventListener("change", () => {
|
|
@@ -2360,13 +2375,13 @@ var sr = P(() => ({
|
|
|
2360
2375
|
}, [n({
|
|
2361
2376
|
key: "check-list-item-shortcuts",
|
|
2362
2377
|
keyboardShortcuts: {
|
|
2363
|
-
Enter: ({ editor: e }) =>
|
|
2378
|
+
Enter: ({ editor: e }) => sr(e, "checkListItem"),
|
|
2364
2379
|
"Mod-Shift-9": ({ editor: e }) => {
|
|
2365
2380
|
let t = e.getTextCursorPosition();
|
|
2366
|
-
return e.schema.blockSchema[t.block.type].content === "inline"
|
|
2381
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
2367
2382
|
type: "checkListItem",
|
|
2368
2383
|
props: {}
|
|
2369
|
-
}), !0)
|
|
2384
|
+
}), !0);
|
|
2370
2385
|
}
|
|
2371
2386
|
},
|
|
2372
2387
|
inputRules: [{
|
|
@@ -2389,7 +2404,7 @@ var sr = P(() => ({
|
|
|
2389
2404
|
})]);
|
|
2390
2405
|
//#endregion
|
|
2391
2406
|
//#region src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts
|
|
2392
|
-
function
|
|
2407
|
+
function pr(e, t, n, r) {
|
|
2393
2408
|
let i = !!e.firstChild.attrs.start, a = b({
|
|
2394
2409
|
posBeforeNode: t,
|
|
2395
2410
|
node: e
|
|
@@ -2438,7 +2453,7 @@ function dr(e, t, n, r) {
|
|
|
2438
2453
|
hasStart: i
|
|
2439
2454
|
};
|
|
2440
2455
|
}
|
|
2441
|
-
function
|
|
2456
|
+
function mr(e, t) {
|
|
2442
2457
|
let n = /* @__PURE__ */ new Map(), r = t.decorations.map(e.mapping, e.doc), i = e.changedRange() ?? {
|
|
2443
2458
|
from: 0,
|
|
2444
2459
|
to: e.doc.nodeSize - 2
|
|
@@ -2446,8 +2461,8 @@ function fr(e, t) {
|
|
|
2446
2461
|
e.doc.nodesBetween(i.from, e.doc.nodeSize - 2, (t, s, c) => {
|
|
2447
2462
|
if (c && o.has(c)) return !1;
|
|
2448
2463
|
if (t.type.name === "blockContainer" && t.firstChild.type.name === "numberedListItem") {
|
|
2449
|
-
let { index: l, isFirst: u, hasStart: d } =
|
|
2450
|
-
if (r.find(s + 1, s + 1 + f.nodeSize, (e) => e.index === l && e.isFirst === u && e.hasStart === d).length === 0) a.push(
|
|
2464
|
+
let { index: l, isFirst: u, hasStart: d } = pr(t, s, e, n), f = e.doc.nodeAt(s + 1);
|
|
2465
|
+
if (r.find(s + 1, s + 1 + f.nodeSize, (e) => e.index === l && e.isFirst === u && e.hasStart === d).length === 0) a.push(ye.node(s + 1, s + 1 + f.nodeSize, { "data-index": l.toString() }, {
|
|
2451
2466
|
index: l,
|
|
2452
2467
|
isFirst: u,
|
|
2453
2468
|
hasStart: d
|
|
@@ -2458,20 +2473,20 @@ function fr(e, t) {
|
|
|
2458
2473
|
let s = a.flatMap((e) => r.find(e.from, e.to));
|
|
2459
2474
|
return { decorations: r.remove(s).add(e.doc, a) };
|
|
2460
2475
|
}
|
|
2461
|
-
var
|
|
2462
|
-
key: new
|
|
2476
|
+
var hr = () => new _e({
|
|
2477
|
+
key: new ve("numbered-list-indexing-decorations"),
|
|
2463
2478
|
state: {
|
|
2464
2479
|
init(e, t) {
|
|
2465
|
-
return
|
|
2480
|
+
return mr(t.tr, { decorations: be.empty });
|
|
2466
2481
|
},
|
|
2467
2482
|
apply(e, t) {
|
|
2468
|
-
return !e.docChanged && t.decorations ? t :
|
|
2483
|
+
return !e.docChanged && t.decorations ? t : mr(e, t);
|
|
2469
2484
|
}
|
|
2470
2485
|
},
|
|
2471
2486
|
props: { decorations(e) {
|
|
2472
|
-
return this.getState(e)?.decorations ??
|
|
2487
|
+
return this.getState(e)?.decorations ?? be.empty;
|
|
2473
2488
|
} }
|
|
2474
|
-
}),
|
|
2489
|
+
}), gr = F(() => ({
|
|
2475
2490
|
type: "numberedListItem",
|
|
2476
2491
|
propSchema: {
|
|
2477
2492
|
...G,
|
|
@@ -2481,7 +2496,7 @@ var pr = () => new ye({
|
|
|
2481
2496
|
}
|
|
2482
2497
|
},
|
|
2483
2498
|
content: "inline"
|
|
2484
|
-
})),
|
|
2499
|
+
})), _r = I(gr, {
|
|
2485
2500
|
meta: { isolating: !1 },
|
|
2486
2501
|
parse(e) {
|
|
2487
2502
|
if (e.tagName !== "LI") return;
|
|
@@ -2494,7 +2509,7 @@ var pr = () => new ye({
|
|
|
2494
2509
|
};
|
|
2495
2510
|
}
|
|
2496
2511
|
},
|
|
2497
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2512
|
+
parseContent: ({ el: e, schema: t }) => cr(e, t, "numberedListItem"),
|
|
2498
2513
|
render() {
|
|
2499
2514
|
let e = document.createElement("p");
|
|
2500
2515
|
return {
|
|
@@ -2514,7 +2529,7 @@ var pr = () => new ye({
|
|
|
2514
2529
|
inputRules: [{
|
|
2515
2530
|
find: /^\s?(\d+)\.\s$/,
|
|
2516
2531
|
replace({ match: e, editor: t }) {
|
|
2517
|
-
if (
|
|
2532
|
+
if (x(t.prosemirrorState).blockNoteType === "heading") return;
|
|
2518
2533
|
let n = parseInt(e[1]);
|
|
2519
2534
|
return {
|
|
2520
2535
|
type: "numberedListItem",
|
|
@@ -2523,21 +2538,21 @@ var pr = () => new ye({
|
|
|
2523
2538
|
}
|
|
2524
2539
|
}],
|
|
2525
2540
|
keyboardShortcuts: {
|
|
2526
|
-
Enter: ({ editor: e }) =>
|
|
2541
|
+
Enter: ({ editor: e }) => sr(e, "numberedListItem"),
|
|
2527
2542
|
"Mod-Shift-7": ({ editor: e }) => {
|
|
2528
2543
|
let t = e.getTextCursorPosition();
|
|
2529
|
-
return e.schema.blockSchema[t.block.type].content === "inline"
|
|
2544
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
2530
2545
|
type: "numberedListItem",
|
|
2531
2546
|
props: {}
|
|
2532
|
-
}), !0)
|
|
2547
|
+
}), !0);
|
|
2533
2548
|
}
|
|
2534
2549
|
},
|
|
2535
|
-
prosemirrorPlugins: [
|
|
2536
|
-
})]),
|
|
2550
|
+
prosemirrorPlugins: [hr()]
|
|
2551
|
+
})]), vr = F(() => ({
|
|
2537
2552
|
type: "toggleListItem",
|
|
2538
2553
|
propSchema: { ...G },
|
|
2539
2554
|
content: "inline"
|
|
2540
|
-
})),
|
|
2555
|
+
})), yr = I(vr, {
|
|
2541
2556
|
meta: { isolating: !1 },
|
|
2542
2557
|
parse(e) {
|
|
2543
2558
|
if (e.tagName === "DETAILS") return K(e);
|
|
@@ -2549,13 +2564,13 @@ var pr = () => new ye({
|
|
|
2549
2564
|
parseContent: ({ el: e, schema: t }) => {
|
|
2550
2565
|
let n = e.tagName === "DETAILS" ? e : e.querySelector(":scope > details");
|
|
2551
2566
|
if (!n) throw Error("No details found in toggleListItem parseContent");
|
|
2552
|
-
return
|
|
2567
|
+
return Wn(n, t, "toggleListItem");
|
|
2553
2568
|
},
|
|
2554
2569
|
runsBefore: ["bulletListItem"],
|
|
2555
2570
|
render(e, t) {
|
|
2556
2571
|
let n = document.createElement("p");
|
|
2557
2572
|
return {
|
|
2558
|
-
...
|
|
2573
|
+
...Kn(e, t, n),
|
|
2559
2574
|
contentDOM: n
|
|
2560
2575
|
};
|
|
2561
2576
|
},
|
|
@@ -2572,20 +2587,20 @@ var pr = () => new ye({
|
|
|
2572
2587
|
}, [n({
|
|
2573
2588
|
key: "toggle-list-item-shortcuts",
|
|
2574
2589
|
keyboardShortcuts: {
|
|
2575
|
-
Enter: ({ editor: e }) =>
|
|
2590
|
+
Enter: ({ editor: e }) => sr(e, "toggleListItem"),
|
|
2576
2591
|
"Mod-Shift-6": ({ editor: e }) => {
|
|
2577
2592
|
let t = e.getTextCursorPosition();
|
|
2578
|
-
return e.schema.blockSchema[t.block.type].content === "inline"
|
|
2593
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
2579
2594
|
type: "toggleListItem",
|
|
2580
2595
|
props: {}
|
|
2581
|
-
}), !0)
|
|
2596
|
+
}), !0);
|
|
2582
2597
|
}
|
|
2583
2598
|
}
|
|
2584
|
-
})]),
|
|
2599
|
+
})]), br = F(() => ({
|
|
2585
2600
|
type: "pageBreak",
|
|
2586
2601
|
propSchema: {},
|
|
2587
2602
|
content: "none"
|
|
2588
|
-
})),
|
|
2603
|
+
})), xr = I(br, {
|
|
2589
2604
|
parse(e) {
|
|
2590
2605
|
if (e.tagName === "DIV" && e.hasAttribute("data-page-break")) return {};
|
|
2591
2606
|
},
|
|
@@ -2597,11 +2612,11 @@ var pr = () => new ye({
|
|
|
2597
2612
|
let e = document.createElement("div");
|
|
2598
2613
|
return e.setAttribute("data-page-break", ""), { dom: e };
|
|
2599
2614
|
}
|
|
2600
|
-
}),
|
|
2615
|
+
}), Sr = (e) => e.extend({ blockSpecs: { pageBreak: xr() } }), Cr = F(() => ({
|
|
2601
2616
|
type: "paragraph",
|
|
2602
2617
|
propSchema: G,
|
|
2603
2618
|
content: "inline"
|
|
2604
|
-
})),
|
|
2619
|
+
})), wr = I(Cr, {
|
|
2605
2620
|
meta: { isolating: !1 },
|
|
2606
2621
|
parse: (e) => {
|
|
2607
2622
|
if (e.tagName === "P" && e.textContent?.trim()) return K(e);
|
|
@@ -2625,19 +2640,19 @@ var pr = () => new ye({
|
|
|
2625
2640
|
key: "paragraph-shortcuts",
|
|
2626
2641
|
keyboardShortcuts: { "Mod-Alt-0": ({ editor: e }) => {
|
|
2627
2642
|
let t = e.getTextCursorPosition();
|
|
2628
|
-
return e.schema.blockSchema[t.block.type].content === "inline"
|
|
2643
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
2629
2644
|
type: "paragraph",
|
|
2630
2645
|
props: {}
|
|
2631
|
-
}), !0)
|
|
2646
|
+
}), !0);
|
|
2632
2647
|
} }
|
|
2633
|
-
})]),
|
|
2648
|
+
})]), Tr = F(() => ({
|
|
2634
2649
|
type: "quote",
|
|
2635
2650
|
propSchema: {
|
|
2636
2651
|
backgroundColor: G.backgroundColor,
|
|
2637
2652
|
textColor: G.textColor
|
|
2638
2653
|
},
|
|
2639
2654
|
content: "inline"
|
|
2640
|
-
})),
|
|
2655
|
+
})), Er = I(Tr, {
|
|
2641
2656
|
meta: { isolating: !1 },
|
|
2642
2657
|
parse(e) {
|
|
2643
2658
|
if (e.tagName === "BLOCKQUOTE") {
|
|
@@ -2666,10 +2681,10 @@ var pr = () => new ye({
|
|
|
2666
2681
|
key: "quote-block-shortcuts",
|
|
2667
2682
|
keyboardShortcuts: { "Mod-Alt-q": ({ editor: e }) => {
|
|
2668
2683
|
let t = e.getTextCursorPosition();
|
|
2669
|
-
return e.schema.blockSchema[t.block.type].content === "inline"
|
|
2684
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
2670
2685
|
type: "quote",
|
|
2671
2686
|
props: {}
|
|
2672
|
-
}), !0)
|
|
2687
|
+
}), !0);
|
|
2673
2688
|
} },
|
|
2674
2689
|
inputRules: [{
|
|
2675
2690
|
find: /* @__PURE__ */ RegExp("^>\\s$"),
|
|
@@ -2688,15 +2703,15 @@ var pr = () => new ye({
|
|
|
2688
2703
|
};
|
|
2689
2704
|
}
|
|
2690
2705
|
}]
|
|
2691
|
-
})]),
|
|
2706
|
+
})]), Dr = "blockLevelSuggestion";
|
|
2692
2707
|
function Y(e) {
|
|
2693
2708
|
return e && e.options.extensions.some((e) => {
|
|
2694
2709
|
if (e.type !== "mark") return !1;
|
|
2695
2710
|
let t = g(e, "group");
|
|
2696
2711
|
return typeof t == "string" && t.split(" ").includes("blockLevelSuggestion");
|
|
2697
|
-
}) ?
|
|
2712
|
+
}) ? Dr : "";
|
|
2698
2713
|
}
|
|
2699
|
-
var
|
|
2714
|
+
var Or = 120, kr = 31, Ar = s.create({
|
|
2700
2715
|
name: "BlockNoteTableExtension",
|
|
2701
2716
|
addProseMirrorPlugins: () => [ue({
|
|
2702
2717
|
cellMinWidth: 35,
|
|
@@ -2718,13 +2733,14 @@ var Er = 120, Dr = 31, Or = s.create({
|
|
|
2718
2733
|
};
|
|
2719
2734
|
},
|
|
2720
2735
|
extendNodeSchema(e) {
|
|
2721
|
-
|
|
2736
|
+
let t = {
|
|
2722
2737
|
name: e.name,
|
|
2723
2738
|
options: e.options,
|
|
2724
2739
|
storage: e.storage
|
|
2725
|
-
}
|
|
2740
|
+
};
|
|
2741
|
+
return { tableRole: d(g(e, "tableRole", t)) };
|
|
2726
2742
|
}
|
|
2727
|
-
}),
|
|
2743
|
+
}), jr = { textColor: G.textColor }, Mr = u.create({
|
|
2728
2744
|
name: "tableHeader",
|
|
2729
2745
|
addOptions() {
|
|
2730
2746
|
return { HTMLAttributes: {} };
|
|
@@ -2751,7 +2767,7 @@ var Er = 120, Dr = 31, Or = s.create({
|
|
|
2751
2767
|
parseHTML() {
|
|
2752
2768
|
return [{
|
|
2753
2769
|
tag: "th",
|
|
2754
|
-
getContent: (e, t) =>
|
|
2770
|
+
getContent: (e, t) => Lr(e, t)
|
|
2755
2771
|
}];
|
|
2756
2772
|
},
|
|
2757
2773
|
renderHTML({ HTMLAttributes: e }) {
|
|
@@ -2761,7 +2777,7 @@ var Er = 120, Dr = 31, Or = s.create({
|
|
|
2761
2777
|
0
|
|
2762
2778
|
];
|
|
2763
2779
|
}
|
|
2764
|
-
}),
|
|
2780
|
+
}), Nr = u.create({
|
|
2765
2781
|
name: "tableCell",
|
|
2766
2782
|
addOptions() {
|
|
2767
2783
|
return { HTMLAttributes: {} };
|
|
@@ -2788,7 +2804,7 @@ var Er = 120, Dr = 31, Or = s.create({
|
|
|
2788
2804
|
parseHTML() {
|
|
2789
2805
|
return [{
|
|
2790
2806
|
tag: "td",
|
|
2791
|
-
getContent: (e, t) =>
|
|
2807
|
+
getContent: (e, t) => Lr(e, t)
|
|
2792
2808
|
}];
|
|
2793
2809
|
},
|
|
2794
2810
|
renderHTML({ HTMLAttributes: e }) {
|
|
@@ -2798,7 +2814,7 @@ var Er = 120, Dr = 31, Or = s.create({
|
|
|
2798
2814
|
0
|
|
2799
2815
|
];
|
|
2800
2816
|
}
|
|
2801
|
-
}),
|
|
2817
|
+
}), Pr = u.create({
|
|
2802
2818
|
name: "table",
|
|
2803
2819
|
content: "tableRow+",
|
|
2804
2820
|
group: "blockContent",
|
|
@@ -2811,7 +2827,7 @@ var Er = 120, Dr = 31, Or = s.create({
|
|
|
2811
2827
|
return [{ tag: "table" }];
|
|
2812
2828
|
},
|
|
2813
2829
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
2814
|
-
let n =
|
|
2830
|
+
let n = He(this.name, "table", {
|
|
2815
2831
|
...this.options.domAttributes?.blockContent || {},
|
|
2816
2832
|
...t
|
|
2817
2833
|
}, this.options.domAttributes?.inlineContent || {}), r = document.createElement("colgroup");
|
|
@@ -2831,7 +2847,7 @@ var Er = 120, Dr = 31, Or = s.create({
|
|
|
2831
2847
|
constructor(e, t, n) {
|
|
2832
2848
|
super(e, t), this.node = e, this.cellMinWidth = t, this.blockContentHTMLAttributes = n;
|
|
2833
2849
|
let r = document.createElement("div");
|
|
2834
|
-
r.className =
|
|
2850
|
+
r.className = A("bn-block-content", n.class), r.setAttribute("data-content-type", "table");
|
|
2835
2851
|
for (let [e, t] of Object.entries(n)) e !== "class" && r.setAttribute(e, t);
|
|
2836
2852
|
let i = this.dom, a = document.createElement("div");
|
|
2837
2853
|
a.className = "tableWrapper-inner", a.appendChild(i.firstChild), i.appendChild(a), r.appendChild(i);
|
|
@@ -2843,8 +2859,8 @@ var Er = 120, Dr = 31, Or = s.create({
|
|
|
2843
2859
|
}
|
|
2844
2860
|
update(e) {
|
|
2845
2861
|
if (!super.update(e)) return !1;
|
|
2846
|
-
for (let [t, n] of Object.entries(
|
|
2847
|
-
let r =
|
|
2862
|
+
for (let [t, n] of Object.entries(jr)) {
|
|
2863
|
+
let r = P(t), i = e.attrs[t];
|
|
2848
2864
|
i === n.default ? this.dom.removeAttribute(r) : this.dom.setAttribute(r, String(i));
|
|
2849
2865
|
}
|
|
2850
2866
|
return !0;
|
|
@@ -2856,7 +2872,7 @@ var Er = 120, Dr = 31, Or = s.create({
|
|
|
2856
2872
|
});
|
|
2857
2873
|
};
|
|
2858
2874
|
}
|
|
2859
|
-
}),
|
|
2875
|
+
}), Fr = u.create({
|
|
2860
2876
|
name: "tableParagraph",
|
|
2861
2877
|
group: "tableContent",
|
|
2862
2878
|
content: "inline*",
|
|
@@ -2878,7 +2894,7 @@ var Er = 120, Dr = 31, Or = s.create({
|
|
|
2878
2894
|
0
|
|
2879
2895
|
];
|
|
2880
2896
|
}
|
|
2881
|
-
}),
|
|
2897
|
+
}), Ir = u.create({
|
|
2882
2898
|
name: "tableRow",
|
|
2883
2899
|
addOptions() {
|
|
2884
2900
|
return { HTMLAttributes: {} };
|
|
@@ -2899,24 +2915,24 @@ var Er = 120, Dr = 31, Or = s.create({
|
|
|
2899
2915
|
];
|
|
2900
2916
|
}
|
|
2901
2917
|
});
|
|
2902
|
-
function
|
|
2918
|
+
function Lr(e, t) {
|
|
2903
2919
|
let n = r.fromSchema(t).parse(e, { topNode: t.nodes.blockGroup.create() }), a = [];
|
|
2904
2920
|
return n.content.descendants((e) => {
|
|
2905
2921
|
if (e.isInline) return a.push(e), !1;
|
|
2906
2922
|
}), i.fromArray(a);
|
|
2907
2923
|
}
|
|
2908
|
-
var
|
|
2909
|
-
node:
|
|
2924
|
+
var Rr = () => ut({
|
|
2925
|
+
node: Pr,
|
|
2910
2926
|
type: "table",
|
|
2911
2927
|
content: "table"
|
|
2912
|
-
},
|
|
2928
|
+
}, jr, [n({
|
|
2913
2929
|
key: "table-extensions",
|
|
2914
2930
|
tiptapExtensions: [
|
|
2915
|
-
Or,
|
|
2916
|
-
Nr,
|
|
2917
2931
|
Ar,
|
|
2918
|
-
|
|
2919
|
-
|
|
2932
|
+
Fr,
|
|
2933
|
+
Mr,
|
|
2934
|
+
Nr,
|
|
2935
|
+
Ir
|
|
2920
2936
|
]
|
|
2921
2937
|
}), n({
|
|
2922
2938
|
key: "table-keyboard-delete",
|
|
@@ -2934,11 +2950,11 @@ var Ir = () => pt({
|
|
|
2934
2950
|
(e.getPrevBlock(t) || e.getNextBlock(t)) && e.setTextCursorPosition(t), e.removeBlocks([t]);
|
|
2935
2951
|
}), !0);
|
|
2936
2952
|
} }
|
|
2937
|
-
})]),
|
|
2953
|
+
})]), zr = (e) => ({
|
|
2938
2954
|
url: e.src || void 0,
|
|
2939
2955
|
previewWidth: e.width || void 0,
|
|
2940
2956
|
name: e.getAttribute("data-name") || void 0
|
|
2941
|
-
}),
|
|
2957
|
+
}), Br = "<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>", Vr = F((e) => ({
|
|
2942
2958
|
type: "video",
|
|
2943
2959
|
propSchema: {
|
|
2944
2960
|
textAlignment: G.textAlignment,
|
|
@@ -2953,28 +2969,28 @@ var Ir = () => pt({
|
|
|
2953
2969
|
}
|
|
2954
2970
|
},
|
|
2955
2971
|
content: "none"
|
|
2956
|
-
})),
|
|
2972
|
+
})), Hr = (e) => (e) => {
|
|
2957
2973
|
if (e.tagName === "VIDEO") {
|
|
2958
2974
|
if (e.closest("figure")) return;
|
|
2959
2975
|
let { backgroundColor: t } = K(e);
|
|
2960
2976
|
return {
|
|
2961
|
-
...
|
|
2977
|
+
...zr(e),
|
|
2962
2978
|
backgroundColor: t
|
|
2963
2979
|
};
|
|
2964
2980
|
}
|
|
2965
2981
|
if (e.tagName === "FIGURE") {
|
|
2966
|
-
let t =
|
|
2982
|
+
let t = mn(e, "video");
|
|
2967
2983
|
if (!t) return;
|
|
2968
2984
|
let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
|
|
2969
2985
|
return {
|
|
2970
|
-
...
|
|
2986
|
+
...zr(n),
|
|
2971
2987
|
backgroundColor: i,
|
|
2972
2988
|
caption: r
|
|
2973
2989
|
};
|
|
2974
2990
|
}
|
|
2975
|
-
},
|
|
2991
|
+
}, Ur = I(Vr, (e) => ({
|
|
2976
2992
|
meta: { fileBlockAccept: ["video/*"] },
|
|
2977
|
-
parse:
|
|
2993
|
+
parse: Hr(e),
|
|
2978
2994
|
render(t, n) {
|
|
2979
2995
|
let r = document.createElement("div");
|
|
2980
2996
|
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>";
|
|
@@ -2983,21 +2999,15 @@ var Ir = () => pt({
|
|
|
2983
2999
|
let a = document.createElement("video");
|
|
2984
3000
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
2985
3001
|
a.src = e;
|
|
2986
|
-
}) : 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),
|
|
3002
|
+
}) : 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), Zn(t, n, { dom: i }, i, r.firstElementChild);
|
|
2987
3003
|
},
|
|
2988
3004
|
toExternalHTML(e) {
|
|
2989
3005
|
if (!e.props.url) return { dom: document.createElement("video") };
|
|
2990
3006
|
let t;
|
|
2991
|
-
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 ?
|
|
3007
|
+
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 ? yn(t, e.props.caption) : bn(t, e.props.caption) : { dom: t };
|
|
2992
3008
|
},
|
|
2993
3009
|
runsBefore: ["file"]
|
|
2994
|
-
}))
|
|
2995
|
-
let t = new FormData();
|
|
2996
|
-
return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
2997
|
-
method: "POST",
|
|
2998
|
-
body: t
|
|
2999
|
-
})).json()).data.url.replace("tmpfiles.org/", "tmpfiles.org/dl/");
|
|
3000
|
-
};
|
|
3010
|
+
}));
|
|
3001
3011
|
//#endregion
|
|
3002
3012
|
//#region src/blocks/defaultBlockTypeGuards.ts
|
|
3003
3013
|
function X(e, t, n) {
|
|
@@ -3016,48 +3026,48 @@ function X(e, t, n) {
|
|
|
3016
3026
|
}
|
|
3017
3027
|
return !0;
|
|
3018
3028
|
}
|
|
3019
|
-
function
|
|
3029
|
+
function Wr(e, t, n, r) {
|
|
3020
3030
|
return X(t, n, r) && e.type === n;
|
|
3021
3031
|
}
|
|
3022
|
-
function
|
|
3032
|
+
function Gr(e) {
|
|
3023
3033
|
return e instanceof se;
|
|
3024
3034
|
}
|
|
3025
|
-
function
|
|
3035
|
+
function Kr(e) {
|
|
3026
3036
|
let t = e.type.spec.tableRole;
|
|
3027
3037
|
return t === "cell" || t === "header_cell";
|
|
3028
3038
|
}
|
|
3029
3039
|
//#endregion
|
|
3030
3040
|
//#region src/extensions/FormattingToolbar/FormattingToolbar.ts
|
|
3031
|
-
var Z = n(({ editor:
|
|
3032
|
-
let n =
|
|
3041
|
+
var Z = n(({ editor: t }) => {
|
|
3042
|
+
let n = e(!1), r = () => t.transact((e) => {
|
|
3033
3043
|
if (e.selection.empty || e.selection instanceof re && e.doc.textBetween(e.selection.from, e.selection.to).length === 0) return !1;
|
|
3034
3044
|
let t = !1;
|
|
3035
|
-
return e.selection.content().content.descendants((e) => (e.type.spec.
|
|
3045
|
+
return e.selection.content().content.descendants((e) => (e.type.spec.content === "text*" && (t = !0), !t)), !t;
|
|
3036
3046
|
});
|
|
3037
3047
|
return {
|
|
3038
3048
|
key: "formattingToolbar",
|
|
3039
3049
|
store: n,
|
|
3040
|
-
mount({ dom:
|
|
3041
|
-
let a = !1, o = !1, s =
|
|
3050
|
+
mount({ dom: e, signal: i }) {
|
|
3051
|
+
let a = !1, o = !1, s = t.onChange(() => {
|
|
3042
3052
|
a || o || n.setState(r());
|
|
3043
|
-
}), c =
|
|
3053
|
+
}), c = t.onSelectionChange(() => {
|
|
3044
3054
|
a || o || n.setState(r());
|
|
3045
3055
|
});
|
|
3046
|
-
|
|
3056
|
+
e.addEventListener("pointerdown", () => {
|
|
3047
3057
|
a = !0, n.setState(!1);
|
|
3048
|
-
}, { signal: i }),
|
|
3049
|
-
a = !1,
|
|
3058
|
+
}, { signal: i }), t.prosemirrorView.root.addEventListener("pointerup", () => {
|
|
3059
|
+
a = !1, t.isFocused() && n.setState(r());
|
|
3050
3060
|
}, {
|
|
3051
3061
|
signal: i,
|
|
3052
3062
|
capture: !0
|
|
3053
|
-
}),
|
|
3063
|
+
}), e.addEventListener("pointercancel", () => {
|
|
3054
3064
|
a = !0;
|
|
3055
3065
|
}, {
|
|
3056
3066
|
signal: i,
|
|
3057
3067
|
capture: !0
|
|
3058
|
-
}),
|
|
3068
|
+
}), t.prosemirrorView.root.addEventListener("dragstart", () => {
|
|
3059
3069
|
o = !0, n.setState(!1);
|
|
3060
|
-
}, { signal: i }),
|
|
3070
|
+
}, { signal: i }), t.prosemirrorView.root.addEventListener("dragend", () => {
|
|
3061
3071
|
o = !1;
|
|
3062
3072
|
}, { signal: i }), i.addEventListener("abort", () => {
|
|
3063
3073
|
s(), c();
|
|
@@ -3067,7 +3077,7 @@ var Z = n(({ editor: e }) => {
|
|
|
3067
3077
|
});
|
|
3068
3078
|
//#endregion
|
|
3069
3079
|
//#region src/api/positionMapping.ts
|
|
3070
|
-
function
|
|
3080
|
+
function qr(e, t, n = "left") {
|
|
3071
3081
|
let r = e.getExtension("yPositionMapping");
|
|
3072
3082
|
if (r) return r.mapPosition(t, n);
|
|
3073
3083
|
let i = e.getExtension("positionMapping");
|
|
@@ -3076,7 +3086,7 @@ function Kr(e, t, n = "left") {
|
|
|
3076
3086
|
}
|
|
3077
3087
|
//#endregion
|
|
3078
3088
|
//#region src/extensions/SuggestionMenu/SuggestionMenu.ts
|
|
3079
|
-
var
|
|
3089
|
+
var Jr = m((e) => e.type.name === "blockContainer"), Yr = class {
|
|
3080
3090
|
editor;
|
|
3081
3091
|
state;
|
|
3082
3092
|
emitUpdate;
|
|
@@ -3100,7 +3110,7 @@ var qr = m((e) => e.type.name === "blockContainer"), Jr = class {
|
|
|
3100
3110
|
};
|
|
3101
3111
|
update(e, t) {
|
|
3102
3112
|
let n = Q.getState(t), r = Q.getState(e.state), i = n === void 0 && r !== void 0, a = n !== void 0 && r === void 0;
|
|
3103
|
-
if (!i &&
|
|
3113
|
+
if (!i && (n === void 0 || r === void 0) && !a) return;
|
|
3104
3114
|
if (this.pluginState = a ? n : r, a || !this.editor.isEditable) {
|
|
3105
3115
|
this.state && (this.state.show = !1), this.emitUpdate(this.pluginState.triggerCharacter);
|
|
3106
3116
|
return;
|
|
@@ -3124,8 +3134,8 @@ var qr = m((e) => e.type.name === "blockContainer"), Jr = class {
|
|
|
3124
3134
|
to: this.editor.transact((e) => e.selection.from)
|
|
3125
3135
|
}).run();
|
|
3126
3136
|
};
|
|
3127
|
-
}, Q = new ne("SuggestionMenuPlugin"),
|
|
3128
|
-
let n = /* @__PURE__ */ new Map(), r, i =
|
|
3137
|
+
}, Q = new ne("SuggestionMenuPlugin"), Xr = n(({ editor: t }) => {
|
|
3138
|
+
let n = /* @__PURE__ */ new Map(), r, i = e(void 0);
|
|
3129
3139
|
return {
|
|
3130
3140
|
key: "suggestionMenu",
|
|
3131
3141
|
store: i,
|
|
@@ -3142,10 +3152,10 @@ var qr = m((e) => e.type.name === "blockContainer"), Jr = class {
|
|
|
3142
3152
|
r?.clearQuery();
|
|
3143
3153
|
},
|
|
3144
3154
|
shown: () => r?.state?.show || !1,
|
|
3145
|
-
openSuggestionMenu: (
|
|
3146
|
-
|
|
3147
|
-
n?.deleteTriggerCharacter &&
|
|
3148
|
-
triggerCharacter:
|
|
3155
|
+
openSuggestionMenu: (e, n) => {
|
|
3156
|
+
t.headless || (t.focus(), t.transact((t) => {
|
|
3157
|
+
n?.deleteTriggerCharacter && t.insertText(e), t.scrollIntoView().setMeta(Q, {
|
|
3158
|
+
triggerCharacter: e,
|
|
3149
3159
|
deleteTriggerCharacter: n?.deleteTriggerCharacter || !1,
|
|
3150
3160
|
ignoreQueryLength: n?.ignoreQueryLength || !1
|
|
3151
3161
|
});
|
|
@@ -3153,31 +3163,31 @@ var qr = m((e) => e.type.name === "blockContainer"), Jr = class {
|
|
|
3153
3163
|
},
|
|
3154
3164
|
prosemirrorPlugins: [new te({
|
|
3155
3165
|
key: Q,
|
|
3156
|
-
view: (
|
|
3166
|
+
view: (e) => (r = new Yr(t, (e, t) => {
|
|
3157
3167
|
i.setState({
|
|
3158
3168
|
...t,
|
|
3159
3169
|
triggerCharacter: e
|
|
3160
3170
|
});
|
|
3161
|
-
},
|
|
3171
|
+
}, e), r),
|
|
3162
3172
|
state: {
|
|
3163
3173
|
init() {},
|
|
3164
|
-
apply: (
|
|
3165
|
-
if (
|
|
3166
|
-
let o =
|
|
3174
|
+
apply: (e, n, i, a) => {
|
|
3175
|
+
if (e.selection.$from.parent.type.spec.code) return n;
|
|
3176
|
+
let o = e.getMeta(Q);
|
|
3167
3177
|
if (typeof o == "object" && o) {
|
|
3168
3178
|
n && r?.closeMenu();
|
|
3169
|
-
let
|
|
3179
|
+
let e = qr(t, a.selection.from - o.triggerCharacter.length);
|
|
3170
3180
|
return {
|
|
3171
3181
|
triggerCharacter: o.triggerCharacter,
|
|
3172
3182
|
deleteTriggerCharacter: o.deleteTriggerCharacter !== !1,
|
|
3173
|
-
queryStartPos: () =>
|
|
3183
|
+
queryStartPos: () => e() + o.triggerCharacter.length,
|
|
3174
3184
|
query: "",
|
|
3175
3185
|
decorationId: `id_${Math.floor(Math.random() * 4294967295)}`,
|
|
3176
3186
|
ignoreQueryLength: o?.ignoreQueryLength
|
|
3177
3187
|
};
|
|
3178
3188
|
}
|
|
3179
3189
|
if (n === void 0) return n;
|
|
3180
|
-
if (a.selection.from !== a.selection.to || o === null ||
|
|
3190
|
+
if (a.selection.from !== a.selection.to || o === null || e.getMeta("focus") || e.getMeta("blur") || e.getMeta("pointer") || n.triggerCharacter !== void 0 && a.selection.from < n.queryStartPos() || !a.selection.$from.sameParent(a.doc.resolve(n.queryStartPos()))) return;
|
|
3181
3191
|
let s = { ...n };
|
|
3182
3192
|
return s.query = a.doc.textBetween(n.queryStartPos(), a.selection.from), s;
|
|
3183
3193
|
}
|
|
@@ -3198,14 +3208,14 @@ var qr = m((e) => e.type.name === "blockContainer"), Jr = class {
|
|
|
3198
3208
|
let t = this.getState(e);
|
|
3199
3209
|
if (t === void 0) return null;
|
|
3200
3210
|
if (!t.deleteTriggerCharacter) {
|
|
3201
|
-
let n =
|
|
3202
|
-
if (n) return
|
|
3211
|
+
let n = Jr(e.selection);
|
|
3212
|
+
if (n) return Se.create(e.doc, [xe.node(n.pos, n.pos + n.node.nodeSize, {
|
|
3203
3213
|
nodeName: "span",
|
|
3204
3214
|
class: "bn-suggestion-decorator",
|
|
3205
3215
|
"data-decoration-id": t.decorationId
|
|
3206
3216
|
})]);
|
|
3207
3217
|
}
|
|
3208
|
-
return
|
|
3218
|
+
return Se.create(e.doc, [xe.inline(t.queryStartPos() - t.triggerCharacter.length, t.queryStartPos(), {
|
|
3209
3219
|
nodeName: "span",
|
|
3210
3220
|
class: "bn-suggestion-decorator",
|
|
3211
3221
|
"data-decoration-id": t.decorationId
|
|
@@ -3217,7 +3227,7 @@ var qr = m((e) => e.type.name === "blockContainer"), Jr = class {
|
|
|
3217
3227
|
});
|
|
3218
3228
|
//#endregion
|
|
3219
3229
|
//#region src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts
|
|
3220
|
-
function
|
|
3230
|
+
function Zr(e) {
|
|
3221
3231
|
let t = e.getTextCursorPosition().block, n = e.schema.blockSchema[t.type].content;
|
|
3222
3232
|
for (; n === "none";) {
|
|
3223
3233
|
if (t = e.getTextCursorPosition().nextBlock, t === void 0) {
|
|
@@ -3232,9 +3242,9 @@ function $(e, t) {
|
|
|
3232
3242
|
let n = e.getTextCursorPosition().block;
|
|
3233
3243
|
if (n.content === void 0) throw Error("Slash Menu open in a block that doesn't contain content.");
|
|
3234
3244
|
let r;
|
|
3235
|
-
return Array.isArray(n.content) && (n.content.length === 1 &&
|
|
3245
|
+
return Array.isArray(n.content) && (n.content.length === 1 && S(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)), Zr(e), r;
|
|
3236
3246
|
}
|
|
3237
|
-
function
|
|
3247
|
+
function Qr(e) {
|
|
3238
3248
|
let t = [];
|
|
3239
3249
|
return X(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((e) => e <= 3).forEach((n) => {
|
|
3240
3250
|
t.push({
|
|
@@ -3244,7 +3254,7 @@ function Zr(e) {
|
|
|
3244
3254
|
props: { level: n }
|
|
3245
3255
|
});
|
|
3246
3256
|
},
|
|
3247
|
-
badge:
|
|
3257
|
+
badge: k(`Mod-Alt-${n}`),
|
|
3248
3258
|
key: n === 1 ? "heading" : `heading_${n}`,
|
|
3249
3259
|
...e.dictionary.slash_menu[n === 1 ? "heading" : `heading_${n}`]
|
|
3250
3260
|
});
|
|
@@ -3258,42 +3268,42 @@ function Zr(e) {
|
|
|
3258
3268
|
onItemClick: () => {
|
|
3259
3269
|
$(e, { type: "toggleListItem" });
|
|
3260
3270
|
},
|
|
3261
|
-
badge:
|
|
3271
|
+
badge: k("Mod-Shift-6"),
|
|
3262
3272
|
key: "toggle_list",
|
|
3263
3273
|
...e.dictionary.slash_menu.toggle_list
|
|
3264
3274
|
}), X(e, "numberedListItem") && t.push({
|
|
3265
3275
|
onItemClick: () => {
|
|
3266
3276
|
$(e, { type: "numberedListItem" });
|
|
3267
3277
|
},
|
|
3268
|
-
badge:
|
|
3278
|
+
badge: k("Mod-Shift-7"),
|
|
3269
3279
|
key: "numbered_list",
|
|
3270
3280
|
...e.dictionary.slash_menu.numbered_list
|
|
3271
3281
|
}), X(e, "bulletListItem") && t.push({
|
|
3272
3282
|
onItemClick: () => {
|
|
3273
3283
|
$(e, { type: "bulletListItem" });
|
|
3274
3284
|
},
|
|
3275
|
-
badge:
|
|
3285
|
+
badge: k("Mod-Shift-8"),
|
|
3276
3286
|
key: "bullet_list",
|
|
3277
3287
|
...e.dictionary.slash_menu.bullet_list
|
|
3278
3288
|
}), X(e, "checkListItem") && t.push({
|
|
3279
3289
|
onItemClick: () => {
|
|
3280
3290
|
$(e, { type: "checkListItem" });
|
|
3281
3291
|
},
|
|
3282
|
-
badge:
|
|
3292
|
+
badge: k("Mod-Shift-9"),
|
|
3283
3293
|
key: "check_list",
|
|
3284
3294
|
...e.dictionary.slash_menu.check_list
|
|
3285
3295
|
}), X(e, "paragraph") && t.push({
|
|
3286
3296
|
onItemClick: () => {
|
|
3287
3297
|
$(e, { type: "paragraph" });
|
|
3288
3298
|
},
|
|
3289
|
-
badge:
|
|
3299
|
+
badge: k("Mod-Alt-0"),
|
|
3290
3300
|
key: "paragraph",
|
|
3291
3301
|
...e.dictionary.slash_menu.paragraph
|
|
3292
3302
|
}), X(e, "codeBlock") && t.push({
|
|
3293
3303
|
onItemClick: () => {
|
|
3294
3304
|
$(e, { type: "codeBlock" });
|
|
3295
3305
|
},
|
|
3296
|
-
badge:
|
|
3306
|
+
badge: k("Mod-Alt-c"),
|
|
3297
3307
|
key: "code_block",
|
|
3298
3308
|
...e.dictionary.slash_menu.code_block
|
|
3299
3309
|
}), X(e, "divider") && t.push({
|
|
@@ -3376,13 +3386,13 @@ function Zr(e) {
|
|
|
3376
3386
|
props: { level: n }
|
|
3377
3387
|
});
|
|
3378
3388
|
},
|
|
3379
|
-
badge:
|
|
3389
|
+
badge: k(`Mod-Alt-${n}`),
|
|
3380
3390
|
key: `heading_${n}`,
|
|
3381
3391
|
...e.dictionary.slash_menu[`heading_${n}`]
|
|
3382
3392
|
});
|
|
3383
3393
|
}), t.push({
|
|
3384
3394
|
onItemClick: () => {
|
|
3385
|
-
e.getExtension(
|
|
3395
|
+
e.getExtension(Xr)?.openSuggestionMenu(":", {
|
|
3386
3396
|
deleteTriggerCharacter: !0,
|
|
3387
3397
|
ignoreQueryLength: !0
|
|
3388
3398
|
});
|
|
@@ -3391,17 +3401,17 @@ function Zr(e) {
|
|
|
3391
3401
|
...e.dictionary.slash_menu.emoji
|
|
3392
3402
|
}), t;
|
|
3393
3403
|
}
|
|
3394
|
-
function
|
|
3404
|
+
function $r(e, t) {
|
|
3395
3405
|
return e.filter(({ title: e, aliases: n }) => e.toLowerCase().includes(t.toLowerCase()) || n && n.filter((e) => e.toLowerCase().includes(t.toLowerCase())).length !== 0);
|
|
3396
3406
|
}
|
|
3397
3407
|
//#endregion
|
|
3398
3408
|
//#region src/blocks/PageBreak/getPageBreakSlashMenuItems.ts
|
|
3399
|
-
function
|
|
3409
|
+
function ei(e) {
|
|
3400
3410
|
return "pageBreak" in e.schema.blockSchema;
|
|
3401
3411
|
}
|
|
3402
|
-
function
|
|
3412
|
+
function ti(e) {
|
|
3403
3413
|
let t = [];
|
|
3404
|
-
return
|
|
3414
|
+
return ei(e) && t.push({
|
|
3405
3415
|
...e.dictionary.slash_menu.page_break,
|
|
3406
3416
|
onItemClick: () => {
|
|
3407
3417
|
$(e, { type: "pageBreak" });
|
|
@@ -3411,22 +3421,22 @@ function ei(e) {
|
|
|
3411
3421
|
}
|
|
3412
3422
|
//#endregion
|
|
3413
3423
|
//#region src/blocks/defaultBlocks.ts
|
|
3414
|
-
var
|
|
3415
|
-
audio:
|
|
3416
|
-
bulletListItem:
|
|
3417
|
-
checkListItem:
|
|
3418
|
-
codeBlock:
|
|
3419
|
-
divider:
|
|
3420
|
-
file:
|
|
3421
|
-
heading:
|
|
3422
|
-
image:
|
|
3423
|
-
numberedListItem:
|
|
3424
|
-
paragraph:
|
|
3425
|
-
quote:
|
|
3426
|
-
table:
|
|
3427
|
-
toggleListItem:
|
|
3428
|
-
video:
|
|
3429
|
-
},
|
|
3424
|
+
var ni = {
|
|
3425
|
+
audio: Dn(),
|
|
3426
|
+
bulletListItem: ur(),
|
|
3427
|
+
checkListItem: fr(),
|
|
3428
|
+
codeBlock: Ln(),
|
|
3429
|
+
divider: zn(),
|
|
3430
|
+
file: Un(),
|
|
3431
|
+
heading: Xn(),
|
|
3432
|
+
image: ir(),
|
|
3433
|
+
numberedListItem: _r(),
|
|
3434
|
+
paragraph: wr(),
|
|
3435
|
+
quote: Er(),
|
|
3436
|
+
table: Rr(),
|
|
3437
|
+
toggleListItem: yr(),
|
|
3438
|
+
video: Ur()
|
|
3439
|
+
}, ri = Ct({
|
|
3430
3440
|
type: "textColor",
|
|
3431
3441
|
propSchema: "string"
|
|
3432
3442
|
}, {
|
|
@@ -3447,7 +3457,7 @@ var ti = {
|
|
|
3447
3457
|
parse: (e) => {
|
|
3448
3458
|
if (e.tagName === "SPAN" && e.style.color) return e.style.color;
|
|
3449
3459
|
}
|
|
3450
|
-
}),
|
|
3460
|
+
}), ii = Ct({
|
|
3451
3461
|
type: "backgroundColor",
|
|
3452
3462
|
propSchema: "string"
|
|
3453
3463
|
}, {
|
|
@@ -3468,12 +3478,12 @@ var ti = {
|
|
|
3468
3478
|
parse: (e) => {
|
|
3469
3479
|
if (e.tagName === "SPAN" && e.style.backgroundColor) return e.style.backgroundColor;
|
|
3470
3480
|
}
|
|
3471
|
-
}),
|
|
3472
|
-
bold:
|
|
3473
|
-
italic:
|
|
3474
|
-
underline:
|
|
3475
|
-
strike:
|
|
3476
|
-
code:
|
|
3481
|
+
}), ai = {
|
|
3482
|
+
bold: R(Ce, "boolean"),
|
|
3483
|
+
italic: R(Te, "boolean"),
|
|
3484
|
+
underline: R(De, "boolean"),
|
|
3485
|
+
strike: R(Ee, "boolean"),
|
|
3486
|
+
code: R(we.extend({ addInputRules() {
|
|
3477
3487
|
return [_({
|
|
3478
3488
|
find: /(^|[^`])`([^`]+)`(?!`)$/,
|
|
3479
3489
|
type: this.type
|
|
@@ -3485,9 +3495,9 @@ var ti = {
|
|
|
3485
3495
|
}
|
|
3486
3496
|
})];
|
|
3487
3497
|
} }), "boolean"),
|
|
3488
|
-
textColor:
|
|
3489
|
-
backgroundColor:
|
|
3490
|
-
},
|
|
3498
|
+
textColor: ri,
|
|
3499
|
+
backgroundColor: ii
|
|
3500
|
+
}, oi = xt(ai), si = {
|
|
3491
3501
|
text: {
|
|
3492
3502
|
config: "text",
|
|
3493
3503
|
implementation: {}
|
|
@@ -3496,16 +3506,16 @@ var ti = {
|
|
|
3496
3506
|
config: "link",
|
|
3497
3507
|
implementation: {}
|
|
3498
3508
|
}
|
|
3499
|
-
},
|
|
3509
|
+
}, ci = vt(si), li = class e extends Nt {
|
|
3500
3510
|
static create(t) {
|
|
3501
3511
|
return new e({
|
|
3502
|
-
blockSpecs: t?.blockSpecs ??
|
|
3503
|
-
inlineContentSpecs: t?.inlineContentSpecs ??
|
|
3504
|
-
styleSpecs: t?.styleSpecs ??
|
|
3512
|
+
blockSpecs: t?.blockSpecs ?? ni,
|
|
3513
|
+
inlineContentSpecs: t?.inlineContentSpecs ?? si,
|
|
3514
|
+
styleSpecs: t?.styleSpecs ?? ai
|
|
3505
3515
|
});
|
|
3506
3516
|
}
|
|
3507
3517
|
};
|
|
3508
3518
|
//#endregion
|
|
3509
|
-
export {
|
|
3519
|
+
export { Kn as $, b as $n, bt as $t, Er as A, Xe as An, sn as At, fr as B, Ve as Bn, Wt as Bt, Rr as C, nt as Cn, dn as Ct, Dr as D, Ze as Dn, un as Dt, Or as E, rt as En, K as Et, Sr as F, He as Fn, U as Ft, $n as G, D as Gn, Pt as Gt, lr as H, O as Hn, Vt as Ht, vr as I, Ue as In, H as It, tr as J, C as Jn, Nt as Jt, er as K, w as Kn, Rt as Kt, yr as L, We as Ln, Yt as Lt, wr as M, M as Mn, en as Mt, br as N, Qe as Nn, Zt as Nt, Y as O, Je as On, W as Ot, xr as P, Ke as Pn, Qt as Pt, Xn as Q, Ie as Qn, L as Qt, gr as R, k as Rn, Ht as Rt, Hr as S, $e as Sn, G as St, kr as T, tt as Tn, fn as Tt, ur as U, ze as Un, Lt as Ut, dr as V, A as Vn, Ut as Vt, ar as W, E as Wn, It as Wt, rr as X, Re as Xn, Ct as Xt, nr as Y, Le as Yn, jt as Yt, Yn as Z, S as Zn, St as Zt, Kr as _, lt as _n, Cn as _t, oi as a, _t as an, ke as ar, zn as at, Vr as b, at as bn, J as bt, ti as c, pt as cn, Pn as ct, $ as d, I as dn, On as dt, R as en, Me as er, Gn as et, Xr as f, ft as fn, kn as ft, X as g, ot as gn, En as gt, Wr as h, st as hn, Tn as ht, si as i, ht as in, Ae as ir, Rn as it, Cr as j, j as jn, $t as jt, Tr as k, Ye as kn, cn as kt, $r as l, dt as ln, Nn as lt, Z as m, ct as mn, wn as mt, ni as n, yt as nn, x as nr, Un as nt, ai as o, gt as on, Oe as or, In as ot, qr as p, ut as pn, Sn as pt, ir as q, T as qn, zt as qt, ci as r, mt as rn, y as rr, Hn as rt, ei as s, vt as sn, Ln as st, li as t, xt as tn, je as tr, Vn as tt, Qr as u, F as un, An as ut, Gr as v, P as vn, Dn as vt, jr as w, N as wn, pn as wt, Ur as x, et as xn, q as xt, Br as y, it as yn, xn as yt, _r as z, Be as zn, Gt as zt };
|
|
3510
3520
|
|
|
3511
|
-
//# sourceMappingURL=blocks-
|
|
3521
|
+
//# sourceMappingURL=blocks-Dol85hpH.js.map
|