@blocknote/core 0.51.3 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BlockNoteExtension-B_IEJHS8.js +38 -0
- package/dist/BlockNoteExtension-B_IEJHS8.js.map +1 -0
- package/dist/BlockNoteExtension-M0znTzxP.cjs +2 -0
- package/dist/BlockNoteExtension-M0znTzxP.cjs.map +1 -0
- package/dist/ThreadStore-Bx-gSEh1.cjs +2 -0
- package/dist/ThreadStore-Bx-gSEh1.cjs.map +1 -0
- package/dist/ThreadStore-et9wB5Xt.js +11 -0
- package/dist/ThreadStore-et9wB5Xt.js.map +1 -0
- package/dist/UserStore-DCG6lsla.cjs +2 -0
- package/dist/UserStore-DCG6lsla.cjs.map +1 -0
- package/dist/UserStore-QbbPFj0z.js +73 -0
- package/dist/UserStore-QbbPFj0z.js.map +1 -0
- package/dist/blocknote.cjs +1 -1
- package/dist/blocknote.js +6 -7
- package/dist/blocks-BqHv0xhc.cjs +12 -0
- package/dist/blocks-BqHv0xhc.cjs.map +1 -0
- package/dist/{blocks-D0lMxErU.js → blocks-CiuUGa1E.js} +1096 -998
- package/dist/blocks-CiuUGa1E.js.map +1 -0
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/comments.cjs +1 -1
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.js +75 -340
- package/dist/comments.js.map +1 -1
- package/dist/{en-Cj5r8sW_.cjs → en-C5Z4Ag9_.cjs} +2 -2
- package/dist/en-C5Z4Ag9_.cjs.map +1 -0
- package/dist/{en-B9hMApn4.js → en-CGKXfWma.js} +9 -1
- package/dist/en-CGKXfWma.js.map +1 -0
- package/dist/{extensions-D2mx2C9y.js → extensions-CrUGDOks.js} +655 -583
- package/dist/extensions-CrUGDOks.js.map +1 -0
- package/dist/extensions-Ghr9QqqR.cjs +52 -0
- package/dist/extensions-Ghr9QqqR.cjs.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +4 -4
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +177 -1
- package/dist/locales.js.map +1 -1
- package/dist/{src-Dvmif2FY.js → src-DTF83Cl9.js} +1243 -1297
- package/dist/src-DTF83Cl9.js.map +1 -0
- package/dist/src-OfbaVbMw.cjs +21 -0
- package/dist/src-OfbaVbMw.cjs.map +1 -0
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/dist/y.cjs +2 -0
- package/dist/y.cjs.map +1 -0
- package/dist/y.js +989 -0
- package/dist/y.js.map +1 -0
- package/dist/yjs.cjs +1 -1
- package/dist/yjs.cjs.map +1 -1
- package/dist/yjs.js +535 -14
- package/dist/yjs.js.map +1 -1
- package/package.json +46 -19
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +1 -1
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +1 -1
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +3 -3
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +25 -20
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +39 -29
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.test.ts +2 -2
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +4 -8
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +1 -1
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +21 -9
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +6 -5
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +362 -4
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +240 -30
- package/src/api/blockManipulation/getBlock/getBlock.ts +4 -9
- package/src/api/blockManipulation/selections/selection.ts +3 -6
- package/src/api/blockManipulation/selections/textCursorPosition.ts +10 -10
- package/src/api/blockManipulation/setupTestEnv.ts +1 -1
- package/src/api/blockManipulation/tables/tables.test.ts +1 -1
- package/src/api/clipboard/fromClipboard/fileDropExtension.ts +1 -1
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +8 -4
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +1 -1
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +2 -1
- package/src/api/exporters/markdown/htmlToMarkdown.ts +79 -43
- package/src/api/getBlockInfoFromPos.test.ts +256 -0
- package/src/api/getBlockInfoFromPos.ts +53 -15
- package/src/api/getBlocksChangedByTransaction.test.ts +2 -1
- package/src/api/getBlocksChangedByTransaction.ts +6 -6
- package/src/api/nodeConversions/blockToNode.test.ts +113 -0
- package/src/api/nodeConversions/blockToNode.ts +15 -3
- package/src/api/nodeConversions/fragmentToBlocks.ts +2 -4
- package/src/api/nodeConversions/nodeToBlock.ts +28 -58
- package/src/api/nodeUtil.ts +6 -2
- package/src/api/parsers/html/parseHTML.ts +1 -1
- package/src/api/parsers/html/util/nestedLists.test.ts +1 -1
- package/src/api/parsers/markdown/detectMarkdown.test.ts +1 -1
- package/src/api/parsers/markdown/markdownToHtml.ts +228 -82
- package/src/api/pmUtil.ts +18 -1
- package/src/api/positionMapping.test.ts +20 -345
- package/src/api/positionMapping.ts +13 -83
- package/src/blocks/Audio/block.ts +1 -1
- package/src/blocks/Code/block.test.ts +14 -7
- package/src/blocks/Code/block.ts +2 -2
- package/src/blocks/Image/block.ts +1 -1
- package/src/blocks/ListItem/CheckListItem/block.test.ts +1 -1
- package/src/blocks/ListItem/ListItemKeyboardShortcuts.ts +2 -2
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.ts +4 -11
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +47 -50
- package/src/blocks/Table/TableExtension.test.ts +129 -0
- package/src/blocks/Table/TableExtension.ts +23 -20
- package/src/blocks/Table/block.ts +18 -5
- package/src/blocks/Video/block.ts +1 -1
- package/src/blocks/utils/listItemEnterHandler.ts +3 -2
- package/src/comments/extension.ts +30 -21
- package/src/comments/index.ts +0 -3
- package/src/comments/mark.ts +4 -0
- package/src/comments/threadstore/ThreadStore.ts +4 -8
- package/src/comments/types.ts +0 -8
- package/src/editor/Block.css +307 -3
- package/src/editor/BlockNoteEditor.test.ts +39 -18
- package/src/editor/BlockNoteEditor.ts +22 -57
- package/src/editor/BlockNoteExtension.test.ts +1 -1
- package/src/editor/managers/BlockManager.ts +1 -1
- package/src/editor/managers/ExtensionManager/ExtensionManager.test.ts +249 -0
- package/src/editor/managers/ExtensionManager/extensions.ts +7 -18
- package/src/editor/managers/ExtensionManager/index.ts +168 -68
- package/src/editor/managers/StateManager.ts +4 -3
- package/src/editor/performance.test.ts +14 -1
- package/src/editor/transformPasted.test.ts +1 -1
- package/src/extensions/Placeholder/Placeholder.ts +1 -0
- package/src/extensions/PositionMapping/PositionMapping.ts +68 -0
- package/src/extensions/PreviousBlockType/PreviousBlockType.test.ts +14 -1
- package/src/extensions/PreviousBlockType/PreviousBlockType.ts +14 -11
- package/src/extensions/SideMenu/SideMenu.ts +9 -2
- package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +1 -1
- package/src/extensions/TableHandles/TableHandles.ts +18 -20
- package/src/extensions/TrailingNode/TrailingNode.ts +33 -1
- package/src/extensions/Versioning/Versioning.test.ts +435 -0
- package/src/extensions/Versioning/Versioning.ts +628 -0
- package/src/extensions/Versioning/inMemoryVersioning.test.ts +469 -0
- package/src/extensions/Versioning/inMemoryVersioning.ts +263 -0
- package/src/extensions/Versioning/index.ts +2 -0
- package/src/extensions/index.ts +6 -9
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.ts +155 -0
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +6 -8
- package/src/extensions/tiptap-extensions/Link/helpers/autolink.ts +9 -9
- package/src/extensions/tiptap-extensions/Link/helpers/linkDetector.ts +8 -10
- package/src/extensions/tiptap-extensions/Link/helpers/whitespace.ts +2 -2
- package/src/extensions/tiptap-extensions/Link/link.test.ts +26 -22
- package/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.ts +187 -0
- package/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts +37 -24
- package/src/extensions/tiptap-extensions/index.ts +1 -25
- package/src/i18n/locales/ar.ts +9 -0
- package/src/i18n/locales/de.ts +9 -0
- package/src/i18n/locales/en.ts +10 -1
- package/src/i18n/locales/es.ts +9 -0
- package/src/i18n/locales/fa.ts +11 -1
- package/src/i18n/locales/fr.ts +9 -0
- package/src/i18n/locales/he.ts +10 -1
- package/src/i18n/locales/hr.ts +10 -0
- package/src/i18n/locales/is.ts +10 -0
- package/src/i18n/locales/it.ts +9 -0
- package/src/i18n/locales/ja.ts +9 -0
- package/src/i18n/locales/ko.ts +9 -0
- package/src/i18n/locales/nl.ts +10 -0
- package/src/i18n/locales/no.ts +10 -0
- package/src/i18n/locales/pl.ts +9 -0
- package/src/i18n/locales/pt.ts +10 -0
- package/src/i18n/locales/ru.ts +10 -0
- package/src/i18n/locales/sk.ts +10 -1
- package/src/i18n/locales/uk.ts +9 -0
- package/src/i18n/locales/uz.ts +9 -0
- package/src/i18n/locales/vi.ts +9 -0
- package/src/i18n/locales/zh-tw.ts +9 -0
- package/src/i18n/locales/zh.ts +9 -0
- package/src/index.ts +2 -0
- package/src/pm-nodes/BlockContainer.ts +4 -1
- package/src/pm-nodes/BlockGroup.ts +4 -1
- package/src/pm-nodes/Doc.ts +4 -1
- package/src/pm-nodes/suggestionMarks.ts +43 -0
- package/src/schema/blocks/createSpec.test.ts +123 -0
- package/src/schema/blocks/createSpec.ts +82 -24
- package/src/schema/blocks/extendBlockSpec.test.ts +188 -0
- package/src/schema/blocks/internal.ts +13 -43
- package/src/schema/blocks/types.ts +69 -22
- package/src/schema/contentTypePropagation.test.ts +182 -0
- package/src/schema/index.ts +1 -0
- package/src/schema/inlineContent/internal.ts +1 -1
- package/src/schema/inlineContent/types.ts +3 -3
- package/src/schema/markGroups.ts +50 -0
- package/src/user/UserStore.ts +199 -0
- package/src/user/createUserStore.test.ts +126 -0
- package/src/user/index.ts +2 -0
- package/src/user/userColors.ts +72 -0
- package/src/util/string.ts +1 -1
- package/src/util/topo-sort.test.ts +1 -1
- package/src/util/typescript.ts +2 -1
- package/src/vite-env.d.ts +1 -1
- package/src/y/README.md +5 -0
- package/src/{comments/threadstore/yjs → y/comments}/RESTYjsThreadStore.ts +8 -14
- package/src/y/comments/YjsThreadStore.test.ts +295 -0
- package/src/y/comments/YjsThreadStore.ts +358 -0
- package/src/y/comments/YjsThreadStoreBase.ts +50 -0
- package/src/y/comments/index.ts +3 -0
- package/src/y/comments/yjsHelpers.ts +125 -0
- package/src/y/extensions/AttributionExtension.test.ts +86 -0
- package/src/y/extensions/AttributionExtension.ts +378 -0
- package/src/y/extensions/DiffVersioningExtension.test.ts +193 -0
- package/src/y/extensions/DiffVersioningExtension.ts +228 -0
- package/src/y/extensions/ForkYDoc.test.ts +253 -0
- package/src/y/extensions/ForkYDoc.ts +108 -0
- package/src/y/extensions/RelativePositionMapping.test.ts +418 -0
- package/src/y/extensions/RelativePositionMapping.ts +49 -0
- package/src/y/extensions/Suggestions.ts +174 -0
- package/src/y/extensions/Versioning.test.ts +395 -0
- package/src/y/extensions/Versioning.ts +115 -0
- package/src/y/extensions/YAttributionMarks.ts +320 -0
- package/src/{extensions/Collaboration → y/extensions}/YCursorPlugin.ts +15 -7
- package/src/y/extensions/YSync.ts +125 -0
- package/src/y/extensions/blockMatchNodes.ts +182 -0
- package/src/y/extensions/index.ts +156 -0
- package/src/y/index.ts +4 -0
- package/src/y/utils.test.ts +1042 -0
- package/src/y/utils.ts +242 -0
- package/src/y/versioning/__test__/fixtures/activity-all-after.bin +0 -0
- package/src/y/versioning/__test__/fixtures/activity-all-after.json +50 -0
- package/src/y/versioning/__test__/fixtures/activity-all.bin +0 -0
- package/src/y/versioning/__test__/fixtures/activity-all.json +20 -0
- package/src/y/versioning/__test__/fixtures/activity-filtered-after.bin +0 -0
- package/src/y/versioning/__test__/fixtures/activity-filtered-after.json +32 -0
- package/src/y/versioning/__test__/fixtures/activity-filtered-before.json +1 -0
- package/src/y/versioning/__test__/fixtures/changeset.bin +0 -0
- package/src/y/versioning/__test__/fixtures/patch-response.json +4 -0
- package/src/y/versioning/__test__/yhub.test.ts +752 -0
- package/src/y/versioning/index.ts +1 -0
- package/src/y/versioning/yhub.ts +631 -0
- package/src/yjs/README.md +5 -0
- package/src/yjs/comments/RESTYjsThreadStore.ts +166 -0
- package/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStore.test.ts +3 -3
- package/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStore.ts +7 -3
- package/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStoreBase.ts +3 -3
- package/src/yjs/comments/index.ts +3 -0
- package/src/{comments/threadstore/yjs → yjs/comments}/yjsHelpers.ts +5 -1
- package/src/yjs/extensions/FixUpSchema.test.ts +421 -0
- package/src/yjs/extensions/FixUpSchema.ts +88 -0
- package/src/yjs/extensions/ForkYDoc.test.ts +216 -0
- package/src/{extensions/Collaboration → yjs/extensions}/ForkYDoc.ts +38 -57
- package/src/yjs/extensions/RelativePositionMapping.test.ts +418 -0
- package/src/yjs/extensions/RelativePositionMapping.ts +71 -0
- package/src/yjs/extensions/Versioning.test.ts +549 -0
- package/src/yjs/extensions/Versioning.ts +83 -0
- package/src/yjs/extensions/YCursorPlugin.ts +201 -0
- package/src/{extensions/Collaboration → yjs/extensions}/YSync.ts +1 -1
- package/src/yjs/extensions/index.ts +89 -0
- package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.test.ts +1 -1
- package/src/yjs/index.ts +2 -0
- package/src/yjs/utils.test.ts +5 -15
- package/src/yjs/utils.ts +36 -0
- package/types/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.d.ts +3 -1
- package/types/src/api/blockManipulation/selections/selection.d.ts +1 -1
- package/types/src/api/getBlockInfoFromPos.d.ts +5 -9
- package/types/src/api/nodeConversions/nodeToBlock.d.ts +4 -6
- package/types/src/api/pmUtil.d.ts +12 -1
- package/types/src/blocks/Audio/block.d.ts +2 -2
- package/types/src/blocks/Code/block.d.ts +2 -2
- package/types/src/blocks/File/block.d.ts +2 -2
- package/types/src/blocks/Heading/block.d.ts +21 -21
- package/types/src/blocks/Image/block.d.ts +3 -3
- package/types/src/blocks/ListItem/CheckListItem/block.d.ts +6 -6
- package/types/src/blocks/ListItem/NumberedListItem/block.d.ts +6 -6
- package/types/src/blocks/Video/block.d.ts +3 -3
- package/types/src/blocks/defaultBlocks.d.ts +17 -17
- package/types/src/comments/extension.d.ts +18 -5
- package/types/src/comments/index.d.ts +0 -3
- package/types/src/comments/threadstore/ThreadStore.d.ts +4 -8
- package/types/src/comments/types.d.ts +0 -8
- package/types/src/editor/BlockNoteEditor.d.ts +8 -9
- package/types/src/editor/managers/BlockManager.d.ts +1 -1
- package/types/src/editor/managers/ExtensionManager/ExtensionManager.test.d.ts +1 -0
- package/types/src/editor/managers/ExtensionManager/extensions.d.ts +2 -2
- package/types/src/editor/managers/ExtensionManager/index.d.ts +13 -0
- package/types/src/editor/managers/SelectionManager.d.ts +1 -1
- package/types/src/extensions/PositionMapping/PositionMapping.d.ts +4 -0
- package/types/src/extensions/TableHandles/TableHandles.d.ts +6 -6
- package/types/src/extensions/Versioning/Versioning.d.ts +352 -0
- package/types/src/extensions/Versioning/Versioning.test.d.ts +1 -0
- package/types/src/extensions/Versioning/inMemoryVersioning.d.ts +37 -0
- package/types/src/extensions/Versioning/inMemoryVersioning.test.d.ts +1 -0
- package/types/src/extensions/Versioning/index.d.ts +2 -0
- package/types/src/extensions/index.d.ts +6 -9
- package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.d.ts +1 -0
- package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.d.ts +6 -1
- package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.d.ts +4 -0
- package/types/src/extensions/tiptap-extensions/index.d.ts +1 -5
- package/types/src/i18n/locales/en.d.ts +9 -1
- package/types/src/i18n/locales/fa.d.ts +9 -1
- package/types/src/i18n/locales/sk.d.ts +9 -1
- package/types/src/index.d.ts +2 -0
- package/types/src/pm-nodes/suggestionMarks.d.ts +26 -0
- package/types/src/schema/blocks/createSpec.d.ts +4 -4
- package/types/src/schema/blocks/createSpec.test.d.ts +1 -0
- package/types/src/schema/blocks/extendBlockSpec.test.d.ts +1 -0
- package/types/src/schema/blocks/internal.d.ts +5 -7
- package/types/src/schema/blocks/types.d.ts +22 -14
- package/types/src/schema/contentTypePropagation.test.d.ts +1 -0
- package/types/src/schema/index.d.ts +1 -0
- package/types/src/schema/inlineContent/types.d.ts +3 -3
- package/types/src/schema/markGroups.d.ts +33 -0
- package/types/src/user/UserStore.d.ts +105 -0
- package/types/src/user/createUserStore.test.d.ts +1 -0
- package/types/src/user/index.d.ts +2 -0
- package/types/src/user/userColors.d.ts +36 -0
- package/types/src/y/comments/RESTYjsThreadStore.d.ts +77 -0
- package/types/src/y/comments/YjsThreadStore.d.ts +79 -0
- package/types/src/y/comments/YjsThreadStore.test.d.ts +1 -0
- package/types/src/y/comments/YjsThreadStoreBase.d.ts +15 -0
- package/types/src/y/comments/index.d.ts +3 -0
- package/types/src/y/comments/yjsHelpers.d.ts +13 -0
- package/types/src/y/extensions/AttributionExtension.d.ts +74 -0
- package/types/src/y/extensions/AttributionExtension.test.d.ts +1 -0
- package/types/src/y/extensions/DiffVersioningExtension.d.ts +69 -0
- package/types/src/y/extensions/DiffVersioningExtension.test.d.ts +1 -0
- package/types/src/{extensions/Collaboration → y/extensions}/ForkYDoc.d.ts +4 -2
- package/types/src/y/extensions/ForkYDoc.test.d.ts +1 -0
- package/types/src/y/extensions/RelativePositionMapping.d.ts +4 -0
- package/types/src/y/extensions/RelativePositionMapping.test.d.ts +1 -0
- package/types/src/y/extensions/Suggestions.d.ts +36 -0
- package/types/src/y/extensions/Versioning.d.ts +17 -0
- package/types/src/y/extensions/Versioning.test.d.ts +1 -0
- package/types/src/y/extensions/YAttributionMarks.d.ts +67 -0
- package/types/src/y/extensions/YCursorPlugin.d.ts +14 -0
- package/types/src/y/extensions/YSync.d.ts +32 -0
- package/types/src/y/extensions/blockMatchNodes.d.ts +25 -0
- package/types/src/y/extensions/index.d.ts +189 -0
- package/types/src/y/index.d.ts +4 -0
- package/types/src/y/utils.d.ts +82 -0
- package/types/src/y/utils.test.d.ts +1 -0
- package/types/src/y/versioning/__test__/yhub.test.d.ts +1 -0
- package/types/src/y/versioning/index.d.ts +1 -0
- package/types/src/y/versioning/yhub.d.ts +87 -0
- package/types/src/{comments/threadstore/yjs → yjs/comments}/RESTYjsThreadStore.d.ts +6 -10
- package/types/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStore.d.ts +3 -3
- package/types/src/yjs/comments/YjsThreadStore.test.d.ts +1 -0
- package/types/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStoreBase.d.ts +3 -3
- package/types/src/yjs/comments/index.d.ts +3 -0
- package/types/src/{comments/threadstore/yjs → yjs/comments}/yjsHelpers.d.ts +1 -1
- package/types/src/yjs/extensions/FixUpSchema.d.ts +3 -0
- package/types/src/yjs/extensions/FixUpSchema.test.d.ts +1 -0
- package/types/src/yjs/extensions/ForkYDoc.d.ts +27 -0
- package/types/src/yjs/extensions/ForkYDoc.test.d.ts +1 -0
- package/types/src/yjs/extensions/RelativePositionMapping.d.ts +4 -0
- package/types/src/yjs/extensions/RelativePositionMapping.test.d.ts +1 -0
- package/types/src/yjs/extensions/Versioning.d.ts +26 -0
- package/types/src/yjs/extensions/Versioning.test.d.ts +1 -0
- package/types/src/{extensions/Collaboration → yjs/extensions}/YCursorPlugin.d.ts +5 -2
- package/types/src/{extensions/Collaboration → yjs/extensions}/YSync.d.ts +1 -1
- package/types/src/{extensions/Collaboration/Collaboration.d.ts → yjs/extensions/index.d.ts} +36 -15
- package/types/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.test.d.ts +1 -0
- package/types/src/yjs/index.d.ts +2 -0
- package/types/src/yjs/utils.d.ts +5 -0
- package/dist/BlockNoteExtension-B6RhuQ3V.js +0 -27
- package/dist/BlockNoteExtension-B6RhuQ3V.js.map +0 -1
- package/dist/BlockNoteExtension-ab0REuob.cjs +0 -2
- package/dist/BlockNoteExtension-ab0REuob.cjs.map +0 -1
- package/dist/EventEmitter-CuPnGDYt.js +0 -22
- package/dist/EventEmitter-CuPnGDYt.js.map +0 -1
- package/dist/EventEmitter-DHdSnYCD.cjs +0 -2
- package/dist/EventEmitter-DHdSnYCD.cjs.map +0 -1
- package/dist/ShowSelection-BsHFfdMi.js +0 -29
- package/dist/ShowSelection-BsHFfdMi.js.map +0 -1
- package/dist/ShowSelection-DhXglbt8.cjs +0 -2
- package/dist/ShowSelection-DhXglbt8.cjs.map +0 -1
- package/dist/blocks-D0lMxErU.js.map +0 -1
- package/dist/blocks-KyMOxPT3.cjs +0 -11
- package/dist/blocks-KyMOxPT3.cjs.map +0 -1
- package/dist/en-B9hMApn4.js.map +0 -1
- package/dist/en-Cj5r8sW_.cjs.map +0 -1
- package/dist/extensions-Cutrafjg.cjs +0 -52
- package/dist/extensions-Cutrafjg.cjs.map +0 -1
- package/dist/extensions-D2mx2C9y.js.map +0 -1
- package/dist/src-D5R5YzV7.cjs +0 -21
- package/dist/src-D5R5YzV7.cjs.map +0 -1
- package/dist/src-Dvmif2FY.js.map +0 -1
- package/src/comments/userstore/UserStore.ts +0 -72
- package/src/extensions/Collaboration/Collaboration.ts +0 -55
- package/src/extensions/Collaboration/ForkYDoc.test.ts +0 -179
- package/src/extensions/tiptap-extensions/Suggestions/SuggestionMarks.ts +0 -175
- package/types/src/comments/userstore/UserStore.d.ts +0 -31
- package/types/src/extensions/tiptap-extensions/Suggestions/SuggestionMarks.d.ts +0 -4
- /package/src/{extensions/Collaboration → yjs/extensions}/YUndo.ts +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-editor-forked.json +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-editor.json +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-forked.html +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap.html +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/SchemaMigration.ts +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/index.ts +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/migrationRule.ts +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.ts +0 -0
- /package/types/src/{comments/threadstore/yjs/YjsThreadStore.test.d.ts → api/getBlockInfoFromPos.test.d.ts} +0 -0
- /package/types/src/{extensions/Collaboration/ForkYDoc.test.d.ts → api/nodeConversions/blockToNode.test.d.ts} +0 -0
- /package/types/src/{extensions/Collaboration/schemaMigration/migrationRules/moveColorAttributes.test.d.ts → blocks/Table/TableExtension.test.d.ts} +0 -0
- /package/types/src/{extensions/Collaboration → yjs/extensions}/YUndo.d.ts +0 -0
- /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/SchemaMigration.d.ts +0 -0
- /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/index.d.ts +0 -0
- /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/migrationRule.d.ts +0 -0
- /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.d.ts +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DOMParser as
|
|
3
|
-
import {
|
|
1
|
+
import { a as e, n as t, t as n } from "./BlockNoteExtension-B_IEJHS8.js";
|
|
2
|
+
import { DOMParser as r, Fragment as i, Slice as a } from "prosemirror-model";
|
|
3
|
+
import { ReplaceStep as o } from "prosemirror-transform";
|
|
4
4
|
import { Extension as s, InputRule as c, Mark as l, Node as u, callOrReturn as d, combineTransactionSteps as f, findChildrenInRange as p, findParentNode as m, getChangedRanges as h, getExtensionField as g, markInputRule as _, mergeAttributes as v } from "@tiptap/core";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { uuidv4 as ee } from "lib0/random";
|
|
6
|
+
import { Plugin as te, PluginKey as ne, TextSelection as y } from "prosemirror-state";
|
|
7
7
|
import { DOMParser as re, DOMSerializer as ie, Fragment as ae } from "@tiptap/pm/model";
|
|
8
8
|
import { CellSelection as oe, TableMap as se, TableView as ce, columnResizing as le, goToNextCell as ue, isInTable as de, moveCellForward as fe, nextCell as pe, selectionCell as me, tableEditing as he } from "prosemirror-tables";
|
|
9
9
|
import { createHighlightPlugin as ge } from "prosemirror-highlight";
|
|
@@ -11,29 +11,132 @@ import { createParser as _e } from "prosemirror-highlight/shiki";
|
|
|
11
11
|
import { Plugin as ve, PluginKey as ye } from "@tiptap/pm/state";
|
|
12
12
|
import { Decoration as be, DecorationSet as xe } from "@tiptap/pm/view";
|
|
13
13
|
import { Decoration as Se, DecorationSet as Ce } from "prosemirror-view";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
14
|
+
import we from "@tiptap/extension-bold";
|
|
15
|
+
import Te from "@tiptap/extension-code";
|
|
16
|
+
import Ee from "@tiptap/extension-italic";
|
|
17
|
+
import De from "@tiptap/extension-strike";
|
|
18
|
+
import Oe from "@tiptap/extension-underline";
|
|
19
|
+
//#region src/api/getBlockInfoFromPos.ts
|
|
20
|
+
function ke(e) {
|
|
21
|
+
return e.marks.some((e) => ["y-attributed-delete"].includes(e.type.name));
|
|
22
|
+
}
|
|
23
|
+
function Ae(e, t) {
|
|
24
|
+
let n = e.attrs.id;
|
|
25
|
+
if (!n) throw Error(`Node ${e.type.name} does not have an ID`);
|
|
26
|
+
if (ke(e)) {
|
|
27
|
+
let r = 0, i = !1;
|
|
28
|
+
if (t.descendants((t) => {
|
|
29
|
+
if (i) return !1;
|
|
30
|
+
if (t.attrs.id === n) {
|
|
31
|
+
if (t === e) return i = !0, !1;
|
|
32
|
+
r++;
|
|
33
|
+
}
|
|
34
|
+
return !0;
|
|
35
|
+
}), !i) throw Error(`Node ${e.type.name} with ID ${n} not found in document`);
|
|
36
|
+
return `${n}-${r}`;
|
|
37
|
+
}
|
|
38
|
+
return n;
|
|
39
|
+
}
|
|
40
|
+
function je(e, t) {
|
|
41
|
+
let n = e.resolve(t);
|
|
42
|
+
if (n.nodeAfter && n.nodeAfter.type.isInGroup("bnBlock")) return {
|
|
43
|
+
posBeforeNode: n.pos,
|
|
44
|
+
node: n.nodeAfter
|
|
45
|
+
};
|
|
46
|
+
let r = n.depth, i = n.node(r);
|
|
47
|
+
for (; r > 0;) {
|
|
48
|
+
if (i.type.isInGroup("bnBlock")) return {
|
|
49
|
+
posBeforeNode: n.before(r),
|
|
50
|
+
node: i
|
|
51
|
+
};
|
|
52
|
+
r--, i = n.node(r);
|
|
53
|
+
}
|
|
54
|
+
let a = [];
|
|
55
|
+
e.descendants((e, t) => {
|
|
56
|
+
e.type.isInGroup("bnBlock") && a.push(t);
|
|
57
|
+
}), console.warn(`Position ${t} is not within a blockContainer node.`);
|
|
58
|
+
let o = e.resolve(a.find((e) => e >= t) || a[a.length - 1]);
|
|
59
|
+
return {
|
|
60
|
+
posBeforeNode: o.pos,
|
|
61
|
+
node: o.nodeAfter
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function Me(e, t) {
|
|
65
|
+
if (!e.type.isInGroup("bnBlock")) throw Error(`Attempted to get bnBlock node at position but found node of different type ${e.type.name}`);
|
|
66
|
+
let n = e, r = t, i = {
|
|
67
|
+
node: n,
|
|
68
|
+
beforePos: r,
|
|
69
|
+
afterPos: r + n.nodeSize
|
|
70
|
+
};
|
|
71
|
+
if (n.type.name === "blockContainer") {
|
|
72
|
+
let e, t;
|
|
73
|
+
if (n.forEach((n, i) => {
|
|
74
|
+
if (n.type.spec.group === "blockContent") {
|
|
75
|
+
let t = n, a = r + i + 1;
|
|
76
|
+
e = {
|
|
77
|
+
node: t,
|
|
78
|
+
beforePos: a,
|
|
79
|
+
afterPos: a + n.nodeSize
|
|
80
|
+
};
|
|
81
|
+
} else if (n.type.name === "blockGroup") {
|
|
82
|
+
let e = n, a = r + i + 1;
|
|
83
|
+
t = {
|
|
84
|
+
node: e,
|
|
85
|
+
beforePos: a,
|
|
86
|
+
afterPos: a + n.nodeSize
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}), !e) throw Error(`blockContainer node does not contain a blockContent node in its children: ${n}`);
|
|
90
|
+
return {
|
|
91
|
+
isBlockContainer: !0,
|
|
92
|
+
bnBlock: i,
|
|
93
|
+
blockContent: e,
|
|
94
|
+
childContainer: t,
|
|
95
|
+
blockNoteType: e.node.type.name
|
|
96
|
+
};
|
|
97
|
+
} else {
|
|
98
|
+
if (!i.node.type.isInGroup("childContainer")) throw Error(`bnBlock node is not in the childContainer group: ${i.node}`);
|
|
99
|
+
return {
|
|
100
|
+
isBlockContainer: !1,
|
|
101
|
+
bnBlock: i,
|
|
102
|
+
childContainer: i,
|
|
103
|
+
blockNoteType: i.node.type.name
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function b(e) {
|
|
108
|
+
return Me(e.node, e.posBeforeNode);
|
|
109
|
+
}
|
|
110
|
+
function Ne(e) {
|
|
111
|
+
if (!e.nodeAfter) throw Error(`Attempted to get blockContainer node at position ${e.pos} but a node at this position does not exist`);
|
|
112
|
+
return Me(e.nodeAfter, e.pos);
|
|
113
|
+
}
|
|
114
|
+
function x(e) {
|
|
115
|
+
return Pe(e, e.selection.anchor);
|
|
116
|
+
}
|
|
117
|
+
function Pe(e, t) {
|
|
118
|
+
return b(je(e.doc, t));
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
20
121
|
//#region src/extensions/tiptap-extensions/UniqueID/UniqueID.ts
|
|
21
|
-
function
|
|
122
|
+
function Fe(e, t = JSON.stringify) {
|
|
22
123
|
let n = {};
|
|
23
124
|
return e.filter((e) => {
|
|
24
125
|
let r = t(e);
|
|
25
126
|
return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
|
|
26
127
|
});
|
|
27
128
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
129
|
+
function Ie(e) {
|
|
130
|
+
return Fe(e.filter((t, n) => e.indexOf(t) !== n));
|
|
30
131
|
}
|
|
31
|
-
|
|
132
|
+
function Le(e) {
|
|
133
|
+
return e.marks.some((e) => e.type.name === "y-attributed-delete");
|
|
134
|
+
}
|
|
135
|
+
var Re = s.create({
|
|
32
136
|
name: "uniqueID",
|
|
33
137
|
priority: 1e4,
|
|
34
138
|
addOptions() {
|
|
35
139
|
return {
|
|
36
|
-
attributeName: "id",
|
|
37
140
|
types: [],
|
|
38
141
|
setIdAttribute: !1,
|
|
39
142
|
isWithinEditor: void 0,
|
|
@@ -42,22 +145,21 @@ var Pe = s.create({
|
|
|
42
145
|
let e = window.__TEST_OPTIONS;
|
|
43
146
|
return e.mockID === void 0 ? e.mockID = 0 : e.mockID++, e.mockID.toString();
|
|
44
147
|
}
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
filterTransaction: null
|
|
148
|
+
return ee();
|
|
149
|
+
}
|
|
48
150
|
};
|
|
49
151
|
},
|
|
50
152
|
addGlobalAttributes() {
|
|
51
153
|
return [{
|
|
52
154
|
types: this.options.types,
|
|
53
|
-
attributes: {
|
|
155
|
+
attributes: { id: {
|
|
54
156
|
default: null,
|
|
55
|
-
parseHTML: (e) => e.getAttribute(
|
|
157
|
+
parseHTML: (e) => e.getAttribute("data-id"),
|
|
56
158
|
renderHTML: (e) => {
|
|
57
|
-
let t = {
|
|
159
|
+
let t = { "data-id": e.id };
|
|
58
160
|
return this.options.setIdAttribute ? {
|
|
59
161
|
...t,
|
|
60
|
-
id: e
|
|
162
|
+
id: e.id
|
|
61
163
|
} : t;
|
|
62
164
|
}
|
|
63
165
|
} }
|
|
@@ -65,41 +167,41 @@ var Pe = s.create({
|
|
|
65
167
|
},
|
|
66
168
|
addProseMirrorPlugins() {
|
|
67
169
|
let { isWithinEditor: e } = this.options, t = null, n = !1;
|
|
68
|
-
return [new
|
|
69
|
-
key: new
|
|
170
|
+
return [new te({
|
|
171
|
+
key: new ne("uniqueID"),
|
|
70
172
|
appendTransaction: (e, t, n) => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
let o =
|
|
173
|
+
if (!(e.some((e) => e.docChanged) && !t.doc.eq(n.doc))) return;
|
|
174
|
+
let { tr: r } = n, { types: i, generateID: a } = this.options, o = f(t.doc, e), { mapping: s } = o;
|
|
175
|
+
if (h(o).forEach(({ newRange: e }) => {
|
|
176
|
+
let o = p(n.doc, e, (e) => i.includes(e.type.name)), c = Ie(o.map(({ node: e }) => e.attrs.id).filter((e) => e !== null));
|
|
177
|
+
o.forEach(({ node: e, pos: i }) => {
|
|
178
|
+
if (Le(e)) return;
|
|
179
|
+
let o = r.doc.nodeAt(i)?.attrs.id;
|
|
78
180
|
if (o === null) {
|
|
79
|
-
let
|
|
80
|
-
if (t.doc.content.findDiffStart(
|
|
181
|
+
let o = t.doc.type.createAndFill().content;
|
|
182
|
+
if (t.doc.content.findDiffStart(o) === null) {
|
|
81
183
|
let t = JSON.parse(JSON.stringify(n.doc.toJSON()));
|
|
82
|
-
if (t.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(t.content) === JSON.stringify(
|
|
83
|
-
|
|
184
|
+
if (t.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(t.content) === JSON.stringify(o.toJSON())) {
|
|
185
|
+
r.setNodeMarkup(i, void 0, {
|
|
84
186
|
...e.attrs,
|
|
85
|
-
|
|
187
|
+
id: "initialBlockId"
|
|
86
188
|
});
|
|
87
189
|
return;
|
|
88
190
|
}
|
|
89
191
|
}
|
|
90
|
-
|
|
192
|
+
r.setNodeMarkup(i, void 0, {
|
|
91
193
|
...e.attrs,
|
|
92
|
-
|
|
194
|
+
id: a()
|
|
93
195
|
});
|
|
94
196
|
return;
|
|
95
197
|
}
|
|
96
|
-
let { deleted: l } =
|
|
97
|
-
l &&
|
|
198
|
+
let { deleted: l } = s.invert().mapResult(i);
|
|
199
|
+
l && c.includes(o) && !ke(e) && r.setNodeMarkup(i, void 0, {
|
|
98
200
|
...e.attrs,
|
|
99
|
-
|
|
201
|
+
id: a()
|
|
100
202
|
});
|
|
101
203
|
});
|
|
102
|
-
}),
|
|
204
|
+
}), r.steps.length) return r.setMeta("uniqueID", !0), r;
|
|
103
205
|
},
|
|
104
206
|
view(n) {
|
|
105
207
|
let r = (r) => {
|
|
@@ -117,7 +219,7 @@ var Pe = s.create({
|
|
|
117
219
|
},
|
|
118
220
|
transformPasted: (e) => {
|
|
119
221
|
if (!n) return e;
|
|
120
|
-
let { types: t
|
|
222
|
+
let { types: t } = this.options, r = (e) => {
|
|
121
223
|
let n = [];
|
|
122
224
|
return e.forEach((e) => {
|
|
123
225
|
if (e.isText) {
|
|
@@ -125,17 +227,17 @@ var Pe = s.create({
|
|
|
125
227
|
return;
|
|
126
228
|
}
|
|
127
229
|
if (!t.includes(e.type.name)) {
|
|
128
|
-
n.push(e.copy(
|
|
230
|
+
n.push(e.copy(r(e.content)));
|
|
129
231
|
return;
|
|
130
232
|
}
|
|
131
|
-
let
|
|
233
|
+
let i = e.type.create({
|
|
132
234
|
...e.attrs,
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
n.push(
|
|
136
|
-
}),
|
|
235
|
+
id: null
|
|
236
|
+
}, r(e.content), e.marks);
|
|
237
|
+
n.push(i);
|
|
238
|
+
}), i.from(n);
|
|
137
239
|
};
|
|
138
|
-
return n = !1, new
|
|
240
|
+
return n = !1, new a(r(e.content), e.openStart, e.openEnd);
|
|
139
241
|
}
|
|
140
242
|
}
|
|
141
243
|
})];
|
|
@@ -143,19 +245,19 @@ var Pe = s.create({
|
|
|
143
245
|
});
|
|
144
246
|
//#endregion
|
|
145
247
|
//#region src/schema/inlineContent/types.ts
|
|
146
|
-
function
|
|
248
|
+
function ze(e) {
|
|
147
249
|
return e.type === "link";
|
|
148
250
|
}
|
|
149
|
-
function
|
|
251
|
+
function Be(e) {
|
|
150
252
|
return typeof e != "string" && e.type === "link";
|
|
151
253
|
}
|
|
152
|
-
function
|
|
254
|
+
function S(e) {
|
|
153
255
|
return typeof e != "string" && e.type === "text";
|
|
154
256
|
}
|
|
155
257
|
//#endregion
|
|
156
258
|
//#region src/util/table.ts
|
|
157
|
-
function
|
|
158
|
-
return
|
|
259
|
+
function C(e) {
|
|
260
|
+
return Ve(e) ? { ...e } : w(e) ? {
|
|
159
261
|
type: "tableCell",
|
|
160
262
|
content: [].concat(e.content),
|
|
161
263
|
props: {
|
|
@@ -176,390 +278,102 @@ function x(e) {
|
|
|
176
278
|
rowspan: 1
|
|
177
279
|
}
|
|
178
280
|
};
|
|
179
|
-
}
|
|
180
|
-
function
|
|
181
|
-
return e != null && typeof e != "string" && !Array.isArray(e) && e.type === "tableCell";
|
|
182
|
-
}
|
|
183
|
-
function
|
|
184
|
-
return
|
|
185
|
-
}
|
|
186
|
-
function
|
|
187
|
-
return
|
|
188
|
-
}
|
|
189
|
-
function
|
|
190
|
-
return
|
|
191
|
-
}
|
|
192
|
-
//#endregion
|
|
193
|
-
//#region src/util/typescript.ts
|
|
194
|
-
var
|
|
195
|
-
constructor(e) {
|
|
196
|
-
super(`Unreachable case: ${e}`);
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
function Re(e, t = !0) {
|
|
200
|
-
let { "data-test": n, ...r } = e;
|
|
201
|
-
if (Object.keys(r).length > 0 && t) throw Error("Object must be empty " + JSON.stringify(e));
|
|
202
|
-
}
|
|
203
|
-
//#endregion
|
|
204
|
-
//#region src/util/browser.ts
|
|
205
|
-
var ze = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
206
|
-
function E(e, t = "Ctrl") {
|
|
207
|
-
return ze() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
|
|
208
|
-
}
|
|
209
|
-
function D(...e) {
|
|
210
|
-
return [...new Set(e.filter((e) => e).join(" ").split(" "))].join(" ");
|
|
211
|
-
}
|
|
212
|
-
var Be = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
213
|
-
//#endregion
|
|
214
|
-
//#region src/blocks/defaultBlockHelpers.ts
|
|
215
|
-
function Ve(e, t, n, r) {
|
|
216
|
-
let i = document.createElement("div");
|
|
217
|
-
i.className = D("bn-block-content", n.class), i.setAttribute("data-content-type", e);
|
|
218
|
-
for (let [e, t] of Object.entries(n)) e !== "class" && i.setAttribute(e, t);
|
|
219
|
-
let a = document.createElement(t);
|
|
220
|
-
a.className = D("bn-inline-content", r.class);
|
|
221
|
-
for (let [e, t] of Object.entries(r)) e !== "class" && a.setAttribute(e, t);
|
|
222
|
-
return i.appendChild(a), {
|
|
223
|
-
dom: i,
|
|
224
|
-
contentDOM: a
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
var He = (e, t) => {
|
|
228
|
-
let n = W(e, t.pmSchema);
|
|
229
|
-
n.type.name === "blockContainer" && (n = n.firstChild);
|
|
230
|
-
let r = t.pmSchema.nodes[n.type.name].spec.toDOM;
|
|
231
|
-
if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
|
|
232
|
-
let i = r(n);
|
|
233
|
-
if (typeof i != "object" || !("dom" in i)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");
|
|
234
|
-
return i;
|
|
235
|
-
};
|
|
236
|
-
function Ue(e, t = "<br>") {
|
|
237
|
-
let n = e.querySelectorAll("p");
|
|
238
|
-
if (n.length > 1) {
|
|
239
|
-
let e = n[0];
|
|
240
|
-
for (let r = 1; r < n.length; r++) {
|
|
241
|
-
let i = n[r];
|
|
242
|
-
e.innerHTML += t + i.innerHTML, i.remove();
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
//#endregion
|
|
247
|
-
//#region src/util/string.ts
|
|
248
|
-
function O(e) {
|
|
249
|
-
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
250
|
-
}
|
|
251
|
-
function We(e) {
|
|
252
|
-
let t = e.split("/");
|
|
253
|
-
return !t.length || t[t.length - 1] === "" ? e : t[t.length - 1];
|
|
254
|
-
}
|
|
255
|
-
function Ge(e) {
|
|
256
|
-
let t = [
|
|
257
|
-
"mp4",
|
|
258
|
-
"webm",
|
|
259
|
-
"ogg",
|
|
260
|
-
"mov",
|
|
261
|
-
"mkv",
|
|
262
|
-
"flv",
|
|
263
|
-
"avi",
|
|
264
|
-
"wmv",
|
|
265
|
-
"m4v"
|
|
266
|
-
];
|
|
267
|
-
try {
|
|
268
|
-
let n = new URL(e).pathname.split(".").pop()?.toLowerCase() || "";
|
|
269
|
-
return t.includes(n);
|
|
270
|
-
} catch {
|
|
271
|
-
return !1;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
//#endregion
|
|
275
|
-
//#region src/schema/blocks/internal.ts
|
|
276
|
-
function Ke(e) {
|
|
277
|
-
let t = {};
|
|
278
|
-
return Object.entries(e).forEach(([e, n]) => {
|
|
279
|
-
t[e] = {
|
|
280
|
-
default: n.default,
|
|
281
|
-
keepOnSplit: !0,
|
|
282
|
-
parseHTML: (t) => {
|
|
283
|
-
let r = t.getAttribute(O(e));
|
|
284
|
-
if (r === null) return null;
|
|
285
|
-
if (n.default === void 0 && n.type === "boolean" || n.default !== void 0 && typeof n.default == "boolean") return r === "true" ? !0 : r === "false" ? !1 : null;
|
|
286
|
-
if (n.default === void 0 && n.type === "number" || n.default !== void 0 && typeof n.default == "number") {
|
|
287
|
-
let e = parseFloat(r);
|
|
288
|
-
return !Number.isNaN(e) && Number.isFinite(e) ? e : null;
|
|
289
|
-
}
|
|
290
|
-
return r;
|
|
291
|
-
},
|
|
292
|
-
renderHTML: (t) => t[e] === n.default ? {} : { [O(e)]: t[e] }
|
|
293
|
-
};
|
|
294
|
-
}), t;
|
|
295
|
-
}
|
|
296
|
-
function qe(e, t, n, r) {
|
|
297
|
-
let i = e();
|
|
298
|
-
if (i === void 0) throw Error("Cannot find node position");
|
|
299
|
-
let a = n.state.doc.resolve(i).node().attrs.id;
|
|
300
|
-
if (!a) throw Error("Block doesn't have id");
|
|
301
|
-
let o = t.getBlock(a);
|
|
302
|
-
if (o.type !== r) throw Error("Block type does not match");
|
|
303
|
-
return o;
|
|
304
|
-
}
|
|
305
|
-
function k(e, t, n, r, i = !1, a) {
|
|
306
|
-
let o = document.createElement("div");
|
|
307
|
-
if (a !== void 0) for (let [e, t] of Object.entries(a)) e !== "class" && o.setAttribute(e, t);
|
|
308
|
-
o.className = D("bn-block-content", a?.class || ""), o.setAttribute("data-content-type", t);
|
|
309
|
-
for (let [e, t] of Object.entries(n)) t !== r[e].default && o.setAttribute(O(e), t);
|
|
310
|
-
return i && o.setAttribute("data-file-block", ""), o.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = D("bn-inline-content", e.contentDOM.className)), {
|
|
311
|
-
...e,
|
|
312
|
-
dom: o
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
function Je(e, t, n) {
|
|
316
|
-
return {
|
|
317
|
-
config: {
|
|
318
|
-
type: e.type,
|
|
319
|
-
content: e.content,
|
|
320
|
-
propSchema: t
|
|
321
|
-
},
|
|
322
|
-
implementation: {
|
|
323
|
-
node: e.node,
|
|
324
|
-
render: He,
|
|
325
|
-
toExternalHTML: He
|
|
326
|
-
},
|
|
327
|
-
extensions: n
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
//#endregion
|
|
331
|
-
//#region src/schema/blocks/createSpec.ts
|
|
332
|
-
function Ye(e, t) {
|
|
333
|
-
e.stopEvent = (e) => (e.type === "mousedown" && setTimeout(() => {
|
|
334
|
-
t.view.dom.blur();
|
|
335
|
-
}, 10), !0);
|
|
336
|
-
}
|
|
337
|
-
function Xe(e, t) {
|
|
338
|
-
let n = [{
|
|
339
|
-
tag: "[data-content-type=" + e.type + "]",
|
|
340
|
-
contentElement: ".bn-inline-content"
|
|
341
|
-
}];
|
|
342
|
-
return t.parse && n.push({
|
|
343
|
-
tag: "*",
|
|
344
|
-
getAttrs(e) {
|
|
345
|
-
if (typeof e == "string") return !1;
|
|
346
|
-
let n = t.parse?.(e);
|
|
347
|
-
return n === void 0 ? !1 : n;
|
|
348
|
-
},
|
|
349
|
-
preserveWhitespace: !0,
|
|
350
|
-
getContent: e.content === "inline" || e.content === "none" ? (n, r) => {
|
|
351
|
-
if (t.parseContent) {
|
|
352
|
-
let e = t.parseContent({
|
|
353
|
-
el: n,
|
|
354
|
-
schema: r
|
|
355
|
-
});
|
|
356
|
-
if (e !== void 0) return e;
|
|
357
|
-
}
|
|
358
|
-
if (e.content === "inline") {
|
|
359
|
-
let e = n.cloneNode(!0);
|
|
360
|
-
return Ue(e, t.meta?.code ? "\n" : "<br>"), re.fromSchema(r).parse(e, {
|
|
361
|
-
topNode: r.nodes.paragraph.create(),
|
|
362
|
-
preserveWhitespace: !0
|
|
363
|
-
}).content;
|
|
364
|
-
}
|
|
365
|
-
return ae.empty;
|
|
366
|
-
} : void 0
|
|
367
|
-
}), n;
|
|
368
|
-
}
|
|
369
|
-
function Ze(e, t, n, r) {
|
|
370
|
-
let i = t.node || u.create({
|
|
371
|
-
name: e.type,
|
|
372
|
-
content: e.content === "inline" ? "inline*" : e.content === "none" ? "" : e.content,
|
|
373
|
-
group: "blockContent",
|
|
374
|
-
selectable: t.meta?.selectable ?? !0,
|
|
375
|
-
isolating: t.meta?.isolating ?? !0,
|
|
376
|
-
code: t.meta?.code ?? !1,
|
|
377
|
-
defining: t.meta?.defining ?? !0,
|
|
378
|
-
priority: r,
|
|
379
|
-
addAttributes() {
|
|
380
|
-
return Ke(e.propSchema);
|
|
381
|
-
},
|
|
382
|
-
parseHTML() {
|
|
383
|
-
return Xe(e, t);
|
|
384
|
-
},
|
|
385
|
-
renderHTML({ HTMLAttributes: n }) {
|
|
386
|
-
let r = document.createElement("div");
|
|
387
|
-
return k({
|
|
388
|
-
dom: r,
|
|
389
|
-
contentDOM: e.content === "inline" ? r : void 0
|
|
390
|
-
}, e.type, {}, e.propSchema, t.meta?.fileBlockAccept !== void 0, n);
|
|
391
|
-
},
|
|
392
|
-
addNodeView() {
|
|
393
|
-
return (n) => {
|
|
394
|
-
let r = this.options.editor, i = qe(n.getPos, r, this.editor, e.type), a = this.options.domAttributes?.blockContent || {}, o = t.render.call({
|
|
395
|
-
blockContentDOMAttributes: a,
|
|
396
|
-
props: n,
|
|
397
|
-
renderType: "nodeView"
|
|
398
|
-
}, i, r);
|
|
399
|
-
return t.meta?.selectable === !1 && Ye(o, this.editor), o;
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
if (i.name !== e.type) throw Error("Node name does not match block type. This is a bug in BlockNote.");
|
|
404
|
-
return {
|
|
405
|
-
config: e,
|
|
406
|
-
implementation: {
|
|
407
|
-
...t,
|
|
408
|
-
node: i,
|
|
409
|
-
render(e, n) {
|
|
410
|
-
let r = i.options.domAttributes?.blockContent || {};
|
|
411
|
-
return t.render.call({
|
|
412
|
-
blockContentDOMAttributes: r,
|
|
413
|
-
props: void 0,
|
|
414
|
-
renderType: "dom"
|
|
415
|
-
}, e, n);
|
|
416
|
-
},
|
|
417
|
-
toExternalHTML: (e, n, r) => {
|
|
418
|
-
let a = i.options.domAttributes?.blockContent || {};
|
|
419
|
-
return t.toExternalHTML?.call({ blockContentDOMAttributes: a }, e, n, r) ?? t.render.call({
|
|
420
|
-
blockContentDOMAttributes: a,
|
|
421
|
-
renderType: "dom",
|
|
422
|
-
props: void 0
|
|
423
|
-
}, e, n);
|
|
424
|
-
}
|
|
425
|
-
},
|
|
426
|
-
extensions: n
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
function A(e) {
|
|
430
|
-
return e;
|
|
431
|
-
}
|
|
432
|
-
function j(e, t, n) {
|
|
433
|
-
return (r = {}) => {
|
|
434
|
-
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;
|
|
435
|
-
return {
|
|
436
|
-
config: i,
|
|
437
|
-
implementation: {
|
|
438
|
-
...a,
|
|
439
|
-
toExternalHTML(e, t, n) {
|
|
440
|
-
let r = a.toExternalHTML?.call({ blockContentDOMAttributes: this.blockContentDOMAttributes }, e, t, n);
|
|
441
|
-
if (r !== void 0) return k(r, e.type, e.props, i.propSchema, a.meta?.fileBlockAccept !== void 0);
|
|
442
|
-
},
|
|
443
|
-
render(e, t) {
|
|
444
|
-
return k(a.render.call({
|
|
445
|
-
blockContentDOMAttributes: this.blockContentDOMAttributes,
|
|
446
|
-
renderType: this.renderType,
|
|
447
|
-
props: this.props
|
|
448
|
-
}, e, t), e.type, e.props, i.propSchema, a.meta?.fileBlockAccept !== void 0, this.blockContentDOMAttributes);
|
|
449
|
-
}
|
|
450
|
-
},
|
|
451
|
-
extensions: o
|
|
452
|
-
};
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
//#endregion
|
|
456
|
-
//#region src/api/getBlockInfoFromPos.ts
|
|
457
|
-
function Qe(e, t) {
|
|
458
|
-
let n = e.resolve(t);
|
|
459
|
-
if (n.nodeAfter && n.nodeAfter.type.isInGroup("bnBlock")) return {
|
|
460
|
-
posBeforeNode: n.pos,
|
|
461
|
-
node: n.nodeAfter
|
|
462
|
-
};
|
|
463
|
-
let r = n.depth, i = n.node(r);
|
|
464
|
-
for (; r > 0;) {
|
|
465
|
-
if (i.type.isInGroup("bnBlock")) return {
|
|
466
|
-
posBeforeNode: n.before(r),
|
|
467
|
-
node: i
|
|
468
|
-
};
|
|
469
|
-
r--, i = n.node(r);
|
|
470
|
-
}
|
|
471
|
-
let a = [];
|
|
472
|
-
e.descendants((e, t) => {
|
|
473
|
-
e.type.isInGroup("bnBlock") && a.push(t);
|
|
474
|
-
}), console.warn(`Position ${t} is not within a blockContainer node.`);
|
|
475
|
-
let o = e.resolve(a.find((e) => e >= t) || a[a.length - 1]);
|
|
476
|
-
return {
|
|
477
|
-
posBeforeNode: o.pos,
|
|
478
|
-
node: o.nodeAfter
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
function $e(e, t) {
|
|
482
|
-
if (!e.type.isInGroup("bnBlock")) throw Error(`Attempted to get bnBlock node at position but found node of different type ${e.type.name}`);
|
|
483
|
-
let n = e, r = t, i = {
|
|
484
|
-
node: n,
|
|
485
|
-
beforePos: r,
|
|
486
|
-
afterPos: r + n.nodeSize
|
|
487
|
-
};
|
|
488
|
-
if (n.type.name === "blockContainer") {
|
|
489
|
-
let e, t;
|
|
490
|
-
if (n.forEach((n, i) => {
|
|
491
|
-
if (n.type.spec.group === "blockContent") {
|
|
492
|
-
let t = n, a = r + i + 1;
|
|
493
|
-
e = {
|
|
494
|
-
node: t,
|
|
495
|
-
beforePos: a,
|
|
496
|
-
afterPos: a + n.nodeSize
|
|
497
|
-
};
|
|
498
|
-
} else if (n.type.name === "blockGroup") {
|
|
499
|
-
let e = n, a = r + i + 1;
|
|
500
|
-
t = {
|
|
501
|
-
node: e,
|
|
502
|
-
beforePos: a,
|
|
503
|
-
afterPos: a + n.nodeSize
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
}), !e) throw Error(`blockContainer node does not contain a blockContent node in its children: ${n}`);
|
|
507
|
-
return {
|
|
508
|
-
isBlockContainer: !0,
|
|
509
|
-
bnBlock: i,
|
|
510
|
-
blockContent: e,
|
|
511
|
-
childContainer: t,
|
|
512
|
-
blockNoteType: e.node.type.name
|
|
513
|
-
};
|
|
514
|
-
} else {
|
|
515
|
-
if (!i.node.type.isInGroup("childContainer")) throw Error(`bnBlock node is not in the childContainer group: ${i.node}`);
|
|
516
|
-
return {
|
|
517
|
-
isBlockContainer: !1,
|
|
518
|
-
bnBlock: i,
|
|
519
|
-
childContainer: i,
|
|
520
|
-
blockNoteType: i.node.type.name
|
|
521
|
-
};
|
|
281
|
+
}
|
|
282
|
+
function w(e) {
|
|
283
|
+
return e != null && typeof e != "string" && !Array.isArray(e) && e.type === "tableCell";
|
|
284
|
+
}
|
|
285
|
+
function Ve(e) {
|
|
286
|
+
return w(e) && e.props !== void 0 && e.content !== void 0;
|
|
287
|
+
}
|
|
288
|
+
function T(e) {
|
|
289
|
+
return Ve(e) ? e.props.colspan ?? 1 : 1;
|
|
290
|
+
}
|
|
291
|
+
function He(e) {
|
|
292
|
+
return Ve(e) ? e.props.rowspan ?? 1 : 1;
|
|
293
|
+
}
|
|
294
|
+
//#endregion
|
|
295
|
+
//#region src/util/typescript.ts
|
|
296
|
+
var E = class extends Error {
|
|
297
|
+
constructor(e) {
|
|
298
|
+
super(`Unreachable case: ${e}`);
|
|
522
299
|
}
|
|
300
|
+
};
|
|
301
|
+
function Ue(e, t = !0) {
|
|
302
|
+
let { "data-test": n, ...r } = e;
|
|
303
|
+
if (Object.keys(r).length > 0 && t) throw Error("Object must be empty " + JSON.stringify(e));
|
|
523
304
|
}
|
|
524
|
-
|
|
525
|
-
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/util/browser.ts
|
|
307
|
+
var We = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
308
|
+
function D(e, t = "Ctrl") {
|
|
309
|
+
return We() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
|
|
526
310
|
}
|
|
527
|
-
function
|
|
528
|
-
|
|
529
|
-
return $e(e.nodeAfter, e.pos);
|
|
311
|
+
function O(...e) {
|
|
312
|
+
return [...new Set(e.filter((e) => e).join(" ").split(" "))].join(" ");
|
|
530
313
|
}
|
|
531
|
-
|
|
532
|
-
|
|
314
|
+
var Ge = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/blocks/defaultBlockHelpers.ts
|
|
317
|
+
function Ke(e, t, n, r) {
|
|
318
|
+
let i = document.createElement("div");
|
|
319
|
+
i.className = O("bn-block-content", n.class), i.setAttribute("data-content-type", e);
|
|
320
|
+
for (let [e, t] of Object.entries(n)) e !== "class" && i.setAttribute(e, t);
|
|
321
|
+
let a = document.createElement(t);
|
|
322
|
+
a.className = O("bn-inline-content", r.class);
|
|
323
|
+
for (let [e, t] of Object.entries(r)) e !== "class" && a.setAttribute(e, t);
|
|
324
|
+
return i.appendChild(a), {
|
|
325
|
+
dom: i,
|
|
326
|
+
contentDOM: a
|
|
327
|
+
};
|
|
533
328
|
}
|
|
534
|
-
|
|
535
|
-
|
|
329
|
+
var qe = (e, t) => {
|
|
330
|
+
let n = U(e, t.pmSchema);
|
|
331
|
+
n.type.name === "blockContainer" && (n = n.firstChild);
|
|
332
|
+
let r = t.pmSchema.nodes[n.type.name].spec.toDOM;
|
|
333
|
+
if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
|
|
334
|
+
let i = r(n);
|
|
335
|
+
if (typeof i != "object" || !("dom" in i)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");
|
|
336
|
+
return i;
|
|
337
|
+
};
|
|
338
|
+
function Je(e, t = "<br>") {
|
|
339
|
+
let n = e.querySelectorAll("p");
|
|
340
|
+
if (n.length > 1) {
|
|
341
|
+
let e = n[0];
|
|
342
|
+
for (let r = 1; r < n.length; r++) {
|
|
343
|
+
let i = n[r];
|
|
344
|
+
e.innerHTML += t + i.innerHTML, i.remove();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
536
347
|
}
|
|
537
348
|
//#endregion
|
|
538
349
|
//#region src/api/pmUtil.ts
|
|
539
|
-
function
|
|
350
|
+
function k(e) {
|
|
540
351
|
return "doc" in e ? e.doc.type.schema : e.type.schema;
|
|
541
352
|
}
|
|
542
|
-
function
|
|
353
|
+
function Ye(e) {
|
|
543
354
|
return e.cached.blockNoteEditor;
|
|
544
355
|
}
|
|
545
|
-
function
|
|
546
|
-
return
|
|
356
|
+
function Xe(e) {
|
|
357
|
+
return Ye(e).schema;
|
|
547
358
|
}
|
|
548
|
-
function
|
|
549
|
-
return
|
|
359
|
+
function Ze(e) {
|
|
360
|
+
return Xe(e).blockSchema;
|
|
550
361
|
}
|
|
551
|
-
function
|
|
552
|
-
return
|
|
362
|
+
function Qe(e) {
|
|
363
|
+
return Xe(e).inlineContentSchema;
|
|
553
364
|
}
|
|
554
|
-
function
|
|
555
|
-
return
|
|
365
|
+
function A(e) {
|
|
366
|
+
return Xe(e).styleSchema;
|
|
556
367
|
}
|
|
557
|
-
function
|
|
558
|
-
return
|
|
368
|
+
function $e(e) {
|
|
369
|
+
return Ye(e).blockCache;
|
|
370
|
+
}
|
|
371
|
+
function et(e, t) {
|
|
372
|
+
return Ze(e)[t.name]?.content === "plain";
|
|
559
373
|
}
|
|
560
374
|
//#endregion
|
|
561
375
|
//#region src/api/nodeConversions/nodeToBlock.ts
|
|
562
|
-
function
|
|
376
|
+
function tt(e, t, n) {
|
|
563
377
|
let r = {
|
|
564
378
|
type: "tableContent",
|
|
565
379
|
columnWidths: [],
|
|
@@ -574,10 +388,10 @@ function st(e, t, n) {
|
|
|
574
388
|
t ??= Array(e.attrs.colspan ?? 1).fill(void 0), r.columnWidths.push(...t);
|
|
575
389
|
}), s.cells = e.content.content.map((e, r) => (i[o] || (i[o] = []), i[o][r] = e.type.name === "tableHeader", {
|
|
576
390
|
type: "tableCell",
|
|
577
|
-
content: e.content.content.map((e) =>
|
|
391
|
+
content: e.content.content.map((e) => j(e, t, n)).reduce((e, t) => {
|
|
578
392
|
if (!e.length) return t;
|
|
579
393
|
let n = e[e.length - 1], r = t[0];
|
|
580
|
-
return r &&
|
|
394
|
+
return r && S(n) && S(r) && JSON.stringify(n.styles) === JSON.stringify(r.styles) ? (n.text += "\n" + r.text, e.push(...t.slice(1)), e) : (e.push(...t), e);
|
|
581
395
|
}, []),
|
|
582
396
|
props: {
|
|
583
397
|
colspan: e.attrs.colspan,
|
|
@@ -592,12 +406,12 @@ function st(e, t, n) {
|
|
|
592
406
|
for (let e = 0; e < i[0]?.length; e++) i?.every((t) => t[e]) && (r.headerCols = (r.headerCols ?? 0) + 1);
|
|
593
407
|
return r;
|
|
594
408
|
}
|
|
595
|
-
function
|
|
409
|
+
function j(e, t, n) {
|
|
596
410
|
let r = [], i;
|
|
597
411
|
return e.content.forEach((e) => {
|
|
598
412
|
if (e.type.name === "hardBreak") {
|
|
599
|
-
if (i) if (
|
|
600
|
-
else if (
|
|
413
|
+
if (i) if (S(i)) i.text += "\n";
|
|
414
|
+
else if (ze(i)) i.content[i.content.length - 1].text += "\n";
|
|
601
415
|
else throw Error("unexpected");
|
|
602
416
|
else i = {
|
|
603
417
|
type: "text",
|
|
@@ -611,7 +425,7 @@ function I(e, t, n) {
|
|
|
611
425
|
console.warn("unrecognized inline content type", e.type.name);
|
|
612
426
|
return;
|
|
613
427
|
}
|
|
614
|
-
i &&= (r.push(i), void 0), r.push(
|
|
428
|
+
i &&= (r.push(i), void 0), r.push(nt(e, t, n));
|
|
615
429
|
return;
|
|
616
430
|
}
|
|
617
431
|
let a = {}, o;
|
|
@@ -624,9 +438,9 @@ function I(e, t, n) {
|
|
|
624
438
|
}
|
|
625
439
|
if (e.propSchema === "boolean") a[e.type] = !0;
|
|
626
440
|
else if (e.propSchema === "string") a[e.type] = t.attrs.stringValue;
|
|
627
|
-
else throw new
|
|
441
|
+
else throw new E(e.propSchema);
|
|
628
442
|
}
|
|
629
|
-
i ?
|
|
443
|
+
i ? S(i) ? o ? (r.push(i), i = {
|
|
630
444
|
type: "link",
|
|
631
445
|
href: o.attrs.href,
|
|
632
446
|
content: [{
|
|
@@ -638,7 +452,7 @@ function I(e, t, n) {
|
|
|
638
452
|
type: "text",
|
|
639
453
|
text: e.textContent,
|
|
640
454
|
styles: a
|
|
641
|
-
}) :
|
|
455
|
+
}) : ze(i) && (o ? i.href === o.attrs.href ? JSON.stringify(i.content[i.content.length - 1].styles) === JSON.stringify(a) ? i.content[i.content.length - 1].text += e.textContent : i.content.push({
|
|
642
456
|
type: "text",
|
|
643
457
|
text: e.textContent,
|
|
644
458
|
styles: a
|
|
@@ -669,7 +483,7 @@ function I(e, t, n) {
|
|
|
669
483
|
};
|
|
670
484
|
}), i && r.push(i), r;
|
|
671
485
|
}
|
|
672
|
-
function
|
|
486
|
+
function nt(e, t, n) {
|
|
673
487
|
if (e.type.name === "text" || e.type.name === "link") throw Error("unexpected");
|
|
674
488
|
let r = {}, i = t[e.type.name];
|
|
675
489
|
for (let [t, n] of Object.entries(e.attrs)) {
|
|
@@ -677,82 +491,95 @@ function ct(e, t, n) {
|
|
|
677
491
|
t in i.propSchema && (r[t] = n);
|
|
678
492
|
}
|
|
679
493
|
let a;
|
|
680
|
-
return a = i.content === "styled" ?
|
|
494
|
+
return a = i.content === "styled" ? j(e, t, n) : void 0, {
|
|
681
495
|
type: e.type.name,
|
|
682
496
|
props: r,
|
|
683
497
|
content: a
|
|
684
498
|
};
|
|
685
499
|
}
|
|
686
|
-
function
|
|
500
|
+
function M(e, t) {
|
|
501
|
+
let n = e.type.schema, r = Ze(n), i = Qe(n), a = A(n), o = $e(n);
|
|
687
502
|
if (!e.type.isInGroup("bnBlock")) throw Error("Node should be a bnBlock, but is instead: " + e.type.name);
|
|
688
|
-
let
|
|
689
|
-
if (
|
|
690
|
-
let
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
503
|
+
let s = o?.get(e);
|
|
504
|
+
if (s) return s;
|
|
505
|
+
let c = Me(e, 0), l;
|
|
506
|
+
try {
|
|
507
|
+
l = Ae(c.bnBlock.node, t);
|
|
508
|
+
} catch {
|
|
509
|
+
l = Re.options.generateID();
|
|
510
|
+
}
|
|
511
|
+
let u = r[c.blockNoteType];
|
|
512
|
+
if (!u) throw Error("Block is of an unrecognized type: " + c.blockNoteType);
|
|
513
|
+
let d = {};
|
|
695
514
|
for (let [t, n] of Object.entries({
|
|
696
515
|
...e.attrs,
|
|
697
|
-
...
|
|
516
|
+
...c.isBlockContainer ? c.blockContent.node.attrs : {}
|
|
698
517
|
})) {
|
|
699
|
-
let e =
|
|
700
|
-
t in e && !(e[t].default === void 0 && n === void 0) && (
|
|
518
|
+
let e = u.propSchema;
|
|
519
|
+
t in e && !(e[t].default === void 0 && n === void 0) && (d[t] = n);
|
|
701
520
|
}
|
|
702
|
-
let
|
|
703
|
-
|
|
704
|
-
|
|
521
|
+
let f = r[c.blockNoteType], p = [];
|
|
522
|
+
c.childContainer?.node.forEach((e) => {
|
|
523
|
+
p.push(M(e, t));
|
|
705
524
|
});
|
|
706
|
-
let
|
|
707
|
-
if (
|
|
708
|
-
if (!
|
|
709
|
-
|
|
710
|
-
} else if (
|
|
711
|
-
if (!
|
|
712
|
-
|
|
713
|
-
} else if (
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
525
|
+
let m;
|
|
526
|
+
if (f.content === "inline") {
|
|
527
|
+
if (!c.isBlockContainer) throw Error("impossible");
|
|
528
|
+
m = j(c.blockContent.node, i, a);
|
|
529
|
+
} else if (f.content === "table") {
|
|
530
|
+
if (!c.isBlockContainer) throw Error("impossible");
|
|
531
|
+
m = tt(c.blockContent.node, i, a);
|
|
532
|
+
} else if (f.content === "plain") {
|
|
533
|
+
if (!c.isBlockContainer) throw Error("impossible");
|
|
534
|
+
let e = c.blockContent.node.textContent;
|
|
535
|
+
m = e.length > 0 ? [{
|
|
536
|
+
type: "text",
|
|
537
|
+
text: e,
|
|
538
|
+
styles: {}
|
|
539
|
+
}] : [];
|
|
540
|
+
} else if (f.content === "none") m = void 0;
|
|
541
|
+
else throw new E(f.content);
|
|
542
|
+
let h = {
|
|
543
|
+
id: l,
|
|
544
|
+
type: f.type,
|
|
545
|
+
props: d,
|
|
546
|
+
content: m,
|
|
547
|
+
children: p
|
|
721
548
|
};
|
|
722
|
-
return
|
|
723
|
-
}
|
|
724
|
-
function
|
|
725
|
-
let
|
|
726
|
-
return e.firstChild && e.firstChild.descendants((
|
|
727
|
-
}
|
|
728
|
-
function
|
|
729
|
-
function
|
|
730
|
-
if (
|
|
731
|
-
let
|
|
732
|
-
return
|
|
733
|
-
if (
|
|
734
|
-
if (
|
|
735
|
-
if (
|
|
736
|
-
let
|
|
737
|
-
if (
|
|
738
|
-
if (!
|
|
739
|
-
let e =
|
|
740
|
-
|
|
549
|
+
return o?.set(e, h), h;
|
|
550
|
+
}
|
|
551
|
+
function rt(e) {
|
|
552
|
+
let t = [];
|
|
553
|
+
return e.firstChild && e.firstChild.descendants((n) => (t.push(M(n, e)), !1)), t;
|
|
554
|
+
}
|
|
555
|
+
function it(e) {
|
|
556
|
+
function t(n, r, i) {
|
|
557
|
+
if (n.type.name !== "blockGroup") throw Error("unexpected");
|
|
558
|
+
let a = [], o, s;
|
|
559
|
+
return n.forEach((c, l, u) => {
|
|
560
|
+
if (c.type.name !== "blockContainer") throw Error("unexpected");
|
|
561
|
+
if (c.childCount === 0) return;
|
|
562
|
+
if (c.childCount === 0 || c.childCount > 2) throw Error("unexpected, blockContainer.childCount: " + c.childCount);
|
|
563
|
+
let d = u === 0, f = u === n.childCount - 1;
|
|
564
|
+
if (c.firstChild.type.name === "blockGroup") {
|
|
565
|
+
if (!d) throw Error("unexpected");
|
|
566
|
+
let e = t(c.firstChild, Math.max(0, r - 1), f ? Math.max(0, i - 1) : 0);
|
|
567
|
+
o = e.blockCutAtStart, f && (s = e.blockCutAtEnd), a.push(...e.blocks);
|
|
741
568
|
return;
|
|
742
569
|
}
|
|
743
|
-
let
|
|
744
|
-
if (
|
|
745
|
-
let e =
|
|
746
|
-
|
|
570
|
+
let p = M(c, e.content.firstChild), m = c.childCount > 1 ? c.child(1) : void 0, h = [];
|
|
571
|
+
if (m) {
|
|
572
|
+
let e = t(m, 0, f ? Math.max(0, i - 1) : 0);
|
|
573
|
+
h = e.blocks, f && (s = e.blockCutAtEnd);
|
|
747
574
|
}
|
|
748
|
-
|
|
749
|
-
...
|
|
750
|
-
children:
|
|
575
|
+
f && !m && i > 1 && (s = p.id), d && r > 1 && (o = p.id), a.push({
|
|
576
|
+
...p,
|
|
577
|
+
children: h
|
|
751
578
|
});
|
|
752
579
|
}), {
|
|
753
|
-
blocks:
|
|
754
|
-
blockCutAtStart:
|
|
755
|
-
blockCutAtEnd:
|
|
580
|
+
blocks: a,
|
|
581
|
+
blockCutAtStart: o,
|
|
582
|
+
blockCutAtEnd: s
|
|
756
583
|
};
|
|
757
584
|
}
|
|
758
585
|
if (e.content.childCount === 0) return {
|
|
@@ -761,27 +588,255 @@ function ut(e, t, n = at(t), r = ot(t), i = P(t), a = F(t)) {
|
|
|
761
588
|
blockCutAtEnd: void 0
|
|
762
589
|
};
|
|
763
590
|
if (e.content.childCount !== 1) throw Error("slice must be a single block, did you forget includeParents=true?");
|
|
764
|
-
return
|
|
591
|
+
return t(e.content.firstChild, Math.max(e.openStart - 1, 0), Math.max(e.openEnd - 1, 0));
|
|
592
|
+
}
|
|
593
|
+
//#endregion
|
|
594
|
+
//#region src/util/string.ts
|
|
595
|
+
function N(e) {
|
|
596
|
+
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
597
|
+
}
|
|
598
|
+
function at(e) {
|
|
599
|
+
let t = e.split("/");
|
|
600
|
+
return !t.length || t[t.length - 1] === "" ? e : t[t.length - 1];
|
|
601
|
+
}
|
|
602
|
+
function ot(e) {
|
|
603
|
+
let t = [
|
|
604
|
+
"mp4",
|
|
605
|
+
"webm",
|
|
606
|
+
"ogg",
|
|
607
|
+
"mov",
|
|
608
|
+
"mkv",
|
|
609
|
+
"flv",
|
|
610
|
+
"avi",
|
|
611
|
+
"wmv",
|
|
612
|
+
"m4v"
|
|
613
|
+
];
|
|
614
|
+
try {
|
|
615
|
+
let n = new URL(e).pathname.split(".").pop()?.toLowerCase() || "";
|
|
616
|
+
return t.includes(n);
|
|
617
|
+
} catch {
|
|
618
|
+
return !1;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region src/schema/blocks/internal.ts
|
|
623
|
+
function st(e) {
|
|
624
|
+
let t = {};
|
|
625
|
+
return Object.entries(e).forEach(([e, n]) => {
|
|
626
|
+
t[e] = {
|
|
627
|
+
default: n.default,
|
|
628
|
+
keepOnSplit: !0,
|
|
629
|
+
parseHTML: (t) => {
|
|
630
|
+
let r = t.getAttribute(N(e));
|
|
631
|
+
if (r === null) return null;
|
|
632
|
+
if (n.default === void 0 && n.type === "boolean" || n.default !== void 0 && typeof n.default == "boolean") return r === "true" ? !0 : r === "false" ? !1 : null;
|
|
633
|
+
if (n.default === void 0 && n.type === "number" || n.default !== void 0 && typeof n.default == "number") {
|
|
634
|
+
let e = parseFloat(r);
|
|
635
|
+
return !Number.isNaN(e) && Number.isFinite(e) ? e : null;
|
|
636
|
+
}
|
|
637
|
+
return r;
|
|
638
|
+
},
|
|
639
|
+
renderHTML: (t) => t[e] === n.default ? {} : { [N(e)]: t[e] }
|
|
640
|
+
};
|
|
641
|
+
}), t;
|
|
642
|
+
}
|
|
643
|
+
function ct(e, t) {
|
|
644
|
+
let n = e();
|
|
645
|
+
if (n === void 0) throw Error("Cannot find node position");
|
|
646
|
+
let r = t.resolve(n).node();
|
|
647
|
+
if (!r) throw Error("Cannot find block container");
|
|
648
|
+
return M(r, t);
|
|
649
|
+
}
|
|
650
|
+
function P(e, t, n, r, i = !1, a) {
|
|
651
|
+
let o = document.createElement("div");
|
|
652
|
+
if (a !== void 0) for (let [e, t] of Object.entries(a)) e !== "class" && o.setAttribute(e, t);
|
|
653
|
+
o.className = O("bn-block-content", a?.class || ""), o.setAttribute("data-content-type", t);
|
|
654
|
+
for (let [e, t] of Object.entries(n)) t !== r[e]?.default && o.setAttribute(N(e), t);
|
|
655
|
+
return i && o.setAttribute("data-file-block", ""), o.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = O("bn-inline-content", e.contentDOM.className)), {
|
|
656
|
+
...e,
|
|
657
|
+
dom: o
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
function lt(e, t, n) {
|
|
661
|
+
return {
|
|
662
|
+
config: {
|
|
663
|
+
type: e.type,
|
|
664
|
+
content: e.content,
|
|
665
|
+
propSchema: t
|
|
666
|
+
},
|
|
667
|
+
implementation: {
|
|
668
|
+
node: e.node,
|
|
669
|
+
render: qe,
|
|
670
|
+
toExternalHTML: qe
|
|
671
|
+
},
|
|
672
|
+
extensions: n
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
//#endregion
|
|
676
|
+
//#region src/schema/blocks/createSpec.ts
|
|
677
|
+
function ut(e, t) {
|
|
678
|
+
e.stopEvent = (e) => (e.type === "mousedown" && setTimeout(() => {
|
|
679
|
+
t.view.dom.blur();
|
|
680
|
+
}, 10), !0);
|
|
681
|
+
}
|
|
682
|
+
function dt(e, t) {
|
|
683
|
+
let n = [{
|
|
684
|
+
tag: "[data-content-type=" + e.type + "]",
|
|
685
|
+
contentElement: ".bn-inline-content"
|
|
686
|
+
}];
|
|
687
|
+
return t.parse && n.push({
|
|
688
|
+
tag: "*",
|
|
689
|
+
getAttrs(e) {
|
|
690
|
+
if (typeof e == "string") return !1;
|
|
691
|
+
let n = t.parse?.(e);
|
|
692
|
+
return n === void 0 ? !1 : n;
|
|
693
|
+
},
|
|
694
|
+
preserveWhitespace: !0,
|
|
695
|
+
getContent: e.content === "inline" || e.content === "none" || e.content === "plain" ? (n, r) => {
|
|
696
|
+
if (t.parseContent) {
|
|
697
|
+
let e = t.parseContent({
|
|
698
|
+
el: n,
|
|
699
|
+
schema: r
|
|
700
|
+
});
|
|
701
|
+
if (e !== void 0) return e;
|
|
702
|
+
}
|
|
703
|
+
if (e.content === "inline" || e.content === "plain") {
|
|
704
|
+
let i = n.cloneNode(!0);
|
|
705
|
+
Je(i, e.content === "plain" || t.meta?.code ? "\n" : "<br>");
|
|
706
|
+
let a = re.fromSchema(r).parse(i, {
|
|
707
|
+
topNode: r.nodes.paragraph.create(),
|
|
708
|
+
preserveWhitespace: !0
|
|
709
|
+
});
|
|
710
|
+
if (e.content === "plain") {
|
|
711
|
+
let e = [];
|
|
712
|
+
return a.content.forEach((t) => {
|
|
713
|
+
if (t.isText) e.push(t);
|
|
714
|
+
else {
|
|
715
|
+
let n = t.type === r.linebreakReplacement ? "\n" : t.textContent;
|
|
716
|
+
n && e.push(r.text(n, t.marks));
|
|
717
|
+
}
|
|
718
|
+
}), ae.fromArray(e);
|
|
719
|
+
}
|
|
720
|
+
return a.content;
|
|
721
|
+
}
|
|
722
|
+
return ae.empty;
|
|
723
|
+
} : void 0
|
|
724
|
+
}), n;
|
|
725
|
+
}
|
|
726
|
+
function ft(t, n, r, i) {
|
|
727
|
+
let a = n.node || u.create({
|
|
728
|
+
name: t.type,
|
|
729
|
+
content: t.content === "inline" ? "inline*" : t.content === "plain" ? "text*" : t.content === "none" ? "" : t.content,
|
|
730
|
+
marks() {
|
|
731
|
+
return t.content === "plain" ? e(this.editor) : void 0;
|
|
732
|
+
},
|
|
733
|
+
group: "blockContent",
|
|
734
|
+
selectable: n.meta?.selectable ?? !0,
|
|
735
|
+
isolating: n.meta?.isolating ?? !0,
|
|
736
|
+
code: n.meta?.code ?? !1,
|
|
737
|
+
defining: n.meta?.defining ?? !0,
|
|
738
|
+
priority: i,
|
|
739
|
+
addAttributes() {
|
|
740
|
+
return st(t.propSchema);
|
|
741
|
+
},
|
|
742
|
+
parseHTML() {
|
|
743
|
+
return dt(t, n);
|
|
744
|
+
},
|
|
745
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
746
|
+
let r = document.createElement("div");
|
|
747
|
+
return P({
|
|
748
|
+
dom: r,
|
|
749
|
+
contentDOM: t.content === "inline" || t.content === "plain" ? r : void 0
|
|
750
|
+
}, t.type, {}, t.propSchema, n.meta?.fileBlockAccept !== void 0, e);
|
|
751
|
+
},
|
|
752
|
+
addNodeView() {
|
|
753
|
+
return (e) => {
|
|
754
|
+
let r = this.options.editor, i = ct(e.getPos, e.view.state.doc), a = this.options.domAttributes?.blockContent || {}, o = n.render.call({
|
|
755
|
+
blockContentDOMAttributes: a,
|
|
756
|
+
props: e,
|
|
757
|
+
renderType: "nodeView",
|
|
758
|
+
propSchema: t.propSchema
|
|
759
|
+
}, i, r);
|
|
760
|
+
return n.meta?.selectable === !1 && ut(o, this.editor), o;
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
if (a.name !== t.type) throw Error("Node name does not match block type. This is a bug in BlockNote.");
|
|
765
|
+
return {
|
|
766
|
+
config: t,
|
|
767
|
+
implementation: {
|
|
768
|
+
...n,
|
|
769
|
+
node: a,
|
|
770
|
+
render(e, r) {
|
|
771
|
+
let i = a.options.domAttributes?.blockContent || {};
|
|
772
|
+
return n.render.call({
|
|
773
|
+
blockContentDOMAttributes: i,
|
|
774
|
+
props: void 0,
|
|
775
|
+
renderType: "dom",
|
|
776
|
+
propSchema: t.propSchema
|
|
777
|
+
}, e, r);
|
|
778
|
+
},
|
|
779
|
+
toExternalHTML: (e, r, i) => {
|
|
780
|
+
let o = a.options.domAttributes?.blockContent || {};
|
|
781
|
+
return n.toExternalHTML?.call({
|
|
782
|
+
blockContentDOMAttributes: o,
|
|
783
|
+
propSchema: t.propSchema
|
|
784
|
+
}, e, r, i) ?? n.render.call({
|
|
785
|
+
blockContentDOMAttributes: o,
|
|
786
|
+
renderType: "dom",
|
|
787
|
+
props: void 0,
|
|
788
|
+
propSchema: t.propSchema
|
|
789
|
+
}, e, r);
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
extensions: r
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
function F(e) {
|
|
796
|
+
return e;
|
|
797
|
+
}
|
|
798
|
+
function I(e, t, n) {
|
|
799
|
+
return (r = {}) => {
|
|
800
|
+
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;
|
|
801
|
+
return {
|
|
802
|
+
config: i,
|
|
803
|
+
implementation: {
|
|
804
|
+
...a,
|
|
805
|
+
toExternalHTML(e, t, n) {
|
|
806
|
+
let r = a.toExternalHTML?.call({ blockContentDOMAttributes: this.blockContentDOMAttributes }, e, t, n);
|
|
807
|
+
if (r !== void 0) return P(r, e.type, e.props, this.propSchema ?? i.propSchema, a.meta?.fileBlockAccept !== void 0);
|
|
808
|
+
},
|
|
809
|
+
render(e, t) {
|
|
810
|
+
return P(a.render.call({
|
|
811
|
+
blockContentDOMAttributes: this.blockContentDOMAttributes,
|
|
812
|
+
renderType: this.renderType,
|
|
813
|
+
props: this.props
|
|
814
|
+
}, e, t), e.type, e.props, this.propSchema ?? i.propSchema, a.meta?.fileBlockAccept !== void 0, this.blockContentDOMAttributes);
|
|
815
|
+
}
|
|
816
|
+
},
|
|
817
|
+
extensions: o
|
|
818
|
+
};
|
|
819
|
+
};
|
|
765
820
|
}
|
|
766
821
|
//#endregion
|
|
767
822
|
//#region src/schema/inlineContent/internal.ts
|
|
768
|
-
function
|
|
769
|
-
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([e, t]) => t !== r[e]
|
|
823
|
+
function pt(e, t, n, r) {
|
|
824
|
+
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([e, t]) => t !== r[e]?.default).map(([e, t]) => [N(e), t]).forEach(([t, n]) => e.dom.setAttribute(t, n)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
770
825
|
}
|
|
771
|
-
function
|
|
826
|
+
function mt(e) {
|
|
772
827
|
return { Backspace: ({ editor: t }) => {
|
|
773
828
|
let n = t.state.selection.$from;
|
|
774
829
|
return t.state.selection.empty && n.node().type.name === e.type && n.parentOffset === 0;
|
|
775
830
|
} };
|
|
776
831
|
}
|
|
777
|
-
function
|
|
832
|
+
function ht(e, t) {
|
|
778
833
|
return {
|
|
779
834
|
config: e,
|
|
780
835
|
implementation: t
|
|
781
836
|
};
|
|
782
837
|
}
|
|
783
|
-
function
|
|
784
|
-
return
|
|
838
|
+
function gt(e, t, n) {
|
|
839
|
+
return ht({
|
|
785
840
|
type: e.name,
|
|
786
841
|
propSchema: t,
|
|
787
842
|
content: e.config.content === "inline*" ? "styled" : "none"
|
|
@@ -790,12 +845,12 @@ function mt(e, t, n) {
|
|
|
790
845
|
node: e
|
|
791
846
|
});
|
|
792
847
|
}
|
|
793
|
-
function
|
|
848
|
+
function _t(e) {
|
|
794
849
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
|
|
795
850
|
}
|
|
796
851
|
//#endregion
|
|
797
852
|
//#region src/schema/styles/internal.ts
|
|
798
|
-
function
|
|
853
|
+
function vt(e) {
|
|
799
854
|
return e === "boolean" ? {} : { stringValue: {
|
|
800
855
|
default: void 0,
|
|
801
856
|
keepOnSplit: !0,
|
|
@@ -803,17 +858,17 @@ function gt(e) {
|
|
|
803
858
|
renderHTML: (e) => e.stringValue === void 0 ? {} : { "data-value": e.stringValue }
|
|
804
859
|
} };
|
|
805
860
|
}
|
|
806
|
-
function
|
|
861
|
+
function L(e, t, n, r) {
|
|
807
862
|
return e.dom.setAttribute("data-style-type", t), r === "string" && e.dom.setAttribute("data-value", n), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
808
863
|
}
|
|
809
|
-
function
|
|
864
|
+
function yt(e, t) {
|
|
810
865
|
return {
|
|
811
866
|
config: e,
|
|
812
867
|
implementation: t
|
|
813
868
|
};
|
|
814
869
|
}
|
|
815
|
-
function
|
|
816
|
-
return
|
|
870
|
+
function R(e, t) {
|
|
871
|
+
return yt({
|
|
817
872
|
type: e.name,
|
|
818
873
|
propSchema: t
|
|
819
874
|
}, {
|
|
@@ -834,12 +889,12 @@ function z(e, t) {
|
|
|
834
889
|
}
|
|
835
890
|
});
|
|
836
891
|
}
|
|
837
|
-
function
|
|
892
|
+
function bt(e) {
|
|
838
893
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
|
|
839
894
|
}
|
|
840
895
|
//#endregion
|
|
841
896
|
//#region src/schema/styles/createSpec.ts
|
|
842
|
-
function
|
|
897
|
+
function xt(e, t) {
|
|
843
898
|
let n = [{
|
|
844
899
|
tag: `[data-style-type="${e.type}"]`,
|
|
845
900
|
contentElement: (e) => {
|
|
@@ -857,33 +912,33 @@ function yt(e, t) {
|
|
|
857
912
|
}
|
|
858
913
|
}), n;
|
|
859
914
|
}
|
|
860
|
-
function
|
|
915
|
+
function St(e, t) {
|
|
861
916
|
let n = l.create({
|
|
862
917
|
name: e.type,
|
|
863
918
|
addAttributes() {
|
|
864
|
-
return
|
|
919
|
+
return vt(e.propSchema);
|
|
865
920
|
},
|
|
866
921
|
parseHTML() {
|
|
867
|
-
return
|
|
922
|
+
return xt(e, t.parse);
|
|
868
923
|
},
|
|
869
924
|
renderHTML({ mark: n }) {
|
|
870
|
-
return
|
|
925
|
+
return L((t.toExternalHTML || t.render)(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
|
|
871
926
|
},
|
|
872
927
|
addMarkView() {
|
|
873
|
-
return ({ mark: n }) =>
|
|
928
|
+
return ({ mark: n }) => L(t.render(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
|
|
874
929
|
}
|
|
875
930
|
});
|
|
876
|
-
return
|
|
931
|
+
return yt(e, {
|
|
877
932
|
...t,
|
|
878
933
|
mark: n,
|
|
879
|
-
render: (n) =>
|
|
880
|
-
toExternalHTML: (n) =>
|
|
934
|
+
render: (n) => L(t.render(n), e.type, n, e.propSchema),
|
|
935
|
+
toExternalHTML: (n) => L((t.toExternalHTML || t.render)(n), e.type, n, e.propSchema)
|
|
881
936
|
});
|
|
882
937
|
}
|
|
883
938
|
//#endregion
|
|
884
939
|
//#region src/util/topo-sort.ts
|
|
885
|
-
function
|
|
886
|
-
let t =
|
|
940
|
+
function Ct(e) {
|
|
941
|
+
let t = Tt(e), { roots: n, nonRoots: r } = Et(t), i = [];
|
|
887
942
|
for (; n.size;) {
|
|
888
943
|
i.push(n);
|
|
889
944
|
let r = /* @__PURE__ */ new Set();
|
|
@@ -898,13 +953,13 @@ function xt(e) {
|
|
|
898
953
|
}
|
|
899
954
|
n = r;
|
|
900
955
|
}
|
|
901
|
-
if (r =
|
|
956
|
+
if (r = Et(t).nonRoots, r.size) throw Error(`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(r).join(", ")}`);
|
|
902
957
|
return i;
|
|
903
958
|
}
|
|
904
|
-
function
|
|
905
|
-
return
|
|
959
|
+
function wt(e) {
|
|
960
|
+
return Ct(Dt(e));
|
|
906
961
|
}
|
|
907
|
-
function
|
|
962
|
+
function Tt(e) {
|
|
908
963
|
let t = /* @__PURE__ */ new Map();
|
|
909
964
|
for (let [n, r] of e.entries()) {
|
|
910
965
|
t.has(n) || t.set(n, 0);
|
|
@@ -915,7 +970,7 @@ function Ct(e) {
|
|
|
915
970
|
}
|
|
916
971
|
return t;
|
|
917
972
|
}
|
|
918
|
-
function
|
|
973
|
+
function Et(e) {
|
|
919
974
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
920
975
|
for (let [r, i] of e.entries()) i === 0 ? t.add(r) : n.add(r);
|
|
921
976
|
return {
|
|
@@ -923,7 +978,7 @@ function wt(e) {
|
|
|
923
978
|
nonRoots: n
|
|
924
979
|
};
|
|
925
980
|
}
|
|
926
|
-
function
|
|
981
|
+
function Dt(e) {
|
|
927
982
|
let t = /* @__PURE__ */ new Map();
|
|
928
983
|
for (let [n, r] of e.entries()) {
|
|
929
984
|
t.has(n) || t.set(n, /* @__PURE__ */ new Set());
|
|
@@ -931,26 +986,27 @@ function Tt(e) {
|
|
|
931
986
|
}
|
|
932
987
|
return t;
|
|
933
988
|
}
|
|
934
|
-
function
|
|
989
|
+
function Ot() {
|
|
935
990
|
return /* @__PURE__ */ new Map();
|
|
936
991
|
}
|
|
937
|
-
function
|
|
992
|
+
function kt(e, t, n) {
|
|
938
993
|
return e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n), e;
|
|
939
994
|
}
|
|
940
|
-
function
|
|
941
|
-
let t =
|
|
995
|
+
function At(e) {
|
|
996
|
+
let t = Ot();
|
|
942
997
|
for (let n of e) Array.isArray(n.runsBefore) && n.runsBefore.length > 0 ? n.runsBefore.forEach((e) => {
|
|
943
|
-
|
|
944
|
-
}) :
|
|
945
|
-
let n =
|
|
998
|
+
kt(t, n.key, e);
|
|
999
|
+
}) : kt(t, "default", n.key);
|
|
1000
|
+
let n = wt(t), r = n.findIndex((e) => e.has("default"));
|
|
946
1001
|
return (e) => 91 + (n.findIndex((t) => t.has(e)) + r) * 10;
|
|
947
1002
|
}
|
|
948
1003
|
//#endregion
|
|
949
1004
|
//#region src/schema/schema.ts
|
|
950
|
-
function
|
|
1005
|
+
function jt(e) {
|
|
951
1006
|
return e && Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
|
|
952
1007
|
}
|
|
953
|
-
var
|
|
1008
|
+
var Mt = class {
|
|
1009
|
+
opts;
|
|
954
1010
|
BlockNoteEditor = "only for types";
|
|
955
1011
|
Block = "only for types";
|
|
956
1012
|
PartialBlock = "only for types";
|
|
@@ -966,14 +1022,14 @@ var At = class {
|
|
|
966
1022
|
this.blockSpecs = t, this.styleSpecs = r, this.styleSchema = o, this.inlineContentSpecs = n, this.blockSchema = i, this.inlineContentSchema = a;
|
|
967
1023
|
}
|
|
968
1024
|
init() {
|
|
969
|
-
let e =
|
|
1025
|
+
let e = At(Object.entries({
|
|
970
1026
|
...this.opts.blockSpecs,
|
|
971
1027
|
...this.opts.inlineContentSpecs,
|
|
972
1028
|
...this.opts.styleSpecs
|
|
973
1029
|
}).map(([e, t]) => ({
|
|
974
1030
|
key: e,
|
|
975
1031
|
runsBefore: t.implementation?.runsBefore ?? []
|
|
976
|
-
}))), t = Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([t, n]) => [t,
|
|
1032
|
+
}))), t = Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([t, n]) => [t, ft(n.config, n.implementation, n.extensions, e(t))])), n = Object.fromEntries(Object.entries(this.opts.inlineContentSpecs).map(([t, n]) => typeof n.config == "object" ? [t, {
|
|
977
1033
|
...n,
|
|
978
1034
|
implementation: {
|
|
979
1035
|
...n.implementation,
|
|
@@ -989,10 +1045,10 @@ var At = class {
|
|
|
989
1045
|
return {
|
|
990
1046
|
blockSpecs: t,
|
|
991
1047
|
blockSchema: Object.fromEntries(Object.entries(t).map(([e, t]) => [e, t.config])),
|
|
992
|
-
inlineContentSpecs:
|
|
993
|
-
styleSpecs:
|
|
994
|
-
inlineContentSchema:
|
|
995
|
-
styleSchema:
|
|
1048
|
+
inlineContentSpecs: jt(n),
|
|
1049
|
+
styleSpecs: jt(r),
|
|
1050
|
+
inlineContentSchema: _t(n),
|
|
1051
|
+
styleSchema: bt(r)
|
|
996
1052
|
};
|
|
997
1053
|
}
|
|
998
1054
|
extend(e) {
|
|
@@ -1003,8 +1059,8 @@ var At = class {
|
|
|
1003
1059
|
};
|
|
1004
1060
|
//#endregion
|
|
1005
1061
|
//#region src/api/blockManipulation/tables/tables.ts
|
|
1006
|
-
function
|
|
1007
|
-
let { height: t, width: n } =
|
|
1062
|
+
function z(e) {
|
|
1063
|
+
let { height: t, width: n } = Nt(e), r = Array(t).fill(!1).map(() => Array(n).fill(null)), i = (e, i) => {
|
|
1008
1064
|
for (let a = e; a < t; a++) for (let e = i; e < n; e++) if (!r[a][e]) return {
|
|
1009
1065
|
row: a,
|
|
1010
1066
|
col: e
|
|
@@ -1012,7 +1068,7 @@ function B(e) {
|
|
|
1012
1068
|
throw Error("Unable to create occupancy grid for table, no more available cells");
|
|
1013
1069
|
};
|
|
1014
1070
|
for (let t = 0; t < e.content.rows.length; t++) for (let n = 0; n < e.content.rows[t].cells.length; n++) {
|
|
1015
|
-
let a =
|
|
1071
|
+
let a = C(e.content.rows[t].cells[n]), o = He(a), s = T(a), { row: c, col: l } = i(t, n);
|
|
1016
1072
|
for (let e = c; e < c + o; e++) for (let i = l; i < l + s; i++) {
|
|
1017
1073
|
if (r[e][i]) throw Error(`Unable to create occupancy grid for table, cell at ${e},${i} is already occupied`);
|
|
1018
1074
|
r[e][i] = {
|
|
@@ -1026,11 +1082,11 @@ function B(e) {
|
|
|
1026
1082
|
}
|
|
1027
1083
|
return r;
|
|
1028
1084
|
}
|
|
1029
|
-
function
|
|
1085
|
+
function B(e) {
|
|
1030
1086
|
let t = /* @__PURE__ */ new Set();
|
|
1031
1087
|
return e.map((e) => ({ cells: e.map((e) => t.has(e.row + ":" + e.col) ? !1 : (t.add(e.row + ":" + e.col), e.cell)).filter((e) => e !== !1) }));
|
|
1032
1088
|
}
|
|
1033
|
-
function
|
|
1089
|
+
function V(e, t, n = z(t)) {
|
|
1034
1090
|
for (let t = 0; t < n.length; t++) for (let r = 0; r < n[t].length; r++) {
|
|
1035
1091
|
let i = n[t][r];
|
|
1036
1092
|
if (i && i.row === e.row && i.col === e.col) return {
|
|
@@ -1041,19 +1097,19 @@ function H(e, t, n = B(t)) {
|
|
|
1041
1097
|
}
|
|
1042
1098
|
throw Error(`Unable to resolve relative table cell indices for table, cell at ${e.row},${e.col} is not occupied`);
|
|
1043
1099
|
}
|
|
1044
|
-
function
|
|
1100
|
+
function Nt(e) {
|
|
1045
1101
|
let t = e.content.rows.length, n = 0;
|
|
1046
1102
|
return e.content.rows.forEach((e) => {
|
|
1047
1103
|
let t = 0;
|
|
1048
1104
|
e.cells.forEach((e) => {
|
|
1049
|
-
t +=
|
|
1105
|
+
t += T(e);
|
|
1050
1106
|
}), n = Math.max(n, t);
|
|
1051
1107
|
}), {
|
|
1052
1108
|
height: t,
|
|
1053
1109
|
width: n
|
|
1054
1110
|
};
|
|
1055
1111
|
}
|
|
1056
|
-
function
|
|
1112
|
+
function Pt(e, t, n = z(t)) {
|
|
1057
1113
|
let r = n[e.row]?.[e.col];
|
|
1058
1114
|
if (r) return {
|
|
1059
1115
|
row: r.row,
|
|
@@ -1061,8 +1117,8 @@ function Mt(e, t, n = B(t)) {
|
|
|
1061
1117
|
cell: r.cell
|
|
1062
1118
|
};
|
|
1063
1119
|
}
|
|
1064
|
-
function
|
|
1065
|
-
let n =
|
|
1120
|
+
function Ft(e, t) {
|
|
1121
|
+
let n = z(e);
|
|
1066
1122
|
if (t < 0 || t >= n.length) return [];
|
|
1067
1123
|
let r = 0;
|
|
1068
1124
|
for (let e = 0; e < t; e++) {
|
|
@@ -1070,14 +1126,14 @@ function Nt(e, t) {
|
|
|
1070
1126
|
if (!e) return [];
|
|
1071
1127
|
r += e.rowspan;
|
|
1072
1128
|
}
|
|
1073
|
-
let i = Array(n[0].length).fill(!1).map((t, i) =>
|
|
1129
|
+
let i = Array(n[0].length).fill(!1).map((t, i) => Pt({
|
|
1074
1130
|
row: r,
|
|
1075
1131
|
col: i
|
|
1076
1132
|
}, e, n)).filter((e) => e !== void 0);
|
|
1077
1133
|
return i.filter((e, t) => i.findIndex((t) => t.row === e.row && t.col === e.col) === t);
|
|
1078
1134
|
}
|
|
1079
|
-
function
|
|
1080
|
-
let n =
|
|
1135
|
+
function It(e, t) {
|
|
1136
|
+
let n = z(e);
|
|
1081
1137
|
if (t < 0 || t >= n[0].length) return [];
|
|
1082
1138
|
let r = 0;
|
|
1083
1139
|
for (let e = 0; e < t; e++) {
|
|
@@ -1085,62 +1141,62 @@ function Pt(e, t) {
|
|
|
1085
1141
|
if (!e) return [];
|
|
1086
1142
|
r += e.colspan;
|
|
1087
1143
|
}
|
|
1088
|
-
let i = Array(n.length).fill(!1).map((t, i) =>
|
|
1144
|
+
let i = Array(n.length).fill(!1).map((t, i) => Pt({
|
|
1089
1145
|
row: i,
|
|
1090
1146
|
col: r
|
|
1091
1147
|
}, e, n)).filter((e) => e !== void 0);
|
|
1092
1148
|
return i.filter((e, t) => i.findIndex((t) => t.row === e.row && t.col === e.col) === t);
|
|
1093
1149
|
}
|
|
1094
|
-
function
|
|
1095
|
-
let { col: i } =
|
|
1150
|
+
function Lt(e, t, n, r = z(e)) {
|
|
1151
|
+
let { col: i } = V({
|
|
1096
1152
|
row: 0,
|
|
1097
1153
|
col: t
|
|
1098
|
-
}, e, r), { col: a } =
|
|
1154
|
+
}, e, r), { col: a } = V({
|
|
1099
1155
|
row: 0,
|
|
1100
1156
|
col: n
|
|
1101
1157
|
}, e, r);
|
|
1102
1158
|
return r.forEach((e) => {
|
|
1103
1159
|
let [t] = e.splice(i, 1);
|
|
1104
1160
|
e.splice(a, 0, t);
|
|
1105
|
-
}),
|
|
1161
|
+
}), B(r);
|
|
1106
1162
|
}
|
|
1107
|
-
function
|
|
1108
|
-
let { row: i } =
|
|
1163
|
+
function Rt(e, t, n, r = z(e)) {
|
|
1164
|
+
let { row: i } = V({
|
|
1109
1165
|
row: t,
|
|
1110
1166
|
col: 0
|
|
1111
|
-
}, e, r), { row: a } =
|
|
1167
|
+
}, e, r), { row: a } = V({
|
|
1112
1168
|
row: n,
|
|
1113
1169
|
col: 0
|
|
1114
1170
|
}, e, r), [o] = r.splice(i, 1);
|
|
1115
|
-
return r.splice(a, 0, o),
|
|
1171
|
+
return r.splice(a, 0, o), B(r);
|
|
1116
1172
|
}
|
|
1117
|
-
function
|
|
1118
|
-
return e ?
|
|
1173
|
+
function zt(e) {
|
|
1174
|
+
return e ? w(e) ? zt(e.content) : typeof e == "string" ? e.length === 0 : Array.isArray(e) ? e.every((e) => typeof e == "string" ? e.length === 0 : S(e) ? e.text.length === 0 : Be(e) ? typeof e.content == "string" ? e.content.length === 0 : e.content.every((e) => e.text.length === 0) : !1) : !1 : !0;
|
|
1119
1175
|
}
|
|
1120
|
-
function
|
|
1176
|
+
function Bt(e, t, n = z(e)) {
|
|
1121
1177
|
if (t === "columns") {
|
|
1122
1178
|
let e = 0;
|
|
1123
|
-
for (let t = n[0].length - 1; t >= 0 && n.every((e) =>
|
|
1179
|
+
for (let t = n[0].length - 1; t >= 0 && n.every((e) => zt(e[t].cell) && e[t].colspan === 1); t--) e++;
|
|
1124
1180
|
for (let t = n.length - 1; t >= 0; t--) {
|
|
1125
1181
|
let r = Math.max(n[t].length - e, 1);
|
|
1126
1182
|
n[t] = n[t].slice(0, r);
|
|
1127
1183
|
}
|
|
1128
|
-
return
|
|
1184
|
+
return B(n);
|
|
1129
1185
|
}
|
|
1130
1186
|
let r = 0;
|
|
1131
|
-
for (let e = n.length - 1; e >= 0 && n[e].every((e) =>
|
|
1187
|
+
for (let e = n.length - 1; e >= 0 && n[e].every((e) => zt(e.cell) && e.rowspan === 1); e--) r++;
|
|
1132
1188
|
let i = Math.min(r, n.length - 1);
|
|
1133
|
-
return n.splice(n.length - i, i),
|
|
1189
|
+
return n.splice(n.length - i, i), B(n);
|
|
1134
1190
|
}
|
|
1135
|
-
function
|
|
1136
|
-
let { width: i, height: a } =
|
|
1191
|
+
function Vt(e, t, n, r = z(e)) {
|
|
1192
|
+
let { width: i, height: a } = Nt(e);
|
|
1137
1193
|
if (t === "columns") r.forEach((e, t) => {
|
|
1138
1194
|
if (n >= 0) for (let r = 0; r < n; r++) e.push({
|
|
1139
1195
|
row: t,
|
|
1140
1196
|
col: Math.max(...e.map((e) => e.col)) + 1,
|
|
1141
1197
|
rowspan: 1,
|
|
1142
1198
|
colspan: 1,
|
|
1143
|
-
cell:
|
|
1199
|
+
cell: C("")
|
|
1144
1200
|
});
|
|
1145
1201
|
else e.splice(i + n, -1 * n);
|
|
1146
1202
|
});
|
|
@@ -1150,77 +1206,78 @@ function zt(e, t, n, r = B(e)) {
|
|
|
1150
1206
|
col: n,
|
|
1151
1207
|
rowspan: 1,
|
|
1152
1208
|
colspan: 1,
|
|
1153
|
-
cell:
|
|
1209
|
+
cell: C("")
|
|
1154
1210
|
}));
|
|
1155
1211
|
r.push(t);
|
|
1156
1212
|
}
|
|
1157
1213
|
else n < 0 && r.splice(a + n, -1 * n);
|
|
1158
|
-
return
|
|
1214
|
+
return B(r);
|
|
1159
1215
|
}
|
|
1160
|
-
function
|
|
1161
|
-
let r =
|
|
1162
|
-
if (!r.some((e) =>
|
|
1216
|
+
function Ht(e, t, n) {
|
|
1217
|
+
let r = Ft(e, n);
|
|
1218
|
+
if (!r.some((e) => He(e.cell) > 1)) return !0;
|
|
1163
1219
|
let i = n, a = n;
|
|
1164
1220
|
return r.forEach((e) => {
|
|
1165
|
-
let t =
|
|
1221
|
+
let t = He(e.cell);
|
|
1166
1222
|
i = Math.max(i, e.row + t - 1), a = Math.min(a, e.row);
|
|
1167
1223
|
}), t < n ? n === i : n === a;
|
|
1168
1224
|
}
|
|
1169
|
-
function
|
|
1170
|
-
let r =
|
|
1171
|
-
if (!r.some((e) =>
|
|
1225
|
+
function Ut(e, t, n) {
|
|
1226
|
+
let r = It(e, n);
|
|
1227
|
+
if (!r.some((e) => T(e.cell) > 1)) return !0;
|
|
1172
1228
|
let i = n, a = n;
|
|
1173
1229
|
return r.forEach((e) => {
|
|
1174
|
-
let t =
|
|
1230
|
+
let t = T(e.cell);
|
|
1175
1231
|
i = Math.max(i, e.col + t - 1), a = Math.min(a, e.col);
|
|
1176
1232
|
}), t < n ? n === i : n === a;
|
|
1177
1233
|
}
|
|
1178
|
-
function
|
|
1179
|
-
let r =
|
|
1234
|
+
function Wt(e, t, n) {
|
|
1235
|
+
let r = V(e, n), i = V(t, n);
|
|
1180
1236
|
return r.col === i.col;
|
|
1181
1237
|
}
|
|
1182
1238
|
//#endregion
|
|
1183
1239
|
//#region src/api/nodeConversions/blockToNode.ts
|
|
1184
|
-
function
|
|
1240
|
+
function Gt(e, t, n, r) {
|
|
1185
1241
|
let i = [];
|
|
1186
1242
|
for (let [r, a] of Object.entries(e.styles || {})) {
|
|
1187
1243
|
let e = n[r];
|
|
1188
1244
|
if (!e) throw Error(`style ${r} not found in styleSchema`);
|
|
1189
1245
|
if (e.propSchema === "boolean") a && i.push(t.mark(r));
|
|
1190
1246
|
else if (e.propSchema === "string") a && i.push(t.mark(r, { stringValue: a }));
|
|
1191
|
-
else throw new
|
|
1247
|
+
else throw new E(e.propSchema);
|
|
1192
1248
|
}
|
|
1193
|
-
|
|
1249
|
+
let a = r && t.nodes[r] && et(t, t.nodes[r]) ? [...t.nodes[r].allowedMarks(i)] : i;
|
|
1250
|
+
return !r || !t.nodes[r].spec.code ? e.text.split(/(\n)/g).filter((e) => e.length > 0).map((e) => e === "\n" ? t.nodes.hardBreak.createChecked() : t.text(e, a)) : e.text.length > 0 ? [t.text(e.text, a)] : [];
|
|
1194
1251
|
}
|
|
1195
|
-
function
|
|
1252
|
+
function Kt(e, t, n) {
|
|
1196
1253
|
let r = t.marks.link.create({ href: e.href });
|
|
1197
|
-
return
|
|
1254
|
+
return qt(e.content, t, n).map((e) => {
|
|
1198
1255
|
if (e.type.name === "text") return e.mark([...e.marks, r]);
|
|
1199
1256
|
if (e.type.name === "hardBreak") return e;
|
|
1200
1257
|
throw Error("unexpected node type");
|
|
1201
1258
|
});
|
|
1202
1259
|
}
|
|
1203
|
-
function
|
|
1260
|
+
function qt(e, t, n, r) {
|
|
1204
1261
|
let i = [];
|
|
1205
|
-
if (typeof e == "string") return i.push(...
|
|
1262
|
+
if (typeof e == "string") return i.push(...Gt({
|
|
1206
1263
|
type: "text",
|
|
1207
1264
|
text: e,
|
|
1208
1265
|
styles: {}
|
|
1209
1266
|
}, t, n, r)), i;
|
|
1210
|
-
for (let a of e) i.push(...
|
|
1267
|
+
for (let a of e) i.push(...Gt(a, t, n, r));
|
|
1211
1268
|
return i;
|
|
1212
1269
|
}
|
|
1213
|
-
function
|
|
1270
|
+
function H(e, t, n, r = A(t)) {
|
|
1214
1271
|
let i = [];
|
|
1215
|
-
for (let a of e) typeof a == "string" ? i.push(...
|
|
1272
|
+
for (let a of e) typeof a == "string" ? i.push(...qt(a, t, r, n)) : Be(a) ? i.push(...Kt(a, t, r)) : S(a) ? i.push(...qt([a], t, r, n)) : i.push(Yt(a, t, r));
|
|
1216
1273
|
return i;
|
|
1217
1274
|
}
|
|
1218
|
-
function
|
|
1275
|
+
function Jt(e, t, n = A(t)) {
|
|
1219
1276
|
let r = [], i = Array(e.headerRows ?? 0).fill(!0), a = Array(e.headerCols ?? 0).fill(!0), o = e.columnWidths ?? [];
|
|
1220
1277
|
for (let s = 0; s < e.rows.length; s++) {
|
|
1221
1278
|
let c = e.rows[s], l = [], u = i[s];
|
|
1222
1279
|
for (let r = 0; r < c.cells.length; r++) {
|
|
1223
|
-
let i = c.cells[r], d = a[r], f = null, p =
|
|
1280
|
+
let i = c.cells[r], d = a[r], f = null, p = V({
|
|
1224
1281
|
row: s,
|
|
1225
1282
|
col: r
|
|
1226
1283
|
}, {
|
|
@@ -1228,13 +1285,13 @@ function Kt(e, t, n = P(t)) {
|
|
|
1228
1285
|
content: e
|
|
1229
1286
|
}), m = o[p.col] ? [o[p.col]] : null;
|
|
1230
1287
|
if (i) if (typeof i == "string") f = t.text(i);
|
|
1231
|
-
else if (
|
|
1232
|
-
i.content && (f =
|
|
1233
|
-
let e =
|
|
1288
|
+
else if (w(i)) {
|
|
1289
|
+
i.content && (f = H(i.content, t, "tableParagraph", n));
|
|
1290
|
+
let e = T(i);
|
|
1234
1291
|
e > 1 && (m = Array(e).fill(!1).map((e, t) => o[p.col + t] ?? void 0));
|
|
1235
|
-
} else f =
|
|
1292
|
+
} else f = H(i, t, "tableParagraph", n);
|
|
1236
1293
|
let h = t.nodes[d || u ? "tableHeader" : "tableCell"].createChecked({
|
|
1237
|
-
...
|
|
1294
|
+
...w(i) ? i.props : {},
|
|
1238
1295
|
colwidth: m
|
|
1239
1296
|
}, t.nodes.tableParagraph.createChecked(void 0, f));
|
|
1240
1297
|
l.push(h);
|
|
@@ -1244,29 +1301,29 @@ function Kt(e, t, n = P(t)) {
|
|
|
1244
1301
|
}
|
|
1245
1302
|
return r;
|
|
1246
1303
|
}
|
|
1247
|
-
function
|
|
1304
|
+
function Yt(e, t, n) {
|
|
1248
1305
|
let r, i = e.type;
|
|
1249
1306
|
if (i === void 0 && (i = "paragraph"), !t.nodes[i]) throw Error(`node type ${i} not found in schema`);
|
|
1250
1307
|
if (!e.content) r = t.nodes[i].createChecked(e.props);
|
|
1251
1308
|
else if (typeof e.content == "string") {
|
|
1252
|
-
let a =
|
|
1309
|
+
let a = H([e.content], t, i, n);
|
|
1253
1310
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1254
1311
|
} else if (Array.isArray(e.content)) {
|
|
1255
|
-
let a =
|
|
1312
|
+
let a = H(e.content, t, i, n);
|
|
1256
1313
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1257
1314
|
} else if (e.content.type === "tableContent") {
|
|
1258
|
-
let a =
|
|
1315
|
+
let a = Jt(e.content, t, n);
|
|
1259
1316
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1260
|
-
} else throw new
|
|
1317
|
+
} else throw new E(e.content.type);
|
|
1261
1318
|
return r;
|
|
1262
1319
|
}
|
|
1263
|
-
function
|
|
1320
|
+
function U(e, t, n = A(t)) {
|
|
1264
1321
|
let r = e.id;
|
|
1265
|
-
r === void 0 && (r =
|
|
1322
|
+
r === void 0 && (r = Re.options.generateID());
|
|
1266
1323
|
let i = [];
|
|
1267
|
-
if (e.children) for (let r of e.children) i.push(
|
|
1324
|
+
if (e.children) for (let r of e.children) i.push(U(r, t, n));
|
|
1268
1325
|
if (!e.type || t.nodes[e.type].isInGroup("blockContent")) {
|
|
1269
|
-
let a =
|
|
1326
|
+
let a = Yt(e, t, n), o = i.length > 0 ? t.nodes.blockGroup.createChecked({}, i) : void 0;
|
|
1270
1327
|
return t.nodes.blockContainer.createChecked({
|
|
1271
1328
|
id: r,
|
|
1272
1329
|
...e.props
|
|
@@ -1279,85 +1336,118 @@ function W(e, t, n = P(t)) {
|
|
|
1279
1336
|
}
|
|
1280
1337
|
//#endregion
|
|
1281
1338
|
//#region src/api/nodeUtil.ts
|
|
1282
|
-
function
|
|
1339
|
+
function Xt(e, t) {
|
|
1283
1340
|
let n, r;
|
|
1284
|
-
if (t.firstChild.descendants((
|
|
1341
|
+
if (t.firstChild.descendants((i, a) => n ? !1 : !Zt(i) || !i.attrs.id || Ae(i, t) !== e ? !0 : (n = i, r = a + 1, !1)), !(n === void 0 || r === void 0)) return {
|
|
1285
1342
|
node: n,
|
|
1286
1343
|
posBeforeNode: r
|
|
1287
1344
|
};
|
|
1288
1345
|
}
|
|
1289
|
-
function
|
|
1346
|
+
function Zt(e) {
|
|
1290
1347
|
return e.type.isInGroup("bnBlock");
|
|
1291
1348
|
}
|
|
1292
1349
|
//#endregion
|
|
1293
1350
|
//#region src/api/blockManipulation/commands/updateBlock/updateBlock.ts
|
|
1294
|
-
var
|
|
1295
|
-
function
|
|
1296
|
-
let a =
|
|
1297
|
-
a.blockNoteType === "table" && (o =
|
|
1298
|
-
let s =
|
|
1351
|
+
var Qt = (e, t) => ({ tr: n, dispatch: r }) => (r && $t(n, e, t), !0);
|
|
1352
|
+
function $t(e, t, n, r, i) {
|
|
1353
|
+
let a = Ne(e.doc.resolve(t)), o = null;
|
|
1354
|
+
a.blockNoteType === "table" && (o = sn(e));
|
|
1355
|
+
let s = k(e);
|
|
1299
1356
|
if (r !== void 0 && i !== void 0 && r > i) throw Error("Invalid replaceFromPos or replaceToPos");
|
|
1300
1357
|
let c = s.nodes[a.blockNoteType], l = s.nodes[n.type || a.blockNoteType], u = l.isInGroup("bnBlock") ? l : s.nodes.blockContainer;
|
|
1301
1358
|
if (a.isBlockContainer && l.isInGroup("blockContent")) {
|
|
1302
1359
|
let t = r !== void 0 && r > a.blockContent.beforePos && r < a.blockContent.afterPos ? r - a.blockContent.beforePos - 1 : void 0, o = i !== void 0 && i > a.blockContent.beforePos && i < a.blockContent.afterPos ? i - a.blockContent.beforePos - 1 : void 0;
|
|
1303
|
-
|
|
1304
|
-
} else if (!a.isBlockContainer && l.isInGroup("bnBlock"))
|
|
1360
|
+
an(n, e, a), en(n, e, c, l, a, t, o);
|
|
1361
|
+
} else if (!a.isBlockContainer && l.isInGroup("bnBlock")) an(n, e, a);
|
|
1305
1362
|
else {
|
|
1306
|
-
let t =
|
|
1307
|
-
children:
|
|
1363
|
+
let t = U({
|
|
1364
|
+
children: M(a.bnBlock.node, e.doc).children,
|
|
1308
1365
|
...n
|
|
1309
1366
|
}, s);
|
|
1310
1367
|
t.check(), e.replaceWith(a.bnBlock.beforePos, a.bnBlock.afterPos, t);
|
|
1311
1368
|
return;
|
|
1312
1369
|
}
|
|
1313
|
-
e
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
else
|
|
1322
|
-
|
|
1323
|
-
else throw new T(e.content.type);
|
|
1324
|
-
else n.spec.content === "" || a.spec.content !== n.spec.content && (u = []);
|
|
1325
|
-
if (u === "keep") t.setNodeMarkup(o.blockContent.beforePos, a, {
|
|
1326
|
-
...o.blockContent.node.attrs,
|
|
1327
|
-
...e.props
|
|
1328
|
-
});
|
|
1370
|
+
nn(e, a.bnBlock.beforePos, u, { ...n.props }), o && cn(e, a, o);
|
|
1371
|
+
}
|
|
1372
|
+
function en(e, t, n, r, o, s, c) {
|
|
1373
|
+
let l = k(t), u = "keep";
|
|
1374
|
+
if (e.content) if (typeof e.content == "string") u = H([e.content], l, r.name);
|
|
1375
|
+
else if (Array.isArray(e.content)) u = H(e.content, l, r.name);
|
|
1376
|
+
else if (e.content.type === "tableContent") u = Jt(e.content, l);
|
|
1377
|
+
else throw new E(e.content.type);
|
|
1378
|
+
else n.spec.content === "" || r.spec.content !== n.spec.content && (u = []);
|
|
1379
|
+
if (u === "keep") nn(t, o.blockContent.beforePos, r, { ...e.props });
|
|
1329
1380
|
else if (s !== void 0 || c !== void 0) {
|
|
1330
|
-
t.
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
});
|
|
1334
|
-
let n = o.blockContent.beforePos + 1 + (s ?? 0), l = o.blockContent.beforePos + 1 + (c ?? o.blockContent.node.content.size), d = t.doc.resolve(o.blockContent.beforePos).depth, f = t.doc.resolve(n).depth, p = t.doc.resolve(l).depth;
|
|
1335
|
-
t.replace(n, l, new i(r.from(u), f - d - 1, p - d - 1));
|
|
1336
|
-
} else t.replaceWith(o.blockContent.beforePos, o.blockContent.afterPos, a.createChecked({
|
|
1381
|
+
let n = rn(t, o.blockContent.beforePos, r, { ...e.props }), l = n + 1 + (s ?? 0), d = n + 1 + (c ?? o.blockContent.node.content.size), f = t.doc.resolve(n).depth, p = t.doc.resolve(l).depth, m = t.doc.resolve(d).depth;
|
|
1382
|
+
t.replace(l, d, new a(i.from(u), p - f - 1, m - f - 1));
|
|
1383
|
+
} else r === n || r.validContent(o.blockContent.node.content) ? tn(t, rn(t, o.blockContent.beforePos, r, { ...e.props }), i.from(u)) : t.replaceWith(o.blockContent.beforePos, o.blockContent.afterPos, r.createChecked({
|
|
1337
1384
|
...o.blockContent.node.attrs,
|
|
1338
1385
|
...e.props
|
|
1339
1386
|
}, u));
|
|
1340
1387
|
}
|
|
1341
|
-
function
|
|
1342
|
-
let
|
|
1388
|
+
function tn(e, t, n) {
|
|
1389
|
+
let r = e.doc.nodeAt(t);
|
|
1390
|
+
if (!r) throw RangeError("No node at given position");
|
|
1391
|
+
let s = r.content, c = t + 1;
|
|
1392
|
+
if (r.isTextblock) {
|
|
1393
|
+
let t = s.findDiffStart(n);
|
|
1394
|
+
if (t === null) return;
|
|
1395
|
+
let { a: r, b: i } = s.findDiffEnd(n), o = Math.max(0, t - r, t - i);
|
|
1396
|
+
o > 0 && (r += o, i += o), e.replace(c + t, c + r, new a(n.cut(t, i), 0, 0));
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1399
|
+
let l = s.childCount, u = n.childCount, d = 0;
|
|
1400
|
+
for (; d < l && d < u && s.child(d).eq(n.child(d));) d++;
|
|
1401
|
+
let f = l, p = u;
|
|
1402
|
+
for (; f > d && p > d && s.child(f - 1).eq(n.child(p - 1));) f--, p--;
|
|
1403
|
+
if (d === f && d === p) return;
|
|
1404
|
+
let m = c;
|
|
1405
|
+
for (let e = 0; e < d; e++) m += s.child(e).nodeSize;
|
|
1406
|
+
let h = m;
|
|
1407
|
+
for (let e = d; e < f; e++) h += s.child(e).nodeSize;
|
|
1408
|
+
let g = [];
|
|
1409
|
+
for (let e = d; e < p; e++) g.push(n.child(e));
|
|
1410
|
+
e.step(new o(m, h, new a(i.from(g), 0, 0)));
|
|
1411
|
+
}
|
|
1412
|
+
function nn(e, t, n, r) {
|
|
1413
|
+
let i = e.doc.nodeAt(t);
|
|
1414
|
+
if (!i) throw RangeError("No node at given position");
|
|
1415
|
+
let a = n.spec.attrs ?? {}, o = {};
|
|
1416
|
+
for (let e of Object.keys(r)) e in a && (o[e] = r[e]);
|
|
1417
|
+
let s = {
|
|
1418
|
+
...i.attrs,
|
|
1419
|
+
...o
|
|
1420
|
+
};
|
|
1421
|
+
if (i.type === n) {
|
|
1422
|
+
for (let n of Object.keys(s)) s[n] !== i.attrs[n] && e.setNodeAttribute(t, n, s[n]);
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
e.setNodeMarkup(t, n, s);
|
|
1426
|
+
}
|
|
1427
|
+
function rn(e, t, n, r) {
|
|
1428
|
+
let i = e.mapping.maps.length;
|
|
1429
|
+
return nn(e, t, n, r), e.mapping.slice(i).map(t, -1);
|
|
1430
|
+
}
|
|
1431
|
+
function an(e, t, n) {
|
|
1432
|
+
let r = k(t);
|
|
1343
1433
|
if (e.children !== void 0 && e.children.length > 0) {
|
|
1344
|
-
let
|
|
1345
|
-
let t =
|
|
1434
|
+
let a = e.children.map((e) => {
|
|
1435
|
+
let t = U(e, r);
|
|
1346
1436
|
return t.check(), t;
|
|
1347
1437
|
});
|
|
1348
|
-
if (n.childContainer) t
|
|
1438
|
+
if (n.childContainer) tn(t, n.childContainer.beforePos, i.from(a));
|
|
1349
1439
|
else {
|
|
1350
1440
|
if (!n.isBlockContainer) throw Error("impossible");
|
|
1351
|
-
t.insert(n.blockContent.afterPos,
|
|
1441
|
+
t.insert(n.blockContent.afterPos, r.nodes.blockGroup.createChecked({}, a));
|
|
1352
1442
|
}
|
|
1353
1443
|
}
|
|
1354
1444
|
}
|
|
1355
|
-
function
|
|
1356
|
-
let a = typeof t == "string" ? t : t.id, o =
|
|
1445
|
+
function on(e, t, n, r, i) {
|
|
1446
|
+
let a = typeof t == "string" ? t : t.id, o = Xt(a, e.doc);
|
|
1357
1447
|
if (!o) throw Error(`Block with ID ${a} not found`);
|
|
1358
|
-
return
|
|
1448
|
+
return $t(e, o.posBeforeNode, n, r, i), M(e.doc.resolve(o.posBeforeNode + 1).node(), e.doc);
|
|
1359
1449
|
}
|
|
1360
|
-
function
|
|
1450
|
+
function sn(e) {
|
|
1361
1451
|
let t = "selection" in e ? e.selection : null;
|
|
1362
1452
|
if (!(t instanceof y)) return null;
|
|
1363
1453
|
let n = e.doc.resolve(t.head), r = -1, i = -1;
|
|
@@ -1380,7 +1470,7 @@ function tn(e) {
|
|
|
1380
1470
|
offset: Math.max(0, t.head - p)
|
|
1381
1471
|
};
|
|
1382
1472
|
}
|
|
1383
|
-
function
|
|
1473
|
+
function cn(e, t, n) {
|
|
1384
1474
|
if (t.blockNoteType !== "table") return !1;
|
|
1385
1475
|
let r = -1;
|
|
1386
1476
|
if (t.isBlockContainer) r = e.mapping.map(t.blockContent.beforePos);
|
|
@@ -1397,7 +1487,7 @@ function nn(e, t, n) {
|
|
|
1397
1487
|
}
|
|
1398
1488
|
//#endregion
|
|
1399
1489
|
//#region src/editor/defaultColors.ts
|
|
1400
|
-
var
|
|
1490
|
+
var W = {
|
|
1401
1491
|
gray: {
|
|
1402
1492
|
text: "#9b9a97",
|
|
1403
1493
|
background: "#ebeced"
|
|
@@ -1434,7 +1524,7 @@ var G = {
|
|
|
1434
1524
|
text: "#ad1a72",
|
|
1435
1525
|
background: "#f4dfeb"
|
|
1436
1526
|
}
|
|
1437
|
-
},
|
|
1527
|
+
}, ln = {
|
|
1438
1528
|
gray: {
|
|
1439
1529
|
text: "#bebdb8",
|
|
1440
1530
|
background: "#9b9a97"
|
|
@@ -1471,7 +1561,7 @@ var G = {
|
|
|
1471
1561
|
text: "#da208f",
|
|
1472
1562
|
background: "#ad1a72"
|
|
1473
1563
|
}
|
|
1474
|
-
},
|
|
1564
|
+
}, G = {
|
|
1475
1565
|
backgroundColor: { default: "default" },
|
|
1476
1566
|
textColor: { default: "default" },
|
|
1477
1567
|
textAlignment: {
|
|
@@ -1483,40 +1573,40 @@ var G = {
|
|
|
1483
1573
|
"justify"
|
|
1484
1574
|
]
|
|
1485
1575
|
}
|
|
1486
|
-
},
|
|
1576
|
+
}, K = (e) => {
|
|
1487
1577
|
let t = {};
|
|
1488
|
-
return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment =
|
|
1489
|
-
},
|
|
1490
|
-
e.backgroundColor && e.backgroundColor !==
|
|
1491
|
-
},
|
|
1492
|
-
default:
|
|
1493
|
-
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : e.style.backgroundColor ? e.style.backgroundColor :
|
|
1494
|
-
renderHTML: (t) => t[e] ===
|
|
1495
|
-
}),
|
|
1496
|
-
default:
|
|
1497
|
-
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : e.style.color ? e.style.color :
|
|
1498
|
-
renderHTML: (t) => t[e] ===
|
|
1499
|
-
}),
|
|
1500
|
-
default:
|
|
1501
|
-
parseHTML: (e) => e.hasAttribute("data-text-alignment") ? e.getAttribute("data-text-alignment") : e.style.textAlign ? e.style.textAlign :
|
|
1502
|
-
renderHTML: (t) => t[e] ===
|
|
1503
|
-
}),
|
|
1578
|
+
return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment = G.textAlignment.values.includes(e.style.textAlign) ? e.style.textAlign : void 0, t;
|
|
1579
|
+
}, q = (e, t) => {
|
|
1580
|
+
e.backgroundColor && e.backgroundColor !== G.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in W ? W[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== G.textColor.default && (t.style.color = e.textColor in W ? W[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== G.textAlignment.default && (t.style.textAlign = e.textAlignment);
|
|
1581
|
+
}, un = (e = "backgroundColor") => ({
|
|
1582
|
+
default: G.backgroundColor.default,
|
|
1583
|
+
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : e.style.backgroundColor ? e.style.backgroundColor : G.backgroundColor.default,
|
|
1584
|
+
renderHTML: (t) => t[e] === G.backgroundColor.default ? {} : { "data-background-color": t[e] }
|
|
1585
|
+
}), dn = (e = "textColor") => ({
|
|
1586
|
+
default: G.textColor.default,
|
|
1587
|
+
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : e.style.color ? e.style.color : G.textColor.default,
|
|
1588
|
+
renderHTML: (t) => t[e] === G.textColor.default ? {} : { "data-text-color": t[e] }
|
|
1589
|
+
}), fn = (e = "textAlignment") => ({
|
|
1590
|
+
default: G.textAlignment.default,
|
|
1591
|
+
parseHTML: (e) => e.hasAttribute("data-text-alignment") ? e.getAttribute("data-text-alignment") : e.style.textAlign ? e.style.textAlign : G.textAlignment.default,
|
|
1592
|
+
renderHTML: (t) => t[e] === G.textAlignment.default ? {} : { "data-text-alignment": t[e] }
|
|
1593
|
+
}), pn = (e, t) => {
|
|
1504
1594
|
let n = e.querySelector(t);
|
|
1505
1595
|
if (n) return {
|
|
1506
1596
|
targetElement: n,
|
|
1507
1597
|
caption: e.querySelector("figcaption")?.textContent ?? void 0
|
|
1508
1598
|
};
|
|
1509
|
-
},
|
|
1510
|
-
let n =
|
|
1599
|
+
}, J = n(({ editor: e }) => {
|
|
1600
|
+
let n = t(void 0);
|
|
1511
1601
|
function r() {
|
|
1512
1602
|
n.setState(void 0);
|
|
1513
1603
|
}
|
|
1514
1604
|
return {
|
|
1515
1605
|
key: "filePanel",
|
|
1516
1606
|
store: n,
|
|
1517
|
-
mount({ signal:
|
|
1518
|
-
let n =
|
|
1519
|
-
|
|
1607
|
+
mount({ signal: t }) {
|
|
1608
|
+
let n = e.onChange(r, !1), i = e.onSelectionChange(r, !1);
|
|
1609
|
+
t.addEventListener("abort", () => {
|
|
1520
1610
|
n(), i();
|
|
1521
1611
|
});
|
|
1522
1612
|
},
|
|
@@ -1525,7 +1615,7 @@ var G = {
|
|
|
1525
1615
|
n.setState(e);
|
|
1526
1616
|
}
|
|
1527
1617
|
};
|
|
1528
|
-
}),
|
|
1618
|
+
}), mn = (e, t, n) => {
|
|
1529
1619
|
let r = document.createElement("div");
|
|
1530
1620
|
r.className = "bn-add-file-button";
|
|
1531
1621
|
let i = document.createElement("div");
|
|
@@ -1535,7 +1625,7 @@ var G = {
|
|
|
1535
1625
|
let o = (e) => {
|
|
1536
1626
|
e.preventDefault(), e.stopPropagation();
|
|
1537
1627
|
}, s = () => {
|
|
1538
|
-
t.isEditable && t.getExtension(
|
|
1628
|
+
t.isEditable && t.getExtension(J)?.showMenu(e.id);
|
|
1539
1629
|
};
|
|
1540
1630
|
return r.addEventListener("mousedown", o, !0), r.addEventListener("click", s, !0), {
|
|
1541
1631
|
dom: r,
|
|
@@ -1543,17 +1633,17 @@ var G = {
|
|
|
1543
1633
|
r.removeEventListener("mousedown", o, !0), r.removeEventListener("click", s, !0);
|
|
1544
1634
|
}
|
|
1545
1635
|
};
|
|
1546
|
-
},
|
|
1636
|
+
}, hn = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z\"></path></svg>", gn = (e) => {
|
|
1547
1637
|
let t = document.createElement("div");
|
|
1548
1638
|
t.className = "bn-file-name-with-icon";
|
|
1549
1639
|
let n = document.createElement("div");
|
|
1550
|
-
n.className = "bn-file-icon", n.innerHTML =
|
|
1640
|
+
n.className = "bn-file-icon", n.innerHTML = hn, t.appendChild(n);
|
|
1551
1641
|
let r = document.createElement("p");
|
|
1552
1642
|
return r.className = "bn-file-name", r.textContent = e.props.name, t.appendChild(r), { dom: t };
|
|
1553
|
-
},
|
|
1643
|
+
}, _n = (e, t, n, r) => {
|
|
1554
1644
|
let i = e.props.url !== "" && !!e.props.caption, a = document.createElement(i ? "figure" : "div");
|
|
1555
1645
|
if (a.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
1556
|
-
let n =
|
|
1646
|
+
let n = mn(e, t, r);
|
|
1557
1647
|
a.appendChild(n.dom);
|
|
1558
1648
|
let i = t.onUploadStart((t) => {
|
|
1559
1649
|
if (t === e.id) {
|
|
@@ -1571,7 +1661,7 @@ var G = {
|
|
|
1571
1661
|
}
|
|
1572
1662
|
let o = { dom: a };
|
|
1573
1663
|
if (e.props.showPreview === !1 || !n) {
|
|
1574
|
-
let t =
|
|
1664
|
+
let t = gn(e);
|
|
1575
1665
|
a.appendChild(t.dom), o.destroy = () => {
|
|
1576
1666
|
t.destroy?.();
|
|
1577
1667
|
};
|
|
@@ -1581,69 +1671,69 @@ var G = {
|
|
|
1581
1671
|
t.className = "bn-file-caption", t.textContent = e.props.caption, a.appendChild(t);
|
|
1582
1672
|
}
|
|
1583
1673
|
return o;
|
|
1584
|
-
},
|
|
1674
|
+
}, vn = (e, t) => {
|
|
1585
1675
|
let n = document.createElement("figure"), r = document.createElement("figcaption");
|
|
1586
1676
|
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
1587
|
-
},
|
|
1677
|
+
}, yn = (e, t) => {
|
|
1588
1678
|
let n = document.createElement("div"), r = document.createElement("p");
|
|
1589
1679
|
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
1590
|
-
},
|
|
1680
|
+
}, bn = (e) => ({ url: e.src || void 0 }), xn = "<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>", Sn = F((e) => ({
|
|
1591
1681
|
type: "audio",
|
|
1592
1682
|
propSchema: {
|
|
1593
|
-
backgroundColor:
|
|
1683
|
+
backgroundColor: G.backgroundColor,
|
|
1594
1684
|
name: { default: "" },
|
|
1595
1685
|
url: { default: "" },
|
|
1596
1686
|
caption: { default: "" },
|
|
1597
1687
|
showPreview: { default: !0 }
|
|
1598
1688
|
},
|
|
1599
1689
|
content: "none"
|
|
1600
|
-
})),
|
|
1690
|
+
})), Cn = (e = {}) => (e) => {
|
|
1601
1691
|
if (e.tagName === "AUDIO") {
|
|
1602
1692
|
if (e.closest("figure")) return;
|
|
1603
|
-
let { backgroundColor: t } =
|
|
1693
|
+
let { backgroundColor: t } = K(e);
|
|
1604
1694
|
return {
|
|
1605
|
-
...
|
|
1695
|
+
...bn(e),
|
|
1606
1696
|
backgroundColor: t
|
|
1607
1697
|
};
|
|
1608
1698
|
}
|
|
1609
1699
|
if (e.tagName === "FIGURE") {
|
|
1610
|
-
let t =
|
|
1700
|
+
let t = pn(e, "audio");
|
|
1611
1701
|
if (!t) return;
|
|
1612
|
-
let { targetElement: n, caption: r } = t, { backgroundColor: i } =
|
|
1702
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
|
|
1613
1703
|
return {
|
|
1614
|
-
...
|
|
1704
|
+
...bn(n),
|
|
1615
1705
|
backgroundColor: i,
|
|
1616
1706
|
caption: r
|
|
1617
1707
|
};
|
|
1618
1708
|
}
|
|
1619
|
-
},
|
|
1709
|
+
}, wn = (e = {}) => (t, n) => {
|
|
1620
1710
|
let r = document.createElement("div");
|
|
1621
1711
|
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>";
|
|
1622
1712
|
let i = document.createElement("audio");
|
|
1623
1713
|
return i.className = "bn-audio", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
1624
1714
|
i.src = e;
|
|
1625
|
-
}) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1,
|
|
1626
|
-
},
|
|
1715
|
+
}) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1, _n(t, n, { dom: i }, r.firstElementChild);
|
|
1716
|
+
}, Tn = (e = {}) => (e, t) => {
|
|
1627
1717
|
if (!e.props.url) return { dom: document.createElement("audio") };
|
|
1628
1718
|
let n;
|
|
1629
|
-
return e.props.showPreview ? (n = document.createElement("audio"), n.src = e.props.url) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
1630
|
-
},
|
|
1719
|
+
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 ? vn(n, e.props.caption) : yn(n, e.props.caption) : { dom: n };
|
|
1720
|
+
}, En = I(Sn, (e) => ({
|
|
1631
1721
|
meta: { fileBlockAccept: ["audio/*"] },
|
|
1632
|
-
parse:
|
|
1633
|
-
render:
|
|
1634
|
-
toExternalHTML:
|
|
1722
|
+
parse: Cn(e),
|
|
1723
|
+
render: wn(e),
|
|
1724
|
+
toExternalHTML: Tn(e),
|
|
1635
1725
|
runsBefore: ["file"]
|
|
1636
|
-
})),
|
|
1637
|
-
function
|
|
1726
|
+
})), Dn = Symbol.for("blocknote.shikiParser"), On = Symbol.for("blocknote.shikiHighlighterPromise");
|
|
1727
|
+
function kn(e) {
|
|
1638
1728
|
let t = globalThis, n, r, i = !1;
|
|
1639
1729
|
return ge({
|
|
1640
1730
|
parser: (a) => {
|
|
1641
1731
|
if (!e.createHighlighter) return process.env.NODE_ENV === "development" && !i && (console.log("For syntax highlighting of code blocks, you must provide a `createCodeBlockSpec({ createHighlighter: () => ... })` function"), i = !0), [];
|
|
1642
|
-
if (!n) return t[
|
|
1732
|
+
if (!n) return t[On] = t[On] || e.createHighlighter(), t[On].then((e) => {
|
|
1643
1733
|
n = e;
|
|
1644
1734
|
});
|
|
1645
|
-
let o =
|
|
1646
|
-
return !o || o === "text" || o === "none" || o === "plaintext" || o === "txt" ? [] : n.getLoadedLanguages().includes(o) ? (r || (r = t[
|
|
1735
|
+
let o = Mn(e, a.language);
|
|
1736
|
+
return !o || o === "text" || o === "none" || o === "plaintext" || o === "txt" ? [] : n.getLoadedLanguages().includes(o) ? (r || (r = t[Dn] || _e(n), t[Dn] = r), r(a)) : n.loadLanguage(o);
|
|
1647
1737
|
},
|
|
1648
1738
|
languageExtractor: (e) => e.attrs.language,
|
|
1649
1739
|
nodeTypes: ["codeBlock"]
|
|
@@ -1651,11 +1741,11 @@ function wn(e) {
|
|
|
1651
1741
|
}
|
|
1652
1742
|
//#endregion
|
|
1653
1743
|
//#region src/blocks/Code/block.ts
|
|
1654
|
-
var
|
|
1744
|
+
var An = F(({ defaultLanguage: e = "text" }) => ({
|
|
1655
1745
|
type: "codeBlock",
|
|
1656
1746
|
propSchema: { language: { default: e } },
|
|
1657
|
-
content: "
|
|
1658
|
-
})),
|
|
1747
|
+
content: "plain"
|
|
1748
|
+
})), jn = I(An, (e) => ({
|
|
1659
1749
|
meta: {
|
|
1660
1750
|
code: !0,
|
|
1661
1751
|
defining: !0,
|
|
@@ -1707,10 +1797,10 @@ var Tn = A(({ defaultLanguage: e = "text" }) => ({
|
|
|
1707
1797
|
contentDOM: n
|
|
1708
1798
|
};
|
|
1709
1799
|
}
|
|
1710
|
-
}), (e) => [
|
|
1800
|
+
}), (e) => [n({
|
|
1711
1801
|
key: "code-block-highlighter",
|
|
1712
|
-
prosemirrorPlugins: [
|
|
1713
|
-
}),
|
|
1802
|
+
prosemirrorPlugins: [kn(e)]
|
|
1803
|
+
}), n({
|
|
1714
1804
|
key: "code-block-keyboard-shortcuts",
|
|
1715
1805
|
keyboardShortcuts: {
|
|
1716
1806
|
Delete: ({ editor: e }) => e.transact((t) => {
|
|
@@ -1747,22 +1837,22 @@ var Tn = A(({ defaultLanguage: e = "text" }) => ({
|
|
|
1747
1837
|
let n = t[1].trim();
|
|
1748
1838
|
return {
|
|
1749
1839
|
type: "codeBlock",
|
|
1750
|
-
props: { language: { language:
|
|
1840
|
+
props: { language: { language: Mn(e, n) ?? n }.language },
|
|
1751
1841
|
content: []
|
|
1752
1842
|
};
|
|
1753
1843
|
}
|
|
1754
1844
|
}]
|
|
1755
1845
|
})]);
|
|
1756
|
-
function
|
|
1846
|
+
function Mn(e, t) {
|
|
1757
1847
|
return Object.entries(e.supportedLanguages ?? {}).find(([e, { aliases: n }]) => n?.includes(t) || e === t)?.[0];
|
|
1758
1848
|
}
|
|
1759
1849
|
//#endregion
|
|
1760
1850
|
//#region src/blocks/Divider/block.ts
|
|
1761
|
-
var
|
|
1851
|
+
var Nn = F(() => ({
|
|
1762
1852
|
type: "divider",
|
|
1763
1853
|
propSchema: {},
|
|
1764
1854
|
content: "none"
|
|
1765
|
-
})),
|
|
1855
|
+
})), Pn = I(Nn, {
|
|
1766
1856
|
meta: { isolating: !1 },
|
|
1767
1857
|
parse(e) {
|
|
1768
1858
|
if (e.tagName === "HR") return {};
|
|
@@ -1770,10 +1860,10 @@ var On = A(() => ({
|
|
|
1770
1860
|
render() {
|
|
1771
1861
|
return { dom: document.createElement("hr") };
|
|
1772
1862
|
}
|
|
1773
|
-
}, [
|
|
1863
|
+
}, [n({
|
|
1774
1864
|
key: "divider-block-shortcuts",
|
|
1775
1865
|
inputRules: [{
|
|
1776
|
-
find: RegExp("^---$"),
|
|
1866
|
+
find: /* @__PURE__ */ RegExp("^---$"),
|
|
1777
1867
|
replace() {
|
|
1778
1868
|
return {
|
|
1779
1869
|
type: "divider",
|
|
@@ -1782,72 +1872,72 @@ var On = A(() => ({
|
|
|
1782
1872
|
};
|
|
1783
1873
|
}
|
|
1784
1874
|
}]
|
|
1785
|
-
})]),
|
|
1875
|
+
})]), Fn = (e) => ({ url: e.src || void 0 }), In = F(() => ({
|
|
1786
1876
|
type: "file",
|
|
1787
1877
|
propSchema: {
|
|
1788
|
-
backgroundColor:
|
|
1878
|
+
backgroundColor: G.backgroundColor,
|
|
1789
1879
|
name: { default: "" },
|
|
1790
1880
|
url: { default: "" },
|
|
1791
1881
|
caption: { default: "" }
|
|
1792
1882
|
},
|
|
1793
1883
|
content: "none"
|
|
1794
|
-
})),
|
|
1884
|
+
})), Ln = () => (e) => {
|
|
1795
1885
|
if (e.tagName === "EMBED") {
|
|
1796
1886
|
if (e.closest("figure")) return;
|
|
1797
|
-
let { backgroundColor: t } =
|
|
1887
|
+
let { backgroundColor: t } = K(e);
|
|
1798
1888
|
return {
|
|
1799
|
-
...
|
|
1889
|
+
...Fn(e),
|
|
1800
1890
|
backgroundColor: t
|
|
1801
1891
|
};
|
|
1802
1892
|
}
|
|
1803
1893
|
if (e.tagName === "FIGURE") {
|
|
1804
|
-
let t =
|
|
1894
|
+
let t = pn(e, "embed");
|
|
1805
1895
|
if (!t) return;
|
|
1806
|
-
let { targetElement: n, caption: r } = t, { backgroundColor: i } =
|
|
1896
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
|
|
1807
1897
|
return {
|
|
1808
|
-
...
|
|
1898
|
+
...Fn(n),
|
|
1809
1899
|
backgroundColor: i,
|
|
1810
1900
|
caption: r
|
|
1811
1901
|
};
|
|
1812
1902
|
}
|
|
1813
|
-
},
|
|
1903
|
+
}, Rn = I(In, {
|
|
1814
1904
|
meta: { fileBlockAccept: ["*/*"] },
|
|
1815
|
-
parse:
|
|
1905
|
+
parse: Ln(),
|
|
1816
1906
|
render(e, t) {
|
|
1817
|
-
return
|
|
1907
|
+
return _n(e, t);
|
|
1818
1908
|
},
|
|
1819
1909
|
toExternalHTML(e) {
|
|
1820
1910
|
if (!e.props.url) return { dom: document.createElement("embed") };
|
|
1821
1911
|
let t = document.createElement("a");
|
|
1822
|
-
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ?
|
|
1912
|
+
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? yn(t, e.props.caption) : { dom: t };
|
|
1823
1913
|
}
|
|
1824
1914
|
});
|
|
1825
1915
|
//#endregion
|
|
1826
1916
|
//#region src/blocks/getDetailsContent.ts
|
|
1827
|
-
function
|
|
1828
|
-
let a =
|
|
1917
|
+
function zn(e, t, n) {
|
|
1918
|
+
let a = r.fromSchema(t), o = e.querySelector(":scope > summary"), s;
|
|
1829
1919
|
if (o) {
|
|
1830
1920
|
let e = o.cloneNode(!0);
|
|
1831
|
-
|
|
1921
|
+
Je(e), s = a.parse(e, {
|
|
1832
1922
|
topNode: t.nodes.paragraph.create(),
|
|
1833
1923
|
preserveWhitespace: !0
|
|
1834
1924
|
}).content;
|
|
1835
|
-
} else s =
|
|
1925
|
+
} else s = i.empty;
|
|
1836
1926
|
let c = document.createElement("div");
|
|
1837
1927
|
c.setAttribute("data-node-type", "blockGroup");
|
|
1838
1928
|
let l = !1;
|
|
1839
1929
|
for (let t of Array.from(e.childNodes)) t.tagName !== "SUMMARY" && (t.nodeType === 3 && !t.textContent?.trim() || (l = !0, c.appendChild(t.cloneNode(!0))));
|
|
1840
|
-
let u = t.nodes[
|
|
1930
|
+
let u = t.nodes[n].create({}, s);
|
|
1841
1931
|
if (!l) return u.content;
|
|
1842
1932
|
let d = a.parse(c, { topNode: t.nodes.blockGroup.create() });
|
|
1843
1933
|
return d.content.size > 0 ? u.content.addToEnd(d) : u.content;
|
|
1844
1934
|
}
|
|
1845
1935
|
//#endregion
|
|
1846
1936
|
//#region src/blocks/ToggleWrapper/createToggleWrapper.ts
|
|
1847
|
-
var
|
|
1937
|
+
var Bn = {
|
|
1848
1938
|
set: (e, t) => window.localStorage.setItem(`toggle-${e.id}`, t ? "true" : "false"),
|
|
1849
1939
|
get: (e) => window.localStorage.getItem(`toggle-${e.id}`) === "true"
|
|
1850
|
-
},
|
|
1940
|
+
}, Vn = (e, t, n, r = Bn) => {
|
|
1851
1941
|
if ("isToggleable" in e.props && !e.props.isToggleable) return { dom: n };
|
|
1852
1942
|
let i = document.createElement("div"), a = document.createElement("div");
|
|
1853
1943
|
a.className = "bn-toggle-wrapper";
|
|
@@ -1881,23 +1971,23 @@ var Fn = {
|
|
|
1881
1971
|
o.removeEventListener("mousedown", s), o.removeEventListener("click", c), l.removeEventListener("mousedown", u), l.removeEventListener("click", d), p?.();
|
|
1882
1972
|
}
|
|
1883
1973
|
};
|
|
1884
|
-
},
|
|
1974
|
+
}, Hn = [
|
|
1885
1975
|
1,
|
|
1886
1976
|
2,
|
|
1887
1977
|
3,
|
|
1888
1978
|
4,
|
|
1889
1979
|
5,
|
|
1890
1980
|
6
|
|
1891
|
-
],
|
|
1981
|
+
], Un = (e) => ({ editor: t }) => {
|
|
1892
1982
|
let n = t.getTextCursorPosition();
|
|
1893
1983
|
return t.schema.blockSchema[n.block.type].content === "inline" ? (t.updateBlock(n.block, {
|
|
1894
1984
|
type: "heading",
|
|
1895
1985
|
props: { level: e }
|
|
1896
1986
|
}), !0) : !1;
|
|
1897
|
-
},
|
|
1987
|
+
}, Wn = F(({ defaultLevel: e = 1, levels: t = Hn, allowToggleHeadings: n = !0 } = {}) => ({
|
|
1898
1988
|
type: "heading",
|
|
1899
1989
|
propSchema: {
|
|
1900
|
-
...
|
|
1990
|
+
...G,
|
|
1901
1991
|
level: {
|
|
1902
1992
|
default: e,
|
|
1903
1993
|
values: t
|
|
@@ -1908,7 +1998,7 @@ var Fn = {
|
|
|
1908
1998
|
} } : {}
|
|
1909
1999
|
},
|
|
1910
2000
|
content: "inline"
|
|
1911
|
-
})),
|
|
2001
|
+
})), Gn = I(Wn, ({ allowToggleHeadings: e = !0 } = {}) => ({
|
|
1912
2002
|
meta: { isolating: !1 },
|
|
1913
2003
|
parse(t) {
|
|
1914
2004
|
if (e && t.tagName === "DETAILS") {
|
|
@@ -1916,7 +2006,7 @@ var Fn = {
|
|
|
1916
2006
|
if (!e) return;
|
|
1917
2007
|
let n = e.querySelector("h1, h2, h3, h4, h5, h6");
|
|
1918
2008
|
return n ? {
|
|
1919
|
-
...
|
|
2009
|
+
...K(n),
|
|
1920
2010
|
level: parseInt(n.tagName[1]),
|
|
1921
2011
|
isToggleable: !0
|
|
1922
2012
|
} : void 0;
|
|
@@ -1944,18 +2034,18 @@ var Fn = {
|
|
|
1944
2034
|
default: return;
|
|
1945
2035
|
}
|
|
1946
2036
|
return {
|
|
1947
|
-
...
|
|
2037
|
+
...K(t),
|
|
1948
2038
|
level: n
|
|
1949
2039
|
};
|
|
1950
2040
|
},
|
|
1951
2041
|
...e ? { parseContent: ({ el: e, schema: t }) => {
|
|
1952
|
-
if (e.tagName === "DETAILS") return
|
|
2042
|
+
if (e.tagName === "DETAILS") return zn(e, t, "heading");
|
|
1953
2043
|
} } : {},
|
|
1954
2044
|
runsBefore: ["toggleListItem"],
|
|
1955
2045
|
render(t, n) {
|
|
1956
2046
|
let r = document.createElement(`h${t.props.level}`);
|
|
1957
2047
|
return e ? {
|
|
1958
|
-
...
|
|
2048
|
+
...Vn(t, n, r),
|
|
1959
2049
|
contentDOM: r
|
|
1960
2050
|
} : {
|
|
1961
2051
|
dom: r,
|
|
@@ -1964,7 +2054,7 @@ var Fn = {
|
|
|
1964
2054
|
},
|
|
1965
2055
|
toExternalHTML(t) {
|
|
1966
2056
|
let n = document.createElement(`h${t.props.level}`);
|
|
1967
|
-
if (
|
|
2057
|
+
if (q(t.props, n), e && t.props.isToggleable) {
|
|
1968
2058
|
let e = document.createElement("details");
|
|
1969
2059
|
e.setAttribute("open", "");
|
|
1970
2060
|
let t = document.createElement("summary");
|
|
@@ -1979,9 +2069,9 @@ var Fn = {
|
|
|
1979
2069
|
contentDOM: n
|
|
1980
2070
|
};
|
|
1981
2071
|
}
|
|
1982
|
-
}), ({ levels: e =
|
|
2072
|
+
}), ({ levels: e = Hn } = {}) => [n({
|
|
1983
2073
|
key: "heading-shortcuts",
|
|
1984
|
-
keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`,
|
|
2074
|
+
keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`, Un(e)]) ?? []),
|
|
1985
2075
|
inputRules: e.map((e) => ({
|
|
1986
2076
|
find: RegExp(`^(#{${e}})\\s$`),
|
|
1987
2077
|
replace({ match: e }) {
|
|
@@ -1991,8 +2081,8 @@ var Fn = {
|
|
|
1991
2081
|
};
|
|
1992
2082
|
}
|
|
1993
2083
|
}))
|
|
1994
|
-
})]),
|
|
1995
|
-
let { dom: a, destroy: o } =
|
|
2084
|
+
})]), Kn = (e, t, n, r, i) => {
|
|
2085
|
+
let { dom: a, destroy: o } = _n(e, t, n, i), s = a;
|
|
1996
2086
|
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");
|
|
1997
2087
|
let c = document.createElement("div");
|
|
1998
2088
|
c.className = "bn-resize-handle", c.style.left = "4px", c.style.display = "none", r.appendChild(c);
|
|
@@ -2036,15 +2126,15 @@ var Fn = {
|
|
|
2036
2126
|
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);
|
|
2037
2127
|
}
|
|
2038
2128
|
};
|
|
2039
|
-
},
|
|
2129
|
+
}, qn = (e) => ({
|
|
2040
2130
|
url: e.src || void 0,
|
|
2041
2131
|
previewWidth: e.width || void 0,
|
|
2042
2132
|
name: e.alt || void 0
|
|
2043
|
-
}),
|
|
2133
|
+
}), Jn = "<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>", Yn = F((e = {}) => ({
|
|
2044
2134
|
type: "image",
|
|
2045
2135
|
propSchema: {
|
|
2046
|
-
textAlignment:
|
|
2047
|
-
backgroundColor:
|
|
2136
|
+
textAlignment: G.textAlignment,
|
|
2137
|
+
backgroundColor: G.backgroundColor,
|
|
2048
2138
|
name: { default: "" },
|
|
2049
2139
|
url: { default: "" },
|
|
2050
2140
|
caption: { default: "" },
|
|
@@ -2055,26 +2145,26 @@ var Fn = {
|
|
|
2055
2145
|
}
|
|
2056
2146
|
},
|
|
2057
2147
|
content: "none"
|
|
2058
|
-
})),
|
|
2148
|
+
})), Xn = (e = {}) => (e) => {
|
|
2059
2149
|
if (e.tagName === "IMG") {
|
|
2060
2150
|
if (e.closest("figure")) return;
|
|
2061
|
-
let { backgroundColor: t } =
|
|
2151
|
+
let { backgroundColor: t } = K(e);
|
|
2062
2152
|
return {
|
|
2063
|
-
...
|
|
2153
|
+
...qn(e),
|
|
2064
2154
|
backgroundColor: t
|
|
2065
2155
|
};
|
|
2066
2156
|
}
|
|
2067
2157
|
if (e.tagName === "FIGURE") {
|
|
2068
|
-
let t =
|
|
2158
|
+
let t = pn(e, "img");
|
|
2069
2159
|
if (!t) return;
|
|
2070
|
-
let { targetElement: n, caption: r } = t, { backgroundColor: i } =
|
|
2160
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
|
|
2071
2161
|
return {
|
|
2072
|
-
...
|
|
2162
|
+
...qn(n),
|
|
2073
2163
|
backgroundColor: i,
|
|
2074
2164
|
caption: r
|
|
2075
2165
|
};
|
|
2076
2166
|
}
|
|
2077
|
-
},
|
|
2167
|
+
}, Zn = (e = {}) => (t, n) => {
|
|
2078
2168
|
let r = document.createElement("div");
|
|
2079
2169
|
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>";
|
|
2080
2170
|
let i = document.createElement("div");
|
|
@@ -2082,21 +2172,21 @@ var Fn = {
|
|
|
2082
2172
|
let a = document.createElement("img");
|
|
2083
2173
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
2084
2174
|
a.src = e;
|
|
2085
|
-
}) : a.src = t.props.url, a.alt = t.props.name || "", a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a),
|
|
2086
|
-
},
|
|
2175
|
+
}) : 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), Kn(t, n, { dom: i }, i, r.firstElementChild);
|
|
2176
|
+
}, Qn = (e = {}) => (e, t) => {
|
|
2087
2177
|
if (!e.props.url) return { dom: document.createElement("img") };
|
|
2088
2178
|
let n;
|
|
2089
|
-
return e.props.showPreview ? (n = document.createElement("img"), n.src = e.props.url, n.alt = e.props.name || "", e.props.previewWidth && (n.width = e.props.previewWidth)) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
2090
|
-
},
|
|
2179
|
+
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 ? vn(n, e.props.caption) : yn(n, e.props.caption) : { dom: n };
|
|
2180
|
+
}, $n = I(Yn, (e) => ({
|
|
2091
2181
|
meta: { fileBlockAccept: ["image/*"] },
|
|
2092
|
-
parse:
|
|
2093
|
-
render:
|
|
2094
|
-
toExternalHTML:
|
|
2182
|
+
parse: Xn(e),
|
|
2183
|
+
render: Zn(e),
|
|
2184
|
+
toExternalHTML: Qn(e),
|
|
2095
2185
|
runsBefore: ["file"]
|
|
2096
|
-
})),
|
|
2097
|
-
let i =
|
|
2186
|
+
})), er = (e, t, n) => ({ state: r, dispatch: i }) => i ? tr(r.tr, e, t, n) : !0, tr = (e, t, n, r) => {
|
|
2187
|
+
let i = b(je(e.doc, t));
|
|
2098
2188
|
if (!i.isBlockContainer) return !1;
|
|
2099
|
-
let a =
|
|
2189
|
+
let a = k(e), o = [{
|
|
2100
2190
|
type: i.bnBlock.node.type,
|
|
2101
2191
|
attrs: r ? {
|
|
2102
2192
|
...i.bnBlock.node.attrs,
|
|
@@ -2107,31 +2197,31 @@ var Fn = {
|
|
|
2107
2197
|
attrs: r ? { ...i.blockContent.node.attrs } : {}
|
|
2108
2198
|
}];
|
|
2109
2199
|
return e.split(t, 2, o), !0;
|
|
2110
|
-
},
|
|
2200
|
+
}, nr = (e, t) => {
|
|
2111
2201
|
let { blockInfo: n, selectionEmpty: r } = e.transact((e) => ({
|
|
2112
|
-
blockInfo:
|
|
2202
|
+
blockInfo: x(e),
|
|
2113
2203
|
selectionEmpty: e.selection.anchor === e.selection.head
|
|
2114
2204
|
}));
|
|
2115
2205
|
if (!n.isBlockContainer) return !1;
|
|
2116
2206
|
let { bnBlock: i, blockContent: a } = n;
|
|
2117
2207
|
return a.node.type.name !== t || !r ? !1 : a.node.childCount === 0 ? (e.transact((e) => {
|
|
2118
|
-
|
|
2208
|
+
$t(e, i.beforePos, {
|
|
2119
2209
|
type: "paragraph",
|
|
2120
2210
|
props: {}
|
|
2121
2211
|
});
|
|
2122
|
-
}), !0) : a.node.childCount > 0 ? e.transact((e) => (e.deleteSelection(),
|
|
2212
|
+
}), !0) : a.node.childCount > 0 ? e.transact((e) => (e.deleteSelection(), e.scrollIntoView(), tr(e, e.selection.from, !0))) : !1;
|
|
2123
2213
|
};
|
|
2124
2214
|
//#endregion
|
|
2125
2215
|
//#region src/blocks/ListItem/getListItemContent.ts
|
|
2126
|
-
function
|
|
2127
|
-
let a =
|
|
2216
|
+
function rr(e, t, n) {
|
|
2217
|
+
let a = r.fromSchema(t), o = e, s = document.createElement("div");
|
|
2128
2218
|
s.setAttribute("data-node-type", "blockGroup");
|
|
2129
2219
|
for (let e of Array.from(o.childNodes)) s.appendChild(e.cloneNode(!0));
|
|
2130
2220
|
let c = a.parse(s, { topNode: t.nodes.blockGroup.create() });
|
|
2131
2221
|
c.firstChild?.firstChild?.type.name === "checkListItem" && (c = c.copy(c.content.cut(c.firstChild.firstChild.nodeSize + 2)));
|
|
2132
2222
|
let l = c.firstChild?.firstChild;
|
|
2133
|
-
if (!l?.isTextblock) return
|
|
2134
|
-
let u = t.nodes[
|
|
2223
|
+
if (!l?.isTextblock) return i.from(c);
|
|
2224
|
+
let u = t.nodes[n].create({}, l.content), d = c.content.cut(l.nodeSize + 2);
|
|
2135
2225
|
if (d.size > 0) {
|
|
2136
2226
|
let e = c.copy(d);
|
|
2137
2227
|
return u.content.addToEnd(e);
|
|
@@ -2140,18 +2230,18 @@ function Qn(e, t, i) {
|
|
|
2140
2230
|
}
|
|
2141
2231
|
//#endregion
|
|
2142
2232
|
//#region src/blocks/ListItem/BulletListItem/block.ts
|
|
2143
|
-
var
|
|
2233
|
+
var ir = F(() => ({
|
|
2144
2234
|
type: "bulletListItem",
|
|
2145
|
-
propSchema: { ...
|
|
2235
|
+
propSchema: { ...G },
|
|
2146
2236
|
content: "inline"
|
|
2147
|
-
})),
|
|
2237
|
+
})), ar = I(ir, {
|
|
2148
2238
|
meta: { isolating: !1 },
|
|
2149
2239
|
parse(e) {
|
|
2150
2240
|
if (e.tagName !== "LI") return;
|
|
2151
2241
|
let t = e.parentElement;
|
|
2152
|
-
if (t === null || t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL" || !e.closest("ul, ol")) return
|
|
2242
|
+
if (t === null || t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL" || !e.closest("ul, ol")) return K(e);
|
|
2153
2243
|
},
|
|
2154
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2244
|
+
parseContent: ({ el: e, schema: t }) => rr(e, t, "bulletListItem"),
|
|
2155
2245
|
render() {
|
|
2156
2246
|
let e = document.createElement("p");
|
|
2157
2247
|
return {
|
|
@@ -2161,15 +2251,15 @@ var $n = A(() => ({
|
|
|
2161
2251
|
},
|
|
2162
2252
|
toExternalHTML(e) {
|
|
2163
2253
|
let t = document.createElement("li"), n = document.createElement("p");
|
|
2164
|
-
return
|
|
2254
|
+
return q(e.props, t), t.appendChild(n), {
|
|
2165
2255
|
dom: t,
|
|
2166
2256
|
contentDOM: n
|
|
2167
2257
|
};
|
|
2168
2258
|
}
|
|
2169
|
-
}, [
|
|
2259
|
+
}, [n({
|
|
2170
2260
|
key: "bullet-list-item-shortcuts",
|
|
2171
2261
|
keyboardShortcuts: {
|
|
2172
|
-
Enter: ({ editor: e }) =>
|
|
2262
|
+
Enter: ({ editor: e }) => nr(e, "bulletListItem"),
|
|
2173
2263
|
"Mod-Shift-8": ({ editor: e }) => {
|
|
2174
2264
|
let t = e.getTextCursorPosition();
|
|
2175
2265
|
return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
|
|
@@ -2181,23 +2271,23 @@ var $n = A(() => ({
|
|
|
2181
2271
|
inputRules: [{
|
|
2182
2272
|
find: /^\s?[-+*]\s$/,
|
|
2183
2273
|
replace({ editor: e }) {
|
|
2184
|
-
if (
|
|
2274
|
+
if (x(e.prosemirrorState).blockNoteType !== "heading") return {
|
|
2185
2275
|
type: "bulletListItem",
|
|
2186
2276
|
props: {}
|
|
2187
2277
|
};
|
|
2188
2278
|
}
|
|
2189
2279
|
}]
|
|
2190
|
-
})]),
|
|
2280
|
+
})]), or = F(() => ({
|
|
2191
2281
|
type: "checkListItem",
|
|
2192
2282
|
propSchema: {
|
|
2193
|
-
...
|
|
2283
|
+
...G,
|
|
2194
2284
|
checked: {
|
|
2195
2285
|
default: !1,
|
|
2196
2286
|
type: "boolean"
|
|
2197
2287
|
}
|
|
2198
2288
|
},
|
|
2199
2289
|
content: "inline"
|
|
2200
|
-
})),
|
|
2290
|
+
})), sr = I(or, {
|
|
2201
2291
|
meta: { isolating: !1 },
|
|
2202
2292
|
parse(e) {
|
|
2203
2293
|
if (e.tagName === "input") return e.closest("[data-content-type]") || e.closest("li") ? void 0 : e.type === "checkbox" ? { checked: e.checked } : void 0;
|
|
@@ -2206,12 +2296,12 @@ var $n = A(() => ({
|
|
|
2206
2296
|
if (t !== null && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL")) {
|
|
2207
2297
|
let t = e.querySelector("input[type=checkbox]") || null;
|
|
2208
2298
|
return t === null ? void 0 : {
|
|
2209
|
-
...
|
|
2299
|
+
...K(e),
|
|
2210
2300
|
checked: t.checked
|
|
2211
2301
|
};
|
|
2212
2302
|
}
|
|
2213
2303
|
},
|
|
2214
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2304
|
+
parseContent: ({ el: e, schema: t }) => rr(e, t, "checkListItem"),
|
|
2215
2305
|
render(e, t) {
|
|
2216
2306
|
let n = document.createDocumentFragment(), r = document.createElement("input");
|
|
2217
2307
|
r.type = "checkbox", r.checked = e.props.checked, e.props.checked && r.setAttribute("checked", ""), r.disabled = !t.isEditable, r.addEventListener("change", () => {
|
|
@@ -2227,16 +2317,16 @@ var $n = A(() => ({
|
|
|
2227
2317
|
let t = document.createElement("li"), n = document.createElement("input");
|
|
2228
2318
|
n.type = "checkbox", n.checked = e.props.checked, e.props.checked && n.setAttribute("checked", "");
|
|
2229
2319
|
let r = document.createElement("p");
|
|
2230
|
-
return
|
|
2320
|
+
return q(e.props, t), t.appendChild(n), t.appendChild(r), {
|
|
2231
2321
|
dom: t,
|
|
2232
2322
|
contentDOM: r
|
|
2233
2323
|
};
|
|
2234
2324
|
},
|
|
2235
2325
|
runsBefore: ["bulletListItem"]
|
|
2236
|
-
}, [
|
|
2326
|
+
}, [n({
|
|
2237
2327
|
key: "check-list-item-shortcuts",
|
|
2238
2328
|
keyboardShortcuts: {
|
|
2239
|
-
Enter: ({ editor: e }) =>
|
|
2329
|
+
Enter: ({ editor: e }) => nr(e, "checkListItem"),
|
|
2240
2330
|
"Mod-Shift-9": ({ editor: e }) => {
|
|
2241
2331
|
let t = e.getTextCursorPosition();
|
|
2242
2332
|
return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
|
|
@@ -2265,8 +2355,8 @@ var $n = A(() => ({
|
|
|
2265
2355
|
})]);
|
|
2266
2356
|
//#endregion
|
|
2267
2357
|
//#region src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts
|
|
2268
|
-
function
|
|
2269
|
-
let i = !!e.firstChild.attrs.start, a =
|
|
2358
|
+
function cr(e, t, n, r) {
|
|
2359
|
+
let i = !!e.firstChild.attrs.start, a = b({
|
|
2270
2360
|
posBeforeNode: t,
|
|
2271
2361
|
node: e
|
|
2272
2362
|
});
|
|
@@ -2285,7 +2375,7 @@ function rr(e, t, n, r) {
|
|
|
2285
2375
|
pos: t
|
|
2286
2376
|
}], l = o, u = a.bnBlock.beforePos;
|
|
2287
2377
|
for (; l && r.get(l) === void 0;) {
|
|
2288
|
-
let e =
|
|
2378
|
+
let e = b({
|
|
2289
2379
|
posBeforeNode: u - l.nodeSize,
|
|
2290
2380
|
node: l
|
|
2291
2381
|
});
|
|
@@ -2297,7 +2387,7 @@ function rr(e, t, n, r) {
|
|
|
2297
2387
|
let t = n.doc.resolve(e.bnBlock.beforePos).nodeBefore;
|
|
2298
2388
|
u = e.bnBlock.beforePos, l = t;
|
|
2299
2389
|
}
|
|
2300
|
-
let d, f, p = c[c.length - 1], m =
|
|
2390
|
+
let d, f, p = c[c.length - 1], m = b({
|
|
2301
2391
|
posBeforeNode: p.pos,
|
|
2302
2392
|
node: p.node
|
|
2303
2393
|
});
|
|
@@ -2314,7 +2404,7 @@ function rr(e, t, n, r) {
|
|
|
2314
2404
|
hasStart: i
|
|
2315
2405
|
};
|
|
2316
2406
|
}
|
|
2317
|
-
function
|
|
2407
|
+
function lr(e, t) {
|
|
2318
2408
|
let n = /* @__PURE__ */ new Map(), r = t.decorations.map(e.mapping, e.doc), i = e.changedRange() ?? {
|
|
2319
2409
|
from: 0,
|
|
2320
2410
|
to: e.doc.nodeSize - 2
|
|
@@ -2322,7 +2412,7 @@ function ir(e, t) {
|
|
|
2322
2412
|
e.doc.nodesBetween(i.from, e.doc.nodeSize - 2, (t, s, c) => {
|
|
2323
2413
|
if (c && o.has(c)) return !1;
|
|
2324
2414
|
if (t.type.name === "blockContainer" && t.firstChild.type.name === "numberedListItem") {
|
|
2325
|
-
let { index: l, isFirst: u, hasStart: d } =
|
|
2415
|
+
let { index: l, isFirst: u, hasStart: d } = cr(t, s, e, n), f = e.doc.nodeAt(s + 1);
|
|
2326
2416
|
if (r.find(s + 1, s + 1 + f.nodeSize, (e) => e.index === l && e.isFirst === u && e.hasStart === d).length === 0) a.push(be.node(s + 1, s + 1 + f.nodeSize, { "data-index": l.toString() }, {
|
|
2327
2417
|
index: l,
|
|
2328
2418
|
isFirst: u,
|
|
@@ -2334,43 +2424,43 @@ function ir(e, t) {
|
|
|
2334
2424
|
let s = a.flatMap((e) => r.find(e.from, e.to));
|
|
2335
2425
|
return { decorations: r.remove(s).add(e.doc, a) };
|
|
2336
2426
|
}
|
|
2337
|
-
var
|
|
2427
|
+
var ur = () => new ve({
|
|
2338
2428
|
key: new ye("numbered-list-indexing-decorations"),
|
|
2339
2429
|
state: {
|
|
2340
2430
|
init(e, t) {
|
|
2341
|
-
return
|
|
2431
|
+
return lr(t.tr, { decorations: xe.empty });
|
|
2342
2432
|
},
|
|
2343
2433
|
apply(e, t) {
|
|
2344
|
-
return !e.docChanged && t.decorations ? t :
|
|
2434
|
+
return !e.docChanged && t.decorations ? t : lr(e, t);
|
|
2345
2435
|
}
|
|
2346
2436
|
},
|
|
2347
2437
|
props: { decorations(e) {
|
|
2348
2438
|
return this.getState(e)?.decorations ?? xe.empty;
|
|
2349
2439
|
} }
|
|
2350
|
-
}),
|
|
2440
|
+
}), dr = F(() => ({
|
|
2351
2441
|
type: "numberedListItem",
|
|
2352
2442
|
propSchema: {
|
|
2353
|
-
...
|
|
2443
|
+
...G,
|
|
2354
2444
|
start: {
|
|
2355
2445
|
default: void 0,
|
|
2356
2446
|
type: "number"
|
|
2357
2447
|
}
|
|
2358
2448
|
},
|
|
2359
2449
|
content: "inline"
|
|
2360
|
-
})),
|
|
2450
|
+
})), fr = I(dr, {
|
|
2361
2451
|
meta: { isolating: !1 },
|
|
2362
2452
|
parse(e) {
|
|
2363
2453
|
if (e.tagName !== "LI") return;
|
|
2364
2454
|
let t = e.parentElement;
|
|
2365
2455
|
if (t !== null && (t.tagName === "OL" || t.tagName === "DIV" && t.parentElement?.tagName === "OL")) {
|
|
2366
|
-
let n = parseInt(t.getAttribute("start") || "1"), r =
|
|
2456
|
+
let n = parseInt(t.getAttribute("start") || "1"), r = K(e);
|
|
2367
2457
|
return e.previousElementSibling || n === 1 ? r : {
|
|
2368
2458
|
...r,
|
|
2369
2459
|
start: n
|
|
2370
2460
|
};
|
|
2371
2461
|
}
|
|
2372
2462
|
},
|
|
2373
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2463
|
+
parseContent: ({ el: e, schema: t }) => rr(e, t, "numberedListItem"),
|
|
2374
2464
|
render() {
|
|
2375
2465
|
let e = document.createElement("p");
|
|
2376
2466
|
return {
|
|
@@ -2380,17 +2470,17 @@ var ar = () => new ve({
|
|
|
2380
2470
|
},
|
|
2381
2471
|
toExternalHTML(e) {
|
|
2382
2472
|
let t = document.createElement("li"), n = document.createElement("p");
|
|
2383
|
-
return
|
|
2473
|
+
return q(e.props, t), t.appendChild(n), {
|
|
2384
2474
|
dom: t,
|
|
2385
2475
|
contentDOM: n
|
|
2386
2476
|
};
|
|
2387
2477
|
}
|
|
2388
|
-
}, [
|
|
2478
|
+
}, [n({
|
|
2389
2479
|
key: "numbered-list-item-shortcuts",
|
|
2390
2480
|
inputRules: [{
|
|
2391
2481
|
find: /^\s?(\d+)\.\s$/,
|
|
2392
2482
|
replace({ match: e, editor: t }) {
|
|
2393
|
-
if (
|
|
2483
|
+
if (x(t.prosemirrorState).blockNoteType === "heading") return;
|
|
2394
2484
|
let n = parseInt(e[1]);
|
|
2395
2485
|
return {
|
|
2396
2486
|
type: "numberedListItem",
|
|
@@ -2399,7 +2489,7 @@ var ar = () => new ve({
|
|
|
2399
2489
|
}
|
|
2400
2490
|
}],
|
|
2401
2491
|
keyboardShortcuts: {
|
|
2402
|
-
Enter: ({ editor: e }) =>
|
|
2492
|
+
Enter: ({ editor: e }) => nr(e, "numberedListItem"),
|
|
2403
2493
|
"Mod-Shift-7": ({ editor: e }) => {
|
|
2404
2494
|
let t = e.getTextCursorPosition();
|
|
2405
2495
|
return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
|
|
@@ -2408,30 +2498,30 @@ var ar = () => new ve({
|
|
|
2408
2498
|
}), !0) : !1;
|
|
2409
2499
|
}
|
|
2410
2500
|
},
|
|
2411
|
-
prosemirrorPlugins: [
|
|
2412
|
-
})]),
|
|
2501
|
+
prosemirrorPlugins: [ur()]
|
|
2502
|
+
})]), pr = F(() => ({
|
|
2413
2503
|
type: "toggleListItem",
|
|
2414
|
-
propSchema: { ...
|
|
2504
|
+
propSchema: { ...G },
|
|
2415
2505
|
content: "inline"
|
|
2416
|
-
})),
|
|
2506
|
+
})), mr = I(pr, {
|
|
2417
2507
|
meta: { isolating: !1 },
|
|
2418
2508
|
parse(e) {
|
|
2419
|
-
if (e.tagName === "DETAILS") return
|
|
2509
|
+
if (e.tagName === "DETAILS") return K(e);
|
|
2420
2510
|
if (e.tagName === "LI") {
|
|
2421
2511
|
let t = e.parentElement;
|
|
2422
|
-
if (t && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL") && e.querySelector(":scope > details")) return
|
|
2512
|
+
if (t && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL") && e.querySelector(":scope > details")) return K(e);
|
|
2423
2513
|
}
|
|
2424
2514
|
},
|
|
2425
2515
|
parseContent: ({ el: e, schema: t }) => {
|
|
2426
2516
|
let n = e.tagName === "DETAILS" ? e : e.querySelector(":scope > details");
|
|
2427
2517
|
if (!n) throw Error("No details found in toggleListItem parseContent");
|
|
2428
|
-
return
|
|
2518
|
+
return zn(n, t, "toggleListItem");
|
|
2429
2519
|
},
|
|
2430
2520
|
runsBefore: ["bulletListItem"],
|
|
2431
2521
|
render(e, t) {
|
|
2432
2522
|
let n = document.createElement("p");
|
|
2433
2523
|
return {
|
|
2434
|
-
...
|
|
2524
|
+
...Vn(e, t, n),
|
|
2435
2525
|
contentDOM: n
|
|
2436
2526
|
};
|
|
2437
2527
|
},
|
|
@@ -2439,16 +2529,16 @@ var ar = () => new ve({
|
|
|
2439
2529
|
let t = document.createElement("li"), n = document.createElement("details");
|
|
2440
2530
|
n.setAttribute("open", "");
|
|
2441
2531
|
let r = document.createElement("summary"), i = document.createElement("p");
|
|
2442
|
-
return r.appendChild(i), n.appendChild(r),
|
|
2532
|
+
return r.appendChild(i), n.appendChild(r), q(e.props, t), t.appendChild(n), {
|
|
2443
2533
|
dom: t,
|
|
2444
2534
|
contentDOM: i,
|
|
2445
2535
|
childrenDOM: n
|
|
2446
2536
|
};
|
|
2447
2537
|
}
|
|
2448
|
-
}, [
|
|
2538
|
+
}, [n({
|
|
2449
2539
|
key: "toggle-list-item-shortcuts",
|
|
2450
2540
|
keyboardShortcuts: {
|
|
2451
|
-
Enter: ({ editor: e }) =>
|
|
2541
|
+
Enter: ({ editor: e }) => nr(e, "toggleListItem"),
|
|
2452
2542
|
"Mod-Shift-6": ({ editor: e }) => {
|
|
2453
2543
|
let t = e.getTextCursorPosition();
|
|
2454
2544
|
return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
|
|
@@ -2457,11 +2547,11 @@ var ar = () => new ve({
|
|
|
2457
2547
|
}), !0) : !1;
|
|
2458
2548
|
}
|
|
2459
2549
|
}
|
|
2460
|
-
})]),
|
|
2550
|
+
})]), hr = F(() => ({
|
|
2461
2551
|
type: "pageBreak",
|
|
2462
2552
|
propSchema: {},
|
|
2463
2553
|
content: "none"
|
|
2464
|
-
})),
|
|
2554
|
+
})), gr = I(hr, {
|
|
2465
2555
|
parse(e) {
|
|
2466
2556
|
if (e.tagName === "DIV" && e.hasAttribute("data-page-break")) return {};
|
|
2467
2557
|
},
|
|
@@ -2473,14 +2563,14 @@ var ar = () => new ve({
|
|
|
2473
2563
|
let e = document.createElement("div");
|
|
2474
2564
|
return e.setAttribute("data-page-break", ""), { dom: e };
|
|
2475
2565
|
}
|
|
2476
|
-
}),
|
|
2566
|
+
}), _r = (e) => e.extend({ blockSpecs: { pageBreak: gr() } }), vr = F(() => ({
|
|
2477
2567
|
type: "paragraph",
|
|
2478
|
-
propSchema:
|
|
2568
|
+
propSchema: G,
|
|
2479
2569
|
content: "inline"
|
|
2480
|
-
})),
|
|
2570
|
+
})), yr = I(vr, {
|
|
2481
2571
|
meta: { isolating: !1 },
|
|
2482
2572
|
parse: (e) => {
|
|
2483
|
-
if (e.tagName === "P" && e.textContent?.trim()) return
|
|
2573
|
+
if (e.tagName === "P" && e.textContent?.trim()) return K(e);
|
|
2484
2574
|
},
|
|
2485
2575
|
render: () => {
|
|
2486
2576
|
let e = document.createElement("p");
|
|
@@ -2491,13 +2581,13 @@ var ar = () => new ve({
|
|
|
2491
2581
|
},
|
|
2492
2582
|
toExternalHTML: (e) => {
|
|
2493
2583
|
let t = document.createElement("p");
|
|
2494
|
-
return
|
|
2584
|
+
return q(e.props, t), {
|
|
2495
2585
|
dom: t,
|
|
2496
2586
|
contentDOM: t
|
|
2497
2587
|
};
|
|
2498
2588
|
},
|
|
2499
2589
|
runsBefore: ["default", "heading"]
|
|
2500
|
-
}, [
|
|
2590
|
+
}, [n({
|
|
2501
2591
|
key: "paragraph-shortcuts",
|
|
2502
2592
|
keyboardShortcuts: { "Mod-Alt-0": ({ editor: e }) => {
|
|
2503
2593
|
let t = e.getTextCursorPosition();
|
|
@@ -2506,18 +2596,18 @@ var ar = () => new ve({
|
|
|
2506
2596
|
props: {}
|
|
2507
2597
|
}), !0) : !1;
|
|
2508
2598
|
} }
|
|
2509
|
-
})]),
|
|
2599
|
+
})]), br = F(() => ({
|
|
2510
2600
|
type: "quote",
|
|
2511
2601
|
propSchema: {
|
|
2512
|
-
backgroundColor:
|
|
2513
|
-
textColor:
|
|
2602
|
+
backgroundColor: G.backgroundColor,
|
|
2603
|
+
textColor: G.textColor
|
|
2514
2604
|
},
|
|
2515
2605
|
content: "inline"
|
|
2516
|
-
})),
|
|
2606
|
+
})), xr = I(br, {
|
|
2517
2607
|
meta: { isolating: !1 },
|
|
2518
2608
|
parse(e) {
|
|
2519
2609
|
if (e.tagName === "BLOCKQUOTE") {
|
|
2520
|
-
let { backgroundColor: t, textColor: n } =
|
|
2610
|
+
let { backgroundColor: t, textColor: n } = K(e);
|
|
2521
2611
|
return {
|
|
2522
2612
|
backgroundColor: t,
|
|
2523
2613
|
textColor: n
|
|
@@ -2533,12 +2623,12 @@ var ar = () => new ve({
|
|
|
2533
2623
|
},
|
|
2534
2624
|
toExternalHTML(e) {
|
|
2535
2625
|
let t = document.createElement("blockquote");
|
|
2536
|
-
return
|
|
2626
|
+
return q(e.props, t), {
|
|
2537
2627
|
dom: t,
|
|
2538
2628
|
contentDOM: t
|
|
2539
2629
|
};
|
|
2540
2630
|
}
|
|
2541
|
-
}, [
|
|
2631
|
+
}, [n({
|
|
2542
2632
|
key: "quote-block-shortcuts",
|
|
2543
2633
|
keyboardShortcuts: { "Mod-Alt-q": ({ editor: e }) => {
|
|
2544
2634
|
let t = e.getTextCursorPosition();
|
|
@@ -2548,7 +2638,7 @@ var ar = () => new ve({
|
|
|
2548
2638
|
}), !0) : !1;
|
|
2549
2639
|
} },
|
|
2550
2640
|
inputRules: [{
|
|
2551
|
-
find: RegExp("^>\\s$"),
|
|
2641
|
+
find: /* @__PURE__ */ RegExp("^>\\s$"),
|
|
2552
2642
|
replace() {
|
|
2553
2643
|
return {
|
|
2554
2644
|
type: "quote",
|
|
@@ -2556,7 +2646,7 @@ var ar = () => new ve({
|
|
|
2556
2646
|
};
|
|
2557
2647
|
}
|
|
2558
2648
|
}, {
|
|
2559
|
-
find: RegExp("^\\p{Quotation_Mark}\\s$", "u"),
|
|
2649
|
+
find: /* @__PURE__ */ RegExp("^\\p{Quotation_Mark}\\s$", "u"),
|
|
2560
2650
|
replace() {
|
|
2561
2651
|
return {
|
|
2562
2652
|
type: "quote",
|
|
@@ -2564,7 +2654,15 @@ var ar = () => new ve({
|
|
|
2564
2654
|
};
|
|
2565
2655
|
}
|
|
2566
2656
|
}]
|
|
2567
|
-
})]),
|
|
2657
|
+
})]), Sr = "blockLevelSuggestion";
|
|
2658
|
+
function Y(e) {
|
|
2659
|
+
return e && e.options.extensions.some((e) => {
|
|
2660
|
+
if (e.type !== "mark") return !1;
|
|
2661
|
+
let t = g(e, "group");
|
|
2662
|
+
return typeof t == "string" && t.split(" ").includes("blockLevelSuggestion");
|
|
2663
|
+
}) ? Sr : "";
|
|
2664
|
+
}
|
|
2665
|
+
var Cr = 120, wr = 31, Tr = s.create({
|
|
2568
2666
|
name: "BlockNoteTableExtension",
|
|
2569
2667
|
addProseMirrorPlugins: () => [le({
|
|
2570
2668
|
cellMinWidth: 35,
|
|
@@ -2573,17 +2671,16 @@ var ar = () => new ve({
|
|
|
2573
2671
|
}), he()],
|
|
2574
2672
|
addKeyboardShortcuts() {
|
|
2575
2673
|
return {
|
|
2576
|
-
Enter: () => this.editor.state
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
return n ? (t && t(e.tr.setSelection(y.between(n, fe(n))).scrollIntoView()), !0) : !1;
|
|
2674
|
+
Enter: () => de(this.editor.state) ? this.editor.commands.command(({ state: e, dispatch: t }) => {
|
|
2675
|
+
let n = me(e), r = n ? pe(n, "vert", 1) : null;
|
|
2676
|
+
return r && t && t(e.tr.setSelection(y.between(r, fe(r))).scrollIntoView()), !0;
|
|
2580
2677
|
}) : !1,
|
|
2581
2678
|
Backspace: () => {
|
|
2582
2679
|
let e = this.editor.state.selection, t = e.empty, n = e.$head.parentOffset === 0, r = e.$head.node().type.name === "tableParagraph";
|
|
2583
2680
|
return t && n && r;
|
|
2584
2681
|
},
|
|
2585
|
-
Tab: () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) => ue(1)(e, t, n)),
|
|
2586
|
-
"Shift-Tab": () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) => ue(-1)(e, t, n))
|
|
2682
|
+
Tab: () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) => de(e) ? (ue(1)(e, t, n), !0) : !1),
|
|
2683
|
+
"Shift-Tab": () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) => de(e) ? (ue(-1)(e, t, n), !0) : !1)
|
|
2587
2684
|
};
|
|
2588
2685
|
},
|
|
2589
2686
|
extendNodeSchema(e) {
|
|
@@ -2593,12 +2690,15 @@ var ar = () => new ve({
|
|
|
2593
2690
|
storage: e.storage
|
|
2594
2691
|
})) };
|
|
2595
2692
|
}
|
|
2596
|
-
}),
|
|
2693
|
+
}), Er = { textColor: G.textColor }, Dr = u.create({
|
|
2597
2694
|
name: "tableHeader",
|
|
2598
2695
|
addOptions() {
|
|
2599
2696
|
return { HTMLAttributes: {} };
|
|
2600
2697
|
},
|
|
2601
2698
|
content: "tableContent+",
|
|
2699
|
+
marks() {
|
|
2700
|
+
return Y(this.editor);
|
|
2701
|
+
},
|
|
2602
2702
|
addAttributes() {
|
|
2603
2703
|
return {
|
|
2604
2704
|
colspan: { default: 1 },
|
|
@@ -2617,7 +2717,7 @@ var ar = () => new ve({
|
|
|
2617
2717
|
parseHTML() {
|
|
2618
2718
|
return [{
|
|
2619
2719
|
tag: "th",
|
|
2620
|
-
getContent: (e, t) =>
|
|
2720
|
+
getContent: (e, t) => Mr(e, t)
|
|
2621
2721
|
}];
|
|
2622
2722
|
},
|
|
2623
2723
|
renderHTML({ HTMLAttributes: e }) {
|
|
@@ -2627,12 +2727,15 @@ var ar = () => new ve({
|
|
|
2627
2727
|
0
|
|
2628
2728
|
];
|
|
2629
2729
|
}
|
|
2630
|
-
}),
|
|
2730
|
+
}), Or = u.create({
|
|
2631
2731
|
name: "tableCell",
|
|
2632
2732
|
addOptions() {
|
|
2633
2733
|
return { HTMLAttributes: {} };
|
|
2634
2734
|
},
|
|
2635
2735
|
content: "tableContent+",
|
|
2736
|
+
marks() {
|
|
2737
|
+
return Y(this.editor);
|
|
2738
|
+
},
|
|
2636
2739
|
addAttributes() {
|
|
2637
2740
|
return {
|
|
2638
2741
|
colspan: { default: 1 },
|
|
@@ -2651,7 +2754,7 @@ var ar = () => new ve({
|
|
|
2651
2754
|
parseHTML() {
|
|
2652
2755
|
return [{
|
|
2653
2756
|
tag: "td",
|
|
2654
|
-
getContent: (e, t) =>
|
|
2757
|
+
getContent: (e, t) => Mr(e, t)
|
|
2655
2758
|
}];
|
|
2656
2759
|
},
|
|
2657
2760
|
renderHTML({ HTMLAttributes: e }) {
|
|
@@ -2661,18 +2764,20 @@ var ar = () => new ve({
|
|
|
2661
2764
|
0
|
|
2662
2765
|
];
|
|
2663
2766
|
}
|
|
2664
|
-
}),
|
|
2767
|
+
}), kr = u.create({
|
|
2665
2768
|
name: "table",
|
|
2666
2769
|
content: "tableRow+",
|
|
2667
2770
|
group: "blockContent",
|
|
2668
2771
|
tableRole: "table",
|
|
2669
|
-
marks
|
|
2772
|
+
marks() {
|
|
2773
|
+
return Y(this.editor);
|
|
2774
|
+
},
|
|
2670
2775
|
isolating: !0,
|
|
2671
2776
|
parseHTML() {
|
|
2672
2777
|
return [{ tag: "table" }];
|
|
2673
2778
|
},
|
|
2674
2779
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
2675
|
-
let n =
|
|
2780
|
+
let n = Ke(this.name, "table", {
|
|
2676
2781
|
...this.options.domAttributes?.blockContent || {},
|
|
2677
2782
|
...t
|
|
2678
2783
|
}, this.options.domAttributes?.inlineContent || {}), r = document.createElement("colgroup");
|
|
@@ -2686,10 +2791,13 @@ var ar = () => new ve({
|
|
|
2686
2791
|
addNodeView() {
|
|
2687
2792
|
return ({ node: e, HTMLAttributes: t }) => {
|
|
2688
2793
|
class n extends ce {
|
|
2794
|
+
node;
|
|
2795
|
+
cellMinWidth;
|
|
2796
|
+
blockContentHTMLAttributes;
|
|
2689
2797
|
constructor(e, t, n) {
|
|
2690
2798
|
super(e, t), this.node = e, this.cellMinWidth = t, this.blockContentHTMLAttributes = n;
|
|
2691
2799
|
let r = document.createElement("div");
|
|
2692
|
-
r.className =
|
|
2800
|
+
r.className = O("bn-block-content", n.class), r.setAttribute("data-content-type", "table");
|
|
2693
2801
|
for (let [e, t] of Object.entries(n)) e !== "class" && r.setAttribute(e, t);
|
|
2694
2802
|
let i = this.dom, a = document.createElement("div");
|
|
2695
2803
|
a.className = "tableWrapper-inner", a.appendChild(i.firstChild), i.appendChild(a), r.appendChild(i);
|
|
@@ -2701,8 +2809,8 @@ var ar = () => new ve({
|
|
|
2701
2809
|
}
|
|
2702
2810
|
update(e) {
|
|
2703
2811
|
if (!super.update(e)) return !1;
|
|
2704
|
-
for (let [t, n] of Object.entries(
|
|
2705
|
-
let r =
|
|
2812
|
+
for (let [t, n] of Object.entries(Er)) {
|
|
2813
|
+
let r = N(t), i = e.attrs[t];
|
|
2706
2814
|
i === n.default ? this.dom.removeAttribute(r) : this.dom.setAttribute(r, String(i));
|
|
2707
2815
|
}
|
|
2708
2816
|
return !0;
|
|
@@ -2714,7 +2822,7 @@ var ar = () => new ve({
|
|
|
2714
2822
|
});
|
|
2715
2823
|
};
|
|
2716
2824
|
}
|
|
2717
|
-
}),
|
|
2825
|
+
}), Ar = u.create({
|
|
2718
2826
|
name: "tableParagraph",
|
|
2719
2827
|
group: "tableContent",
|
|
2720
2828
|
content: "inline*",
|
|
@@ -2736,14 +2844,16 @@ var ar = () => new ve({
|
|
|
2736
2844
|
0
|
|
2737
2845
|
];
|
|
2738
2846
|
}
|
|
2739
|
-
}),
|
|
2847
|
+
}), jr = u.create({
|
|
2740
2848
|
name: "tableRow",
|
|
2741
2849
|
addOptions() {
|
|
2742
2850
|
return { HTMLAttributes: {} };
|
|
2743
2851
|
},
|
|
2744
2852
|
content: "(tableCell | tableHeader)+",
|
|
2745
2853
|
tableRole: "row",
|
|
2746
|
-
marks
|
|
2854
|
+
marks() {
|
|
2855
|
+
return Y(this.editor);
|
|
2856
|
+
},
|
|
2747
2857
|
parseHTML() {
|
|
2748
2858
|
return [{ tag: "tr" }];
|
|
2749
2859
|
},
|
|
@@ -2755,26 +2865,26 @@ var ar = () => new ve({
|
|
|
2755
2865
|
];
|
|
2756
2866
|
}
|
|
2757
2867
|
});
|
|
2758
|
-
function
|
|
2759
|
-
let
|
|
2760
|
-
return
|
|
2868
|
+
function Mr(e, t) {
|
|
2869
|
+
let n = r.fromSchema(t).parse(e, { topNode: t.nodes.blockGroup.create() }), a = [];
|
|
2870
|
+
return n.content.descendants((e) => {
|
|
2761
2871
|
if (e.isInline) return a.push(e), !1;
|
|
2762
|
-
}),
|
|
2872
|
+
}), i.fromArray(a);
|
|
2763
2873
|
}
|
|
2764
|
-
var
|
|
2765
|
-
node:
|
|
2874
|
+
var Nr = () => lt({
|
|
2875
|
+
node: kr,
|
|
2766
2876
|
type: "table",
|
|
2767
2877
|
content: "table"
|
|
2768
|
-
},
|
|
2878
|
+
}, Er, [n({
|
|
2769
2879
|
key: "table-extensions",
|
|
2770
2880
|
tiptapExtensions: [
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2881
|
+
Tr,
|
|
2882
|
+
Ar,
|
|
2883
|
+
Dr,
|
|
2884
|
+
Or,
|
|
2885
|
+
jr
|
|
2776
2886
|
]
|
|
2777
|
-
}),
|
|
2887
|
+
}), n({
|
|
2778
2888
|
key: "table-keyboard-delete",
|
|
2779
2889
|
keyboardShortcuts: { Backspace: ({ editor: e }) => {
|
|
2780
2890
|
if (!(e.prosemirrorState.selection instanceof oe)) return !1;
|
|
@@ -2790,15 +2900,15 @@ var Dr = () => Je({
|
|
|
2790
2900
|
(e.getPrevBlock(t) || e.getNextBlock(t)) && e.setTextCursorPosition(t), e.removeBlocks([t]);
|
|
2791
2901
|
}), !0);
|
|
2792
2902
|
} }
|
|
2793
|
-
})]),
|
|
2903
|
+
})]), Pr = (e) => ({
|
|
2794
2904
|
url: e.src || void 0,
|
|
2795
2905
|
previewWidth: e.width || void 0,
|
|
2796
2906
|
name: e.getAttribute("data-name") || void 0
|
|
2797
|
-
}),
|
|
2907
|
+
}), Fr = "<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>", Ir = F((e) => ({
|
|
2798
2908
|
type: "video",
|
|
2799
2909
|
propSchema: {
|
|
2800
|
-
textAlignment:
|
|
2801
|
-
backgroundColor:
|
|
2910
|
+
textAlignment: G.textAlignment,
|
|
2911
|
+
backgroundColor: G.backgroundColor,
|
|
2802
2912
|
name: { default: "" },
|
|
2803
2913
|
url: { default: "" },
|
|
2804
2914
|
caption: { default: "" },
|
|
@@ -2809,28 +2919,28 @@ var Dr = () => Je({
|
|
|
2809
2919
|
}
|
|
2810
2920
|
},
|
|
2811
2921
|
content: "none"
|
|
2812
|
-
})),
|
|
2922
|
+
})), Lr = (e) => (e) => {
|
|
2813
2923
|
if (e.tagName === "VIDEO") {
|
|
2814
2924
|
if (e.closest("figure")) return;
|
|
2815
|
-
let { backgroundColor: t } =
|
|
2925
|
+
let { backgroundColor: t } = K(e);
|
|
2816
2926
|
return {
|
|
2817
|
-
...
|
|
2927
|
+
...Pr(e),
|
|
2818
2928
|
backgroundColor: t
|
|
2819
2929
|
};
|
|
2820
2930
|
}
|
|
2821
2931
|
if (e.tagName === "FIGURE") {
|
|
2822
|
-
let t =
|
|
2932
|
+
let t = pn(e, "video");
|
|
2823
2933
|
if (!t) return;
|
|
2824
|
-
let { targetElement: n, caption: r } = t, { backgroundColor: i } =
|
|
2934
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
|
|
2825
2935
|
return {
|
|
2826
|
-
...
|
|
2936
|
+
...Pr(n),
|
|
2827
2937
|
backgroundColor: i,
|
|
2828
2938
|
caption: r
|
|
2829
2939
|
};
|
|
2830
2940
|
}
|
|
2831
|
-
},
|
|
2941
|
+
}, Rr = I(Ir, (e) => ({
|
|
2832
2942
|
meta: { fileBlockAccept: ["video/*"] },
|
|
2833
|
-
parse:
|
|
2943
|
+
parse: Lr(e),
|
|
2834
2944
|
render(t, n) {
|
|
2835
2945
|
let r = document.createElement("div");
|
|
2836
2946
|
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>";
|
|
@@ -2839,15 +2949,15 @@ var Dr = () => Je({
|
|
|
2839
2949
|
let a = document.createElement("video");
|
|
2840
2950
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
2841
2951
|
a.src = e;
|
|
2842
|
-
}) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a),
|
|
2952
|
+
}) : 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), Kn(t, n, { dom: i }, i, r.firstElementChild);
|
|
2843
2953
|
},
|
|
2844
2954
|
toExternalHTML(e) {
|
|
2845
2955
|
if (!e.props.url) return { dom: document.createElement("video") };
|
|
2846
2956
|
let t;
|
|
2847
|
-
return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, e.props.previewWidth && (t.width = e.props.previewWidth)) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
2957
|
+
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 ? vn(t, e.props.caption) : yn(t, e.props.caption) : { dom: t };
|
|
2848
2958
|
},
|
|
2849
2959
|
runsBefore: ["file"]
|
|
2850
|
-
})),
|
|
2960
|
+
})), zr = async (e) => {
|
|
2851
2961
|
let t = new FormData();
|
|
2852
2962
|
return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
2853
2963
|
method: "POST",
|
|
@@ -2872,16 +2982,16 @@ function X(e, t, n) {
|
|
|
2872
2982
|
}
|
|
2873
2983
|
return !0;
|
|
2874
2984
|
}
|
|
2875
|
-
function
|
|
2985
|
+
function Br(e, t, n, r) {
|
|
2876
2986
|
return X(t, n, r) && e.type === n;
|
|
2877
2987
|
}
|
|
2878
|
-
function
|
|
2988
|
+
function Vr(e) {
|
|
2879
2989
|
return e instanceof oe;
|
|
2880
2990
|
}
|
|
2881
2991
|
//#endregion
|
|
2882
2992
|
//#region src/extensions/FormattingToolbar/FormattingToolbar.ts
|
|
2883
|
-
var Z =
|
|
2884
|
-
let n =
|
|
2993
|
+
var Z = n(({ editor: e }) => {
|
|
2994
|
+
let n = t(!1), r = () => e.transact((e) => {
|
|
2885
2995
|
if (e.selection.empty || e.selection instanceof y && e.doc.textBetween(e.selection.from, e.selection.to).length === 0) return !1;
|
|
2886
2996
|
let t = !1;
|
|
2887
2997
|
return e.selection.content().content.descendants((e) => (e.type.spec.code && (t = !0), !t)), !t;
|
|
@@ -2889,59 +2999,47 @@ var Z = t(({ editor: t }) => {
|
|
|
2889
2999
|
return {
|
|
2890
3000
|
key: "formattingToolbar",
|
|
2891
3001
|
store: n,
|
|
2892
|
-
mount({ dom:
|
|
2893
|
-
let a = !1, o = !1, s =
|
|
3002
|
+
mount({ dom: t, signal: i }) {
|
|
3003
|
+
let a = !1, o = !1, s = e.onChange(() => {
|
|
2894
3004
|
a || o || n.setState(r());
|
|
2895
|
-
}), c =
|
|
3005
|
+
}), c = e.onSelectionChange(() => {
|
|
2896
3006
|
a || o || n.setState(r());
|
|
2897
3007
|
});
|
|
2898
|
-
|
|
3008
|
+
t.addEventListener("pointerdown", () => {
|
|
2899
3009
|
a = !0, n.setState(!1);
|
|
2900
|
-
}, { signal: i }),
|
|
2901
|
-
a = !1,
|
|
3010
|
+
}, { signal: i }), e.prosemirrorView.root.addEventListener("pointerup", () => {
|
|
3011
|
+
a = !1, e.isFocused() && n.setState(r());
|
|
2902
3012
|
}, {
|
|
2903
3013
|
signal: i,
|
|
2904
3014
|
capture: !0
|
|
2905
|
-
}),
|
|
3015
|
+
}), t.addEventListener("pointercancel", () => {
|
|
2906
3016
|
a = !0;
|
|
2907
3017
|
}, {
|
|
2908
3018
|
signal: i,
|
|
2909
3019
|
capture: !0
|
|
2910
|
-
}),
|
|
3020
|
+
}), e.prosemirrorView.root.addEventListener("dragstart", () => {
|
|
2911
3021
|
o = !0, n.setState(!1);
|
|
2912
|
-
}, { signal: i }),
|
|
3022
|
+
}, { signal: i }), e.prosemirrorView.root.addEventListener("dragend", () => {
|
|
2913
3023
|
o = !1;
|
|
2914
3024
|
}, { signal: i }), i.addEventListener("abort", () => {
|
|
2915
3025
|
s(), c();
|
|
2916
3026
|
});
|
|
2917
3027
|
}
|
|
2918
3028
|
};
|
|
2919
|
-
})
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
}
|
|
2929
|
-
function Rr(e, t, n = "left") {
|
|
2930
|
-
let r = Ee.getState(e.prosemirrorState);
|
|
2931
|
-
if (!r) {
|
|
2932
|
-
let r = Lr(e), i = r.maps.length;
|
|
2933
|
-
return () => r.slice(i).map(t, n === "left" ? -1 : 1);
|
|
2934
|
-
}
|
|
2935
|
-
let i = we(t + (n === "right" ? 1 : -1), r.binding.type, r.binding.mapping);
|
|
2936
|
-
return () => {
|
|
2937
|
-
let t = Ee.getState(e.prosemirrorState), r = Te(t.doc, t.binding.type, i, t.binding.mapping);
|
|
2938
|
-
if (r === null) throw Error("Position not found, cannot track positions");
|
|
2939
|
-
return r + (n === "right" ? -1 : 1);
|
|
2940
|
-
};
|
|
3029
|
+
});
|
|
3030
|
+
//#endregion
|
|
3031
|
+
//#region src/api/positionMapping.ts
|
|
3032
|
+
function Hr(e, t, n = "left") {
|
|
3033
|
+
let r = e.getExtension("yPositionMapping");
|
|
3034
|
+
if (r) return r.mapPosition(t, n);
|
|
3035
|
+
let i = e.getExtension("positionMapping");
|
|
3036
|
+
if (i) return i.mapPosition(t, n);
|
|
3037
|
+
throw Error("No position mapping extension found");
|
|
2941
3038
|
}
|
|
2942
3039
|
//#endregion
|
|
2943
3040
|
//#region src/extensions/SuggestionMenu/SuggestionMenu.ts
|
|
2944
|
-
var
|
|
3041
|
+
var Ur = m((e) => e.type.name === "blockContainer"), Wr = class {
|
|
3042
|
+
editor;
|
|
2945
3043
|
state;
|
|
2946
3044
|
emitUpdate;
|
|
2947
3045
|
rootEl;
|
|
@@ -2988,8 +3086,8 @@ var zr = m((e) => e.type.name === "blockContainer"), Br = class {
|
|
|
2988
3086
|
to: this.editor.transact((e) => e.selection.from)
|
|
2989
3087
|
}).run();
|
|
2990
3088
|
};
|
|
2991
|
-
}, Q = new
|
|
2992
|
-
let n = /* @__PURE__ */ new Map(), r, i =
|
|
3089
|
+
}, Q = new ne("SuggestionMenuPlugin"), Gr = n(({ editor: e }) => {
|
|
3090
|
+
let n = /* @__PURE__ */ new Map(), r, i = t(void 0);
|
|
2993
3091
|
return {
|
|
2994
3092
|
key: "suggestionMenu",
|
|
2995
3093
|
store: i,
|
|
@@ -3006,42 +3104,42 @@ var zr = m((e) => e.type.name === "blockContainer"), Br = class {
|
|
|
3006
3104
|
r?.clearQuery();
|
|
3007
3105
|
},
|
|
3008
3106
|
shown: () => r?.state?.show || !1,
|
|
3009
|
-
openSuggestionMenu: (
|
|
3010
|
-
|
|
3011
|
-
n?.deleteTriggerCharacter &&
|
|
3012
|
-
triggerCharacter:
|
|
3107
|
+
openSuggestionMenu: (t, n) => {
|
|
3108
|
+
e.headless || (e.focus(), e.transact((e) => {
|
|
3109
|
+
n?.deleteTriggerCharacter && e.insertText(t), e.scrollIntoView().setMeta(Q, {
|
|
3110
|
+
triggerCharacter: t,
|
|
3013
3111
|
deleteTriggerCharacter: n?.deleteTriggerCharacter || !1,
|
|
3014
3112
|
ignoreQueryLength: n?.ignoreQueryLength || !1
|
|
3015
3113
|
});
|
|
3016
3114
|
}));
|
|
3017
3115
|
},
|
|
3018
|
-
prosemirrorPlugins: [new
|
|
3116
|
+
prosemirrorPlugins: [new te({
|
|
3019
3117
|
key: Q,
|
|
3020
|
-
view: (
|
|
3118
|
+
view: (t) => (r = new Wr(e, (e, t) => {
|
|
3021
3119
|
i.setState({
|
|
3022
3120
|
...t,
|
|
3023
3121
|
triggerCharacter: e
|
|
3024
3122
|
});
|
|
3025
|
-
},
|
|
3123
|
+
}, t), r),
|
|
3026
3124
|
state: {
|
|
3027
3125
|
init() {},
|
|
3028
|
-
apply: (
|
|
3029
|
-
if (
|
|
3030
|
-
let o =
|
|
3126
|
+
apply: (t, n, i, a) => {
|
|
3127
|
+
if (t.selection.$from.parent.type.spec.code) return n;
|
|
3128
|
+
let o = t.getMeta(Q);
|
|
3031
3129
|
if (typeof o == "object" && o) {
|
|
3032
3130
|
n && r?.closeMenu();
|
|
3033
|
-
let
|
|
3131
|
+
let t = Hr(e, a.selection.from - o.triggerCharacter.length);
|
|
3034
3132
|
return {
|
|
3035
3133
|
triggerCharacter: o.triggerCharacter,
|
|
3036
3134
|
deleteTriggerCharacter: o.deleteTriggerCharacter !== !1,
|
|
3037
|
-
queryStartPos: () =>
|
|
3135
|
+
queryStartPos: () => t() + o.triggerCharacter.length,
|
|
3038
3136
|
query: "",
|
|
3039
3137
|
decorationId: `id_${Math.floor(Math.random() * 4294967295)}`,
|
|
3040
3138
|
ignoreQueryLength: o?.ignoreQueryLength
|
|
3041
3139
|
};
|
|
3042
3140
|
}
|
|
3043
3141
|
if (n === void 0) return n;
|
|
3044
|
-
if (a.selection.from !== a.selection.to || o === null ||
|
|
3142
|
+
if (a.selection.from !== a.selection.to || o === null || t.getMeta("focus") || t.getMeta("blur") || t.getMeta("pointer") || n.triggerCharacter !== void 0 && a.selection.from < n.queryStartPos() || !a.selection.$from.sameParent(a.doc.resolve(n.queryStartPos()))) return;
|
|
3045
3143
|
let s = { ...n };
|
|
3046
3144
|
return s.query = a.doc.textBetween(n.queryStartPos(), a.selection.from), s;
|
|
3047
3145
|
}
|
|
@@ -3064,7 +3162,7 @@ var zr = m((e) => e.type.name === "blockContainer"), Br = class {
|
|
|
3064
3162
|
let t = this.getState(e);
|
|
3065
3163
|
if (t === void 0) return null;
|
|
3066
3164
|
if (!t.deleteTriggerCharacter) {
|
|
3067
|
-
let n =
|
|
3165
|
+
let n = Ur(e.selection);
|
|
3068
3166
|
if (n) return Ce.create(e.doc, [Se.node(n.pos, n.pos + n.node.nodeSize, {
|
|
3069
3167
|
nodeName: "span",
|
|
3070
3168
|
class: "bn-suggestion-decorator",
|
|
@@ -3083,7 +3181,7 @@ var zr = m((e) => e.type.name === "blockContainer"), Br = class {
|
|
|
3083
3181
|
});
|
|
3084
3182
|
//#endregion
|
|
3085
3183
|
//#region src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts
|
|
3086
|
-
function
|
|
3184
|
+
function Kr(e) {
|
|
3087
3185
|
let t = e.getTextCursorPosition().block, n = e.schema.blockSchema[t.type].content;
|
|
3088
3186
|
for (; n === "none";) {
|
|
3089
3187
|
if (t = e.getTextCursorPosition().nextBlock, t === void 0) return;
|
|
@@ -3094,9 +3192,9 @@ function $(e, t) {
|
|
|
3094
3192
|
let n = e.getTextCursorPosition().block;
|
|
3095
3193
|
if (n.content === void 0) throw Error("Slash Menu open in a block that doesn't contain content.");
|
|
3096
3194
|
let r;
|
|
3097
|
-
return Array.isArray(n.content) && (n.content.length === 1 &&
|
|
3195
|
+
return Array.isArray(n.content) && (n.content.length === 1 && S(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (r = e.updateBlock(n, t), e.setTextCursorPosition(r)) : (r = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)), Kr(e), r;
|
|
3098
3196
|
}
|
|
3099
|
-
function
|
|
3197
|
+
function qr(e) {
|
|
3100
3198
|
let t = [];
|
|
3101
3199
|
return X(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((e) => e <= 3).forEach((n) => {
|
|
3102
3200
|
t.push({
|
|
@@ -3106,7 +3204,7 @@ function Ur(e) {
|
|
|
3106
3204
|
props: { level: n }
|
|
3107
3205
|
});
|
|
3108
3206
|
},
|
|
3109
|
-
badge:
|
|
3207
|
+
badge: D(`Mod-Alt-${n}`),
|
|
3110
3208
|
key: n === 1 ? "heading" : `heading_${n}`,
|
|
3111
3209
|
...e.dictionary.slash_menu[n === 1 ? "heading" : `heading_${n}`]
|
|
3112
3210
|
});
|
|
@@ -3120,42 +3218,42 @@ function Ur(e) {
|
|
|
3120
3218
|
onItemClick: () => {
|
|
3121
3219
|
$(e, { type: "toggleListItem" });
|
|
3122
3220
|
},
|
|
3123
|
-
badge:
|
|
3221
|
+
badge: D("Mod-Shift-6"),
|
|
3124
3222
|
key: "toggle_list",
|
|
3125
3223
|
...e.dictionary.slash_menu.toggle_list
|
|
3126
3224
|
}), X(e, "numberedListItem") && t.push({
|
|
3127
3225
|
onItemClick: () => {
|
|
3128
3226
|
$(e, { type: "numberedListItem" });
|
|
3129
3227
|
},
|
|
3130
|
-
badge:
|
|
3228
|
+
badge: D("Mod-Shift-7"),
|
|
3131
3229
|
key: "numbered_list",
|
|
3132
3230
|
...e.dictionary.slash_menu.numbered_list
|
|
3133
3231
|
}), X(e, "bulletListItem") && t.push({
|
|
3134
3232
|
onItemClick: () => {
|
|
3135
3233
|
$(e, { type: "bulletListItem" });
|
|
3136
3234
|
},
|
|
3137
|
-
badge:
|
|
3235
|
+
badge: D("Mod-Shift-8"),
|
|
3138
3236
|
key: "bullet_list",
|
|
3139
3237
|
...e.dictionary.slash_menu.bullet_list
|
|
3140
3238
|
}), X(e, "checkListItem") && t.push({
|
|
3141
3239
|
onItemClick: () => {
|
|
3142
3240
|
$(e, { type: "checkListItem" });
|
|
3143
3241
|
},
|
|
3144
|
-
badge:
|
|
3242
|
+
badge: D("Mod-Shift-9"),
|
|
3145
3243
|
key: "check_list",
|
|
3146
3244
|
...e.dictionary.slash_menu.check_list
|
|
3147
3245
|
}), X(e, "paragraph") && t.push({
|
|
3148
3246
|
onItemClick: () => {
|
|
3149
3247
|
$(e, { type: "paragraph" });
|
|
3150
3248
|
},
|
|
3151
|
-
badge:
|
|
3249
|
+
badge: D("Mod-Alt-0"),
|
|
3152
3250
|
key: "paragraph",
|
|
3153
3251
|
...e.dictionary.slash_menu.paragraph
|
|
3154
3252
|
}), X(e, "codeBlock") && t.push({
|
|
3155
3253
|
onItemClick: () => {
|
|
3156
3254
|
$(e, { type: "codeBlock" });
|
|
3157
3255
|
},
|
|
3158
|
-
badge:
|
|
3256
|
+
badge: D("Mod-Alt-c"),
|
|
3159
3257
|
key: "code_block",
|
|
3160
3258
|
...e.dictionary.slash_menu.code_block
|
|
3161
3259
|
}), X(e, "divider") && t.push({
|
|
@@ -3188,28 +3286,28 @@ function Ur(e) {
|
|
|
3188
3286
|
}), X(e, "image", { url: "string" }) && t.push({
|
|
3189
3287
|
onItemClick: () => {
|
|
3190
3288
|
let t = $(e, { type: "image" });
|
|
3191
|
-
e.getExtension(
|
|
3289
|
+
e.getExtension(J)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3192
3290
|
},
|
|
3193
3291
|
key: "image",
|
|
3194
3292
|
...e.dictionary.slash_menu.image
|
|
3195
3293
|
}), X(e, "video", { url: "string" }) && t.push({
|
|
3196
3294
|
onItemClick: () => {
|
|
3197
3295
|
let t = $(e, { type: "video" });
|
|
3198
|
-
e.getExtension(
|
|
3296
|
+
e.getExtension(J)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3199
3297
|
},
|
|
3200
3298
|
key: "video",
|
|
3201
3299
|
...e.dictionary.slash_menu.video
|
|
3202
3300
|
}), X(e, "audio", { url: "string" }) && t.push({
|
|
3203
3301
|
onItemClick: () => {
|
|
3204
3302
|
let t = $(e, { type: "audio" });
|
|
3205
|
-
e.getExtension(
|
|
3303
|
+
e.getExtension(J)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3206
3304
|
},
|
|
3207
3305
|
key: "audio",
|
|
3208
3306
|
...e.dictionary.slash_menu.audio
|
|
3209
3307
|
}), X(e, "file", { url: "string" }) && t.push({
|
|
3210
3308
|
onItemClick: () => {
|
|
3211
3309
|
let t = $(e, { type: "file" });
|
|
3212
|
-
e.getExtension(
|
|
3310
|
+
e.getExtension(J)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3213
3311
|
},
|
|
3214
3312
|
key: "file",
|
|
3215
3313
|
...e.dictionary.slash_menu.file
|
|
@@ -3238,13 +3336,13 @@ function Ur(e) {
|
|
|
3238
3336
|
props: { level: n }
|
|
3239
3337
|
});
|
|
3240
3338
|
},
|
|
3241
|
-
badge:
|
|
3339
|
+
badge: D(`Mod-Alt-${n}`),
|
|
3242
3340
|
key: `heading_${n}`,
|
|
3243
3341
|
...e.dictionary.slash_menu[`heading_${n}`]
|
|
3244
3342
|
});
|
|
3245
3343
|
}), t.push({
|
|
3246
3344
|
onItemClick: () => {
|
|
3247
|
-
e.getExtension(
|
|
3345
|
+
e.getExtension(Gr)?.openSuggestionMenu(":", {
|
|
3248
3346
|
deleteTriggerCharacter: !0,
|
|
3249
3347
|
ignoreQueryLength: !0
|
|
3250
3348
|
});
|
|
@@ -3253,17 +3351,17 @@ function Ur(e) {
|
|
|
3253
3351
|
...e.dictionary.slash_menu.emoji
|
|
3254
3352
|
}), t;
|
|
3255
3353
|
}
|
|
3256
|
-
function
|
|
3354
|
+
function Jr(e, t) {
|
|
3257
3355
|
return e.filter(({ title: e, aliases: n }) => e.toLowerCase().includes(t.toLowerCase()) || n && n.filter((e) => e.toLowerCase().includes(t.toLowerCase())).length !== 0);
|
|
3258
3356
|
}
|
|
3259
3357
|
//#endregion
|
|
3260
3358
|
//#region src/blocks/PageBreak/getPageBreakSlashMenuItems.ts
|
|
3261
|
-
function
|
|
3359
|
+
function Yr(e) {
|
|
3262
3360
|
return "pageBreak" in e.schema.blockSchema;
|
|
3263
3361
|
}
|
|
3264
|
-
function
|
|
3362
|
+
function Xr(e) {
|
|
3265
3363
|
let t = [];
|
|
3266
|
-
return
|
|
3364
|
+
return Yr(e) && t.push({
|
|
3267
3365
|
...e.dictionary.slash_menu.page_break,
|
|
3268
3366
|
onItemClick: () => {
|
|
3269
3367
|
$(e, { type: "pageBreak" });
|
|
@@ -3273,22 +3371,22 @@ function Kr(e) {
|
|
|
3273
3371
|
}
|
|
3274
3372
|
//#endregion
|
|
3275
3373
|
//#region src/blocks/defaultBlocks.ts
|
|
3276
|
-
var
|
|
3277
|
-
audio:
|
|
3278
|
-
bulletListItem:
|
|
3279
|
-
checkListItem:
|
|
3280
|
-
codeBlock:
|
|
3281
|
-
divider:
|
|
3282
|
-
file:
|
|
3283
|
-
heading:
|
|
3284
|
-
image:
|
|
3285
|
-
numberedListItem:
|
|
3286
|
-
paragraph:
|
|
3287
|
-
quote:
|
|
3288
|
-
table:
|
|
3289
|
-
toggleListItem:
|
|
3290
|
-
video:
|
|
3291
|
-
},
|
|
3374
|
+
var Zr = {
|
|
3375
|
+
audio: En(),
|
|
3376
|
+
bulletListItem: ar(),
|
|
3377
|
+
checkListItem: sr(),
|
|
3378
|
+
codeBlock: jn(),
|
|
3379
|
+
divider: Pn(),
|
|
3380
|
+
file: Rn(),
|
|
3381
|
+
heading: Gn(),
|
|
3382
|
+
image: $n(),
|
|
3383
|
+
numberedListItem: fr(),
|
|
3384
|
+
paragraph: yr(),
|
|
3385
|
+
quote: xr(),
|
|
3386
|
+
table: Nr(),
|
|
3387
|
+
toggleListItem: mr(),
|
|
3388
|
+
video: Rr()
|
|
3389
|
+
}, Qr = St({
|
|
3292
3390
|
type: "textColor",
|
|
3293
3391
|
propSchema: "string"
|
|
3294
3392
|
}, {
|
|
@@ -3301,7 +3399,7 @@ var qr = {
|
|
|
3301
3399
|
},
|
|
3302
3400
|
toExternalHTML: (e) => {
|
|
3303
3401
|
let t = document.createElement("span");
|
|
3304
|
-
return e !==
|
|
3402
|
+
return e !== G.textColor.default && (t.style.color = e in W ? W[e].text : e), {
|
|
3305
3403
|
dom: t,
|
|
3306
3404
|
contentDOM: t
|
|
3307
3405
|
};
|
|
@@ -3309,7 +3407,7 @@ var qr = {
|
|
|
3309
3407
|
parse: (e) => {
|
|
3310
3408
|
if (e.tagName === "SPAN" && e.style.color) return e.style.color;
|
|
3311
3409
|
}
|
|
3312
|
-
}),
|
|
3410
|
+
}), $r = St({
|
|
3313
3411
|
type: "backgroundColor",
|
|
3314
3412
|
propSchema: "string"
|
|
3315
3413
|
}, {
|
|
@@ -3322,7 +3420,7 @@ var qr = {
|
|
|
3322
3420
|
},
|
|
3323
3421
|
toExternalHTML: (e) => {
|
|
3324
3422
|
let t = document.createElement("span");
|
|
3325
|
-
return e !==
|
|
3423
|
+
return e !== G.backgroundColor.default && (t.style.backgroundColor = e in W ? W[e].background : e), {
|
|
3326
3424
|
dom: t,
|
|
3327
3425
|
contentDOM: t
|
|
3328
3426
|
};
|
|
@@ -3330,12 +3428,12 @@ var qr = {
|
|
|
3330
3428
|
parse: (e) => {
|
|
3331
3429
|
if (e.tagName === "SPAN" && e.style.backgroundColor) return e.style.backgroundColor;
|
|
3332
3430
|
}
|
|
3333
|
-
}),
|
|
3334
|
-
bold:
|
|
3335
|
-
italic:
|
|
3336
|
-
underline:
|
|
3337
|
-
strike:
|
|
3338
|
-
code:
|
|
3431
|
+
}), ei = {
|
|
3432
|
+
bold: R(we, "boolean"),
|
|
3433
|
+
italic: R(Ee, "boolean"),
|
|
3434
|
+
underline: R(Oe, "boolean"),
|
|
3435
|
+
strike: R(De, "boolean"),
|
|
3436
|
+
code: R(Te.extend({ addInputRules() {
|
|
3339
3437
|
return [_({
|
|
3340
3438
|
find: /(^|[^`])`([^`]+)`(?!`)$/,
|
|
3341
3439
|
type: this.type
|
|
@@ -3347,9 +3445,9 @@ var qr = {
|
|
|
3347
3445
|
}
|
|
3348
3446
|
})];
|
|
3349
3447
|
} }), "boolean"),
|
|
3350
|
-
textColor:
|
|
3351
|
-
backgroundColor:
|
|
3352
|
-
},
|
|
3448
|
+
textColor: Qr,
|
|
3449
|
+
backgroundColor: $r
|
|
3450
|
+
}, ti = bt(ei), ni = {
|
|
3353
3451
|
text: {
|
|
3354
3452
|
config: "text",
|
|
3355
3453
|
implementation: {}
|
|
@@ -3358,16 +3456,16 @@ var qr = {
|
|
|
3358
3456
|
config: "link",
|
|
3359
3457
|
implementation: {}
|
|
3360
3458
|
}
|
|
3361
|
-
},
|
|
3459
|
+
}, ri = _t(ni), ii = class e extends Mt {
|
|
3362
3460
|
static create(t) {
|
|
3363
3461
|
return new e({
|
|
3364
|
-
blockSpecs: t?.blockSpecs ??
|
|
3365
|
-
inlineContentSpecs: t?.inlineContentSpecs ??
|
|
3366
|
-
styleSpecs: t?.styleSpecs ??
|
|
3462
|
+
blockSpecs: t?.blockSpecs ?? Zr,
|
|
3463
|
+
inlineContentSpecs: t?.inlineContentSpecs ?? ni,
|
|
3464
|
+
styleSpecs: t?.styleSpecs ?? ei
|
|
3367
3465
|
});
|
|
3368
3466
|
}
|
|
3369
3467
|
};
|
|
3370
3468
|
//#endregion
|
|
3371
|
-
export {
|
|
3469
|
+
export { Vn as $, Ae as $n, pt as $t, xr as A, qe as An, Zt as At, sr as B, w as Bn, Ft as Bt, Nr as C, Xe as Cn, ln as Ct, Sr as D, A as Dn, Qt as Dt, Cr as E, k as En, on as Et, _r as F, O as Fn, Wt as Ft, Jn as G, S as Gn, At as Gt, ir as H, C as Hn, Lt as Ht, pr as I, E as In, Ut as It, Xn as J, Pe as Jn, L as Jt, Yn as K, Re as Kn, St as Kt, mr as L, Ue as Ln, Ht as Lt, yr as M, D as Mn, H as Mt, hr as N, We as Nn, Jt as Nt, Y as O, et as On, $t as Ot, gr as P, Ge as Pn, Vt as Pt, Gn as Q, je as Qn, vt as Qt, dr as R, T as Rn, Bt as Rt, Lr as S, $e as Sn, K as St, wr as T, Qe as Tn, sn as Tt, ar as U, ze as Un, Rt as Ut, or as V, Ve as Vn, Nt as Vt, er as W, Be as Wn, Mt as Wt, Qn as X, x as Xn, R as Xt, Zn as Y, Ne as Yn, yt as Yt, Wn as Z, Me as Zn, bt as Zt, Vr as _, tt as _n, q as _t, ti as a, ut as an, Pn as at, Ir as b, nt as bn, fn as bt, Xr as c, dt as cn, Mn as ct, $ as d, st as dn, wn as dt, mt as en, ke as er, Bn as et, Gr as f, P as fn, Tn as ft, X as g, j as gn, J as gt, Br as h, ot as hn, bn as ht, ni as i, ft as in, Nn as it, vr as j, Je as jn, U as jt, br as k, Ke as kn, Xt as kt, Jr as l, lt as ln, xn as lt, Z as m, at as mn, En as mt, Zr as n, ht as nn, Rn as nt, ei as o, F as on, An as ot, Hr as p, N as pn, Sn as pt, $n as q, b as qn, xt as qt, ri as r, _t as rn, Ln as rt, Yr as s, I as sn, jn as st, ii as t, gt as tn, In as tt, qr as u, ct as un, Cn as ut, zr as v, rt as vn, G as vt, Er as w, Ze as wn, W as wt, Rr as x, it as xn, dn as xt, Fr as y, M as yn, un as yt, fr as z, He as zn, It as zt };
|
|
3372
3470
|
|
|
3373
|
-
//# sourceMappingURL=blocks-
|
|
3471
|
+
//# sourceMappingURL=blocks-CiuUGa1E.js.map
|