@blocknote/core 0.37.0 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BlockNoteSchema-DmZ6UQfY.cjs +11 -0
- package/dist/BlockNoteSchema-DmZ6UQfY.cjs.map +1 -0
- package/dist/BlockNoteSchema-oR047ACf.js +4275 -0
- package/dist/BlockNoteSchema-oR047ACf.js.map +1 -0
- package/dist/blocknote.cjs +4 -12
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +3311 -7230
- package/dist/blocknote.js.map +1 -1
- package/dist/blocks.cjs +2 -0
- package/dist/blocks.cjs.map +1 -0
- package/dist/blocks.js +71 -0
- package/dist/blocks.js.map +1 -0
- package/dist/{en-CvDoFvhc.js → en-Bq3Es3Np.js} +6 -12
- package/dist/en-Bq3Es3Np.js.map +1 -0
- package/dist/en-D3B48eJ7.cjs +2 -0
- package/dist/en-D3B48eJ7.cjs.map +1 -0
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +109 -229
- package/dist/locales.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/webpack-stats.json +1 -1
- package/package.json +25 -22
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +1 -1
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +2 -2
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +34 -25
- package/src/api/blockManipulation/setupTestEnv.ts +0 -1
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +4 -8
- package/src/api/clipboard/toClipboard/copyExtension.ts +1 -3
- package/src/api/exporters/html/externalHTMLExporter.ts +0 -1
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +128 -28
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +101 -41
- package/src/api/exporters/markdown/markdownExporter.ts +13 -22
- package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +2 -12
- package/src/api/parsers/html/parseHTML.ts +3 -2
- package/src/api/parsers/html/util/nestedLists.test.ts +8 -8
- package/src/api/parsers/markdown/parseMarkdown.ts +17 -14
- package/src/api/pmUtil.ts +1 -1
- package/src/api/positionMapping.test.ts +197 -33
- package/src/api/positionMapping.ts +4 -6
- package/src/blocks/Audio/block.ts +174 -0
- package/src/blocks/BlockNoteSchema.ts +59 -0
- package/src/blocks/Code/block.ts +303 -0
- package/src/blocks/Code/shiki.ts +73 -0
- package/src/blocks/File/block.ts +98 -0
- package/src/blocks/{FileBlockContent → File}/helpers/render/createAddFileButton.ts +8 -4
- package/src/blocks/{FileBlockContent → File}/helpers/render/createFileBlockWrapper.ts +16 -13
- package/src/blocks/{FileBlockContent → File}/helpers/render/createFileNameWithIcon.ts +15 -2
- package/src/blocks/{FileBlockContent → File}/helpers/render/createResizableFileBlockWrapper.ts +63 -19
- package/src/blocks/Heading/block.ts +138 -0
- package/src/blocks/Image/block.ts +190 -0
- package/src/blocks/ListItem/BulletListItem/block.ts +116 -0
- package/src/blocks/ListItem/CheckListItem/block.ts +175 -0
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +173 -0
- package/src/blocks/ListItem/NumberedListItem/block.ts +133 -0
- package/src/blocks/ListItem/ToggleListItem/block.ts +78 -0
- package/src/blocks/PageBreak/block.ts +72 -0
- package/src/blocks/{PageBreakBlockContent → PageBreak}/getPageBreakSlashMenuItems.ts +9 -7
- package/src/blocks/Paragraph/block.ts +80 -0
- package/src/blocks/Quote/block.ts +90 -0
- package/src/blocks/{TableBlockContent/TableBlockContent.ts → Table/block.ts} +169 -51
- package/src/blocks/ToggleWrapper/createToggleWrapper.ts +1 -1
- package/src/blocks/Video/block.ts +143 -0
- package/src/blocks/defaultBlockHelpers.ts +2 -2
- package/src/blocks/defaultBlockTypeGuards.ts +143 -174
- package/src/blocks/defaultBlocks.ts +107 -35
- package/src/blocks/defaultProps.ts +145 -4
- package/src/blocks/index.ts +26 -0
- package/src/blocks/utils/listItemEnterHandler.ts +42 -0
- package/src/editor/Block.css +54 -18
- package/src/editor/BlockNoteEditor.ts +265 -230
- package/src/editor/BlockNoteExtension.ts +92 -0
- package/src/editor/BlockNoteExtensions.ts +20 -16
- package/src/editor/defaultColors.ts +2 -2
- package/src/exporter/Exporter.ts +1 -1
- package/src/exporter/mapping.ts +1 -1
- package/src/extensions/BackgroundColor/BackgroundColorExtension.ts +3 -20
- package/src/extensions/BackgroundColor/BackgroundColorMark.ts +6 -8
- package/src/extensions/BlockChange/BlockChangePlugin.ts +2 -1
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor-forked.json +2 -2
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor.json +2 -2
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-forked.html +1 -1
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap.html +1 -1
- package/src/extensions/Collaboration/schemaMigration/SchemaMigrationPlugin.ts +52 -0
- package/src/extensions/Collaboration/schemaMigration/migrationRules/index.ts +4 -0
- package/src/extensions/Collaboration/schemaMigration/migrationRules/migrationRule.ts +4 -0
- package/src/extensions/Collaboration/schemaMigration/migrationRules/moveColorAttributes.ts +78 -0
- package/src/extensions/Comments/CommentsPlugin.ts +2 -0
- package/src/extensions/FilePanel/FilePanelPlugin.ts +5 -10
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +1 -1
- package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +4 -3
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +2 -2
- package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +1 -23
- package/src/extensions/SideMenu/SideMenuPlugin.ts +0 -2
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +0 -5
- package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +6 -2
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +24 -17
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +2 -2
- package/src/extensions/TextAlignment/TextAlignmentExtension.ts +5 -11
- package/src/extensions/TextColor/TextColorExtension.ts +3 -17
- package/src/extensions/TextColor/TextColorMark.ts +4 -9
- package/src/extensions/UniqueID/UniqueID.ts +6 -13
- package/src/i18n/locales/ar.ts +6 -12
- package/src/i18n/locales/de.ts +6 -12
- package/src/i18n/locales/en.ts +6 -12
- package/src/i18n/locales/es.ts +6 -12
- package/src/i18n/locales/fr.ts +6 -12
- package/src/i18n/locales/he.ts +6 -12
- package/src/i18n/locales/hr.ts +6 -12
- package/src/i18n/locales/is.ts +6 -12
- package/src/i18n/locales/it.ts +6 -12
- package/src/i18n/locales/ja.ts +6 -12
- package/src/i18n/locales/ko.ts +6 -12
- package/src/i18n/locales/nl.ts +6 -12
- package/src/i18n/locales/no.ts +6 -12
- package/src/i18n/locales/pl.ts +6 -12
- package/src/i18n/locales/pt.ts +6 -12
- package/src/i18n/locales/ru.ts +6 -12
- package/src/i18n/locales/sk.ts +6 -12
- package/src/i18n/locales/uk.ts +6 -12
- package/src/i18n/locales/vi.ts +6 -12
- package/src/i18n/locales/zh-tw.ts +6 -12
- package/src/i18n/locales/zh.ts +6 -12
- package/src/index.ts +2 -29
- package/src/schema/blocks/createSpec.ts +342 -169
- package/src/schema/blocks/internal.ts +77 -138
- package/src/schema/blocks/types.ts +264 -94
- package/src/schema/index.ts +1 -0
- package/src/schema/inlineContent/createSpec.ts +99 -21
- package/src/schema/inlineContent/internal.ts +16 -7
- package/src/schema/inlineContent/types.ts +24 -2
- package/src/schema/propTypes.ts +15 -9
- package/src/schema/schema.ts +209 -0
- package/src/schema/styles/createSpec.ts +79 -31
- package/src/schema/styles/internal.ts +61 -2
- package/src/schema/styles/types.ts +17 -3
- package/src/util/topo-sort.test.ts +125 -0
- package/src/util/topo-sort.ts +160 -0
- package/types/src/api/blockManipulation/commands/splitBlock/splitBlock.d.ts +2 -1
- package/types/src/api/blockManipulation/selections/selection.d.ts +1 -1
- package/types/src/api/blockManipulation/setupTestEnv.d.ts +29 -543
- package/types/src/api/exporters/html/util/serializeBlocksExternalHTML.d.ts +1 -1
- package/types/src/api/exporters/html/util/serializeBlocksInternalHTML.d.ts +1 -1
- package/types/src/api/exporters/markdown/markdownExporter.d.ts +1 -1
- package/types/src/api/parsers/html/parseHTML.d.ts +1 -1
- package/types/src/api/parsers/markdown/parseMarkdown.d.ts +2 -2
- package/types/src/api/pmUtil.d.ts +1 -1
- package/types/src/blocks/Audio/block.d.ts +58 -0
- package/types/src/blocks/BlockNoteSchema.d.ts +18 -0
- package/types/src/blocks/{CodeBlockContent/CodeBlockContent.d.ts → Code/block.d.ts} +25 -26
- package/types/src/blocks/Code/shiki.d.ts +4 -0
- package/types/src/blocks/File/block.d.ts +37 -0
- package/types/src/blocks/File/helpers/render/createAddFileButton.d.ts +6 -0
- package/types/src/blocks/File/helpers/render/createFileBlockWrapper.d.ts +25 -0
- package/types/src/blocks/{FileBlockContent → File}/helpers/render/createFileNameWithIcon.d.ts +6 -2
- package/types/src/blocks/File/helpers/render/createResizableFileBlockWrapper.d.ts +31 -0
- package/types/src/blocks/Heading/block.d.ts +71 -0
- package/types/src/blocks/Image/block.d.ts +102 -0
- package/types/src/blocks/ListItem/BulletListItem/block.d.ts +25 -0
- package/types/src/blocks/ListItem/CheckListItem/block.d.ts +33 -0
- package/types/src/blocks/ListItem/NumberedListItem/IndexingPlugin.d.ts +8 -0
- package/types/src/blocks/ListItem/NumberedListItem/block.d.ts +33 -0
- package/types/src/blocks/ListItem/ToggleListItem/block.d.ts +25 -0
- package/types/src/blocks/PageBreak/block.d.ts +11 -0
- package/types/src/blocks/{PageBreakBlockContent → PageBreak}/getPageBreakSlashMenuItems.d.ts +4 -2
- package/types/src/blocks/Paragraph/block.d.ts +25 -0
- package/types/src/blocks/Quote/block.d.ts +17 -0
- package/types/src/blocks/Table/block.d.ts +21 -0
- package/types/src/blocks/Video/block.d.ts +67 -0
- package/types/src/blocks/defaultBlockHelpers.d.ts +1 -1
- package/types/src/blocks/defaultBlockTypeGuards.d.ts +15 -36
- package/types/src/blocks/defaultBlocks.d.ts +221 -1060
- package/types/src/blocks/defaultProps.d.ts +17 -1
- package/types/src/blocks/index.d.ts +24 -0
- package/types/src/blocks/utils/listItemEnterHandler.d.ts +2 -0
- package/types/src/editor/BlockNoteEditor.d.ts +39 -75
- package/types/src/editor/BlockNoteExtension.d.ts +67 -0
- package/types/src/editor/BlockNoteExtensions.d.ts +2 -0
- package/types/src/editor/defaultColors.d.ts +8 -76
- package/types/src/exporter/Exporter.d.ts +1 -1
- package/types/src/exporter/mapping.d.ts +1 -1
- package/types/src/extensions/BackgroundColor/BackgroundColorMark.d.ts +4 -1
- package/types/src/extensions/Collaboration/schemaMigration/SchemaMigrationPlugin.d.ts +7 -0
- package/types/src/extensions/Collaboration/schemaMigration/migrationRules/index.d.ts +3 -0
- package/types/src/extensions/Collaboration/schemaMigration/migrationRules/migrationRule.d.ts +3 -0
- package/types/src/extensions/Collaboration/schemaMigration/migrationRules/moveColorAttributes.d.ts +2 -0
- package/types/src/extensions/Comments/CommentsPlugin.d.ts +3 -1
- package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +4 -4
- package/types/src/extensions/TextColor/TextColorMark.d.ts +4 -1
- package/types/src/i18n/locales/en.d.ts +1 -12
- package/types/src/i18n/locales/sk.d.ts +1 -12
- package/types/src/index.d.ts +2 -26
- package/types/src/schema/blocks/createSpec.d.ts +16 -36
- package/types/src/schema/blocks/internal.d.ts +11 -33
- package/types/src/schema/blocks/types.d.ts +181 -57
- package/types/src/schema/index.d.ts +1 -0
- package/types/src/schema/inlineContent/createSpec.d.ts +36 -2
- package/types/src/schema/inlineContent/internal.d.ts +7 -15
- package/types/src/schema/inlineContent/types.d.ts +15 -1
- package/types/src/schema/propTypes.d.ts +4 -4
- package/types/src/schema/schema.d.ts +40 -0
- package/types/src/schema/styles/createSpec.d.ts +6 -4
- package/types/src/schema/styles/internal.d.ts +6 -3
- package/types/src/schema/styles/types.d.ts +11 -2
- package/types/src/util/topo-sort.d.ts +18 -0
- package/types/src/util/topo-sort.test.d.ts +1 -0
- package/dist/en-CvDoFvhc.js.map +0 -1
- package/dist/en-ub2yVBX0.cjs +0 -2
- package/dist/en-ub2yVBX0.cjs.map +0 -1
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +0 -145
- package/src/blocks/CodeBlockContent/CodeBlockContent.ts +0 -445
- package/src/blocks/FileBlockContent/FileBlockContent.ts +0 -100
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +0 -159
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +0 -160
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +0 -134
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +0 -299
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +0 -86
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +0 -172
- package/src/blocks/ListItemBlockContent/ToggleListItemBlockContent/ToggleListItemBlockContent.ts +0 -104
- package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +0 -49
- package/src/blocks/PageBreakBlockContent/schema.ts +0 -40
- package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +0 -78
- package/src/blocks/QuoteBlockContent/QuoteBlockContent.ts +0 -121
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +0 -159
- package/src/editor/BlockNoteSchema.ts +0 -107
- package/src/editor/BlockNoteTipTapEditor.ts +0 -335
- package/src/util/esmDependencies.ts +0 -51
- package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +0 -99
- package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +0 -90
- package/types/src/blocks/FileBlockContent/helpers/render/createAddFileButton.d.ts +0 -6
- package/types/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.d.ts +0 -9
- package/types/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.d.ts +0 -9
- package/types/src/blocks/HeadingBlockContent/HeadingBlockContent.d.ts +0 -67
- package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +0 -131
- package/types/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.d.ts +0 -46
- package/types/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.d.ts +0 -55
- package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.d.ts +0 -2
- package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +0 -58
- package/types/src/blocks/ListItemBlockContent/ToggleListItemBlockContent/ToggleListItemBlockContent.d.ts +0 -46
- package/types/src/blocks/PageBreakBlockContent/PageBreakBlockContent.d.ts +0 -31
- package/types/src/blocks/PageBreakBlockContent/schema.d.ts +0 -86
- package/types/src/blocks/ParagraphBlockContent/ParagraphBlockContent.d.ts +0 -52
- package/types/src/blocks/QuoteBlockContent/QuoteBlockContent.d.ts +0 -52
- package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +0 -39
- package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +0 -131
- package/types/src/editor/BlockNoteSchema.d.ts +0 -34
- package/types/src/editor/BlockNoteTipTapEditor.d.ts +0 -43
- package/types/src/util/esmDependencies.d.ts +0 -24
- /package/src/blocks/{AudioBlockContent → Audio}/parseAudioElement.ts +0 -0
- /package/src/blocks/{FileBlockContent → File}/helpers/parse/parseEmbedElement.ts +0 -0
- /package/src/blocks/{FileBlockContent → File}/helpers/parse/parseFigureElement.ts +0 -0
- /package/src/blocks/{FileBlockContent → File}/helpers/toExternalHTML/createFigureWithCaption.ts +0 -0
- /package/src/blocks/{FileBlockContent → File}/helpers/toExternalHTML/createLinkWithCaption.ts +0 -0
- /package/src/blocks/{FileBlockContent → File/helpers}/uploadToTmpFilesDotOrg_DEV_ONLY.ts +0 -0
- /package/src/blocks/{ImageBlockContent → Image}/parseImageElement.ts +0 -0
- /package/src/blocks/{ListItemBlockContent → ListItem}/ListItemKeyboardShortcuts.ts +0 -0
- /package/src/blocks/{ListItemBlockContent → ListItem}/getListItemContent.ts +0 -0
- /package/src/blocks/{TableBlockContent → Table}/TableExtension.ts +0 -0
- /package/src/blocks/{VideoBlockContent → Video}/parseVideoElement.ts +0 -0
- /package/types/src/blocks/{AudioBlockContent → Audio}/parseAudioElement.d.ts +0 -0
- /package/types/src/blocks/{FileBlockContent → File}/helpers/parse/parseEmbedElement.d.ts +0 -0
- /package/types/src/blocks/{FileBlockContent → File}/helpers/parse/parseFigureElement.d.ts +0 -0
- /package/types/src/blocks/{FileBlockContent → File}/helpers/toExternalHTML/createFigureWithCaption.d.ts +0 -0
- /package/types/src/blocks/{FileBlockContent → File}/helpers/toExternalHTML/createLinkWithCaption.d.ts +0 -0
- /package/types/src/blocks/{FileBlockContent → File/helpers}/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +0 -0
- /package/types/src/blocks/{ImageBlockContent → Image}/parseImageElement.d.ts +0 -0
- /package/types/src/blocks/{ListItemBlockContent → ListItem}/ListItemKeyboardShortcuts.d.ts +0 -0
- /package/types/src/blocks/{ListItemBlockContent → ListItem}/getListItemContent.d.ts +0 -0
- /package/types/src/blocks/{TableBlockContent → Table}/TableExtension.d.ts +0 -0
- /package/types/src/blocks/{VideoBlockContent → Video}/parseVideoElement.d.ts +0 -0
|
@@ -0,0 +1,4275 @@
|
|
|
1
|
+
var ft = Object.defineProperty;
|
|
2
|
+
var ht = (e, t, n) => t in e ? ft(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var x = (e, t, n) => ht(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { TableMap as We, goToNextCell as Se, columnResizing as mt, tableEditing as gt, TableView as bt, CellSelection as Ct } from "prosemirror-tables";
|
|
5
|
+
import kt from "@tiptap/extension-bold";
|
|
6
|
+
import yt from "@tiptap/extension-code";
|
|
7
|
+
import wt from "@tiptap/extension-italic";
|
|
8
|
+
import vt from "@tiptap/extension-strike";
|
|
9
|
+
import Et from "@tiptap/extension-underline";
|
|
10
|
+
import { Extension as Fe, combineTransactionSteps as xt, getChangedRanges as St, findChildrenInRange as Bt, Node as D, Mark as Mt, callOrReturn as Lt, getExtensionField as Tt, mergeAttributes as ue } from "@tiptap/core";
|
|
11
|
+
import { Slice as de, Fragment as _, DOMParser as Q, DOMSerializer as Be } from "prosemirror-model";
|
|
12
|
+
import { Plugin as je, PluginKey as $e, TextSelection as Ue } from "prosemirror-state";
|
|
13
|
+
import { v4 as At } from "uuid";
|
|
14
|
+
import { createHighlightPlugin as Nt } from "prosemirror-highlight";
|
|
15
|
+
import { createParser as It } from "prosemirror-highlight/shiki";
|
|
16
|
+
import { ReplaceStep as Ht } from "prosemirror-transform";
|
|
17
|
+
import { DecorationSet as Me, Decoration as Pt } from "prosemirror-view";
|
|
18
|
+
function Ot(e, t = JSON.stringify) {
|
|
19
|
+
const n = {};
|
|
20
|
+
return e.filter((o) => {
|
|
21
|
+
const r = t(o);
|
|
22
|
+
return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function Dt(e) {
|
|
26
|
+
const t = e.filter(
|
|
27
|
+
(o, r) => e.indexOf(o) !== r
|
|
28
|
+
);
|
|
29
|
+
return Ot(t);
|
|
30
|
+
}
|
|
31
|
+
const ze = Fe.create({
|
|
32
|
+
name: "uniqueID",
|
|
33
|
+
// we’ll set a very high priority to make sure this runs first
|
|
34
|
+
// and is compatible with `appendTransaction` hooks of other extensions
|
|
35
|
+
priority: 1e4,
|
|
36
|
+
addOptions() {
|
|
37
|
+
return {
|
|
38
|
+
attributeName: "id",
|
|
39
|
+
types: [],
|
|
40
|
+
setIdAttribute: !1,
|
|
41
|
+
generateID: () => {
|
|
42
|
+
if (typeof window < "u" && window.__TEST_OPTIONS) {
|
|
43
|
+
const e = window.__TEST_OPTIONS;
|
|
44
|
+
return e.mockID === void 0 ? e.mockID = 0 : e.mockID++, e.mockID.toString();
|
|
45
|
+
}
|
|
46
|
+
return At();
|
|
47
|
+
},
|
|
48
|
+
filterTransaction: null
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
addGlobalAttributes() {
|
|
52
|
+
return [
|
|
53
|
+
{
|
|
54
|
+
types: this.options.types,
|
|
55
|
+
attributes: {
|
|
56
|
+
[this.options.attributeName]: {
|
|
57
|
+
default: null,
|
|
58
|
+
parseHTML: (e) => e.getAttribute(`data-${this.options.attributeName}`),
|
|
59
|
+
renderHTML: (e) => {
|
|
60
|
+
const t = {
|
|
61
|
+
[`data-${this.options.attributeName}`]: e[this.options.attributeName]
|
|
62
|
+
};
|
|
63
|
+
return this.options.setIdAttribute ? {
|
|
64
|
+
...t,
|
|
65
|
+
id: e[this.options.attributeName]
|
|
66
|
+
} : t;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
},
|
|
73
|
+
// check initial content for missing ids
|
|
74
|
+
// onCreate() {
|
|
75
|
+
// // Don’t do this when the collaboration extension is active
|
|
76
|
+
// // because this may update the content, so Y.js tries to merge these changes.
|
|
77
|
+
// // This leads to empty block nodes.
|
|
78
|
+
// // See: https://github.com/ueberdosis/tiptap/issues/2400
|
|
79
|
+
// if (
|
|
80
|
+
// this.editor.extensionManager.extensions.find(
|
|
81
|
+
// (extension) => extension.name === "collaboration"
|
|
82
|
+
// )
|
|
83
|
+
// ) {
|
|
84
|
+
// return;
|
|
85
|
+
// }
|
|
86
|
+
// const { view, state } = this.editor;
|
|
87
|
+
// const { tr, doc } = state;
|
|
88
|
+
// const { types, attributeName, generateID } = this.options;
|
|
89
|
+
// const nodesWithoutId = findChildren(doc, (node) => {
|
|
90
|
+
// return (
|
|
91
|
+
// types.includes(node.type.name) && node.attrs[attributeName] === null
|
|
92
|
+
// );
|
|
93
|
+
// });
|
|
94
|
+
// nodesWithoutId.forEach(({ node, pos }) => {
|
|
95
|
+
// tr.setNodeMarkup(pos, undefined, {
|
|
96
|
+
// ...node.attrs,
|
|
97
|
+
// [attributeName]: generateID(),
|
|
98
|
+
// });
|
|
99
|
+
// });
|
|
100
|
+
// tr.setMeta("addToHistory", false);
|
|
101
|
+
// view.dispatch(tr);
|
|
102
|
+
// },
|
|
103
|
+
addProseMirrorPlugins() {
|
|
104
|
+
let e = null, t = !1;
|
|
105
|
+
return [
|
|
106
|
+
new je({
|
|
107
|
+
key: new $e("uniqueID"),
|
|
108
|
+
appendTransaction: (n, o, r) => {
|
|
109
|
+
const s = n.some((h) => h.docChanged) && !o.doc.eq(r.doc), a = this.options.filterTransaction && n.some((h) => {
|
|
110
|
+
var C, m;
|
|
111
|
+
return !((m = (C = this.options).filterTransaction) != null && m.call(C, h));
|
|
112
|
+
});
|
|
113
|
+
if (!s || a)
|
|
114
|
+
return;
|
|
115
|
+
const { tr: i } = r, { types: c, attributeName: l, generateID: d } = this.options, u = xt(
|
|
116
|
+
o.doc,
|
|
117
|
+
n
|
|
118
|
+
), { mapping: p } = u;
|
|
119
|
+
if (St(u).forEach(({ newRange: h }) => {
|
|
120
|
+
const C = Bt(
|
|
121
|
+
r.doc,
|
|
122
|
+
h,
|
|
123
|
+
(y) => c.includes(y.type.name)
|
|
124
|
+
), m = C.map(({ node: y }) => y.attrs[l]).filter((y) => y !== null), b = Dt(m);
|
|
125
|
+
C.forEach(({ node: y, pos: g }) => {
|
|
126
|
+
var V;
|
|
127
|
+
const w = (V = i.doc.nodeAt(g)) == null ? void 0 : V.attrs[l];
|
|
128
|
+
if (w === null) {
|
|
129
|
+
const W = o.doc.type.createAndFill().content;
|
|
130
|
+
if (o.doc.content.findDiffStart(W) === null) {
|
|
131
|
+
const xe = JSON.parse(
|
|
132
|
+
JSON.stringify(r.doc.toJSON())
|
|
133
|
+
);
|
|
134
|
+
if (xe.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(xe.content) === JSON.stringify(W.toJSON())) {
|
|
135
|
+
i.setNodeMarkup(g, void 0, {
|
|
136
|
+
...y.attrs,
|
|
137
|
+
[l]: "initialBlockId"
|
|
138
|
+
});
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
i.setNodeMarkup(g, void 0, {
|
|
143
|
+
...y.attrs,
|
|
144
|
+
[l]: d()
|
|
145
|
+
});
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const { deleted: S } = p.invert().mapResult(g);
|
|
149
|
+
S && b.includes(w) && i.setNodeMarkup(g, void 0, {
|
|
150
|
+
...y.attrs,
|
|
151
|
+
[l]: d()
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
}), !!i.steps.length)
|
|
155
|
+
return i.setMeta("uniqueID", !0), i;
|
|
156
|
+
},
|
|
157
|
+
// we register a global drag handler to track the current drag source element
|
|
158
|
+
view(n) {
|
|
159
|
+
const o = (r) => {
|
|
160
|
+
let s;
|
|
161
|
+
e = !((s = n.dom.parentElement) === null || s === void 0) && s.contains(r.target) ? n.dom.parentElement : null;
|
|
162
|
+
};
|
|
163
|
+
return window.addEventListener("dragstart", o), {
|
|
164
|
+
destroy() {
|
|
165
|
+
window.removeEventListener("dragstart", o);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
},
|
|
169
|
+
props: {
|
|
170
|
+
// `handleDOMEvents` is called before `transformPasted` so we can do
|
|
171
|
+
// some checks before. However, `transformPasted` only runs when
|
|
172
|
+
// editor content is pasted - not external content.
|
|
173
|
+
handleDOMEvents: {
|
|
174
|
+
// only create new ids for dropped content while holding `alt`
|
|
175
|
+
// or content is dragged from another editor
|
|
176
|
+
drop: (n, o) => {
|
|
177
|
+
let r;
|
|
178
|
+
return e !== n.dom.parentElement || ((r = o.dataTransfer) === null || r === void 0 ? void 0 : r.effectAllowed) === "copy" ? t = !0 : t = !1, e = null, !1;
|
|
179
|
+
},
|
|
180
|
+
// always create new ids on pasted content
|
|
181
|
+
paste: () => (t = !0, !1)
|
|
182
|
+
},
|
|
183
|
+
// we’ll remove ids for every pasted node
|
|
184
|
+
// so we can create a new one within `appendTransaction`
|
|
185
|
+
transformPasted: (n) => {
|
|
186
|
+
if (!t)
|
|
187
|
+
return n;
|
|
188
|
+
const { types: o, attributeName: r } = this.options, s = (a) => {
|
|
189
|
+
const i = [];
|
|
190
|
+
return a.forEach((c) => {
|
|
191
|
+
if (c.isText) {
|
|
192
|
+
i.push(c);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (!o.includes(c.type.name)) {
|
|
196
|
+
i.push(c.copy(s(c.content)));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const l = c.type.create(
|
|
200
|
+
{
|
|
201
|
+
...c.attrs,
|
|
202
|
+
[r]: null
|
|
203
|
+
},
|
|
204
|
+
s(c.content),
|
|
205
|
+
c.marks
|
|
206
|
+
);
|
|
207
|
+
i.push(l);
|
|
208
|
+
}), _.from(i);
|
|
209
|
+
};
|
|
210
|
+
return t = !1, new de(
|
|
211
|
+
s(n.content),
|
|
212
|
+
n.openStart,
|
|
213
|
+
n.openEnd
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
|
+
];
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
function Le(e) {
|
|
222
|
+
return e.type === "link";
|
|
223
|
+
}
|
|
224
|
+
function qe(e) {
|
|
225
|
+
return typeof e != "string" && e.type === "link";
|
|
226
|
+
}
|
|
227
|
+
function I(e) {
|
|
228
|
+
return typeof e != "string" && e.type === "text";
|
|
229
|
+
}
|
|
230
|
+
function se(e) {
|
|
231
|
+
var t, n, o, r, s;
|
|
232
|
+
return pe(e) ? { ...e } : j(e) ? {
|
|
233
|
+
type: "tableCell",
|
|
234
|
+
content: [].concat(e.content),
|
|
235
|
+
props: {
|
|
236
|
+
backgroundColor: ((t = e.props) == null ? void 0 : t.backgroundColor) ?? "default",
|
|
237
|
+
textColor: ((n = e.props) == null ? void 0 : n.textColor) ?? "default",
|
|
238
|
+
textAlignment: ((o = e.props) == null ? void 0 : o.textAlignment) ?? "left",
|
|
239
|
+
colspan: ((r = e.props) == null ? void 0 : r.colspan) ?? 1,
|
|
240
|
+
rowspan: ((s = e.props) == null ? void 0 : s.rowspan) ?? 1
|
|
241
|
+
}
|
|
242
|
+
} : {
|
|
243
|
+
type: "tableCell",
|
|
244
|
+
content: [].concat(e),
|
|
245
|
+
props: {
|
|
246
|
+
backgroundColor: "default",
|
|
247
|
+
textColor: "default",
|
|
248
|
+
textAlignment: "left",
|
|
249
|
+
colspan: 1,
|
|
250
|
+
rowspan: 1
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function j(e) {
|
|
255
|
+
return e != null && typeof e != "string" && !Array.isArray(e) && e.type === "tableCell";
|
|
256
|
+
}
|
|
257
|
+
function pe(e) {
|
|
258
|
+
return j(e) && e.props !== void 0 && e.content !== void 0;
|
|
259
|
+
}
|
|
260
|
+
function $(e) {
|
|
261
|
+
return pe(e) ? e.props.colspan ?? 1 : 1;
|
|
262
|
+
}
|
|
263
|
+
function ae(e) {
|
|
264
|
+
return pe(e) ? e.props.rowspan ?? 1 : 1;
|
|
265
|
+
}
|
|
266
|
+
class Z extends Error {
|
|
267
|
+
constructor(t) {
|
|
268
|
+
super(`Unreachable case: ${t}`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function Do(e, t = !0) {
|
|
272
|
+
const { "data-test": n, ...o } = e;
|
|
273
|
+
if (Object.keys(o).length > 0 && t)
|
|
274
|
+
throw new Error("Object must be empty " + JSON.stringify(e));
|
|
275
|
+
}
|
|
276
|
+
const _t = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
277
|
+
function T(e, t = "Ctrl") {
|
|
278
|
+
return _t() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
|
|
279
|
+
}
|
|
280
|
+
function U(...e) {
|
|
281
|
+
return [
|
|
282
|
+
// Converts to & from set to remove duplicates.
|
|
283
|
+
...new Set(
|
|
284
|
+
e.filter((t) => t).join(" ").split(" ")
|
|
285
|
+
)
|
|
286
|
+
].join(" ");
|
|
287
|
+
}
|
|
288
|
+
const _o = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
289
|
+
function Rt(e, t, n, o) {
|
|
290
|
+
const r = document.createElement("div");
|
|
291
|
+
r.className = U(
|
|
292
|
+
"bn-block-content",
|
|
293
|
+
n.class
|
|
294
|
+
), r.setAttribute("data-content-type", e);
|
|
295
|
+
for (const [a, i] of Object.entries(n))
|
|
296
|
+
a !== "class" && r.setAttribute(a, i);
|
|
297
|
+
const s = document.createElement(t);
|
|
298
|
+
s.className = U(
|
|
299
|
+
"bn-inline-content",
|
|
300
|
+
o.class
|
|
301
|
+
);
|
|
302
|
+
for (const [a, i] of Object.entries(
|
|
303
|
+
o
|
|
304
|
+
))
|
|
305
|
+
a !== "class" && s.setAttribute(a, i);
|
|
306
|
+
return r.appendChild(s), {
|
|
307
|
+
dom: r,
|
|
308
|
+
contentDOM: s
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
const Te = (e, t) => {
|
|
312
|
+
let n = Y(e, t.pmSchema);
|
|
313
|
+
n.type.name === "blockContainer" && (n = n.firstChild);
|
|
314
|
+
const o = t.pmSchema.nodes[n.type.name].spec.toDOM;
|
|
315
|
+
if (o === void 0)
|
|
316
|
+
throw new Error(
|
|
317
|
+
"This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`."
|
|
318
|
+
);
|
|
319
|
+
const r = o(n);
|
|
320
|
+
if (typeof r != "object" || !("dom" in r))
|
|
321
|
+
throw new Error(
|
|
322
|
+
"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."
|
|
323
|
+
);
|
|
324
|
+
return r;
|
|
325
|
+
};
|
|
326
|
+
function Vt(e, t = "<br>") {
|
|
327
|
+
const n = e.querySelectorAll("p");
|
|
328
|
+
if (n.length > 1) {
|
|
329
|
+
const o = n[0];
|
|
330
|
+
for (let r = 1; r < n.length; r++) {
|
|
331
|
+
const s = n[r];
|
|
332
|
+
o.innerHTML += t + s.innerHTML, s.remove();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
function K(e) {
|
|
337
|
+
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
338
|
+
}
|
|
339
|
+
function Ro(e) {
|
|
340
|
+
const t = e.split("/");
|
|
341
|
+
return !t.length || // invalid?
|
|
342
|
+
t[t.length - 1] === "" ? e : t[t.length - 1];
|
|
343
|
+
}
|
|
344
|
+
function Wt(e) {
|
|
345
|
+
const t = {};
|
|
346
|
+
return Object.entries(e).forEach(([n, o]) => {
|
|
347
|
+
t[n] = {
|
|
348
|
+
default: o.default,
|
|
349
|
+
keepOnSplit: !0,
|
|
350
|
+
// Props are displayed in kebab-case as HTML attributes. If a prop's
|
|
351
|
+
// value is the same as its default, we don't display an HTML
|
|
352
|
+
// attribute for it.
|
|
353
|
+
parseHTML: (r) => {
|
|
354
|
+
const s = r.getAttribute(K(n));
|
|
355
|
+
if (s === null)
|
|
356
|
+
return null;
|
|
357
|
+
if (o.default === void 0 && o.type === "boolean" || o.default !== void 0 && typeof o.default == "boolean")
|
|
358
|
+
return s === "true" ? !0 : s === "false" ? !1 : null;
|
|
359
|
+
if (o.default === void 0 && o.type === "number" || o.default !== void 0 && typeof o.default == "number") {
|
|
360
|
+
const a = parseFloat(s);
|
|
361
|
+
return !Number.isNaN(a) && Number.isFinite(a) ? a : null;
|
|
362
|
+
}
|
|
363
|
+
return s;
|
|
364
|
+
},
|
|
365
|
+
renderHTML: (r) => r[n] !== o.default ? {
|
|
366
|
+
[K(n)]: r[n]
|
|
367
|
+
} : {}
|
|
368
|
+
};
|
|
369
|
+
}), t;
|
|
370
|
+
}
|
|
371
|
+
function Ft(e, t, n, o) {
|
|
372
|
+
const r = e();
|
|
373
|
+
if (r === void 0)
|
|
374
|
+
throw new Error("Cannot find node position");
|
|
375
|
+
const a = n.state.doc.resolve(r).node().attrs.id;
|
|
376
|
+
if (!a)
|
|
377
|
+
throw new Error("Block doesn't have id");
|
|
378
|
+
const i = t.getBlock(a);
|
|
379
|
+
if (i.type !== o)
|
|
380
|
+
throw new Error("Block type does not match");
|
|
381
|
+
return i;
|
|
382
|
+
}
|
|
383
|
+
function ie(e, t, n, o, r = !1, s) {
|
|
384
|
+
const a = document.createElement("div");
|
|
385
|
+
if (s !== void 0)
|
|
386
|
+
for (const [i, c] of Object.entries(s))
|
|
387
|
+
i !== "class" && a.setAttribute(i, c);
|
|
388
|
+
a.className = U(
|
|
389
|
+
"bn-block-content",
|
|
390
|
+
(s == null ? void 0 : s.class) || ""
|
|
391
|
+
), a.setAttribute("data-content-type", t);
|
|
392
|
+
for (const [i, c] of Object.entries(n)) {
|
|
393
|
+
const d = o[i].default;
|
|
394
|
+
c !== d && a.setAttribute(K(i), c);
|
|
395
|
+
}
|
|
396
|
+
return r && a.setAttribute("data-file-block", ""), a.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = U(
|
|
397
|
+
"bn-inline-content",
|
|
398
|
+
e.contentDOM.className
|
|
399
|
+
)), {
|
|
400
|
+
...e,
|
|
401
|
+
dom: a
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
function jt(e, t, n) {
|
|
405
|
+
return {
|
|
406
|
+
config: {
|
|
407
|
+
type: e.type,
|
|
408
|
+
content: e.content,
|
|
409
|
+
propSchema: t
|
|
410
|
+
},
|
|
411
|
+
implementation: {
|
|
412
|
+
node: e.node,
|
|
413
|
+
render: Te,
|
|
414
|
+
toExternalHTML: Te
|
|
415
|
+
},
|
|
416
|
+
extensions: n
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
function $t(e, t) {
|
|
420
|
+
e.stopEvent = (n) => (n.type === "mousedown" && setTimeout(() => {
|
|
421
|
+
t.view.dom.blur();
|
|
422
|
+
}, 10), !0);
|
|
423
|
+
}
|
|
424
|
+
function Ut(e, t) {
|
|
425
|
+
const n = [
|
|
426
|
+
{
|
|
427
|
+
tag: "[data-content-type=" + e.type + "]",
|
|
428
|
+
contentElement: ".bn-inline-content"
|
|
429
|
+
}
|
|
430
|
+
];
|
|
431
|
+
return t.parse && n.push({
|
|
432
|
+
tag: "*",
|
|
433
|
+
getAttrs(o) {
|
|
434
|
+
var s;
|
|
435
|
+
if (typeof o == "string")
|
|
436
|
+
return !1;
|
|
437
|
+
const r = (s = t.parse) == null ? void 0 : s.call(t, o);
|
|
438
|
+
return r === void 0 ? !1 : r;
|
|
439
|
+
},
|
|
440
|
+
getContent: e.content === "inline" || e.content === "none" ? (o, r) => {
|
|
441
|
+
var s;
|
|
442
|
+
if (t.parseContent)
|
|
443
|
+
return t.parseContent({
|
|
444
|
+
el: o,
|
|
445
|
+
schema: r
|
|
446
|
+
});
|
|
447
|
+
if (e.content === "inline") {
|
|
448
|
+
const i = o.cloneNode(!0);
|
|
449
|
+
return Vt(
|
|
450
|
+
i,
|
|
451
|
+
(s = t.meta) != null && s.code ? `
|
|
452
|
+
` : "<br>"
|
|
453
|
+
), Q.fromSchema(r).parse(i, {
|
|
454
|
+
topNode: r.nodes.paragraph.create()
|
|
455
|
+
}).content;
|
|
456
|
+
}
|
|
457
|
+
return _.empty;
|
|
458
|
+
} : void 0
|
|
459
|
+
}), n;
|
|
460
|
+
}
|
|
461
|
+
function zt(e, t, n, o) {
|
|
462
|
+
var s, a, i, c;
|
|
463
|
+
const r = t.node || D.create({
|
|
464
|
+
name: e.type,
|
|
465
|
+
content: e.content === "inline" ? "inline*" : e.content === "none" ? "" : e.content,
|
|
466
|
+
group: "blockContent",
|
|
467
|
+
selectable: ((s = t.meta) == null ? void 0 : s.selectable) ?? !0,
|
|
468
|
+
isolating: ((a = t.meta) == null ? void 0 : a.isolating) ?? !0,
|
|
469
|
+
code: ((i = t.meta) == null ? void 0 : i.code) ?? !1,
|
|
470
|
+
defining: ((c = t.meta) == null ? void 0 : c.defining) ?? !0,
|
|
471
|
+
priority: o,
|
|
472
|
+
addAttributes() {
|
|
473
|
+
return Wt(e.propSchema);
|
|
474
|
+
},
|
|
475
|
+
parseHTML() {
|
|
476
|
+
return Ut(e, t);
|
|
477
|
+
},
|
|
478
|
+
renderHTML({ HTMLAttributes: l }) {
|
|
479
|
+
var u;
|
|
480
|
+
const d = document.createElement("div");
|
|
481
|
+
return ie(
|
|
482
|
+
{
|
|
483
|
+
dom: d,
|
|
484
|
+
contentDOM: e.content === "inline" ? d : void 0
|
|
485
|
+
},
|
|
486
|
+
e.type,
|
|
487
|
+
{},
|
|
488
|
+
e.propSchema,
|
|
489
|
+
((u = t.meta) == null ? void 0 : u.fileBlockAccept) !== void 0,
|
|
490
|
+
l
|
|
491
|
+
);
|
|
492
|
+
},
|
|
493
|
+
addNodeView() {
|
|
494
|
+
return (l) => {
|
|
495
|
+
var h, C;
|
|
496
|
+
const d = this.options.editor, u = Ft(
|
|
497
|
+
l.getPos,
|
|
498
|
+
d,
|
|
499
|
+
this.editor,
|
|
500
|
+
e.type
|
|
501
|
+
), p = ((h = this.options.domAttributes) == null ? void 0 : h.blockContent) || {}, f = t.render.call(
|
|
502
|
+
{ blockContentDOMAttributes: p, props: l, renderType: "nodeView" },
|
|
503
|
+
u,
|
|
504
|
+
d
|
|
505
|
+
);
|
|
506
|
+
return ((C = t.meta) == null ? void 0 : C.selectable) === !1 && $t(f, this.editor), f;
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
if (r.name !== e.type)
|
|
511
|
+
throw new Error(
|
|
512
|
+
"Node name does not match block type. This is a bug in BlockNote."
|
|
513
|
+
);
|
|
514
|
+
return {
|
|
515
|
+
config: e,
|
|
516
|
+
implementation: {
|
|
517
|
+
node: r,
|
|
518
|
+
render(l, d) {
|
|
519
|
+
var p;
|
|
520
|
+
const u = ((p = r.options.domAttributes) == null ? void 0 : p.blockContent) || {};
|
|
521
|
+
return t.render.call(
|
|
522
|
+
{
|
|
523
|
+
blockContentDOMAttributes: u,
|
|
524
|
+
props: void 0,
|
|
525
|
+
renderType: "dom"
|
|
526
|
+
},
|
|
527
|
+
l,
|
|
528
|
+
d
|
|
529
|
+
);
|
|
530
|
+
},
|
|
531
|
+
// TODO: this should not have wrapInBlockStructure and generally be a lot simpler
|
|
532
|
+
// post-processing in externalHTMLExporter should not be necessary
|
|
533
|
+
toExternalHTML: (l, d) => {
|
|
534
|
+
var p, f;
|
|
535
|
+
const u = ((p = r.options.domAttributes) == null ? void 0 : p.blockContent) || {};
|
|
536
|
+
return ((f = t.toExternalHTML) == null ? void 0 : f.call(
|
|
537
|
+
{ blockContentDOMAttributes: u },
|
|
538
|
+
l,
|
|
539
|
+
d
|
|
540
|
+
)) ?? t.render.call(
|
|
541
|
+
{ blockContentDOMAttributes: u, renderType: "dom", props: void 0 },
|
|
542
|
+
l,
|
|
543
|
+
d
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
extensions: n
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
function Vo(e) {
|
|
551
|
+
return e;
|
|
552
|
+
}
|
|
553
|
+
function M(e, t, n) {
|
|
554
|
+
return (o = {}) => {
|
|
555
|
+
const r = typeof e == "function" ? e(o) : e, s = typeof t == "function" ? t(o) : t, a = n ? typeof n == "function" ? n(o) : n : void 0;
|
|
556
|
+
return {
|
|
557
|
+
config: r,
|
|
558
|
+
implementation: {
|
|
559
|
+
...s,
|
|
560
|
+
// TODO: this should not have wrapInBlockStructure and generally be a lot simpler
|
|
561
|
+
// post-processing in externalHTMLExporter should not be necessary
|
|
562
|
+
toExternalHTML(i, c) {
|
|
563
|
+
var d, u;
|
|
564
|
+
const l = (d = s.toExternalHTML) == null ? void 0 : d.call(
|
|
565
|
+
{ blockContentDOMAttributes: this.blockContentDOMAttributes },
|
|
566
|
+
i,
|
|
567
|
+
c
|
|
568
|
+
);
|
|
569
|
+
if (l !== void 0)
|
|
570
|
+
return ie(
|
|
571
|
+
l,
|
|
572
|
+
i.type,
|
|
573
|
+
i.props,
|
|
574
|
+
r.propSchema,
|
|
575
|
+
((u = s.meta) == null ? void 0 : u.fileBlockAccept) !== void 0
|
|
576
|
+
);
|
|
577
|
+
},
|
|
578
|
+
render(i, c) {
|
|
579
|
+
var u;
|
|
580
|
+
const l = s.render.call(
|
|
581
|
+
{
|
|
582
|
+
blockContentDOMAttributes: this.blockContentDOMAttributes,
|
|
583
|
+
renderType: this.renderType,
|
|
584
|
+
props: this.props
|
|
585
|
+
},
|
|
586
|
+
i,
|
|
587
|
+
c
|
|
588
|
+
);
|
|
589
|
+
return ie(
|
|
590
|
+
l,
|
|
591
|
+
i.type,
|
|
592
|
+
i.props,
|
|
593
|
+
r.propSchema,
|
|
594
|
+
((u = s.meta) == null ? void 0 : u.fileBlockAccept) !== void 0,
|
|
595
|
+
this.blockContentDOMAttributes
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
extensions: a
|
|
600
|
+
};
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
function fe(e, t) {
|
|
604
|
+
const n = e.resolve(t);
|
|
605
|
+
if (n.nodeAfter && n.nodeAfter.type.isInGroup("bnBlock"))
|
|
606
|
+
return {
|
|
607
|
+
posBeforeNode: n.pos,
|
|
608
|
+
node: n.nodeAfter
|
|
609
|
+
};
|
|
610
|
+
let o = n.depth, r = n.node(o);
|
|
611
|
+
for (; o > 0; ) {
|
|
612
|
+
if (r.type.isInGroup("bnBlock"))
|
|
613
|
+
return {
|
|
614
|
+
posBeforeNode: n.before(o),
|
|
615
|
+
node: r
|
|
616
|
+
};
|
|
617
|
+
o--, r = n.node(o);
|
|
618
|
+
}
|
|
619
|
+
const s = [];
|
|
620
|
+
e.descendants((i, c) => {
|
|
621
|
+
i.type.isInGroup("bnBlock") && s.push(c);
|
|
622
|
+
}), console.warn(`Position ${t} is not within a blockContainer node.`);
|
|
623
|
+
const a = e.resolve(
|
|
624
|
+
s.find((i) => i >= t) || s[s.length - 1]
|
|
625
|
+
);
|
|
626
|
+
return {
|
|
627
|
+
posBeforeNode: a.pos,
|
|
628
|
+
node: a.nodeAfter
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
function he(e, t) {
|
|
632
|
+
if (!e.type.isInGroup("bnBlock"))
|
|
633
|
+
throw new Error(
|
|
634
|
+
`Attempted to get bnBlock node at position but found node of different type ${e.type.name}`
|
|
635
|
+
);
|
|
636
|
+
const n = e, o = t, r = o + n.nodeSize, s = {
|
|
637
|
+
node: n,
|
|
638
|
+
beforePos: o,
|
|
639
|
+
afterPos: r
|
|
640
|
+
};
|
|
641
|
+
if (n.type.name === "blockContainer") {
|
|
642
|
+
let a, i;
|
|
643
|
+
if (n.forEach((c, l) => {
|
|
644
|
+
if (c.type.spec.group === "blockContent") {
|
|
645
|
+
const d = c, u = o + l + 1, p = u + c.nodeSize;
|
|
646
|
+
a = {
|
|
647
|
+
node: d,
|
|
648
|
+
beforePos: u,
|
|
649
|
+
afterPos: p
|
|
650
|
+
};
|
|
651
|
+
} else if (c.type.name === "blockGroup") {
|
|
652
|
+
const d = c, u = o + l + 1, p = u + c.nodeSize;
|
|
653
|
+
i = {
|
|
654
|
+
node: d,
|
|
655
|
+
beforePos: u,
|
|
656
|
+
afterPos: p
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
}), !a)
|
|
660
|
+
throw new Error(
|
|
661
|
+
`blockContainer node does not contain a blockContent node in its children: ${n}`
|
|
662
|
+
);
|
|
663
|
+
return {
|
|
664
|
+
isBlockContainer: !0,
|
|
665
|
+
bnBlock: s,
|
|
666
|
+
blockContent: a,
|
|
667
|
+
childContainer: i,
|
|
668
|
+
blockNoteType: a.node.type.name
|
|
669
|
+
};
|
|
670
|
+
} else {
|
|
671
|
+
if (!s.node.type.isInGroup("childContainer"))
|
|
672
|
+
throw new Error(
|
|
673
|
+
`bnBlock node is not in the childContainer group: ${s.node}`
|
|
674
|
+
);
|
|
675
|
+
return {
|
|
676
|
+
isBlockContainer: !1,
|
|
677
|
+
bnBlock: s,
|
|
678
|
+
childContainer: s,
|
|
679
|
+
blockNoteType: s.node.type.name
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
function z(e) {
|
|
684
|
+
return he(e.node, e.posBeforeNode);
|
|
685
|
+
}
|
|
686
|
+
function qt(e) {
|
|
687
|
+
if (!e.nodeAfter)
|
|
688
|
+
throw new Error(
|
|
689
|
+
`Attempted to get blockContainer node at position ${e.pos} but a node at this position does not exist`
|
|
690
|
+
);
|
|
691
|
+
return he(e.nodeAfter, e.pos);
|
|
692
|
+
}
|
|
693
|
+
function Wo(e) {
|
|
694
|
+
const t = fe(e.doc, e.selection.anchor);
|
|
695
|
+
return z(t);
|
|
696
|
+
}
|
|
697
|
+
function Zt(e) {
|
|
698
|
+
const t = fe(e.doc, e.selection.anchor);
|
|
699
|
+
return z(t);
|
|
700
|
+
}
|
|
701
|
+
function G(e) {
|
|
702
|
+
return "doc" in e ? e.doc.type.schema : e.type.schema;
|
|
703
|
+
}
|
|
704
|
+
function Ze(e) {
|
|
705
|
+
return e.cached.blockNoteEditor;
|
|
706
|
+
}
|
|
707
|
+
function me(e) {
|
|
708
|
+
return Ze(e).schema;
|
|
709
|
+
}
|
|
710
|
+
function ge(e) {
|
|
711
|
+
return me(e).blockSchema;
|
|
712
|
+
}
|
|
713
|
+
function be(e) {
|
|
714
|
+
return me(e).inlineContentSchema;
|
|
715
|
+
}
|
|
716
|
+
function R(e) {
|
|
717
|
+
return me(e).styleSchema;
|
|
718
|
+
}
|
|
719
|
+
function Ce(e) {
|
|
720
|
+
return Ze(e).blockCache;
|
|
721
|
+
}
|
|
722
|
+
function Gt(e, t, n) {
|
|
723
|
+
var s, a;
|
|
724
|
+
const o = {
|
|
725
|
+
type: "tableContent",
|
|
726
|
+
columnWidths: [],
|
|
727
|
+
headerRows: void 0,
|
|
728
|
+
headerCols: void 0,
|
|
729
|
+
rows: []
|
|
730
|
+
}, r = [];
|
|
731
|
+
e.content.forEach((i, c, l) => {
|
|
732
|
+
const d = {
|
|
733
|
+
cells: []
|
|
734
|
+
};
|
|
735
|
+
l === 0 && i.content.forEach((u) => {
|
|
736
|
+
let p = u.attrs.colwidth;
|
|
737
|
+
p == null && (p = new Array(u.attrs.colspan ?? 1).fill(void 0)), o.columnWidths.push(...p);
|
|
738
|
+
}), d.cells = i.content.content.map((u, p) => (r[l] || (r[l] = []), r[l][p] = u.type.name === "tableHeader", {
|
|
739
|
+
type: "tableCell",
|
|
740
|
+
content: u.content.content.map(
|
|
741
|
+
(h) => ke(h, t, n)
|
|
742
|
+
).reduce(
|
|
743
|
+
(h, C) => {
|
|
744
|
+
if (!h.length)
|
|
745
|
+
return C;
|
|
746
|
+
const m = h[h.length - 1], b = C[0];
|
|
747
|
+
return b && I(m) && I(b) && JSON.stringify(m.styles) === JSON.stringify(b.styles) ? (m.text += `
|
|
748
|
+
` + b.text, h.push(...C.slice(1)), h) : (h.push(...C), h);
|
|
749
|
+
},
|
|
750
|
+
[]
|
|
751
|
+
),
|
|
752
|
+
props: {
|
|
753
|
+
colspan: u.attrs.colspan,
|
|
754
|
+
rowspan: u.attrs.rowspan,
|
|
755
|
+
backgroundColor: u.attrs.backgroundColor,
|
|
756
|
+
textColor: u.attrs.textColor,
|
|
757
|
+
textAlignment: u.attrs.textAlignment
|
|
758
|
+
}
|
|
759
|
+
})), o.rows.push(d);
|
|
760
|
+
});
|
|
761
|
+
for (let i = 0; i < r.length; i++)
|
|
762
|
+
(s = r[i]) != null && s.every((c) => c) && (o.headerRows = (o.headerRows ?? 0) + 1);
|
|
763
|
+
for (let i = 0; i < ((a = r[0]) == null ? void 0 : a.length); i++)
|
|
764
|
+
r != null && r.every((c) => c[i]) && (o.headerCols = (o.headerCols ?? 0) + 1);
|
|
765
|
+
return o;
|
|
766
|
+
}
|
|
767
|
+
function ke(e, t, n) {
|
|
768
|
+
const o = [];
|
|
769
|
+
let r;
|
|
770
|
+
return e.content.forEach((s) => {
|
|
771
|
+
if (s.type.name === "hardBreak") {
|
|
772
|
+
if (r)
|
|
773
|
+
if (I(r))
|
|
774
|
+
r.text += `
|
|
775
|
+
`;
|
|
776
|
+
else if (Le(r))
|
|
777
|
+
r.content[r.content.length - 1].text += `
|
|
778
|
+
`;
|
|
779
|
+
else
|
|
780
|
+
throw new Error("unexpected");
|
|
781
|
+
else
|
|
782
|
+
r = {
|
|
783
|
+
type: "text",
|
|
784
|
+
text: `
|
|
785
|
+
`,
|
|
786
|
+
styles: {}
|
|
787
|
+
};
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
if (s.type.name !== "link" && s.type.name !== "text") {
|
|
791
|
+
if (!t[s.type.name]) {
|
|
792
|
+
console.warn("unrecognized inline content type", s.type.name);
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
r && (o.push(r), r = void 0), o.push(
|
|
796
|
+
Xt(s, t, n)
|
|
797
|
+
);
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
const a = {};
|
|
801
|
+
let i;
|
|
802
|
+
for (const c of s.marks)
|
|
803
|
+
if (c.type.name === "link")
|
|
804
|
+
i = c;
|
|
805
|
+
else {
|
|
806
|
+
const l = n[c.type.name];
|
|
807
|
+
if (!l) {
|
|
808
|
+
if (c.type.spec.blocknoteIgnore)
|
|
809
|
+
continue;
|
|
810
|
+
throw new Error(`style ${c.type.name} not found in styleSchema`);
|
|
811
|
+
}
|
|
812
|
+
if (l.propSchema === "boolean")
|
|
813
|
+
a[l.type] = !0;
|
|
814
|
+
else if (l.propSchema === "string")
|
|
815
|
+
a[l.type] = c.attrs.stringValue;
|
|
816
|
+
else
|
|
817
|
+
throw new Z(l.propSchema);
|
|
818
|
+
}
|
|
819
|
+
r ? I(r) ? i ? (o.push(r), r = {
|
|
820
|
+
type: "link",
|
|
821
|
+
href: i.attrs.href,
|
|
822
|
+
content: [
|
|
823
|
+
{
|
|
824
|
+
type: "text",
|
|
825
|
+
text: s.textContent,
|
|
826
|
+
styles: a
|
|
827
|
+
}
|
|
828
|
+
]
|
|
829
|
+
}) : JSON.stringify(r.styles) === JSON.stringify(a) ? r.text += s.textContent : (o.push(r), r = {
|
|
830
|
+
type: "text",
|
|
831
|
+
text: s.textContent,
|
|
832
|
+
styles: a
|
|
833
|
+
}) : Le(r) && (i ? r.href === i.attrs.href ? JSON.stringify(
|
|
834
|
+
r.content[r.content.length - 1].styles
|
|
835
|
+
) === JSON.stringify(a) ? r.content[r.content.length - 1].text += s.textContent : r.content.push({
|
|
836
|
+
type: "text",
|
|
837
|
+
text: s.textContent,
|
|
838
|
+
styles: a
|
|
839
|
+
}) : (o.push(r), r = {
|
|
840
|
+
type: "link",
|
|
841
|
+
href: i.attrs.href,
|
|
842
|
+
content: [
|
|
843
|
+
{
|
|
844
|
+
type: "text",
|
|
845
|
+
text: s.textContent,
|
|
846
|
+
styles: a
|
|
847
|
+
}
|
|
848
|
+
]
|
|
849
|
+
}) : (o.push(r), r = {
|
|
850
|
+
type: "text",
|
|
851
|
+
text: s.textContent,
|
|
852
|
+
styles: a
|
|
853
|
+
})) : i ? r = {
|
|
854
|
+
type: "link",
|
|
855
|
+
href: i.attrs.href,
|
|
856
|
+
content: [
|
|
857
|
+
{
|
|
858
|
+
type: "text",
|
|
859
|
+
text: s.textContent,
|
|
860
|
+
styles: a
|
|
861
|
+
}
|
|
862
|
+
]
|
|
863
|
+
} : r = {
|
|
864
|
+
type: "text",
|
|
865
|
+
text: s.textContent,
|
|
866
|
+
styles: a
|
|
867
|
+
};
|
|
868
|
+
}), r && o.push(r), o;
|
|
869
|
+
}
|
|
870
|
+
function Xt(e, t, n) {
|
|
871
|
+
if (e.type.name === "text" || e.type.name === "link")
|
|
872
|
+
throw new Error("unexpected");
|
|
873
|
+
const o = {}, r = t[e.type.name];
|
|
874
|
+
for (const [i, c] of Object.entries(e.attrs)) {
|
|
875
|
+
if (!r)
|
|
876
|
+
throw Error("ic node is of an unrecognized type: " + e.type.name);
|
|
877
|
+
const l = r.propSchema;
|
|
878
|
+
i in l && (o[i] = c);
|
|
879
|
+
}
|
|
880
|
+
let s;
|
|
881
|
+
return r.content === "styled" ? s = ke(
|
|
882
|
+
e,
|
|
883
|
+
t,
|
|
884
|
+
n
|
|
885
|
+
) : s = void 0, {
|
|
886
|
+
type: e.type.name,
|
|
887
|
+
props: o,
|
|
888
|
+
content: s
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
function X(e, t, n = ge(t), o = be(t), r = R(t), s = Ce(t)) {
|
|
892
|
+
var C;
|
|
893
|
+
if (!e.type.isInGroup("bnBlock"))
|
|
894
|
+
throw Error("Node should be a bnBlock, but is instead: " + e.type.name);
|
|
895
|
+
const a = s == null ? void 0 : s.get(e);
|
|
896
|
+
if (a)
|
|
897
|
+
return a;
|
|
898
|
+
const i = he(e, 0);
|
|
899
|
+
let c = i.bnBlock.node.attrs.id;
|
|
900
|
+
c === null && (c = ze.options.generateID());
|
|
901
|
+
const l = n[i.blockNoteType];
|
|
902
|
+
if (!l)
|
|
903
|
+
throw Error("Block is of an unrecognized type: " + i.blockNoteType);
|
|
904
|
+
const d = {};
|
|
905
|
+
for (const [m, b] of Object.entries({
|
|
906
|
+
...e.attrs,
|
|
907
|
+
...i.isBlockContainer ? i.blockContent.node.attrs : {}
|
|
908
|
+
})) {
|
|
909
|
+
const y = l.propSchema;
|
|
910
|
+
m in y && !(y[m].default === void 0 && b === void 0) && (d[m] = b);
|
|
911
|
+
}
|
|
912
|
+
const u = n[i.blockNoteType], p = [];
|
|
913
|
+
(C = i.childContainer) == null || C.node.forEach((m) => {
|
|
914
|
+
p.push(
|
|
915
|
+
X(
|
|
916
|
+
m,
|
|
917
|
+
t,
|
|
918
|
+
n,
|
|
919
|
+
o,
|
|
920
|
+
r,
|
|
921
|
+
s
|
|
922
|
+
)
|
|
923
|
+
);
|
|
924
|
+
});
|
|
925
|
+
let f;
|
|
926
|
+
if (u.content === "inline") {
|
|
927
|
+
if (!i.isBlockContainer)
|
|
928
|
+
throw new Error("impossible");
|
|
929
|
+
f = ke(
|
|
930
|
+
i.blockContent.node,
|
|
931
|
+
o,
|
|
932
|
+
r
|
|
933
|
+
);
|
|
934
|
+
} else if (u.content === "table") {
|
|
935
|
+
if (!i.isBlockContainer)
|
|
936
|
+
throw new Error("impossible");
|
|
937
|
+
f = Gt(
|
|
938
|
+
i.blockContent.node,
|
|
939
|
+
o,
|
|
940
|
+
r
|
|
941
|
+
);
|
|
942
|
+
} else if (u.content === "none")
|
|
943
|
+
f = void 0;
|
|
944
|
+
else
|
|
945
|
+
throw new Z(u.content);
|
|
946
|
+
const h = {
|
|
947
|
+
id: c,
|
|
948
|
+
type: u.type,
|
|
949
|
+
props: d,
|
|
950
|
+
content: f,
|
|
951
|
+
children: p
|
|
952
|
+
};
|
|
953
|
+
return s == null || s.set(e, h), h;
|
|
954
|
+
}
|
|
955
|
+
function Fo(e, t, n = ge(t), o = be(t), r = R(t), s = Ce(t)) {
|
|
956
|
+
const a = [];
|
|
957
|
+
return e.firstChild.descendants((i) => (a.push(
|
|
958
|
+
X(
|
|
959
|
+
i,
|
|
960
|
+
t,
|
|
961
|
+
n,
|
|
962
|
+
o,
|
|
963
|
+
r,
|
|
964
|
+
s
|
|
965
|
+
)
|
|
966
|
+
), !1)), a;
|
|
967
|
+
}
|
|
968
|
+
function jo(e, t, n = ge(t), o = be(t), r = R(t), s = Ce(t)) {
|
|
969
|
+
function a(i, c, l) {
|
|
970
|
+
if (i.type.name !== "blockGroup")
|
|
971
|
+
throw new Error("unexpected");
|
|
972
|
+
const d = [];
|
|
973
|
+
let u, p;
|
|
974
|
+
return i.forEach((f, h, C) => {
|
|
975
|
+
if (f.type.name !== "blockContainer")
|
|
976
|
+
throw new Error("unexpected");
|
|
977
|
+
if (f.childCount === 0)
|
|
978
|
+
return;
|
|
979
|
+
if (f.childCount === 0 || f.childCount > 2)
|
|
980
|
+
throw new Error(
|
|
981
|
+
"unexpected, blockContainer.childCount: " + f.childCount
|
|
982
|
+
);
|
|
983
|
+
const m = C === 0, b = C === i.childCount - 1;
|
|
984
|
+
if (f.firstChild.type.name === "blockGroup") {
|
|
985
|
+
if (!m)
|
|
986
|
+
throw new Error("unexpected");
|
|
987
|
+
const S = a(
|
|
988
|
+
f.firstChild,
|
|
989
|
+
Math.max(0, c - 1),
|
|
990
|
+
b ? Math.max(0, l - 1) : 0
|
|
991
|
+
);
|
|
992
|
+
u = S.blockCutAtStart, b && (p = S.blockCutAtEnd), d.push(...S.blocks);
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
const y = X(
|
|
996
|
+
f,
|
|
997
|
+
t,
|
|
998
|
+
n,
|
|
999
|
+
o,
|
|
1000
|
+
r,
|
|
1001
|
+
s
|
|
1002
|
+
), g = f.childCount > 1 ? f.child(1) : void 0;
|
|
1003
|
+
let w = [];
|
|
1004
|
+
if (g) {
|
|
1005
|
+
const S = a(
|
|
1006
|
+
g,
|
|
1007
|
+
0,
|
|
1008
|
+
// TODO: can this be anything other than 0?
|
|
1009
|
+
b ? Math.max(0, l - 1) : 0
|
|
1010
|
+
);
|
|
1011
|
+
w = S.blocks, b && (p = S.blockCutAtEnd);
|
|
1012
|
+
}
|
|
1013
|
+
b && !g && l > 1 && (p = y.id), m && c > 1 && (u = y.id), d.push({
|
|
1014
|
+
...y,
|
|
1015
|
+
children: w
|
|
1016
|
+
});
|
|
1017
|
+
}), { blocks: d, blockCutAtStart: u, blockCutAtEnd: p };
|
|
1018
|
+
}
|
|
1019
|
+
if (e.content.childCount === 0)
|
|
1020
|
+
return {
|
|
1021
|
+
blocks: [],
|
|
1022
|
+
blockCutAtStart: void 0,
|
|
1023
|
+
blockCutAtEnd: void 0
|
|
1024
|
+
};
|
|
1025
|
+
if (e.content.childCount !== 1)
|
|
1026
|
+
throw new Error(
|
|
1027
|
+
"slice must be a single block, did you forget includeParents=true?"
|
|
1028
|
+
);
|
|
1029
|
+
return a(
|
|
1030
|
+
e.content.firstChild,
|
|
1031
|
+
Math.max(e.openStart - 1, 0),
|
|
1032
|
+
Math.max(e.openEnd - 1, 0)
|
|
1033
|
+
);
|
|
1034
|
+
}
|
|
1035
|
+
function $o(e, t, n, o) {
|
|
1036
|
+
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([r, s]) => {
|
|
1037
|
+
const a = o[r];
|
|
1038
|
+
return s !== a.default;
|
|
1039
|
+
}).map(([r, s]) => [K(r), s]).forEach(([r, s]) => e.dom.setAttribute(r, s)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
1040
|
+
}
|
|
1041
|
+
function Uo(e) {
|
|
1042
|
+
return {
|
|
1043
|
+
Backspace: ({ editor: t }) => {
|
|
1044
|
+
const n = t.state.selection.$from;
|
|
1045
|
+
return t.state.selection.empty && n.node().type.name === e.type && n.parentOffset === 0;
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
1048
|
+
}
|
|
1049
|
+
function Jt(e, t) {
|
|
1050
|
+
return {
|
|
1051
|
+
config: e,
|
|
1052
|
+
implementation: t
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
function zo(e, t, n) {
|
|
1056
|
+
return Jt(
|
|
1057
|
+
{
|
|
1058
|
+
type: e.name,
|
|
1059
|
+
propSchema: t,
|
|
1060
|
+
content: e.config.content === "inline*" ? "styled" : "none"
|
|
1061
|
+
},
|
|
1062
|
+
{
|
|
1063
|
+
...n,
|
|
1064
|
+
node: e
|
|
1065
|
+
}
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
function Ge(e) {
|
|
1069
|
+
return Object.fromEntries(
|
|
1070
|
+
Object.entries(e).map(([t, n]) => [t, n.config])
|
|
1071
|
+
);
|
|
1072
|
+
}
|
|
1073
|
+
function Kt(e) {
|
|
1074
|
+
return e === "boolean" ? {} : {
|
|
1075
|
+
stringValue: {
|
|
1076
|
+
default: void 0,
|
|
1077
|
+
keepOnSplit: !0,
|
|
1078
|
+
parseHTML: (t) => t.getAttribute("data-value"),
|
|
1079
|
+
renderHTML: (t) => t.stringValue !== void 0 ? {
|
|
1080
|
+
"data-value": t.stringValue
|
|
1081
|
+
} : {}
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
function J(e, t, n, o) {
|
|
1086
|
+
return e.dom.setAttribute("data-style-type", t), o === "string" && e.dom.setAttribute("data-value", n), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
1087
|
+
}
|
|
1088
|
+
function Xe(e, t) {
|
|
1089
|
+
return {
|
|
1090
|
+
config: e,
|
|
1091
|
+
implementation: t
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
function F(e, t) {
|
|
1095
|
+
return Xe(
|
|
1096
|
+
{
|
|
1097
|
+
type: e.name,
|
|
1098
|
+
propSchema: t
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
mark: e,
|
|
1102
|
+
render(n, o) {
|
|
1103
|
+
const r = o.pmSchema.marks[e.name].spec.toDOM;
|
|
1104
|
+
if (r === void 0)
|
|
1105
|
+
throw new Error(
|
|
1106
|
+
"This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`."
|
|
1107
|
+
);
|
|
1108
|
+
const s = o.pmSchema.mark(e.name, {
|
|
1109
|
+
stringValue: n
|
|
1110
|
+
}), a = Be.renderSpec(
|
|
1111
|
+
document,
|
|
1112
|
+
r(s, !0)
|
|
1113
|
+
);
|
|
1114
|
+
if (typeof a != "object" || !("dom" in a))
|
|
1115
|
+
throw new Error(
|
|
1116
|
+
"Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property."
|
|
1117
|
+
);
|
|
1118
|
+
return a;
|
|
1119
|
+
},
|
|
1120
|
+
toExternalHTML(n, o) {
|
|
1121
|
+
const r = o.pmSchema.marks[e.name].spec.toDOM;
|
|
1122
|
+
if (r === void 0)
|
|
1123
|
+
throw new Error(
|
|
1124
|
+
"This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`."
|
|
1125
|
+
);
|
|
1126
|
+
const s = o.pmSchema.mark(e.name, {
|
|
1127
|
+
stringValue: n
|
|
1128
|
+
}), a = Be.renderSpec(
|
|
1129
|
+
document,
|
|
1130
|
+
r(s, !0)
|
|
1131
|
+
);
|
|
1132
|
+
if (typeof a != "object" || !("dom" in a))
|
|
1133
|
+
throw new Error(
|
|
1134
|
+
"Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property."
|
|
1135
|
+
);
|
|
1136
|
+
return a;
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
);
|
|
1140
|
+
}
|
|
1141
|
+
function Je(e) {
|
|
1142
|
+
return Object.fromEntries(
|
|
1143
|
+
Object.entries(e).map(([t, n]) => [t, n.config])
|
|
1144
|
+
);
|
|
1145
|
+
}
|
|
1146
|
+
function Qt(e, t) {
|
|
1147
|
+
const n = [
|
|
1148
|
+
{
|
|
1149
|
+
tag: `[data-style-type="${e.type}"]`,
|
|
1150
|
+
contentElement: (o) => {
|
|
1151
|
+
const r = o;
|
|
1152
|
+
return r.matches("[data-editable]") ? r : r.querySelector("[data-editable]") || r;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
];
|
|
1156
|
+
return t && n.push({
|
|
1157
|
+
tag: "*",
|
|
1158
|
+
getAttrs(o) {
|
|
1159
|
+
if (typeof o == "string")
|
|
1160
|
+
return !1;
|
|
1161
|
+
const r = t == null ? void 0 : t(o);
|
|
1162
|
+
return r === void 0 ? !1 : { stringValue: r };
|
|
1163
|
+
}
|
|
1164
|
+
}), n;
|
|
1165
|
+
}
|
|
1166
|
+
function Ke(e, t) {
|
|
1167
|
+
const n = Mt.create({
|
|
1168
|
+
name: e.type,
|
|
1169
|
+
addAttributes() {
|
|
1170
|
+
return Kt(e.propSchema);
|
|
1171
|
+
},
|
|
1172
|
+
parseHTML() {
|
|
1173
|
+
return Qt(e, t.parse);
|
|
1174
|
+
},
|
|
1175
|
+
renderHTML({ mark: o }) {
|
|
1176
|
+
const r = (t.toExternalHTML || t.render)(o.attrs.stringValue);
|
|
1177
|
+
return J(
|
|
1178
|
+
r,
|
|
1179
|
+
e.type,
|
|
1180
|
+
o.attrs.stringValue,
|
|
1181
|
+
e.propSchema
|
|
1182
|
+
);
|
|
1183
|
+
},
|
|
1184
|
+
addMarkView() {
|
|
1185
|
+
return ({ mark: o }) => {
|
|
1186
|
+
const r = t.render(o.attrs.stringValue);
|
|
1187
|
+
return J(
|
|
1188
|
+
r,
|
|
1189
|
+
e.type,
|
|
1190
|
+
o.attrs.stringValue,
|
|
1191
|
+
e.propSchema
|
|
1192
|
+
);
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1196
|
+
return Xe(e, {
|
|
1197
|
+
mark: n,
|
|
1198
|
+
render: (o) => {
|
|
1199
|
+
const r = t.render(o);
|
|
1200
|
+
return J(
|
|
1201
|
+
r,
|
|
1202
|
+
e.type,
|
|
1203
|
+
o,
|
|
1204
|
+
e.propSchema
|
|
1205
|
+
);
|
|
1206
|
+
},
|
|
1207
|
+
toExternalHTML: (o) => {
|
|
1208
|
+
const r = (t.toExternalHTML || t.render)(o);
|
|
1209
|
+
return J(
|
|
1210
|
+
r,
|
|
1211
|
+
e.type,
|
|
1212
|
+
o,
|
|
1213
|
+
e.propSchema
|
|
1214
|
+
);
|
|
1215
|
+
}
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
function Yt(e) {
|
|
1219
|
+
const t = tn(e);
|
|
1220
|
+
let { roots: n, nonRoots: o } = Ae(t);
|
|
1221
|
+
const r = [];
|
|
1222
|
+
for (; n.size; ) {
|
|
1223
|
+
r.push(n);
|
|
1224
|
+
const s = /* @__PURE__ */ new Set();
|
|
1225
|
+
for (const a of n) {
|
|
1226
|
+
const i = e.get(a);
|
|
1227
|
+
if (i)
|
|
1228
|
+
for (const c of i) {
|
|
1229
|
+
const l = t.get(c);
|
|
1230
|
+
if (l === void 0)
|
|
1231
|
+
continue;
|
|
1232
|
+
const d = l - 1;
|
|
1233
|
+
t.set(c, d), d === 0 && s.add(c);
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
n = s;
|
|
1237
|
+
}
|
|
1238
|
+
if (o = Ae(t).nonRoots, o.size)
|
|
1239
|
+
throw new Error(
|
|
1240
|
+
`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(o).join(", ")}`
|
|
1241
|
+
);
|
|
1242
|
+
return r;
|
|
1243
|
+
}
|
|
1244
|
+
function en(e) {
|
|
1245
|
+
const t = nn(e);
|
|
1246
|
+
return Yt(t);
|
|
1247
|
+
}
|
|
1248
|
+
function tn(e) {
|
|
1249
|
+
const t = /* @__PURE__ */ new Map();
|
|
1250
|
+
for (const [n, o] of e.entries()) {
|
|
1251
|
+
t.has(n) || t.set(n, 0);
|
|
1252
|
+
for (const r of o) {
|
|
1253
|
+
const s = t.get(r) ?? 0;
|
|
1254
|
+
t.set(r, s + 1);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
return t;
|
|
1258
|
+
}
|
|
1259
|
+
function Ae(e) {
|
|
1260
|
+
const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
1261
|
+
for (const [o, r] of e.entries())
|
|
1262
|
+
r === 0 ? t.add(o) : n.add(o);
|
|
1263
|
+
return { roots: t, nonRoots: n };
|
|
1264
|
+
}
|
|
1265
|
+
function nn(e) {
|
|
1266
|
+
const t = /* @__PURE__ */ new Map();
|
|
1267
|
+
for (const [n, o] of e.entries()) {
|
|
1268
|
+
t.has(n) || t.set(n, /* @__PURE__ */ new Set());
|
|
1269
|
+
for (const r of o)
|
|
1270
|
+
t.has(r) || t.set(r, /* @__PURE__ */ new Set()), t.get(r).add(n);
|
|
1271
|
+
}
|
|
1272
|
+
return t;
|
|
1273
|
+
}
|
|
1274
|
+
function on() {
|
|
1275
|
+
return /* @__PURE__ */ new Map();
|
|
1276
|
+
}
|
|
1277
|
+
function Ne(e) {
|
|
1278
|
+
return e && Object.fromEntries(
|
|
1279
|
+
Object.entries(e).filter(([, t]) => t !== void 0)
|
|
1280
|
+
);
|
|
1281
|
+
}
|
|
1282
|
+
class rn {
|
|
1283
|
+
constructor(t) {
|
|
1284
|
+
// Helper so that you can use typeof schema.BlockNoteEditor
|
|
1285
|
+
x(this, "BlockNoteEditor", "only for types");
|
|
1286
|
+
x(this, "Block", "only for types");
|
|
1287
|
+
x(this, "PartialBlock", "only for types");
|
|
1288
|
+
x(this, "inlineContentSpecs");
|
|
1289
|
+
x(this, "styleSpecs");
|
|
1290
|
+
x(this, "blockSpecs");
|
|
1291
|
+
x(this, "blockSchema");
|
|
1292
|
+
x(this, "inlineContentSchema");
|
|
1293
|
+
x(this, "styleSchema");
|
|
1294
|
+
this.opts = t;
|
|
1295
|
+
const {
|
|
1296
|
+
blockSpecs: n,
|
|
1297
|
+
inlineContentSpecs: o,
|
|
1298
|
+
styleSpecs: r,
|
|
1299
|
+
blockSchema: s,
|
|
1300
|
+
inlineContentSchema: a,
|
|
1301
|
+
styleSchema: i
|
|
1302
|
+
} = this.init();
|
|
1303
|
+
this.blockSpecs = n, this.styleSpecs = r, this.styleSchema = i, this.inlineContentSpecs = o, this.blockSchema = s, this.inlineContentSchema = a;
|
|
1304
|
+
}
|
|
1305
|
+
init() {
|
|
1306
|
+
const t = on(), n = /* @__PURE__ */ new Set();
|
|
1307
|
+
t.set("default", n);
|
|
1308
|
+
for (const [i, c] of Object.entries(this.opts.blockSpecs))
|
|
1309
|
+
c.implementation.runsBefore ? t.set(i, new Set(c.implementation.runsBefore)) : n.add(i);
|
|
1310
|
+
const o = en(t), r = o.findIndex((i) => i.has("default")), s = (i) => 91 + (o.findIndex((l) => l.has(i)) + r) * 10, a = Object.fromEntries(
|
|
1311
|
+
Object.entries(this.opts.blockSpecs).map(([i, c]) => [
|
|
1312
|
+
i,
|
|
1313
|
+
zt(
|
|
1314
|
+
c.config,
|
|
1315
|
+
c.implementation,
|
|
1316
|
+
c.extensions,
|
|
1317
|
+
s(i)
|
|
1318
|
+
)
|
|
1319
|
+
])
|
|
1320
|
+
);
|
|
1321
|
+
return {
|
|
1322
|
+
blockSpecs: a,
|
|
1323
|
+
blockSchema: Object.fromEntries(
|
|
1324
|
+
Object.entries(a).map(([i, c]) => [i, c.config])
|
|
1325
|
+
),
|
|
1326
|
+
inlineContentSpecs: Ne(this.opts.inlineContentSpecs),
|
|
1327
|
+
styleSpecs: Ne(this.opts.styleSpecs),
|
|
1328
|
+
inlineContentSchema: Ge(
|
|
1329
|
+
this.opts.inlineContentSpecs
|
|
1330
|
+
),
|
|
1331
|
+
styleSchema: Je(this.opts.styleSpecs)
|
|
1332
|
+
};
|
|
1333
|
+
}
|
|
1334
|
+
/**
|
|
1335
|
+
* Adds additional block specs to the current schema in a builder pattern.
|
|
1336
|
+
* This method allows extending the schema after it has been created.
|
|
1337
|
+
*
|
|
1338
|
+
* @param additionalBlockSpecs - Additional block specs to add to the schema
|
|
1339
|
+
* @returns The current schema instance for chaining
|
|
1340
|
+
*/
|
|
1341
|
+
extend(t) {
|
|
1342
|
+
Object.assign(this.opts.blockSpecs, t.blockSpecs), Object.assign(this.opts.inlineContentSpecs, t.inlineContentSpecs), Object.assign(this.opts.styleSpecs, t.styleSpecs);
|
|
1343
|
+
const {
|
|
1344
|
+
blockSpecs: n,
|
|
1345
|
+
inlineContentSpecs: o,
|
|
1346
|
+
styleSpecs: r,
|
|
1347
|
+
blockSchema: s,
|
|
1348
|
+
inlineContentSchema: a,
|
|
1349
|
+
styleSchema: i
|
|
1350
|
+
} = this.init();
|
|
1351
|
+
return this.blockSpecs = n, this.styleSpecs = r, this.styleSchema = i, this.inlineContentSpecs = o, this.blockSchema = s, this.inlineContentSchema = a, this;
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
function N(e) {
|
|
1355
|
+
const { height: t, width: n } = Qe(e), o = new Array(t).fill(!1).map(() => new Array(n).fill(null)), r = (s, a) => {
|
|
1356
|
+
for (let i = s; i < t; i++)
|
|
1357
|
+
for (let c = a; c < n; c++)
|
|
1358
|
+
if (!o[i][c])
|
|
1359
|
+
return { row: i, col: c };
|
|
1360
|
+
throw new Error(
|
|
1361
|
+
"Unable to create occupancy grid for table, no more available cells"
|
|
1362
|
+
);
|
|
1363
|
+
};
|
|
1364
|
+
for (let s = 0; s < e.content.rows.length; s++)
|
|
1365
|
+
for (let a = 0; a < e.content.rows[s].cells.length; a++) {
|
|
1366
|
+
const i = se(e.content.rows[s].cells[a]), c = ae(i), l = $(i), { row: d, col: u } = r(s, a);
|
|
1367
|
+
for (let p = d; p < d + c; p++)
|
|
1368
|
+
for (let f = u; f < u + l; f++) {
|
|
1369
|
+
if (o[p][f])
|
|
1370
|
+
throw new Error(
|
|
1371
|
+
`Unable to create occupancy grid for table, cell at ${p},${f} is already occupied`
|
|
1372
|
+
);
|
|
1373
|
+
o[p][f] = {
|
|
1374
|
+
row: s,
|
|
1375
|
+
col: a,
|
|
1376
|
+
rowspan: c,
|
|
1377
|
+
colspan: l,
|
|
1378
|
+
cell: i
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
return o;
|
|
1383
|
+
}
|
|
1384
|
+
function q(e) {
|
|
1385
|
+
const t = /* @__PURE__ */ new Set();
|
|
1386
|
+
return e.map((n) => ({
|
|
1387
|
+
cells: n.map((o) => t.has(o.row + ":" + o.col) ? !1 : (t.add(o.row + ":" + o.col), o.cell)).filter((o) => o !== !1)
|
|
1388
|
+
}));
|
|
1389
|
+
}
|
|
1390
|
+
function H(e, t, n = N(t)) {
|
|
1391
|
+
for (let o = 0; o < n.length; o++)
|
|
1392
|
+
for (let r = 0; r < n[o].length; r++) {
|
|
1393
|
+
const s = n[o][r];
|
|
1394
|
+
if (s.row === e.row && s.col === e.col)
|
|
1395
|
+
return { row: o, col: r, cell: s.cell };
|
|
1396
|
+
}
|
|
1397
|
+
throw new Error(
|
|
1398
|
+
`Unable to resolve relative table cell indices for table, cell at ${e.row},${e.col} is not occupied`
|
|
1399
|
+
);
|
|
1400
|
+
}
|
|
1401
|
+
function Qe(e) {
|
|
1402
|
+
const t = e.content.rows.length;
|
|
1403
|
+
let n = 0;
|
|
1404
|
+
return e.content.rows.forEach((o) => {
|
|
1405
|
+
let r = 0;
|
|
1406
|
+
o.cells.forEach((s) => {
|
|
1407
|
+
r += $(s);
|
|
1408
|
+
}), n = Math.max(n, r);
|
|
1409
|
+
}), { height: t, width: n };
|
|
1410
|
+
}
|
|
1411
|
+
function Ye(e, t, n = N(t)) {
|
|
1412
|
+
var r;
|
|
1413
|
+
const o = (r = n[e.row]) == null ? void 0 : r[e.col];
|
|
1414
|
+
if (o)
|
|
1415
|
+
return {
|
|
1416
|
+
row: o.row,
|
|
1417
|
+
col: o.col,
|
|
1418
|
+
cell: o.cell
|
|
1419
|
+
};
|
|
1420
|
+
}
|
|
1421
|
+
function sn(e, t) {
|
|
1422
|
+
var s;
|
|
1423
|
+
const n = N(e);
|
|
1424
|
+
if (t < 0 || t >= n.length)
|
|
1425
|
+
return [];
|
|
1426
|
+
let o = 0;
|
|
1427
|
+
for (let a = 0; a < t; a++) {
|
|
1428
|
+
const i = (s = n[o]) == null ? void 0 : s[0];
|
|
1429
|
+
if (!i)
|
|
1430
|
+
return [];
|
|
1431
|
+
o += i.rowspan;
|
|
1432
|
+
}
|
|
1433
|
+
const r = new Array(n[0].length).fill(!1).map((a, i) => Ye(
|
|
1434
|
+
{ row: o, col: i },
|
|
1435
|
+
e,
|
|
1436
|
+
n
|
|
1437
|
+
)).filter(
|
|
1438
|
+
(a) => a !== void 0
|
|
1439
|
+
);
|
|
1440
|
+
return r.filter((a, i) => r.findIndex((c) => c.row === a.row && c.col === a.col) === i);
|
|
1441
|
+
}
|
|
1442
|
+
function an(e, t) {
|
|
1443
|
+
var s;
|
|
1444
|
+
const n = N(e);
|
|
1445
|
+
if (t < 0 || t >= n[0].length)
|
|
1446
|
+
return [];
|
|
1447
|
+
let o = 0;
|
|
1448
|
+
for (let a = 0; a < t; a++) {
|
|
1449
|
+
const i = (s = n[0]) == null ? void 0 : s[o];
|
|
1450
|
+
if (!i)
|
|
1451
|
+
return [];
|
|
1452
|
+
o += i.colspan;
|
|
1453
|
+
}
|
|
1454
|
+
const r = new Array(n.length).fill(!1).map((a, i) => Ye(
|
|
1455
|
+
{ row: i, col: o },
|
|
1456
|
+
e,
|
|
1457
|
+
n
|
|
1458
|
+
)).filter(
|
|
1459
|
+
(a) => a !== void 0
|
|
1460
|
+
);
|
|
1461
|
+
return r.filter((a, i) => r.findIndex((c) => c.row === a.row && c.col === a.col) === i);
|
|
1462
|
+
}
|
|
1463
|
+
function qo(e, t, n, o = N(e)) {
|
|
1464
|
+
const { col: r } = H(
|
|
1465
|
+
{
|
|
1466
|
+
row: 0,
|
|
1467
|
+
col: t
|
|
1468
|
+
},
|
|
1469
|
+
e,
|
|
1470
|
+
o
|
|
1471
|
+
), { col: s } = H(
|
|
1472
|
+
{
|
|
1473
|
+
row: 0,
|
|
1474
|
+
col: n
|
|
1475
|
+
},
|
|
1476
|
+
e,
|
|
1477
|
+
o
|
|
1478
|
+
);
|
|
1479
|
+
return o.forEach((a) => {
|
|
1480
|
+
const [i] = a.splice(r, 1);
|
|
1481
|
+
a.splice(s, 0, i);
|
|
1482
|
+
}), q(o);
|
|
1483
|
+
}
|
|
1484
|
+
function Zo(e, t, n, o = N(e)) {
|
|
1485
|
+
const { row: r } = H(
|
|
1486
|
+
{
|
|
1487
|
+
row: t,
|
|
1488
|
+
col: 0
|
|
1489
|
+
},
|
|
1490
|
+
e,
|
|
1491
|
+
o
|
|
1492
|
+
), { row: s } = H(
|
|
1493
|
+
{
|
|
1494
|
+
row: n,
|
|
1495
|
+
col: 0
|
|
1496
|
+
},
|
|
1497
|
+
e,
|
|
1498
|
+
o
|
|
1499
|
+
), [a] = o.splice(r, 1);
|
|
1500
|
+
return o.splice(s, 0, a), q(o);
|
|
1501
|
+
}
|
|
1502
|
+
function ce(e) {
|
|
1503
|
+
return e ? j(e) ? ce(e.content) : typeof e == "string" ? e.length === 0 : Array.isArray(e) ? e.every(
|
|
1504
|
+
(t) => typeof t == "string" ? t.length === 0 : I(t) ? t.text.length === 0 : qe(t) ? typeof t.content == "string" ? t.content.length === 0 : t.content.every((n) => n.text.length === 0) : !1
|
|
1505
|
+
) : !1 : !0;
|
|
1506
|
+
}
|
|
1507
|
+
function Go(e, t, n = N(e)) {
|
|
1508
|
+
if (t === "columns") {
|
|
1509
|
+
let s = 0;
|
|
1510
|
+
for (let a = n[0].length - 1; a >= 0 && n.every(
|
|
1511
|
+
(c) => ce(c[a].cell) && c[a].colspan === 1
|
|
1512
|
+
); a--)
|
|
1513
|
+
s++;
|
|
1514
|
+
for (let a = n.length - 1; a >= 0; a--) {
|
|
1515
|
+
const i = Math.max(
|
|
1516
|
+
n[a].length - s,
|
|
1517
|
+
1
|
|
1518
|
+
);
|
|
1519
|
+
n[a] = n[a].slice(0, i);
|
|
1520
|
+
}
|
|
1521
|
+
return q(n);
|
|
1522
|
+
}
|
|
1523
|
+
let o = 0;
|
|
1524
|
+
for (let s = n.length - 1; s >= 0 && n[s].every(
|
|
1525
|
+
(i) => ce(i.cell) && i.rowspan === 1
|
|
1526
|
+
); s--)
|
|
1527
|
+
o++;
|
|
1528
|
+
const r = Math.min(o, n.length - 1);
|
|
1529
|
+
return n.splice(n.length - r, r), q(n);
|
|
1530
|
+
}
|
|
1531
|
+
function Xo(e, t, n, o = N(e)) {
|
|
1532
|
+
const { width: r, height: s } = Qe(e);
|
|
1533
|
+
if (t === "columns")
|
|
1534
|
+
o.forEach((a, i) => {
|
|
1535
|
+
if (n >= 0)
|
|
1536
|
+
for (let c = 0; c < n; c++)
|
|
1537
|
+
a.push({
|
|
1538
|
+
row: i,
|
|
1539
|
+
col: Math.max(...a.map((l) => l.col)) + 1,
|
|
1540
|
+
rowspan: 1,
|
|
1541
|
+
colspan: 1,
|
|
1542
|
+
cell: se("")
|
|
1543
|
+
});
|
|
1544
|
+
else
|
|
1545
|
+
a.splice(r + n, -1 * n);
|
|
1546
|
+
});
|
|
1547
|
+
else if (n > 0)
|
|
1548
|
+
for (let a = 0; a < n; a++) {
|
|
1549
|
+
const i = new Array(r).fill(null).map((c, l) => ({
|
|
1550
|
+
row: s + a,
|
|
1551
|
+
col: l,
|
|
1552
|
+
rowspan: 1,
|
|
1553
|
+
colspan: 1,
|
|
1554
|
+
cell: se("")
|
|
1555
|
+
}));
|
|
1556
|
+
o.push(i);
|
|
1557
|
+
}
|
|
1558
|
+
else n < 0 && o.splice(s + n, -1 * n);
|
|
1559
|
+
return q(o);
|
|
1560
|
+
}
|
|
1561
|
+
function Jo(e, t, n) {
|
|
1562
|
+
const o = sn(e, n);
|
|
1563
|
+
if (!o.some((c) => ae(c.cell) > 1))
|
|
1564
|
+
return !0;
|
|
1565
|
+
let s = n, a = n;
|
|
1566
|
+
return o.forEach((c) => {
|
|
1567
|
+
const l = ae(c.cell);
|
|
1568
|
+
s = Math.max(s, c.row + l - 1), a = Math.min(a, c.row);
|
|
1569
|
+
}), t < n ? n === s : n === a;
|
|
1570
|
+
}
|
|
1571
|
+
function Ko(e, t, n) {
|
|
1572
|
+
const o = an(e, n);
|
|
1573
|
+
if (!o.some((c) => $(c.cell) > 1))
|
|
1574
|
+
return !0;
|
|
1575
|
+
let s = n, a = n;
|
|
1576
|
+
return o.forEach((c) => {
|
|
1577
|
+
const l = $(c.cell);
|
|
1578
|
+
s = Math.max(s, c.col + l - 1), a = Math.min(a, c.col);
|
|
1579
|
+
}), t < n ? n === s : n === a;
|
|
1580
|
+
}
|
|
1581
|
+
function Qo(e, t, n) {
|
|
1582
|
+
const o = H(e, n), r = H(t, n);
|
|
1583
|
+
return o.col === r.col;
|
|
1584
|
+
}
|
|
1585
|
+
function Ie(e, t, n, o) {
|
|
1586
|
+
const r = [];
|
|
1587
|
+
for (const [a, i] of Object.entries(e.styles || {})) {
|
|
1588
|
+
const c = n[a];
|
|
1589
|
+
if (!c)
|
|
1590
|
+
throw new Error(`style ${a} not found in styleSchema`);
|
|
1591
|
+
if (c.propSchema === "boolean")
|
|
1592
|
+
i && r.push(t.mark(a));
|
|
1593
|
+
else if (c.propSchema === "string")
|
|
1594
|
+
i && r.push(t.mark(a, { stringValue: i }));
|
|
1595
|
+
else
|
|
1596
|
+
throw new Z(c.propSchema);
|
|
1597
|
+
}
|
|
1598
|
+
return !o || !t.nodes[o].spec.code ? e.text.split(/(\n)/g).filter((a) => a.length > 0).map((a) => a === `
|
|
1599
|
+
` ? t.nodes.hardBreak.createChecked() : t.text(a, r)) : e.text.length > 0 ? [t.text(e.text, r)] : [];
|
|
1600
|
+
}
|
|
1601
|
+
function cn(e, t, n) {
|
|
1602
|
+
const o = t.marks.link.create({
|
|
1603
|
+
href: e.href
|
|
1604
|
+
});
|
|
1605
|
+
return le(e.content, t, n).map(
|
|
1606
|
+
(r) => {
|
|
1607
|
+
if (r.type.name === "text")
|
|
1608
|
+
return r.mark([...r.marks, o]);
|
|
1609
|
+
if (r.type.name === "hardBreak")
|
|
1610
|
+
return r;
|
|
1611
|
+
throw new Error("unexpected node type");
|
|
1612
|
+
}
|
|
1613
|
+
);
|
|
1614
|
+
}
|
|
1615
|
+
function le(e, t, n, o) {
|
|
1616
|
+
const r = [];
|
|
1617
|
+
if (typeof e == "string")
|
|
1618
|
+
return r.push(
|
|
1619
|
+
...Ie(
|
|
1620
|
+
{ text: e, styles: {} },
|
|
1621
|
+
t,
|
|
1622
|
+
n,
|
|
1623
|
+
o
|
|
1624
|
+
)
|
|
1625
|
+
), r;
|
|
1626
|
+
for (const s of e)
|
|
1627
|
+
r.push(
|
|
1628
|
+
...Ie(s, t, n, o)
|
|
1629
|
+
);
|
|
1630
|
+
return r;
|
|
1631
|
+
}
|
|
1632
|
+
function O(e, t, n, o = R(t)) {
|
|
1633
|
+
const r = [];
|
|
1634
|
+
for (const s of e)
|
|
1635
|
+
typeof s == "string" ? r.push(
|
|
1636
|
+
...le(s, t, o, n)
|
|
1637
|
+
) : qe(s) ? r.push(...cn(s, t, o)) : I(s) ? r.push(
|
|
1638
|
+
...le([s], t, o, n)
|
|
1639
|
+
) : r.push(
|
|
1640
|
+
tt(s, t, o)
|
|
1641
|
+
);
|
|
1642
|
+
return r;
|
|
1643
|
+
}
|
|
1644
|
+
function et(e, t, n = R(t)) {
|
|
1645
|
+
const o = [], r = new Array(e.headerRows ?? 0).fill(!0), s = new Array(e.headerCols ?? 0).fill(!0), a = e.columnWidths ?? [];
|
|
1646
|
+
for (let i = 0; i < e.rows.length; i++) {
|
|
1647
|
+
const c = e.rows[i], l = [], d = r[i];
|
|
1648
|
+
for (let p = 0; p < c.cells.length; p++) {
|
|
1649
|
+
const f = c.cells[p], h = s[p], C = void 0;
|
|
1650
|
+
let m = null;
|
|
1651
|
+
const b = H(
|
|
1652
|
+
{
|
|
1653
|
+
row: i,
|
|
1654
|
+
col: p
|
|
1655
|
+
},
|
|
1656
|
+
{ content: e }
|
|
1657
|
+
);
|
|
1658
|
+
let y = a[b.col] ? [a[b.col]] : null;
|
|
1659
|
+
if (f) if (typeof f == "string")
|
|
1660
|
+
m = t.text(f);
|
|
1661
|
+
else if (j(f)) {
|
|
1662
|
+
f.content && (m = O(
|
|
1663
|
+
f.content,
|
|
1664
|
+
t,
|
|
1665
|
+
"tableParagraph",
|
|
1666
|
+
n
|
|
1667
|
+
));
|
|
1668
|
+
const w = $(f);
|
|
1669
|
+
w > 1 && (y = new Array(w).fill(!1).map((S, oe) => a[b.col + oe] ?? void 0));
|
|
1670
|
+
} else
|
|
1671
|
+
m = O(
|
|
1672
|
+
f,
|
|
1673
|
+
t,
|
|
1674
|
+
"tableParagraph",
|
|
1675
|
+
n
|
|
1676
|
+
);
|
|
1677
|
+
const g = t.nodes[h || d ? "tableHeader" : "tableCell"].createChecked(
|
|
1678
|
+
{
|
|
1679
|
+
...j(f) ? f.props : {},
|
|
1680
|
+
colwidth: y
|
|
1681
|
+
},
|
|
1682
|
+
t.nodes.tableParagraph.createChecked(C, m)
|
|
1683
|
+
);
|
|
1684
|
+
l.push(g);
|
|
1685
|
+
}
|
|
1686
|
+
const u = t.nodes.tableRow.createChecked({}, l);
|
|
1687
|
+
o.push(u);
|
|
1688
|
+
}
|
|
1689
|
+
return o;
|
|
1690
|
+
}
|
|
1691
|
+
function tt(e, t, n) {
|
|
1692
|
+
let o, r = e.type;
|
|
1693
|
+
if (r === void 0 && (r = "paragraph"), !t.nodes[r])
|
|
1694
|
+
throw new Error(`node type ${r} not found in schema`);
|
|
1695
|
+
if (!e.content)
|
|
1696
|
+
o = t.nodes[r].createChecked(e.props);
|
|
1697
|
+
else if (typeof e.content == "string") {
|
|
1698
|
+
const s = O(
|
|
1699
|
+
[e.content],
|
|
1700
|
+
t,
|
|
1701
|
+
r,
|
|
1702
|
+
n
|
|
1703
|
+
);
|
|
1704
|
+
o = t.nodes[r].createChecked(e.props, s);
|
|
1705
|
+
} else if (Array.isArray(e.content)) {
|
|
1706
|
+
const s = O(
|
|
1707
|
+
e.content,
|
|
1708
|
+
t,
|
|
1709
|
+
r,
|
|
1710
|
+
n
|
|
1711
|
+
);
|
|
1712
|
+
o = t.nodes[r].createChecked(e.props, s);
|
|
1713
|
+
} else if (e.content.type === "tableContent") {
|
|
1714
|
+
const s = et(e.content, t, n);
|
|
1715
|
+
o = t.nodes[r].createChecked(e.props, s);
|
|
1716
|
+
} else
|
|
1717
|
+
throw new Z(e.content.type);
|
|
1718
|
+
return o;
|
|
1719
|
+
}
|
|
1720
|
+
function Y(e, t, n = R(t)) {
|
|
1721
|
+
let o = e.id;
|
|
1722
|
+
o === void 0 && (o = ze.options.generateID());
|
|
1723
|
+
const r = [];
|
|
1724
|
+
if (e.children)
|
|
1725
|
+
for (const a of e.children)
|
|
1726
|
+
r.push(Y(a, t, n));
|
|
1727
|
+
if (!e.type || // can happen if block.type is not defined (this should create the default node)
|
|
1728
|
+
t.nodes[e.type].isInGroup("blockContent")) {
|
|
1729
|
+
const a = tt(
|
|
1730
|
+
e,
|
|
1731
|
+
t,
|
|
1732
|
+
n
|
|
1733
|
+
), i = r.length > 0 ? t.nodes.blockGroup.createChecked({}, r) : void 0;
|
|
1734
|
+
return t.nodes.blockContainer.createChecked(
|
|
1735
|
+
{
|
|
1736
|
+
id: o,
|
|
1737
|
+
...e.props
|
|
1738
|
+
},
|
|
1739
|
+
i ? [a, i] : a
|
|
1740
|
+
);
|
|
1741
|
+
} else {
|
|
1742
|
+
if (t.nodes[e.type].isInGroup("bnBlock"))
|
|
1743
|
+
return t.nodes[e.type].createChecked(
|
|
1744
|
+
{
|
|
1745
|
+
id: o,
|
|
1746
|
+
...e.props
|
|
1747
|
+
},
|
|
1748
|
+
r
|
|
1749
|
+
);
|
|
1750
|
+
throw new Error(
|
|
1751
|
+
`block type ${e.type} doesn't match blockContent or bnBlock group`
|
|
1752
|
+
);
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
function ln(e, t) {
|
|
1756
|
+
let n, o;
|
|
1757
|
+
if (t.firstChild.descendants((r, s) => n ? !1 : !un(r) || r.attrs.id !== e ? !0 : (n = r, o = s + 1, !1)), !(n === void 0 || o === void 0))
|
|
1758
|
+
return {
|
|
1759
|
+
node: n,
|
|
1760
|
+
posBeforeNode: o
|
|
1761
|
+
};
|
|
1762
|
+
}
|
|
1763
|
+
function un(e) {
|
|
1764
|
+
return e.type.isInGroup("bnBlock");
|
|
1765
|
+
}
|
|
1766
|
+
const Yo = (e, t) => ({
|
|
1767
|
+
tr: n,
|
|
1768
|
+
dispatch: o
|
|
1769
|
+
}) => (o && ye(n, e, t), !0);
|
|
1770
|
+
function ye(e, t, n, o, r) {
|
|
1771
|
+
const s = qt(e.doc.resolve(t));
|
|
1772
|
+
let a = null;
|
|
1773
|
+
s.blockNoteType === "table" && (a = pn(e));
|
|
1774
|
+
const i = G(e);
|
|
1775
|
+
if (o !== void 0 && r !== void 0 && o > r)
|
|
1776
|
+
throw new Error("Invalid replaceFromPos or replaceToPos");
|
|
1777
|
+
const c = i.nodes[s.blockNoteType], l = i.nodes[n.type || s.blockNoteType], d = l.isInGroup("bnBlock") ? l : i.nodes.blockContainer;
|
|
1778
|
+
if (s.isBlockContainer && l.isInGroup("blockContent")) {
|
|
1779
|
+
const u = o !== void 0 && o > s.blockContent.beforePos && o < s.blockContent.afterPos ? o - s.blockContent.beforePos - 1 : void 0, p = r !== void 0 && r > s.blockContent.beforePos && r < s.blockContent.afterPos ? r - s.blockContent.beforePos - 1 : void 0;
|
|
1780
|
+
He(n, e, s), dn(
|
|
1781
|
+
n,
|
|
1782
|
+
e,
|
|
1783
|
+
c,
|
|
1784
|
+
l,
|
|
1785
|
+
s,
|
|
1786
|
+
u,
|
|
1787
|
+
p
|
|
1788
|
+
);
|
|
1789
|
+
} else if (!s.isBlockContainer && l.isInGroup("bnBlock"))
|
|
1790
|
+
He(n, e, s);
|
|
1791
|
+
else {
|
|
1792
|
+
const u = X(s.bnBlock.node, i);
|
|
1793
|
+
e.replaceWith(
|
|
1794
|
+
s.bnBlock.beforePos,
|
|
1795
|
+
s.bnBlock.afterPos,
|
|
1796
|
+
Y(
|
|
1797
|
+
{
|
|
1798
|
+
children: u.children,
|
|
1799
|
+
// if no children are passed in, use existing children
|
|
1800
|
+
...n
|
|
1801
|
+
},
|
|
1802
|
+
i
|
|
1803
|
+
)
|
|
1804
|
+
);
|
|
1805
|
+
return;
|
|
1806
|
+
}
|
|
1807
|
+
e.setNodeMarkup(s.bnBlock.beforePos, d, {
|
|
1808
|
+
...s.bnBlock.node.attrs,
|
|
1809
|
+
...n.props
|
|
1810
|
+
}), a && fn(e, s, a);
|
|
1811
|
+
}
|
|
1812
|
+
function dn(e, t, n, o, r, s, a) {
|
|
1813
|
+
const i = G(t);
|
|
1814
|
+
let c = "keep";
|
|
1815
|
+
if (e.content)
|
|
1816
|
+
if (typeof e.content == "string")
|
|
1817
|
+
c = O(
|
|
1818
|
+
[e.content],
|
|
1819
|
+
i,
|
|
1820
|
+
o.name
|
|
1821
|
+
);
|
|
1822
|
+
else if (Array.isArray(e.content))
|
|
1823
|
+
c = O(e.content, i, o.name);
|
|
1824
|
+
else if (e.content.type === "tableContent")
|
|
1825
|
+
c = et(e.content, i);
|
|
1826
|
+
else
|
|
1827
|
+
throw new Z(e.content.type);
|
|
1828
|
+
else
|
|
1829
|
+
n.spec.content === "" || o.spec.content !== n.spec.content && (c = []);
|
|
1830
|
+
if (c === "keep")
|
|
1831
|
+
t.setNodeMarkup(r.blockContent.beforePos, o, {
|
|
1832
|
+
...r.blockContent.node.attrs,
|
|
1833
|
+
...e.props
|
|
1834
|
+
});
|
|
1835
|
+
else if (s !== void 0 || a !== void 0) {
|
|
1836
|
+
t.setNodeMarkup(r.blockContent.beforePos, o, {
|
|
1837
|
+
...r.blockContent.node.attrs,
|
|
1838
|
+
...e.props
|
|
1839
|
+
});
|
|
1840
|
+
const l = r.blockContent.beforePos + 1 + (s ?? 0), d = r.blockContent.beforePos + 1 + (a ?? r.blockContent.node.content.size), u = t.doc.resolve(r.blockContent.beforePos).depth, p = t.doc.resolve(l).depth, f = t.doc.resolve(d).depth;
|
|
1841
|
+
t.replace(
|
|
1842
|
+
l,
|
|
1843
|
+
d,
|
|
1844
|
+
new de(
|
|
1845
|
+
_.from(c),
|
|
1846
|
+
p - u - 1,
|
|
1847
|
+
f - u - 1
|
|
1848
|
+
)
|
|
1849
|
+
);
|
|
1850
|
+
} else
|
|
1851
|
+
t.replaceWith(
|
|
1852
|
+
r.blockContent.beforePos,
|
|
1853
|
+
r.blockContent.afterPos,
|
|
1854
|
+
o.createChecked(
|
|
1855
|
+
{
|
|
1856
|
+
...r.blockContent.node.attrs,
|
|
1857
|
+
...e.props
|
|
1858
|
+
},
|
|
1859
|
+
c
|
|
1860
|
+
)
|
|
1861
|
+
);
|
|
1862
|
+
}
|
|
1863
|
+
function He(e, t, n) {
|
|
1864
|
+
const o = G(t);
|
|
1865
|
+
if (e.children !== void 0 && e.children.length > 0) {
|
|
1866
|
+
const r = e.children.map((s) => Y(s, o));
|
|
1867
|
+
if (n.childContainer)
|
|
1868
|
+
t.step(
|
|
1869
|
+
new Ht(
|
|
1870
|
+
n.childContainer.beforePos + 1,
|
|
1871
|
+
n.childContainer.afterPos - 1,
|
|
1872
|
+
new de(_.from(r), 0, 0)
|
|
1873
|
+
)
|
|
1874
|
+
);
|
|
1875
|
+
else {
|
|
1876
|
+
if (!n.isBlockContainer)
|
|
1877
|
+
throw new Error("impossible");
|
|
1878
|
+
t.insert(
|
|
1879
|
+
n.blockContent.afterPos,
|
|
1880
|
+
o.nodes.blockGroup.createChecked({}, r)
|
|
1881
|
+
);
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
function er(e, t, n, o, r) {
|
|
1886
|
+
const s = typeof t == "string" ? t : t.id, a = ln(s, e.doc);
|
|
1887
|
+
if (!a)
|
|
1888
|
+
throw new Error(`Block with ID ${s} not found`);
|
|
1889
|
+
ye(
|
|
1890
|
+
e,
|
|
1891
|
+
a.posBeforeNode,
|
|
1892
|
+
n,
|
|
1893
|
+
o,
|
|
1894
|
+
r
|
|
1895
|
+
);
|
|
1896
|
+
const i = e.doc.resolve(a.posBeforeNode + 1).node(), c = G(e);
|
|
1897
|
+
return X(i, c);
|
|
1898
|
+
}
|
|
1899
|
+
function pn(e) {
|
|
1900
|
+
const t = "selection" in e ? e.selection : null;
|
|
1901
|
+
if (!(t instanceof Ue))
|
|
1902
|
+
return null;
|
|
1903
|
+
const n = e.doc.resolve(t.head);
|
|
1904
|
+
let o = -1, r = -1;
|
|
1905
|
+
for (let m = n.depth; m >= 0; m--) {
|
|
1906
|
+
const b = n.node(m).type.name;
|
|
1907
|
+
if (o < 0 && (b === "tableCell" || b === "tableHeader") && (o = m), b === "table") {
|
|
1908
|
+
r = m;
|
|
1909
|
+
break;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
if (o < 0 || r < 0)
|
|
1913
|
+
return null;
|
|
1914
|
+
const s = n.before(o), a = n.before(r), i = e.doc.nodeAt(a);
|
|
1915
|
+
if (!i || i.type.name !== "table")
|
|
1916
|
+
return null;
|
|
1917
|
+
const c = We.get(i), l = s - (a + 1), d = c.map.indexOf(l);
|
|
1918
|
+
if (d < 0)
|
|
1919
|
+
return null;
|
|
1920
|
+
const u = Math.floor(d / c.width), p = d % c.width, h = s + 1 + 1, C = Math.max(0, t.head - h);
|
|
1921
|
+
return { row: u, col: p, offset: C };
|
|
1922
|
+
}
|
|
1923
|
+
function fn(e, t, n) {
|
|
1924
|
+
var m;
|
|
1925
|
+
if (t.blockNoteType !== "table")
|
|
1926
|
+
return !1;
|
|
1927
|
+
let o = -1;
|
|
1928
|
+
if (t.isBlockContainer)
|
|
1929
|
+
o = e.mapping.map(t.blockContent.beforePos);
|
|
1930
|
+
else {
|
|
1931
|
+
const b = e.mapping.map(t.bnBlock.beforePos), y = b + (((m = e.doc.nodeAt(b)) == null ? void 0 : m.nodeSize) || 0);
|
|
1932
|
+
e.doc.nodesBetween(b, y, (g, w) => g.type.name === "table" ? (o = w, !1) : !0);
|
|
1933
|
+
}
|
|
1934
|
+
const r = o >= 0 ? e.doc.nodeAt(o) : null;
|
|
1935
|
+
if (!r || r.type.name !== "table")
|
|
1936
|
+
return !1;
|
|
1937
|
+
const s = We.get(r), a = Math.max(0, Math.min(n.row, s.height - 1)), i = Math.max(0, Math.min(n.col, s.width - 1)), c = a * s.width + i, l = s.map[c];
|
|
1938
|
+
if (l == null)
|
|
1939
|
+
return !1;
|
|
1940
|
+
const u = o + 1 + l + 1, p = e.doc.nodeAt(u), f = u + 1, h = p ? p.content.size : 0, C = f + Math.max(0, Math.min(n.offset, h));
|
|
1941
|
+
return "selection" in e && e.setSelection(Ue.create(e.doc, C)), !0;
|
|
1942
|
+
}
|
|
1943
|
+
const A = {
|
|
1944
|
+
gray: {
|
|
1945
|
+
text: "#9b9a97",
|
|
1946
|
+
background: "#ebeced"
|
|
1947
|
+
},
|
|
1948
|
+
brown: {
|
|
1949
|
+
text: "#64473a",
|
|
1950
|
+
background: "#e9e5e3"
|
|
1951
|
+
},
|
|
1952
|
+
red: {
|
|
1953
|
+
text: "#e03e3e",
|
|
1954
|
+
background: "#fbe4e4"
|
|
1955
|
+
},
|
|
1956
|
+
orange: {
|
|
1957
|
+
text: "#d9730d",
|
|
1958
|
+
background: "#f6e9d9"
|
|
1959
|
+
},
|
|
1960
|
+
yellow: {
|
|
1961
|
+
text: "#dfab01",
|
|
1962
|
+
background: "#fbf3db"
|
|
1963
|
+
},
|
|
1964
|
+
green: {
|
|
1965
|
+
text: "#4d6461",
|
|
1966
|
+
background: "#ddedea"
|
|
1967
|
+
},
|
|
1968
|
+
blue: {
|
|
1969
|
+
text: "#0b6e99",
|
|
1970
|
+
background: "#ddebf1"
|
|
1971
|
+
},
|
|
1972
|
+
purple: {
|
|
1973
|
+
text: "#6940a5",
|
|
1974
|
+
background: "#eae4f2"
|
|
1975
|
+
},
|
|
1976
|
+
pink: {
|
|
1977
|
+
text: "#ad1a72",
|
|
1978
|
+
background: "#f4dfeb"
|
|
1979
|
+
}
|
|
1980
|
+
}, tr = {
|
|
1981
|
+
gray: {
|
|
1982
|
+
text: "#bebdb8",
|
|
1983
|
+
background: "#9b9a97"
|
|
1984
|
+
},
|
|
1985
|
+
brown: {
|
|
1986
|
+
text: "#8e6552",
|
|
1987
|
+
background: "#64473a"
|
|
1988
|
+
},
|
|
1989
|
+
red: {
|
|
1990
|
+
text: "#ec4040",
|
|
1991
|
+
background: "#be3434"
|
|
1992
|
+
},
|
|
1993
|
+
orange: {
|
|
1994
|
+
text: "#e3790d",
|
|
1995
|
+
background: "#b7600a"
|
|
1996
|
+
},
|
|
1997
|
+
yellow: {
|
|
1998
|
+
text: "#dfab01",
|
|
1999
|
+
background: "#b58b00"
|
|
2000
|
+
},
|
|
2001
|
+
green: {
|
|
2002
|
+
text: "#6b8b87",
|
|
2003
|
+
background: "#4d6461"
|
|
2004
|
+
},
|
|
2005
|
+
blue: {
|
|
2006
|
+
text: "#0e87bc",
|
|
2007
|
+
background: "#0b6e99"
|
|
2008
|
+
},
|
|
2009
|
+
purple: {
|
|
2010
|
+
text: "#8552d7",
|
|
2011
|
+
background: "#6940a5"
|
|
2012
|
+
},
|
|
2013
|
+
pink: {
|
|
2014
|
+
text: "#da208f",
|
|
2015
|
+
background: "#ad1a72"
|
|
2016
|
+
}
|
|
2017
|
+
}, k = {
|
|
2018
|
+
backgroundColor: {
|
|
2019
|
+
default: "default"
|
|
2020
|
+
},
|
|
2021
|
+
textColor: {
|
|
2022
|
+
default: "default"
|
|
2023
|
+
},
|
|
2024
|
+
textAlignment: {
|
|
2025
|
+
default: "left",
|
|
2026
|
+
values: ["left", "center", "right", "justify"]
|
|
2027
|
+
}
|
|
2028
|
+
}, B = (e) => {
|
|
2029
|
+
const t = {};
|
|
2030
|
+
return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment = k.textAlignment.values.includes(
|
|
2031
|
+
e.style.textAlign
|
|
2032
|
+
) ? e.style.textAlign : void 0, t;
|
|
2033
|
+
}, P = (e, t) => {
|
|
2034
|
+
e.backgroundColor && e.backgroundColor !== k.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in A ? A[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== k.textColor.default && (t.style.color = e.textColor in A ? A[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== k.textAlignment.default && (t.style.textAlign = e.textAlignment);
|
|
2035
|
+
}, nr = (e = "backgroundColor") => ({
|
|
2036
|
+
default: k.backgroundColor.default,
|
|
2037
|
+
parseHTML: (t) => t.hasAttribute("data-background-color") ? t.getAttribute("data-background-color") : t.style.backgroundColor ? t.style.backgroundColor : k.backgroundColor.default,
|
|
2038
|
+
renderHTML: (t) => t[e] === k.backgroundColor.default ? {} : {
|
|
2039
|
+
"data-background-color": t[e]
|
|
2040
|
+
}
|
|
2041
|
+
}), or = (e = "textColor") => ({
|
|
2042
|
+
default: k.textColor.default,
|
|
2043
|
+
parseHTML: (t) => t.hasAttribute("data-text-color") ? t.getAttribute("data-text-color") : t.style.color ? t.style.color : k.textColor.default,
|
|
2044
|
+
renderHTML: (t) => t[e] === k.textColor.default ? {} : {
|
|
2045
|
+
"data-text-color": t[e]
|
|
2046
|
+
}
|
|
2047
|
+
}), rr = (e = "textAlignment") => ({
|
|
2048
|
+
default: k.textAlignment.default,
|
|
2049
|
+
parseHTML: (t) => t.hasAttribute("data-text-alignment") ? t.getAttribute("data-text-alignment") : t.style.textAlign ? t.style.textAlign : k.textAlignment.default,
|
|
2050
|
+
renderHTML: (t) => t[e] === k.textAlignment.default ? {} : {
|
|
2051
|
+
"data-text-alignment": t[e]
|
|
2052
|
+
}
|
|
2053
|
+
}), ee = (e, t) => {
|
|
2054
|
+
const n = e.querySelector(
|
|
2055
|
+
t
|
|
2056
|
+
);
|
|
2057
|
+
if (!n)
|
|
2058
|
+
return;
|
|
2059
|
+
const o = e.querySelector("figcaption"), r = (o == null ? void 0 : o.textContent) ?? void 0;
|
|
2060
|
+
return { targetElement: n, caption: r };
|
|
2061
|
+
}, hn = (e, t, n) => {
|
|
2062
|
+
const o = document.createElement("div");
|
|
2063
|
+
o.className = "bn-add-file-button";
|
|
2064
|
+
const r = document.createElement("div");
|
|
2065
|
+
r.className = "bn-add-file-button-icon", n ? r.appendChild(n) : r.innerHTML = '<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>', o.appendChild(r);
|
|
2066
|
+
const s = document.createElement("p");
|
|
2067
|
+
s.className = "bn-add-file-button-text", s.innerHTML = e.type in t.dictionary.file_blocks.add_button_text ? t.dictionary.file_blocks.add_button_text[e.type] : t.dictionary.file_blocks.add_button_text.file, o.appendChild(s);
|
|
2068
|
+
const a = (c) => {
|
|
2069
|
+
c.preventDefault();
|
|
2070
|
+
}, i = () => {
|
|
2071
|
+
t.transact(
|
|
2072
|
+
(c) => c.setMeta(t.filePanel.plugins[0], {
|
|
2073
|
+
block: e
|
|
2074
|
+
})
|
|
2075
|
+
);
|
|
2076
|
+
};
|
|
2077
|
+
return o.addEventListener(
|
|
2078
|
+
"mousedown",
|
|
2079
|
+
a,
|
|
2080
|
+
!0
|
|
2081
|
+
), o.addEventListener("click", i, !0), {
|
|
2082
|
+
dom: o,
|
|
2083
|
+
destroy: () => {
|
|
2084
|
+
o.removeEventListener(
|
|
2085
|
+
"mousedown",
|
|
2086
|
+
a,
|
|
2087
|
+
!0
|
|
2088
|
+
), o.removeEventListener(
|
|
2089
|
+
"click",
|
|
2090
|
+
i,
|
|
2091
|
+
!0
|
|
2092
|
+
);
|
|
2093
|
+
}
|
|
2094
|
+
};
|
|
2095
|
+
}, mn = '<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>', gn = (e) => {
|
|
2096
|
+
const t = document.createElement("div");
|
|
2097
|
+
t.className = "bn-file-name-with-icon";
|
|
2098
|
+
const n = document.createElement("div");
|
|
2099
|
+
n.className = "bn-file-icon", n.innerHTML = mn, t.appendChild(n);
|
|
2100
|
+
const o = document.createElement("p");
|
|
2101
|
+
return o.className = "bn-file-name", o.textContent = e.props.name, t.appendChild(o), {
|
|
2102
|
+
dom: t
|
|
2103
|
+
};
|
|
2104
|
+
}, we = (e, t, n, o) => {
|
|
2105
|
+
const r = document.createElement("div");
|
|
2106
|
+
if (r.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
2107
|
+
const a = hn(e, t, o);
|
|
2108
|
+
r.appendChild(a.dom);
|
|
2109
|
+
const i = t.onUploadStart((c) => {
|
|
2110
|
+
if (c === e.id) {
|
|
2111
|
+
r.removeChild(a.dom);
|
|
2112
|
+
const l = document.createElement("div");
|
|
2113
|
+
l.className = "bn-file-loading-preview", l.textContent = "Loading...", r.appendChild(l);
|
|
2114
|
+
}
|
|
2115
|
+
});
|
|
2116
|
+
return {
|
|
2117
|
+
dom: r,
|
|
2118
|
+
destroy: () => {
|
|
2119
|
+
i(), a.destroy();
|
|
2120
|
+
}
|
|
2121
|
+
};
|
|
2122
|
+
}
|
|
2123
|
+
const s = { dom: r };
|
|
2124
|
+
if (e.props.showPreview === !1 || !n) {
|
|
2125
|
+
const a = gn(e);
|
|
2126
|
+
r.appendChild(a.dom), s.destroy = () => {
|
|
2127
|
+
var i;
|
|
2128
|
+
(i = a.destroy) == null || i.call(a);
|
|
2129
|
+
};
|
|
2130
|
+
} else
|
|
2131
|
+
r.appendChild(n.dom);
|
|
2132
|
+
if (e.props.caption) {
|
|
2133
|
+
const a = document.createElement("p");
|
|
2134
|
+
a.className = "bn-file-caption", a.textContent = e.props.caption, r.appendChild(a);
|
|
2135
|
+
}
|
|
2136
|
+
return s;
|
|
2137
|
+
}, ve = (e, t) => {
|
|
2138
|
+
const n = document.createElement("figure"), o = document.createElement("figcaption");
|
|
2139
|
+
return o.textContent = t, n.appendChild(e), n.appendChild(o), { dom: n };
|
|
2140
|
+
}, te = (e, t) => {
|
|
2141
|
+
const n = document.createElement("div"), o = document.createElement("p");
|
|
2142
|
+
return o.textContent = t, n.appendChild(e), n.appendChild(o), {
|
|
2143
|
+
dom: n
|
|
2144
|
+
};
|
|
2145
|
+
}, Pe = (e) => ({ url: e.src || void 0 }), bn = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>', Cn = (e) => ({
|
|
2146
|
+
type: "audio",
|
|
2147
|
+
propSchema: {
|
|
2148
|
+
backgroundColor: k.backgroundColor,
|
|
2149
|
+
// File name.
|
|
2150
|
+
name: {
|
|
2151
|
+
default: ""
|
|
2152
|
+
},
|
|
2153
|
+
// File url.
|
|
2154
|
+
url: {
|
|
2155
|
+
default: ""
|
|
2156
|
+
},
|
|
2157
|
+
// File caption.
|
|
2158
|
+
caption: {
|
|
2159
|
+
default: ""
|
|
2160
|
+
},
|
|
2161
|
+
showPreview: {
|
|
2162
|
+
default: !0
|
|
2163
|
+
}
|
|
2164
|
+
},
|
|
2165
|
+
content: "none"
|
|
2166
|
+
}), kn = (e = {}) => (t) => {
|
|
2167
|
+
if (t.tagName === "AUDIO") {
|
|
2168
|
+
if (t.closest("figure"))
|
|
2169
|
+
return;
|
|
2170
|
+
const { backgroundColor: n } = B(t);
|
|
2171
|
+
return {
|
|
2172
|
+
...Pe(t),
|
|
2173
|
+
backgroundColor: n
|
|
2174
|
+
};
|
|
2175
|
+
}
|
|
2176
|
+
if (t.tagName === "FIGURE") {
|
|
2177
|
+
const n = ee(t, "audio");
|
|
2178
|
+
if (!n)
|
|
2179
|
+
return;
|
|
2180
|
+
const { targetElement: o, caption: r } = n, { backgroundColor: s } = B(t);
|
|
2181
|
+
return {
|
|
2182
|
+
...Pe(o),
|
|
2183
|
+
backgroundColor: s,
|
|
2184
|
+
caption: r
|
|
2185
|
+
};
|
|
2186
|
+
}
|
|
2187
|
+
}, yn = (e = {}) => (t, n) => {
|
|
2188
|
+
const o = document.createElement("div");
|
|
2189
|
+
o.innerHTML = e.icon ?? bn;
|
|
2190
|
+
const r = document.createElement("audio");
|
|
2191
|
+
return r.className = "bn-audio", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((s) => {
|
|
2192
|
+
r.src = s;
|
|
2193
|
+
}) : r.src = t.props.url, r.controls = !0, r.contentEditable = "false", r.draggable = !1, we(
|
|
2194
|
+
t,
|
|
2195
|
+
n,
|
|
2196
|
+
{ dom: r },
|
|
2197
|
+
o.firstElementChild
|
|
2198
|
+
);
|
|
2199
|
+
}, wn = (e = {}) => (t, n) => {
|
|
2200
|
+
if (!t.props.url) {
|
|
2201
|
+
const r = document.createElement("p");
|
|
2202
|
+
return r.textContent = "Add audio", {
|
|
2203
|
+
dom: r
|
|
2204
|
+
};
|
|
2205
|
+
}
|
|
2206
|
+
let o;
|
|
2207
|
+
return t.props.showPreview ? (o = document.createElement("audio"), o.src = t.props.url) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? ve(o, t.props.caption) : te(o, t.props.caption) : {
|
|
2208
|
+
dom: o
|
|
2209
|
+
};
|
|
2210
|
+
}, vn = M(
|
|
2211
|
+
Cn,
|
|
2212
|
+
(e) => ({
|
|
2213
|
+
meta: {
|
|
2214
|
+
fileBlockAccept: ["audio/*"]
|
|
2215
|
+
},
|
|
2216
|
+
parse: kn(e),
|
|
2217
|
+
render: yn(e),
|
|
2218
|
+
toExternalHTML: wn(e),
|
|
2219
|
+
runsBefore: ["file"]
|
|
2220
|
+
})
|
|
2221
|
+
);
|
|
2222
|
+
class En {
|
|
2223
|
+
constructor() {
|
|
2224
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
2225
|
+
x(this, "callbacks", {});
|
|
2226
|
+
}
|
|
2227
|
+
on(t, n) {
|
|
2228
|
+
return this.callbacks[t] || (this.callbacks[t] = []), this.callbacks[t].push(n), () => this.off(t, n);
|
|
2229
|
+
}
|
|
2230
|
+
emit(t, ...n) {
|
|
2231
|
+
const o = this.callbacks[t];
|
|
2232
|
+
o && o.forEach((r) => r.apply(this, n));
|
|
2233
|
+
}
|
|
2234
|
+
off(t, n) {
|
|
2235
|
+
const o = this.callbacks[t];
|
|
2236
|
+
o && (n ? this.callbacks[t] = o.filter((r) => r !== n) : delete this.callbacks[t]);
|
|
2237
|
+
}
|
|
2238
|
+
removeAllListeners() {
|
|
2239
|
+
this.callbacks = {};
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
class xn extends En {
|
|
2243
|
+
// eslint-disable-next-line
|
|
2244
|
+
constructor(...n) {
|
|
2245
|
+
super();
|
|
2246
|
+
x(this, "plugins", []);
|
|
2247
|
+
/**
|
|
2248
|
+
* Input rules for the block
|
|
2249
|
+
*/
|
|
2250
|
+
x(this, "inputRules");
|
|
2251
|
+
/**
|
|
2252
|
+
* A mapping of a keyboard shortcut to a function that will be called when the shortcut is pressed
|
|
2253
|
+
*
|
|
2254
|
+
* The keys are in the format:
|
|
2255
|
+
* - Key names may be strings like `Shift-Ctrl-Enter`—a key identifier prefixed with zero or more modifiers
|
|
2256
|
+
* - Key identifiers are based on the strings that can appear in KeyEvent.key
|
|
2257
|
+
* - Use lowercase letters to refer to letter keys (or uppercase letters if you want shift to be held)
|
|
2258
|
+
* - You may use `Space` as an alias for the " " name
|
|
2259
|
+
* - Modifiers can be given in any order: `Shift-` (or `s-`), `Alt-` (or `a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or `Meta-`)
|
|
2260
|
+
* - For characters that are created by holding shift, the Shift- prefix is implied, and should not be added explicitly
|
|
2261
|
+
* - You can use Mod- as a shorthand for Cmd- on Mac and Ctrl- on other platforms
|
|
2262
|
+
*
|
|
2263
|
+
* @example
|
|
2264
|
+
* ```typescript
|
|
2265
|
+
* keyboardShortcuts: {
|
|
2266
|
+
* "Mod-Enter": (ctx) => { return true; },
|
|
2267
|
+
* "Shift-Ctrl-Space": (ctx) => { return true; },
|
|
2268
|
+
* "a": (ctx) => { return true; },
|
|
2269
|
+
* "Space": (ctx) => { return true; }
|
|
2270
|
+
* }
|
|
2271
|
+
* ```
|
|
2272
|
+
*/
|
|
2273
|
+
x(this, "keyboardShortcuts");
|
|
2274
|
+
x(this, "tiptapExtensions");
|
|
2275
|
+
}
|
|
2276
|
+
static key() {
|
|
2277
|
+
throw new Error("You must implement the key method in your extension");
|
|
2278
|
+
}
|
|
2279
|
+
addProsemirrorPlugin(n) {
|
|
2280
|
+
this.plugins.push(n);
|
|
2281
|
+
}
|
|
2282
|
+
get priority() {
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
function L(e) {
|
|
2286
|
+
const t = Object.create(xn.prototype);
|
|
2287
|
+
return t.key = e.key, t.inputRules = e.inputRules, t.keyboardShortcuts = e.keyboardShortcuts, t.plugins = e.plugins ?? [], t.tiptapExtensions = e.tiptapExtensions, t;
|
|
2288
|
+
}
|
|
2289
|
+
const Oe = Symbol.for("blocknote.shikiParser"), re = Symbol.for(
|
|
2290
|
+
"blocknote.shikiHighlighterPromise"
|
|
2291
|
+
);
|
|
2292
|
+
function Sn(e) {
|
|
2293
|
+
const t = globalThis;
|
|
2294
|
+
let n, o, r = !1;
|
|
2295
|
+
return Nt({
|
|
2296
|
+
parser: (a) => {
|
|
2297
|
+
if (!e.createHighlighter)
|
|
2298
|
+
return process.env.NODE_ENV === "development" && !r && (console.log(
|
|
2299
|
+
"For syntax highlighting of code blocks, you must provide a `createCodeBlockSpec({ createHighlighter: () => ... })` function"
|
|
2300
|
+
), r = !0), [];
|
|
2301
|
+
if (!n)
|
|
2302
|
+
return t[re] = t[re] || e.createHighlighter(), t[re].then(
|
|
2303
|
+
(c) => {
|
|
2304
|
+
n = c;
|
|
2305
|
+
}
|
|
2306
|
+
);
|
|
2307
|
+
const i = nt(e, a.language);
|
|
2308
|
+
return !i || i === "text" || i === "none" || i === "plaintext" || i === "txt" ? [] : n.getLoadedLanguages().includes(i) ? (o || (o = t[Oe] || It(n), t[Oe] = o), o(a)) : n.loadLanguage(i);
|
|
2309
|
+
},
|
|
2310
|
+
languageExtractor: (a) => a.attrs.language,
|
|
2311
|
+
nodeTypes: ["codeBlock"]
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
const Bn = ({ defaultLanguage: e = "text" }) => ({
|
|
2315
|
+
type: "codeBlock",
|
|
2316
|
+
propSchema: {
|
|
2317
|
+
language: {
|
|
2318
|
+
default: e
|
|
2319
|
+
}
|
|
2320
|
+
},
|
|
2321
|
+
content: "inline"
|
|
2322
|
+
}), Mn = M(
|
|
2323
|
+
Bn,
|
|
2324
|
+
(e) => ({
|
|
2325
|
+
meta: {
|
|
2326
|
+
code: !0,
|
|
2327
|
+
defining: !0,
|
|
2328
|
+
isolating: !1
|
|
2329
|
+
},
|
|
2330
|
+
parse: (t) => {
|
|
2331
|
+
var r, s;
|
|
2332
|
+
if (t.tagName !== "PRE" || t.childElementCount !== 1 || ((r = t.firstElementChild) == null ? void 0 : r.tagName) !== "CODE")
|
|
2333
|
+
return;
|
|
2334
|
+
const n = t.firstElementChild;
|
|
2335
|
+
return { language: n.getAttribute("data-language") || ((s = n.className.split(" ").find((a) => a.includes("language-"))) == null ? void 0 : s.replace("language-", "")) };
|
|
2336
|
+
},
|
|
2337
|
+
parseContent: ({ el: t, schema: n }) => {
|
|
2338
|
+
const o = Q.fromSchema(n), r = t.firstElementChild;
|
|
2339
|
+
return o.parse(r, {
|
|
2340
|
+
topNode: n.nodes.codeBlock.create()
|
|
2341
|
+
}).content;
|
|
2342
|
+
},
|
|
2343
|
+
render(t, n) {
|
|
2344
|
+
const o = document.createDocumentFragment(), r = document.createElement("pre"), s = document.createElement("code");
|
|
2345
|
+
r.appendChild(s);
|
|
2346
|
+
let a;
|
|
2347
|
+
if (e.supportedLanguages) {
|
|
2348
|
+
const i = document.createElement("select"), c = (d) => {
|
|
2349
|
+
const u = d.target.value;
|
|
2350
|
+
n.updateBlock(t.id, { props: { language: u } });
|
|
2351
|
+
};
|
|
2352
|
+
i.addEventListener("change", c);
|
|
2353
|
+
const l = document.createElement("div");
|
|
2354
|
+
l.contentEditable = "false", i.value = t.props.language || e.defaultLanguage || "text", Object.entries(e.supportedLanguages ?? {}).forEach(
|
|
2355
|
+
([d, { name: u }]) => {
|
|
2356
|
+
const p = document.createElement("option");
|
|
2357
|
+
p.value = d, p.text = u, i.appendChild(p);
|
|
2358
|
+
}
|
|
2359
|
+
), l.appendChild(i), o.appendChild(l), a = () => i.removeEventListener("change", c);
|
|
2360
|
+
}
|
|
2361
|
+
return o.appendChild(r), {
|
|
2362
|
+
dom: o,
|
|
2363
|
+
contentDOM: s,
|
|
2364
|
+
destroy: () => {
|
|
2365
|
+
a == null || a();
|
|
2366
|
+
}
|
|
2367
|
+
};
|
|
2368
|
+
},
|
|
2369
|
+
toExternalHTML(t) {
|
|
2370
|
+
const n = document.createElement("pre"), o = document.createElement("code");
|
|
2371
|
+
return o.className = `language-${t.props.language}`, o.dataset.language = t.props.language, n.appendChild(o), {
|
|
2372
|
+
dom: n,
|
|
2373
|
+
contentDOM: o
|
|
2374
|
+
};
|
|
2375
|
+
}
|
|
2376
|
+
}),
|
|
2377
|
+
(e) => [
|
|
2378
|
+
L({
|
|
2379
|
+
key: "code-block-highlighter",
|
|
2380
|
+
plugins: [Sn(e)]
|
|
2381
|
+
}),
|
|
2382
|
+
L({
|
|
2383
|
+
key: "code-block-keyboard-shortcuts",
|
|
2384
|
+
keyboardShortcuts: {
|
|
2385
|
+
Delete: ({ editor: t }) => t.transact((n) => {
|
|
2386
|
+
const { block: o } = t.getTextCursorPosition();
|
|
2387
|
+
if (o.type !== "codeBlock")
|
|
2388
|
+
return !1;
|
|
2389
|
+
const { $from: r } = n.selection;
|
|
2390
|
+
return r.parent.textContent ? !1 : (t.removeBlocks([o]), !0);
|
|
2391
|
+
}),
|
|
2392
|
+
Tab: ({ editor: t }) => e.indentLineWithTab === !1 ? !1 : t.transact((n) => {
|
|
2393
|
+
const { block: o } = t.getTextCursorPosition();
|
|
2394
|
+
return o.type === "codeBlock" ? (n.insertText(" "), !0) : !1;
|
|
2395
|
+
}),
|
|
2396
|
+
Enter: ({ editor: t }) => t.transact((n) => {
|
|
2397
|
+
const { block: o, nextBlock: r } = t.getTextCursorPosition();
|
|
2398
|
+
if (o.type !== "codeBlock")
|
|
2399
|
+
return !1;
|
|
2400
|
+
const { $from: s } = n.selection, a = s.parentOffset === s.parent.nodeSize - 2, i = s.parent.textContent.endsWith(`
|
|
2401
|
+
|
|
2402
|
+
`);
|
|
2403
|
+
if (a && i) {
|
|
2404
|
+
if (n.delete(s.pos - 2, s.pos), r)
|
|
2405
|
+
return t.setTextCursorPosition(r, "start"), !0;
|
|
2406
|
+
const [c] = t.insertBlocks(
|
|
2407
|
+
[{ type: "paragraph" }],
|
|
2408
|
+
o,
|
|
2409
|
+
"after"
|
|
2410
|
+
);
|
|
2411
|
+
return t.setTextCursorPosition(c, "start"), !0;
|
|
2412
|
+
}
|
|
2413
|
+
return n.insertText(`
|
|
2414
|
+
`), !0;
|
|
2415
|
+
}),
|
|
2416
|
+
"Shift-Enter": ({ editor: t }) => t.transact(() => {
|
|
2417
|
+
const { block: n } = t.getTextCursorPosition();
|
|
2418
|
+
if (n.type !== "codeBlock")
|
|
2419
|
+
return !1;
|
|
2420
|
+
const [o] = t.insertBlocks(
|
|
2421
|
+
// insert a new paragraph
|
|
2422
|
+
[{ type: "paragraph" }],
|
|
2423
|
+
n,
|
|
2424
|
+
"after"
|
|
2425
|
+
);
|
|
2426
|
+
return t.setTextCursorPosition(o, "start"), !0;
|
|
2427
|
+
})
|
|
2428
|
+
},
|
|
2429
|
+
inputRules: [
|
|
2430
|
+
{
|
|
2431
|
+
find: /^```(.*?)\s$/,
|
|
2432
|
+
replace: ({ match: t }) => {
|
|
2433
|
+
const n = t[1].trim();
|
|
2434
|
+
return {
|
|
2435
|
+
type: "codeBlock",
|
|
2436
|
+
props: {
|
|
2437
|
+
language: {
|
|
2438
|
+
language: nt(e, n) ?? n
|
|
2439
|
+
}.language
|
|
2440
|
+
},
|
|
2441
|
+
content: []
|
|
2442
|
+
};
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
]
|
|
2446
|
+
})
|
|
2447
|
+
]
|
|
2448
|
+
);
|
|
2449
|
+
function nt(e, t) {
|
|
2450
|
+
var n;
|
|
2451
|
+
return (n = Object.entries(e.supportedLanguages ?? {}).find(
|
|
2452
|
+
([o, { aliases: r }]) => (r == null ? void 0 : r.includes(t)) || o === t
|
|
2453
|
+
)) == null ? void 0 : n[0];
|
|
2454
|
+
}
|
|
2455
|
+
const De = (e) => ({ url: e.src || void 0 }), Ln = () => ({
|
|
2456
|
+
type: "file",
|
|
2457
|
+
propSchema: {
|
|
2458
|
+
backgroundColor: k.backgroundColor,
|
|
2459
|
+
// File name.
|
|
2460
|
+
name: {
|
|
2461
|
+
default: ""
|
|
2462
|
+
},
|
|
2463
|
+
// File url.
|
|
2464
|
+
url: {
|
|
2465
|
+
default: ""
|
|
2466
|
+
},
|
|
2467
|
+
// File caption.
|
|
2468
|
+
caption: {
|
|
2469
|
+
default: ""
|
|
2470
|
+
}
|
|
2471
|
+
},
|
|
2472
|
+
content: "none"
|
|
2473
|
+
}), Tn = () => (e) => {
|
|
2474
|
+
if (e.tagName === "EMBED") {
|
|
2475
|
+
if (e.closest("figure"))
|
|
2476
|
+
return;
|
|
2477
|
+
const { backgroundColor: t } = B(e);
|
|
2478
|
+
return {
|
|
2479
|
+
...De(e),
|
|
2480
|
+
backgroundColor: t
|
|
2481
|
+
};
|
|
2482
|
+
}
|
|
2483
|
+
if (e.tagName === "FIGURE") {
|
|
2484
|
+
const t = ee(e, "embed");
|
|
2485
|
+
if (!t)
|
|
2486
|
+
return;
|
|
2487
|
+
const { targetElement: n, caption: o } = t, { backgroundColor: r } = B(e);
|
|
2488
|
+
return {
|
|
2489
|
+
...De(n),
|
|
2490
|
+
backgroundColor: r,
|
|
2491
|
+
caption: o
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
}, An = M(Ln, {
|
|
2495
|
+
meta: {
|
|
2496
|
+
fileBlockAccept: ["*/*"]
|
|
2497
|
+
},
|
|
2498
|
+
parse: Tn(),
|
|
2499
|
+
render(e, t) {
|
|
2500
|
+
return we(e, t);
|
|
2501
|
+
},
|
|
2502
|
+
toExternalHTML(e) {
|
|
2503
|
+
if (!e.props.url) {
|
|
2504
|
+
const n = document.createElement("p");
|
|
2505
|
+
return n.textContent = "Add file", {
|
|
2506
|
+
dom: n
|
|
2507
|
+
};
|
|
2508
|
+
}
|
|
2509
|
+
const t = document.createElement("a");
|
|
2510
|
+
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? te(t, e.props.caption) : {
|
|
2511
|
+
dom: t
|
|
2512
|
+
};
|
|
2513
|
+
}
|
|
2514
|
+
}), Nn = {
|
|
2515
|
+
set: (e, t) => window.localStorage.setItem(
|
|
2516
|
+
`toggle-${e.id}`,
|
|
2517
|
+
t ? "true" : "false"
|
|
2518
|
+
),
|
|
2519
|
+
get: (e) => window.localStorage.getItem(`toggle-${e.id}`) === "true"
|
|
2520
|
+
}, ot = (e, t, n, o = Nn) => {
|
|
2521
|
+
if (!("isToggleable" in e.props) || !e.props.isToggleable)
|
|
2522
|
+
return {
|
|
2523
|
+
dom: n
|
|
2524
|
+
};
|
|
2525
|
+
const r = document.createElement("div"), s = document.createElement("div");
|
|
2526
|
+
s.className = "bn-toggle-wrapper";
|
|
2527
|
+
const a = document.createElement("button");
|
|
2528
|
+
a.className = "bn-toggle-button", a.type = "button", a.innerHTML = // https://fonts.google.com/icons?selected=Material+Symbols+Rounded:chevron_right:FILL@0;wght@700;GRAD@0;opsz@24&icon.query=chevron&icon.style=Rounded&icon.size=24&icon.color=%23e8eaed
|
|
2529
|
+
'<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="CURRENTCOLOR"><path d="M320-200v-560l440 280-440 280Z"/></svg>';
|
|
2530
|
+
const i = (h) => h.preventDefault();
|
|
2531
|
+
a.addEventListener("mousedown", i);
|
|
2532
|
+
const c = () => {
|
|
2533
|
+
var h;
|
|
2534
|
+
s.getAttribute("data-show-children") === "true" ? (s.setAttribute("data-show-children", "false"), o.set(t.getBlock(e), !1), r.contains(l) && r.removeChild(l)) : (s.setAttribute("data-show-children", "true"), o.set(t.getBlock(e), !0), ((h = t.getBlock(e)) == null ? void 0 : h.children.length) === 0 && !r.contains(l) && r.appendChild(l));
|
|
2535
|
+
};
|
|
2536
|
+
a.addEventListener("click", c), s.appendChild(a), s.appendChild(n);
|
|
2537
|
+
const l = document.createElement("button");
|
|
2538
|
+
l.className = "bn-toggle-add-block-button", l.type = "button", l.textContent = t.dictionary.toggle_blocks.add_block_button;
|
|
2539
|
+
const d = (h) => h.preventDefault();
|
|
2540
|
+
l.addEventListener(
|
|
2541
|
+
"mousedown",
|
|
2542
|
+
d
|
|
2543
|
+
);
|
|
2544
|
+
const u = () => {
|
|
2545
|
+
t.transact(() => {
|
|
2546
|
+
const h = t.updateBlock(e, {
|
|
2547
|
+
// Single empty block with default type.
|
|
2548
|
+
children: [{}]
|
|
2549
|
+
});
|
|
2550
|
+
t.setTextCursorPosition(h.children[0].id, "end"), t.focus();
|
|
2551
|
+
});
|
|
2552
|
+
};
|
|
2553
|
+
l.addEventListener("click", u), r.appendChild(s);
|
|
2554
|
+
let p = e.children.length;
|
|
2555
|
+
const f = t.onChange(() => {
|
|
2556
|
+
var C;
|
|
2557
|
+
const h = ((C = t.getBlock(e)) == null ? void 0 : C.children.length) ?? 0;
|
|
2558
|
+
h > p ? (s.getAttribute("data-show-children") === "false" && (s.setAttribute("data-show-children", "true"), o.set(t.getBlock(e), !0)), r.contains(l) && r.removeChild(l)) : h === 0 && h < p && (s.getAttribute("data-show-children") === "true" && (s.setAttribute("data-show-children", "false"), o.set(t.getBlock(e), !1)), r.contains(l) && r.removeChild(l)), p = h;
|
|
2559
|
+
});
|
|
2560
|
+
return o.get(e) ? (s.setAttribute("data-show-children", "true"), e.children.length === 0 && r.appendChild(l)) : s.setAttribute("data-show-children", "false"), {
|
|
2561
|
+
dom: r,
|
|
2562
|
+
// Prevents re-renders when the toggle button is clicked.
|
|
2563
|
+
ignoreMutation: (h) => h instanceof MutationRecord && // We want to prevent re-renders when the view changes, so we ignore
|
|
2564
|
+
// all mutations where the `data-show-children` attribute is changed
|
|
2565
|
+
// or the "add block" button is added/removed.
|
|
2566
|
+
(h.type === "attributes" && h.target === s && h.attributeName === "data-show-children" || h.type === "childList" && (h.addedNodes[0] === l || h.removedNodes[0] === l)),
|
|
2567
|
+
destroy: () => {
|
|
2568
|
+
a.removeEventListener("mousedown", i), a.removeEventListener("click", c), l.removeEventListener(
|
|
2569
|
+
"mousedown",
|
|
2570
|
+
d
|
|
2571
|
+
), l.removeEventListener(
|
|
2572
|
+
"click",
|
|
2573
|
+
u
|
|
2574
|
+
), f == null || f();
|
|
2575
|
+
}
|
|
2576
|
+
};
|
|
2577
|
+
}, rt = [1, 2, 3, 4, 5, 6], In = ({
|
|
2578
|
+
defaultLevel: e = 1,
|
|
2579
|
+
levels: t = rt,
|
|
2580
|
+
allowToggleHeadings: n = !0
|
|
2581
|
+
} = {}) => ({
|
|
2582
|
+
type: "heading",
|
|
2583
|
+
propSchema: {
|
|
2584
|
+
...k,
|
|
2585
|
+
level: { default: e, values: t },
|
|
2586
|
+
...n ? { isToggleable: { default: !1, optional: !0 } } : {}
|
|
2587
|
+
},
|
|
2588
|
+
content: "inline"
|
|
2589
|
+
}), Hn = M(
|
|
2590
|
+
In,
|
|
2591
|
+
({ allowToggleHeadings: e = !0 } = {}) => ({
|
|
2592
|
+
meta: {
|
|
2593
|
+
isolating: !1
|
|
2594
|
+
},
|
|
2595
|
+
parse(t) {
|
|
2596
|
+
let n;
|
|
2597
|
+
switch (t.tagName) {
|
|
2598
|
+
case "H1":
|
|
2599
|
+
n = 1;
|
|
2600
|
+
break;
|
|
2601
|
+
case "H2":
|
|
2602
|
+
n = 2;
|
|
2603
|
+
break;
|
|
2604
|
+
case "H3":
|
|
2605
|
+
n = 3;
|
|
2606
|
+
break;
|
|
2607
|
+
case "H4":
|
|
2608
|
+
n = 4;
|
|
2609
|
+
break;
|
|
2610
|
+
case "H5":
|
|
2611
|
+
n = 5;
|
|
2612
|
+
break;
|
|
2613
|
+
case "H6":
|
|
2614
|
+
n = 6;
|
|
2615
|
+
break;
|
|
2616
|
+
default:
|
|
2617
|
+
return;
|
|
2618
|
+
}
|
|
2619
|
+
return {
|
|
2620
|
+
...B(t),
|
|
2621
|
+
level: n
|
|
2622
|
+
};
|
|
2623
|
+
},
|
|
2624
|
+
render(t, n) {
|
|
2625
|
+
const o = document.createElement(`h${t.props.level}`);
|
|
2626
|
+
return e ? { ...ot(t, n, o), contentDOM: o } : {
|
|
2627
|
+
dom: o,
|
|
2628
|
+
contentDOM: o
|
|
2629
|
+
};
|
|
2630
|
+
},
|
|
2631
|
+
toExternalHTML(t) {
|
|
2632
|
+
const n = document.createElement(`h${t.props.level}`);
|
|
2633
|
+
return P(t.props, n), {
|
|
2634
|
+
dom: n,
|
|
2635
|
+
contentDOM: n
|
|
2636
|
+
};
|
|
2637
|
+
}
|
|
2638
|
+
}),
|
|
2639
|
+
({ levels: e = rt } = {}) => [
|
|
2640
|
+
L({
|
|
2641
|
+
key: "heading-shortcuts",
|
|
2642
|
+
keyboardShortcuts: Object.fromEntries(
|
|
2643
|
+
e.map((t) => [
|
|
2644
|
+
`Mod-Alt-${t}`,
|
|
2645
|
+
({ editor: n }) => {
|
|
2646
|
+
const o = n.getTextCursorPosition();
|
|
2647
|
+
return n.schema.blockSchema[o.block.type].content !== "inline" ? !1 : (n.updateBlock(o.block, {
|
|
2648
|
+
type: "heading",
|
|
2649
|
+
props: {
|
|
2650
|
+
level: t
|
|
2651
|
+
}
|
|
2652
|
+
}), !0);
|
|
2653
|
+
}
|
|
2654
|
+
]) ?? []
|
|
2655
|
+
),
|
|
2656
|
+
inputRules: e.map((t) => ({
|
|
2657
|
+
find: new RegExp(`^(#{${t}})\\s$`),
|
|
2658
|
+
replace({ match: n }) {
|
|
2659
|
+
return {
|
|
2660
|
+
type: "heading",
|
|
2661
|
+
props: {
|
|
2662
|
+
level: n[1].length
|
|
2663
|
+
}
|
|
2664
|
+
};
|
|
2665
|
+
}
|
|
2666
|
+
}))
|
|
2667
|
+
})
|
|
2668
|
+
]
|
|
2669
|
+
), st = (e, t, n, o, r) => {
|
|
2670
|
+
const { dom: s, destroy: a } = we(
|
|
2671
|
+
e,
|
|
2672
|
+
t,
|
|
2673
|
+
n,
|
|
2674
|
+
r
|
|
2675
|
+
), i = s;
|
|
2676
|
+
i.style.position = "relative", e.props.url && e.props.showPreview && (e.props.previewWidth ? i.style.width = `${e.props.previewWidth}px` : i.style.width = "fit-content");
|
|
2677
|
+
const c = document.createElement("div");
|
|
2678
|
+
c.className = "bn-resize-handle", c.style.left = "4px";
|
|
2679
|
+
const l = document.createElement("div");
|
|
2680
|
+
l.className = "bn-resize-handle", l.style.right = "4px";
|
|
2681
|
+
const d = document.createElement("div");
|
|
2682
|
+
d.style.position = "absolute", d.style.height = "100%", d.style.width = "100%";
|
|
2683
|
+
let u, p = e.props.previewWidth;
|
|
2684
|
+
const f = (g) => {
|
|
2685
|
+
var V, W;
|
|
2686
|
+
if (!u) {
|
|
2687
|
+
!t.isEditable && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l));
|
|
2688
|
+
return;
|
|
2689
|
+
}
|
|
2690
|
+
let w;
|
|
2691
|
+
const S = "touches" in g ? g.touches[0].clientX : g.clientX;
|
|
2692
|
+
e.props.textAlignment === "center" ? u.handleUsed === "left" ? w = u.initialWidth + (u.initialClientX - S) * 2 : w = u.initialWidth + (S - u.initialClientX) * 2 : u.handleUsed === "left" ? w = u.initialWidth + u.initialClientX - S : w = u.initialWidth + S - u.initialClientX, p = Math.min(
|
|
2693
|
+
Math.max(w, 64),
|
|
2694
|
+
((W = (V = t.domElement) == null ? void 0 : V.firstElementChild) == null ? void 0 : W.clientWidth) || Number.MAX_VALUE
|
|
2695
|
+
), i.style.width = `${p}px`;
|
|
2696
|
+
}, h = (g) => {
|
|
2697
|
+
(!g.target || !i.contains(g.target) || !t.isEditable) && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l)), u && (u = void 0, i.contains(d) && i.removeChild(d), t.updateBlock(e, {
|
|
2698
|
+
props: {
|
|
2699
|
+
previewWidth: p
|
|
2700
|
+
}
|
|
2701
|
+
}));
|
|
2702
|
+
}, C = () => {
|
|
2703
|
+
t.isEditable && (o.appendChild(c), o.appendChild(l));
|
|
2704
|
+
}, m = (g) => {
|
|
2705
|
+
g.relatedTarget === c || g.relatedTarget === l || u || t.isEditable && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l));
|
|
2706
|
+
}, b = (g) => {
|
|
2707
|
+
g.preventDefault(), i.contains(d) || i.appendChild(d);
|
|
2708
|
+
const w = "touches" in g ? g.touches[0].clientX : g.clientX;
|
|
2709
|
+
u = {
|
|
2710
|
+
handleUsed: "left",
|
|
2711
|
+
initialWidth: i.clientWidth,
|
|
2712
|
+
initialClientX: w
|
|
2713
|
+
};
|
|
2714
|
+
}, y = (g) => {
|
|
2715
|
+
g.preventDefault(), i.contains(d) || i.appendChild(d);
|
|
2716
|
+
const w = "touches" in g ? g.touches[0].clientX : g.clientX;
|
|
2717
|
+
u = {
|
|
2718
|
+
handleUsed: "right",
|
|
2719
|
+
initialWidth: i.clientWidth,
|
|
2720
|
+
initialClientX: w
|
|
2721
|
+
};
|
|
2722
|
+
};
|
|
2723
|
+
return window.addEventListener("mousemove", f), window.addEventListener("touchmove", f), window.addEventListener("mouseup", h), window.addEventListener("touchend", h), i.addEventListener("mouseenter", C), i.addEventListener("mouseleave", m), c.addEventListener(
|
|
2724
|
+
"mousedown",
|
|
2725
|
+
b
|
|
2726
|
+
), c.addEventListener(
|
|
2727
|
+
"touchstart",
|
|
2728
|
+
b
|
|
2729
|
+
), l.addEventListener(
|
|
2730
|
+
"mousedown",
|
|
2731
|
+
y
|
|
2732
|
+
), l.addEventListener(
|
|
2733
|
+
"touchstart",
|
|
2734
|
+
y
|
|
2735
|
+
), {
|
|
2736
|
+
dom: i,
|
|
2737
|
+
destroy: () => {
|
|
2738
|
+
a == null || a(), window.removeEventListener("mousemove", f), window.removeEventListener("touchmove", f), window.removeEventListener("mouseup", h), window.removeEventListener("touchend", h), i.removeEventListener("mouseenter", C), i.removeEventListener("mouseleave", m), c.removeEventListener(
|
|
2739
|
+
"mousedown",
|
|
2740
|
+
b
|
|
2741
|
+
), c.removeEventListener(
|
|
2742
|
+
"touchstart",
|
|
2743
|
+
b
|
|
2744
|
+
), l.removeEventListener(
|
|
2745
|
+
"mousedown",
|
|
2746
|
+
y
|
|
2747
|
+
), l.removeEventListener(
|
|
2748
|
+
"touchstart",
|
|
2749
|
+
y
|
|
2750
|
+
);
|
|
2751
|
+
}
|
|
2752
|
+
};
|
|
2753
|
+
}, _e = (e) => {
|
|
2754
|
+
const t = e.src || void 0, n = e.width || void 0, o = e.alt || void 0;
|
|
2755
|
+
return { url: t, previewWidth: n, name: o };
|
|
2756
|
+
}, Pn = '<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>', On = (e = {}) => ({
|
|
2757
|
+
type: "image",
|
|
2758
|
+
propSchema: {
|
|
2759
|
+
textAlignment: k.textAlignment,
|
|
2760
|
+
backgroundColor: k.backgroundColor,
|
|
2761
|
+
// File name.
|
|
2762
|
+
name: {
|
|
2763
|
+
default: ""
|
|
2764
|
+
},
|
|
2765
|
+
// File url.
|
|
2766
|
+
url: {
|
|
2767
|
+
default: ""
|
|
2768
|
+
},
|
|
2769
|
+
// File caption.
|
|
2770
|
+
caption: {
|
|
2771
|
+
default: ""
|
|
2772
|
+
},
|
|
2773
|
+
showPreview: {
|
|
2774
|
+
default: !0
|
|
2775
|
+
},
|
|
2776
|
+
// File preview width in px.
|
|
2777
|
+
previewWidth: {
|
|
2778
|
+
default: void 0,
|
|
2779
|
+
type: "number"
|
|
2780
|
+
}
|
|
2781
|
+
},
|
|
2782
|
+
content: "none"
|
|
2783
|
+
}), Dn = (e = {}) => (t) => {
|
|
2784
|
+
if (t.tagName === "IMG") {
|
|
2785
|
+
if (t.closest("figure"))
|
|
2786
|
+
return;
|
|
2787
|
+
const { backgroundColor: n } = B(t);
|
|
2788
|
+
return {
|
|
2789
|
+
..._e(t),
|
|
2790
|
+
backgroundColor: n
|
|
2791
|
+
};
|
|
2792
|
+
}
|
|
2793
|
+
if (t.tagName === "FIGURE") {
|
|
2794
|
+
const n = ee(t, "img");
|
|
2795
|
+
if (!n)
|
|
2796
|
+
return;
|
|
2797
|
+
const { targetElement: o, caption: r } = n, { backgroundColor: s } = B(t);
|
|
2798
|
+
return {
|
|
2799
|
+
..._e(o),
|
|
2800
|
+
backgroundColor: s,
|
|
2801
|
+
caption: r
|
|
2802
|
+
};
|
|
2803
|
+
}
|
|
2804
|
+
}, _n = (e = {}) => (t, n) => {
|
|
2805
|
+
const o = document.createElement("div");
|
|
2806
|
+
o.innerHTML = e.icon ?? Pn;
|
|
2807
|
+
const r = document.createElement("div");
|
|
2808
|
+
r.className = "bn-visual-media-wrapper";
|
|
2809
|
+
const s = document.createElement("img");
|
|
2810
|
+
return s.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((a) => {
|
|
2811
|
+
s.src = a;
|
|
2812
|
+
}) : s.src = t.props.url, s.alt = t.props.name || t.props.caption || "BlockNote image", s.contentEditable = "false", s.draggable = !1, r.appendChild(s), st(
|
|
2813
|
+
t,
|
|
2814
|
+
n,
|
|
2815
|
+
{ dom: r },
|
|
2816
|
+
r,
|
|
2817
|
+
o.firstElementChild
|
|
2818
|
+
);
|
|
2819
|
+
}, Rn = (e = {}) => (t, n) => {
|
|
2820
|
+
if (!t.props.url) {
|
|
2821
|
+
const r = document.createElement("p");
|
|
2822
|
+
return r.textContent = "Add image", {
|
|
2823
|
+
dom: r
|
|
2824
|
+
};
|
|
2825
|
+
}
|
|
2826
|
+
let o;
|
|
2827
|
+
return t.props.showPreview ? (o = document.createElement("img"), o.src = t.props.url, o.alt = t.props.name || t.props.caption || "BlockNote image", t.props.previewWidth && (o.width = t.props.previewWidth)) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? ve(o, t.props.caption) : te(o, t.props.caption) : {
|
|
2828
|
+
dom: o
|
|
2829
|
+
};
|
|
2830
|
+
}, Vn = M(
|
|
2831
|
+
On,
|
|
2832
|
+
(e) => ({
|
|
2833
|
+
meta: {
|
|
2834
|
+
fileBlockAccept: ["image/*"]
|
|
2835
|
+
},
|
|
2836
|
+
parse: Dn(e),
|
|
2837
|
+
render: _n(e),
|
|
2838
|
+
toExternalHTML: Rn(e),
|
|
2839
|
+
runsBefore: ["file"]
|
|
2840
|
+
})
|
|
2841
|
+
), sr = (e, t, n) => ({
|
|
2842
|
+
state: o,
|
|
2843
|
+
dispatch: r
|
|
2844
|
+
}) => r ? at(o.tr, e, t, n) : !0, at = (e, t, n, o) => {
|
|
2845
|
+
const r = fe(e.doc, t), s = z(r);
|
|
2846
|
+
if (!s.isBlockContainer)
|
|
2847
|
+
return !1;
|
|
2848
|
+
const a = G(e), i = [
|
|
2849
|
+
{
|
|
2850
|
+
type: s.bnBlock.node.type,
|
|
2851
|
+
// always keep blockcontainer type
|
|
2852
|
+
attrs: o ? { ...s.bnBlock.node.attrs, id: void 0 } : {}
|
|
2853
|
+
},
|
|
2854
|
+
{
|
|
2855
|
+
type: n ? s.blockContent.node.type : a.nodes.paragraph,
|
|
2856
|
+
attrs: o ? { ...s.blockContent.node.attrs } : {}
|
|
2857
|
+
}
|
|
2858
|
+
];
|
|
2859
|
+
return e.split(t, 2, i), !0;
|
|
2860
|
+
}, ne = (e, t) => {
|
|
2861
|
+
const { blockInfo: n, selectionEmpty: o } = e.transact((a) => ({
|
|
2862
|
+
blockInfo: Zt(a),
|
|
2863
|
+
selectionEmpty: a.selection.anchor === a.selection.head
|
|
2864
|
+
}));
|
|
2865
|
+
if (!n.isBlockContainer)
|
|
2866
|
+
return !1;
|
|
2867
|
+
const { bnBlock: r, blockContent: s } = n;
|
|
2868
|
+
return s.node.type.name !== t || !o ? !1 : s.node.childCount === 0 ? (e.transact((a) => {
|
|
2869
|
+
ye(a, r.beforePos, {
|
|
2870
|
+
type: "paragraph",
|
|
2871
|
+
props: {}
|
|
2872
|
+
});
|
|
2873
|
+
}), !0) : s.node.childCount > 0 ? e.transact((a) => (a.deleteSelection(), at(a, a.selection.from, !0))) : !1;
|
|
2874
|
+
};
|
|
2875
|
+
function Ee(e, t, n) {
|
|
2876
|
+
var u, p, f;
|
|
2877
|
+
const o = Q.fromSchema(t), r = e, s = document.createElement("div");
|
|
2878
|
+
s.setAttribute("data-node-type", "blockGroup");
|
|
2879
|
+
for (const h of Array.from(r.childNodes))
|
|
2880
|
+
s.appendChild(h.cloneNode(!0));
|
|
2881
|
+
let a = o.parse(s, {
|
|
2882
|
+
topNode: t.nodes.blockGroup.create()
|
|
2883
|
+
});
|
|
2884
|
+
((p = (u = a.firstChild) == null ? void 0 : u.firstChild) == null ? void 0 : p.type.name) === "checkListItem" && (a = a.copy(
|
|
2885
|
+
a.content.cut(
|
|
2886
|
+
a.firstChild.firstChild.nodeSize + 2
|
|
2887
|
+
)
|
|
2888
|
+
));
|
|
2889
|
+
const i = (f = a.firstChild) == null ? void 0 : f.firstChild;
|
|
2890
|
+
if (!(i != null && i.isTextblock))
|
|
2891
|
+
return _.from(a);
|
|
2892
|
+
const c = t.nodes[n].create(
|
|
2893
|
+
{},
|
|
2894
|
+
i.content
|
|
2895
|
+
), l = a.content.cut(
|
|
2896
|
+
// +2 for the `blockGroup` node's start and end markers
|
|
2897
|
+
i.nodeSize + 2
|
|
2898
|
+
);
|
|
2899
|
+
if (l.size > 0) {
|
|
2900
|
+
const h = a.copy(l);
|
|
2901
|
+
return c.content.addToEnd(h);
|
|
2902
|
+
}
|
|
2903
|
+
return c.content;
|
|
2904
|
+
}
|
|
2905
|
+
const Wn = () => ({
|
|
2906
|
+
type: "bulletListItem",
|
|
2907
|
+
propSchema: {
|
|
2908
|
+
...k
|
|
2909
|
+
},
|
|
2910
|
+
content: "inline"
|
|
2911
|
+
}), Fn = M(
|
|
2912
|
+
Wn,
|
|
2913
|
+
{
|
|
2914
|
+
meta: {
|
|
2915
|
+
isolating: !1
|
|
2916
|
+
},
|
|
2917
|
+
parse(e) {
|
|
2918
|
+
var n;
|
|
2919
|
+
if (e.tagName !== "LI")
|
|
2920
|
+
return;
|
|
2921
|
+
const t = e.parentElement;
|
|
2922
|
+
if (t !== null && (t.tagName === "UL" || t.tagName === "DIV" && ((n = t.parentElement) == null ? void 0 : n.tagName) === "UL"))
|
|
2923
|
+
return B(e);
|
|
2924
|
+
},
|
|
2925
|
+
// As `li` elements can contain multiple paragraphs, we need to merge their contents
|
|
2926
|
+
// into a single one so that ProseMirror can parse everything correctly.
|
|
2927
|
+
parseContent: ({ el: e, schema: t }) => Ee(e, t, "bulletListItem"),
|
|
2928
|
+
render() {
|
|
2929
|
+
const e = document.createElement("p");
|
|
2930
|
+
return {
|
|
2931
|
+
dom: e,
|
|
2932
|
+
contentDOM: e
|
|
2933
|
+
};
|
|
2934
|
+
},
|
|
2935
|
+
toExternalHTML(e) {
|
|
2936
|
+
const t = document.createElement("li"), n = document.createElement("p");
|
|
2937
|
+
return P(e.props, t), t.appendChild(n), {
|
|
2938
|
+
dom: t,
|
|
2939
|
+
contentDOM: n
|
|
2940
|
+
};
|
|
2941
|
+
}
|
|
2942
|
+
},
|
|
2943
|
+
[
|
|
2944
|
+
L({
|
|
2945
|
+
key: "bullet-list-item-shortcuts",
|
|
2946
|
+
keyboardShortcuts: {
|
|
2947
|
+
Enter: ({ editor: e }) => ne(e, "bulletListItem"),
|
|
2948
|
+
"Mod-Shift-8": ({ editor: e }) => {
|
|
2949
|
+
const t = e.getTextCursorPosition();
|
|
2950
|
+
return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
|
|
2951
|
+
type: "bulletListItem",
|
|
2952
|
+
props: {}
|
|
2953
|
+
}), !0);
|
|
2954
|
+
}
|
|
2955
|
+
},
|
|
2956
|
+
inputRules: [
|
|
2957
|
+
{
|
|
2958
|
+
find: new RegExp("^[-+*]\\s$"),
|
|
2959
|
+
replace() {
|
|
2960
|
+
return {
|
|
2961
|
+
type: "bulletListItem",
|
|
2962
|
+
props: {}
|
|
2963
|
+
};
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
]
|
|
2967
|
+
})
|
|
2968
|
+
]
|
|
2969
|
+
), jn = () => ({
|
|
2970
|
+
type: "checkListItem",
|
|
2971
|
+
propSchema: {
|
|
2972
|
+
...k,
|
|
2973
|
+
checked: { default: !1, type: "boolean" }
|
|
2974
|
+
},
|
|
2975
|
+
content: "inline"
|
|
2976
|
+
}), $n = M(
|
|
2977
|
+
jn,
|
|
2978
|
+
{
|
|
2979
|
+
meta: {
|
|
2980
|
+
isolating: !1
|
|
2981
|
+
},
|
|
2982
|
+
parse(e) {
|
|
2983
|
+
var n;
|
|
2984
|
+
if (e.tagName === "input")
|
|
2985
|
+
return e.closest("[data-content-type]") || e.closest("li") ? void 0 : e.type === "checkbox" ? { checked: e.checked } : void 0;
|
|
2986
|
+
if (e.tagName !== "LI")
|
|
2987
|
+
return;
|
|
2988
|
+
const t = e.parentElement;
|
|
2989
|
+
if (t !== null && (t.tagName === "UL" || t.tagName === "DIV" && ((n = t.parentElement) == null ? void 0 : n.tagName) === "UL")) {
|
|
2990
|
+
const o = e.querySelector("input[type=checkbox]") || null;
|
|
2991
|
+
return o === null ? void 0 : { ...B(e), checked: o.checked };
|
|
2992
|
+
}
|
|
2993
|
+
},
|
|
2994
|
+
// As `li` elements can contain multiple paragraphs, we need to merge their contents
|
|
2995
|
+
// into a single one so that ProseMirror can parse everything correctly.
|
|
2996
|
+
parseContent: ({ el: e, schema: t }) => Ee(e, t, "checkListItem"),
|
|
2997
|
+
render(e, t) {
|
|
2998
|
+
const n = document.createDocumentFragment(), o = document.createElement("input");
|
|
2999
|
+
o.type = "checkbox", o.checked = e.props.checked, e.props.checked && o.setAttribute("checked", ""), o.addEventListener("change", () => {
|
|
3000
|
+
t.updateBlock(e, { props: { checked: !e.props.checked } });
|
|
3001
|
+
});
|
|
3002
|
+
const r = document.createElement("p");
|
|
3003
|
+
return n.appendChild(o), n.appendChild(r), {
|
|
3004
|
+
dom: n,
|
|
3005
|
+
contentDOM: r
|
|
3006
|
+
};
|
|
3007
|
+
},
|
|
3008
|
+
toExternalHTML(e) {
|
|
3009
|
+
const t = document.createElement("li"), n = document.createElement("input");
|
|
3010
|
+
n.type = "checkbox", n.checked = e.props.checked, e.props.checked && n.setAttribute("checked", "");
|
|
3011
|
+
const o = document.createElement("p");
|
|
3012
|
+
return P(e.props, t), t.appendChild(n), t.appendChild(o), {
|
|
3013
|
+
dom: t,
|
|
3014
|
+
contentDOM: o
|
|
3015
|
+
};
|
|
3016
|
+
},
|
|
3017
|
+
runsBefore: ["bulletListItem"]
|
|
3018
|
+
},
|
|
3019
|
+
[
|
|
3020
|
+
L({
|
|
3021
|
+
key: "check-list-item-shortcuts",
|
|
3022
|
+
keyboardShortcuts: {
|
|
3023
|
+
Enter: ({ editor: e }) => ne(e, "checkListItem"),
|
|
3024
|
+
"Mod-Shift-9": ({ editor: e }) => {
|
|
3025
|
+
const t = e.getTextCursorPosition();
|
|
3026
|
+
return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
|
|
3027
|
+
type: "checkListItem",
|
|
3028
|
+
props: {}
|
|
3029
|
+
}), !0);
|
|
3030
|
+
}
|
|
3031
|
+
},
|
|
3032
|
+
inputRules: [
|
|
3033
|
+
{
|
|
3034
|
+
find: new RegExp("\\[\\s*\\]\\s$"),
|
|
3035
|
+
replace() {
|
|
3036
|
+
return {
|
|
3037
|
+
type: "checkListItem",
|
|
3038
|
+
props: {
|
|
3039
|
+
checked: !1
|
|
3040
|
+
},
|
|
3041
|
+
content: []
|
|
3042
|
+
};
|
|
3043
|
+
}
|
|
3044
|
+
},
|
|
3045
|
+
{
|
|
3046
|
+
find: new RegExp("\\[[Xx]\\]\\s$"),
|
|
3047
|
+
replace() {
|
|
3048
|
+
return {
|
|
3049
|
+
type: "checkListItem",
|
|
3050
|
+
props: {
|
|
3051
|
+
checked: !0
|
|
3052
|
+
}
|
|
3053
|
+
};
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
]
|
|
3057
|
+
})
|
|
3058
|
+
]
|
|
3059
|
+
);
|
|
3060
|
+
function it(e, t, n, o) {
|
|
3061
|
+
let r = e.firstChild.attrs.start || 1, s = !0;
|
|
3062
|
+
const a = !!e.firstChild.attrs.start, i = z({
|
|
3063
|
+
posBeforeNode: t,
|
|
3064
|
+
node: e
|
|
3065
|
+
});
|
|
3066
|
+
if (!i.isBlockContainer)
|
|
3067
|
+
throw new Error("impossible");
|
|
3068
|
+
const c = n.doc.resolve(i.bnBlock.beforePos).nodeBefore, l = c ? o.get(c) : void 0;
|
|
3069
|
+
return l !== void 0 ? (r = l + 1, s = !1) : c && z({
|
|
3070
|
+
posBeforeNode: i.bnBlock.beforePos - c.nodeSize,
|
|
3071
|
+
node: c
|
|
3072
|
+
}).blockNoteType === "numberedListItem" && (r = it(
|
|
3073
|
+
c,
|
|
3074
|
+
i.bnBlock.beforePos - c.nodeSize,
|
|
3075
|
+
n,
|
|
3076
|
+
o
|
|
3077
|
+
).index + 1, s = !1), o.set(e, r), { index: r, isFirst: s, hasStart: a };
|
|
3078
|
+
}
|
|
3079
|
+
function Re(e, t) {
|
|
3080
|
+
const n = /* @__PURE__ */ new Map(), o = t.decorations.map(
|
|
3081
|
+
e.mapping,
|
|
3082
|
+
e.doc
|
|
3083
|
+
), r = [];
|
|
3084
|
+
e.doc.nodesBetween(0, e.doc.nodeSize - 2, (a, i) => {
|
|
3085
|
+
if (a.type.name === "blockContainer" && a.firstChild.type.name === "numberedListItem") {
|
|
3086
|
+
const { index: c, isFirst: l, hasStart: d } = it(
|
|
3087
|
+
a,
|
|
3088
|
+
i,
|
|
3089
|
+
e,
|
|
3090
|
+
n
|
|
3091
|
+
);
|
|
3092
|
+
o.find(
|
|
3093
|
+
i,
|
|
3094
|
+
i + a.nodeSize,
|
|
3095
|
+
(p) => p.index === c && p.isFirst === l && p.hasStart === d
|
|
3096
|
+
).length === 0 && r.push(
|
|
3097
|
+
// move in by 1 to account for the block container
|
|
3098
|
+
Pt.node(i + 1, i + a.nodeSize - 1, {
|
|
3099
|
+
"data-index": c.toString()
|
|
3100
|
+
})
|
|
3101
|
+
);
|
|
3102
|
+
}
|
|
3103
|
+
});
|
|
3104
|
+
const s = r.flatMap(
|
|
3105
|
+
(a) => o.find(a.from, a.to)
|
|
3106
|
+
);
|
|
3107
|
+
return {
|
|
3108
|
+
decorations: o.remove(s).add(e.doc, r)
|
|
3109
|
+
};
|
|
3110
|
+
}
|
|
3111
|
+
const Un = () => new je({
|
|
3112
|
+
key: new $e("numbered-list-indexing-decorations"),
|
|
3113
|
+
state: {
|
|
3114
|
+
init(e, t) {
|
|
3115
|
+
return Re(t.tr, {
|
|
3116
|
+
decorations: Me.empty
|
|
3117
|
+
});
|
|
3118
|
+
},
|
|
3119
|
+
apply(e, t) {
|
|
3120
|
+
return !e.docChanged && !e.selectionSet && t.decorations ? t : Re(e, t);
|
|
3121
|
+
}
|
|
3122
|
+
},
|
|
3123
|
+
props: {
|
|
3124
|
+
decorations(e) {
|
|
3125
|
+
var t;
|
|
3126
|
+
return ((t = this.getState(e)) == null ? void 0 : t.decorations) ?? Me.empty;
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
}), zn = () => ({
|
|
3130
|
+
type: "numberedListItem",
|
|
3131
|
+
propSchema: {
|
|
3132
|
+
...k,
|
|
3133
|
+
start: { default: void 0, type: "number" }
|
|
3134
|
+
},
|
|
3135
|
+
content: "inline"
|
|
3136
|
+
}), qn = M(
|
|
3137
|
+
zn,
|
|
3138
|
+
{
|
|
3139
|
+
meta: {
|
|
3140
|
+
isolating: !1
|
|
3141
|
+
},
|
|
3142
|
+
parse(e) {
|
|
3143
|
+
var n;
|
|
3144
|
+
if (e.tagName !== "LI")
|
|
3145
|
+
return;
|
|
3146
|
+
const t = e.parentElement;
|
|
3147
|
+
if (t !== null && (t.tagName === "OL" || t.tagName === "DIV" && ((n = t.parentElement) == null ? void 0 : n.tagName) === "OL")) {
|
|
3148
|
+
const o = parseInt(t.getAttribute("start") || "1"), r = B(e);
|
|
3149
|
+
return e.previousElementSibling || o === 1 ? r : {
|
|
3150
|
+
...r,
|
|
3151
|
+
start: o
|
|
3152
|
+
};
|
|
3153
|
+
}
|
|
3154
|
+
},
|
|
3155
|
+
// As `li` elements can contain multiple paragraphs, we need to merge their contents
|
|
3156
|
+
// into a single one so that ProseMirror can parse everything correctly.
|
|
3157
|
+
parseContent: ({ el: e, schema: t }) => Ee(e, t, "numberedListItem"),
|
|
3158
|
+
render() {
|
|
3159
|
+
const e = document.createElement("p");
|
|
3160
|
+
return {
|
|
3161
|
+
dom: e,
|
|
3162
|
+
contentDOM: e
|
|
3163
|
+
};
|
|
3164
|
+
},
|
|
3165
|
+
toExternalHTML(e) {
|
|
3166
|
+
const t = document.createElement("li"), n = document.createElement("p");
|
|
3167
|
+
return P(e.props, t), t.appendChild(n), {
|
|
3168
|
+
dom: t,
|
|
3169
|
+
contentDOM: n
|
|
3170
|
+
};
|
|
3171
|
+
}
|
|
3172
|
+
},
|
|
3173
|
+
[
|
|
3174
|
+
L({
|
|
3175
|
+
key: "numbered-list-item-shortcuts",
|
|
3176
|
+
inputRules: [
|
|
3177
|
+
{
|
|
3178
|
+
find: new RegExp("^(\\d+)\\.\\s$"),
|
|
3179
|
+
replace({ match: e }) {
|
|
3180
|
+
const t = parseInt(e[1]);
|
|
3181
|
+
return {
|
|
3182
|
+
type: "numberedListItem",
|
|
3183
|
+
props: {
|
|
3184
|
+
start: t !== 1 ? t : void 0
|
|
3185
|
+
}
|
|
3186
|
+
};
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
],
|
|
3190
|
+
keyboardShortcuts: {
|
|
3191
|
+
Enter: ({ editor: e }) => ne(e, "numberedListItem"),
|
|
3192
|
+
"Mod-Shift-7": ({ editor: e }) => {
|
|
3193
|
+
const t = e.getTextCursorPosition();
|
|
3194
|
+
return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
|
|
3195
|
+
type: "numberedListItem",
|
|
3196
|
+
props: {}
|
|
3197
|
+
}), !0);
|
|
3198
|
+
}
|
|
3199
|
+
},
|
|
3200
|
+
plugins: [Un()]
|
|
3201
|
+
})
|
|
3202
|
+
]
|
|
3203
|
+
), Zn = () => ({
|
|
3204
|
+
type: "toggleListItem",
|
|
3205
|
+
propSchema: {
|
|
3206
|
+
...k
|
|
3207
|
+
},
|
|
3208
|
+
content: "inline"
|
|
3209
|
+
}), Gn = M(
|
|
3210
|
+
Zn,
|
|
3211
|
+
{
|
|
3212
|
+
meta: {
|
|
3213
|
+
isolating: !1
|
|
3214
|
+
},
|
|
3215
|
+
render(e, t) {
|
|
3216
|
+
const n = document.createElement("p");
|
|
3217
|
+
return { ...ot(
|
|
3218
|
+
e,
|
|
3219
|
+
t,
|
|
3220
|
+
n
|
|
3221
|
+
), contentDOM: n };
|
|
3222
|
+
},
|
|
3223
|
+
toExternalHTML(e) {
|
|
3224
|
+
const t = document.createElement("li"), n = document.createElement("p");
|
|
3225
|
+
return P(e.props, t), t.appendChild(n), {
|
|
3226
|
+
dom: t,
|
|
3227
|
+
contentDOM: n
|
|
3228
|
+
};
|
|
3229
|
+
}
|
|
3230
|
+
},
|
|
3231
|
+
[
|
|
3232
|
+
L({
|
|
3233
|
+
key: "toggle-list-item-shortcuts",
|
|
3234
|
+
keyboardShortcuts: {
|
|
3235
|
+
Enter: ({ editor: e }) => ne(e, "toggleListItem"),
|
|
3236
|
+
"Mod-Shift-6": ({ editor: e }) => {
|
|
3237
|
+
const t = e.getTextCursorPosition();
|
|
3238
|
+
return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
|
|
3239
|
+
type: "toggleListItem",
|
|
3240
|
+
props: {}
|
|
3241
|
+
}), !0);
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
})
|
|
3245
|
+
]
|
|
3246
|
+
), Xn = () => ({
|
|
3247
|
+
type: "pageBreak",
|
|
3248
|
+
propSchema: {},
|
|
3249
|
+
content: "none"
|
|
3250
|
+
}), Jn = M(
|
|
3251
|
+
Xn,
|
|
3252
|
+
{
|
|
3253
|
+
parse(e) {
|
|
3254
|
+
if (e.tagName === "DIV" && e.hasAttribute("data-page-break"))
|
|
3255
|
+
return {};
|
|
3256
|
+
},
|
|
3257
|
+
render() {
|
|
3258
|
+
const e = document.createElement("div");
|
|
3259
|
+
return e.setAttribute("data-page-break", ""), {
|
|
3260
|
+
dom: e
|
|
3261
|
+
};
|
|
3262
|
+
},
|
|
3263
|
+
toExternalHTML() {
|
|
3264
|
+
const e = document.createElement("div");
|
|
3265
|
+
return e.setAttribute("data-page-break", ""), {
|
|
3266
|
+
dom: e
|
|
3267
|
+
};
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
), ar = (e) => e.extend({
|
|
3271
|
+
blockSpecs: {
|
|
3272
|
+
pageBreak: Jn()
|
|
3273
|
+
}
|
|
3274
|
+
}), Kn = () => ({
|
|
3275
|
+
type: "paragraph",
|
|
3276
|
+
propSchema: k,
|
|
3277
|
+
content: "inline"
|
|
3278
|
+
}), Qn = M(
|
|
3279
|
+
Kn,
|
|
3280
|
+
{
|
|
3281
|
+
meta: {
|
|
3282
|
+
isolating: !1
|
|
3283
|
+
},
|
|
3284
|
+
parse: (e) => {
|
|
3285
|
+
var t;
|
|
3286
|
+
if (e.tagName === "P" && (t = e.textContent) != null && t.trim())
|
|
3287
|
+
return B(e);
|
|
3288
|
+
},
|
|
3289
|
+
render: () => {
|
|
3290
|
+
const e = document.createElement("p");
|
|
3291
|
+
return {
|
|
3292
|
+
dom: e,
|
|
3293
|
+
contentDOM: e
|
|
3294
|
+
};
|
|
3295
|
+
},
|
|
3296
|
+
toExternalHTML: (e) => {
|
|
3297
|
+
const t = document.createElement("p");
|
|
3298
|
+
return P(e.props, t), {
|
|
3299
|
+
dom: t,
|
|
3300
|
+
contentDOM: t
|
|
3301
|
+
};
|
|
3302
|
+
},
|
|
3303
|
+
runsBefore: ["default"]
|
|
3304
|
+
},
|
|
3305
|
+
[
|
|
3306
|
+
L({
|
|
3307
|
+
key: "paragraph-shortcuts",
|
|
3308
|
+
keyboardShortcuts: {
|
|
3309
|
+
"Mod-Alt-0": ({ editor: e }) => {
|
|
3310
|
+
const t = e.getTextCursorPosition();
|
|
3311
|
+
return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
|
|
3312
|
+
type: "paragraph",
|
|
3313
|
+
props: {}
|
|
3314
|
+
}), !0);
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
})
|
|
3318
|
+
]
|
|
3319
|
+
), Yn = () => ({
|
|
3320
|
+
type: "quote",
|
|
3321
|
+
propSchema: {
|
|
3322
|
+
backgroundColor: k.backgroundColor,
|
|
3323
|
+
textColor: k.textColor
|
|
3324
|
+
},
|
|
3325
|
+
content: "inline"
|
|
3326
|
+
}), eo = M(
|
|
3327
|
+
Yn,
|
|
3328
|
+
{
|
|
3329
|
+
meta: {
|
|
3330
|
+
isolating: !1
|
|
3331
|
+
},
|
|
3332
|
+
parse(e) {
|
|
3333
|
+
if (e.tagName === "BLOCKQUOTE") {
|
|
3334
|
+
const { backgroundColor: t, textColor: n } = B(e);
|
|
3335
|
+
return { backgroundColor: t, textColor: n };
|
|
3336
|
+
}
|
|
3337
|
+
},
|
|
3338
|
+
render() {
|
|
3339
|
+
const e = document.createElement("blockquote");
|
|
3340
|
+
return {
|
|
3341
|
+
dom: e,
|
|
3342
|
+
contentDOM: e
|
|
3343
|
+
};
|
|
3344
|
+
},
|
|
3345
|
+
toExternalHTML(e) {
|
|
3346
|
+
const t = document.createElement("blockquote");
|
|
3347
|
+
return P(e.props, t), {
|
|
3348
|
+
dom: t,
|
|
3349
|
+
contentDOM: t
|
|
3350
|
+
};
|
|
3351
|
+
}
|
|
3352
|
+
},
|
|
3353
|
+
[
|
|
3354
|
+
L({
|
|
3355
|
+
key: "quote-block-shortcuts",
|
|
3356
|
+
keyboardShortcuts: {
|
|
3357
|
+
"Mod-Alt-q": ({ editor: e }) => {
|
|
3358
|
+
const t = e.getTextCursorPosition();
|
|
3359
|
+
return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
|
|
3360
|
+
type: "quote",
|
|
3361
|
+
props: {}
|
|
3362
|
+
}), !0);
|
|
3363
|
+
}
|
|
3364
|
+
},
|
|
3365
|
+
inputRules: [
|
|
3366
|
+
{
|
|
3367
|
+
find: new RegExp("^>\\s$"),
|
|
3368
|
+
replace() {
|
|
3369
|
+
return {
|
|
3370
|
+
type: "quote",
|
|
3371
|
+
props: {}
|
|
3372
|
+
};
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
]
|
|
3376
|
+
})
|
|
3377
|
+
]
|
|
3378
|
+
), to = 35, ct = 120, ir = 31, no = Fe.create({
|
|
3379
|
+
name: "BlockNoteTableExtension",
|
|
3380
|
+
addProseMirrorPlugins: () => [
|
|
3381
|
+
mt({
|
|
3382
|
+
cellMinWidth: to,
|
|
3383
|
+
defaultCellMinWidth: ct,
|
|
3384
|
+
// We set this to null as we implement our own node view in the table
|
|
3385
|
+
// block content. This node view is the same as what's used by default,
|
|
3386
|
+
// but is wrapped in a `blockContent` HTML element.
|
|
3387
|
+
View: null
|
|
3388
|
+
}),
|
|
3389
|
+
gt()
|
|
3390
|
+
],
|
|
3391
|
+
addKeyboardShortcuts() {
|
|
3392
|
+
return {
|
|
3393
|
+
// Makes enter create a new line within the cell.
|
|
3394
|
+
Enter: () => this.editor.state.selection.empty && this.editor.state.selection.$head.parent.type.name === "tableParagraph" ? (this.editor.commands.insertContent({ type: "hardBreak" }), !0) : !1,
|
|
3395
|
+
// Ensures that backspace won't delete the table if the text cursor is at
|
|
3396
|
+
// the start of a cell and the selection is empty.
|
|
3397
|
+
Backspace: () => {
|
|
3398
|
+
const e = this.editor.state.selection, t = e.empty, n = e.$head.parentOffset === 0, o = e.$head.node().type.name === "tableParagraph";
|
|
3399
|
+
return t && n && o;
|
|
3400
|
+
},
|
|
3401
|
+
// Enables navigating cells using the tab key.
|
|
3402
|
+
Tab: () => this.editor.commands.command(
|
|
3403
|
+
({ state: e, dispatch: t, view: n }) => Se(1)(e, t, n)
|
|
3404
|
+
),
|
|
3405
|
+
"Shift-Tab": () => this.editor.commands.command(
|
|
3406
|
+
({ state: e, dispatch: t, view: n }) => Se(-1)(e, t, n)
|
|
3407
|
+
)
|
|
3408
|
+
};
|
|
3409
|
+
},
|
|
3410
|
+
extendNodeSchema(e) {
|
|
3411
|
+
const t = {
|
|
3412
|
+
name: e.name,
|
|
3413
|
+
options: e.options,
|
|
3414
|
+
storage: e.storage
|
|
3415
|
+
};
|
|
3416
|
+
return {
|
|
3417
|
+
tableRole: Lt(
|
|
3418
|
+
Tt(e, "tableRole", t)
|
|
3419
|
+
)
|
|
3420
|
+
};
|
|
3421
|
+
}
|
|
3422
|
+
}), oo = {
|
|
3423
|
+
textColor: k.textColor
|
|
3424
|
+
}, ro = D.create({
|
|
3425
|
+
name: "tableHeader",
|
|
3426
|
+
addOptions() {
|
|
3427
|
+
return {
|
|
3428
|
+
HTMLAttributes: {}
|
|
3429
|
+
};
|
|
3430
|
+
},
|
|
3431
|
+
/**
|
|
3432
|
+
* We allow table headers and cells to have multiple tableContent nodes because
|
|
3433
|
+
* when merging cells, prosemirror-tables will concat the contents of the cells naively.
|
|
3434
|
+
* This would cause that content to overflow into other cells when prosemirror tries to enforce the cell structure.
|
|
3435
|
+
*
|
|
3436
|
+
* So, we manually fix this up when reading back in the `nodeToBlock` and only ever place a single tableContent back into the cell.
|
|
3437
|
+
*/
|
|
3438
|
+
content: "tableContent+",
|
|
3439
|
+
addAttributes() {
|
|
3440
|
+
return {
|
|
3441
|
+
colspan: {
|
|
3442
|
+
default: 1
|
|
3443
|
+
},
|
|
3444
|
+
rowspan: {
|
|
3445
|
+
default: 1
|
|
3446
|
+
},
|
|
3447
|
+
colwidth: {
|
|
3448
|
+
default: null,
|
|
3449
|
+
parseHTML: (e) => {
|
|
3450
|
+
const t = e.getAttribute("colwidth");
|
|
3451
|
+
return t ? t.split(",").map((o) => parseInt(o, 10)) : null;
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
};
|
|
3455
|
+
},
|
|
3456
|
+
tableRole: "header_cell",
|
|
3457
|
+
isolating: !0,
|
|
3458
|
+
parseHTML() {
|
|
3459
|
+
return [
|
|
3460
|
+
{
|
|
3461
|
+
tag: "th",
|
|
3462
|
+
// As `th` elements can contain multiple paragraphs, we need to merge their contents
|
|
3463
|
+
// into a single one so that ProseMirror can parse everything correctly.
|
|
3464
|
+
getContent: (e, t) => lt(e, t)
|
|
3465
|
+
}
|
|
3466
|
+
];
|
|
3467
|
+
},
|
|
3468
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
3469
|
+
return [
|
|
3470
|
+
"th",
|
|
3471
|
+
ue(this.options.HTMLAttributes, e),
|
|
3472
|
+
0
|
|
3473
|
+
];
|
|
3474
|
+
}
|
|
3475
|
+
}), so = D.create({
|
|
3476
|
+
name: "tableCell",
|
|
3477
|
+
addOptions() {
|
|
3478
|
+
return {
|
|
3479
|
+
HTMLAttributes: {}
|
|
3480
|
+
};
|
|
3481
|
+
},
|
|
3482
|
+
content: "tableContent+",
|
|
3483
|
+
addAttributes() {
|
|
3484
|
+
return {
|
|
3485
|
+
colspan: {
|
|
3486
|
+
default: 1
|
|
3487
|
+
},
|
|
3488
|
+
rowspan: {
|
|
3489
|
+
default: 1
|
|
3490
|
+
},
|
|
3491
|
+
colwidth: {
|
|
3492
|
+
default: null,
|
|
3493
|
+
parseHTML: (e) => {
|
|
3494
|
+
const t = e.getAttribute("colwidth");
|
|
3495
|
+
return t ? t.split(",").map((o) => parseInt(o, 10)) : null;
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3498
|
+
};
|
|
3499
|
+
},
|
|
3500
|
+
tableRole: "cell",
|
|
3501
|
+
isolating: !0,
|
|
3502
|
+
parseHTML() {
|
|
3503
|
+
return [
|
|
3504
|
+
{
|
|
3505
|
+
tag: "td",
|
|
3506
|
+
// As `td` elements can contain multiple paragraphs, we need to merge their contents
|
|
3507
|
+
// into a single one so that ProseMirror can parse everything correctly.
|
|
3508
|
+
getContent: (e, t) => lt(e, t)
|
|
3509
|
+
}
|
|
3510
|
+
];
|
|
3511
|
+
},
|
|
3512
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
3513
|
+
return [
|
|
3514
|
+
"td",
|
|
3515
|
+
ue(this.options.HTMLAttributes, e),
|
|
3516
|
+
0
|
|
3517
|
+
];
|
|
3518
|
+
}
|
|
3519
|
+
}), ao = D.create({
|
|
3520
|
+
name: "table",
|
|
3521
|
+
content: "tableRow+",
|
|
3522
|
+
group: "blockContent",
|
|
3523
|
+
tableRole: "table",
|
|
3524
|
+
marks: "deletion insertion modification",
|
|
3525
|
+
isolating: !0,
|
|
3526
|
+
parseHTML() {
|
|
3527
|
+
return [
|
|
3528
|
+
{
|
|
3529
|
+
tag: "table"
|
|
3530
|
+
}
|
|
3531
|
+
];
|
|
3532
|
+
},
|
|
3533
|
+
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
3534
|
+
var r, s, a;
|
|
3535
|
+
const n = Rt(
|
|
3536
|
+
this.name,
|
|
3537
|
+
"table",
|
|
3538
|
+
{
|
|
3539
|
+
...((r = this.options.domAttributes) == null ? void 0 : r.blockContent) || {},
|
|
3540
|
+
...t
|
|
3541
|
+
},
|
|
3542
|
+
((s = this.options.domAttributes) == null ? void 0 : s.inlineContent) || {}
|
|
3543
|
+
), o = document.createElement("colgroup");
|
|
3544
|
+
for (const i of e.children[0].children)
|
|
3545
|
+
if (i.attrs.colwidth)
|
|
3546
|
+
for (const l of i.attrs.colwidth) {
|
|
3547
|
+
const d = document.createElement("col");
|
|
3548
|
+
l && (d.style = `width: ${l}px`), o.appendChild(d);
|
|
3549
|
+
}
|
|
3550
|
+
else
|
|
3551
|
+
o.appendChild(document.createElement("col"));
|
|
3552
|
+
return (a = n.dom.firstChild) == null || a.appendChild(o), n;
|
|
3553
|
+
},
|
|
3554
|
+
// This node view is needed for the `columnResizing` plugin. By default, the
|
|
3555
|
+
// plugin adds its own node view, which overrides how the node is rendered vs
|
|
3556
|
+
// `renderHTML`. This means that the wrapping `blockContent` HTML element is
|
|
3557
|
+
// no longer rendered. The `columnResizing` plugin uses the `TableView` as its
|
|
3558
|
+
// default node view. `BlockNoteTableView` extends it by wrapping it in a
|
|
3559
|
+
// `blockContent` element, so the DOM structure is consistent with other block
|
|
3560
|
+
// types.
|
|
3561
|
+
addNodeView() {
|
|
3562
|
+
return ({ node: e, HTMLAttributes: t }) => {
|
|
3563
|
+
var o;
|
|
3564
|
+
class n extends bt {
|
|
3565
|
+
constructor(s, a, i) {
|
|
3566
|
+
super(s, a), this.node = s, this.cellMinWidth = a, this.blockContentHTMLAttributes = i;
|
|
3567
|
+
const c = document.createElement("div");
|
|
3568
|
+
c.className = U(
|
|
3569
|
+
"bn-block-content",
|
|
3570
|
+
i.class
|
|
3571
|
+
), c.setAttribute("data-content-type", "table");
|
|
3572
|
+
for (const [p, f] of Object.entries(
|
|
3573
|
+
i
|
|
3574
|
+
))
|
|
3575
|
+
p !== "class" && c.setAttribute(p, f);
|
|
3576
|
+
const l = this.dom, d = document.createElement("div");
|
|
3577
|
+
d.className = "tableWrapper-inner", d.appendChild(l.firstChild), l.appendChild(d), c.appendChild(l);
|
|
3578
|
+
const u = document.createElement("div");
|
|
3579
|
+
u.className = "table-widgets-container", u.style.position = "relative", l.appendChild(u), this.dom = c;
|
|
3580
|
+
}
|
|
3581
|
+
ignoreMutation(s) {
|
|
3582
|
+
return !s.target.closest(".tableWrapper-inner") || super.ignoreMutation(s);
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
return new n(e, ct, {
|
|
3586
|
+
...((o = this.options.domAttributes) == null ? void 0 : o.blockContent) || {},
|
|
3587
|
+
...t
|
|
3588
|
+
});
|
|
3589
|
+
};
|
|
3590
|
+
}
|
|
3591
|
+
}), io = D.create({
|
|
3592
|
+
name: "tableParagraph",
|
|
3593
|
+
group: "tableContent",
|
|
3594
|
+
content: "inline*",
|
|
3595
|
+
parseHTML() {
|
|
3596
|
+
return [
|
|
3597
|
+
{
|
|
3598
|
+
tag: "p",
|
|
3599
|
+
getAttrs: (e) => {
|
|
3600
|
+
if (typeof e == "string" || !e.textContent || !e.closest("[data-content-type]"))
|
|
3601
|
+
return !1;
|
|
3602
|
+
const t = e.parentElement;
|
|
3603
|
+
return t === null ? !1 : t.tagName === "TD" || t.tagName === "TH" ? {} : !1;
|
|
3604
|
+
},
|
|
3605
|
+
node: "tableParagraph"
|
|
3606
|
+
}
|
|
3607
|
+
];
|
|
3608
|
+
},
|
|
3609
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
3610
|
+
return ["p", e, 0];
|
|
3611
|
+
}
|
|
3612
|
+
}), co = D.create({
|
|
3613
|
+
name: "tableRow",
|
|
3614
|
+
addOptions() {
|
|
3615
|
+
return {
|
|
3616
|
+
HTMLAttributes: {}
|
|
3617
|
+
};
|
|
3618
|
+
},
|
|
3619
|
+
content: "(tableCell | tableHeader)+",
|
|
3620
|
+
tableRole: "row",
|
|
3621
|
+
marks: "deletion insertion modification",
|
|
3622
|
+
parseHTML() {
|
|
3623
|
+
return [{ tag: "tr" }];
|
|
3624
|
+
},
|
|
3625
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
3626
|
+
return [
|
|
3627
|
+
"tr",
|
|
3628
|
+
ue(this.options.HTMLAttributes, e),
|
|
3629
|
+
0
|
|
3630
|
+
];
|
|
3631
|
+
}
|
|
3632
|
+
});
|
|
3633
|
+
function lt(e, t) {
|
|
3634
|
+
const o = Q.fromSchema(t).parse(e, {
|
|
3635
|
+
topNode: t.nodes.blockGroup.create()
|
|
3636
|
+
}), r = [];
|
|
3637
|
+
return o.content.descendants((s) => {
|
|
3638
|
+
if (s.isInline)
|
|
3639
|
+
return r.push(s), !1;
|
|
3640
|
+
}), _.fromArray(r);
|
|
3641
|
+
}
|
|
3642
|
+
const lo = () => jt(
|
|
3643
|
+
{ node: ao, type: "table", content: "table" },
|
|
3644
|
+
oo,
|
|
3645
|
+
[
|
|
3646
|
+
L({
|
|
3647
|
+
key: "table-extensions",
|
|
3648
|
+
tiptapExtensions: [
|
|
3649
|
+
no,
|
|
3650
|
+
io,
|
|
3651
|
+
ro,
|
|
3652
|
+
so,
|
|
3653
|
+
co
|
|
3654
|
+
]
|
|
3655
|
+
})
|
|
3656
|
+
]
|
|
3657
|
+
), Ve = (e) => {
|
|
3658
|
+
const t = e.src || void 0, n = e.width || void 0;
|
|
3659
|
+
return { url: t, previewWidth: n };
|
|
3660
|
+
}, uo = '<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>', po = (e) => ({
|
|
3661
|
+
type: "video",
|
|
3662
|
+
propSchema: {
|
|
3663
|
+
textAlignment: k.textAlignment,
|
|
3664
|
+
backgroundColor: k.backgroundColor,
|
|
3665
|
+
name: { default: "" },
|
|
3666
|
+
url: { default: "" },
|
|
3667
|
+
caption: { default: "" },
|
|
3668
|
+
showPreview: { default: !0 },
|
|
3669
|
+
previewWidth: { default: void 0, type: "number" }
|
|
3670
|
+
},
|
|
3671
|
+
content: "none"
|
|
3672
|
+
}), fo = (e) => (t) => {
|
|
3673
|
+
if (t.tagName === "VIDEO") {
|
|
3674
|
+
if (t.closest("figure"))
|
|
3675
|
+
return;
|
|
3676
|
+
const { backgroundColor: n } = B(t);
|
|
3677
|
+
return {
|
|
3678
|
+
...Ve(t),
|
|
3679
|
+
backgroundColor: n
|
|
3680
|
+
};
|
|
3681
|
+
}
|
|
3682
|
+
if (t.tagName === "FIGURE") {
|
|
3683
|
+
const n = ee(t, "video");
|
|
3684
|
+
if (!n)
|
|
3685
|
+
return;
|
|
3686
|
+
const { targetElement: o, caption: r } = n, { backgroundColor: s } = B(t);
|
|
3687
|
+
return {
|
|
3688
|
+
...Ve(o),
|
|
3689
|
+
backgroundColor: s,
|
|
3690
|
+
caption: r
|
|
3691
|
+
};
|
|
3692
|
+
}
|
|
3693
|
+
}, ho = M(
|
|
3694
|
+
po,
|
|
3695
|
+
(e) => ({
|
|
3696
|
+
meta: {
|
|
3697
|
+
fileBlockAccept: ["video/*"]
|
|
3698
|
+
},
|
|
3699
|
+
parse: fo(),
|
|
3700
|
+
render(t, n) {
|
|
3701
|
+
const o = document.createElement("div");
|
|
3702
|
+
o.innerHTML = e.icon ?? uo;
|
|
3703
|
+
const r = document.createElement("div");
|
|
3704
|
+
r.className = "bn-visual-media-wrapper";
|
|
3705
|
+
const s = document.createElement("video");
|
|
3706
|
+
return s.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((a) => {
|
|
3707
|
+
s.src = a;
|
|
3708
|
+
}) : s.src = t.props.url, s.controls = !0, s.contentEditable = "false", s.draggable = !1, s.width = t.props.previewWidth, r.appendChild(s), st(
|
|
3709
|
+
t,
|
|
3710
|
+
n,
|
|
3711
|
+
{ dom: r },
|
|
3712
|
+
r,
|
|
3713
|
+
o.firstElementChild
|
|
3714
|
+
);
|
|
3715
|
+
},
|
|
3716
|
+
toExternalHTML(t) {
|
|
3717
|
+
if (!t.props.url) {
|
|
3718
|
+
const o = document.createElement("p");
|
|
3719
|
+
return o.textContent = "Add video", {
|
|
3720
|
+
dom: o
|
|
3721
|
+
};
|
|
3722
|
+
}
|
|
3723
|
+
let n;
|
|
3724
|
+
return t.props.showPreview ? (n = document.createElement("video"), n.src = t.props.url, t.props.previewWidth && (n.width = t.props.previewWidth)) : (n = document.createElement("a"), n.href = t.props.url, n.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? ve(n, t.props.caption) : te(n, t.props.caption) : {
|
|
3725
|
+
dom: n
|
|
3726
|
+
};
|
|
3727
|
+
},
|
|
3728
|
+
runsBefore: ["file"]
|
|
3729
|
+
})
|
|
3730
|
+
), cr = async (e) => {
|
|
3731
|
+
const t = new FormData();
|
|
3732
|
+
return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
3733
|
+
method: "POST",
|
|
3734
|
+
body: t
|
|
3735
|
+
})).json()).data.url.replace(
|
|
3736
|
+
"tmpfiles.org/",
|
|
3737
|
+
"tmpfiles.org/dl/"
|
|
3738
|
+
);
|
|
3739
|
+
};
|
|
3740
|
+
function E(e, t, n) {
|
|
3741
|
+
if (!(t in e.schema.blockSpecs))
|
|
3742
|
+
return !1;
|
|
3743
|
+
if (!n)
|
|
3744
|
+
return !0;
|
|
3745
|
+
for (const [o, r] of Object.entries(n)) {
|
|
3746
|
+
if (!(o in e.schema.blockSpecs[t].config.propSchema))
|
|
3747
|
+
return !1;
|
|
3748
|
+
if (typeof r == "string") {
|
|
3749
|
+
if (e.schema.blockSpecs[t].config.propSchema[o].default && typeof e.schema.blockSpecs[t].config.propSchema[o].default !== r || e.schema.blockSpecs[t].config.propSchema[o].type && e.schema.blockSpecs[t].config.propSchema[o].type !== r)
|
|
3750
|
+
return !1;
|
|
3751
|
+
} else {
|
|
3752
|
+
if (e.schema.blockSpecs[t].config.propSchema[o].default !== r.default || e.schema.blockSpecs[t].config.propSchema[o].default === void 0 && r.default === void 0 && e.schema.blockSpecs[t].config.propSchema[o].type !== r.type || typeof e.schema.blockSpecs[t].config.propSchema[o].values != typeof r.values)
|
|
3753
|
+
return !1;
|
|
3754
|
+
if (typeof e.schema.blockSpecs[t].config.propSchema[o].values == "object" && typeof r.values == "object") {
|
|
3755
|
+
if (e.schema.blockSpecs[t].config.propSchema[o].values.length !== r.values.length)
|
|
3756
|
+
return !1;
|
|
3757
|
+
for (let s = 0; s < e.schema.blockSpecs[t].config.propSchema[o].values.length; s++)
|
|
3758
|
+
if (e.schema.blockSpecs[t].config.propSchema[o].values[s] !== r.values[s])
|
|
3759
|
+
return !1;
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
}
|
|
3763
|
+
return !0;
|
|
3764
|
+
}
|
|
3765
|
+
function lr(e, t, n, o) {
|
|
3766
|
+
return E(t, n, o) && e.type === n;
|
|
3767
|
+
}
|
|
3768
|
+
function ur(e) {
|
|
3769
|
+
return e instanceof Ct;
|
|
3770
|
+
}
|
|
3771
|
+
function mo(e) {
|
|
3772
|
+
let t = e.getTextCursorPosition().block, n = e.schema.blockSchema[t.type].content;
|
|
3773
|
+
for (; n === "none"; ) {
|
|
3774
|
+
if (t = e.getTextCursorPosition().nextBlock, t === void 0)
|
|
3775
|
+
return;
|
|
3776
|
+
n = e.schema.blockSchema[t.type].content, e.setTextCursorPosition(t, "end");
|
|
3777
|
+
}
|
|
3778
|
+
}
|
|
3779
|
+
function v(e, t) {
|
|
3780
|
+
const n = e.getTextCursorPosition().block;
|
|
3781
|
+
if (n.content === void 0)
|
|
3782
|
+
throw new Error("Slash Menu open in a block that doesn't contain content.");
|
|
3783
|
+
let o;
|
|
3784
|
+
return Array.isArray(n.content) && (n.content.length === 1 && I(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (o = e.updateBlock(n, t), e.setTextCursorPosition(o)) : (o = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)), mo(e), o;
|
|
3785
|
+
}
|
|
3786
|
+
function dr(e) {
|
|
3787
|
+
const t = [];
|
|
3788
|
+
return E(e, "heading", { level: "number" }) && t.push(
|
|
3789
|
+
{
|
|
3790
|
+
onItemClick: () => {
|
|
3791
|
+
v(e, {
|
|
3792
|
+
type: "heading",
|
|
3793
|
+
props: { level: 1 }
|
|
3794
|
+
});
|
|
3795
|
+
},
|
|
3796
|
+
badge: T("Mod-Alt-1"),
|
|
3797
|
+
key: "heading",
|
|
3798
|
+
...e.dictionary.slash_menu.heading
|
|
3799
|
+
},
|
|
3800
|
+
{
|
|
3801
|
+
onItemClick: () => {
|
|
3802
|
+
v(e, {
|
|
3803
|
+
type: "heading",
|
|
3804
|
+
props: { level: 2 }
|
|
3805
|
+
});
|
|
3806
|
+
},
|
|
3807
|
+
badge: T("Mod-Alt-2"),
|
|
3808
|
+
key: "heading_2",
|
|
3809
|
+
...e.dictionary.slash_menu.heading_2
|
|
3810
|
+
},
|
|
3811
|
+
{
|
|
3812
|
+
onItemClick: () => {
|
|
3813
|
+
v(e, {
|
|
3814
|
+
type: "heading",
|
|
3815
|
+
props: { level: 3 }
|
|
3816
|
+
});
|
|
3817
|
+
},
|
|
3818
|
+
badge: T("Mod-Alt-3"),
|
|
3819
|
+
key: "heading_3",
|
|
3820
|
+
...e.dictionary.slash_menu.heading_3
|
|
3821
|
+
}
|
|
3822
|
+
), E(e, "quote") && t.push({
|
|
3823
|
+
onItemClick: () => {
|
|
3824
|
+
v(e, {
|
|
3825
|
+
type: "quote"
|
|
3826
|
+
});
|
|
3827
|
+
},
|
|
3828
|
+
key: "quote",
|
|
3829
|
+
...e.dictionary.slash_menu.quote
|
|
3830
|
+
}), E(e, "toggleListItem") && t.push({
|
|
3831
|
+
onItemClick: () => {
|
|
3832
|
+
v(e, {
|
|
3833
|
+
type: "toggleListItem"
|
|
3834
|
+
});
|
|
3835
|
+
},
|
|
3836
|
+
badge: T("Mod-Shift-6"),
|
|
3837
|
+
key: "toggle_list",
|
|
3838
|
+
...e.dictionary.slash_menu.toggle_list
|
|
3839
|
+
}), E(e, "numberedListItem") && t.push({
|
|
3840
|
+
onItemClick: () => {
|
|
3841
|
+
v(e, {
|
|
3842
|
+
type: "numberedListItem"
|
|
3843
|
+
});
|
|
3844
|
+
},
|
|
3845
|
+
badge: T("Mod-Shift-7"),
|
|
3846
|
+
key: "numbered_list",
|
|
3847
|
+
...e.dictionary.slash_menu.numbered_list
|
|
3848
|
+
}), E(e, "bulletListItem") && t.push({
|
|
3849
|
+
onItemClick: () => {
|
|
3850
|
+
v(e, {
|
|
3851
|
+
type: "bulletListItem"
|
|
3852
|
+
});
|
|
3853
|
+
},
|
|
3854
|
+
badge: T("Mod-Shift-8"),
|
|
3855
|
+
key: "bullet_list",
|
|
3856
|
+
...e.dictionary.slash_menu.bullet_list
|
|
3857
|
+
}), E(e, "checkListItem") && t.push({
|
|
3858
|
+
onItemClick: () => {
|
|
3859
|
+
v(e, {
|
|
3860
|
+
type: "checkListItem"
|
|
3861
|
+
});
|
|
3862
|
+
},
|
|
3863
|
+
badge: T("Mod-Shift-9"),
|
|
3864
|
+
key: "check_list",
|
|
3865
|
+
...e.dictionary.slash_menu.check_list
|
|
3866
|
+
}), E(e, "paragraph") && t.push({
|
|
3867
|
+
onItemClick: () => {
|
|
3868
|
+
v(e, {
|
|
3869
|
+
type: "paragraph"
|
|
3870
|
+
});
|
|
3871
|
+
},
|
|
3872
|
+
badge: T("Mod-Alt-0"),
|
|
3873
|
+
key: "paragraph",
|
|
3874
|
+
...e.dictionary.slash_menu.paragraph
|
|
3875
|
+
}), E(e, "codeBlock") && t.push({
|
|
3876
|
+
onItemClick: () => {
|
|
3877
|
+
v(e, {
|
|
3878
|
+
type: "codeBlock"
|
|
3879
|
+
});
|
|
3880
|
+
},
|
|
3881
|
+
badge: T("Mod-Alt-c"),
|
|
3882
|
+
key: "code_block",
|
|
3883
|
+
...e.dictionary.slash_menu.code_block
|
|
3884
|
+
}), E(e, "table") && t.push({
|
|
3885
|
+
onItemClick: () => {
|
|
3886
|
+
v(e, {
|
|
3887
|
+
type: "table",
|
|
3888
|
+
content: {
|
|
3889
|
+
type: "tableContent",
|
|
3890
|
+
rows: [
|
|
3891
|
+
{
|
|
3892
|
+
cells: ["", "", ""]
|
|
3893
|
+
},
|
|
3894
|
+
{
|
|
3895
|
+
cells: ["", "", ""]
|
|
3896
|
+
}
|
|
3897
|
+
]
|
|
3898
|
+
}
|
|
3899
|
+
});
|
|
3900
|
+
},
|
|
3901
|
+
badge: void 0,
|
|
3902
|
+
key: "table",
|
|
3903
|
+
...e.dictionary.slash_menu.table
|
|
3904
|
+
}), E(e, "image", { url: "string" }) && t.push({
|
|
3905
|
+
onItemClick: () => {
|
|
3906
|
+
const n = v(e, {
|
|
3907
|
+
type: "image"
|
|
3908
|
+
});
|
|
3909
|
+
e.transact(
|
|
3910
|
+
(o) => o.setMeta(e.filePanel.plugins[0], {
|
|
3911
|
+
block: n
|
|
3912
|
+
})
|
|
3913
|
+
);
|
|
3914
|
+
},
|
|
3915
|
+
key: "image",
|
|
3916
|
+
...e.dictionary.slash_menu.image
|
|
3917
|
+
}), E(e, "video", { url: "string" }) && t.push({
|
|
3918
|
+
onItemClick: () => {
|
|
3919
|
+
const n = v(e, {
|
|
3920
|
+
type: "video"
|
|
3921
|
+
});
|
|
3922
|
+
e.transact(
|
|
3923
|
+
(o) => o.setMeta(e.filePanel.plugins[0], {
|
|
3924
|
+
block: n
|
|
3925
|
+
})
|
|
3926
|
+
);
|
|
3927
|
+
},
|
|
3928
|
+
key: "video",
|
|
3929
|
+
...e.dictionary.slash_menu.video
|
|
3930
|
+
}), E(e, "audio", { url: "string" }) && t.push({
|
|
3931
|
+
onItemClick: () => {
|
|
3932
|
+
const n = v(e, {
|
|
3933
|
+
type: "audio"
|
|
3934
|
+
});
|
|
3935
|
+
e.transact(
|
|
3936
|
+
(o) => o.setMeta(e.filePanel.plugins[0], {
|
|
3937
|
+
block: n
|
|
3938
|
+
})
|
|
3939
|
+
);
|
|
3940
|
+
},
|
|
3941
|
+
key: "audio",
|
|
3942
|
+
...e.dictionary.slash_menu.audio
|
|
3943
|
+
}), E(e, "file", { url: "string" }) && t.push({
|
|
3944
|
+
onItemClick: () => {
|
|
3945
|
+
const n = v(e, {
|
|
3946
|
+
type: "file"
|
|
3947
|
+
});
|
|
3948
|
+
e.transact(
|
|
3949
|
+
(o) => o.setMeta(e.filePanel.plugins[0], {
|
|
3950
|
+
block: n
|
|
3951
|
+
})
|
|
3952
|
+
);
|
|
3953
|
+
},
|
|
3954
|
+
key: "file",
|
|
3955
|
+
...e.dictionary.slash_menu.file
|
|
3956
|
+
}), E(e, "heading", {
|
|
3957
|
+
level: "number",
|
|
3958
|
+
isToggleable: "boolean"
|
|
3959
|
+
}) && t.push(
|
|
3960
|
+
{
|
|
3961
|
+
onItemClick: () => {
|
|
3962
|
+
v(e, {
|
|
3963
|
+
type: "heading",
|
|
3964
|
+
props: { level: 1, isToggleable: !0 }
|
|
3965
|
+
});
|
|
3966
|
+
},
|
|
3967
|
+
key: "toggle_heading",
|
|
3968
|
+
...e.dictionary.slash_menu.toggle_heading
|
|
3969
|
+
},
|
|
3970
|
+
{
|
|
3971
|
+
onItemClick: () => {
|
|
3972
|
+
v(e, {
|
|
3973
|
+
type: "heading",
|
|
3974
|
+
props: { level: 2, isToggleable: !0 }
|
|
3975
|
+
});
|
|
3976
|
+
},
|
|
3977
|
+
key: "toggle_heading_2",
|
|
3978
|
+
...e.dictionary.slash_menu.toggle_heading_2
|
|
3979
|
+
},
|
|
3980
|
+
{
|
|
3981
|
+
onItemClick: () => {
|
|
3982
|
+
v(e, {
|
|
3983
|
+
type: "heading",
|
|
3984
|
+
props: { level: 3, isToggleable: !0 }
|
|
3985
|
+
});
|
|
3986
|
+
},
|
|
3987
|
+
key: "toggle_heading_3",
|
|
3988
|
+
...e.dictionary.slash_menu.toggle_heading_3
|
|
3989
|
+
}
|
|
3990
|
+
), E(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((n) => n > 3).forEach((n) => {
|
|
3991
|
+
t.push({
|
|
3992
|
+
onItemClick: () => {
|
|
3993
|
+
v(e, {
|
|
3994
|
+
type: "heading",
|
|
3995
|
+
props: { level: n }
|
|
3996
|
+
});
|
|
3997
|
+
},
|
|
3998
|
+
key: `heading_${n}`,
|
|
3999
|
+
...e.dictionary.slash_menu[`heading_${n}`]
|
|
4000
|
+
});
|
|
4001
|
+
}), t.push({
|
|
4002
|
+
onItemClick: () => {
|
|
4003
|
+
e.openSuggestionMenu(":", {
|
|
4004
|
+
deleteTriggerCharacter: !0,
|
|
4005
|
+
ignoreQueryLength: !0
|
|
4006
|
+
});
|
|
4007
|
+
},
|
|
4008
|
+
key: "emoji",
|
|
4009
|
+
...e.dictionary.slash_menu.emoji
|
|
4010
|
+
}), t;
|
|
4011
|
+
}
|
|
4012
|
+
function pr(e, t) {
|
|
4013
|
+
return e.filter(
|
|
4014
|
+
({ title: n, aliases: o }) => n.toLowerCase().includes(t.toLowerCase()) || o && o.filter(
|
|
4015
|
+
(r) => r.toLowerCase().includes(t.toLowerCase())
|
|
4016
|
+
).length !== 0
|
|
4017
|
+
);
|
|
4018
|
+
}
|
|
4019
|
+
function go(e) {
|
|
4020
|
+
return "pageBreak" in e.schema.blockSchema;
|
|
4021
|
+
}
|
|
4022
|
+
function fr(e) {
|
|
4023
|
+
const t = [];
|
|
4024
|
+
return go(e) && t.push({
|
|
4025
|
+
...e.dictionary.slash_menu.page_break,
|
|
4026
|
+
onItemClick: () => {
|
|
4027
|
+
v(e, {
|
|
4028
|
+
type: "pageBreak"
|
|
4029
|
+
});
|
|
4030
|
+
},
|
|
4031
|
+
key: "page_break"
|
|
4032
|
+
}), t;
|
|
4033
|
+
}
|
|
4034
|
+
const bo = {
|
|
4035
|
+
audio: vn(),
|
|
4036
|
+
bulletListItem: Fn(),
|
|
4037
|
+
checkListItem: $n(),
|
|
4038
|
+
codeBlock: Mn(),
|
|
4039
|
+
file: An(),
|
|
4040
|
+
heading: Hn(),
|
|
4041
|
+
image: Vn(),
|
|
4042
|
+
numberedListItem: qn(),
|
|
4043
|
+
paragraph: Qn(),
|
|
4044
|
+
quote: eo(),
|
|
4045
|
+
table: lo(),
|
|
4046
|
+
toggleListItem: Gn(),
|
|
4047
|
+
video: ho()
|
|
4048
|
+
}, Co = Ke(
|
|
4049
|
+
{
|
|
4050
|
+
type: "textColor",
|
|
4051
|
+
propSchema: "string"
|
|
4052
|
+
},
|
|
4053
|
+
{
|
|
4054
|
+
render: () => {
|
|
4055
|
+
const e = document.createElement("span");
|
|
4056
|
+
return {
|
|
4057
|
+
dom: e,
|
|
4058
|
+
contentDOM: e
|
|
4059
|
+
};
|
|
4060
|
+
},
|
|
4061
|
+
toExternalHTML: (e) => {
|
|
4062
|
+
const t = document.createElement("span");
|
|
4063
|
+
return e !== k.textColor.default && (t.style.color = e in A ? A[e].text : e), {
|
|
4064
|
+
dom: t,
|
|
4065
|
+
contentDOM: t
|
|
4066
|
+
};
|
|
4067
|
+
},
|
|
4068
|
+
parse: (e) => {
|
|
4069
|
+
if (e.tagName === "SPAN" && e.style.color)
|
|
4070
|
+
return e.style.color;
|
|
4071
|
+
}
|
|
4072
|
+
}
|
|
4073
|
+
), ko = Ke(
|
|
4074
|
+
{
|
|
4075
|
+
type: "backgroundColor",
|
|
4076
|
+
propSchema: "string"
|
|
4077
|
+
},
|
|
4078
|
+
{
|
|
4079
|
+
render: () => {
|
|
4080
|
+
const e = document.createElement("span");
|
|
4081
|
+
return {
|
|
4082
|
+
dom: e,
|
|
4083
|
+
contentDOM: e
|
|
4084
|
+
};
|
|
4085
|
+
},
|
|
4086
|
+
toExternalHTML: (e) => {
|
|
4087
|
+
const t = document.createElement("span");
|
|
4088
|
+
return e !== k.backgroundColor.default && (t.style.backgroundColor = e in A ? A[e].background : e), {
|
|
4089
|
+
dom: t,
|
|
4090
|
+
contentDOM: t
|
|
4091
|
+
};
|
|
4092
|
+
},
|
|
4093
|
+
parse: (e) => {
|
|
4094
|
+
if (e.tagName === "SPAN" && e.style.backgroundColor)
|
|
4095
|
+
return e.style.backgroundColor;
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4098
|
+
), ut = {
|
|
4099
|
+
bold: F(kt, "boolean"),
|
|
4100
|
+
italic: F(wt, "boolean"),
|
|
4101
|
+
underline: F(Et, "boolean"),
|
|
4102
|
+
strike: F(vt, "boolean"),
|
|
4103
|
+
code: F(yt, "boolean"),
|
|
4104
|
+
textColor: Co,
|
|
4105
|
+
backgroundColor: ko
|
|
4106
|
+
}, hr = Je(ut), dt = {
|
|
4107
|
+
text: { config: "text", implementation: {} },
|
|
4108
|
+
link: { config: "link", implementation: {} }
|
|
4109
|
+
}, mr = Ge(
|
|
4110
|
+
dt
|
|
4111
|
+
);
|
|
4112
|
+
class pt extends rn {
|
|
4113
|
+
static create(t) {
|
|
4114
|
+
return new pt({
|
|
4115
|
+
blockSpecs: (t == null ? void 0 : t.blockSpecs) ?? bo,
|
|
4116
|
+
inlineContentSpecs: (t == null ? void 0 : t.inlineContentSpecs) ?? dt,
|
|
4117
|
+
styleSpecs: (t == null ? void 0 : t.styleSpecs) ?? ut
|
|
4118
|
+
});
|
|
4119
|
+
}
|
|
4120
|
+
}
|
|
4121
|
+
export {
|
|
4122
|
+
bo as $,
|
|
4123
|
+
qn as A,
|
|
4124
|
+
Zn as B,
|
|
4125
|
+
Gn as C,
|
|
4126
|
+
Xn as D,
|
|
4127
|
+
ir as E,
|
|
4128
|
+
bn as F,
|
|
4129
|
+
Jn as G,
|
|
4130
|
+
ar as H,
|
|
4131
|
+
Kn as I,
|
|
4132
|
+
Qn as J,
|
|
4133
|
+
Yn as K,
|
|
4134
|
+
eo as L,
|
|
4135
|
+
oo as M,
|
|
4136
|
+
lo as N,
|
|
4137
|
+
uo as O,
|
|
4138
|
+
po as P,
|
|
4139
|
+
fo as Q,
|
|
4140
|
+
ho as R,
|
|
4141
|
+
Nn as S,
|
|
4142
|
+
ot as T,
|
|
4143
|
+
cr as U,
|
|
4144
|
+
go as V,
|
|
4145
|
+
fr as W,
|
|
4146
|
+
pt as X,
|
|
4147
|
+
Rt as Y,
|
|
4148
|
+
Te as Z,
|
|
4149
|
+
Vt as _,
|
|
4150
|
+
ct as a,
|
|
4151
|
+
tr as a$,
|
|
4152
|
+
ut as a0,
|
|
4153
|
+
hr as a1,
|
|
4154
|
+
dt as a2,
|
|
4155
|
+
mr as a3,
|
|
4156
|
+
E as a4,
|
|
4157
|
+
lr as a5,
|
|
4158
|
+
ur as a6,
|
|
4159
|
+
k as a7,
|
|
4160
|
+
B as a8,
|
|
4161
|
+
P as a9,
|
|
4162
|
+
Wo as aA,
|
|
4163
|
+
sr as aB,
|
|
4164
|
+
Yo as aC,
|
|
4165
|
+
Jo as aD,
|
|
4166
|
+
Zo as aE,
|
|
4167
|
+
Ko as aF,
|
|
4168
|
+
qo as aG,
|
|
4169
|
+
Qe as aH,
|
|
4170
|
+
sn as aI,
|
|
4171
|
+
an as aJ,
|
|
4172
|
+
Qo as aK,
|
|
4173
|
+
Go as aL,
|
|
4174
|
+
Xo as aM,
|
|
4175
|
+
U as aN,
|
|
4176
|
+
ze as aO,
|
|
4177
|
+
ye as aP,
|
|
4178
|
+
Fo as aQ,
|
|
4179
|
+
er as aR,
|
|
4180
|
+
Do as aS,
|
|
4181
|
+
pn as aT,
|
|
4182
|
+
he as aU,
|
|
4183
|
+
ge as aV,
|
|
4184
|
+
be as aW,
|
|
4185
|
+
R as aX,
|
|
4186
|
+
Ce as aY,
|
|
4187
|
+
L as aZ,
|
|
4188
|
+
A as a_,
|
|
4189
|
+
nr as aa,
|
|
4190
|
+
or as ab,
|
|
4191
|
+
rr as ac,
|
|
4192
|
+
Xt as ad,
|
|
4193
|
+
O as ae,
|
|
4194
|
+
$o as af,
|
|
4195
|
+
Uo as ag,
|
|
4196
|
+
Wt as ah,
|
|
4197
|
+
zo as ai,
|
|
4198
|
+
G as aj,
|
|
4199
|
+
Y as ak,
|
|
4200
|
+
ln as al,
|
|
4201
|
+
X as am,
|
|
4202
|
+
et as an,
|
|
4203
|
+
Z as ao,
|
|
4204
|
+
un as ap,
|
|
4205
|
+
fe as aq,
|
|
4206
|
+
Zt as ar,
|
|
4207
|
+
jo as as,
|
|
4208
|
+
me as at,
|
|
4209
|
+
z as au,
|
|
4210
|
+
Gt as av,
|
|
4211
|
+
ke as aw,
|
|
4212
|
+
xn as ax,
|
|
4213
|
+
En as ay,
|
|
4214
|
+
qt as az,
|
|
4215
|
+
kn as b,
|
|
4216
|
+
v as b0,
|
|
4217
|
+
dr as b1,
|
|
4218
|
+
pr as b2,
|
|
4219
|
+
$t as b3,
|
|
4220
|
+
Ut as b4,
|
|
4221
|
+
zt as b5,
|
|
4222
|
+
Vo as b6,
|
|
4223
|
+
M as b7,
|
|
4224
|
+
Ft as b8,
|
|
4225
|
+
ie as b9,
|
|
4226
|
+
jt as ba,
|
|
4227
|
+
Jt as bb,
|
|
4228
|
+
Ge as bc,
|
|
4229
|
+
Le as bd,
|
|
4230
|
+
qe as be,
|
|
4231
|
+
I as bf,
|
|
4232
|
+
Qt as bg,
|
|
4233
|
+
Ke as bh,
|
|
4234
|
+
Kt as bi,
|
|
4235
|
+
J as bj,
|
|
4236
|
+
Xe as bk,
|
|
4237
|
+
F as bl,
|
|
4238
|
+
Je as bm,
|
|
4239
|
+
rn as bn,
|
|
4240
|
+
_t as bo,
|
|
4241
|
+
T as bp,
|
|
4242
|
+
_o as bq,
|
|
4243
|
+
K as br,
|
|
4244
|
+
Ro as bs,
|
|
4245
|
+
se as bt,
|
|
4246
|
+
j as bu,
|
|
4247
|
+
pe as bv,
|
|
4248
|
+
$ as bw,
|
|
4249
|
+
ae as bx,
|
|
4250
|
+
Cn as c,
|
|
4251
|
+
yn as d,
|
|
4252
|
+
wn as e,
|
|
4253
|
+
vn as f,
|
|
4254
|
+
Bn as g,
|
|
4255
|
+
Mn as h,
|
|
4256
|
+
nt as i,
|
|
4257
|
+
Ln as j,
|
|
4258
|
+
Tn as k,
|
|
4259
|
+
An as l,
|
|
4260
|
+
In as m,
|
|
4261
|
+
Hn as n,
|
|
4262
|
+
Pn as o,
|
|
4263
|
+
Pe as p,
|
|
4264
|
+
On as q,
|
|
4265
|
+
Dn as r,
|
|
4266
|
+
_n as s,
|
|
4267
|
+
Rn as t,
|
|
4268
|
+
Vn as u,
|
|
4269
|
+
Wn as v,
|
|
4270
|
+
Fn as w,
|
|
4271
|
+
jn as x,
|
|
4272
|
+
$n as y,
|
|
4273
|
+
zn as z
|
|
4274
|
+
};
|
|
4275
|
+
//# sourceMappingURL=BlockNoteSchema-oR047ACf.js.map
|