@blocknote/core 0.56.0 → 0.57.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/NOTICE.txt +101 -0
- package/dist/BlockNoteExtension-U58cXw1g.js +64 -0
- package/dist/ThreadStore-CSEwCO0O.js +8 -0
- package/dist/{UserStore-OZJP3K8T.js → UserStore-BFv6NXA-.js} +3 -7
- package/dist/ar-DPJDxCQI.js +3 -0
- package/dist/blocknote.js +8 -6
- package/dist/blocks-BUX9dXi9.js +2063 -0
- package/dist/blocks.js +3 -2
- package/dist/comments.js +8 -9
- package/dist/de-CakHBokE.js +3 -0
- package/dist/emoji-data.js +102 -0
- package/dist/en-BGdzE27X.js +3 -0
- package/dist/{en-Ch-vvt5e.js → en-Ne9rlj9Y.js} +9 -6
- package/dist/es-VeBX6MEG.js +3 -0
- package/dist/{extensions-BbM81hHa.js → extensions-CEgexSyF.js} +846 -824
- package/dist/extensions.js +4 -4
- package/dist/fa-Dt7EYtKf.js +3 -0
- package/dist/fr-DUhhjxrJ.js +3 -0
- package/dist/getDefaultSlashMenuItems-DfDOr807.js +1939 -0
- package/dist/he-BShJg1dK.js +3 -0
- package/dist/hr-BXtyqmwg.js +3 -0
- package/dist/is-2Fb-0w_j.js +3 -0
- package/dist/it-CiZtVb3Y.js +3 -0
- package/dist/ja-CsxD3kEL.js +3 -0
- package/dist/ko-It6g03Cy.js +3 -0
- package/dist/locales.js +692 -54
- package/dist/markGroups-BszXCkX8.js +18 -0
- package/dist/nb-CLao87La.js +3 -0
- package/dist/nl-JQSo8dht.js +3 -0
- package/dist/pl-DEMBgHEP.js +3 -0
- package/dist/pt-CBCdYAax.js +3 -0
- package/dist/ru-BQk_9Q-L.js +3 -0
- package/dist/sk-kgB2DtDL.js +3 -0
- package/dist/{src-BmLsLZfE.js → src-DksfoQmN.js} +1173 -1090
- package/dist/style.css +1 -1
- package/dist/tr-DkcSXX8f.js +3 -0
- package/dist/uk-Bib-e6bV.js +3 -0
- package/dist/uz-B2jaKhJb.js +3 -0
- package/dist/vi-V_GFRxE8.js +3 -0
- package/dist/y.js +356 -361
- package/dist/yjs.js +134 -135
- package/dist/zh-hant-2ZrAkFnC.js +3 -0
- package/dist/zh-jglyCmjs.js +3 -0
- package/package.json +45 -21
- package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.fixture.d.ts +5 -0
- package/types/src/api/blockManipulation/tables/tables.d.ts +9 -4
- package/types/src/api/clipboard/fromClipboard/normalizeOfficeHTML.d.ts +5 -0
- package/types/src/api/exporters/markdown/wrapWithDelimiter.d.ts +6 -0
- package/types/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.d.ts +4 -0
- package/types/src/blocks/defaultBlocks.d.ts +10 -0
- package/types/src/editor/BlockNoteEditor.d.ts +2 -1
- package/types/src/editor/managers/ExtensionManager/index.d.ts +4 -4
- package/types/src/editor/managers/StyleManager.d.ts +2 -1
- package/types/src/emoji-data/frimousse/ar.d.ts +2 -0
- package/types/src/emoji-data/frimousse/common.d.ts +3 -0
- package/types/src/emoji-data/frimousse/de.d.ts +2 -0
- package/types/src/emoji-data/frimousse/en.d.ts +2 -0
- package/types/src/emoji-data/frimousse/es.d.ts +2 -0
- package/types/src/emoji-data/frimousse/fa.d.ts +2 -0
- package/types/src/emoji-data/frimousse/fr.d.ts +2 -0
- package/types/src/emoji-data/frimousse/he.d.ts +2 -0
- package/types/src/emoji-data/frimousse/hr.d.ts +2 -0
- package/types/src/emoji-data/frimousse/is.d.ts +2 -0
- package/types/src/emoji-data/frimousse/it.d.ts +2 -0
- package/types/src/emoji-data/frimousse/ja.d.ts +2 -0
- package/types/src/emoji-data/frimousse/ko.d.ts +2 -0
- package/types/src/emoji-data/frimousse/loadFrimousseData.d.ts +2 -0
- package/types/src/emoji-data/frimousse/nb.d.ts +2 -0
- package/types/src/emoji-data/frimousse/nl.d.ts +2 -0
- package/types/src/emoji-data/frimousse/pl.d.ts +2 -0
- package/types/src/emoji-data/frimousse/pt.d.ts +2 -0
- package/types/src/emoji-data/frimousse/ru.d.ts +2 -0
- package/types/src/emoji-data/frimousse/sk.d.ts +2 -0
- package/types/src/emoji-data/frimousse/tr.d.ts +2 -0
- package/types/src/emoji-data/frimousse/types.d.ts +21 -0
- package/types/src/emoji-data/frimousse/uk.d.ts +2 -0
- package/types/src/emoji-data/frimousse/uz.d.ts +2 -0
- package/types/src/emoji-data/frimousse/vi.d.ts +2 -0
- package/types/src/emoji-data/frimousse/zh-hant.d.ts +2 -0
- package/types/src/emoji-data/frimousse/zh.d.ts +2 -0
- package/types/src/emoji-data/index.d.ts +3 -0
- package/types/src/emoji-data/searchEmojis.d.ts +5 -0
- package/types/src/extensions/Loading/Loading.d.ts +11 -0
- package/types/src/extensions/SideMenu/MultipleNodeSelection.d.ts +13 -4
- package/types/src/extensions/SideMenu/SideMenu.d.ts +2 -1
- package/types/src/extensions/Versioning/Versioning.d.ts +2 -0
- package/types/src/extensions/Versioning/inMemoryVersioning.d.ts +1 -0
- package/types/src/extensions/Versioning/types.d.ts +12 -6
- package/types/src/extensions/Versioning/versioningState.d.ts +6 -0
- package/types/src/extensions/index.d.ts +1 -2
- package/types/src/i18n/dictionary.d.ts +4 -1
- package/types/src/i18n/locales/en.d.ts +6 -0
- package/types/src/i18n/locales/fa.d.ts +6 -0
- package/types/src/i18n/locales/index.d.ts +1 -0
- package/types/src/i18n/locales/sk.d.ts +6 -0
- package/types/src/i18n/locales/tr.d.ts +378 -0
- package/types/src/index.d.ts +0 -1
- package/types/src/schema/inlineContent/createSpec.d.ts +2 -1
- package/types/src/schema/inlineContent/internal.d.ts +1 -1
- package/types/src/schema/inlineContent/types.d.ts +2 -4
- package/types/src/schema/styles/createSpec.d.ts +2 -1
- package/types/src/schema/styles/internal.d.ts +4 -1
- package/types/src/schema/styles/types.d.ts +2 -0
- package/types/src/y/extensions/YSync.d.ts +1 -1
- package/types/src/y/extensions/index.d.ts +1 -1
- package/types/src/y/versioning/yhub.d.ts +2 -0
- package/types/src/yjs/extensions/Versioning.d.ts +1 -0
- package/types/src/yjs/extensions/YUndo.d.ts +3 -2
- package/types/src/yjs/extensions/index.d.ts +1 -1
- package/dist/BlockNoteExtension-DjEkXkR5.cjs +0 -2
- package/dist/BlockNoteExtension-DjEkXkR5.cjs.map +0 -1
- package/dist/BlockNoteExtension-TsTGtIeX.js +0 -87
- package/dist/BlockNoteExtension-TsTGtIeX.js.map +0 -1
- package/dist/ThreadStore-Bx-gSEh1.cjs +0 -2
- package/dist/ThreadStore-Bx-gSEh1.cjs.map +0 -1
- package/dist/ThreadStore-et9wB5Xt.js +0 -11
- package/dist/ThreadStore-et9wB5Xt.js.map +0 -1
- package/dist/UserStore-CTVzVGh-.cjs +0 -2
- package/dist/UserStore-CTVzVGh-.cjs.map +0 -1
- package/dist/UserStore-OZJP3K8T.js.map +0 -1
- package/dist/blocknote.cjs +0 -1
- package/dist/blocks-COVwe5Cf.cjs +0 -12
- package/dist/blocks-COVwe5Cf.cjs.map +0 -1
- package/dist/blocks-COYcDVg7.js +0 -3943
- package/dist/blocks-COYcDVg7.js.map +0 -1
- package/dist/blocks.cjs +0 -1
- package/dist/comments.cjs +0 -2
- package/dist/comments.cjs.map +0 -1
- package/dist/comments.js.map +0 -1
- package/dist/en-Ch-vvt5e.js.map +0 -1
- package/dist/en-N5lu0-j8.cjs +0 -2
- package/dist/en-N5lu0-j8.cjs.map +0 -1
- package/dist/extensions-BbM81hHa.js.map +0 -1
- package/dist/extensions-D_WkAfSt.cjs +0 -58
- package/dist/extensions-D_WkAfSt.cjs.map +0 -1
- package/dist/extensions.cjs +0 -1
- package/dist/locales.cjs +0 -2
- package/dist/locales.cjs.map +0 -1
- package/dist/locales.js.map +0 -1
- package/dist/src-4OQT3z5S.cjs +0 -23
- package/dist/src-4OQT3z5S.cjs.map +0 -1
- package/dist/src-BmLsLZfE.js.map +0 -1
- package/dist/webpack-stats.json +0 -1
- package/dist/y.cjs +0 -2
- package/dist/y.cjs.map +0 -1
- package/dist/y.js.map +0 -1
- package/dist/yjs.cjs +0 -2
- package/dist/yjs.cjs.map +0 -1
- package/dist/yjs.js.map +0 -1
- package/src/api/README.md +0 -8
- package/src/api/__snapshots__/blocks-deleted-nested-deep.json +0 -26
- package/src/api/__snapshots__/blocks-deleted-nested.json +0 -68
- package/src/api/__snapshots__/blocks-deleted.json +0 -26
- package/src/api/__snapshots__/blocks-indented-changed.json +0 -129
- package/src/api/__snapshots__/blocks-inserted-nested.json +0 -62
- package/src/api/__snapshots__/blocks-inserted.json +0 -20
- package/src/api/__snapshots__/blocks-moved-deeper-into-nesting.json +0 -164
- package/src/api/__snapshots__/blocks-moved-down-twice-in-same-parent.json +0 -44
- package/src/api/__snapshots__/blocks-moved-insert-changes-sibling-order.json +0 -26
- package/src/api/__snapshots__/blocks-moved-multiple-in-same-transaction.json +0 -188
- package/src/api/__snapshots__/blocks-moved-nested-sibling-reorder.json +0 -180
- package/src/api/__snapshots__/blocks-moved-to-different-parent.json +0 -78
- package/src/api/__snapshots__/blocks-moved-to-root-level.json +0 -78
- package/src/api/__snapshots__/blocks-moved-up-down-in-same-parent.json +0 -44
- package/src/api/__snapshots__/blocks-moved-up-down-in-same-transaction.json +0 -44
- package/src/api/__snapshots__/blocks-outdented-changed.json +0 -129
- package/src/api/__snapshots__/blocks-updated-content-inserted.json +0 -42
- package/src/api/__snapshots__/blocks-updated-multiple-insert.json +0 -50
- package/src/api/__snapshots__/blocks-updated-multiple.json +0 -82
- package/src/api/__snapshots__/blocks-updated-nested-deep.json +0 -42
- package/src/api/__snapshots__/blocks-updated-nested-multiple.json +0 -118
- package/src/api/__snapshots__/blocks-updated-nested.json +0 -78
- package/src/api/__snapshots__/blocks-updated-single.json +0 -42
- package/src/api/__snapshots__/blocks-updated.json +0 -42
- package/src/api/blockManipulation/__snapshots__/transactions.test.ts.snap +0 -34
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +0 -4570
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +0 -176
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +0 -95
- package/src/api/blockManipulation/commands/insertBlocks/insertPlacement.test.ts +0 -217
- package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +0 -2761
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +0 -251
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +0 -187
- package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +0 -13625
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +0 -391
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +0 -350
- package/src/api/blockManipulation/commands/nestBlock/__snapshots__/nestBlock.test.ts.snap +0 -952
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.test.ts +0 -917
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +0 -248
- package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +0 -5710
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +0 -306
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +0 -143
- package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +0 -3507
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +0 -364
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +0 -90
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +0 -15085
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +0 -1210
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +0 -706
- package/src/api/blockManipulation/getBlock/getBlock.ts +0 -104
- package/src/api/blockManipulation/insertContentAt.ts +0 -83
- package/src/api/blockManipulation/layoutBlocks/fixLayoutBlock.ts +0 -173
- package/src/api/blockManipulation/layoutBlocks/layoutBlocks.browser.test.ts +0 -293
- package/src/api/blockManipulation/layoutBlocks/layoutBlocks.fixture.ts +0 -145
- package/src/api/blockManipulation/layoutBlocks/layoutBlocks.test.ts +0 -783
- package/src/api/blockManipulation/layoutBlocks/plainBlocks.test.ts +0 -180
- package/src/api/blockManipulation/layoutBlocks/titledBlocks.test.ts +0 -365
- package/src/api/blockManipulation/selections/selection.ts +0 -234
- package/src/api/blockManipulation/selections/textCursorPosition.ts +0 -63
- package/src/api/blockManipulation/setupTestEnv.ts +0 -223
- package/src/api/blockManipulation/tables/tables.test.ts +0 -2127
- package/src/api/blockManipulation/tables/tables.ts +0 -887
- package/src/api/clipboard/fromClipboard/acceptedMIMETypes.ts +0 -8
- package/src/api/clipboard/fromClipboard/fileDropExtension.ts +0 -55
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +0 -209
- package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +0 -38
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +0 -157
- package/src/api/clipboard/toClipboard/copyExtension.ts +0 -299
- package/src/api/combineTransactionSteps.ts +0 -22
- package/src/api/exporters/html/externalHTMLExporter.ts +0 -76
- package/src/api/exporters/html/internalHTMLSerializer.ts +0 -182
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +0 -510
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +0 -283
- package/src/api/exporters/markdown/htmlToMarkdown.ts +0 -895
- package/src/api/exporters/markdown/markdownExporter.ts +0 -41
- package/src/api/getBlockInfoFromPos.test.ts +0 -681
- package/src/api/getBlockInfoFromPos.ts +0 -693
- package/src/api/getBlocksChangedByTransaction.test.ts +0 -783
- package/src/api/getBlocksChangedByTransaction.ts +0 -458
- package/src/api/getChangedRangeWithAttrs.ts +0 -54
- package/src/api/getChangedRanges.test.ts +0 -391
- package/src/api/getChangedRanges.ts +0 -368
- package/src/api/nodeConversions/blockToNode.test.ts +0 -113
- package/src/api/nodeConversions/blockToNode.ts +0 -427
- package/src/api/nodeConversions/fragmentToBlocks.ts +0 -48
- package/src/api/nodeConversions/nodeToBlock.ts +0 -717
- package/src/api/nodeUtil.ts +0 -46
- package/src/api/parsers/html/parseHTML.ts +0 -80
- package/src/api/parsers/html/util/__snapshots__/nestedLists.test.ts.snap +0 -144
- package/src/api/parsers/html/util/nestedLists.test.ts +0 -165
- package/src/api/parsers/html/util/nestedLists.ts +0 -123
- package/src/api/parsers/html/util/normalizeWhitespace.ts +0 -87
- package/src/api/parsers/markdown/autolink.ts +0 -23
- package/src/api/parsers/markdown/detectMarkdown.test.ts +0 -211
- package/src/api/parsers/markdown/detectMarkdown.ts +0 -61
- package/src/api/parsers/markdown/markdownToHtml.ts +0 -1444
- package/src/api/parsers/markdown/parseMarkdown.ts +0 -24
- package/src/api/pmUtil.ts +0 -79
- package/src/api/positionMapping.test.ts +0 -209
- package/src/api/positionMapping.ts +0 -42
- package/src/blocks/Audio/block.ts +0 -171
- package/src/blocks/Audio/parseAudioElement.ts +0 -5
- package/src/blocks/BlockNoteSchema.ts +0 -59
- package/src/blocks/Code/CodeBlockOptions.ts +0 -83
- package/src/blocks/Code/block.test.ts +0 -265
- package/src/blocks/Code/block.ts +0 -56
- package/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.ts +0 -125
- package/src/blocks/Code/helpers/parse/parsePreCode.ts +0 -45
- package/src/blocks/Code/helpers/render/createCodeBlock.ts +0 -98
- package/src/blocks/Code/helpers/toExternalHTML/createPreCode.ts +0 -14
- package/src/blocks/Divider/block.ts +0 -49
- package/src/blocks/File/block.ts +0 -95
- package/src/blocks/File/helpers/parse/parseEmbedElement.ts +0 -5
- package/src/blocks/File/helpers/parse/parseFigureElement.ts +0 -16
- package/src/blocks/File/helpers/render/createAddFileButton.ts +0 -69
- package/src/blocks/File/helpers/render/createFileBlockWrapper.ts +0 -88
- package/src/blocks/File/helpers/render/createFileNameWithIcon.ts +0 -37
- package/src/blocks/File/helpers/render/createResizableFileBlockWrapper.ts +0 -271
- package/src/blocks/File/helpers/toExternalHTML/createFigureWithCaption.ts +0 -13
- package/src/blocks/File/helpers/toExternalHTML/createLinkWithCaption.ts +0 -15
- package/src/blocks/Heading/block.ts +0 -227
- package/src/blocks/Image/block.ts +0 -193
- package/src/blocks/Image/parseImageElement.ts +0 -7
- package/src/blocks/ListItem/BulletListItem/block.ts +0 -129
- package/src/blocks/ListItem/CheckListItem/block.test.ts +0 -61
- package/src/blocks/ListItem/CheckListItem/block.ts +0 -184
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.ts +0 -352
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +0 -239
- package/src/blocks/ListItem/NumberedListItem/block.ts +0 -143
- package/src/blocks/ListItem/ToggleListItem/block.ts +0 -139
- package/src/blocks/ListItem/getListItemContent.ts +0 -115
- package/src/blocks/PageBreak/block.ts +0 -72
- package/src/blocks/PageBreak/getPageBreakSlashMenuItems.ts +0 -47
- package/src/blocks/Paragraph/block.ts +0 -80
- package/src/blocks/Quote/block.ts +0 -99
- package/src/blocks/README.md +0 -3
- package/src/blocks/Table/TableExtension.test.ts +0 -231
- package/src/blocks/Table/TableExtension.ts +0 -115
- package/src/blocks/Table/block.ts +0 -492
- package/src/blocks/ToggleWrapper/createToggleFrame.ts +0 -126
- package/src/blocks/ToggleWrapper/toggleBlocks.browser.test.ts +0 -1056
- package/src/blocks/Video/block.ts +0 -142
- package/src/blocks/Video/parseVideoElement.ts +0 -7
- package/src/blocks/defaultBlockHelpers.ts +0 -113
- package/src/blocks/defaultBlockTypeGuards.ts +0 -167
- package/src/blocks/defaultBlockTypeItems.test.ts +0 -70
- package/src/blocks/defaultBlockTypeItems.ts +0 -99
- package/src/blocks/defaultBlocks.test.ts +0 -67
- package/src/blocks/defaultBlocks.ts +0 -214
- package/src/blocks/defaultProps.ts +0 -165
- package/src/blocks/getDetailsContent.ts +0 -77
- package/src/blocks/index.ts +0 -30
- package/src/comments/CommentEditorSubmitExtension.test.ts +0 -141
- package/src/comments/CommentEditorSubmitExtension.ts +0 -56
- package/src/comments/extension.ts +0 -396
- package/src/comments/index.ts +0 -8
- package/src/comments/mark.ts +0 -64
- package/src/comments/threadstore/DefaultThreadStoreAuth.ts +0 -106
- package/src/comments/threadstore/ThreadStore.ts +0 -130
- package/src/comments/threadstore/ThreadStoreAuth.ts +0 -13
- package/src/comments/threadstore/TipTapThreadStore.ts +0 -292
- package/src/comments/threadstore/tiptap/types.ts +0 -131
- package/src/comments/types.ts +0 -121
- package/src/editor/Block.css +0 -1498
- package/src/editor/BlockNoteEditor.node.test.ts +0 -35
- package/src/editor/BlockNoteEditor.test.ts +0 -278
- package/src/editor/BlockNoteEditor.ts +0 -1559
- package/src/editor/BlockNoteExtension.test.ts +0 -103
- package/src/editor/BlockNoteExtension.ts +0 -246
- package/src/editor/README.md +0 -3
- package/src/editor/blockColors.browser.test.ts +0 -127
- package/src/editor/cursorPositionTypes.ts +0 -17
- package/src/editor/defaultColors.ts +0 -77
- package/src/editor/editor.css +0 -257
- package/src/editor/managers/BlockManager.ts +0 -256
- package/src/editor/managers/EventManager.browser.test.ts +0 -334
- package/src/editor/managers/EventManager.ts +0 -260
- package/src/editor/managers/ExportManager.ts +0 -137
- package/src/editor/managers/ExtensionManager/ExtensionManager.browser.test.ts +0 -45
- package/src/editor/managers/ExtensionManager/ExtensionManager.node.test.ts +0 -209
- package/src/editor/managers/ExtensionManager/ExtensionManager.test.ts +0 -336
- package/src/editor/managers/ExtensionManager/extensions.ts +0 -200
- package/src/editor/managers/ExtensionManager/index.ts +0 -764
- package/src/editor/managers/ExtensionManager/symbol.ts +0 -5
- package/src/editor/managers/SelectionManager.ts +0 -120
- package/src/editor/managers/StateManager.ts +0 -261
- package/src/editor/managers/StyleManager.browser.test.ts +0 -122
- package/src/editor/managers/StyleManager.test.ts +0 -98
- package/src/editor/managers/StyleManager.ts +0 -278
- package/src/editor/managers/index.ts +0 -8
- package/src/editor/performance.test.ts +0 -192
- package/src/editor/selectionTypes.ts +0 -14
- package/src/editor/transformPasted.test.ts +0 -295
- package/src/editor/transformPasted.ts +0 -294
- package/src/exporter/ExportImage.ts +0 -50
- package/src/exporter/Exporter.test.ts +0 -255
- package/src/exporter/Exporter.ts +0 -185
- package/src/exporter/index.ts +0 -3
- package/src/exporter/mapping.ts +0 -110
- package/src/extensions/BlockChange/BlockChange.ts +0 -67
- package/src/extensions/DropCursor/DropCursor.ts +0 -376
- package/src/extensions/DropCursor/dropIntoChildren.ts +0 -80
- package/src/extensions/DropCursor/utils.ts +0 -195
- package/src/extensions/FilePanel/FilePanel.ts +0 -41
- package/src/extensions/FormattingToolbar/FormattingToolbar.ts +0 -157
- package/src/extensions/History/History.ts +0 -11
- package/src/extensions/InlineContentBoundaryEdit/InlineContentBoundaryEdit.ts +0 -109
- package/src/extensions/LinkToolbar/LinkToolbar.ts +0 -76
- package/src/extensions/LinkToolbar/protocols.ts +0 -13
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.test.ts +0 -190
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.ts +0 -112
- package/src/extensions/Placeholder/Placeholder.test.ts +0 -23
- package/src/extensions/Placeholder/Placeholder.ts +0 -150
- package/src/extensions/PositionMapping/PositionMapping.ts +0 -68
- package/src/extensions/PreviousBlockType/PreviousBlockType.test.ts +0 -156
- package/src/extensions/PreviousBlockType/PreviousBlockType.ts +0 -201
- package/src/extensions/README.md +0 -3
- package/src/extensions/ReadOnly/ReadOnly.test.ts +0 -181
- package/src/extensions/ReadOnly/ReadOnly.ts +0 -73
- package/src/extensions/ShowSelection/ShowSelection.ts +0 -61
- package/src/extensions/SideMenu/MultipleNodeSelection.ts +0 -89
- package/src/extensions/SideMenu/SideMenu.ts +0 -470
- package/src/extensions/SideMenu/blockDropHandling.ts +0 -372
- package/src/extensions/SideMenu/blockGeometry.browser.test.ts +0 -148
- package/src/extensions/SideMenu/blockGeometry.test.ts +0 -46
- package/src/extensions/SideMenu/blockGeometry.ts +0 -53
- package/src/extensions/SideMenu/dragging.ts +0 -200
- package/src/extensions/SideMenu/sideMenuHover.test.ts +0 -36
- package/src/extensions/SideMenu/sideMenuHover.ts +0 -270
- package/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.ts +0 -193
- package/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.ts +0 -142
- package/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.ts +0 -4
- package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +0 -11
- package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +0 -309
- package/src/extensions/SuggestionMenu/SuggestionMenu.ts +0 -436
- package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +0 -76
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +0 -299
- package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.ts +0 -130
- package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.ts +0 -89
- package/src/extensions/SyntaxHighlighting/inlineHighlight.test.ts +0 -135
- package/src/extensions/SyntaxHighlighting/shiki.ts +0 -116
- package/src/extensions/TableHandles/TableHandles.browser.test.ts +0 -307
- package/src/extensions/TableHandles/TableHandles.ts +0 -1263
- package/src/extensions/TrailingNode/TrailingNode.ts +0 -233
- package/src/extensions/Versioning/Versioning.browser.test.ts +0 -151
- package/src/extensions/Versioning/Versioning.node.test.ts +0 -177
- package/src/extensions/Versioning/Versioning.ts +0 -161
- package/src/extensions/Versioning/__test__/result.ts +0 -12
- package/src/extensions/Versioning/comparison.test.ts +0 -40
- package/src/extensions/Versioning/createVersioning.test.ts +0 -867
- package/src/extensions/Versioning/createVersioning.ts +0 -499
- package/src/extensions/Versioning/formatVersionDate.ts +0 -24
- package/src/extensions/Versioning/inMemoryVersioning.test.ts +0 -572
- package/src/extensions/Versioning/inMemoryVersioning.ts +0 -268
- package/src/extensions/Versioning/index.ts +0 -6
- package/src/extensions/Versioning/scrollScheduling.test.ts +0 -51
- package/src/extensions/Versioning/scrollToFirstChange.test.ts +0 -320
- package/src/extensions/Versioning/scrollToFirstChange.ts +0 -139
- package/src/extensions/Versioning/types.ts +0 -219
- package/src/extensions/Versioning/versioningState.ts +0 -154
- package/src/extensions/blockDOM.browser.test.ts +0 -102
- package/src/extensions/blockDOM.test.ts +0 -178
- package/src/extensions/blockDOM.ts +0 -135
- package/src/extensions/index.ts +0 -27
- package/src/extensions/tiptap-extensions/BackgroundColor/BackgroundColorExtension.ts +0 -17
- package/src/extensions/tiptap-extensions/HardBreak/HardBreak.ts +0 -35
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.ts +0 -1870
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +0 -1116
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/blockIdentity.browser.test.ts +0 -152
- package/src/extensions/tiptap-extensions/Link/helpers/autolink.ts +0 -174
- package/src/extensions/tiptap-extensions/Link/helpers/clickHandler.ts +0 -82
- package/src/extensions/tiptap-extensions/Link/helpers/linkDetector.ts +0 -412
- package/src/extensions/tiptap-extensions/Link/helpers/pasteHandler.ts +0 -53
- package/src/extensions/tiptap-extensions/Link/helpers/tlds.ts +0 -7
- package/src/extensions/tiptap-extensions/Link/helpers/whitespace.ts +0 -13
- package/src/extensions/tiptap-extensions/Link/index.ts +0 -2
- package/src/extensions/tiptap-extensions/Link/link.test.ts +0 -945
- package/src/extensions/tiptap-extensions/Link/link.ts +0 -238
- package/src/extensions/tiptap-extensions/TextAlignment/TextAlignmentExtension.ts +0 -33
- package/src/extensions/tiptap-extensions/TextColor/TextColorExtension.ts +0 -17
- package/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.ts +0 -173
- package/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts +0 -339
- package/src/extensions/tiptap-extensions/index.ts +0 -7
- package/src/extensions-shared/UiElementPosition.ts +0 -4
- package/src/fonts/inter.browser.test.ts +0 -57
- package/src/i18n/dictionary.ts +0 -17
- package/src/i18n/index.ts +0 -2
- package/src/i18n/locales/ar.ts +0 -443
- package/src/i18n/locales/de.ts +0 -477
- package/src/i18n/locales/en.ts +0 -458
- package/src/i18n/locales/es.ts +0 -456
- package/src/i18n/locales/fa.ts +0 -427
- package/src/i18n/locales/fr.ts +0 -504
- package/src/i18n/locales/he.ts +0 -458
- package/src/i18n/locales/hr.ts +0 -472
- package/src/i18n/locales/index.ts +0 -23
- package/src/i18n/locales/is.ts +0 -472
- package/src/i18n/locales/it.ts +0 -480
- package/src/i18n/locales/ja.ts +0 -498
- package/src/i18n/locales/ko.ts +0 -471
- package/src/i18n/locales/nl.ts +0 -459
- package/src/i18n/locales/no.ts +0 -476
- package/src/i18n/locales/pl.ts +0 -449
- package/src/i18n/locales/pt.ts +0 -451
- package/src/i18n/locales/ru.ts +0 -502
- package/src/i18n/locales/sk.ts +0 -456
- package/src/i18n/locales/uk.ts +0 -482
- package/src/i18n/locales/uz.ts +0 -492
- package/src/i18n/locales/vi.ts +0 -457
- package/src/i18n/locales/zh-tw.ts +0 -499
- package/src/i18n/locales/zh.ts +0 -499
- package/src/index.ts +0 -66
- package/src/locales.ts +0 -1
- package/src/pm-nodes/BlockContainer.test.ts +0 -101
- package/src/pm-nodes/BlockContainer.ts +0 -200
- package/src/pm-nodes/BlockGroup.ts +0 -58
- package/src/pm-nodes/Doc.ts +0 -11
- package/src/pm-nodes/README.md +0 -143
- package/src/pm-nodes/index.ts +0 -3
- package/src/pm-nodes/suggestionMarks.ts +0 -43
- package/src/schema/README.md +0 -3
- package/src/schema/blocks/children.test.ts +0 -288
- package/src/schema/blocks/children.ts +0 -136
- package/src/schema/blocks/createSpec.browser.test.ts +0 -176
- package/src/schema/blocks/createSpec.test.ts +0 -354
- package/src/schema/blocks/createSpec.ts +0 -732
- package/src/schema/blocks/extendBlockSpec.test.ts +0 -188
- package/src/schema/blocks/frame.test.ts +0 -112
- package/src/schema/blocks/frame.ts +0 -337
- package/src/schema/blocks/internal.test.ts +0 -86
- package/src/schema/blocks/internal.ts +0 -288
- package/src/schema/blocks/keyboard.ts +0 -154
- package/src/schema/blocks/layoutBlockAttributes.ts +0 -29
- package/src/schema/blocks/meta.test.ts +0 -53
- package/src/schema/blocks/meta.ts +0 -35
- package/src/schema/blocks/renderFrame.test.ts +0 -691
- package/src/schema/blocks/types.ts +0 -966
- package/src/schema/blocks/validateChildren.ts +0 -156
- package/src/schema/contentTypePropagation.test.ts +0 -182
- package/src/schema/dataAttributes.test.ts +0 -72
- package/src/schema/dataAttributes.ts +0 -69
- package/src/schema/index.ts +0 -15
- package/src/schema/inlineContent/createSpec.test.ts +0 -161
- package/src/schema/inlineContent/createSpec.ts +0 -409
- package/src/schema/inlineContent/internal.ts +0 -131
- package/src/schema/inlineContent/types.ts +0 -204
- package/src/schema/markGroups.ts +0 -82
- package/src/schema/nodeViewMutations.test.ts +0 -146
- package/src/schema/nodeViewMutations.ts +0 -49
- package/src/schema/propTypes.ts +0 -61
- package/src/schema/schema.test.ts +0 -110
- package/src/schema/schema.ts +0 -243
- package/src/schema/styles/createSpec.ts +0 -140
- package/src/schema/styles/internal.ts +0 -155
- package/src/schema/styles/types.ts +0 -57
- package/src/style.css +0 -2
- package/src/user/UserStore.ts +0 -199
- package/src/user/createUserStore.test.ts +0 -126
- package/src/user/index.ts +0 -2
- package/src/user/userColors.test.ts +0 -108
- package/src/user/userColors.ts +0 -101
- package/src/util/EventEmitter.ts +0 -59
- package/src/util/README.md +0 -3
- package/src/util/Store.test.ts +0 -132
- package/src/util/Store.ts +0 -135
- package/src/util/browser.ts +0 -54
- package/src/util/combineByGroup.ts +0 -25
- package/src/util/expandToWords.ts +0 -38
- package/src/util/string.ts +0 -36
- package/src/util/table.ts +0 -110
- package/src/util/topo-sort.test.ts +0 -125
- package/src/util/topo-sort.ts +0 -206
- package/src/util/typescript.ts +0 -17
- package/src/vite-env.d.ts +0 -7
- package/src/y/README.md +0 -5
- package/src/y/comments/RESTYjsThreadStore.ts +0 -138
- package/src/y/comments/YjsThreadStore.test.ts +0 -295
- package/src/y/comments/YjsThreadStore.ts +0 -358
- package/src/y/comments/YjsThreadStoreBase.ts +0 -50
- package/src/y/comments/index.ts +0 -3
- package/src/y/comments/yjsHelpers.ts +0 -125
- package/src/y/extensions/AttributionExtension.test.ts +0 -364
- package/src/y/extensions/AttributionExtension.ts +0 -401
- package/src/y/extensions/DiffVersioningExtension.test.ts +0 -242
- package/src/y/extensions/DiffVersioningExtension.ts +0 -200
- package/src/y/extensions/EmptyDocBinding.test.ts +0 -282
- package/src/y/extensions/ForkYDoc.node.test.ts +0 -77
- package/src/y/extensions/ForkYDoc.test.ts +0 -344
- package/src/y/extensions/ForkYDoc.ts +0 -117
- package/src/y/extensions/History.test.ts +0 -125
- package/src/y/extensions/RelativePositionMapping.test.ts +0 -453
- package/src/y/extensions/RelativePositionMapping.ts +0 -45
- package/src/y/extensions/Suggestions.ts +0 -174
- package/src/y/extensions/Versioning.node.test.ts +0 -126
- package/src/y/extensions/Versioning.test.ts +0 -117
- package/src/y/extensions/Versioning.ts +0 -74
- package/src/y/extensions/YAttributionMarks.ts +0 -422
- package/src/y/extensions/YCursorPlugin.ts +0 -192
- package/src/y/extensions/YSync.node.test.ts +0 -75
- package/src/y/extensions/YSync.ts +0 -197
- package/src/y/extensions/YSyncRemount.test.ts +0 -99
- package/src/y/extensions/blockMatchNodes.ts +0 -173
- package/src/y/extensions/index.ts +0 -140
- package/src/y/extensions/legacyYjsDocBinding.test.ts +0 -652
- package/src/y/extensions/nestingChanges.test.ts +0 -326
- package/src/y/extensions/persistentBlockGroups.test.ts +0 -1709
- package/src/y/extensions/persistentBlockGroups.ts +0 -953
- package/src/y/extensions/snapshotCodec.test.ts +0 -105
- package/src/y/extensions/snapshotCodec.ts +0 -39
- package/src/y/extensions/snapshotPreview.test.ts +0 -201
- package/src/y/extensions/snapshotPreview.ts +0 -292
- package/src/y/extensions/tableReshape.test.ts +0 -121
- package/src/y/extensions/v1BindingSnapshotDiff.test.ts +0 -121
- package/src/y/extensions/versionDiffAttribution.test.ts +0 -944
- package/src/y/extensions/versionDiffPerformance.test.ts +0 -101
- package/src/y/index.ts +0 -5
- package/src/y/utils.test.ts +0 -1309
- package/src/y/utils.ts +0 -366
- package/src/y/versioning/__test__/fixtures/activity-all-after.bin +0 -0
- package/src/y/versioning/__test__/fixtures/activity-all-after.json +0 -50
- package/src/y/versioning/__test__/fixtures/activity-all.bin +0 -0
- package/src/y/versioning/__test__/fixtures/activity-all.json +0 -20
- package/src/y/versioning/__test__/fixtures/activity-filtered-after.bin +0 -0
- package/src/y/versioning/__test__/fixtures/activity-filtered-after.json +0 -32
- package/src/y/versioning/__test__/fixtures/activity-filtered-before.json +0 -1
- package/src/y/versioning/__test__/fixtures/changeset.bin +0 -0
- package/src/y/versioning/__test__/fixtures/patch-response.json +0 -4
- package/src/y/versioning/__test__/yhub.test.ts +0 -966
- package/src/y/versioning/index.ts +0 -6
- package/src/y/versioning/yhub.ts +0 -350
- package/src/y/versioning/yhubClient.ts +0 -345
- package/src/yjs/README.md +0 -5
- package/src/yjs/comments/RESTYjsThreadStore.test.ts +0 -95
- package/src/yjs/comments/RESTYjsThreadStore.ts +0 -172
- package/src/yjs/comments/YjsThreadStore.test.ts +0 -295
- package/src/yjs/comments/YjsThreadStore.ts +0 -345
- package/src/yjs/comments/YjsThreadStoreBase.ts +0 -50
- package/src/yjs/comments/index.ts +0 -3
- package/src/yjs/comments/yjsHelpers.ts +0 -127
- package/src/yjs/extensions/FixUpSchema.test.ts +0 -421
- package/src/yjs/extensions/FixUpSchema.ts +0 -99
- package/src/yjs/extensions/ForkYDoc.browser.test.ts +0 -84
- package/src/yjs/extensions/ForkYDoc.node.test.ts +0 -231
- package/src/yjs/extensions/ForkYDoc.test.ts +0 -320
- package/src/yjs/extensions/ForkYDoc.ts +0 -177
- package/src/yjs/extensions/RelativePositionMapping.test.ts +0 -418
- package/src/yjs/extensions/RelativePositionMapping.ts +0 -77
- package/src/yjs/extensions/Versioning.test.ts +0 -376
- package/src/yjs/extensions/Versioning.ts +0 -126
- package/src/yjs/extensions/YCursorPlugin.ts +0 -201
- package/src/yjs/extensions/YSync.ts +0 -16
- package/src/yjs/extensions/YUndo.ts +0 -12
- package/src/yjs/extensions/__snapshots__/fork-yjs-snap-editor-forked.json +0 -19
- package/src/yjs/extensions/__snapshots__/fork-yjs-snap-editor.json +0 -19
- package/src/yjs/extensions/__snapshots__/fork-yjs-snap-forked.html +0 -1
- package/src/yjs/extensions/__snapshots__/fork-yjs-snap.html +0 -1
- package/src/yjs/extensions/index.ts +0 -89
- package/src/yjs/extensions/schemaMigration/SchemaMigration.ts +0 -59
- package/src/yjs/extensions/schemaMigration/migrationRules/index.ts +0 -4
- package/src/yjs/extensions/schemaMigration/migrationRules/migrationRule.ts +0 -4
- package/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.test.ts +0 -130
- package/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.ts +0 -91
- package/src/yjs/index.ts +0 -7
- package/src/yjs/utils.test.ts +0 -1013
- package/src/yjs/utils.ts +0 -186
- package/types/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/insertBlocks/insertPlacement.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/nestBlock/nestBlock.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/splitBlock/splitBlock.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/updateBlock/updateBlock.test.d.ts +0 -1
- package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.browser.test.d.ts +0 -1
- package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/layoutBlocks/plainBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/layoutBlocks/titledBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/tables/tables.test.d.ts +0 -1
- package/types/src/api/getBlockInfoFromPos.test.d.ts +0 -1
- package/types/src/api/getBlocksChangedByTransaction.test.d.ts +0 -1
- package/types/src/api/getChangedRanges.test.d.ts +0 -1
- package/types/src/api/nodeConversions/blockToNode.test.d.ts +0 -1
- package/types/src/api/parsers/html/util/nestedLists.test.d.ts +0 -1
- package/types/src/api/parsers/markdown/detectMarkdown.test.d.ts +0 -1
- package/types/src/api/positionMapping.test.d.ts +0 -1
- package/types/src/blocks/Code/block.test.d.ts +0 -1
- package/types/src/blocks/ListItem/CheckListItem/block.test.d.ts +0 -1
- package/types/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.d.ts +0 -1
- package/types/src/blocks/Table/TableExtension.test.d.ts +0 -1
- package/types/src/blocks/ToggleWrapper/toggleBlocks.browser.test.d.ts +0 -1
- package/types/src/blocks/defaultBlockTypeItems.test.d.ts +0 -1
- package/types/src/blocks/defaultBlocks.test.d.ts +0 -1
- package/types/src/comments/CommentEditorSubmitExtension.test.d.ts +0 -1
- package/types/src/editor/BlockNoteEditor.node.test.d.ts +0 -1
- package/types/src/editor/BlockNoteEditor.test.d.ts +0 -1
- package/types/src/editor/BlockNoteExtension.test.d.ts +0 -1
- package/types/src/editor/blockColors.browser.test.d.ts +0 -1
- package/types/src/editor/managers/EventManager.browser.test.d.ts +0 -1
- package/types/src/editor/managers/ExtensionManager/ExtensionManager.browser.test.d.ts +0 -1
- package/types/src/editor/managers/ExtensionManager/ExtensionManager.node.test.d.ts +0 -1
- package/types/src/editor/managers/ExtensionManager/ExtensionManager.test.d.ts +0 -1
- package/types/src/editor/managers/StyleManager.browser.test.d.ts +0 -1
- package/types/src/editor/managers/StyleManager.test.d.ts +0 -1
- package/types/src/editor/performance.test.d.ts +0 -1
- package/types/src/editor/transformPasted.test.d.ts +0 -1
- package/types/src/exporter/Exporter.test.d.ts +0 -1
- package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.test.d.ts +0 -1
- package/types/src/extensions/Placeholder/Placeholder.test.d.ts +0 -1
- package/types/src/extensions/PreviousBlockType/PreviousBlockType.test.d.ts +0 -1
- package/types/src/extensions/ReadOnly/ReadOnly.test.d.ts +0 -1
- package/types/src/extensions/SideMenu/blockGeometry.browser.test.d.ts +0 -1
- package/types/src/extensions/SideMenu/blockGeometry.test.d.ts +0 -1
- package/types/src/extensions/SideMenu/sideMenuHover.test.d.ts +0 -1
- package/types/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.d.ts +0 -4
- package/types/src/extensions/SuggestionMenu/SuggestionMenu.test.d.ts +0 -1
- package/types/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.d.ts +0 -4
- package/types/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.d.ts +0 -1
- package/types/src/extensions/SyntaxHighlighting/inlineHighlight.test.d.ts +0 -1
- package/types/src/extensions/TableHandles/TableHandles.browser.test.d.ts +0 -1
- package/types/src/extensions/Versioning/Versioning.browser.test.d.ts +0 -1
- package/types/src/extensions/Versioning/Versioning.node.test.d.ts +0 -1
- package/types/src/extensions/Versioning/__test__/result.d.ts +0 -3
- package/types/src/extensions/Versioning/comparison.test.d.ts +0 -1
- package/types/src/extensions/Versioning/createVersioning.test.d.ts +0 -1
- package/types/src/extensions/Versioning/inMemoryVersioning.test.d.ts +0 -1
- package/types/src/extensions/Versioning/scrollScheduling.test.d.ts +0 -1
- package/types/src/extensions/Versioning/scrollToFirstChange.test.d.ts +0 -1
- package/types/src/extensions/blockDOM.browser.test.d.ts +0 -1
- package/types/src/extensions/blockDOM.test.d.ts +0 -1
- package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.d.ts +0 -4
- package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/blockIdentity.browser.test.d.ts +0 -1
- package/types/src/extensions/tiptap-extensions/Link/link.test.d.ts +0 -1
- package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.d.ts +0 -4
- package/types/src/fonts/inter.browser.test.d.ts +0 -2
- package/types/src/pm-nodes/BlockContainer.test.d.ts +0 -1
- package/types/src/schema/blocks/children.test.d.ts +0 -1
- package/types/src/schema/blocks/createSpec.browser.test.d.ts +0 -1
- package/types/src/schema/blocks/createSpec.test.d.ts +0 -1
- package/types/src/schema/blocks/extendBlockSpec.test.d.ts +0 -1
- package/types/src/schema/blocks/frame.test.d.ts +0 -1
- package/types/src/schema/blocks/internal.test.d.ts +0 -1
- package/types/src/schema/blocks/meta.test.d.ts +0 -1
- package/types/src/schema/blocks/renderFrame.test.d.ts +0 -1
- package/types/src/schema/contentTypePropagation.test.d.ts +0 -1
- package/types/src/schema/dataAttributes.test.d.ts +0 -1
- package/types/src/schema/inlineContent/createSpec.test.d.ts +0 -1
- package/types/src/schema/nodeViewMutations.test.d.ts +0 -1
- package/types/src/schema/schema.test.d.ts +0 -1
- package/types/src/user/createUserStore.test.d.ts +0 -1
- package/types/src/user/userColors.test.d.ts +0 -1
- package/types/src/util/Store.test.d.ts +0 -1
- package/types/src/util/topo-sort.test.d.ts +0 -1
- package/types/src/y/comments/YjsThreadStore.test.d.ts +0 -1
- package/types/src/y/extensions/AttributionExtension.test.d.ts +0 -1
- package/types/src/y/extensions/DiffVersioningExtension.test.d.ts +0 -1
- package/types/src/y/extensions/EmptyDocBinding.test.d.ts +0 -1
- package/types/src/y/extensions/ForkYDoc.node.test.d.ts +0 -1
- package/types/src/y/extensions/ForkYDoc.test.d.ts +0 -1
- package/types/src/y/extensions/History.test.d.ts +0 -1
- package/types/src/y/extensions/RelativePositionMapping.test.d.ts +0 -1
- package/types/src/y/extensions/Versioning.node.test.d.ts +0 -1
- package/types/src/y/extensions/Versioning.test.d.ts +0 -1
- package/types/src/y/extensions/YSync.node.test.d.ts +0 -1
- package/types/src/y/extensions/YSyncRemount.test.d.ts +0 -1
- package/types/src/y/extensions/legacyYjsDocBinding.test.d.ts +0 -1
- package/types/src/y/extensions/nestingChanges.test.d.ts +0 -1
- package/types/src/y/extensions/persistentBlockGroups.test.d.ts +0 -1
- package/types/src/y/extensions/snapshotCodec.test.d.ts +0 -1
- package/types/src/y/extensions/snapshotPreview.test.d.ts +0 -1
- package/types/src/y/extensions/tableReshape.test.d.ts +0 -1
- package/types/src/y/extensions/v1BindingSnapshotDiff.test.d.ts +0 -1
- package/types/src/y/extensions/versionDiffAttribution.test.d.ts +0 -1
- package/types/src/y/extensions/versionDiffPerformance.test.d.ts +0 -1
- package/types/src/y/utils.test.d.ts +0 -1
- package/types/src/y/versioning/__test__/yhub.test.d.ts +0 -1
- package/types/src/yjs/comments/RESTYjsThreadStore.test.d.ts +0 -1
- package/types/src/yjs/comments/YjsThreadStore.test.d.ts +0 -1
- package/types/src/yjs/extensions/FixUpSchema.test.d.ts +0 -1
- package/types/src/yjs/extensions/ForkYDoc.browser.test.d.ts +0 -1
- package/types/src/yjs/extensions/ForkYDoc.node.test.d.ts +0 -1
- package/types/src/yjs/extensions/ForkYDoc.test.d.ts +0 -1
- package/types/src/yjs/extensions/RelativePositionMapping.test.d.ts +0 -1
- package/types/src/yjs/extensions/Versioning.test.d.ts +0 -1
- package/types/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.test.d.ts +0 -1
- package/types/src/yjs/utils.test.d.ts +0 -1
|
@@ -0,0 +1,2063 @@
|
|
|
1
|
+
import { $t as e, A as t, B as n, Bt as r, F as i, I as a, M as o, N as s, O as c, P as l, R as u, Vt as d, ct as f, en as p, ft as m, ht as h, k as g, nn as _, on as v, ot as ee, p as te, pt as ne, r as re, st as ie, tn as ae, xt as oe, z as se } from "./getDefaultSlashMenuItems-DfDOr807.js";
|
|
2
|
+
import { n as ce, r as le } from "./markGroups-BszXCkX8.js";
|
|
3
|
+
import { t as y } from "./BlockNoteExtension-U58cXw1g.js";
|
|
4
|
+
import { DOMParser as b, Fragment as x } from "prosemirror-model";
|
|
5
|
+
import { TextSelection as ue } from "prosemirror-state";
|
|
6
|
+
import { DOMParser as S, DOMSerializer as de, Fragment as fe } from "@tiptap/pm/model";
|
|
7
|
+
import { Extension as pe, InputRule as me, Mark as he, Node as C, callOrReturn as ge, getExtensionField as _e, markInputRule as ve, mergeAttributes as w } from "@tiptap/core";
|
|
8
|
+
import { CellSelection as ye, TableView as be, columnResizing as xe, goToNextCell as Se, isInTable as T, moveCellForward as Ce, nextCell as we, selectionCell as Te, tableEditing as Ee } from "prosemirror-tables";
|
|
9
|
+
import { Plugin as De, PluginKey as Oe } from "@tiptap/pm/state";
|
|
10
|
+
import { Decoration as ke, DecorationSet as Ae } from "@tiptap/pm/view";
|
|
11
|
+
import je from "@tiptap/extension-bold";
|
|
12
|
+
import Me from "@tiptap/extension-code";
|
|
13
|
+
import Ne from "@tiptap/extension-italic";
|
|
14
|
+
import Pe from "@tiptap/extension-strike";
|
|
15
|
+
import Fe from "@tiptap/extension-underline";
|
|
16
|
+
// src/pm-nodes/suggestionMarks.ts
|
|
17
|
+
var Ie = "blockLevelSuggestion";
|
|
18
|
+
function E(e) {
|
|
19
|
+
return e && e.options.extensions.some((e) => {
|
|
20
|
+
if (e.type !== "mark") return !1;
|
|
21
|
+
let t = _e(e, "group");
|
|
22
|
+
return typeof t == "string" && t.split(" ").includes("blockLevelSuggestion");
|
|
23
|
+
}) ? Ie : "";
|
|
24
|
+
}
|
|
25
|
+
// src/schema/blocks/createSpec.ts
|
|
26
|
+
function D(e, t) {
|
|
27
|
+
e.stopEvent = (e) => (e.type === "mousedown" && setTimeout(() => {
|
|
28
|
+
t.view.dom.blur();
|
|
29
|
+
}, 10), !0);
|
|
30
|
+
}
|
|
31
|
+
function Le(e, t) {
|
|
32
|
+
let n = e.layoutOnly === !0;
|
|
33
|
+
if (!(e.content === "table" || n && !t.parseContent)) return (r, i) => {
|
|
34
|
+
if (t.parseContent) {
|
|
35
|
+
let e = t.parseContent({
|
|
36
|
+
el: r,
|
|
37
|
+
schema: i
|
|
38
|
+
});
|
|
39
|
+
if (e !== void 0) return e;
|
|
40
|
+
}
|
|
41
|
+
if (n) return S.fromSchema(i).parse(r, {
|
|
42
|
+
topNode: i.nodes.blockGroup.create(),
|
|
43
|
+
preserveWhitespace: !0
|
|
44
|
+
}).content;
|
|
45
|
+
if (e.content === "none") return fe.empty;
|
|
46
|
+
let a = r.cloneNode(!0);
|
|
47
|
+
h(a, e.content === "plain" || t.meta?.code ? "\n" : "<br>");
|
|
48
|
+
let o = S.fromSchema(i).parse(a, {
|
|
49
|
+
topNode: i.nodes.paragraph.create(),
|
|
50
|
+
preserveWhitespace: e.content !== "plain" || "full"
|
|
51
|
+
});
|
|
52
|
+
if (e.content === "inline") return o.content;
|
|
53
|
+
let s = [];
|
|
54
|
+
return o.content.forEach((e) => {
|
|
55
|
+
if (e.isText) {
|
|
56
|
+
s.push(e);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
let t = e.type === i.linebreakReplacement ? "\n" : e.textContent;
|
|
60
|
+
t && s.push(i.text(t, e.marks));
|
|
61
|
+
}), fe.fromArray(s);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function Re(e, t) {
|
|
65
|
+
let n = [e.layoutOnly === !0 ? {
|
|
66
|
+
tag: `[data-node-type=${e.type}]`,
|
|
67
|
+
contentElement: (e) => se(e) ?? e
|
|
68
|
+
} : {
|
|
69
|
+
tag: "[data-content-type=" + e.type + "]",
|
|
70
|
+
contentElement: ".bn-inline-content",
|
|
71
|
+
preserveWhitespace: e.content === "plain" ? "full" : void 0
|
|
72
|
+
}];
|
|
73
|
+
return t.parse && n.push({
|
|
74
|
+
tag: "*",
|
|
75
|
+
getAttrs(e) {
|
|
76
|
+
if (typeof e == "string") return !1;
|
|
77
|
+
let n = t.parse?.(e);
|
|
78
|
+
return n !== void 0 && n;
|
|
79
|
+
},
|
|
80
|
+
preserveWhitespace: !0,
|
|
81
|
+
getContent: Le(e, t)
|
|
82
|
+
}), n;
|
|
83
|
+
}
|
|
84
|
+
function O(e, t) {
|
|
85
|
+
if (e.layoutOnly !== !0) {
|
|
86
|
+
if (!t.render) throw Error(`Block "${e.type}" must declare \`render\`.`);
|
|
87
|
+
} else {
|
|
88
|
+
if (t.render) throw Error(`Layout block "${e.type}" draws its box in \`renderFrame\`, and has no content for \`render\` to draw.`);
|
|
89
|
+
if (!t.renderFrame) throw Error(`Layout block "${e.type}" must declare \`renderFrame\`.`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function ze(e, t) {
|
|
93
|
+
let r = u({
|
|
94
|
+
props: t,
|
|
95
|
+
editor: t.extension.options.editor,
|
|
96
|
+
blockNode: (e) => e
|
|
97
|
+
}), i = {
|
|
98
|
+
dom: r.dom,
|
|
99
|
+
contentDOM: r.slot,
|
|
100
|
+
update(e, t, n) {
|
|
101
|
+
return e.attrs.id === r.node.attrs.id && r.update(e, t, n);
|
|
102
|
+
},
|
|
103
|
+
...n(r)
|
|
104
|
+
};
|
|
105
|
+
return e.meta.selectable || D(i, t.editor), i;
|
|
106
|
+
}
|
|
107
|
+
function Be(e, n, r) {
|
|
108
|
+
if (e.layoutOnly === !0) return ze(n, r);
|
|
109
|
+
let i = t(r.getPos, r.node, r.view.state.doc), a = n.render.call({
|
|
110
|
+
blockContentDOMAttributes: r.extension.options.domAttributes?.blockContent || {},
|
|
111
|
+
props: r,
|
|
112
|
+
renderType: "nodeView",
|
|
113
|
+
propSchema: e.propSchema
|
|
114
|
+
}, i, r.extension.options.editor);
|
|
115
|
+
return n.meta.selectable || D(a, r.editor), m(a), a;
|
|
116
|
+
}
|
|
117
|
+
function Ve(e) {
|
|
118
|
+
let t = e !== void 0 && "exclude" in e ? e.exclude : [];
|
|
119
|
+
return t === void 0 || t.length === 0 ? _(e) : function() {
|
|
120
|
+
return _(e, ae(t, this.options.editor.schema.blockSpecs));
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function He(t, n, r) {
|
|
124
|
+
let i = t.layoutOnly === !0;
|
|
125
|
+
return C.create({
|
|
126
|
+
name: t.type,
|
|
127
|
+
content: i ? Ve(t.children) : t.content === "inline" ? "inline*" : t.content === "plain" ? "text*" : t.content === "none" ? "" : t.content,
|
|
128
|
+
marks() {
|
|
129
|
+
return i ? E(this.editor) : t.content === "plain" ? le(this.editor) : void 0;
|
|
130
|
+
},
|
|
131
|
+
group: i ? [
|
|
132
|
+
"bnBlock",
|
|
133
|
+
p,
|
|
134
|
+
...t.placeable === "namedOnly" ? [] : [e]
|
|
135
|
+
].join(" ") : "blockContent",
|
|
136
|
+
selectable: n.meta.selectable,
|
|
137
|
+
isolating: n.meta.isolating,
|
|
138
|
+
code: n.meta.code,
|
|
139
|
+
defining: n.meta.defining,
|
|
140
|
+
priority: i ? v(r) : r,
|
|
141
|
+
addAttributes() {
|
|
142
|
+
return s(t.propSchema);
|
|
143
|
+
},
|
|
144
|
+
parseHTML() {
|
|
145
|
+
return Re(t, n);
|
|
146
|
+
},
|
|
147
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
148
|
+
if (i) {
|
|
149
|
+
let n = document.createElement("div");
|
|
150
|
+
n.setAttribute("data-node-type", t.type);
|
|
151
|
+
for (let [t, r] of Object.entries(e)) n.setAttribute(t, r);
|
|
152
|
+
return {
|
|
153
|
+
dom: n,
|
|
154
|
+
contentDOM: n
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
let r = document.createElement("div");
|
|
158
|
+
return l({
|
|
159
|
+
dom: r,
|
|
160
|
+
contentDOM: t.content === "inline" || t.content === "plain" ? r : void 0
|
|
161
|
+
}, t.type, {}, t.propSchema, n.meta.fileBlockAccept !== void 0, e);
|
|
162
|
+
},
|
|
163
|
+
addNodeView() {
|
|
164
|
+
return (e) => Be(t, n, e);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function Ue(e, t, n, r) {
|
|
169
|
+
let s = e.layoutOnly === !0, c = {
|
|
170
|
+
...t,
|
|
171
|
+
meta: i(t.meta, e)
|
|
172
|
+
}, l = c.node ?? He(e, c, r);
|
|
173
|
+
if (l.name !== e.type) throw Error("Node name does not match block type. This is a bug in BlockNote.");
|
|
174
|
+
O(e, c);
|
|
175
|
+
let u = l.extend({ extendNodeSchema(t) {
|
|
176
|
+
return t.name === l.name ? { blockConfig: e } : {};
|
|
177
|
+
} }), { experimental_keyboard: d, render: f, toExternalHTML: p, ...m } = c;
|
|
178
|
+
return {
|
|
179
|
+
config: e,
|
|
180
|
+
implementation: {
|
|
181
|
+
...m,
|
|
182
|
+
keyboard: a(d, {
|
|
183
|
+
isLayoutBlock: s,
|
|
184
|
+
hardBreakShortcut: c.meta.hardBreakShortcut
|
|
185
|
+
}),
|
|
186
|
+
node: u,
|
|
187
|
+
...f && { render(t, n) {
|
|
188
|
+
let r = u.options.domAttributes?.blockContent || {};
|
|
189
|
+
return f.call({
|
|
190
|
+
blockContentDOMAttributes: r,
|
|
191
|
+
props: void 0,
|
|
192
|
+
renderType: "dom",
|
|
193
|
+
propSchema: e.propSchema
|
|
194
|
+
}, t, n);
|
|
195
|
+
} },
|
|
196
|
+
...p && { toExternalHTML: (t, n, r) => {
|
|
197
|
+
let i = u.options.domAttributes?.blockContent || {}, a = p.call({
|
|
198
|
+
blockContentDOMAttributes: i,
|
|
199
|
+
propSchema: e.propSchema
|
|
200
|
+
}, t, n, r);
|
|
201
|
+
return a && s && !o(a.dom) && ee(a.dom, t.props, e.propSchema), a;
|
|
202
|
+
} }
|
|
203
|
+
},
|
|
204
|
+
extensions: n
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function k(e) {
|
|
208
|
+
return e;
|
|
209
|
+
}
|
|
210
|
+
function A(e, t, n) {
|
|
211
|
+
return (r = {}) => {
|
|
212
|
+
let i = typeof e == "function" ? e(r) : e, a = typeof t == "function" ? t(r) : t, o = n ? typeof n == "function" ? n(r) : n : void 0, s = i.layoutOnly === !0;
|
|
213
|
+
O(i, a);
|
|
214
|
+
let u = a.render, d = a.toExternalHTML;
|
|
215
|
+
return {
|
|
216
|
+
config: i,
|
|
217
|
+
implementation: {
|
|
218
|
+
...a,
|
|
219
|
+
...d && { toExternalHTML(e, t, n) {
|
|
220
|
+
let r = d.call({ blockContentDOMAttributes: this.blockContentDOMAttributes }, e, t, n);
|
|
221
|
+
if (r !== void 0) return s ? (c(r.dom, this.blockContentDOMAttributes), r) : l(r, e.type, e.props, this.propSchema ?? i.propSchema, a.meta?.fileBlockAccept !== void 0);
|
|
222
|
+
} },
|
|
223
|
+
...u && { render(e, t) {
|
|
224
|
+
let n = u.call({
|
|
225
|
+
blockContentDOMAttributes: this.blockContentDOMAttributes,
|
|
226
|
+
renderType: this.renderType,
|
|
227
|
+
props: this.props
|
|
228
|
+
}, e, t);
|
|
229
|
+
return l(n, e.type, e.props, this.propSchema ?? i.propSchema, a.meta?.fileBlockAccept !== void 0, this.blockContentDOMAttributes);
|
|
230
|
+
} }
|
|
231
|
+
},
|
|
232
|
+
extensions: o
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
// src/schema/inlineContent/internal.ts
|
|
237
|
+
function We(e, t, n, r) {
|
|
238
|
+
return e.dom.setAttribute("data-inline-content-type", t), f(e.dom, ie(n, r)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
239
|
+
}
|
|
240
|
+
function Ge(e) {
|
|
241
|
+
return { Backspace: ({ editor: t }) => {
|
|
242
|
+
let n = t.state.selection.$from;
|
|
243
|
+
return t.state.selection.empty && n.node().type.name === e.type && n.parentOffset === 0;
|
|
244
|
+
} };
|
|
245
|
+
}
|
|
246
|
+
function Ke(e, t, n) {
|
|
247
|
+
return {
|
|
248
|
+
config: e,
|
|
249
|
+
implementation: t,
|
|
250
|
+
extensions: n
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function qe(e, t, n, r) {
|
|
254
|
+
return Ke({
|
|
255
|
+
type: e.name,
|
|
256
|
+
propSchema: t,
|
|
257
|
+
content: e.config.content === "inline*" ? "styled" : e.config.content === "text*" ? "plain" : "none"
|
|
258
|
+
}, {
|
|
259
|
+
...n,
|
|
260
|
+
node: e
|
|
261
|
+
}, r);
|
|
262
|
+
}
|
|
263
|
+
function j(e) {
|
|
264
|
+
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
|
|
265
|
+
}
|
|
266
|
+
// src/schema/styles/internal.ts
|
|
267
|
+
function Je(e) {
|
|
268
|
+
return e === "boolean" ? {} : { stringValue: {
|
|
269
|
+
default: void 0,
|
|
270
|
+
keepOnSplit: !0,
|
|
271
|
+
parseHTML: (e) => e.getAttribute("data-value"),
|
|
272
|
+
renderHTML: (e) => e.stringValue === void 0 ? {} : { "data-value": e.stringValue }
|
|
273
|
+
} };
|
|
274
|
+
}
|
|
275
|
+
function M(e, t, n, r) {
|
|
276
|
+
return e.dom.setAttribute("data-style-type", t), r === "string" && e.dom.setAttribute("data-value", n), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
277
|
+
}
|
|
278
|
+
function N(e, t, n) {
|
|
279
|
+
return {
|
|
280
|
+
config: e,
|
|
281
|
+
implementation: t,
|
|
282
|
+
extensions: n
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
function P(e, t) {
|
|
286
|
+
return N({
|
|
287
|
+
type: e.name,
|
|
288
|
+
propSchema: t
|
|
289
|
+
}, {
|
|
290
|
+
mark: e,
|
|
291
|
+
render(t, n) {
|
|
292
|
+
let r = n.pmSchema.marks[e.name].spec.toDOM;
|
|
293
|
+
if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
|
|
294
|
+
let i = n.pmSchema.mark(e.name, { stringValue: t }), a = de.renderSpec(document, r(i, !0));
|
|
295
|
+
if (typeof a != "object" || !("dom" in a)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");
|
|
296
|
+
return a;
|
|
297
|
+
},
|
|
298
|
+
toExternalHTML(t, n) {
|
|
299
|
+
let r = n.pmSchema.marks[e.name].spec.toDOM;
|
|
300
|
+
if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
|
|
301
|
+
let i = n.pmSchema.mark(e.name, { stringValue: t }), a = de.renderSpec(document, r(i, !0));
|
|
302
|
+
if (typeof a != "object" || !("dom" in a)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");
|
|
303
|
+
return a;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
function F(e) {
|
|
308
|
+
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
|
|
309
|
+
}
|
|
310
|
+
// src/schema/styles/createSpec.ts
|
|
311
|
+
function Ye(e, t) {
|
|
312
|
+
let n = [{
|
|
313
|
+
tag: `[data-style-type="${e.type}"]`,
|
|
314
|
+
contentElement: (e) => {
|
|
315
|
+
let t = e;
|
|
316
|
+
return t.matches("[data-editable]") ? t : t.querySelector("[data-editable]") || t;
|
|
317
|
+
}
|
|
318
|
+
}];
|
|
319
|
+
return t && n.push({
|
|
320
|
+
tag: "*",
|
|
321
|
+
consuming: !1,
|
|
322
|
+
getAttrs(e) {
|
|
323
|
+
if (typeof e == "string") return !1;
|
|
324
|
+
let n = t?.(e);
|
|
325
|
+
return n !== void 0 && { stringValue: n };
|
|
326
|
+
}
|
|
327
|
+
}), n;
|
|
328
|
+
}
|
|
329
|
+
function I(e, t, n) {
|
|
330
|
+
let r = he.create({
|
|
331
|
+
name: e.type,
|
|
332
|
+
addAttributes() {
|
|
333
|
+
return Je(e.propSchema);
|
|
334
|
+
},
|
|
335
|
+
parseHTML() {
|
|
336
|
+
return Ye(e, t.parse);
|
|
337
|
+
},
|
|
338
|
+
renderHTML({ mark: n }) {
|
|
339
|
+
return M((t.toExternalHTML || t.render)(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
|
|
340
|
+
},
|
|
341
|
+
addMarkView() {
|
|
342
|
+
return ({ mark: n }) => M(t.render(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
return N(e, {
|
|
346
|
+
...t,
|
|
347
|
+
mark: r,
|
|
348
|
+
render: (n) => M(t.render(n), e.type, n, e.propSchema),
|
|
349
|
+
toExternalHTML: (n) => M((t.toExternalHTML || t.render)(n), e.type, n, e.propSchema)
|
|
350
|
+
}, n);
|
|
351
|
+
}
|
|
352
|
+
// src/util/topo-sort.ts
|
|
353
|
+
function Xe(e) {
|
|
354
|
+
let t = Qe(e), { roots: n, nonRoots: r } = $e(t), i = [];
|
|
355
|
+
for (; n.size;) {
|
|
356
|
+
i.push(n);
|
|
357
|
+
let r = /* @__PURE__ */ new Set();
|
|
358
|
+
for (let i of n) {
|
|
359
|
+
let n = e.get(i);
|
|
360
|
+
if (n) for (let e of n) {
|
|
361
|
+
let n = t.get(e);
|
|
362
|
+
if (n === void 0) continue;
|
|
363
|
+
let i = n - 1;
|
|
364
|
+
t.set(e, i), i === 0 && r.add(e);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
n = r;
|
|
368
|
+
}
|
|
369
|
+
if (r = $e(t).nonRoots, r.size) throw Error(`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(r).join(", ")}`);
|
|
370
|
+
return i;
|
|
371
|
+
}
|
|
372
|
+
function Ze(e) {
|
|
373
|
+
return Xe(et(e));
|
|
374
|
+
}
|
|
375
|
+
function Qe(e) {
|
|
376
|
+
let t = /* @__PURE__ */ new Map();
|
|
377
|
+
for (let [n, r] of e.entries()) {
|
|
378
|
+
t.has(n) || t.set(n, 0);
|
|
379
|
+
for (let e of r) {
|
|
380
|
+
let n = t.get(e) ?? 0;
|
|
381
|
+
t.set(e, n + 1);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return t;
|
|
385
|
+
}
|
|
386
|
+
function $e(e) {
|
|
387
|
+
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
388
|
+
for (let [r, i] of e.entries()) i === 0 ? t.add(r) : n.add(r);
|
|
389
|
+
return {
|
|
390
|
+
roots: t,
|
|
391
|
+
nonRoots: n
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function et(e) {
|
|
395
|
+
let t = /* @__PURE__ */ new Map();
|
|
396
|
+
for (let [n, r] of e.entries()) {
|
|
397
|
+
t.has(n) || t.set(n, /* @__PURE__ */ new Set());
|
|
398
|
+
for (let e of r) t.has(e) || t.set(e, /* @__PURE__ */ new Set()), t.get(e).add(n);
|
|
399
|
+
}
|
|
400
|
+
return t;
|
|
401
|
+
}
|
|
402
|
+
function tt() {
|
|
403
|
+
return /* @__PURE__ */ new Map();
|
|
404
|
+
}
|
|
405
|
+
function nt(e, t, n) {
|
|
406
|
+
return e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n), e;
|
|
407
|
+
}
|
|
408
|
+
function rt(e) {
|
|
409
|
+
let t = tt();
|
|
410
|
+
for (let n of e) Array.isArray(n.runsBefore) && n.runsBefore.length > 0 ? n.runsBefore.forEach((e) => {
|
|
411
|
+
nt(t, n.key, e);
|
|
412
|
+
}) : nt(t, "default", n.key);
|
|
413
|
+
let n = Ze(t), r = n.findIndex((e) => e.has("default"));
|
|
414
|
+
return (e) => 91 + (n.findIndex((t) => t.has(e)) + r) * 10;
|
|
415
|
+
}
|
|
416
|
+
// src/schema/blocks/validateChildren.ts
|
|
417
|
+
function it(e) {
|
|
418
|
+
for (let [t, { config: n }] of Object.entries(e)) {
|
|
419
|
+
if (n.layoutOnly === !0 && n.content !== "none" && L(t, "`layoutOnly: true` is only for blocks without content (`content: \"none\"`). A layout block holds only child blocks, no content of its own."), n.placeable === "namedOnly" && n.layoutOnly !== !0 && L(t, "`placeable: \"namedOnly\"` is only for layout blocks (`layoutOnly: true`). Only a layout block can be limited to the blocks that name it in `children.allow`."), !n.children) continue;
|
|
420
|
+
let { allow: r = "blocks", min: i, exclude: a, dissolve: o } = n.children;
|
|
421
|
+
if (n.layoutOnly !== !0) (r !== "blocks" || i !== void 0 || a !== void 0 || o !== void 0) && L(t, "restricting child types, a minimum count or `dissolve` requires `layoutOnly: true`. Other blocks can always have any child blocks (`{ allow: \"blocks\" }`).");
|
|
422
|
+
else {
|
|
423
|
+
if (r === "blocks" && (i !== void 0 || o !== void 0) && L(t, `\`children.${i === void 0 ? "dissolve" : "min"}\` needs an \`allow\` list. A layout block that accepts any blocks always holds at least one child, and dissolves when its last child is removed.`), i !== void 0 && !(Number.isInteger(i) && i >= 0) && L(t, `\`children.min\` must be a whole number that is 0 or more, not ${String(i)}.`), a !== void 0) {
|
|
424
|
+
r !== "blocks" && L(t, "`children.exclude` is only for a layout block that accepts any blocks. An `allow` list already names exactly what the layout block holds.");
|
|
425
|
+
for (let n of a) {
|
|
426
|
+
Object.prototype.hasOwnProperty.call(e, n) || L(t, `\`exclude\` contains "${n}", which is not a configured block type.`);
|
|
427
|
+
let { config: r } = e[n];
|
|
428
|
+
r.layoutOnly !== !0 && L(t, `\`exclude\` contains "${n}", which is not a layout block. Only layout blocks (\`layoutOnly: true\`) can be excluded.`), r.placeable === "namedOnly" && L(t, `\`exclude\` contains "${n}", which is \`placeable: "namedOnly"\` and never a child of a layout block that accepts any blocks.`);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (r !== "blocks") for (let n of r) Object.prototype.hasOwnProperty.call(e, n) || L(t, `\`allow\` contains "${n}", which is not a configured block type.`), e[n].config.layoutOnly !== !0 && L(t, `\`allow\` contains "${n}", which is not a layout block. An \`allow\` list can name only layout blocks (\`layoutOnly: true\`); naming other blocks is not supported yet. Use \`allow: "blocks"\` to accept all other blocks.`);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
let t = new Set(Object.values(e).flatMap(({ config: e }) => e.children?.allow && e.children.allow !== "blocks" ? e.children.allow : []));
|
|
435
|
+
for (let [n, { config: r }] of Object.entries(e)) r.placeable === "namedOnly" && !t.has(n) && L(n, "`placeable: \"namedOnly\"` limits this block to the blocks that name it in `children.allow`, but no block names it. Name it in the `allow` list of a layout block.");
|
|
436
|
+
}
|
|
437
|
+
function L(e, t) {
|
|
438
|
+
throw Error(`Invalid config for block "${e}": ${t}`);
|
|
439
|
+
}
|
|
440
|
+
// src/schema/schema.ts
|
|
441
|
+
function at(e) {
|
|
442
|
+
return e && Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
|
|
443
|
+
}
|
|
444
|
+
var ot = class {
|
|
445
|
+
opts;
|
|
446
|
+
BlockNoteEditor = "only for types";
|
|
447
|
+
Block = "only for types";
|
|
448
|
+
PartialBlock = "only for types";
|
|
449
|
+
inlineContentSpecs;
|
|
450
|
+
styleSpecs;
|
|
451
|
+
blockSpecs;
|
|
452
|
+
blockSchema;
|
|
453
|
+
inlineContentSchema;
|
|
454
|
+
styleSchema;
|
|
455
|
+
constructor(e) {
|
|
456
|
+
this.opts = e;
|
|
457
|
+
let { blockSpecs: t, inlineContentSpecs: n, styleSpecs: r, blockSchema: i, inlineContentSchema: a, styleSchema: o } = this.init();
|
|
458
|
+
this.blockSpecs = t, this.styleSpecs = r, this.styleSchema = o, this.inlineContentSpecs = n, this.blockSchema = i, this.inlineContentSchema = a;
|
|
459
|
+
}
|
|
460
|
+
init() {
|
|
461
|
+
let e = rt(Object.entries({
|
|
462
|
+
...this.opts.blockSpecs,
|
|
463
|
+
...this.opts.inlineContentSpecs,
|
|
464
|
+
...this.opts.styleSpecs
|
|
465
|
+
}).map(([e, t]) => ({
|
|
466
|
+
key: e,
|
|
467
|
+
runsBefore: t.implementation?.runsBefore ?? []
|
|
468
|
+
})));
|
|
469
|
+
it(this.opts.blockSpecs);
|
|
470
|
+
let t = Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([t, n]) => [t, Ue(n.config, n.implementation, n.extensions, e(t))])), n = Object.fromEntries(Object.entries(this.opts.inlineContentSpecs).map(([t, n]) => typeof n.config == "object" ? [t, {
|
|
471
|
+
...n,
|
|
472
|
+
implementation: {
|
|
473
|
+
...n.implementation,
|
|
474
|
+
node: n.implementation?.node.extend({ priority: e(t) })
|
|
475
|
+
}
|
|
476
|
+
}] : [t, n])), r = Object.fromEntries(Object.entries(this.opts.styleSpecs).map(([t, n]) => [t, {
|
|
477
|
+
...n,
|
|
478
|
+
implementation: {
|
|
479
|
+
...n.implementation,
|
|
480
|
+
mark: n.implementation?.mark.extend({ priority: e(t) })
|
|
481
|
+
}
|
|
482
|
+
}]));
|
|
483
|
+
return {
|
|
484
|
+
blockSpecs: t,
|
|
485
|
+
blockSchema: Object.fromEntries(Object.entries(t).map(([e, t]) => [e, t.config])),
|
|
486
|
+
inlineContentSpecs: at(n),
|
|
487
|
+
styleSpecs: at(r),
|
|
488
|
+
inlineContentSchema: j(n),
|
|
489
|
+
styleSchema: F(r)
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
extend(e) {
|
|
493
|
+
this.opts = {
|
|
494
|
+
blockSpecs: {
|
|
495
|
+
...this.opts.blockSpecs,
|
|
496
|
+
...e.blockSpecs
|
|
497
|
+
},
|
|
498
|
+
inlineContentSpecs: {
|
|
499
|
+
...this.opts.inlineContentSpecs,
|
|
500
|
+
...e.inlineContentSpecs
|
|
501
|
+
},
|
|
502
|
+
styleSpecs: {
|
|
503
|
+
...this.opts.styleSpecs,
|
|
504
|
+
...e.styleSpecs
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
let { blockSpecs: t, inlineContentSpecs: n, styleSpecs: r, blockSchema: i, inlineContentSchema: a, styleSchema: o } = this.init();
|
|
508
|
+
return this.blockSpecs = t, this.styleSpecs = r, this.styleSchema = o, this.inlineContentSpecs = n, this.blockSchema = i, this.inlineContentSchema = a, this;
|
|
509
|
+
}
|
|
510
|
+
}, R = {
|
|
511
|
+
gray: {
|
|
512
|
+
text: "#9b9a97",
|
|
513
|
+
background: "#ebeced"
|
|
514
|
+
},
|
|
515
|
+
brown: {
|
|
516
|
+
text: "#64473a",
|
|
517
|
+
background: "#e9e5e3"
|
|
518
|
+
},
|
|
519
|
+
red: {
|
|
520
|
+
text: "#e03e3e",
|
|
521
|
+
background: "#fbe4e4"
|
|
522
|
+
},
|
|
523
|
+
orange: {
|
|
524
|
+
text: "#d9730d",
|
|
525
|
+
background: "#f6e9d9"
|
|
526
|
+
},
|
|
527
|
+
yellow: {
|
|
528
|
+
text: "#dfab01",
|
|
529
|
+
background: "#fbf3db"
|
|
530
|
+
},
|
|
531
|
+
green: {
|
|
532
|
+
text: "#4d6461",
|
|
533
|
+
background: "#ddedea"
|
|
534
|
+
},
|
|
535
|
+
blue: {
|
|
536
|
+
text: "#0b6e99",
|
|
537
|
+
background: "#ddebf1"
|
|
538
|
+
},
|
|
539
|
+
purple: {
|
|
540
|
+
text: "#6940a5",
|
|
541
|
+
background: "#eae4f2"
|
|
542
|
+
},
|
|
543
|
+
pink: {
|
|
544
|
+
text: "#ad1a72",
|
|
545
|
+
background: "#f4dfeb"
|
|
546
|
+
}
|
|
547
|
+
}, st = {
|
|
548
|
+
gray: {
|
|
549
|
+
text: "#bebdb8",
|
|
550
|
+
background: "#9b9a97"
|
|
551
|
+
},
|
|
552
|
+
brown: {
|
|
553
|
+
text: "#8e6552",
|
|
554
|
+
background: "#64473a"
|
|
555
|
+
},
|
|
556
|
+
red: {
|
|
557
|
+
text: "#ec4040",
|
|
558
|
+
background: "#be3434"
|
|
559
|
+
},
|
|
560
|
+
orange: {
|
|
561
|
+
text: "#e3790d",
|
|
562
|
+
background: "#b7600a"
|
|
563
|
+
},
|
|
564
|
+
yellow: {
|
|
565
|
+
text: "#dfab01",
|
|
566
|
+
background: "#b58b00"
|
|
567
|
+
},
|
|
568
|
+
green: {
|
|
569
|
+
text: "#6b8b87",
|
|
570
|
+
background: "#4d6461"
|
|
571
|
+
},
|
|
572
|
+
blue: {
|
|
573
|
+
text: "#0e87bc",
|
|
574
|
+
background: "#0b6e99"
|
|
575
|
+
},
|
|
576
|
+
purple: {
|
|
577
|
+
text: "#8552d7",
|
|
578
|
+
background: "#6940a5"
|
|
579
|
+
},
|
|
580
|
+
pink: {
|
|
581
|
+
text: "#da208f",
|
|
582
|
+
background: "#ad1a72"
|
|
583
|
+
}
|
|
584
|
+
}, z = {
|
|
585
|
+
backgroundColor: { default: "default" },
|
|
586
|
+
textColor: { default: "default" },
|
|
587
|
+
textAlignment: {
|
|
588
|
+
default: "left",
|
|
589
|
+
values: [
|
|
590
|
+
"left",
|
|
591
|
+
"center",
|
|
592
|
+
"right",
|
|
593
|
+
"justify"
|
|
594
|
+
]
|
|
595
|
+
}
|
|
596
|
+
}, B = (e) => {
|
|
597
|
+
let t = {};
|
|
598
|
+
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 = z.textAlignment.values.includes(e.style.textAlign) ? e.style.textAlign : void 0, t;
|
|
599
|
+
}, V = (e, t) => {
|
|
600
|
+
e.backgroundColor && e.backgroundColor !== z.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in R ? R[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== z.textColor.default && (t.style.color = e.textColor in R ? R[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== z.textAlignment.default && (t.style.textAlign = e.textAlignment);
|
|
601
|
+
}, ct = (e = "backgroundColor") => ({
|
|
602
|
+
default: z.backgroundColor.default,
|
|
603
|
+
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : e.style.backgroundColor ? e.style.backgroundColor : z.backgroundColor.default,
|
|
604
|
+
renderHTML: (t) => t[e] === z.backgroundColor.default ? {} : { "data-background-color": t[e] }
|
|
605
|
+
}), lt = (e = "textColor") => ({
|
|
606
|
+
default: z.textColor.default,
|
|
607
|
+
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : e.style.color ? e.style.color : z.textColor.default,
|
|
608
|
+
renderHTML: (t) => t[e] === z.textColor.default ? {} : { "data-text-color": t[e] }
|
|
609
|
+
}), ut = (e = "textAlignment") => ({
|
|
610
|
+
default: z.textAlignment.default,
|
|
611
|
+
parseHTML: (e) => e.hasAttribute("data-text-alignment") ? e.getAttribute("data-text-alignment") : e.style.textAlign ? e.style.textAlign : z.textAlignment.default,
|
|
612
|
+
renderHTML: (t) => t[e] === z.textAlignment.default ? {} : { "data-text-alignment": t[e] }
|
|
613
|
+
}), H = (e, t) => {
|
|
614
|
+
let n = e.querySelector(t);
|
|
615
|
+
if (n) return {
|
|
616
|
+
targetElement: n,
|
|
617
|
+
caption: e.querySelector("figcaption")?.textContent ?? void 0
|
|
618
|
+
};
|
|
619
|
+
}, dt = (e, t, n) => {
|
|
620
|
+
let r = document.createElement("div");
|
|
621
|
+
r.className = "bn-add-file-button";
|
|
622
|
+
let i = document.createElement("div");
|
|
623
|
+
i.className = "bn-add-file-button-icon", n ? i.appendChild(n) : i.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>", r.appendChild(i);
|
|
624
|
+
let a = document.createElement("p");
|
|
625
|
+
a.className = "bn-add-file-button-text", a.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, r.appendChild(a);
|
|
626
|
+
let o = (e) => {
|
|
627
|
+
e.preventDefault(), e.stopPropagation();
|
|
628
|
+
}, s = () => {
|
|
629
|
+
t.isEditable && t.getExtension(te)?.showMenu(e.id);
|
|
630
|
+
};
|
|
631
|
+
return r.addEventListener("mousedown", o, !0), r.addEventListener("click", s, !0), {
|
|
632
|
+
dom: r,
|
|
633
|
+
destroy: () => {
|
|
634
|
+
r.removeEventListener("mousedown", o, !0), r.removeEventListener("click", s, !0);
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
}, ft = "<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>", pt = (e) => {
|
|
638
|
+
let t = document.createElement("div");
|
|
639
|
+
t.className = "bn-file-name-with-icon";
|
|
640
|
+
let n = document.createElement("div");
|
|
641
|
+
n.className = "bn-file-icon", n.innerHTML = ft, t.appendChild(n);
|
|
642
|
+
let r = document.createElement("p");
|
|
643
|
+
return r.className = "bn-file-name", r.textContent = e.props.name, t.appendChild(r), { dom: t };
|
|
644
|
+
}, U = (e, t, n, r) => {
|
|
645
|
+
let i = e.props.url !== "" && !!e.props.caption, a = document.createElement(i ? "figure" : "div");
|
|
646
|
+
if (a.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
647
|
+
let n = dt(e, t, r);
|
|
648
|
+
a.appendChild(n.dom);
|
|
649
|
+
let i = t.onUploadStart((t) => {
|
|
650
|
+
if (t === e.id) {
|
|
651
|
+
let e = document.createElement("div");
|
|
652
|
+
e.className = "bn-file-loading-preview", e.textContent = "Loading...", a.replaceChildren(e);
|
|
653
|
+
}
|
|
654
|
+
}), o = t.onUploadEnd((t) => {
|
|
655
|
+
t === e.id && a.replaceChildren(n.dom);
|
|
656
|
+
});
|
|
657
|
+
return {
|
|
658
|
+
dom: a,
|
|
659
|
+
destroy: () => {
|
|
660
|
+
i(), o(), n.destroy();
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
let o = { dom: a };
|
|
665
|
+
if (e.props.showPreview === !1 || !n) {
|
|
666
|
+
let t = pt(e);
|
|
667
|
+
a.appendChild(t.dom), o.destroy = () => {
|
|
668
|
+
t.destroy?.();
|
|
669
|
+
};
|
|
670
|
+
} else a.appendChild(n.dom);
|
|
671
|
+
if (e.props.caption) {
|
|
672
|
+
let t = document.createElement("figcaption");
|
|
673
|
+
t.className = "bn-file-caption", t.textContent = e.props.caption, a.appendChild(t);
|
|
674
|
+
}
|
|
675
|
+
return o;
|
|
676
|
+
}, W = (e, t) => {
|
|
677
|
+
let n = document.createElement("figure"), r = document.createElement("figcaption");
|
|
678
|
+
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
679
|
+
}, G = (e, t) => {
|
|
680
|
+
let n = document.createElement("div"), r = document.createElement("p");
|
|
681
|
+
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
682
|
+
}, K = (e) => ({ url: e.src || void 0 }), mt = "<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>", ht = k((e) => ({
|
|
683
|
+
type: "audio",
|
|
684
|
+
propSchema: {
|
|
685
|
+
backgroundColor: z.backgroundColor,
|
|
686
|
+
name: { default: "" },
|
|
687
|
+
url: { default: "" },
|
|
688
|
+
caption: { default: "" },
|
|
689
|
+
showPreview: { default: !0 }
|
|
690
|
+
},
|
|
691
|
+
content: "none"
|
|
692
|
+
})), gt = (e = {}) => (e) => {
|
|
693
|
+
if (e.tagName === "AUDIO") {
|
|
694
|
+
if (e.closest("figure")) return;
|
|
695
|
+
let { backgroundColor: t } = B(e);
|
|
696
|
+
return {
|
|
697
|
+
...K(e),
|
|
698
|
+
backgroundColor: t
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
if (e.tagName === "FIGURE") {
|
|
702
|
+
let t = H(e, "audio");
|
|
703
|
+
if (!t) return;
|
|
704
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = B(e);
|
|
705
|
+
return {
|
|
706
|
+
...K(n),
|
|
707
|
+
backgroundColor: i,
|
|
708
|
+
caption: r
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
}, _t = (e = {}) => (t, n) => {
|
|
712
|
+
let r = document.createElement("div");
|
|
713
|
+
r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>";
|
|
714
|
+
let i = document.createElement("audio");
|
|
715
|
+
return i.className = "bn-audio", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
716
|
+
i.src = e;
|
|
717
|
+
}) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1, U(t, n, { dom: i }, r.firstElementChild);
|
|
718
|
+
}, vt = (e = {}) => (e, t) => {
|
|
719
|
+
if (!e.props.url) return { dom: document.createElement("audio") };
|
|
720
|
+
let n;
|
|
721
|
+
return e.props.showPreview ? (n = document.createElement("audio"), n.src = e.props.url) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? W(n, e.props.caption) : G(n, e.props.caption) : { dom: n };
|
|
722
|
+
}, yt = A(ht, (e) => ({
|
|
723
|
+
meta: { fileBlockAccept: ["audio/*"] },
|
|
724
|
+
parse: gt(e),
|
|
725
|
+
render: _t(e),
|
|
726
|
+
toExternalHTML: vt(e),
|
|
727
|
+
runsBefore: ["file"]
|
|
728
|
+
})), bt = (e) => {
|
|
729
|
+
{
|
|
730
|
+
if (e.tagName !== "PRE" || e.childElementCount !== 1 || e.firstElementChild?.tagName !== "CODE") return;
|
|
731
|
+
let t = e.firstElementChild;
|
|
732
|
+
return { language: t.getAttribute("data-language") || t.className.split(" ").find((e) => e.startsWith("language-"))?.replace("language-", "") };
|
|
733
|
+
}
|
|
734
|
+
}, xt = ({ el: e, schema: t }, n) => {
|
|
735
|
+
let r = S.fromSchema(t), i = e.firstElementChild;
|
|
736
|
+
return r.parse(i, {
|
|
737
|
+
preserveWhitespace: "full",
|
|
738
|
+
topNode: t.nodes[n].create()
|
|
739
|
+
}).content;
|
|
740
|
+
}, St = (e) => {
|
|
741
|
+
let t = document.createElement("pre"), n = document.createElement("code");
|
|
742
|
+
return n.className = `language-${e.props.language}`, n.dataset.language = e.props.language, t.appendChild(n), {
|
|
743
|
+
dom: t,
|
|
744
|
+
contentDOM: n
|
|
745
|
+
};
|
|
746
|
+
};
|
|
747
|
+
// src/blocks/Code/CodeBlockOptions.ts
|
|
748
|
+
function Ct(e, t) {
|
|
749
|
+
let n = t.trim().toLowerCase();
|
|
750
|
+
return Object.entries(e.supportedLanguages ?? {}).find(([e, { aliases: t }]) => e.toLowerCase() === n || t?.some((e) => e.toLowerCase() === n))?.[0];
|
|
751
|
+
}
|
|
752
|
+
// src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.ts
|
|
753
|
+
var wt = (e) => (t, n) => y({
|
|
754
|
+
key: t,
|
|
755
|
+
keyboardShortcuts: {
|
|
756
|
+
"Mod-Alt-c": ({ editor: e }) => {
|
|
757
|
+
let t = e.getTextCursorPosition();
|
|
758
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
759
|
+
type: n,
|
|
760
|
+
props: {}
|
|
761
|
+
}), !0);
|
|
762
|
+
},
|
|
763
|
+
Delete: ({ editor: e }) => e.transact((t) => {
|
|
764
|
+
let { block: r } = e.getTextCursorPosition();
|
|
765
|
+
if (r.type !== n) return !1;
|
|
766
|
+
let { $from: i } = t.selection;
|
|
767
|
+
return !i.parent.textContent && (e.removeBlocks([r]), !0);
|
|
768
|
+
}),
|
|
769
|
+
Tab: ({ editor: t }) => e.indentLineWithTab !== !1 && t.transact((e) => {
|
|
770
|
+
let { block: r } = t.getTextCursorPosition();
|
|
771
|
+
return r.type === n && (e.insertText(" "), !0);
|
|
772
|
+
}),
|
|
773
|
+
Enter: ({ editor: e }) => e.transact((t) => {
|
|
774
|
+
let { block: r, nextBlock: i } = e.getTextCursorPosition();
|
|
775
|
+
if (r.type !== n) return !1;
|
|
776
|
+
let { $from: a } = t.selection, o = a.parentOffset === a.parent.nodeSize - 2, s = a.parent.textContent.endsWith("\n\n");
|
|
777
|
+
if (o && s) {
|
|
778
|
+
if (t.delete(a.pos - 2, a.pos), i) return e.setTextCursorPosition(i, "start"), !0;
|
|
779
|
+
let [n] = e.insertBlocks([{ type: "paragraph" }], r, "after");
|
|
780
|
+
return e.setTextCursorPosition(n, "start"), !0;
|
|
781
|
+
}
|
|
782
|
+
return t.insertText("\n"), !0;
|
|
783
|
+
}),
|
|
784
|
+
"Shift-Enter": ({ editor: e }) => e.transact(() => {
|
|
785
|
+
let { block: t } = e.getTextCursorPosition();
|
|
786
|
+
if (t.type !== n) return !1;
|
|
787
|
+
let [r] = e.insertBlocks([{ type: "paragraph" }], t, "after");
|
|
788
|
+
return e.setTextCursorPosition(r, "start"), !0;
|
|
789
|
+
})
|
|
790
|
+
},
|
|
791
|
+
inputRules: [{
|
|
792
|
+
find: /^```(.*?)\s$/,
|
|
793
|
+
replace: ({ match: t }) => {
|
|
794
|
+
let r = t[1].trim();
|
|
795
|
+
return {
|
|
796
|
+
type: n,
|
|
797
|
+
props: { language: { language: Ct(e, r) ?? (r || e.defaultLanguage || "text") }.language },
|
|
798
|
+
content: []
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
}]
|
|
802
|
+
}), Tt = (e, t, n, r) => {
|
|
803
|
+
if (!(n in r)) throw Error(`Language ${n} is not supported.`);
|
|
804
|
+
let i = document.createElement("select");
|
|
805
|
+
Object.entries(r).forEach(([e, { name: t }]) => {
|
|
806
|
+
let n = document.createElement("option");
|
|
807
|
+
n.value = e, n.text = t, i.appendChild(n);
|
|
808
|
+
}), i.value = n;
|
|
809
|
+
let a = (n) => {
|
|
810
|
+
t.isEditable && t.updateBlock(e.id, { props: { language: n.target.value } });
|
|
811
|
+
};
|
|
812
|
+
t.isEditable ? i.addEventListener("change", a) : i.disabled = !0;
|
|
813
|
+
let o = document.createElement("div");
|
|
814
|
+
return o.contentEditable = "false", o.appendChild(i), {
|
|
815
|
+
dom: o,
|
|
816
|
+
destroy: () => i.removeEventListener("change", a)
|
|
817
|
+
};
|
|
818
|
+
}, Et = (e, t, n) => {
|
|
819
|
+
let r = document.createElement("pre"), i = document.createElement("code");
|
|
820
|
+
r.appendChild(i);
|
|
821
|
+
let a = document.createDocumentFragment(), o;
|
|
822
|
+
return n && Object.keys(n.supportedLanguages).length > 1 && (o = Tt(e, t, n.selectedLanguage, n.supportedLanguages), a.appendChild(o.dom)), a.appendChild(r), {
|
|
823
|
+
dom: a,
|
|
824
|
+
contentDOM: i,
|
|
825
|
+
destroy: () => {
|
|
826
|
+
o?.destroy();
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
}, Dt = "code-block-keyboard-shortcuts", Ot = k(({ defaultLanguage: e = "text" }) => ({
|
|
830
|
+
type: "codeBlock",
|
|
831
|
+
propSchema: { language: { default: e } },
|
|
832
|
+
content: "plain"
|
|
833
|
+
})), kt = A(Ot, (e) => ({
|
|
834
|
+
meta: {
|
|
835
|
+
code: !0,
|
|
836
|
+
defining: !0,
|
|
837
|
+
isolating: !1,
|
|
838
|
+
highlight: (e) => e.props.language
|
|
839
|
+
},
|
|
840
|
+
parse: (e) => bt(e),
|
|
841
|
+
parseContent: (e) => xt(e, "codeBlock"),
|
|
842
|
+
render: (t, n) => Et(t, n, e.supportedLanguages && {
|
|
843
|
+
selectedLanguage: t.props.language,
|
|
844
|
+
supportedLanguages: e.supportedLanguages
|
|
845
|
+
}),
|
|
846
|
+
toExternalHTML: (e) => St(e)
|
|
847
|
+
}), (e) => [wt(e)(Dt, "codeBlock")]), At = k(() => ({
|
|
848
|
+
type: "divider",
|
|
849
|
+
propSchema: {},
|
|
850
|
+
content: "none"
|
|
851
|
+
})), jt = A(At, {
|
|
852
|
+
meta: { isolating: !1 },
|
|
853
|
+
parse(e) {
|
|
854
|
+
if (e.tagName === "HR") return {};
|
|
855
|
+
},
|
|
856
|
+
render() {
|
|
857
|
+
return { dom: document.createElement("hr") };
|
|
858
|
+
}
|
|
859
|
+
}, [y({
|
|
860
|
+
key: "divider-block-shortcuts",
|
|
861
|
+
inputRules: [{
|
|
862
|
+
find: /* @__PURE__ */ RegExp("^---$"),
|
|
863
|
+
replace() {
|
|
864
|
+
return {
|
|
865
|
+
type: "divider",
|
|
866
|
+
props: {},
|
|
867
|
+
content: []
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
}]
|
|
871
|
+
})]), Mt = (e) => ({ url: e.src || void 0 }), Nt = k(() => ({
|
|
872
|
+
type: "file",
|
|
873
|
+
propSchema: {
|
|
874
|
+
backgroundColor: z.backgroundColor,
|
|
875
|
+
name: { default: "" },
|
|
876
|
+
url: { default: "" },
|
|
877
|
+
caption: { default: "" }
|
|
878
|
+
},
|
|
879
|
+
content: "none"
|
|
880
|
+
})), Pt = () => (e) => {
|
|
881
|
+
if (e.tagName === "EMBED") {
|
|
882
|
+
if (e.closest("figure")) return;
|
|
883
|
+
let { backgroundColor: t } = B(e);
|
|
884
|
+
return {
|
|
885
|
+
...Mt(e),
|
|
886
|
+
backgroundColor: t
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
if (e.tagName === "FIGURE") {
|
|
890
|
+
let t = H(e, "embed");
|
|
891
|
+
if (!t) return;
|
|
892
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = B(e);
|
|
893
|
+
return {
|
|
894
|
+
...Mt(n),
|
|
895
|
+
backgroundColor: i,
|
|
896
|
+
caption: r
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
}, Ft = A(Nt, {
|
|
900
|
+
meta: { fileBlockAccept: ["*/*"] },
|
|
901
|
+
parse: Pt(),
|
|
902
|
+
render(e, t) {
|
|
903
|
+
return U(e, t);
|
|
904
|
+
},
|
|
905
|
+
toExternalHTML(e) {
|
|
906
|
+
if (!e.props.url) return { dom: document.createElement("embed") };
|
|
907
|
+
let t = document.createElement("a");
|
|
908
|
+
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? G(t, e.props.caption) : { dom: t };
|
|
909
|
+
}
|
|
910
|
+
});
|
|
911
|
+
// src/blocks/getDetailsContent.ts
|
|
912
|
+
function It(e, t, n) {
|
|
913
|
+
let r = b.fromSchema(t), i = e.querySelector(":scope > summary"), a;
|
|
914
|
+
if (i) {
|
|
915
|
+
let e = i.cloneNode(!0);
|
|
916
|
+
h(e), a = r.parse(e, {
|
|
917
|
+
topNode: t.nodes.paragraph.create(),
|
|
918
|
+
preserveWhitespace: !0
|
|
919
|
+
}).content;
|
|
920
|
+
} else a = x.empty;
|
|
921
|
+
let o = document.createElement("div");
|
|
922
|
+
o.setAttribute("data-node-type", "blockGroup");
|
|
923
|
+
let s = !1;
|
|
924
|
+
for (let t of Array.from(e.childNodes)) t.tagName !== "SUMMARY" && (t.nodeType !== 3 || t.textContent?.trim()) && (s = !0, o.appendChild(t.cloneNode(!0)));
|
|
925
|
+
let c = t.nodes[n].create({}, a);
|
|
926
|
+
if (!s) return c.content;
|
|
927
|
+
let l = r.parse(o, { topNode: t.nodes.blockGroup.create() });
|
|
928
|
+
return l.content.size > 0 ? c.content.addToEnd(l) : c.content;
|
|
929
|
+
}
|
|
930
|
+
// src/blocks/ToggleWrapper/createToggleFrame.ts
|
|
931
|
+
var q = {
|
|
932
|
+
set: (e, t) => window.localStorage.setItem(`toggle-${e.id}`, t ? "true" : "false"),
|
|
933
|
+
get: (e) => window.localStorage.getItem(`toggle-${e.id}`) === "true"
|
|
934
|
+
}, Lt = "<svg aria-hidden=\"true\" 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>";
|
|
935
|
+
function J(e) {
|
|
936
|
+
return q.get(e);
|
|
937
|
+
}
|
|
938
|
+
function Y(e, t, n = q) {
|
|
939
|
+
let r = document.createElement("div");
|
|
940
|
+
r.className = "bn-toggle-wrapper bn-toggle-frame";
|
|
941
|
+
let i = document.createElement("button");
|
|
942
|
+
i.className = "bn-toggle-button", i.type = "button", i.setAttribute("aria-label", t.dictionary.toggle_blocks.toggle_button), i.innerHTML = Lt, i.addEventListener("mousedown", (e) => e.preventDefault());
|
|
943
|
+
let a = document.createElement("div");
|
|
944
|
+
a.className = "bn-toggle-slot";
|
|
945
|
+
let o = document.createElement("button");
|
|
946
|
+
o.className = "bn-toggle-add-block-button", o.type = "button", o.textContent = t.dictionary.toggle_blocks.add_block_button, o.addEventListener("mousedown", (e) => e.preventDefault()), o.addEventListener("click", () => {
|
|
947
|
+
t.transact(() => {
|
|
948
|
+
let n = t.updateBlock(e.id, { children: [{}] });
|
|
949
|
+
t.setTextCursorPosition(n.children[0], "end"), t.focus();
|
|
950
|
+
});
|
|
951
|
+
}), r.append(i, a);
|
|
952
|
+
let s = e.children.length, c = n.get(e);
|
|
953
|
+
function l() {
|
|
954
|
+
i.setAttribute("aria-expanded", String(c));
|
|
955
|
+
let e = c && s === 0 && t.isEditable;
|
|
956
|
+
e && !o.isConnected ? r.append(o) : e || o.remove();
|
|
957
|
+
}
|
|
958
|
+
return i.addEventListener("click", () => {
|
|
959
|
+
c = !c, n.set(e, c), l();
|
|
960
|
+
}), l(), {
|
|
961
|
+
dom: r,
|
|
962
|
+
slot: a,
|
|
963
|
+
update(e) {
|
|
964
|
+
let t = e.children.length, r = c;
|
|
965
|
+
return t > s && (c = !0), c !== r && n.set(e, c), s = t, l(), !0;
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
// src/blocks/Heading/block.ts
|
|
970
|
+
var Rt = [
|
|
971
|
+
1,
|
|
972
|
+
2,
|
|
973
|
+
3,
|
|
974
|
+
4,
|
|
975
|
+
5,
|
|
976
|
+
6
|
|
977
|
+
];
|
|
978
|
+
function zt(e, t) {
|
|
979
|
+
return t ? {
|
|
980
|
+
level: e,
|
|
981
|
+
isToggleable: !1
|
|
982
|
+
} : { level: e };
|
|
983
|
+
}
|
|
984
|
+
var Bt = (e, t) => ({ editor: n }) => {
|
|
985
|
+
let r = n.getTextCursorPosition();
|
|
986
|
+
return n.schema.blockSchema[r.block.type].content === "inline" && (n.updateBlock(r.block, {
|
|
987
|
+
type: "heading",
|
|
988
|
+
props: zt(e, t)
|
|
989
|
+
}), !0);
|
|
990
|
+
}, Vt = k(({ defaultLevel: e = 1, levels: t = Rt, allowToggleHeadings: n = !0 } = {}) => ({
|
|
991
|
+
type: "heading",
|
|
992
|
+
propSchema: {
|
|
993
|
+
...z,
|
|
994
|
+
level: {
|
|
995
|
+
default: e,
|
|
996
|
+
values: t
|
|
997
|
+
},
|
|
998
|
+
...n ? { isToggleable: {
|
|
999
|
+
default: !1,
|
|
1000
|
+
optional: !0
|
|
1001
|
+
} } : {}
|
|
1002
|
+
},
|
|
1003
|
+
content: "inline"
|
|
1004
|
+
})), Ht = A(Vt, ({ allowToggleHeadings: e = !0 } = {}) => ({
|
|
1005
|
+
meta: {
|
|
1006
|
+
isolating: !1,
|
|
1007
|
+
dropsIntoChildren: (t) => e && t.props.isToggleable === !0
|
|
1008
|
+
},
|
|
1009
|
+
experimental_keyboard: e ? (e) => {
|
|
1010
|
+
if (!e.props.isToggleable) return {};
|
|
1011
|
+
let t = J(e);
|
|
1012
|
+
return {
|
|
1013
|
+
resetsTo: {
|
|
1014
|
+
type: "heading",
|
|
1015
|
+
props: { isToggleable: !1 }
|
|
1016
|
+
},
|
|
1017
|
+
emptyEnterResets: !0,
|
|
1018
|
+
enter: t ? "into-children" : "split",
|
|
1019
|
+
splitKeepsChildren: !t,
|
|
1020
|
+
emptyChildEnter: t ? "stay" : "outdent"
|
|
1021
|
+
};
|
|
1022
|
+
} : void 0,
|
|
1023
|
+
parse(t) {
|
|
1024
|
+
if (e && t.tagName === "DETAILS") {
|
|
1025
|
+
let e = t.querySelector(":scope > summary");
|
|
1026
|
+
if (!e) return;
|
|
1027
|
+
let n = e.querySelector("h1, h2, h3, h4, h5, h6");
|
|
1028
|
+
return n ? {
|
|
1029
|
+
...B(n),
|
|
1030
|
+
level: parseInt(n.tagName[1]),
|
|
1031
|
+
isToggleable: !0
|
|
1032
|
+
} : void 0;
|
|
1033
|
+
}
|
|
1034
|
+
let n;
|
|
1035
|
+
switch (t.tagName) {
|
|
1036
|
+
case "H1":
|
|
1037
|
+
n = 1;
|
|
1038
|
+
break;
|
|
1039
|
+
case "H2":
|
|
1040
|
+
n = 2;
|
|
1041
|
+
break;
|
|
1042
|
+
case "H3":
|
|
1043
|
+
n = 3;
|
|
1044
|
+
break;
|
|
1045
|
+
case "H4":
|
|
1046
|
+
n = 4;
|
|
1047
|
+
break;
|
|
1048
|
+
case "H5":
|
|
1049
|
+
n = 5;
|
|
1050
|
+
break;
|
|
1051
|
+
case "H6":
|
|
1052
|
+
n = 6;
|
|
1053
|
+
break;
|
|
1054
|
+
default: return;
|
|
1055
|
+
}
|
|
1056
|
+
return {
|
|
1057
|
+
...B(t),
|
|
1058
|
+
level: n
|
|
1059
|
+
};
|
|
1060
|
+
},
|
|
1061
|
+
...e ? { parseContent: ({ el: e, schema: t }) => {
|
|
1062
|
+
if (e.tagName === "DETAILS") return It(e, t, "heading");
|
|
1063
|
+
} } : {},
|
|
1064
|
+
runsBefore: ["toggleListItem"],
|
|
1065
|
+
render(e) {
|
|
1066
|
+
let t = document.createElement(`h${e.props.level}`);
|
|
1067
|
+
return {
|
|
1068
|
+
dom: t,
|
|
1069
|
+
contentDOM: t
|
|
1070
|
+
};
|
|
1071
|
+
},
|
|
1072
|
+
renderFrame(t, n) {
|
|
1073
|
+
if (!e || !t.props.isToggleable) return;
|
|
1074
|
+
let r = Y(t, n);
|
|
1075
|
+
return {
|
|
1076
|
+
...r,
|
|
1077
|
+
update: (e) => !!e.props.isToggleable && r.update(e)
|
|
1078
|
+
};
|
|
1079
|
+
},
|
|
1080
|
+
toExternalHTML(t) {
|
|
1081
|
+
let n = document.createElement(`h${t.props.level}`);
|
|
1082
|
+
if (V(t.props, n), e && t.props.isToggleable) {
|
|
1083
|
+
let e = document.createElement("details");
|
|
1084
|
+
e.setAttribute("open", "");
|
|
1085
|
+
let t = document.createElement("summary");
|
|
1086
|
+
return t.appendChild(n), e.appendChild(t), {
|
|
1087
|
+
dom: e,
|
|
1088
|
+
contentDOM: n,
|
|
1089
|
+
childrenDOM: e
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
return {
|
|
1093
|
+
dom: n,
|
|
1094
|
+
contentDOM: n
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
}), ({ levels: e = Rt, allowToggleHeadings: t = !0 } = {}) => [y({
|
|
1098
|
+
key: "heading-shortcuts",
|
|
1099
|
+
keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`, Bt(e, t)]) ?? []),
|
|
1100
|
+
inputRules: e.map((e) => ({
|
|
1101
|
+
find: RegExp(`^(#{${e}})\\s$`),
|
|
1102
|
+
replace({ match: e }) {
|
|
1103
|
+
return {
|
|
1104
|
+
type: "heading",
|
|
1105
|
+
props: zt(e[1].length, t)
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
}))
|
|
1109
|
+
})]), Ut = (e, t, n, r, i) => {
|
|
1110
|
+
let { dom: a, destroy: o } = U(e, t, n, i), s = a;
|
|
1111
|
+
s.style.position = "relative", e.props.url && e.props.showPreview && (e.props.previewWidth ? s.style.width = `${e.props.previewWidth}px` : s.style.width = "fit-content");
|
|
1112
|
+
let c = document.createElement("div");
|
|
1113
|
+
c.className = "bn-resize-handle", c.style.left = "4px", c.style.display = "none", r.appendChild(c);
|
|
1114
|
+
let l = document.createElement("div");
|
|
1115
|
+
l.className = "bn-resize-handle", l.style.right = "4px", l.style.display = "none", r.appendChild(l);
|
|
1116
|
+
let u = document.createElement("div");
|
|
1117
|
+
u.style.position = "absolute", u.style.height = "100%", u.style.width = "100%";
|
|
1118
|
+
let d, f = e.props.previewWidth, p = (n) => {
|
|
1119
|
+
if (!d) {
|
|
1120
|
+
t.isEditable || (c.style.display = "none", l.style.display = "none");
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
let r, i = "touches" in n ? n.touches[0].clientX : n.clientX;
|
|
1124
|
+
r = e.props.textAlignment === "center" ? d.handleUsed === "left" ? d.initialWidth + (d.initialClientX - i) * 2 : d.initialWidth + (i - d.initialClientX) * 2 : d.handleUsed === "left" ? d.initialWidth + d.initialClientX - i : d.initialWidth + i - d.initialClientX, f = Math.min(Math.max(r, 64), t.domElement?.firstElementChild?.clientWidth || Number.MAX_VALUE), s.style.width = `${f}px`;
|
|
1125
|
+
}, m = (n) => {
|
|
1126
|
+
n.target && s.contains(n.target) && t.isEditable || (c.style.display = "none", l.style.display = "none"), d && (d = void 0, s.contains(u) && s.removeChild(u), t.updateBlock(e, { props: { previewWidth: f } }));
|
|
1127
|
+
}, h = () => {
|
|
1128
|
+
t.isEditable && (c.style.display = "", l.style.display = "");
|
|
1129
|
+
}, g = (e) => {
|
|
1130
|
+
e.relatedTarget !== c && e.relatedTarget !== l && (d || t.isEditable && (c.style.display = "none", l.style.display = "none"));
|
|
1131
|
+
}, _ = (e) => {
|
|
1132
|
+
e.preventDefault(), s.contains(u) || s.appendChild(u);
|
|
1133
|
+
let t = "touches" in e ? e.touches[0].clientX : e.clientX;
|
|
1134
|
+
d = {
|
|
1135
|
+
handleUsed: "left",
|
|
1136
|
+
initialWidth: s.clientWidth,
|
|
1137
|
+
initialClientX: t
|
|
1138
|
+
};
|
|
1139
|
+
}, v = (e) => {
|
|
1140
|
+
e.preventDefault(), s.contains(u) || s.appendChild(u);
|
|
1141
|
+
let t = "touches" in e ? e.touches[0].clientX : e.clientX;
|
|
1142
|
+
d = {
|
|
1143
|
+
handleUsed: "right",
|
|
1144
|
+
initialWidth: s.clientWidth,
|
|
1145
|
+
initialClientX: t
|
|
1146
|
+
};
|
|
1147
|
+
};
|
|
1148
|
+
return window.addEventListener("mousemove", p), window.addEventListener("touchmove", p), window.addEventListener("mouseup", m), window.addEventListener("touchend", m), s.addEventListener("mouseenter", h), s.addEventListener("mouseleave", g), c.addEventListener("mousedown", _), c.addEventListener("touchstart", _), l.addEventListener("mousedown", v), l.addEventListener("touchstart", v), {
|
|
1149
|
+
dom: s,
|
|
1150
|
+
destroy: () => {
|
|
1151
|
+
o?.(), window.removeEventListener("mousemove", p), window.removeEventListener("touchmove", p), window.removeEventListener("mouseup", m), window.removeEventListener("touchend", m), s.removeEventListener("mouseenter", h), s.removeEventListener("mouseleave", g), c.removeEventListener("mousedown", _), c.removeEventListener("touchstart", _), l.removeEventListener("mousedown", v), l.removeEventListener("touchstart", v);
|
|
1152
|
+
}
|
|
1153
|
+
};
|
|
1154
|
+
}, Wt = (e) => ({
|
|
1155
|
+
url: e.src || void 0,
|
|
1156
|
+
previewWidth: e.width || void 0,
|
|
1157
|
+
name: e.alt || void 0
|
|
1158
|
+
}), Gt = "<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>", Kt = k((e = {}) => ({
|
|
1159
|
+
type: "image",
|
|
1160
|
+
propSchema: {
|
|
1161
|
+
textAlignment: z.textAlignment,
|
|
1162
|
+
backgroundColor: z.backgroundColor,
|
|
1163
|
+
name: { default: "" },
|
|
1164
|
+
url: { default: "" },
|
|
1165
|
+
caption: { default: "" },
|
|
1166
|
+
showPreview: { default: !0 },
|
|
1167
|
+
previewWidth: {
|
|
1168
|
+
default: void 0,
|
|
1169
|
+
type: "number"
|
|
1170
|
+
}
|
|
1171
|
+
},
|
|
1172
|
+
content: "none"
|
|
1173
|
+
})), qt = (e = {}) => (e) => {
|
|
1174
|
+
if (e.tagName === "IMG") {
|
|
1175
|
+
if (e.closest("figure")) return;
|
|
1176
|
+
let { backgroundColor: t } = B(e);
|
|
1177
|
+
return {
|
|
1178
|
+
...Wt(e),
|
|
1179
|
+
backgroundColor: t
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
if (e.tagName === "FIGURE") {
|
|
1183
|
+
let t = H(e, "img");
|
|
1184
|
+
if (!t) return;
|
|
1185
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = B(e);
|
|
1186
|
+
return {
|
|
1187
|
+
...Wt(n),
|
|
1188
|
+
backgroundColor: i,
|
|
1189
|
+
caption: r
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
}, Jt = (e = {}) => (t, n) => {
|
|
1193
|
+
let r = document.createElement("div");
|
|
1194
|
+
r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>";
|
|
1195
|
+
let i = document.createElement("div");
|
|
1196
|
+
i.className = "bn-visual-media-wrapper";
|
|
1197
|
+
let a = document.createElement("img");
|
|
1198
|
+
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
1199
|
+
a.src = e;
|
|
1200
|
+
}) : a.src = t.props.url, a.alt = t.props.name || "", a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a), Ut(t, n, { dom: i }, i, r.firstElementChild);
|
|
1201
|
+
}, Yt = (e = {}) => (e, t) => {
|
|
1202
|
+
if (!e.props.url) return { dom: document.createElement("img") };
|
|
1203
|
+
let n;
|
|
1204
|
+
return e.props.showPreview ? (n = document.createElement("img"), n.src = e.props.url, n.alt = e.props.name || "", e.props.previewWidth && (n.width = e.props.previewWidth)) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? W(n, e.props.caption) : G(n, e.props.caption) : { dom: n };
|
|
1205
|
+
}, Xt = A(Kt, (e) => ({
|
|
1206
|
+
meta: { fileBlockAccept: ["image/*"] },
|
|
1207
|
+
parse: qt(e),
|
|
1208
|
+
render: Jt(e),
|
|
1209
|
+
toExternalHTML: Yt(e),
|
|
1210
|
+
runsBefore: ["file"]
|
|
1211
|
+
}));
|
|
1212
|
+
// src/blocks/ListItem/getListItemContent.ts
|
|
1213
|
+
function X(e, t, n) {
|
|
1214
|
+
let r = b.fromSchema(t), i = e, a = document.createElement("div");
|
|
1215
|
+
a.setAttribute("data-node-type", "blockGroup");
|
|
1216
|
+
for (let e of Array.from(i.childNodes)) a.appendChild(e.cloneNode(!0));
|
|
1217
|
+
let o = r.parse(a, { topNode: t.nodes.blockGroup.create() });
|
|
1218
|
+
o.firstChild?.firstChild?.type.name === "checkListItem" && (o = o.copy(o.content.cut(o.firstChild.firstChild.nodeSize + 2)));
|
|
1219
|
+
let s = o.firstChild, c = s?.firstChild;
|
|
1220
|
+
if (!s || !c?.isTextblock) return x.from(o);
|
|
1221
|
+
let l = t.nodes[n].create({}, c.content), u = (s.maybeChild(1)?.content ?? x.empty).append(o.content.cut(s.nodeSize));
|
|
1222
|
+
if (u.size > 0) {
|
|
1223
|
+
let e = o.copy(u);
|
|
1224
|
+
return l.content.addToEnd(e);
|
|
1225
|
+
}
|
|
1226
|
+
return l.content;
|
|
1227
|
+
}
|
|
1228
|
+
// src/blocks/ListItem/BulletListItem/block.ts
|
|
1229
|
+
var Zt = k(() => ({
|
|
1230
|
+
type: "bulletListItem",
|
|
1231
|
+
propSchema: { ...z },
|
|
1232
|
+
content: "inline"
|
|
1233
|
+
})), Qt = A(Zt, {
|
|
1234
|
+
experimental_keyboard: {
|
|
1235
|
+
splitKeepsType: !0,
|
|
1236
|
+
emptyEnterResets: !0
|
|
1237
|
+
},
|
|
1238
|
+
meta: { isolating: !1 },
|
|
1239
|
+
parse(e) {
|
|
1240
|
+
if (e.tagName !== "LI") return;
|
|
1241
|
+
let t = e.parentElement;
|
|
1242
|
+
if (t === null || t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL" || !e.closest("ul, ol")) return B(e);
|
|
1243
|
+
},
|
|
1244
|
+
parseContent: ({ el: e, schema: t }) => X(e, t, "bulletListItem"),
|
|
1245
|
+
render() {
|
|
1246
|
+
let e = document.createElement("p");
|
|
1247
|
+
return {
|
|
1248
|
+
dom: e,
|
|
1249
|
+
contentDOM: e
|
|
1250
|
+
};
|
|
1251
|
+
},
|
|
1252
|
+
toExternalHTML(e) {
|
|
1253
|
+
let t = document.createElement("li"), n = document.createElement("p");
|
|
1254
|
+
return V(e.props, t), t.appendChild(n), {
|
|
1255
|
+
dom: t,
|
|
1256
|
+
contentDOM: n
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
}, [y({
|
|
1260
|
+
key: "bullet-list-item-shortcuts",
|
|
1261
|
+
keyboardShortcuts: { "Mod-Shift-8": ({ editor: e }) => {
|
|
1262
|
+
let t = e.getTextCursorPosition();
|
|
1263
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
1264
|
+
type: "bulletListItem",
|
|
1265
|
+
props: {}
|
|
1266
|
+
}), !0);
|
|
1267
|
+
} },
|
|
1268
|
+
inputRules: [{
|
|
1269
|
+
find: /^\s?[-+*]\s$/,
|
|
1270
|
+
replace({ editor: e }) {
|
|
1271
|
+
if (d(e.prosemirrorState).blockNoteType !== "heading") return {
|
|
1272
|
+
type: "bulletListItem",
|
|
1273
|
+
props: {}
|
|
1274
|
+
};
|
|
1275
|
+
}
|
|
1276
|
+
}]
|
|
1277
|
+
})]), $t = k(() => ({
|
|
1278
|
+
type: "checkListItem",
|
|
1279
|
+
propSchema: {
|
|
1280
|
+
...z,
|
|
1281
|
+
checked: {
|
|
1282
|
+
default: !1,
|
|
1283
|
+
type: "boolean"
|
|
1284
|
+
}
|
|
1285
|
+
},
|
|
1286
|
+
content: "inline"
|
|
1287
|
+
})), en = A($t, {
|
|
1288
|
+
experimental_keyboard: {
|
|
1289
|
+
splitKeepsType: !0,
|
|
1290
|
+
emptyEnterResets: !0
|
|
1291
|
+
},
|
|
1292
|
+
meta: { isolating: !1 },
|
|
1293
|
+
parse(e) {
|
|
1294
|
+
if (e.tagName === "input") return e.closest("[data-content-type]") || e.closest("li") ? void 0 : e.type === "checkbox" ? { checked: e.checked } : void 0;
|
|
1295
|
+
if (e.tagName !== "LI") return;
|
|
1296
|
+
let t = e.parentElement;
|
|
1297
|
+
if (t !== null && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL")) {
|
|
1298
|
+
let t = e.querySelector("input[type=checkbox]") || null;
|
|
1299
|
+
return t === null ? void 0 : {
|
|
1300
|
+
...B(e),
|
|
1301
|
+
checked: t.checked
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
},
|
|
1305
|
+
parseContent: ({ el: e, schema: t }) => X(e, t, "checkListItem"),
|
|
1306
|
+
render(e, t) {
|
|
1307
|
+
let n = document.createDocumentFragment(), r = document.createElement("input");
|
|
1308
|
+
r.type = "checkbox", r.checked = e.props.checked, e.props.checked && r.setAttribute("checked", ""), r.disabled = !t.isEditable, r.addEventListener("change", () => {
|
|
1309
|
+
t.isEditable && t.updateBlock(e, { props: { checked: !e.props.checked } });
|
|
1310
|
+
});
|
|
1311
|
+
let i = document.createElement("p"), a = document.createElement("div");
|
|
1312
|
+
return a.contentEditable = "false", a.appendChild(r), n.appendChild(a), n.appendChild(i), {
|
|
1313
|
+
dom: n,
|
|
1314
|
+
contentDOM: i
|
|
1315
|
+
};
|
|
1316
|
+
},
|
|
1317
|
+
toExternalHTML(e) {
|
|
1318
|
+
let t = document.createElement("li"), n = document.createElement("input");
|
|
1319
|
+
n.type = "checkbox", n.checked = e.props.checked, e.props.checked && n.setAttribute("checked", "");
|
|
1320
|
+
let r = document.createElement("p");
|
|
1321
|
+
return V(e.props, t), t.appendChild(n), t.appendChild(r), {
|
|
1322
|
+
dom: t,
|
|
1323
|
+
contentDOM: r
|
|
1324
|
+
};
|
|
1325
|
+
},
|
|
1326
|
+
runsBefore: ["bulletListItem"]
|
|
1327
|
+
}, [y({
|
|
1328
|
+
key: "check-list-item-shortcuts",
|
|
1329
|
+
keyboardShortcuts: { "Mod-Shift-9": ({ editor: e }) => {
|
|
1330
|
+
let t = e.getTextCursorPosition();
|
|
1331
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
1332
|
+
type: "checkListItem",
|
|
1333
|
+
props: {}
|
|
1334
|
+
}), !0);
|
|
1335
|
+
} },
|
|
1336
|
+
inputRules: [{
|
|
1337
|
+
find: /^\s?\[\s*\]\s$/,
|
|
1338
|
+
replace() {
|
|
1339
|
+
return {
|
|
1340
|
+
type: "checkListItem",
|
|
1341
|
+
props: { checked: !1 }
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
}, {
|
|
1345
|
+
find: /^\s?\[[Xx]\]\s$/,
|
|
1346
|
+
replace() {
|
|
1347
|
+
return {
|
|
1348
|
+
type: "checkListItem",
|
|
1349
|
+
props: { checked: !0 }
|
|
1350
|
+
};
|
|
1351
|
+
}
|
|
1352
|
+
}]
|
|
1353
|
+
})]);
|
|
1354
|
+
// src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts
|
|
1355
|
+
function tn(e, t, n, i) {
|
|
1356
|
+
let a = !!e.firstChild.attrs.start, o = r(e, t);
|
|
1357
|
+
if (!o.hasContent) throw Error("impossible");
|
|
1358
|
+
let s = n.doc.resolve(o.block.beforePos).nodeBefore, c = s ? i.get(s) : void 0;
|
|
1359
|
+
if (c !== void 0) {
|
|
1360
|
+
let t = c + 1;
|
|
1361
|
+
return i.set(e, t), {
|
|
1362
|
+
index: t,
|
|
1363
|
+
isFirst: !1,
|
|
1364
|
+
hasStart: a
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
let l = [{
|
|
1368
|
+
node: e,
|
|
1369
|
+
pos: t
|
|
1370
|
+
}], u = s, d = o.block.beforePos;
|
|
1371
|
+
for (; u && i.get(u) === void 0;) {
|
|
1372
|
+
let e = r(u, d - u.nodeSize);
|
|
1373
|
+
if (e.blockNoteType !== "numberedListItem") break;
|
|
1374
|
+
l.push({
|
|
1375
|
+
node: u,
|
|
1376
|
+
pos: d - u.nodeSize
|
|
1377
|
+
});
|
|
1378
|
+
let t = n.doc.resolve(e.block.beforePos).nodeBefore;
|
|
1379
|
+
d = e.block.beforePos, u = t;
|
|
1380
|
+
}
|
|
1381
|
+
let f, p, m = l[l.length - 1], h = r(m.node, m.pos);
|
|
1382
|
+
if (!h.hasContent) throw Error("impossible");
|
|
1383
|
+
let g = n.doc.resolve(h.block.beforePos).nodeBefore, _ = g ? i.get(g) : void 0;
|
|
1384
|
+
_ === void 0 ? (f = (m.node.firstChild.attrs.start || 1) - 1, p = !0) : (f = _, p = !1);
|
|
1385
|
+
for (let e = l.length - 1; e >= 0; e--) {
|
|
1386
|
+
let t = l[e];
|
|
1387
|
+
p && e < l.length - 1 && (p = !1), f++, i.set(t.node, f);
|
|
1388
|
+
}
|
|
1389
|
+
return {
|
|
1390
|
+
index: f,
|
|
1391
|
+
isFirst: l.length === 1 ? p || _ === void 0 : !1,
|
|
1392
|
+
hasStart: a
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
function nn(e, t) {
|
|
1396
|
+
let n = /* @__PURE__ */ new Map(), r = t.decorations.map(e.mapping, e.doc), i = e.changedRange() ?? {
|
|
1397
|
+
from: 0,
|
|
1398
|
+
to: e.doc.nodeSize - 2
|
|
1399
|
+
}, a = [], o = /* @__PURE__ */ new Set();
|
|
1400
|
+
e.doc.nodesBetween(i.from, e.doc.nodeSize - 2, (t, s, c) => {
|
|
1401
|
+
if (c && o.has(c)) return !1;
|
|
1402
|
+
if (t.type.name === "blockContainer" && t.firstChild.type.name === "numberedListItem") {
|
|
1403
|
+
let { index: l, isFirst: u, hasStart: d } = tn(t, s, e, n), f = e.doc.nodeAt(s + 1);
|
|
1404
|
+
if (r.find(s + 1, s + 1 + f.nodeSize, (e) => e.index === l && e.isFirst === u && e.hasStart === d).length === 0) a.push(ke.node(s + 1, s + 1 + f.nodeSize, { "data-index": l.toString() }, {
|
|
1405
|
+
index: l,
|
|
1406
|
+
isFirst: u,
|
|
1407
|
+
hasStart: d
|
|
1408
|
+
}));
|
|
1409
|
+
else if (s >= i.to && c) return o.add(c), !1;
|
|
1410
|
+
}
|
|
1411
|
+
});
|
|
1412
|
+
let s = a.flatMap((e) => r.find(e.from, e.to));
|
|
1413
|
+
return { decorations: r.remove(s).add(e.doc, a) };
|
|
1414
|
+
}
|
|
1415
|
+
var rn = () => new De({
|
|
1416
|
+
key: new Oe("numbered-list-indexing-decorations"),
|
|
1417
|
+
state: {
|
|
1418
|
+
init(e, t) {
|
|
1419
|
+
return nn(t.tr, { decorations: Ae.empty });
|
|
1420
|
+
},
|
|
1421
|
+
apply(e, t) {
|
|
1422
|
+
return !e.docChanged && t.decorations ? t : nn(e, t);
|
|
1423
|
+
}
|
|
1424
|
+
},
|
|
1425
|
+
props: { decorations(e) {
|
|
1426
|
+
return this.getState(e)?.decorations ?? Ae.empty;
|
|
1427
|
+
} }
|
|
1428
|
+
}), an = k(() => ({
|
|
1429
|
+
type: "numberedListItem",
|
|
1430
|
+
propSchema: {
|
|
1431
|
+
...z,
|
|
1432
|
+
start: {
|
|
1433
|
+
default: void 0,
|
|
1434
|
+
type: "number"
|
|
1435
|
+
}
|
|
1436
|
+
},
|
|
1437
|
+
content: "inline"
|
|
1438
|
+
})), on = A(an, {
|
|
1439
|
+
experimental_keyboard: {
|
|
1440
|
+
splitKeepsType: !0,
|
|
1441
|
+
emptyEnterResets: !0
|
|
1442
|
+
},
|
|
1443
|
+
meta: { isolating: !1 },
|
|
1444
|
+
parse(e) {
|
|
1445
|
+
if (e.tagName !== "LI") return;
|
|
1446
|
+
let t = e.parentElement;
|
|
1447
|
+
if (t !== null && (t.tagName === "OL" || t.tagName === "DIV" && t.parentElement?.tagName === "OL")) {
|
|
1448
|
+
let n = parseInt(t.getAttribute("start") || "1"), r = B(e);
|
|
1449
|
+
return e.previousElementSibling || n === 1 ? r : {
|
|
1450
|
+
...r,
|
|
1451
|
+
start: n
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1454
|
+
},
|
|
1455
|
+
parseContent: ({ el: e, schema: t }) => X(e, t, "numberedListItem"),
|
|
1456
|
+
render() {
|
|
1457
|
+
let e = document.createElement("p");
|
|
1458
|
+
return {
|
|
1459
|
+
dom: e,
|
|
1460
|
+
contentDOM: e
|
|
1461
|
+
};
|
|
1462
|
+
},
|
|
1463
|
+
toExternalHTML(e) {
|
|
1464
|
+
let t = document.createElement("li"), n = document.createElement("p");
|
|
1465
|
+
return V(e.props, t), t.appendChild(n), {
|
|
1466
|
+
dom: t,
|
|
1467
|
+
contentDOM: n
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1470
|
+
}, [y({
|
|
1471
|
+
key: "numbered-list-item-shortcuts",
|
|
1472
|
+
inputRules: [{
|
|
1473
|
+
find: /^\s?(\d+)\.\s$/,
|
|
1474
|
+
replace({ match: e, editor: t }) {
|
|
1475
|
+
if (d(t.prosemirrorState).blockNoteType === "heading") return;
|
|
1476
|
+
let n = parseInt(e[1]);
|
|
1477
|
+
return {
|
|
1478
|
+
type: "numberedListItem",
|
|
1479
|
+
props: { start: n === 1 ? void 0 : n }
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
}],
|
|
1483
|
+
keyboardShortcuts: { "Mod-Shift-7": ({ editor: e }) => {
|
|
1484
|
+
let t = e.getTextCursorPosition();
|
|
1485
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
1486
|
+
type: "numberedListItem",
|
|
1487
|
+
props: {}
|
|
1488
|
+
}), !0);
|
|
1489
|
+
} },
|
|
1490
|
+
prosemirrorPlugins: [rn()]
|
|
1491
|
+
})]), sn = k(() => ({
|
|
1492
|
+
type: "toggleListItem",
|
|
1493
|
+
propSchema: { ...z },
|
|
1494
|
+
content: "inline"
|
|
1495
|
+
})), cn = A(sn, {
|
|
1496
|
+
experimental_keyboard: (e) => {
|
|
1497
|
+
let t = J(e);
|
|
1498
|
+
return {
|
|
1499
|
+
splitKeepsType: !0,
|
|
1500
|
+
emptyEnterResets: !0,
|
|
1501
|
+
enter: t ? "into-children" : "split",
|
|
1502
|
+
splitKeepsChildren: !t,
|
|
1503
|
+
emptyChildEnter: t ? "stay" : "outdent"
|
|
1504
|
+
};
|
|
1505
|
+
},
|
|
1506
|
+
meta: {
|
|
1507
|
+
isolating: !1,
|
|
1508
|
+
dropsIntoChildren: () => !0
|
|
1509
|
+
},
|
|
1510
|
+
parse(e) {
|
|
1511
|
+
if (e.tagName === "DETAILS") return B(e);
|
|
1512
|
+
if (e.tagName === "LI") {
|
|
1513
|
+
let t = e.parentElement;
|
|
1514
|
+
if (t && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL") && e.querySelector(":scope > details")) return B(e);
|
|
1515
|
+
}
|
|
1516
|
+
},
|
|
1517
|
+
parseContent: ({ el: e, schema: t }) => {
|
|
1518
|
+
let n = e.tagName === "DETAILS" ? e : e.querySelector(":scope > details");
|
|
1519
|
+
if (!n) throw Error("No details found in toggleListItem parseContent");
|
|
1520
|
+
return It(n, t, "toggleListItem");
|
|
1521
|
+
},
|
|
1522
|
+
runsBefore: ["bulletListItem"],
|
|
1523
|
+
render() {
|
|
1524
|
+
let e = document.createElement("p");
|
|
1525
|
+
return {
|
|
1526
|
+
dom: e,
|
|
1527
|
+
contentDOM: e
|
|
1528
|
+
};
|
|
1529
|
+
},
|
|
1530
|
+
renderFrame: Y,
|
|
1531
|
+
toExternalHTML(e) {
|
|
1532
|
+
let t = document.createElement("li"), n = document.createElement("details");
|
|
1533
|
+
n.setAttribute("open", "");
|
|
1534
|
+
let r = document.createElement("summary"), i = document.createElement("p");
|
|
1535
|
+
return r.appendChild(i), n.appendChild(r), V(e.props, t), t.appendChild(n), {
|
|
1536
|
+
dom: t,
|
|
1537
|
+
contentDOM: i,
|
|
1538
|
+
childrenDOM: n
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
}, [y({
|
|
1542
|
+
key: "toggle-list-item-shortcuts",
|
|
1543
|
+
keyboardShortcuts: { "Mod-Shift-6": ({ editor: e }) => {
|
|
1544
|
+
let t = e.getTextCursorPosition();
|
|
1545
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
1546
|
+
type: "toggleListItem",
|
|
1547
|
+
props: {}
|
|
1548
|
+
}), !0);
|
|
1549
|
+
} }
|
|
1550
|
+
})]), ln = k(() => ({
|
|
1551
|
+
type: "pageBreak",
|
|
1552
|
+
propSchema: {},
|
|
1553
|
+
content: "none"
|
|
1554
|
+
})), un = A(ln, {
|
|
1555
|
+
parse(e) {
|
|
1556
|
+
if (e.tagName === "DIV" && e.hasAttribute("data-page-break")) return {};
|
|
1557
|
+
},
|
|
1558
|
+
render() {
|
|
1559
|
+
let e = document.createElement("div");
|
|
1560
|
+
return e.setAttribute("data-page-break", ""), { dom: e };
|
|
1561
|
+
},
|
|
1562
|
+
toExternalHTML() {
|
|
1563
|
+
let e = document.createElement("div");
|
|
1564
|
+
return e.setAttribute("data-page-break", ""), { dom: e };
|
|
1565
|
+
}
|
|
1566
|
+
}), dn = (e) => e.extend({ blockSpecs: { pageBreak: un() } }), fn = k(() => ({
|
|
1567
|
+
type: "paragraph",
|
|
1568
|
+
propSchema: z,
|
|
1569
|
+
content: "inline"
|
|
1570
|
+
})), pn = A(fn, {
|
|
1571
|
+
meta: { isolating: !1 },
|
|
1572
|
+
parse: (e) => {
|
|
1573
|
+
if (e.tagName === "P" && e.textContent?.trim()) return B(e);
|
|
1574
|
+
},
|
|
1575
|
+
render: () => {
|
|
1576
|
+
let e = document.createElement("p");
|
|
1577
|
+
return {
|
|
1578
|
+
dom: e,
|
|
1579
|
+
contentDOM: e
|
|
1580
|
+
};
|
|
1581
|
+
},
|
|
1582
|
+
toExternalHTML: (e) => {
|
|
1583
|
+
let t = document.createElement("p");
|
|
1584
|
+
return V(e.props, t), {
|
|
1585
|
+
dom: t,
|
|
1586
|
+
contentDOM: t
|
|
1587
|
+
};
|
|
1588
|
+
},
|
|
1589
|
+
runsBefore: ["default", "heading"]
|
|
1590
|
+
}, [y({
|
|
1591
|
+
key: "paragraph-shortcuts",
|
|
1592
|
+
keyboardShortcuts: { "Mod-Alt-0": ({ editor: e }) => {
|
|
1593
|
+
let t = e.getTextCursorPosition();
|
|
1594
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
1595
|
+
type: "paragraph",
|
|
1596
|
+
props: {}
|
|
1597
|
+
}), !0);
|
|
1598
|
+
} }
|
|
1599
|
+
})]), mn = k(() => ({
|
|
1600
|
+
type: "quote",
|
|
1601
|
+
propSchema: {
|
|
1602
|
+
backgroundColor: z.backgroundColor,
|
|
1603
|
+
textColor: z.textColor
|
|
1604
|
+
},
|
|
1605
|
+
content: "inline"
|
|
1606
|
+
})), hn = A(mn, {
|
|
1607
|
+
meta: { isolating: !1 },
|
|
1608
|
+
parse(e) {
|
|
1609
|
+
if (e.tagName === "BLOCKQUOTE") {
|
|
1610
|
+
let { backgroundColor: t, textColor: n } = B(e);
|
|
1611
|
+
return {
|
|
1612
|
+
backgroundColor: t,
|
|
1613
|
+
textColor: n
|
|
1614
|
+
};
|
|
1615
|
+
}
|
|
1616
|
+
},
|
|
1617
|
+
render() {
|
|
1618
|
+
let e = document.createElement("blockquote");
|
|
1619
|
+
return {
|
|
1620
|
+
dom: e,
|
|
1621
|
+
contentDOM: e
|
|
1622
|
+
};
|
|
1623
|
+
},
|
|
1624
|
+
toExternalHTML(e) {
|
|
1625
|
+
let t = document.createElement("blockquote");
|
|
1626
|
+
return V(e.props, t), {
|
|
1627
|
+
dom: t,
|
|
1628
|
+
contentDOM: t
|
|
1629
|
+
};
|
|
1630
|
+
}
|
|
1631
|
+
}, [y({
|
|
1632
|
+
key: "quote-block-shortcuts",
|
|
1633
|
+
keyboardShortcuts: { "Mod-Alt-q": ({ editor: e }) => {
|
|
1634
|
+
let t = e.getTextCursorPosition();
|
|
1635
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
1636
|
+
type: "quote",
|
|
1637
|
+
props: {}
|
|
1638
|
+
}), !0);
|
|
1639
|
+
} },
|
|
1640
|
+
inputRules: [{
|
|
1641
|
+
find: /* @__PURE__ */ RegExp("^>\\s$"),
|
|
1642
|
+
replace() {
|
|
1643
|
+
return {
|
|
1644
|
+
type: "quote",
|
|
1645
|
+
props: {}
|
|
1646
|
+
};
|
|
1647
|
+
}
|
|
1648
|
+
}, {
|
|
1649
|
+
find: /* @__PURE__ */ RegExp("^\\p{Quotation_Mark}\\s$", "u"),
|
|
1650
|
+
replace() {
|
|
1651
|
+
return {
|
|
1652
|
+
type: "quote",
|
|
1653
|
+
props: {}
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1656
|
+
}]
|
|
1657
|
+
})]), gn = 120, _n = 31, vn = pe.create({
|
|
1658
|
+
name: "BlockNoteTableExtension",
|
|
1659
|
+
addProseMirrorPlugins: () => [xe({
|
|
1660
|
+
cellMinWidth: 35,
|
|
1661
|
+
defaultCellMinWidth: 120,
|
|
1662
|
+
View: null
|
|
1663
|
+
}), Ee()],
|
|
1664
|
+
addKeyboardShortcuts() {
|
|
1665
|
+
return {
|
|
1666
|
+
Enter: () => T(this.editor.state) ? this.editor.commands.command(({ state: e, dispatch: t }) => {
|
|
1667
|
+
let n = Te(e), r = n ? we(n, "vert", 1) : null;
|
|
1668
|
+
return r && t && t(e.tr.setSelection(ue.between(r, Ce(r))).scrollIntoView()), !0;
|
|
1669
|
+
}) : !1,
|
|
1670
|
+
Backspace: () => {
|
|
1671
|
+
let e = this.editor.state.selection, t = e.empty, n = e.$head.parentOffset === 0, r = e.$head.node().type.name === "tableParagraph";
|
|
1672
|
+
return t && n && r;
|
|
1673
|
+
},
|
|
1674
|
+
Tab: () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) => T(e) ? (Se(1)(e, t, n), !0) : !1),
|
|
1675
|
+
"Shift-Tab": () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) => T(e) ? (Se(-1)(e, t, n), !0) : !1)
|
|
1676
|
+
};
|
|
1677
|
+
},
|
|
1678
|
+
extendNodeSchema(e) {
|
|
1679
|
+
let t = {
|
|
1680
|
+
name: e.name,
|
|
1681
|
+
options: e.options,
|
|
1682
|
+
storage: e.storage
|
|
1683
|
+
};
|
|
1684
|
+
return { tableRole: ge(_e(e, "tableRole", t)) };
|
|
1685
|
+
}
|
|
1686
|
+
}), Z = { textColor: z.textColor }, yn = C.create({
|
|
1687
|
+
name: "tableHeader",
|
|
1688
|
+
addOptions() {
|
|
1689
|
+
return { HTMLAttributes: {} };
|
|
1690
|
+
},
|
|
1691
|
+
content: "tableContent+",
|
|
1692
|
+
marks() {
|
|
1693
|
+
return E(this.editor);
|
|
1694
|
+
},
|
|
1695
|
+
addAttributes() {
|
|
1696
|
+
return {
|
|
1697
|
+
colspan: { default: 1 },
|
|
1698
|
+
rowspan: { default: 1 },
|
|
1699
|
+
colwidth: {
|
|
1700
|
+
default: null,
|
|
1701
|
+
parseHTML: (e) => {
|
|
1702
|
+
let t = e.getAttribute("colwidth");
|
|
1703
|
+
return t ? t.split(",").map((e) => parseInt(e, 10)) : null;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
};
|
|
1707
|
+
},
|
|
1708
|
+
tableRole: "header_cell",
|
|
1709
|
+
isolating: !0,
|
|
1710
|
+
parseHTML() {
|
|
1711
|
+
return [{
|
|
1712
|
+
tag: "th",
|
|
1713
|
+
getContent: (e, t) => wn(e, t)
|
|
1714
|
+
}];
|
|
1715
|
+
},
|
|
1716
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
1717
|
+
return [
|
|
1718
|
+
"th",
|
|
1719
|
+
w(this.options.HTMLAttributes, e),
|
|
1720
|
+
0
|
|
1721
|
+
];
|
|
1722
|
+
}
|
|
1723
|
+
}), bn = C.create({
|
|
1724
|
+
name: "tableCell",
|
|
1725
|
+
addOptions() {
|
|
1726
|
+
return { HTMLAttributes: {} };
|
|
1727
|
+
},
|
|
1728
|
+
content: "tableContent+",
|
|
1729
|
+
marks() {
|
|
1730
|
+
return E(this.editor);
|
|
1731
|
+
},
|
|
1732
|
+
addAttributes() {
|
|
1733
|
+
return {
|
|
1734
|
+
colspan: { default: 1 },
|
|
1735
|
+
rowspan: { default: 1 },
|
|
1736
|
+
colwidth: {
|
|
1737
|
+
default: null,
|
|
1738
|
+
parseHTML: (e) => {
|
|
1739
|
+
let t = e.getAttribute("colwidth");
|
|
1740
|
+
return t ? t.split(",").map((e) => parseInt(e, 10)) : null;
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
},
|
|
1745
|
+
tableRole: "cell",
|
|
1746
|
+
isolating: !0,
|
|
1747
|
+
parseHTML() {
|
|
1748
|
+
return [{
|
|
1749
|
+
tag: "td",
|
|
1750
|
+
getContent: (e, t) => wn(e, t)
|
|
1751
|
+
}];
|
|
1752
|
+
},
|
|
1753
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
1754
|
+
return [
|
|
1755
|
+
"td",
|
|
1756
|
+
w(this.options.HTMLAttributes, e),
|
|
1757
|
+
0
|
|
1758
|
+
];
|
|
1759
|
+
}
|
|
1760
|
+
}), xn = C.create({
|
|
1761
|
+
name: "table",
|
|
1762
|
+
content: "tableRow+",
|
|
1763
|
+
group: "blockContent",
|
|
1764
|
+
tableRole: "table",
|
|
1765
|
+
marks() {
|
|
1766
|
+
return E(this.editor);
|
|
1767
|
+
},
|
|
1768
|
+
isolating: !0,
|
|
1769
|
+
parseHTML() {
|
|
1770
|
+
return [{ tag: "table" }];
|
|
1771
|
+
},
|
|
1772
|
+
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
1773
|
+
let n = ne(this.name, "table", {
|
|
1774
|
+
...this.options.domAttributes?.blockContent || {},
|
|
1775
|
+
...t
|
|
1776
|
+
}, this.options.domAttributes?.inlineContent || {}), r = document.createElement("colgroup");
|
|
1777
|
+
for (let t of e.children[0].children) if (t.attrs.colwidth) for (let e of t.attrs.colwidth) {
|
|
1778
|
+
let t = document.createElement("col");
|
|
1779
|
+
e && (t.style = `width: ${e}px`), r.appendChild(t);
|
|
1780
|
+
}
|
|
1781
|
+
else r.appendChild(document.createElement("col"));
|
|
1782
|
+
return n.dom.firstChild?.appendChild(r), n;
|
|
1783
|
+
},
|
|
1784
|
+
addNodeView() {
|
|
1785
|
+
return ({ node: e, HTMLAttributes: t }) => {
|
|
1786
|
+
class n extends be {
|
|
1787
|
+
node;
|
|
1788
|
+
cellMinWidth;
|
|
1789
|
+
blockContentHTMLAttributes;
|
|
1790
|
+
constructor(e, t, n) {
|
|
1791
|
+
super(e, t), this.node = e, this.cellMinWidth = t, this.blockContentHTMLAttributes = n;
|
|
1792
|
+
let r = document.createElement("div");
|
|
1793
|
+
r.className = oe("bn-block-content", n.class), r.setAttribute("data-content-type", "table");
|
|
1794
|
+
for (let [e, t] of Object.entries(n)) e !== "class" && r.setAttribute(e, t);
|
|
1795
|
+
let i = this.dom, a = document.createElement("div");
|
|
1796
|
+
a.className = "tableWrapper-inner", a.appendChild(i.firstChild), i.appendChild(a), r.appendChild(i);
|
|
1797
|
+
let o = document.createElement("div");
|
|
1798
|
+
o.className = "table-widgets-container", o.style.position = "relative", i.appendChild(o), this.dom = r;
|
|
1799
|
+
}
|
|
1800
|
+
ignoreMutation(e) {
|
|
1801
|
+
return !e.target.closest(".tableWrapper-inner") || super.ignoreMutation(e);
|
|
1802
|
+
}
|
|
1803
|
+
update(e) {
|
|
1804
|
+
return super.update(e) ? (ee(this.dom, e.attrs, Z), !0) : !1;
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
return new n(e, 120, {
|
|
1808
|
+
...this.options.domAttributes?.blockContent || {},
|
|
1809
|
+
...t
|
|
1810
|
+
});
|
|
1811
|
+
};
|
|
1812
|
+
}
|
|
1813
|
+
}), Sn = C.create({
|
|
1814
|
+
name: "tableParagraph",
|
|
1815
|
+
group: "tableContent",
|
|
1816
|
+
content: "inline*",
|
|
1817
|
+
parseHTML() {
|
|
1818
|
+
return [{
|
|
1819
|
+
tag: "p",
|
|
1820
|
+
getAttrs: (e) => {
|
|
1821
|
+
if (typeof e == "string" || !e.textContent || !e.closest("[data-content-type]")) return !1;
|
|
1822
|
+
let t = e.parentElement;
|
|
1823
|
+
return t === null ? !1 : t.tagName === "TD" || t.tagName === "TH" ? {} : !1;
|
|
1824
|
+
},
|
|
1825
|
+
node: "tableParagraph"
|
|
1826
|
+
}];
|
|
1827
|
+
},
|
|
1828
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
1829
|
+
return [
|
|
1830
|
+
"p",
|
|
1831
|
+
e,
|
|
1832
|
+
0
|
|
1833
|
+
];
|
|
1834
|
+
}
|
|
1835
|
+
}), Cn = C.create({
|
|
1836
|
+
name: "tableRow",
|
|
1837
|
+
addOptions() {
|
|
1838
|
+
return { HTMLAttributes: {} };
|
|
1839
|
+
},
|
|
1840
|
+
content: "(tableCell | tableHeader)+",
|
|
1841
|
+
tableRole: "row",
|
|
1842
|
+
marks() {
|
|
1843
|
+
return E(this.editor);
|
|
1844
|
+
},
|
|
1845
|
+
parseHTML() {
|
|
1846
|
+
return [{ tag: "tr" }];
|
|
1847
|
+
},
|
|
1848
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
1849
|
+
return [
|
|
1850
|
+
"tr",
|
|
1851
|
+
w(this.options.HTMLAttributes, e),
|
|
1852
|
+
0
|
|
1853
|
+
];
|
|
1854
|
+
}
|
|
1855
|
+
});
|
|
1856
|
+
function wn(e, t) {
|
|
1857
|
+
let n = b.fromSchema(t).parse(e, { topNode: t.nodes.blockGroup.create() }), r = [];
|
|
1858
|
+
return n.content.descendants((e) => {
|
|
1859
|
+
if (e.isInline) return r.push(e), !1;
|
|
1860
|
+
}), x.fromArray(r);
|
|
1861
|
+
}
|
|
1862
|
+
var Tn = () => g({
|
|
1863
|
+
node: xn,
|
|
1864
|
+
type: "table",
|
|
1865
|
+
content: "table"
|
|
1866
|
+
}, Z, [y({
|
|
1867
|
+
key: "table-extensions",
|
|
1868
|
+
tiptapExtensions: [
|
|
1869
|
+
vn,
|
|
1870
|
+
Sn,
|
|
1871
|
+
yn,
|
|
1872
|
+
bn,
|
|
1873
|
+
Cn
|
|
1874
|
+
]
|
|
1875
|
+
}), y({
|
|
1876
|
+
key: "table-keyboard-delete",
|
|
1877
|
+
keyboardShortcuts: { Backspace: ({ editor: e }) => {
|
|
1878
|
+
if (!(e.prosemirrorState.selection instanceof ye)) return !1;
|
|
1879
|
+
let t = e.getTextCursorPosition().block, n = t.content, r = 0;
|
|
1880
|
+
for (let e of n.rows) for (let t of e.cells) {
|
|
1881
|
+
if ("type" in t && t.content.length > 0 || !("type" in t) && t.length > 0) return !1;
|
|
1882
|
+
r++;
|
|
1883
|
+
}
|
|
1884
|
+
let i = 0;
|
|
1885
|
+
return e.prosemirrorState.selection.forEachCell(() => {
|
|
1886
|
+
i++;
|
|
1887
|
+
}), i < r ? !1 : (e.transact(() => {
|
|
1888
|
+
(e.getPrevBlock(t) || e.getNextBlock(t)) && e.setTextCursorPosition(t), e.removeBlocks([t]);
|
|
1889
|
+
}), !0);
|
|
1890
|
+
} }
|
|
1891
|
+
})]), En = (e) => ({
|
|
1892
|
+
url: e.src || void 0,
|
|
1893
|
+
previewWidth: e.width || void 0,
|
|
1894
|
+
name: e.getAttribute("data-name") || void 0
|
|
1895
|
+
}), Dn = "<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>", On = k((e) => ({
|
|
1896
|
+
type: "video",
|
|
1897
|
+
propSchema: {
|
|
1898
|
+
textAlignment: z.textAlignment,
|
|
1899
|
+
backgroundColor: z.backgroundColor,
|
|
1900
|
+
name: { default: "" },
|
|
1901
|
+
url: { default: "" },
|
|
1902
|
+
caption: { default: "" },
|
|
1903
|
+
showPreview: { default: !0 },
|
|
1904
|
+
previewWidth: {
|
|
1905
|
+
default: void 0,
|
|
1906
|
+
type: "number"
|
|
1907
|
+
}
|
|
1908
|
+
},
|
|
1909
|
+
content: "none"
|
|
1910
|
+
})), kn = (e) => (e) => {
|
|
1911
|
+
if (e.tagName === "VIDEO") {
|
|
1912
|
+
if (e.closest("figure")) return;
|
|
1913
|
+
let { backgroundColor: t } = B(e);
|
|
1914
|
+
return {
|
|
1915
|
+
...En(e),
|
|
1916
|
+
backgroundColor: t
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1919
|
+
if (e.tagName === "FIGURE") {
|
|
1920
|
+
let t = H(e, "video");
|
|
1921
|
+
if (!t) return;
|
|
1922
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = B(e);
|
|
1923
|
+
return {
|
|
1924
|
+
...En(n),
|
|
1925
|
+
backgroundColor: i,
|
|
1926
|
+
caption: r
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
}, An = A(On, (e) => ({
|
|
1930
|
+
meta: { fileBlockAccept: ["video/*"] },
|
|
1931
|
+
parse: kn(e),
|
|
1932
|
+
render(t, n) {
|
|
1933
|
+
let r = document.createElement("div");
|
|
1934
|
+
r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z\"></path></svg>";
|
|
1935
|
+
let i = document.createElement("div");
|
|
1936
|
+
i.className = "bn-visual-media-wrapper";
|
|
1937
|
+
let a = document.createElement("video");
|
|
1938
|
+
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
1939
|
+
a.src = e;
|
|
1940
|
+
}) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a), Ut(t, n, { dom: i }, i, r.firstElementChild);
|
|
1941
|
+
},
|
|
1942
|
+
toExternalHTML(e) {
|
|
1943
|
+
if (!e.props.url) return { dom: document.createElement("video") };
|
|
1944
|
+
let t;
|
|
1945
|
+
return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, e.props.previewWidth && (t.width = e.props.previewWidth)) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? W(t, e.props.caption) : G(t, e.props.caption) : { dom: t };
|
|
1946
|
+
},
|
|
1947
|
+
runsBefore: ["file"]
|
|
1948
|
+
}));
|
|
1949
|
+
// src/blocks/PageBreak/getPageBreakSlashMenuItems.ts
|
|
1950
|
+
function jn(e) {
|
|
1951
|
+
return "pageBreak" in e.schema.blockSchema;
|
|
1952
|
+
}
|
|
1953
|
+
function Mn(e) {
|
|
1954
|
+
let t = [];
|
|
1955
|
+
return jn(e) && t.push({
|
|
1956
|
+
...e.dictionary.slash_menu.page_break,
|
|
1957
|
+
onItemClick: () => {
|
|
1958
|
+
re(e, { type: "pageBreak" });
|
|
1959
|
+
},
|
|
1960
|
+
key: "page_break"
|
|
1961
|
+
}), t;
|
|
1962
|
+
}
|
|
1963
|
+
// src/blocks/defaultBlocks.ts
|
|
1964
|
+
var Nn = {
|
|
1965
|
+
audio: yt(),
|
|
1966
|
+
bulletListItem: Qt(),
|
|
1967
|
+
checkListItem: en(),
|
|
1968
|
+
codeBlock: kt(),
|
|
1969
|
+
divider: jt(),
|
|
1970
|
+
file: Ft(),
|
|
1971
|
+
heading: Ht(),
|
|
1972
|
+
image: Xt(),
|
|
1973
|
+
numberedListItem: on(),
|
|
1974
|
+
paragraph: pn(),
|
|
1975
|
+
quote: hn(),
|
|
1976
|
+
table: Tn(),
|
|
1977
|
+
toggleListItem: cn(),
|
|
1978
|
+
video: An()
|
|
1979
|
+
}, Pn = I({
|
|
1980
|
+
type: "textColor",
|
|
1981
|
+
propSchema: "string"
|
|
1982
|
+
}, {
|
|
1983
|
+
render: () => {
|
|
1984
|
+
let e = document.createElement("span");
|
|
1985
|
+
return {
|
|
1986
|
+
dom: e,
|
|
1987
|
+
contentDOM: e
|
|
1988
|
+
};
|
|
1989
|
+
},
|
|
1990
|
+
toExternalHTML: (e) => {
|
|
1991
|
+
let t = document.createElement("span");
|
|
1992
|
+
return e !== z.textColor.default && (t.style.color = e in R ? R[e].text : e), {
|
|
1993
|
+
dom: t,
|
|
1994
|
+
contentDOM: t
|
|
1995
|
+
};
|
|
1996
|
+
},
|
|
1997
|
+
parse: (e) => {
|
|
1998
|
+
if (e.tagName === "SPAN" && e.style.color) return e.style.color;
|
|
1999
|
+
}
|
|
2000
|
+
}), Fn = I({
|
|
2001
|
+
type: "backgroundColor",
|
|
2002
|
+
propSchema: "string"
|
|
2003
|
+
}, {
|
|
2004
|
+
render: () => {
|
|
2005
|
+
let e = document.createElement("span");
|
|
2006
|
+
return {
|
|
2007
|
+
dom: e,
|
|
2008
|
+
contentDOM: e
|
|
2009
|
+
};
|
|
2010
|
+
},
|
|
2011
|
+
toExternalHTML: (e) => {
|
|
2012
|
+
let t = document.createElement("span");
|
|
2013
|
+
return e !== z.backgroundColor.default && (t.style.backgroundColor = e in R ? R[e].background : e), {
|
|
2014
|
+
dom: t,
|
|
2015
|
+
contentDOM: t
|
|
2016
|
+
};
|
|
2017
|
+
},
|
|
2018
|
+
parse: (e) => {
|
|
2019
|
+
if (e.tagName === "SPAN" && e.style.backgroundColor) return e.style.backgroundColor;
|
|
2020
|
+
}
|
|
2021
|
+
}), Q = {
|
|
2022
|
+
bold: P(je, "boolean"),
|
|
2023
|
+
italic: P(Ne, "boolean"),
|
|
2024
|
+
underline: P(Fe, "boolean"),
|
|
2025
|
+
strike: P(Pe, "boolean"),
|
|
2026
|
+
code: P(Me.extend({
|
|
2027
|
+
excludes() {
|
|
2028
|
+
return ce(this.editor);
|
|
2029
|
+
},
|
|
2030
|
+
addInputRules() {
|
|
2031
|
+
return [ve({
|
|
2032
|
+
find: /(^|[^`])`([^`]+)`(?!`)$/,
|
|
2033
|
+
type: this.type
|
|
2034
|
+
}), new me({
|
|
2035
|
+
find: /(^|[^`])`([^`]+)`(?!`) $/,
|
|
2036
|
+
handler: ({ state: e, range: t, match: n }) => {
|
|
2037
|
+
let { tr: r, schema: i } = e, a = n[1], o = n[2];
|
|
2038
|
+
r.replaceWith(t.from + a.length, t.to, [i.text(o, [this.type.create()]), i.text(" ")]);
|
|
2039
|
+
}
|
|
2040
|
+
})];
|
|
2041
|
+
}
|
|
2042
|
+
}), "boolean"),
|
|
2043
|
+
textColor: Pn,
|
|
2044
|
+
backgroundColor: Fn
|
|
2045
|
+
}, In = F(Q), $ = {
|
|
2046
|
+
text: {
|
|
2047
|
+
config: "text",
|
|
2048
|
+
implementation: {}
|
|
2049
|
+
},
|
|
2050
|
+
link: {
|
|
2051
|
+
config: "link",
|
|
2052
|
+
implementation: {}
|
|
2053
|
+
}
|
|
2054
|
+
}, Ln = j($), Rn = class e extends ot {
|
|
2055
|
+
static create(t) {
|
|
2056
|
+
return new e({
|
|
2057
|
+
blockSpecs: t?.blockSpecs ?? Nn,
|
|
2058
|
+
inlineContentSpecs: t?.inlineContentSpecs ?? $,
|
|
2059
|
+
styleSpecs: t?.styleSpecs ?? Q
|
|
2060
|
+
});
|
|
2061
|
+
}
|
|
2062
|
+
};
|
|
2063
|
+
export { bt as $, Zt as A, Ue as At, Y as B, dn as C, F as Ct, on as D, qe as Dt, an as E, Ge as Et, qt as F, O as Ft, Pt as G, J as H, Jt as I, Ie as It, Ot as J, At as K, Yt as L, E as Lt, Gt as M, k as Mt, Kt as N, A as Nt, en as O, Ke as Ot, Xt as P, Re as Pt, St as Q, Vt as R, un as S, P as St, cn as T, We as Tt, Nt as U, q as V, Ft as W, Et as X, kt as Y, Tt as Z, mn as _, rt as _t, In as a, ht as at, pn as b, M as bt, Mn as c, V as ct, An as d, ut as dt, xt as et, kn as f, lt as ft, gn as g, ot as gt, _n as h, R as ht, $ as i, vt as it, Qt as j, D as jt, $t as k, j as kt, Dn as l, z as lt, Z as m, st as mt, Nn as n, gt as nt, Q as o, yt as ot, Tn as p, B as pt, jt as q, Ln as r, _t as rt, jn as s, K as st, Rn as t, mt as tt, On as u, ct as ut, hn as v, I as vt, sn as w, Je as wt, ln as x, N as xt, fn as y, Ye as yt, Ht as z };
|