@blocknote/core 0.54.2 → 0.56.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-DjEkXkR5.cjs +2 -0
- package/dist/BlockNoteExtension-DjEkXkR5.cjs.map +1 -0
- package/dist/{BlockNoteExtension-CbvDA0F7.js → BlockNoteExtension-TsTGtIeX.js} +34 -27
- package/dist/BlockNoteExtension-TsTGtIeX.js.map +1 -0
- package/dist/{UserStore-mj3fXW4D.cjs → UserStore-CTVzVGh-.cjs} +2 -2
- package/dist/{UserStore-mj3fXW4D.cjs.map → UserStore-CTVzVGh-.cjs.map} +1 -1
- package/dist/{UserStore-C4TzkGEn.js → UserStore-OZJP3K8T.js} +2 -2
- package/dist/{UserStore-C4TzkGEn.js.map → UserStore-OZJP3K8T.js.map} +1 -1
- package/dist/blocknote.cjs +1 -1
- package/dist/blocknote.js +6 -6
- package/dist/blocks-COVwe5Cf.cjs +12 -0
- package/dist/blocks-COVwe5Cf.cjs.map +1 -0
- package/dist/{blocks-Dol85hpH.js → blocks-COYcDVg7.js} +1577 -1155
- package/dist/blocks-COYcDVg7.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 +69 -43
- package/dist/comments.js.map +1 -1
- package/dist/{en-uzHzj6eH.js → en-Ch-vvt5e.js} +40 -3
- package/dist/en-Ch-vvt5e.js.map +1 -0
- package/dist/en-N5lu0-j8.cjs +2 -0
- package/dist/en-N5lu0-j8.cjs.map +1 -0
- package/dist/extensions-BbM81hHa.js +3069 -0
- package/dist/extensions-BbM81hHa.js.map +1 -0
- package/dist/extensions-D_WkAfSt.cjs +58 -0
- package/dist/extensions-D_WkAfSt.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 +859 -45
- package/dist/locales.js.map +1 -1
- package/dist/src-4OQT3z5S.cjs +23 -0
- package/dist/src-4OQT3z5S.cjs.map +1 -0
- package/dist/src-BmLsLZfE.js +3491 -0
- package/dist/src-BmLsLZfE.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/dist/y.cjs +1 -1
- package/dist/y.cjs.map +1 -1
- package/dist/y.js +1284 -554
- package/dist/y.js.map +1 -1
- package/dist/yjs.cjs +1 -1
- package/dist/yjs.cjs.map +1 -1
- package/dist/yjs.js +189 -148
- package/dist/yjs.js.map +1 -1
- package/package.json +18 -18
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +45 -6
- package/src/api/blockManipulation/commands/insertBlocks/insertPlacement.test.ts +217 -0
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +113 -9
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +151 -163
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +47 -31
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +122 -181
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.test.ts +256 -0
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +80 -40
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +71 -0
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +39 -31
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +221 -8
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +40 -8
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +272 -40
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +138 -117
- package/src/api/blockManipulation/getBlock/getBlock.ts +4 -11
- package/src/api/blockManipulation/layoutBlocks/fixLayoutBlock.ts +173 -0
- package/src/api/blockManipulation/layoutBlocks/layoutBlocks.browser.test.ts +293 -0
- package/src/api/blockManipulation/layoutBlocks/layoutBlocks.fixture.ts +145 -0
- package/src/api/blockManipulation/layoutBlocks/layoutBlocks.test.ts +783 -0
- package/src/api/blockManipulation/layoutBlocks/plainBlocks.test.ts +180 -0
- package/src/api/blockManipulation/layoutBlocks/titledBlocks.test.ts +365 -0
- package/src/api/blockManipulation/selections/selection.ts +20 -53
- package/src/api/blockManipulation/selections/textCursorPosition.ts +17 -72
- package/src/api/blockManipulation/setupTestEnv.ts +38 -6
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +4 -4
- package/src/api/clipboard/toClipboard/copyExtension.ts +3 -3
- package/src/api/combineTransactionSteps.ts +22 -0
- package/src/api/exporters/html/externalHTMLExporter.ts +1 -1
- package/src/api/exporters/html/internalHTMLSerializer.ts +4 -4
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +111 -36
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +51 -21
- package/src/api/exporters/markdown/htmlToMarkdown.ts +12 -1
- package/src/api/exporters/markdown/markdownExporter.ts +1 -1
- package/src/api/getBlockInfoFromPos.test.ts +428 -3
- package/src/api/getBlockInfoFromPos.ts +531 -129
- package/src/api/getBlocksChangedByTransaction.test.ts +7 -7
- package/src/api/getBlocksChangedByTransaction.ts +3 -3
- package/src/api/{getChangedRange.ts → getChangedRangeWithAttrs.ts} +2 -2
- package/src/api/getChangedRanges.test.ts +391 -0
- package/src/api/getChangedRanges.ts +368 -0
- package/src/api/nodeConversions/blockToNode.ts +44 -16
- package/src/api/nodeConversions/fragmentToBlocks.ts +29 -44
- package/src/api/nodeConversions/nodeToBlock.ts +120 -68
- package/src/api/nodeUtil.ts +1 -1
- package/src/api/parsers/markdown/autolink.ts +23 -0
- package/src/api/parsers/markdown/markdownToHtml.ts +115 -11
- package/src/blocks/Code/block.test.ts +4 -4
- package/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.ts +6 -1
- package/src/blocks/Heading/block.ts +54 -15
- package/src/blocks/ListItem/BulletListItem/block.ts +6 -4
- package/src/blocks/ListItem/CheckListItem/block.test.ts +2 -2
- package/src/blocks/ListItem/CheckListItem/block.ts +6 -4
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +14 -17
- package/src/blocks/ListItem/NumberedListItem/block.ts +6 -4
- package/src/blocks/ListItem/ToggleListItem/block.ts +23 -12
- package/src/blocks/Table/block.ts +2 -10
- package/src/blocks/ToggleWrapper/createToggleFrame.ts +126 -0
- package/src/blocks/ToggleWrapper/toggleBlocks.browser.test.ts +1056 -0
- package/src/blocks/defaultBlockTypeItems.test.ts +70 -0
- package/src/blocks/defaultBlockTypeItems.ts +99 -0
- package/src/blocks/defaultBlocks.test.ts +67 -0
- package/src/blocks/defaultBlocks.ts +7 -1
- package/src/blocks/index.ts +2 -1
- package/src/comments/CommentEditorSubmitExtension.test.ts +141 -0
- package/src/comments/CommentEditorSubmitExtension.ts +56 -0
- package/src/comments/extension.ts +8 -0
- package/src/comments/index.ts +1 -0
- package/src/editor/Block.css +286 -154
- package/src/editor/BlockNoteEditor.node.test.ts +35 -0
- package/src/editor/BlockNoteEditor.test.ts +2 -2
- package/src/editor/BlockNoteEditor.ts +165 -50
- package/src/editor/BlockNoteExtension.ts +11 -6
- package/src/editor/blockColors.browser.test.ts +127 -0
- package/src/editor/editor.css +60 -0
- package/src/editor/managers/BlockManager.ts +4 -3
- package/src/editor/managers/EventManager.browser.test.ts +334 -0
- package/src/editor/managers/EventManager.ts +128 -31
- package/src/editor/managers/ExtensionManager/ExtensionManager.browser.test.ts +45 -0
- package/src/editor/managers/ExtensionManager/ExtensionManager.node.test.ts +209 -0
- package/src/editor/managers/ExtensionManager/ExtensionManager.test.ts +88 -1
- package/src/editor/managers/ExtensionManager/extensions.ts +10 -1
- package/src/editor/managers/ExtensionManager/index.ts +165 -75
- package/src/editor/managers/StateManager.ts +14 -4
- package/src/editor/managers/StyleManager.browser.test.ts +122 -0
- package/src/editor/managers/StyleManager.test.ts +98 -0
- package/src/editor/managers/StyleManager.ts +31 -15
- package/src/editor/managers/index.ts +1 -0
- package/src/editor/transformPasted.ts +14 -13
- package/src/exporter/Exporter.test.ts +70 -1
- package/src/exporter/Exporter.ts +34 -4
- package/src/exporter/mapping.ts +41 -10
- package/src/extensions/DropCursor/DropCursor.ts +119 -6
- package/src/extensions/DropCursor/dropIntoChildren.ts +80 -0
- package/src/extensions/FormattingToolbar/FormattingToolbar.ts +29 -0
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.test.ts +190 -0
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.ts +41 -4
- package/src/extensions/Placeholder/Placeholder.test.ts +23 -0
- package/src/extensions/Placeholder/Placeholder.ts +8 -7
- package/src/extensions/PreviousBlockType/PreviousBlockType.test.ts +36 -0
- package/src/extensions/PreviousBlockType/PreviousBlockType.ts +8 -4
- package/src/extensions/ReadOnly/ReadOnly.test.ts +181 -0
- package/src/extensions/ReadOnly/ReadOnly.ts +73 -0
- package/src/extensions/SideMenu/SideMenu.ts +401 -749
- package/src/extensions/SideMenu/blockDropHandling.ts +372 -0
- package/src/extensions/SideMenu/blockGeometry.browser.test.ts +148 -0
- package/src/extensions/SideMenu/blockGeometry.test.ts +46 -0
- package/src/extensions/SideMenu/blockGeometry.ts +53 -0
- package/src/extensions/SideMenu/dragging.ts +19 -32
- package/src/extensions/SideMenu/sideMenuHover.test.ts +36 -0
- package/src/extensions/SideMenu/sideMenuHover.ts +270 -0
- package/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.ts +5 -4
- package/src/extensions/SuggestionMenu/SuggestionMenu.ts +10 -1
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +36 -136
- package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.ts +14 -4
- package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.ts +1 -1
- package/src/extensions/SyntaxHighlighting/shiki.ts +1 -1
- package/src/extensions/TableHandles/TableHandles.browser.test.ts +3 -1
- package/src/extensions/TableHandles/TableHandles.ts +4 -6
- package/src/extensions/Versioning/Versioning.browser.test.ts +151 -0
- package/src/extensions/Versioning/Versioning.node.test.ts +177 -0
- package/src/extensions/Versioning/Versioning.ts +145 -612
- package/src/extensions/Versioning/__test__/result.ts +12 -0
- package/src/extensions/Versioning/comparison.test.ts +40 -0
- package/src/extensions/Versioning/createVersioning.test.ts +867 -0
- package/src/extensions/Versioning/createVersioning.ts +499 -0
- package/src/extensions/Versioning/formatVersionDate.ts +24 -0
- package/src/extensions/Versioning/inMemoryVersioning.test.ts +533 -430
- package/src/extensions/Versioning/inMemoryVersioning.ts +246 -251
- package/src/extensions/Versioning/index.ts +4 -0
- package/src/extensions/Versioning/scrollScheduling.test.ts +51 -0
- package/src/extensions/Versioning/scrollToFirstChange.test.ts +320 -0
- package/src/extensions/Versioning/scrollToFirstChange.ts +139 -0
- package/src/extensions/Versioning/types.ts +219 -0
- package/src/extensions/Versioning/versioningState.ts +154 -0
- package/src/extensions/blockDOM.browser.test.ts +102 -0
- package/src/extensions/blockDOM.test.ts +178 -0
- package/src/extensions/blockDOM.ts +135 -0
- package/src/extensions/index.ts +2 -0
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.ts +1719 -53
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +645 -531
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/blockIdentity.browser.test.ts +152 -0
- package/src/extensions/tiptap-extensions/Link/helpers/autolink.ts +4 -9
- package/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.ts +10 -24
- package/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts +22 -19
- package/src/fonts/inter.browser.test.ts +57 -0
- package/src/fonts/inter.css +111 -0
- package/src/i18n/locales/ar.ts +33 -0
- package/src/i18n/locales/de.ts +33 -0
- package/src/i18n/locales/en.ts +33 -0
- package/src/i18n/locales/es.ts +33 -0
- package/src/i18n/locales/fa.ts +33 -0
- package/src/i18n/locales/fr.ts +33 -0
- package/src/i18n/locales/he.ts +33 -0
- package/src/i18n/locales/hr.ts +33 -0
- package/src/i18n/locales/is.ts +33 -0
- package/src/i18n/locales/it.ts +33 -0
- package/src/i18n/locales/ja.ts +33 -0
- package/src/i18n/locales/ko.ts +33 -0
- package/src/i18n/locales/nl.ts +33 -0
- package/src/i18n/locales/no.ts +33 -0
- package/src/i18n/locales/pl.ts +33 -0
- package/src/i18n/locales/pt.ts +33 -0
- package/src/i18n/locales/ru.ts +33 -0
- package/src/i18n/locales/sk.ts +33 -0
- package/src/i18n/locales/uk.ts +33 -0
- package/src/i18n/locales/uz.ts +33 -0
- package/src/i18n/locales/vi.ts +33 -0
- package/src/i18n/locales/zh-tw.ts +33 -0
- package/src/i18n/locales/zh.ts +33 -0
- package/src/index.ts +14 -3
- package/src/pm-nodes/BlockContainer.test.ts +101 -0
- package/src/pm-nodes/BlockContainer.ts +110 -1
- package/src/pm-nodes/BlockGroup.ts +2 -1
- package/src/pm-nodes/README.md +2 -0
- package/src/schema/blocks/children.test.ts +288 -0
- package/src/schema/blocks/children.ts +136 -0
- package/src/schema/blocks/createSpec.browser.test.ts +176 -0
- package/src/schema/blocks/createSpec.test.ts +231 -0
- package/src/schema/blocks/createSpec.ts +493 -267
- package/src/schema/blocks/frame.test.ts +112 -0
- package/src/schema/blocks/frame.ts +337 -0
- package/src/schema/blocks/internal.ts +50 -17
- package/src/schema/blocks/keyboard.ts +154 -0
- package/src/schema/blocks/layoutBlockAttributes.ts +29 -0
- package/src/schema/blocks/meta.test.ts +53 -0
- package/src/schema/blocks/meta.ts +35 -0
- package/src/schema/blocks/renderFrame.test.ts +691 -0
- package/src/schema/blocks/types.ts +285 -21
- package/src/schema/blocks/validateChildren.ts +156 -0
- package/src/schema/dataAttributes.test.ts +72 -0
- package/src/schema/dataAttributes.ts +69 -0
- package/src/schema/index.ts +3 -0
- package/src/schema/inlineContent/internal.ts +7 -12
- package/src/schema/markGroups.ts +34 -2
- package/src/schema/schema.ts +8 -1
- package/src/user/userColors.test.ts +108 -0
- package/src/user/userColors.ts +42 -13
- package/src/util/browser.ts +24 -0
- package/src/y/comments/RESTYjsThreadStore.ts +1 -1
- package/src/y/comments/YjsThreadStore.test.ts +1 -1
- package/src/y/comments/YjsThreadStore.ts +27 -27
- package/src/y/comments/YjsThreadStoreBase.ts +2 -2
- package/src/y/comments/yjsHelpers.ts +11 -11
- package/src/y/extensions/AttributionExtension.test.ts +271 -2
- package/src/y/extensions/AttributionExtension.ts +146 -123
- package/src/y/extensions/DiffVersioningExtension.test.ts +67 -18
- package/src/y/extensions/DiffVersioningExtension.ts +95 -123
- package/src/y/extensions/EmptyDocBinding.test.ts +282 -0
- package/src/y/extensions/ForkYDoc.node.test.ts +77 -0
- package/src/y/extensions/ForkYDoc.test.ts +93 -2
- package/src/y/extensions/ForkYDoc.ts +22 -13
- package/src/y/extensions/History.test.ts +125 -0
- package/src/y/extensions/RelativePositionMapping.test.ts +35 -0
- package/src/y/extensions/RelativePositionMapping.ts +7 -11
- package/src/y/extensions/Versioning.node.test.ts +126 -0
- package/src/y/extensions/Versioning.test.ts +110 -401
- package/src/y/extensions/Versioning.ts +66 -107
- package/src/y/extensions/YAttributionMarks.ts +111 -9
- package/src/y/extensions/YCursorPlugin.ts +3 -0
- package/src/y/extensions/YSync.node.test.ts +75 -0
- package/src/y/extensions/YSync.ts +76 -4
- package/src/y/extensions/YSyncRemount.test.ts +99 -0
- package/src/y/extensions/blockMatchNodes.ts +20 -29
- package/src/y/extensions/index.ts +10 -26
- package/src/y/extensions/legacyYjsDocBinding.test.ts +652 -0
- package/src/y/extensions/nestingChanges.test.ts +326 -0
- package/src/y/extensions/persistentBlockGroups.test.ts +1709 -0
- package/src/y/extensions/persistentBlockGroups.ts +953 -0
- package/src/y/extensions/snapshotCodec.test.ts +105 -0
- package/src/y/extensions/snapshotCodec.ts +39 -0
- package/src/y/extensions/snapshotPreview.test.ts +201 -0
- package/src/y/extensions/snapshotPreview.ts +292 -0
- package/src/y/extensions/tableReshape.test.ts +121 -0
- package/src/y/extensions/v1BindingSnapshotDiff.test.ts +121 -0
- package/src/y/extensions/versionDiffAttribution.test.ts +944 -0
- package/src/y/extensions/versionDiffPerformance.test.ts +101 -0
- package/src/y/index.ts +1 -0
- package/src/y/utils.test.ts +289 -22
- package/src/y/utils.ts +167 -43
- package/src/y/versioning/__test__/fixtures/activity-all-after.json +5 -5
- package/src/y/versioning/__test__/fixtures/activity-all.json +3 -3
- package/src/y/versioning/__test__/fixtures/activity-filtered-after.json +2 -2
- package/src/y/versioning/__test__/yhub.test.ts +902 -721
- package/src/y/versioning/index.ts +6 -1
- package/src/y/versioning/yhub.ts +316 -603
- package/src/y/versioning/yhubClient.ts +345 -0
- package/src/yjs/comments/RESTYjsThreadStore.test.ts +10 -0
- package/src/yjs/extensions/FixUpSchema.ts +11 -0
- package/src/yjs/extensions/ForkYDoc.browser.test.ts +84 -0
- package/src/yjs/extensions/ForkYDoc.node.test.ts +231 -0
- package/src/yjs/extensions/ForkYDoc.test.ts +68 -1
- package/src/yjs/extensions/ForkYDoc.ts +57 -39
- package/src/yjs/extensions/Versioning.test.ts +345 -530
- package/src/yjs/extensions/Versioning.ts +111 -68
- package/src/yjs/extensions/index.ts +1 -1
- package/src/yjs/index.ts +4 -0
- package/types/src/api/blockManipulation/commands/insertBlocks/insertBlocks.d.ts +2 -1
- package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.d.ts +24 -24
- package/types/src/api/blockManipulation/commands/nestBlock/nestBlock.d.ts +3 -2
- package/types/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.d.ts +1 -1
- package/types/src/api/blockManipulation/commands/splitBlock/splitBlock.d.ts +2 -2
- package/types/src/api/blockManipulation/layoutBlocks/fixLayoutBlock.d.ts +34 -0
- package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.browser.test.d.ts +1 -0
- package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.fixture.d.ts +460 -0
- package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.test.d.ts +1 -0
- package/types/src/api/blockManipulation/layoutBlocks/plainBlocks.test.d.ts +1 -0
- package/types/src/api/blockManipulation/layoutBlocks/titledBlocks.test.d.ts +1 -0
- package/types/src/api/blockManipulation/setupTestEnv.d.ts +15 -69
- package/types/src/api/combineTransactionSteps.d.ts +12 -0
- package/types/src/api/getBlockInfoFromPos.d.ts +218 -44
- package/types/src/api/{getChangedRange.d.ts → getChangedRangeWithAttrs.d.ts} +1 -1
- package/types/src/api/getChangedRanges.d.ts +23 -0
- package/types/src/api/getChangedRanges.test.d.ts +1 -0
- package/types/src/api/nodeConversions/fragmentToBlocks.d.ts +0 -3
- package/types/src/api/parsers/markdown/autolink.d.ts +5 -0
- package/types/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.d.ts +4 -0
- package/types/src/blocks/ToggleWrapper/createToggleFrame.d.ts +29 -0
- package/types/src/blocks/ToggleWrapper/toggleBlocks.browser.test.d.ts +1 -0
- package/types/src/blocks/defaultBlockTypeItems.d.ts +37 -0
- package/types/src/blocks/defaultBlockTypeItems.test.d.ts +1 -0
- package/types/src/blocks/defaultBlocks.test.d.ts +1 -0
- package/types/src/blocks/index.d.ts +2 -1
- package/types/src/comments/CommentEditorSubmitExtension.d.ts +19 -0
- package/types/src/comments/CommentEditorSubmitExtension.test.d.ts +1 -0
- package/types/src/comments/extension.d.ts +7 -0
- package/types/src/comments/index.d.ts +1 -0
- package/types/src/editor/BlockNoteEditor.d.ts +88 -27
- package/types/src/editor/BlockNoteEditor.node.test.d.ts +1 -0
- package/types/src/editor/BlockNoteExtension.d.ts +3 -0
- package/types/src/editor/blockColors.browser.test.d.ts +1 -0
- package/types/src/editor/managers/BlockManager.d.ts +4 -3
- package/types/src/editor/managers/EventManager.browser.test.d.ts +1 -0
- package/types/src/editor/managers/EventManager.d.ts +55 -0
- package/types/src/editor/managers/ExtensionManager/ExtensionManager.browser.test.d.ts +1 -0
- package/types/src/editor/managers/ExtensionManager/ExtensionManager.node.test.d.ts +1 -0
- package/types/src/editor/managers/ExtensionManager/index.d.ts +15 -3
- package/types/src/editor/managers/StateManager.d.ts +1 -1
- package/types/src/editor/managers/StyleManager.browser.test.d.ts +1 -0
- package/types/src/editor/managers/StyleManager.d.ts +4 -2
- package/types/src/editor/managers/StyleManager.test.d.ts +1 -0
- package/types/src/editor/managers/index.d.ts +1 -0
- package/types/src/editor/transformPasted.d.ts +1 -1
- package/types/src/exporter/Exporter.d.ts +11 -4
- package/types/src/exporter/mapping.d.ts +13 -1
- package/types/src/extensions/DropCursor/DropCursor.d.ts +1 -1
- package/types/src/extensions/DropCursor/dropIntoChildren.d.ts +38 -0
- package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.d.ts +1 -1
- package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.test.d.ts +1 -0
- package/types/src/extensions/Placeholder/Placeholder.test.d.ts +1 -0
- package/types/src/extensions/ReadOnly/ReadOnly.d.ts +21 -0
- package/types/src/extensions/ReadOnly/ReadOnly.test.d.ts +1 -0
- package/types/src/extensions/SideMenu/SideMenu.d.ts +49 -88
- package/types/src/extensions/SideMenu/blockDropHandling.d.ts +11 -0
- package/types/src/extensions/SideMenu/blockGeometry.browser.test.d.ts +1 -0
- package/types/src/extensions/SideMenu/blockGeometry.d.ts +22 -0
- package/types/src/extensions/SideMenu/blockGeometry.test.d.ts +1 -0
- package/types/src/extensions/SideMenu/dragging.d.ts +0 -4
- package/types/src/extensions/SideMenu/sideMenuHover.d.ts +58 -0
- package/types/src/extensions/SideMenu/sideMenuHover.test.d.ts +1 -0
- package/types/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.d.ts +3 -0
- package/types/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.d.ts +1 -0
- package/types/src/extensions/Versioning/Versioning.browser.test.d.ts +1 -0
- package/types/src/extensions/Versioning/Versioning.d.ts +34 -311
- package/types/src/extensions/Versioning/Versioning.node.test.d.ts +1 -0
- package/types/src/extensions/Versioning/__test__/result.d.ts +3 -0
- package/types/src/extensions/Versioning/comparison.test.d.ts +1 -0
- package/types/src/extensions/Versioning/createVersioning.d.ts +32 -0
- package/types/src/extensions/Versioning/createVersioning.test.d.ts +1 -0
- package/types/src/extensions/Versioning/formatVersionDate.d.ts +7 -0
- package/types/src/extensions/Versioning/inMemoryVersioning.d.ts +64 -36
- package/types/src/extensions/Versioning/index.d.ts +4 -0
- package/types/src/extensions/Versioning/scrollScheduling.test.d.ts +1 -0
- package/types/src/extensions/Versioning/scrollToFirstChange.d.ts +18 -0
- package/types/src/extensions/Versioning/scrollToFirstChange.test.d.ts +1 -0
- package/types/src/extensions/Versioning/types.d.ts +239 -0
- package/types/src/extensions/Versioning/versioningState.d.ts +43 -0
- package/types/src/extensions/blockDOM.browser.test.d.ts +1 -0
- package/types/src/extensions/blockDOM.d.ts +37 -0
- package/types/src/extensions/blockDOM.test.d.ts +1 -0
- package/types/src/extensions/index.d.ts +2 -0
- package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.d.ts +1 -0
- package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.d.ts +3 -0
- package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/blockIdentity.browser.test.d.ts +1 -0
- package/types/src/fonts/inter.browser.test.d.ts +2 -0
- package/types/src/i18n/locales/en.d.ts +33 -0
- package/types/src/i18n/locales/fa.d.ts +33 -0
- package/types/src/i18n/locales/sk.d.ts +33 -0
- package/types/src/index.d.ts +7 -3
- package/types/src/pm-nodes/BlockContainer.d.ts +6 -0
- package/types/src/pm-nodes/BlockContainer.test.d.ts +1 -0
- package/types/src/schema/blocks/children.d.ts +39 -0
- package/types/src/schema/blocks/children.test.d.ts +1 -0
- package/types/src/schema/blocks/createSpec.browser.test.d.ts +1 -0
- package/types/src/schema/blocks/createSpec.d.ts +13 -0
- package/types/src/schema/blocks/frame.d.ts +109 -0
- package/types/src/schema/blocks/frame.test.d.ts +1 -0
- package/types/src/schema/blocks/internal.d.ts +6 -0
- package/types/src/schema/blocks/keyboard.d.ts +111 -0
- package/types/src/schema/blocks/layoutBlockAttributes.d.ts +9 -0
- package/types/src/schema/blocks/meta.d.ts +14 -0
- package/types/src/schema/blocks/meta.test.d.ts +1 -0
- package/types/src/schema/blocks/renderFrame.test.d.ts +1 -0
- package/types/src/schema/blocks/types.d.ts +228 -15
- package/types/src/schema/blocks/validateChildren.d.ts +5 -0
- package/types/src/schema/dataAttributes.d.ts +19 -0
- package/types/src/schema/dataAttributes.test.d.ts +1 -0
- package/types/src/schema/index.d.ts +3 -0
- package/types/src/schema/markGroups.d.ts +8 -0
- package/types/src/user/userColors.d.ts +24 -3
- package/types/src/user/userColors.test.d.ts +1 -0
- package/types/src/util/browser.d.ts +2 -0
- package/types/src/y/comments/RESTYjsThreadStore.d.ts +1 -1
- package/types/src/y/comments/YjsThreadStore.d.ts +1 -1
- package/types/src/y/comments/YjsThreadStoreBase.d.ts +2 -2
- package/types/src/y/comments/yjsHelpers.d.ts +5 -5
- package/types/src/y/extensions/AttributionExtension.d.ts +19 -21
- package/types/src/y/extensions/DiffVersioningExtension.d.ts +9 -4
- package/types/src/y/extensions/EmptyDocBinding.test.d.ts +1 -0
- package/types/src/y/extensions/ForkYDoc.d.ts +3 -1
- package/types/src/y/extensions/ForkYDoc.node.test.d.ts +1 -0
- package/types/src/y/extensions/History.test.d.ts +1 -0
- package/types/src/y/extensions/Versioning.d.ts +4 -15
- package/types/src/y/extensions/Versioning.node.test.d.ts +1 -0
- package/types/src/y/extensions/YAttributionMarks.d.ts +13 -2
- package/types/src/y/extensions/YCursorPlugin.d.ts +1 -0
- package/types/src/y/extensions/YSync.d.ts +4 -18
- package/types/src/y/extensions/YSync.node.test.d.ts +1 -0
- package/types/src/y/extensions/YSyncRemount.test.d.ts +1 -0
- package/types/src/y/extensions/blockMatchNodes.d.ts +0 -22
- package/types/src/y/extensions/index.d.ts +27 -44
- package/types/src/y/extensions/legacyYjsDocBinding.test.d.ts +1 -0
- package/types/src/y/extensions/nestingChanges.test.d.ts +1 -0
- package/types/src/y/extensions/persistentBlockGroups.d.ts +189 -0
- package/types/src/y/extensions/persistentBlockGroups.test.d.ts +1 -0
- package/types/src/y/extensions/snapshotCodec.d.ts +13 -0
- package/types/src/y/extensions/snapshotCodec.test.d.ts +1 -0
- package/types/src/y/extensions/snapshotPreview.d.ts +21 -0
- package/types/src/y/extensions/snapshotPreview.test.d.ts +1 -0
- package/types/src/y/extensions/tableReshape.test.d.ts +1 -0
- package/types/src/y/extensions/v1BindingSnapshotDiff.test.d.ts +1 -0
- package/types/src/y/extensions/versionDiffAttribution.test.d.ts +1 -0
- package/types/src/y/extensions/versionDiffPerformance.test.d.ts +1 -0
- package/types/src/y/index.d.ts +1 -0
- package/types/src/y/utils.d.ts +39 -19
- package/types/src/y/versioning/index.d.ts +1 -1
- package/types/src/y/versioning/yhub.d.ts +69 -86
- package/types/src/y/versioning/yhubClient.d.ts +67 -0
- package/types/src/yjs/extensions/ForkYDoc.browser.test.d.ts +1 -0
- package/types/src/yjs/extensions/ForkYDoc.d.ts +2 -0
- package/types/src/yjs/extensions/ForkYDoc.node.test.d.ts +1 -0
- package/types/src/yjs/extensions/Versioning.d.ts +36 -22
- package/types/src/yjs/extensions/index.d.ts +2 -1
- package/types/src/yjs/index.d.ts +1 -0
- package/dist/BlockNoteExtension-BJCLnwrE.cjs +0 -2
- package/dist/BlockNoteExtension-BJCLnwrE.cjs.map +0 -1
- package/dist/BlockNoteExtension-CbvDA0F7.js.map +0 -1
- package/dist/blocks-CTB_5Vyj.cjs +0 -12
- package/dist/blocks-CTB_5Vyj.cjs.map +0 -1
- package/dist/blocks-Dol85hpH.js.map +0 -1
- package/dist/en-BuzSuuTq.cjs +0 -2
- package/dist/en-BuzSuuTq.cjs.map +0 -1
- package/dist/en-uzHzj6eH.js.map +0 -1
- package/dist/extensions-B7Rsp_Ft.cjs +0 -58
- package/dist/extensions-B7Rsp_Ft.cjs.map +0 -1
- package/dist/extensions-D6JcJCwd.js +0 -2138
- package/dist/extensions-D6JcJCwd.js.map +0 -1
- package/dist/src-Buuo5l7X.js +0 -3317
- package/dist/src-Buuo5l7X.js.map +0 -1
- package/dist/src-C54Ok9E0.cjs +0 -23
- package/dist/src-C54Ok9E0.cjs.map +0 -1
- package/src/api/blockManipulation/commands/replaceBlocks/util/fixColumnList.ts +0 -173
- package/src/blocks/ListItem/ListItemKeyboardShortcuts.ts +0 -63
- package/src/blocks/ToggleWrapper/createToggleWrapper.ts +0 -197
- package/src/blocks/utils/listItemEnterHandler.ts +0 -43
- package/src/extensions/Versioning/Versioning.test.ts +0 -435
- package/src/extensions/getDraggableBlockFromElement.ts +0 -19
- package/types/src/api/blockManipulation/commands/replaceBlocks/util/fixColumnList.d.ts +0 -32
- package/types/src/blocks/ListItem/ListItemKeyboardShortcuts.d.ts +0 -2
- package/types/src/blocks/ToggleWrapper/createToggleWrapper.d.ts +0 -15
- package/types/src/blocks/utils/listItemEnterHandler.d.ts +0 -2
- package/types/src/extensions/getDraggableBlockFromElement.d.ts +0 -5
- /package/types/src/{extensions/Versioning/Versioning.test.d.ts → api/blockManipulation/commands/insertBlocks/insertPlacement.test.d.ts} +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { n as e, o as t,
|
|
2
|
-
import { DOMParser as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { CellSelection as se, TableMap as ce, TableView as le, columnResizing as ue, goToNextCell as de, isInTable as fe, moveCellForward as pe, nextCell as me, selectionCell as he, tableEditing as ge } from "prosemirror-tables";
|
|
1
|
+
import { n as e, o as t, s as n, t as r } from "./BlockNoteExtension-TsTGtIeX.js";
|
|
2
|
+
import { DOMParser as i, Fragment as a, Slice as o } from "prosemirror-model";
|
|
3
|
+
import { NodeSelection as s, Plugin as c, PluginKey as l, TextSelection as u } from "prosemirror-state";
|
|
4
|
+
import { DOMParser as d, DOMSerializer as f, Fragment as p } from "@tiptap/pm/model";
|
|
5
|
+
import { Extension as m, InputRule as h, Mark as g, Node as _, callOrReturn as v, combineTransactionSteps as ee, findChildrenInRange as te, findParentNode as ne, getChangedRanges as re, getExtensionField as ie, markInputRule as ae, mergeAttributes as oe } from "@tiptap/core";
|
|
6
|
+
import { uuidv4 as se } from "lib0/random";
|
|
7
|
+
import { CellSelection as ce, TableView as le, columnResizing as ue, goToNextCell as de, isInTable as fe, moveCellForward as pe, nextCell as me, selectionCell as he, tableEditing as ge } from "prosemirror-tables";
|
|
9
8
|
import { Plugin as _e, PluginKey as ve } from "@tiptap/pm/state";
|
|
10
9
|
import { Decoration as ye, DecorationSet as be } from "@tiptap/pm/view";
|
|
11
10
|
import { Decoration as xe, DecorationSet as Se } from "prosemirror-view";
|
|
@@ -14,28 +13,88 @@ import we from "@tiptap/extension-code";
|
|
|
14
13
|
import Te from "@tiptap/extension-italic";
|
|
15
14
|
import Ee from "@tiptap/extension-strike";
|
|
16
15
|
import De from "@tiptap/extension-underline";
|
|
16
|
+
//#region src/schema/blocks/children.ts
|
|
17
|
+
var Oe = "childContainer", ke = "blockGroupChild";
|
|
18
|
+
function y(e) {
|
|
19
|
+
return e.isInGroup("childContainer") && e.isInGroup("bnBlock");
|
|
20
|
+
}
|
|
21
|
+
function Ae(e, t) {
|
|
22
|
+
return e.nodes.blockGroup.createChecked({}, t);
|
|
23
|
+
}
|
|
24
|
+
function je(e) {
|
|
25
|
+
return y(e) && e.spec.blockConfig?.placeable === "namedOnly";
|
|
26
|
+
}
|
|
27
|
+
var Me = {
|
|
28
|
+
min: 30,
|
|
29
|
+
max: 49
|
|
30
|
+
}, Ne = 101;
|
|
31
|
+
function Pe(e) {
|
|
32
|
+
if (e === void 0) return 40;
|
|
33
|
+
let t = Math.round((e - Ne) / 10);
|
|
34
|
+
return Math.min(Me.max, Math.max(Me.min, 40 + t));
|
|
35
|
+
}
|
|
36
|
+
function Fe(e) {
|
|
37
|
+
return e !== void 0 && "min" in e ? e.min ?? 1 : 1;
|
|
38
|
+
}
|
|
39
|
+
function Ie(e, t) {
|
|
40
|
+
if (e.length === 0) return ke;
|
|
41
|
+
let n = ["blockContainer", ...Object.entries(t).filter(([t, { config: n }]) => n.layoutOnly === !0 && n.placeable !== "namedOnly" && !e.includes(t)).map(([e]) => e)];
|
|
42
|
+
return n.length === 1 ? n[0] : `(${n.join(" | ")})`;
|
|
43
|
+
}
|
|
44
|
+
function Le(e = {}, t = ke) {
|
|
45
|
+
let { allow: n = "blocks" } = e, r = Fe(e), i;
|
|
46
|
+
if (n === "blocks") i = t;
|
|
47
|
+
else {
|
|
48
|
+
if (n.length === 0) throw Error("Layout block `allow` permits nothing. A layout block must accept at least one block or layout block type; drop `children` entirely for a block that holds none.");
|
|
49
|
+
i = n.length === 1 ? n[0] : `(${n.join(" | ")})`;
|
|
50
|
+
}
|
|
51
|
+
return i + (r === 0 ? "*" : r === 1 ? "+" : `{${r},}`);
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
17
54
|
//#region src/api/getBlockInfoFromPos.ts
|
|
18
|
-
function
|
|
55
|
+
function Re(e, t) {
|
|
56
|
+
return t === "start" ? e.beforePos + 4 : e.afterPos - 4;
|
|
57
|
+
}
|
|
58
|
+
function ze(e, t) {
|
|
59
|
+
return !e.hasContent || e.contentKind === "none" ? null : e.contentKind === "table" ? Re(e.content, t) : t === "start" ? e.contentStart : e.contentEnd;
|
|
60
|
+
}
|
|
61
|
+
function Be(e, t, n) {
|
|
62
|
+
let r = ze(t, n);
|
|
63
|
+
if (r !== null) return u.create(e, r);
|
|
64
|
+
if (t.hasContent) return s.create(e, t.content.beforePos);
|
|
65
|
+
let { node: i, childrenStart: a, childrenEnd: o } = t.children, c = n === "start" ? i.firstChild : i.lastChild;
|
|
66
|
+
return c ? Be(e, b(c, n === "start" ? a : o - c.nodeSize), n) : s.create(e, t.block.beforePos);
|
|
67
|
+
}
|
|
68
|
+
function Ve(e) {
|
|
19
69
|
return e.marks.some((e) => ["y-attributed-delete"].includes(e.type.name));
|
|
20
70
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (t
|
|
29
|
-
|
|
30
|
-
r
|
|
71
|
+
var He = /* @__PURE__ */ new WeakMap();
|
|
72
|
+
function Ue(e) {
|
|
73
|
+
let t = He.get(e);
|
|
74
|
+
if (t === void 0) {
|
|
75
|
+
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
76
|
+
e.descendants((e) => {
|
|
77
|
+
let t = e.attrs.id;
|
|
78
|
+
if (t) {
|
|
79
|
+
let i = r.get(t) ?? 0;
|
|
80
|
+
Ve(e) && !n.has(e) && n.set(e, `${t}-${i}`), r.set(t, i + 1);
|
|
31
81
|
}
|
|
32
82
|
return !0;
|
|
33
|
-
}),
|
|
34
|
-
|
|
83
|
+
}), t = n, He.set(e, t);
|
|
84
|
+
}
|
|
85
|
+
return t;
|
|
86
|
+
}
|
|
87
|
+
function We(e, t) {
|
|
88
|
+
let n = e.attrs.id;
|
|
89
|
+
if (!n) throw Error(`Node ${e.type.name} does not have an ID`);
|
|
90
|
+
if (Ve(e)) {
|
|
91
|
+
let r = Ue(t).get(e);
|
|
92
|
+
if (r === void 0) throw Error(`Node ${e.type.name} with ID ${n} not found in document`);
|
|
93
|
+
return r;
|
|
35
94
|
}
|
|
36
95
|
return n;
|
|
37
96
|
}
|
|
38
|
-
function
|
|
97
|
+
function Ge(e, t) {
|
|
39
98
|
let n = e.resolve(t);
|
|
40
99
|
if (n.nodeAfter && n.nodeAfter.type.isInGroup("bnBlock")) return {
|
|
41
100
|
posBeforeNode: n.pos,
|
|
@@ -59,77 +118,306 @@ function Ae(e, t) {
|
|
|
59
118
|
node: o.nodeAfter
|
|
60
119
|
};
|
|
61
120
|
}
|
|
62
|
-
function
|
|
63
|
-
if (!e.type.isInGroup("bnBlock")) throw Error(`Attempted to get
|
|
64
|
-
let n =
|
|
65
|
-
node:
|
|
66
|
-
beforePos:
|
|
67
|
-
afterPos:
|
|
121
|
+
function b(e, t) {
|
|
122
|
+
if (!e.type.isInGroup("bnBlock")) throw Error(`Attempted to get block node at position but found node of different type ${e.type.name}`);
|
|
123
|
+
let n = {
|
|
124
|
+
node: e,
|
|
125
|
+
beforePos: t,
|
|
126
|
+
afterPos: t + e.nodeSize
|
|
68
127
|
};
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
128
|
+
if (y(e.type)) return {
|
|
129
|
+
hasContent: !1,
|
|
130
|
+
block: n,
|
|
131
|
+
children: {
|
|
132
|
+
...n,
|
|
133
|
+
childrenStart: n.beforePos + 1,
|
|
134
|
+
childrenEnd: n.afterPos - 1
|
|
135
|
+
},
|
|
136
|
+
blockNoteType: e.type.name
|
|
137
|
+
};
|
|
138
|
+
if (e.type.name === "blockContainer") {
|
|
139
|
+
let r = e.firstChild;
|
|
140
|
+
if (!r || !r.type.isInGroup("blockContent")) throw Error("blockContainer must start with a block content node.");
|
|
141
|
+
let i = {
|
|
142
|
+
node: r,
|
|
143
|
+
beforePos: t + 1,
|
|
144
|
+
afterPos: t + 1 + r.nodeSize
|
|
145
|
+
}, a;
|
|
146
|
+
if (e.childCount > 1) {
|
|
147
|
+
let t = e.child(1);
|
|
148
|
+
if (e.childCount !== 2 || t.type.name !== "blockGroup") throw Error("blockContainer may only have a blockGroup after its content.");
|
|
149
|
+
a = {
|
|
150
|
+
node: t,
|
|
151
|
+
beforePos: i.afterPos,
|
|
152
|
+
afterPos: n.afterPos - 1,
|
|
153
|
+
childrenStart: i.afterPos + 1,
|
|
154
|
+
childrenEnd: n.afterPos - 2
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
let o = i.node.type.spec.blockConfig;
|
|
158
|
+
if (!o) throw Error(`Block content node "${i.node.type.name}" was not built from a block spec, so it has no content kind. Register it with \`createBlockSpec\`/\`createBlockSpecFromTiptapNode\` instead of joining the \`blockContent\` group directly.`);
|
|
88
159
|
return {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
160
|
+
hasContent: !0,
|
|
161
|
+
block: n,
|
|
162
|
+
content: i,
|
|
163
|
+
children: a,
|
|
164
|
+
contentStart: i.beforePos + 1,
|
|
165
|
+
contentEnd: i.afterPos - 1,
|
|
166
|
+
contentKind: o.content,
|
|
167
|
+
isContentEmpty: i.node.childCount === 0,
|
|
168
|
+
blockNoteType: i.node.type.name
|
|
94
169
|
};
|
|
95
170
|
}
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
isBlockContainer: !1,
|
|
99
|
-
bnBlock: i,
|
|
100
|
-
childContainer: i,
|
|
101
|
-
blockNoteType: i.node.type.name
|
|
102
|
-
};
|
|
171
|
+
throw Error(`Node "${e.type.name}" is not a container or blockContainer.`);
|
|
103
172
|
}
|
|
104
|
-
function
|
|
105
|
-
|
|
173
|
+
function x(e, t) {
|
|
174
|
+
let n = e.resolve(t);
|
|
175
|
+
if (!n.nodeAfter) throw Error(`Attempted to get block node at position ${t} but a node at this position does not exist`);
|
|
176
|
+
return b(n.nodeAfter, n.pos);
|
|
106
177
|
}
|
|
107
|
-
function
|
|
108
|
-
|
|
109
|
-
return
|
|
178
|
+
function Ke(e, t) {
|
|
179
|
+
let n = Ge(e.doc, t);
|
|
180
|
+
return b(n.node, n.posBeforeNode);
|
|
181
|
+
}
|
|
182
|
+
function qe(e) {
|
|
183
|
+
return Ke(e, e.selection.anchor);
|
|
184
|
+
}
|
|
185
|
+
function Je(e, t) {
|
|
186
|
+
let n = e.resolve(t), r = n.node();
|
|
187
|
+
if (r.type.isInGroup("bnBlock")) return x(e, n.before(n.depth));
|
|
188
|
+
if (r.type.isInGroup("childContainer") && n.depth > 1) return x(e, n.before(n.depth - 1));
|
|
189
|
+
}
|
|
190
|
+
function Ye(e, t) {
|
|
191
|
+
let n = e.resolve(t), r = n.index();
|
|
192
|
+
if (r !== 0) return x(e, n.posAtIndex(r - 1));
|
|
193
|
+
}
|
|
194
|
+
function Xe(e, t) {
|
|
195
|
+
let n = e.resolve(t), r = n.index();
|
|
196
|
+
if (r !== n.node().childCount - 1) return x(e, n.posAtIndex(r + 1));
|
|
197
|
+
}
|
|
198
|
+
function Ze(e) {
|
|
199
|
+
for (; e.children && e.children.node.childCount;) {
|
|
200
|
+
let t = e.children.node.lastChild;
|
|
201
|
+
e = b(t, e.children.childrenEnd - t.nodeSize);
|
|
202
|
+
}
|
|
203
|
+
return e;
|
|
204
|
+
}
|
|
205
|
+
function Qe(e, t, n, r) {
|
|
206
|
+
if (n === "before" || n === "after") {
|
|
207
|
+
let i = n === "before" ? t.block.beforePos : t.block.afterPos, a = e.resolve(i);
|
|
208
|
+
return a.parent.canReplaceWith(a.index(), a.index(), r) ? { pos: i } : null;
|
|
209
|
+
}
|
|
210
|
+
if (!t.children) {
|
|
211
|
+
let e = r.schema.nodes.blockGroup;
|
|
212
|
+
return t.hasContent && e?.contentMatch.matchType(r) ? {
|
|
213
|
+
pos: t.content.afterPos,
|
|
214
|
+
wrapIn: e
|
|
215
|
+
} : null;
|
|
216
|
+
}
|
|
217
|
+
let i = n === "last-child";
|
|
218
|
+
for (; t.children;) {
|
|
219
|
+
let e = t.children, n = i ? e.node.childCount : 0;
|
|
220
|
+
if (e.node.canReplaceWith(n, n, r)) return { pos: i ? e.childrenEnd : e.childrenStart };
|
|
221
|
+
let a = i ? e.node.lastChild : e.node.firstChild;
|
|
222
|
+
if (!a || !y(a.type)) break;
|
|
223
|
+
t = b(a, i ? e.childrenEnd - a.nodeSize : e.childrenStart);
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
function $e(e) {
|
|
228
|
+
for (; !e.hasContent;) {
|
|
229
|
+
let { node: t, childrenStart: n } = e.children;
|
|
230
|
+
if (!t.firstChild) return null;
|
|
231
|
+
e = b(t.firstChild, n);
|
|
232
|
+
}
|
|
233
|
+
return e;
|
|
234
|
+
}
|
|
235
|
+
function et(e, t, n, r = "before") {
|
|
236
|
+
for (;;) {
|
|
237
|
+
let i = e.resolve(t), a = i.node();
|
|
238
|
+
if (a.canReplaceWith(i.index(), i.index(), n)) return t;
|
|
239
|
+
if (i.depth > 0 && y(a.type)) {
|
|
240
|
+
t = r === "before" ? i.before() : i.after();
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function tt(e, t) {
|
|
247
|
+
let n = e.resolve(t), r = [];
|
|
248
|
+
for (let e = n.depth; e > 0; e--) {
|
|
249
|
+
let t = n.node(e);
|
|
250
|
+
if (!y(t.type)) break;
|
|
251
|
+
t.attrs.id && r.push({
|
|
252
|
+
id: t.attrs.id,
|
|
253
|
+
depth: e
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
return r;
|
|
110
257
|
}
|
|
111
|
-
|
|
112
|
-
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/api/combineTransactionSteps.ts
|
|
260
|
+
function nt(e, t) {
|
|
261
|
+
return t.length === 1 && t[0].before === e ? t[0] : ee(e, [...t]);
|
|
113
262
|
}
|
|
114
|
-
|
|
115
|
-
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/api/getChangedRanges.ts
|
|
265
|
+
function rt(e) {
|
|
266
|
+
let { mapping: t, steps: n } = e, r = t.maps;
|
|
267
|
+
for (let e = 0; e < r.length; e++) if (t.getMirror(e) !== void 0) return re({
|
|
268
|
+
mapping: t,
|
|
269
|
+
steps: n
|
|
270
|
+
});
|
|
271
|
+
let i = new at(r), a = [];
|
|
272
|
+
return r.forEach((e, t) => {
|
|
273
|
+
let r = [];
|
|
274
|
+
if (e.forEach((e, t) => r.push({
|
|
275
|
+
from: e,
|
|
276
|
+
to: t
|
|
277
|
+
})), !r.length) {
|
|
278
|
+
let { from: e, to: i } = n[t];
|
|
279
|
+
if (e === void 0 || i === void 0) return;
|
|
280
|
+
r.push({
|
|
281
|
+
from: e,
|
|
282
|
+
to: i
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
for (let { from: e, to: n } of r) {
|
|
286
|
+
let r = i.mapForward(e, -1, t), o = i.mapForward(n, 1, t);
|
|
287
|
+
a.push({
|
|
288
|
+
oldRange: {
|
|
289
|
+
from: i.mapBackward(r, -1),
|
|
290
|
+
to: i.mapBackward(o, 1)
|
|
291
|
+
},
|
|
292
|
+
newRange: {
|
|
293
|
+
from: r,
|
|
294
|
+
to: o
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}), it(a);
|
|
116
299
|
}
|
|
300
|
+
function it(e) {
|
|
301
|
+
let t = /* @__PURE__ */ new Set(), n = e.filter(({ oldRange: e, newRange: n }) => {
|
|
302
|
+
let r = `${e.from},${e.to},${n.from},${n.to}`;
|
|
303
|
+
return !t.has(r) && (t.add(r), !0);
|
|
304
|
+
});
|
|
305
|
+
if (n.length === 1) return n;
|
|
306
|
+
let r = n.map((e, t) => t).sort((e, t) => n[e].newRange.from - n[t].newRange.from), i = new st(r.map((e) => n[e].newRange.to), "max");
|
|
307
|
+
return n.filter((e, t) => {
|
|
308
|
+
let a = 0, o = r.length - 1;
|
|
309
|
+
for (; a < o;) {
|
|
310
|
+
let t = a + o + 1 >> 1;
|
|
311
|
+
n[r[t]].newRange.from <= e.newRange.from ? a = t : o = t - 1;
|
|
312
|
+
}
|
|
313
|
+
return !i.someBefore(a, (t) => t >= e.newRange.to, (e) => r[e] !== t);
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
var at = class {
|
|
317
|
+
maps;
|
|
318
|
+
inverted;
|
|
319
|
+
firstStarts = [];
|
|
320
|
+
oldEnds = [];
|
|
321
|
+
newEnds = [];
|
|
322
|
+
shift = [0];
|
|
323
|
+
trees;
|
|
324
|
+
constructor(e) {
|
|
325
|
+
this.maps = e, this.inverted = Array(e.length);
|
|
326
|
+
for (let t of e) {
|
|
327
|
+
let e = Infinity, n = -Infinity, r = -Infinity, i = 0;
|
|
328
|
+
t.forEach((t, a, o, s) => {
|
|
329
|
+
e = Math.min(e, t, o), n = Math.max(n, a), r = Math.max(r, s), i += s - o - (a - t);
|
|
330
|
+
}), this.firstStarts.push(e), this.oldEnds.push(n), this.newEnds.push(r), this.shift.push(this.shift[this.shift.length - 1] + i);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
mapForward(e, t, n) {
|
|
334
|
+
let r = 0, i = n;
|
|
335
|
+
for (; i < this.maps.length;) if (e < this.firstStarts[i]) r = Math.max(r, 0) + 1, r > ot ? (i = this.getTrees().firstStart.firstFrom(i, (t) => t <= e), r = 0) : i++;
|
|
336
|
+
else if (e > this.oldEnds[i]) {
|
|
337
|
+
if (r = Math.min(r, 0) - 1, r < -ot) {
|
|
338
|
+
let t = e - this.shift[i], n = this.getTrees().forwardShiftFrom.firstFrom(i, (e) => e >= t);
|
|
339
|
+
e += this.shift[n] - this.shift[i], i = n, r = 0;
|
|
340
|
+
} else e += this.shift[i + 1] - this.shift[i], i++;
|
|
341
|
+
} else e = this.maps[i].map(e, t), r = 0, i++;
|
|
342
|
+
return e;
|
|
343
|
+
}
|
|
344
|
+
mapBackward(e, t) {
|
|
345
|
+
let n = 0, r = this.maps.length - 1;
|
|
346
|
+
for (; r >= 0;) if (e < this.firstStarts[r]) n = Math.max(n, 0) + 1, n > ot ? (r = this.getTrees().firstStart.lastFrom(r, (t) => t <= e), n = 0) : r--;
|
|
347
|
+
else if (e > this.newEnds[r]) {
|
|
348
|
+
if (n = Math.min(n, 0) - 1, n < -ot) {
|
|
349
|
+
let t = e - this.shift[r + 1], i = this.getTrees().backwardShiftFrom.lastFrom(r, (e) => e >= t);
|
|
350
|
+
e -= this.shift[r + 1] - this.shift[i + 1], r = i, n = 0;
|
|
351
|
+
} else e -= this.shift[r + 1] - this.shift[r], r--;
|
|
352
|
+
} else this.inverted[r] ??= this.maps[r].invert(), e = this.inverted[r].map(e, t), n = 0, r--;
|
|
353
|
+
return e;
|
|
354
|
+
}
|
|
355
|
+
getTrees() {
|
|
356
|
+
return this.trees ??= {
|
|
357
|
+
firstStart: new st(this.firstStarts, "min"),
|
|
358
|
+
forwardShiftFrom: new st(this.oldEnds.map((e, t) => e - this.shift[t]), "max"),
|
|
359
|
+
backwardShiftFrom: new st(this.newEnds.map((e, t) => e - this.shift[t + 1]), "max")
|
|
360
|
+
}, this.trees;
|
|
361
|
+
}
|
|
362
|
+
}, ot = 8, st = class {
|
|
363
|
+
values;
|
|
364
|
+
kind;
|
|
365
|
+
size;
|
|
366
|
+
tree;
|
|
367
|
+
constructor(e, t) {
|
|
368
|
+
this.values = e, this.kind = t, this.size = e.length, this.tree = Array(4 * Math.max(1, e.length)), e.length && this.build(1, 0, e.length - 1);
|
|
369
|
+
}
|
|
370
|
+
firstFrom(e, t) {
|
|
371
|
+
let n = this.first(1, 0, this.size - 1, e, t);
|
|
372
|
+
return n === -1 ? this.size : n;
|
|
373
|
+
}
|
|
374
|
+
lastFrom(e, t) {
|
|
375
|
+
return this.last(1, 0, this.size - 1, e, t);
|
|
376
|
+
}
|
|
377
|
+
someBefore(e, t, n) {
|
|
378
|
+
for (let r = this.lastFrom(e, t); r !== -1;) {
|
|
379
|
+
if (n(r)) return !0;
|
|
380
|
+
r = r === 0 ? -1 : this.lastFrom(r - 1, t);
|
|
381
|
+
}
|
|
382
|
+
return !1;
|
|
383
|
+
}
|
|
384
|
+
build(e, t, n) {
|
|
385
|
+
if (t === n) {
|
|
386
|
+
this.tree[e] = this.values[t];
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
let r = t + n >> 1;
|
|
390
|
+
this.build(2 * e, t, r), this.build(2 * e + 1, r + 1, n), this.tree[e] = this.kind === "min" ? Math.min(this.tree[2 * e], this.tree[2 * e + 1]) : Math.max(this.tree[2 * e], this.tree[2 * e + 1]);
|
|
391
|
+
}
|
|
392
|
+
first(e, t, n, r, i) {
|
|
393
|
+
if (n < r || !i(this.tree[e])) return -1;
|
|
394
|
+
if (t === n) return t;
|
|
395
|
+
let a = t + n >> 1, o = this.first(2 * e, t, a, r, i);
|
|
396
|
+
return o === -1 ? this.first(2 * e + 1, a + 1, n, r, i) : o;
|
|
397
|
+
}
|
|
398
|
+
last(e, t, n, r, i) {
|
|
399
|
+
if (t > r || !i(this.tree[e])) return -1;
|
|
400
|
+
if (t === n) return t;
|
|
401
|
+
let a = t + n >> 1, o = this.last(2 * e + 1, a + 1, n, r, i);
|
|
402
|
+
return o === -1 ? this.last(2 * e, t, a, r, i) : o;
|
|
403
|
+
}
|
|
404
|
+
};
|
|
117
405
|
//#endregion
|
|
118
406
|
//#region src/extensions/tiptap-extensions/UniqueID/UniqueID.ts
|
|
119
|
-
function
|
|
407
|
+
function ct(e, t = JSON.stringify) {
|
|
120
408
|
let n = {};
|
|
121
409
|
return e.filter((e) => {
|
|
122
410
|
let r = t(e);
|
|
123
411
|
return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
|
|
124
412
|
});
|
|
125
413
|
}
|
|
126
|
-
function
|
|
127
|
-
return
|
|
414
|
+
function lt(e) {
|
|
415
|
+
return ct(e.filter((t, n) => e.indexOf(t) !== n));
|
|
128
416
|
}
|
|
129
|
-
function
|
|
417
|
+
function ut(e) {
|
|
130
418
|
return e.marks.some((e) => e.type.name === "y-attributed-delete");
|
|
131
419
|
}
|
|
132
|
-
var
|
|
420
|
+
var dt = m.create({
|
|
133
421
|
name: "uniqueID",
|
|
134
422
|
priority: 1e4,
|
|
135
423
|
addOptions() {
|
|
@@ -138,11 +426,12 @@ var Ie = s.create({
|
|
|
138
426
|
setIdAttribute: !1,
|
|
139
427
|
isWithinEditor: void 0,
|
|
140
428
|
generateID: () => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
429
|
+
let e = globalThis.window ?? globalThis;
|
|
430
|
+
if (e.__TEST_OPTIONS) {
|
|
431
|
+
let t = e.__TEST_OPTIONS;
|
|
432
|
+
return t.mockID === void 0 ? t.mockID = 0 : t.mockID++, t.mockID.toString();
|
|
144
433
|
}
|
|
145
|
-
return
|
|
434
|
+
return se();
|
|
146
435
|
}
|
|
147
436
|
};
|
|
148
437
|
},
|
|
@@ -164,15 +453,15 @@ var Ie = s.create({
|
|
|
164
453
|
},
|
|
165
454
|
addProseMirrorPlugins() {
|
|
166
455
|
let { isWithinEditor: e } = this.options, t = null, n = !1;
|
|
167
|
-
return [new
|
|
168
|
-
key: new
|
|
456
|
+
return [new c({
|
|
457
|
+
key: new l("uniqueID"),
|
|
169
458
|
appendTransaction: (e, t, n) => {
|
|
170
|
-
if (!
|
|
171
|
-
let { tr: r } = n, { types: i, generateID: a } = this.options, o =
|
|
172
|
-
if (
|
|
173
|
-
let o =
|
|
459
|
+
if (!e.some((e) => e.docChanged) || t.doc.eq(n.doc)) return;
|
|
460
|
+
let { tr: r } = n, { types: i, generateID: a } = this.options, o = nt(t.doc, e), { mapping: s } = o;
|
|
461
|
+
if (rt(o).forEach(({ newRange: e }) => {
|
|
462
|
+
let o = te(n.doc, e, (e) => i.includes(e.type.name)), c = lt(o.filter(({ node: e }) => !ut(e)).map(({ node: e }) => e.attrs.id).filter((e) => e !== null));
|
|
174
463
|
o.forEach(({ node: e, pos: i }) => {
|
|
175
|
-
if (
|
|
464
|
+
if (ut(e)) return;
|
|
176
465
|
let o = r.doc.nodeAt(i)?.attrs.id;
|
|
177
466
|
if (o === null) {
|
|
178
467
|
let o = t.doc.type.createAndFill().content;
|
|
@@ -192,8 +481,7 @@ var Ie = s.create({
|
|
|
192
481
|
});
|
|
193
482
|
return;
|
|
194
483
|
}
|
|
195
|
-
|
|
196
|
-
l && c.includes(o) && !Oe(e) && r.setNodeMarkup(i, void 0, {
|
|
484
|
+
c.includes(o) && s.invert().mapResult(i).deleted && r.setNodeMarkup(i, void 0, {
|
|
197
485
|
...e.attrs,
|
|
198
486
|
id: a()
|
|
199
487
|
});
|
|
@@ -232,9 +520,9 @@ var Ie = s.create({
|
|
|
232
520
|
id: null
|
|
233
521
|
}, r(e.content), e.marks);
|
|
234
522
|
n.push(i);
|
|
235
|
-
}),
|
|
523
|
+
}), a.from(n);
|
|
236
524
|
};
|
|
237
|
-
return n = !1, new
|
|
525
|
+
return n = !1, new o(r(e.content), e.openStart, e.openEnd);
|
|
238
526
|
}
|
|
239
527
|
}
|
|
240
528
|
})];
|
|
@@ -242,10 +530,10 @@ var Ie = s.create({
|
|
|
242
530
|
});
|
|
243
531
|
//#endregion
|
|
244
532
|
//#region src/schema/inlineContent/types.ts
|
|
245
|
-
function
|
|
533
|
+
function ft(e) {
|
|
246
534
|
return e.type === "link";
|
|
247
535
|
}
|
|
248
|
-
function
|
|
536
|
+
function pt(e) {
|
|
249
537
|
return typeof e != "string" && e.type === "link";
|
|
250
538
|
}
|
|
251
539
|
function S(e) {
|
|
@@ -253,8 +541,8 @@ function S(e) {
|
|
|
253
541
|
}
|
|
254
542
|
//#endregion
|
|
255
543
|
//#region src/util/table.ts
|
|
256
|
-
function
|
|
257
|
-
return
|
|
544
|
+
function mt(e) {
|
|
545
|
+
return ht(e) ? { ...e } : C(e) ? {
|
|
258
546
|
type: "tableCell",
|
|
259
547
|
content: [].concat(e.content),
|
|
260
548
|
props: {
|
|
@@ -276,55 +564,55 @@ function C(e) {
|
|
|
276
564
|
}
|
|
277
565
|
};
|
|
278
566
|
}
|
|
279
|
-
function
|
|
567
|
+
function C(e) {
|
|
280
568
|
return e != null && typeof e != "string" && !Array.isArray(e) && e.type === "tableCell";
|
|
281
569
|
}
|
|
282
|
-
function
|
|
283
|
-
return
|
|
570
|
+
function ht(e) {
|
|
571
|
+
return C(e) && e.props !== void 0 && e.content !== void 0;
|
|
284
572
|
}
|
|
285
|
-
function
|
|
286
|
-
return
|
|
573
|
+
function w(e) {
|
|
574
|
+
return ht(e) ? e.props.colspan ?? 1 : 1;
|
|
287
575
|
}
|
|
288
|
-
function
|
|
289
|
-
return
|
|
576
|
+
function T(e) {
|
|
577
|
+
return ht(e) ? e.props.rowspan ?? 1 : 1;
|
|
290
578
|
}
|
|
291
579
|
//#endregion
|
|
292
580
|
//#region src/util/typescript.ts
|
|
293
|
-
var
|
|
581
|
+
var E = class extends Error {
|
|
294
582
|
constructor(e) {
|
|
295
583
|
super(`Unreachable case: ${e}`);
|
|
296
584
|
}
|
|
297
585
|
};
|
|
298
|
-
function
|
|
586
|
+
function gt(e, t = !0) {
|
|
299
587
|
let { "data-test": n, ...r } = e;
|
|
300
588
|
if (Object.keys(r).length > 0 && t) throw Error("Object must be empty " + JSON.stringify(e));
|
|
301
589
|
}
|
|
302
590
|
//#endregion
|
|
303
591
|
//#region src/util/browser.ts
|
|
304
|
-
var
|
|
305
|
-
function
|
|
306
|
-
return
|
|
592
|
+
var _t = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
593
|
+
function D(e, t = "Ctrl") {
|
|
594
|
+
return _t() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
|
|
307
595
|
}
|
|
308
|
-
function
|
|
596
|
+
function O(...e) {
|
|
309
597
|
return [...new Set(e.filter((e) => e).join(" ").split(" "))].join(" ");
|
|
310
598
|
}
|
|
311
|
-
var
|
|
599
|
+
var vt = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent), yt = () => typeof navigator < "u" && /android/i.test(navigator.userAgent), bt, xt = () => typeof navigator > "u" || typeof window > "u" ? !1 : (bt === void 0 && (bt = navigator.maxTouchPoints > 0 && typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches), bt);
|
|
312
600
|
//#endregion
|
|
313
601
|
//#region src/blocks/defaultBlockHelpers.ts
|
|
314
|
-
function
|
|
602
|
+
function St(e, t, n, r) {
|
|
315
603
|
let i = document.createElement("div");
|
|
316
|
-
i.className =
|
|
604
|
+
i.className = O("bn-block-content", n.class), i.setAttribute("data-content-type", e);
|
|
317
605
|
for (let [e, t] of Object.entries(n)) e !== "class" && i.setAttribute(e, t);
|
|
318
606
|
let a = document.createElement(t);
|
|
319
|
-
a.className =
|
|
607
|
+
a.className = O("bn-inline-content", r.class);
|
|
320
608
|
for (let [e, t] of Object.entries(r)) e !== "class" && a.setAttribute(e, t);
|
|
321
609
|
return i.appendChild(a), {
|
|
322
610
|
dom: i,
|
|
323
611
|
contentDOM: a
|
|
324
612
|
};
|
|
325
613
|
}
|
|
326
|
-
var
|
|
327
|
-
let n =
|
|
614
|
+
var Ct = (e, t) => {
|
|
615
|
+
let n = cr(e, t.pmSchema);
|
|
328
616
|
n.type.name === "blockContainer" && (n = n.firstChild);
|
|
329
617
|
let r = t.pmSchema.nodes[n.type.name].spec.toDOM;
|
|
330
618
|
if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
|
|
@@ -332,7 +620,7 @@ var Ue = (e, t) => {
|
|
|
332
620
|
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.");
|
|
333
621
|
return i;
|
|
334
622
|
};
|
|
335
|
-
function
|
|
623
|
+
function wt(e, t = "<br>") {
|
|
336
624
|
let n = e.querySelectorAll("p");
|
|
337
625
|
if (n.length > 1) {
|
|
338
626
|
let e = n[0];
|
|
@@ -343,45 +631,112 @@ function We(e, t = "<br>") {
|
|
|
343
631
|
}
|
|
344
632
|
}
|
|
345
633
|
//#endregion
|
|
634
|
+
//#region src/pm-nodes/suggestionMarks.ts
|
|
635
|
+
var Tt = "blockLevelSuggestion";
|
|
636
|
+
function k(e) {
|
|
637
|
+
return e && e.options.extensions.some((e) => {
|
|
638
|
+
if (e.type !== "mark") return !1;
|
|
639
|
+
let t = ie(e, "group");
|
|
640
|
+
return typeof t == "string" && t.split(" ").includes("blockLevelSuggestion");
|
|
641
|
+
}) ? Tt : "";
|
|
642
|
+
}
|
|
643
|
+
//#endregion
|
|
346
644
|
//#region src/schema/nodeViewMutations.ts
|
|
347
|
-
function
|
|
645
|
+
function Et(e) {
|
|
348
646
|
return e.type !== "attributes" || !e.attributeName ? !1 : e.attributeName.startsWith("data-darkreader") ? !0 : e.attributeName === "style" ? (e.target.getAttribute("style") ?? "").includes("--darkreader") || (e.oldValue ?? "").includes("--darkreader") : !1;
|
|
349
647
|
}
|
|
350
|
-
function
|
|
648
|
+
function Dt(e) {
|
|
351
649
|
let t = e.ignoreMutation?.bind(e), n = e.contentDOM;
|
|
352
|
-
e.ignoreMutation = (e) =>
|
|
650
|
+
e.ignoreMutation = (e) => Et(e) ? !0 : t ? t(e) : !n && e.type !== "selection";
|
|
651
|
+
}
|
|
652
|
+
//#endregion
|
|
653
|
+
//#region src/util/string.ts
|
|
654
|
+
function Ot(e) {
|
|
655
|
+
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
656
|
+
}
|
|
657
|
+
function kt(e) {
|
|
658
|
+
let t = e.split("/");
|
|
659
|
+
return !t.length || t[t.length - 1] === "" ? e : t[t.length - 1];
|
|
660
|
+
}
|
|
661
|
+
function At(e) {
|
|
662
|
+
let t = [
|
|
663
|
+
"mp4",
|
|
664
|
+
"webm",
|
|
665
|
+
"ogg",
|
|
666
|
+
"mov",
|
|
667
|
+
"mkv",
|
|
668
|
+
"flv",
|
|
669
|
+
"avi",
|
|
670
|
+
"wmv",
|
|
671
|
+
"m4v"
|
|
672
|
+
];
|
|
673
|
+
try {
|
|
674
|
+
let n = new URL(e).pathname.split(".").pop()?.toLowerCase() || "";
|
|
675
|
+
return t.includes(n);
|
|
676
|
+
} catch {
|
|
677
|
+
return !1;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
//#endregion
|
|
681
|
+
//#region src/schema/dataAttributes.ts
|
|
682
|
+
function jt(e, t) {
|
|
683
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])].filter((e) => e in t);
|
|
684
|
+
}
|
|
685
|
+
function A(e, t) {
|
|
686
|
+
let n = {};
|
|
687
|
+
for (let r of jt(e, t)) {
|
|
688
|
+
let i = e[r];
|
|
689
|
+
i !== void 0 && i !== t[r].default && (n[Ot(r)] = String(i));
|
|
690
|
+
}
|
|
691
|
+
return n;
|
|
692
|
+
}
|
|
693
|
+
function Mt(e, t) {
|
|
694
|
+
for (let [n, r] of Object.entries(t)) e.setAttribute(n, r);
|
|
695
|
+
}
|
|
696
|
+
function j(e, t, n) {
|
|
697
|
+
let r = A(t, n);
|
|
698
|
+
for (let i of jt(t, n)) {
|
|
699
|
+
let t = Ot(i);
|
|
700
|
+
t in r ? e.setAttribute(t, r[t]) : e.removeAttribute(t);
|
|
701
|
+
}
|
|
353
702
|
}
|
|
354
703
|
//#endregion
|
|
355
704
|
//#region src/api/pmUtil.ts
|
|
356
|
-
function
|
|
705
|
+
function Nt(e) {
|
|
357
706
|
return "doc" in e ? e.doc.type.schema : e.type.schema;
|
|
358
707
|
}
|
|
359
|
-
function
|
|
708
|
+
function Pt(e) {
|
|
360
709
|
return e.cached.blockNoteEditor;
|
|
361
710
|
}
|
|
362
|
-
function
|
|
363
|
-
return
|
|
711
|
+
function M(e) {
|
|
712
|
+
return Pt(e).schema;
|
|
364
713
|
}
|
|
365
|
-
function
|
|
366
|
-
return
|
|
714
|
+
function Ft(e) {
|
|
715
|
+
return M(e).blockSchema;
|
|
367
716
|
}
|
|
368
|
-
function
|
|
369
|
-
return
|
|
717
|
+
function It(e) {
|
|
718
|
+
return M(e).inlineContentSchema;
|
|
370
719
|
}
|
|
371
|
-
function
|
|
372
|
-
return
|
|
720
|
+
function N(e) {
|
|
721
|
+
return M(e).styleSchema;
|
|
373
722
|
}
|
|
374
|
-
function
|
|
375
|
-
return
|
|
723
|
+
function Lt(e) {
|
|
724
|
+
return Pt(e).blockCache;
|
|
376
725
|
}
|
|
377
|
-
function
|
|
378
|
-
if (
|
|
379
|
-
let n =
|
|
726
|
+
function Rt(e, t) {
|
|
727
|
+
if (Ft(e)[t.name]?.content === "plain") return !0;
|
|
728
|
+
let n = It(e)[t.name];
|
|
380
729
|
return typeof n == "object" && n.content === "plain";
|
|
381
730
|
}
|
|
382
731
|
//#endregion
|
|
383
732
|
//#region src/api/nodeConversions/nodeToBlock.ts
|
|
384
|
-
function
|
|
733
|
+
function zt(e) {
|
|
734
|
+
let t = "";
|
|
735
|
+
return e.forEach((e) => {
|
|
736
|
+
Ve(e) || (t += e.textContent);
|
|
737
|
+
}), t;
|
|
738
|
+
}
|
|
739
|
+
function Bt(e, t, n) {
|
|
385
740
|
let r = {
|
|
386
741
|
type: "tableContent",
|
|
387
742
|
columnWidths: [],
|
|
@@ -396,7 +751,7 @@ function $e(e, t, n) {
|
|
|
396
751
|
t ??= Array(e.attrs.colspan ?? 1).fill(void 0), r.columnWidths.push(...t);
|
|
397
752
|
}), s.cells = e.content.content.map((e, r) => (i[o] || (i[o] = []), i[o][r] = e.type.name === "tableHeader", {
|
|
398
753
|
type: "tableCell",
|
|
399
|
-
content: e.content.content.map((e) =>
|
|
754
|
+
content: e.content.content.map((e) => Vt(e, t, n)).reduce((e, t) => {
|
|
400
755
|
if (!e.length) return t;
|
|
401
756
|
let n = e[e.length - 1], r = t[0];
|
|
402
757
|
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);
|
|
@@ -414,13 +769,13 @@ function $e(e, t, n) {
|
|
|
414
769
|
for (let e = 0; e < i[0]?.length; e++) i?.every((t) => t[e]) && (r.headerCols = (r.headerCols ?? 0) + 1);
|
|
415
770
|
return r;
|
|
416
771
|
}
|
|
417
|
-
function
|
|
772
|
+
function Vt(e, t, n) {
|
|
418
773
|
let r = [], i;
|
|
419
774
|
return e.content.forEach((e) => {
|
|
420
775
|
if (e.type.name === "hardBreak") {
|
|
421
776
|
if (i) {
|
|
422
777
|
if (S(i)) i.text += "\n";
|
|
423
|
-
else if (
|
|
778
|
+
else if (ft(i)) i.content[i.content.length - 1].text += "\n";
|
|
424
779
|
else throw Error("unexpected");
|
|
425
780
|
} else i = {
|
|
426
781
|
type: "text",
|
|
@@ -434,7 +789,7 @@ function et(e, t, n) {
|
|
|
434
789
|
console.warn("unrecognized inline content type", e.type.name);
|
|
435
790
|
return;
|
|
436
791
|
}
|
|
437
|
-
i &&= (r.push(i), void 0), r.push(
|
|
792
|
+
i &&= (r.push(i), void 0), r.push(Ht(e, t, n));
|
|
438
793
|
return;
|
|
439
794
|
}
|
|
440
795
|
let a = {}, o;
|
|
@@ -447,7 +802,7 @@ function et(e, t, n) {
|
|
|
447
802
|
}
|
|
448
803
|
if (e.propSchema === "boolean") a[e.type] = !0;
|
|
449
804
|
else if (e.propSchema === "string") a[e.type] = t.attrs.stringValue;
|
|
450
|
-
else throw new
|
|
805
|
+
else throw new E(e.propSchema);
|
|
451
806
|
}
|
|
452
807
|
i ? S(i) ? o ? (r.push(i), i = {
|
|
453
808
|
type: "link",
|
|
@@ -461,7 +816,7 @@ function et(e, t, n) {
|
|
|
461
816
|
type: "text",
|
|
462
817
|
text: e.textContent,
|
|
463
818
|
styles: a
|
|
464
|
-
}) :
|
|
819
|
+
}) : ft(i) && (o ? i.href === o.attrs.href ? JSON.stringify(i.content[i.content.length - 1].styles) === JSON.stringify(a) ? i.content[i.content.length - 1].text += e.textContent : i.content.push({
|
|
465
820
|
type: "text",
|
|
466
821
|
text: e.textContent,
|
|
467
822
|
styles: a
|
|
@@ -492,7 +847,7 @@ function et(e, t, n) {
|
|
|
492
847
|
};
|
|
493
848
|
}), i && r.push(i), r;
|
|
494
849
|
}
|
|
495
|
-
function
|
|
850
|
+
function Ht(e, t, n) {
|
|
496
851
|
if (e.type.name === "text" || e.type.name === "link") throw Error("unexpected");
|
|
497
852
|
let r = {}, i = t[e.type.name];
|
|
498
853
|
for (let [t, n] of Object.entries(e.attrs)) {
|
|
@@ -500,90 +855,103 @@ function tt(e, t, n) {
|
|
|
500
855
|
t in i.propSchema && (r[t] = n);
|
|
501
856
|
}
|
|
502
857
|
let a;
|
|
503
|
-
return a = i.content === "styled" ?
|
|
858
|
+
return a = i.content === "styled" ? Vt(e, t, n) : i.content === "plain" ? zt(e) : void 0, {
|
|
504
859
|
type: e.type.name,
|
|
505
860
|
props: r,
|
|
506
861
|
content: a
|
|
507
862
|
};
|
|
508
863
|
}
|
|
509
|
-
function
|
|
510
|
-
let n = e.type.schema, r =
|
|
511
|
-
if (!e.type.isInGroup("bnBlock")) throw Error("Node should be a
|
|
864
|
+
function P(e, t) {
|
|
865
|
+
let n = e.type.schema, r = Ft(n), i = It(n), a = N(n), o = Lt(n);
|
|
866
|
+
if (!e.type.isInGroup("bnBlock")) throw Error("Node should be a block, but is instead: " + e.type.name);
|
|
512
867
|
let s = o?.get(e);
|
|
513
868
|
if (s) return s;
|
|
514
|
-
let c =
|
|
869
|
+
let c = b(e, 0), l;
|
|
515
870
|
try {
|
|
516
|
-
l =
|
|
871
|
+
l = We(c.block.node, t);
|
|
517
872
|
} catch {
|
|
518
|
-
l =
|
|
873
|
+
l = dt.options.generateID();
|
|
519
874
|
}
|
|
520
875
|
let u = r[c.blockNoteType];
|
|
521
876
|
if (!u) throw Error("Block is of an unrecognized type: " + c.blockNoteType);
|
|
522
877
|
let d = {};
|
|
523
878
|
for (let [t, n] of Object.entries({
|
|
524
879
|
...e.attrs,
|
|
525
|
-
...c.
|
|
880
|
+
...c.hasContent ? c.content.node.attrs : {}
|
|
526
881
|
})) {
|
|
527
882
|
let e = u.propSchema;
|
|
528
883
|
t in e && (e[t].default !== void 0 || n !== void 0) && (d[t] = n);
|
|
529
884
|
}
|
|
530
|
-
let f =
|
|
531
|
-
c.
|
|
532
|
-
|
|
885
|
+
let f = [];
|
|
886
|
+
c.children?.node.forEach((e) => {
|
|
887
|
+
f.push(P(e, t));
|
|
533
888
|
});
|
|
534
|
-
let
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
889
|
+
let p;
|
|
890
|
+
switch (c.contentKind) {
|
|
891
|
+
case "inline":
|
|
892
|
+
p = Vt(c.content.node, i, a);
|
|
893
|
+
break;
|
|
894
|
+
case "table":
|
|
895
|
+
p = Bt(c.content.node, i, a);
|
|
896
|
+
break;
|
|
897
|
+
case "plain": {
|
|
898
|
+
let e = zt(c.content.node);
|
|
899
|
+
p = e.length > 0 ? [{
|
|
900
|
+
type: "text",
|
|
901
|
+
text: e,
|
|
902
|
+
styles: {}
|
|
903
|
+
}] : [];
|
|
904
|
+
break;
|
|
905
|
+
}
|
|
906
|
+
case "none":
|
|
907
|
+
case void 0:
|
|
908
|
+
p = void 0;
|
|
909
|
+
break;
|
|
910
|
+
default: throw new E(c);
|
|
911
|
+
}
|
|
912
|
+
let m = {
|
|
552
913
|
id: l,
|
|
553
|
-
type:
|
|
914
|
+
type: u.type,
|
|
554
915
|
props: d,
|
|
555
|
-
content:
|
|
556
|
-
children:
|
|
916
|
+
content: p,
|
|
917
|
+
children: f
|
|
557
918
|
};
|
|
558
|
-
return o?.set(e,
|
|
919
|
+
return o?.set(e, m), m;
|
|
559
920
|
}
|
|
560
|
-
function
|
|
921
|
+
function Ut(e) {
|
|
561
922
|
let t = [];
|
|
562
|
-
return e.firstChild && e.firstChild.descendants((n) => (t.push(
|
|
923
|
+
return e.firstChild && e.firstChild.descendants((n) => (t.push(P(n, e)), !1)), t;
|
|
563
924
|
}
|
|
564
|
-
function
|
|
925
|
+
function Wt(e) {
|
|
565
926
|
function t(n, r, i) {
|
|
566
|
-
if (n.type.name !== "blockGroup") throw Error("unexpected");
|
|
927
|
+
if (n.type.name !== "blockGroup" && !y(n.type)) throw Error("unexpected");
|
|
567
928
|
let a = [], o, s;
|
|
568
929
|
return n.forEach((c, l, u) => {
|
|
569
|
-
|
|
570
|
-
if (
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
930
|
+
let d = u === 0, f = u === n.childCount - 1, p = y(c.type);
|
|
931
|
+
if (!p) {
|
|
932
|
+
if (c.type.name !== "blockContainer") throw Error("unexpected");
|
|
933
|
+
if (c.childCount === 0) return;
|
|
934
|
+
if (c.childCount > 2) throw Error("unexpected, blockContainer.childCount: " + c.childCount);
|
|
935
|
+
}
|
|
936
|
+
let m = !p && c.firstChild.type.name === "blockGroup";
|
|
937
|
+
if (m && !d) throw Error("unexpected");
|
|
938
|
+
if (m || p && (d && r > 0 || f && i > 0)) {
|
|
939
|
+
let e = t(p ? c : c.firstChild, d ? Math.max(0, r - 1) : 0, f ? Math.max(0, i - 1) : 0);
|
|
940
|
+
d && (o = e.blockCutAtStart), f && (s = e.blockCutAtEnd), a.push(...e.blocks);
|
|
577
941
|
return;
|
|
578
942
|
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
943
|
+
if (p) {
|
|
944
|
+
a.push(P(c, e.content.firstChild));
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
let h = P(c, e.content.firstChild), g = c.childCount > 1 ? c.child(1) : void 0, _ = [];
|
|
948
|
+
if (g) {
|
|
949
|
+
let e = t(g, 0, f ? Math.max(0, i - 1) : 0);
|
|
950
|
+
_ = e.blocks, f && (s = e.blockCutAtEnd);
|
|
583
951
|
}
|
|
584
|
-
f && !
|
|
585
|
-
...
|
|
586
|
-
children:
|
|
952
|
+
f && !g && i > 1 && (s = h.id), d && r > 1 && (o = h.id), a.push({
|
|
953
|
+
...h,
|
|
954
|
+
children: _
|
|
587
955
|
});
|
|
588
956
|
}), {
|
|
589
957
|
blocks: a,
|
|
@@ -600,43 +968,152 @@ function rt(e) {
|
|
|
600
968
|
return t(e.content.firstChild, Math.max(e.openStart - 1, 0), Math.max(e.openEnd - 1, 0));
|
|
601
969
|
}
|
|
602
970
|
//#endregion
|
|
603
|
-
//#region src/
|
|
604
|
-
function
|
|
605
|
-
|
|
971
|
+
//#region src/schema/blocks/layoutBlockAttributes.ts
|
|
972
|
+
function Gt(e, t, n, r, i) {
|
|
973
|
+
e && (j(e, n, r), e.setAttribute("data-node-type", t), i && e.setAttribute("data-id", i));
|
|
606
974
|
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
975
|
+
//#endregion
|
|
976
|
+
//#region src/schema/blocks/frame.ts
|
|
977
|
+
var Kt = "data-frame-slot";
|
|
978
|
+
function qt(e) {
|
|
979
|
+
e.setAttribute(Kt, "");
|
|
980
|
+
}
|
|
981
|
+
function Jt(e) {
|
|
982
|
+
if (e.hasAttribute("data-frame-slot")) return e;
|
|
983
|
+
for (let t of e.querySelectorAll(`[${Kt}]`)) if (t.closest("[data-node-type]") === e) return t;
|
|
984
|
+
}
|
|
985
|
+
function Yt(e, t, n) {
|
|
986
|
+
Gt(t.dom, e.type, n.props, e.propSchema, n.id), qt(t.slot);
|
|
987
|
+
}
|
|
988
|
+
function Xt(e, t) {
|
|
989
|
+
let n = e.blockImplementations[t.type], r = n.implementation.renderFrame?.call({
|
|
990
|
+
renderType: "dom",
|
|
991
|
+
props: void 0,
|
|
992
|
+
propSchema: n.config.propSchema
|
|
993
|
+
}, t, e);
|
|
994
|
+
if (n.config.layoutOnly === !0) {
|
|
995
|
+
if (!r) throw Error(`Layout block "${t.type}" must draw its frame: \`renderFrame\` returned undefined.`);
|
|
996
|
+
Yt(n.config, r, t);
|
|
628
997
|
}
|
|
998
|
+
return r;
|
|
999
|
+
}
|
|
1000
|
+
function Zt(e) {
|
|
1001
|
+
let { props: t, editor: n, blockNode: r } = e;
|
|
1002
|
+
return n.blockImplementations[r(t.node).type.name].implementation.frameView?.(t) ?? Qt(e);
|
|
1003
|
+
}
|
|
1004
|
+
function Qt(e) {
|
|
1005
|
+
let { props: t, editor: n, blockNode: r, unframed: i } = e, a = n.blockImplementations[r(t.node).type.name].config;
|
|
1006
|
+
function o(e, t) {
|
|
1007
|
+
a.layoutOnly === !0 && Yt(a, e, t);
|
|
1008
|
+
}
|
|
1009
|
+
function s(e) {
|
|
1010
|
+
let i = n.blockImplementations[r(e).type.name], a = i.implementation.renderFrame;
|
|
1011
|
+
if (!a) return;
|
|
1012
|
+
let s = P(e, t.view.state.doc), c = a.call({
|
|
1013
|
+
renderType: "nodeView",
|
|
1014
|
+
props: t,
|
|
1015
|
+
propSchema: i.config.propSchema
|
|
1016
|
+
}, s, n);
|
|
1017
|
+
if (c) return o(c, s), c;
|
|
1018
|
+
}
|
|
1019
|
+
let c = s(t.node), l, u;
|
|
1020
|
+
if (c) l = c.dom, u = c.slot;
|
|
1021
|
+
else if (i) l = i, u = i;
|
|
1022
|
+
else throw Error(`Block "${r(t.node).type.name}" must draw its frame: \`renderFrame\` returned undefined.`);
|
|
1023
|
+
let d = t.node;
|
|
1024
|
+
return {
|
|
1025
|
+
dom: l,
|
|
1026
|
+
slot: u,
|
|
1027
|
+
get node() {
|
|
1028
|
+
return d;
|
|
1029
|
+
},
|
|
1030
|
+
update(e) {
|
|
1031
|
+
let n = r(d), i = r(e);
|
|
1032
|
+
if (!c) {
|
|
1033
|
+
let t = i.sameMarkup(n) ? void 0 : s(e);
|
|
1034
|
+
return t ? (t.destroy?.(), !1) : (d = e, !0);
|
|
1035
|
+
}
|
|
1036
|
+
if (i.type !== n.type) return !1;
|
|
1037
|
+
if (c.update) {
|
|
1038
|
+
let n = P(e, t.view.state.doc);
|
|
1039
|
+
if (c.update(n) === !1) return !1;
|
|
1040
|
+
o(c, n);
|
|
1041
|
+
} else if (!i.sameMarkup(n)) return !1;
|
|
1042
|
+
return d = e, !0;
|
|
1043
|
+
},
|
|
1044
|
+
destroy: () => c?.destroy?.()
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
var $t = /* @__PURE__ */ new Set([
|
|
1048
|
+
"dragenter",
|
|
1049
|
+
"dragover",
|
|
1050
|
+
"dragleave",
|
|
1051
|
+
"drop",
|
|
1052
|
+
"copy",
|
|
1053
|
+
"cut",
|
|
1054
|
+
"paste"
|
|
1055
|
+
]);
|
|
1056
|
+
function en(e, t) {
|
|
1057
|
+
let n = t.target;
|
|
1058
|
+
return n instanceof globalThis.Node && e.dom.contains(n) && !e.slot.contains(n) && !$t.has(t.type);
|
|
1059
|
+
}
|
|
1060
|
+
function tn(e, t) {
|
|
1061
|
+
return t.type === "selection" ? !1 : Et(t) || t.target === e.slot && t.type === "attributes" ? !0 : e.dom.contains(t.target) && !e.slot.contains(t.target);
|
|
1062
|
+
}
|
|
1063
|
+
function nn(e) {
|
|
1064
|
+
return {
|
|
1065
|
+
stopEvent: (t) => en(e, t),
|
|
1066
|
+
ignoreMutation: (t) => tn(e, t),
|
|
1067
|
+
selectNode: e.selectNode?.bind(e),
|
|
1068
|
+
deselectNode: e.deselectNode?.bind(e),
|
|
1069
|
+
destroy: e.destroy?.bind(e)
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
//#endregion
|
|
1073
|
+
//#region src/schema/blocks/keyboard.ts
|
|
1074
|
+
function rn(e, t) {
|
|
1075
|
+
let { isLayoutBlock: n, hardBreakShortcut: r } = t, i = {
|
|
1076
|
+
enter: r === "enter" ? "line-break" : "split",
|
|
1077
|
+
shiftEnter: r === "none" ? "same-as-enter" : "line-break",
|
|
1078
|
+
splitKeepsType: !1,
|
|
1079
|
+
splitKeepsChildren: !1,
|
|
1080
|
+
resetsTo: { type: "paragraph" },
|
|
1081
|
+
emptyEnterResets: !1,
|
|
1082
|
+
emptyChildEnter: n ? "exit-at-end" : "outdent",
|
|
1083
|
+
childrenCanOutdent: !n
|
|
1084
|
+
};
|
|
1085
|
+
if (typeof e == "function") return (t) => an(i, e(t));
|
|
1086
|
+
let a = an(i, e);
|
|
1087
|
+
return () => a;
|
|
1088
|
+
}
|
|
1089
|
+
function an(e, t) {
|
|
1090
|
+
let n = { ...e };
|
|
1091
|
+
for (let [e, r] of Object.entries(t ?? {})) r !== void 0 && Object.assign(n, { [e]: r });
|
|
1092
|
+
return t?.splitKeepsChildren === void 0 && (n.splitKeepsChildren = n.enter === "into-children"), n;
|
|
1093
|
+
}
|
|
1094
|
+
//#endregion
|
|
1095
|
+
//#region src/schema/blocks/meta.ts
|
|
1096
|
+
function on(e, t) {
|
|
1097
|
+
let n = t.layoutOnly === !0;
|
|
1098
|
+
return {
|
|
1099
|
+
...e,
|
|
1100
|
+
selectable: e?.selectable ?? !0,
|
|
1101
|
+
code: n ? !1 : e?.code ?? !1,
|
|
1102
|
+
defining: n ? !0 : e?.defining ?? !0,
|
|
1103
|
+
isolating: n ? !1 : e?.isolating ?? !0,
|
|
1104
|
+
draggable: e?.draggable ?? t.placeable !== "namedOnly"
|
|
1105
|
+
};
|
|
629
1106
|
}
|
|
630
1107
|
//#endregion
|
|
631
1108
|
//#region src/schema/blocks/internal.ts
|
|
632
|
-
function
|
|
1109
|
+
function sn(e) {
|
|
633
1110
|
let t = {};
|
|
634
1111
|
return Object.entries(e).forEach(([e, n]) => {
|
|
635
1112
|
t[e] = {
|
|
636
1113
|
default: n.default,
|
|
637
1114
|
keepOnSplit: !0,
|
|
638
1115
|
parseHTML: (t) => {
|
|
639
|
-
let r = t.getAttribute(
|
|
1116
|
+
let r = t.getAttribute(Ot(e));
|
|
640
1117
|
if (r === null) return null;
|
|
641
1118
|
if (n.default === void 0 && n.type === "boolean" || n.default !== void 0 && typeof n.default == "boolean") return r === "true" || r !== "false" && null;
|
|
642
1119
|
if (n.default === void 0 && n.type === "number" || n.default !== void 0 && typeof n.default == "number") {
|
|
@@ -645,37 +1122,42 @@ function ot(e) {
|
|
|
645
1122
|
}
|
|
646
1123
|
return r;
|
|
647
1124
|
},
|
|
648
|
-
renderHTML: (t) => t[e]
|
|
1125
|
+
renderHTML: (t) => A({ [e]: t[e] }, { [e]: n })
|
|
649
1126
|
};
|
|
650
1127
|
}), t;
|
|
651
1128
|
}
|
|
652
|
-
function
|
|
1129
|
+
function cn(e, t) {
|
|
653
1130
|
let n = e();
|
|
654
1131
|
if (n === void 0) throw Error("Cannot find node position");
|
|
655
1132
|
let r = t.resolve(n).node();
|
|
656
1133
|
if (!r) throw Error("Cannot find block container");
|
|
657
|
-
return
|
|
1134
|
+
return P(r, t);
|
|
658
1135
|
}
|
|
659
|
-
function
|
|
1136
|
+
function ln(e, t, n) {
|
|
660
1137
|
try {
|
|
661
|
-
return
|
|
1138
|
+
return cn(e, n);
|
|
662
1139
|
} catch (e) {
|
|
663
1140
|
let r = n.type.schema.nodes.blockContainer?.createAndFill(null, t);
|
|
664
|
-
if (r) return
|
|
1141
|
+
if (r) return P(r, n);
|
|
665
1142
|
throw e;
|
|
666
1143
|
}
|
|
667
1144
|
}
|
|
668
|
-
|
|
1145
|
+
var un = 11;
|
|
1146
|
+
function dn(e) {
|
|
1147
|
+
return e.nodeType === un;
|
|
1148
|
+
}
|
|
1149
|
+
function fn(e, t) {
|
|
1150
|
+
if (t && !dn(e)) for (let [n, r] of Object.entries(t)) n === "class" ? e.className = O(e.className, r) : e.setAttribute(n, r);
|
|
1151
|
+
}
|
|
1152
|
+
function F(e, t, n, r, i = !1, a) {
|
|
669
1153
|
let o = document.createElement("div");
|
|
670
1154
|
if (a !== void 0) for (let [e, t] of Object.entries(a)) e !== "class" && o.setAttribute(e, t);
|
|
671
|
-
o.className =
|
|
672
|
-
for (let [e, t] of Object.entries(n)) t !== r[e]?.default && o.setAttribute(P(e), t);
|
|
673
|
-
return i && o.setAttribute("data-file-block", ""), o.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = A("bn-inline-content", e.contentDOM.className)), {
|
|
1155
|
+
return o.className = O("bn-block-content", a?.class || ""), o.setAttribute("data-content-type", t), Mt(o, A(n, r)), i && o.setAttribute("data-file-block", ""), o.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = O("bn-inline-content", e.contentDOM.className)), {
|
|
674
1156
|
...e,
|
|
675
1157
|
dom: o
|
|
676
1158
|
};
|
|
677
1159
|
}
|
|
678
|
-
function
|
|
1160
|
+
function pn(e, t, n) {
|
|
679
1161
|
return {
|
|
680
1162
|
config: {
|
|
681
1163
|
type: e.type,
|
|
@@ -684,23 +1166,65 @@ function ut(e, t, n) {
|
|
|
684
1166
|
},
|
|
685
1167
|
implementation: {
|
|
686
1168
|
node: e.node,
|
|
687
|
-
|
|
688
|
-
|
|
1169
|
+
meta: on(void 0, {}),
|
|
1170
|
+
keyboard: rn(void 0, {
|
|
1171
|
+
isLayoutBlock: !1,
|
|
1172
|
+
hardBreakShortcut: void 0
|
|
1173
|
+
}),
|
|
1174
|
+
render: Ct,
|
|
1175
|
+
toExternalHTML: Ct
|
|
689
1176
|
},
|
|
690
1177
|
extensions: n
|
|
691
1178
|
};
|
|
692
1179
|
}
|
|
693
1180
|
//#endregion
|
|
694
1181
|
//#region src/schema/blocks/createSpec.ts
|
|
695
|
-
function
|
|
1182
|
+
function mn(e, t) {
|
|
696
1183
|
e.stopEvent = (e) => (e.type === "mousedown" && setTimeout(() => {
|
|
697
1184
|
t.view.dom.blur();
|
|
698
1185
|
}, 10), !0);
|
|
699
1186
|
}
|
|
700
|
-
function
|
|
701
|
-
let n =
|
|
1187
|
+
function hn(e, t) {
|
|
1188
|
+
let n = e.layoutOnly === !0;
|
|
1189
|
+
if (!(e.content === "table" || n && !t.parseContent)) return (r, i) => {
|
|
1190
|
+
if (t.parseContent) {
|
|
1191
|
+
let e = t.parseContent({
|
|
1192
|
+
el: r,
|
|
1193
|
+
schema: i
|
|
1194
|
+
});
|
|
1195
|
+
if (e !== void 0) return e;
|
|
1196
|
+
}
|
|
1197
|
+
if (n) return d.fromSchema(i).parse(r, {
|
|
1198
|
+
topNode: i.nodes.blockGroup.create(),
|
|
1199
|
+
preserveWhitespace: !0
|
|
1200
|
+
}).content;
|
|
1201
|
+
if (e.content === "none") return p.empty;
|
|
1202
|
+
let a = r.cloneNode(!0);
|
|
1203
|
+
wt(a, e.content === "plain" || t.meta?.code ? "\n" : "<br>");
|
|
1204
|
+
let o = d.fromSchema(i).parse(a, {
|
|
1205
|
+
topNode: i.nodes.paragraph.create(),
|
|
1206
|
+
preserveWhitespace: e.content !== "plain" || "full"
|
|
1207
|
+
});
|
|
1208
|
+
if (e.content === "inline") return o.content;
|
|
1209
|
+
let s = [];
|
|
1210
|
+
return o.content.forEach((e) => {
|
|
1211
|
+
if (e.isText) {
|
|
1212
|
+
s.push(e);
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
let t = e.type === i.linebreakReplacement ? "\n" : e.textContent;
|
|
1216
|
+
t && s.push(i.text(t, e.marks));
|
|
1217
|
+
}), p.fromArray(s);
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
function gn(e, t) {
|
|
1221
|
+
let n = [e.layoutOnly === !0 ? {
|
|
1222
|
+
tag: `[data-node-type=${e.type}]`,
|
|
1223
|
+
contentElement: (e) => Jt(e) ?? e
|
|
1224
|
+
} : {
|
|
702
1225
|
tag: "[data-content-type=" + e.type + "]",
|
|
703
|
-
contentElement: ".bn-inline-content"
|
|
1226
|
+
contentElement: ".bn-inline-content",
|
|
1227
|
+
preserveWhitespace: e.content === "plain" ? "full" : void 0
|
|
704
1228
|
}];
|
|
705
1229
|
return t.parse && n.push({
|
|
706
1230
|
tag: "*",
|
|
@@ -710,127 +1234,155 @@ function ft(e, t) {
|
|
|
710
1234
|
return n !== void 0 && n;
|
|
711
1235
|
},
|
|
712
1236
|
preserveWhitespace: !0,
|
|
713
|
-
getContent: e
|
|
714
|
-
if (t.parseContent) {
|
|
715
|
-
let e = t.parseContent({
|
|
716
|
-
el: n,
|
|
717
|
-
schema: r
|
|
718
|
-
});
|
|
719
|
-
if (e !== void 0) return e;
|
|
720
|
-
}
|
|
721
|
-
if (e.content === "inline" || e.content === "plain") {
|
|
722
|
-
let i = n.cloneNode(!0);
|
|
723
|
-
We(i, e.content === "plain" || t.meta?.code ? "\n" : "<br>");
|
|
724
|
-
let a = ie.fromSchema(r).parse(i, {
|
|
725
|
-
topNode: r.nodes.paragraph.create(),
|
|
726
|
-
preserveWhitespace: !0
|
|
727
|
-
});
|
|
728
|
-
if (e.content === "plain") {
|
|
729
|
-
let e = [];
|
|
730
|
-
return a.content.forEach((t) => {
|
|
731
|
-
if (t.isText) e.push(t);
|
|
732
|
-
else {
|
|
733
|
-
let n = t.type === r.linebreakReplacement ? "\n" : t.textContent;
|
|
734
|
-
n && e.push(r.text(n, t.marks));
|
|
735
|
-
}
|
|
736
|
-
}), oe.fromArray(e);
|
|
737
|
-
}
|
|
738
|
-
return a.content;
|
|
739
|
-
}
|
|
740
|
-
return oe.empty;
|
|
741
|
-
} : void 0
|
|
1237
|
+
getContent: hn(e, t)
|
|
742
1238
|
}), n;
|
|
743
1239
|
}
|
|
744
|
-
function
|
|
745
|
-
|
|
1240
|
+
function _n(e, t) {
|
|
1241
|
+
if (e.layoutOnly !== !0) {
|
|
1242
|
+
if (!t.render) throw Error(`Block "${e.type}" must declare \`render\`.`);
|
|
1243
|
+
return;
|
|
1244
|
+
}
|
|
1245
|
+
if (t.render) throw Error(`Layout block "${e.type}" draws its box in \`renderFrame\`, and has no content for \`render\` to draw.`);
|
|
1246
|
+
if (!t.renderFrame) throw Error(`Layout block "${e.type}" must declare \`renderFrame\`.`);
|
|
1247
|
+
}
|
|
1248
|
+
function vn(e, t) {
|
|
1249
|
+
let n = Zt({
|
|
1250
|
+
props: t,
|
|
1251
|
+
editor: t.extension.options.editor,
|
|
1252
|
+
blockNode: (e) => e
|
|
1253
|
+
}), r = {
|
|
1254
|
+
dom: n.dom,
|
|
1255
|
+
contentDOM: n.slot,
|
|
1256
|
+
update(e, t, r) {
|
|
1257
|
+
return e.attrs.id === n.node.attrs.id && n.update(e, t, r);
|
|
1258
|
+
},
|
|
1259
|
+
...nn(n)
|
|
1260
|
+
};
|
|
1261
|
+
return e.meta.selectable || mn(r, t.editor), r;
|
|
1262
|
+
}
|
|
1263
|
+
function yn(e, t, n) {
|
|
1264
|
+
if (e.layoutOnly === !0) return vn(t, n);
|
|
1265
|
+
let r = ln(n.getPos, n.node, n.view.state.doc), i = t.render.call({
|
|
1266
|
+
blockContentDOMAttributes: n.extension.options.domAttributes?.blockContent || {},
|
|
1267
|
+
props: n,
|
|
1268
|
+
renderType: "nodeView",
|
|
1269
|
+
propSchema: e.propSchema
|
|
1270
|
+
}, r, n.extension.options.editor);
|
|
1271
|
+
return t.meta.selectable || mn(i, n.editor), Dt(i), i;
|
|
1272
|
+
}
|
|
1273
|
+
function bn(e) {
|
|
1274
|
+
let t = e !== void 0 && "exclude" in e ? e.exclude : [];
|
|
1275
|
+
return t === void 0 || t.length === 0 ? Le(e) : function() {
|
|
1276
|
+
return Le(e, Ie(t, this.options.editor.schema.blockSpecs));
|
|
1277
|
+
};
|
|
1278
|
+
}
|
|
1279
|
+
function xn(e, t, r) {
|
|
1280
|
+
let i = e.layoutOnly === !0;
|
|
1281
|
+
return _.create({
|
|
746
1282
|
name: e.type,
|
|
747
|
-
content: e.content === "inline" ? "inline*" : e.content === "plain" ? "text*" : e.content === "none" ? "" : e.content,
|
|
1283
|
+
content: i ? bn(e.children) : e.content === "inline" ? "inline*" : e.content === "plain" ? "text*" : e.content === "none" ? "" : e.content,
|
|
748
1284
|
marks() {
|
|
749
|
-
return e.content === "plain" ?
|
|
1285
|
+
return i ? k(this.editor) : e.content === "plain" ? n(this.editor) : void 0;
|
|
750
1286
|
},
|
|
751
|
-
group:
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
1287
|
+
group: i ? [
|
|
1288
|
+
"bnBlock",
|
|
1289
|
+
Oe,
|
|
1290
|
+
...e.placeable === "namedOnly" ? [] : [ke]
|
|
1291
|
+
].join(" ") : "blockContent",
|
|
1292
|
+
selectable: t.meta.selectable,
|
|
1293
|
+
isolating: t.meta.isolating,
|
|
1294
|
+
code: t.meta.code,
|
|
1295
|
+
defining: t.meta.defining,
|
|
1296
|
+
priority: i ? Pe(r) : r,
|
|
757
1297
|
addAttributes() {
|
|
758
|
-
return
|
|
1298
|
+
return sn(e.propSchema);
|
|
759
1299
|
},
|
|
760
1300
|
parseHTML() {
|
|
761
|
-
return
|
|
1301
|
+
return gn(e, t);
|
|
762
1302
|
},
|
|
763
|
-
renderHTML({ HTMLAttributes:
|
|
1303
|
+
renderHTML({ HTMLAttributes: n }) {
|
|
1304
|
+
if (i) {
|
|
1305
|
+
let t = document.createElement("div");
|
|
1306
|
+
t.setAttribute("data-node-type", e.type);
|
|
1307
|
+
for (let [e, r] of Object.entries(n)) t.setAttribute(e, r);
|
|
1308
|
+
return {
|
|
1309
|
+
dom: t,
|
|
1310
|
+
contentDOM: t
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
764
1313
|
let r = document.createElement("div");
|
|
765
|
-
return
|
|
1314
|
+
return F({
|
|
766
1315
|
dom: r,
|
|
767
1316
|
contentDOM: e.content === "inline" || e.content === "plain" ? r : void 0
|
|
768
|
-
}, e.type, {}, e.propSchema,
|
|
1317
|
+
}, e.type, {}, e.propSchema, t.meta.fileBlockAccept !== void 0, n);
|
|
769
1318
|
},
|
|
770
1319
|
addNodeView() {
|
|
771
|
-
return (
|
|
772
|
-
let r = this.options.editor, i = ct(t.getPos, t.node, t.view.state.doc), a = this.options.domAttributes?.blockContent || {}, o = n.render.call({
|
|
773
|
-
blockContentDOMAttributes: a,
|
|
774
|
-
props: t,
|
|
775
|
-
renderType: "nodeView",
|
|
776
|
-
propSchema: e.propSchema
|
|
777
|
-
}, i, r);
|
|
778
|
-
return n.meta?.selectable === !1 && dt(o, this.editor), Ke(o), o;
|
|
779
|
-
};
|
|
1320
|
+
return (n) => yn(e, t, n);
|
|
780
1321
|
}
|
|
781
1322
|
});
|
|
782
|
-
|
|
1323
|
+
}
|
|
1324
|
+
function Sn(e, t, n, r) {
|
|
1325
|
+
let i = e.layoutOnly === !0, a = {
|
|
1326
|
+
...t,
|
|
1327
|
+
meta: on(t.meta, e)
|
|
1328
|
+
}, o = a.node ?? xn(e, a, r);
|
|
1329
|
+
if (o.name !== e.type) throw Error("Node name does not match block type. This is a bug in BlockNote.");
|
|
1330
|
+
_n(e, a);
|
|
1331
|
+
let s = o.extend({ extendNodeSchema(t) {
|
|
1332
|
+
return t.name === o.name ? { blockConfig: e } : {};
|
|
1333
|
+
} }), { experimental_keyboard: c, render: l, toExternalHTML: u, ...d } = a;
|
|
783
1334
|
return {
|
|
784
1335
|
config: e,
|
|
785
1336
|
implementation: {
|
|
786
|
-
...
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
1337
|
+
...d,
|
|
1338
|
+
keyboard: rn(c, {
|
|
1339
|
+
isLayoutBlock: i,
|
|
1340
|
+
hardBreakShortcut: a.meta.hardBreakShortcut
|
|
1341
|
+
}),
|
|
1342
|
+
node: s,
|
|
1343
|
+
...l && { render(t, n) {
|
|
1344
|
+
let r = s.options.domAttributes?.blockContent || {};
|
|
1345
|
+
return l.call({
|
|
1346
|
+
blockContentDOMAttributes: r,
|
|
792
1347
|
props: void 0,
|
|
793
1348
|
renderType: "dom",
|
|
794
1349
|
propSchema: e.propSchema
|
|
795
|
-
}, t,
|
|
796
|
-
},
|
|
797
|
-
toExternalHTML: (t,
|
|
798
|
-
let
|
|
799
|
-
|
|
800
|
-
blockContentDOMAttributes: o,
|
|
801
|
-
propSchema: e.propSchema
|
|
802
|
-
}, t, r, i) ?? n.render.call({
|
|
803
|
-
blockContentDOMAttributes: o,
|
|
804
|
-
renderType: "dom",
|
|
805
|
-
props: void 0,
|
|
1350
|
+
}, t, n);
|
|
1351
|
+
} },
|
|
1352
|
+
...u && { toExternalHTML: (t, n, r) => {
|
|
1353
|
+
let a = s.options.domAttributes?.blockContent || {}, o = u.call({
|
|
1354
|
+
blockContentDOMAttributes: a,
|
|
806
1355
|
propSchema: e.propSchema
|
|
807
|
-
}, t, r);
|
|
808
|
-
|
|
1356
|
+
}, t, n, r);
|
|
1357
|
+
return o && i && !dn(o.dom) && j(o.dom, t.props, e.propSchema), o;
|
|
1358
|
+
} }
|
|
809
1359
|
},
|
|
810
|
-
extensions:
|
|
1360
|
+
extensions: n
|
|
811
1361
|
};
|
|
812
1362
|
}
|
|
813
|
-
function
|
|
1363
|
+
function I(e) {
|
|
814
1364
|
return e;
|
|
815
1365
|
}
|
|
816
|
-
function
|
|
1366
|
+
function L(e, t, n) {
|
|
817
1367
|
return (r = {}) => {
|
|
818
|
-
let i = typeof e == "function" ? e(r) : e, a = typeof t == "function" ? t(r) : t, o = n ? typeof n == "function" ? n(r) : n : void 0;
|
|
1368
|
+
let i = typeof e == "function" ? e(r) : e, a = typeof t == "function" ? t(r) : t, o = n ? typeof n == "function" ? n(r) : n : void 0, s = i.layoutOnly === !0;
|
|
1369
|
+
_n(i, a);
|
|
1370
|
+
let c = a.render, l = a.toExternalHTML;
|
|
819
1371
|
return {
|
|
820
1372
|
config: i,
|
|
821
1373
|
implementation: {
|
|
822
1374
|
...a,
|
|
823
|
-
toExternalHTML(e, t, n) {
|
|
824
|
-
let r =
|
|
825
|
-
if (r !== void 0) return
|
|
826
|
-
},
|
|
827
|
-
render(e, t) {
|
|
828
|
-
return
|
|
1375
|
+
...l && { toExternalHTML(e, t, n) {
|
|
1376
|
+
let r = l.call({ blockContentDOMAttributes: this.blockContentDOMAttributes }, e, t, n);
|
|
1377
|
+
if (r !== void 0) return s ? (fn(r.dom, this.blockContentDOMAttributes), r) : F(r, e.type, e.props, this.propSchema ?? i.propSchema, a.meta?.fileBlockAccept !== void 0);
|
|
1378
|
+
} },
|
|
1379
|
+
...c && { render(e, t) {
|
|
1380
|
+
return F(c.call({
|
|
829
1381
|
blockContentDOMAttributes: this.blockContentDOMAttributes,
|
|
830
1382
|
renderType: this.renderType,
|
|
831
1383
|
props: this.props
|
|
832
1384
|
}, e, t), e.type, e.props, this.propSchema ?? i.propSchema, a.meta?.fileBlockAccept !== void 0, this.blockContentDOMAttributes);
|
|
833
|
-
}
|
|
1385
|
+
} }
|
|
834
1386
|
},
|
|
835
1387
|
extensions: o
|
|
836
1388
|
};
|
|
@@ -838,24 +1390,24 @@ function I(e, t, n) {
|
|
|
838
1390
|
}
|
|
839
1391
|
//#endregion
|
|
840
1392
|
//#region src/schema/inlineContent/internal.ts
|
|
841
|
-
function
|
|
842
|
-
return e.dom.setAttribute("data-inline-content-type", t),
|
|
1393
|
+
function Cn(e, t, n, r) {
|
|
1394
|
+
return e.dom.setAttribute("data-inline-content-type", t), Mt(e.dom, A(n, r)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
843
1395
|
}
|
|
844
|
-
function
|
|
1396
|
+
function wn(e) {
|
|
845
1397
|
return { Backspace: ({ editor: t }) => {
|
|
846
1398
|
let n = t.state.selection.$from;
|
|
847
1399
|
return t.state.selection.empty && n.node().type.name === e.type && n.parentOffset === 0;
|
|
848
1400
|
} };
|
|
849
1401
|
}
|
|
850
|
-
function
|
|
1402
|
+
function Tn(e, t, n) {
|
|
851
1403
|
return {
|
|
852
1404
|
config: e,
|
|
853
1405
|
implementation: t,
|
|
854
1406
|
extensions: n
|
|
855
1407
|
};
|
|
856
1408
|
}
|
|
857
|
-
function
|
|
858
|
-
return
|
|
1409
|
+
function En(e, t, n) {
|
|
1410
|
+
return Tn({
|
|
859
1411
|
type: e.name,
|
|
860
1412
|
propSchema: t,
|
|
861
1413
|
content: e.config.content === "inline*" ? "styled" : e.config.content === "text*" ? "plain" : "none"
|
|
@@ -864,12 +1416,12 @@ function _t(e, t, n) {
|
|
|
864
1416
|
node: e
|
|
865
1417
|
});
|
|
866
1418
|
}
|
|
867
|
-
function
|
|
1419
|
+
function Dn(e) {
|
|
868
1420
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
|
|
869
1421
|
}
|
|
870
1422
|
//#endregion
|
|
871
1423
|
//#region src/schema/styles/internal.ts
|
|
872
|
-
function
|
|
1424
|
+
function On(e) {
|
|
873
1425
|
return e === "boolean" ? {} : { stringValue: {
|
|
874
1426
|
default: void 0,
|
|
875
1427
|
keepOnSplit: !0,
|
|
@@ -877,17 +1429,17 @@ function yt(e) {
|
|
|
877
1429
|
renderHTML: (e) => e.stringValue === void 0 ? {} : { "data-value": e.stringValue }
|
|
878
1430
|
} };
|
|
879
1431
|
}
|
|
880
|
-
function
|
|
1432
|
+
function R(e, t, n, r) {
|
|
881
1433
|
return e.dom.setAttribute("data-style-type", t), r === "string" && e.dom.setAttribute("data-value", n), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
882
1434
|
}
|
|
883
|
-
function
|
|
1435
|
+
function kn(e, t) {
|
|
884
1436
|
return {
|
|
885
1437
|
config: e,
|
|
886
1438
|
implementation: t
|
|
887
1439
|
};
|
|
888
1440
|
}
|
|
889
|
-
function
|
|
890
|
-
return
|
|
1441
|
+
function z(e, t) {
|
|
1442
|
+
return kn({
|
|
891
1443
|
type: e.name,
|
|
892
1444
|
propSchema: t
|
|
893
1445
|
}, {
|
|
@@ -895,25 +1447,25 @@ function R(e, t) {
|
|
|
895
1447
|
render(t, n) {
|
|
896
1448
|
let r = n.pmSchema.marks[e.name].spec.toDOM;
|
|
897
1449
|
if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
|
|
898
|
-
let i = n.pmSchema.mark(e.name, { stringValue: t }), a =
|
|
1450
|
+
let i = n.pmSchema.mark(e.name, { stringValue: t }), a = f.renderSpec(document, r(i, !0));
|
|
899
1451
|
if (typeof a != "object" || !("dom" in a)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");
|
|
900
1452
|
return a;
|
|
901
1453
|
},
|
|
902
1454
|
toExternalHTML(t, n) {
|
|
903
1455
|
let r = n.pmSchema.marks[e.name].spec.toDOM;
|
|
904
1456
|
if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
|
|
905
|
-
let i = n.pmSchema.mark(e.name, { stringValue: t }), a =
|
|
1457
|
+
let i = n.pmSchema.mark(e.name, { stringValue: t }), a = f.renderSpec(document, r(i, !0));
|
|
906
1458
|
if (typeof a != "object" || !("dom" in a)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");
|
|
907
1459
|
return a;
|
|
908
1460
|
}
|
|
909
1461
|
});
|
|
910
1462
|
}
|
|
911
|
-
function
|
|
1463
|
+
function An(e) {
|
|
912
1464
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
|
|
913
1465
|
}
|
|
914
1466
|
//#endregion
|
|
915
1467
|
//#region src/schema/styles/createSpec.ts
|
|
916
|
-
function
|
|
1468
|
+
function jn(e, t) {
|
|
917
1469
|
let n = [{
|
|
918
1470
|
tag: `[data-style-type="${e.type}"]`,
|
|
919
1471
|
contentElement: (e) => {
|
|
@@ -931,33 +1483,33 @@ function St(e, t) {
|
|
|
931
1483
|
}
|
|
932
1484
|
}), n;
|
|
933
1485
|
}
|
|
934
|
-
function
|
|
935
|
-
let n =
|
|
1486
|
+
function Mn(e, t) {
|
|
1487
|
+
let n = g.create({
|
|
936
1488
|
name: e.type,
|
|
937
1489
|
addAttributes() {
|
|
938
|
-
return
|
|
1490
|
+
return On(e.propSchema);
|
|
939
1491
|
},
|
|
940
1492
|
parseHTML() {
|
|
941
|
-
return
|
|
1493
|
+
return jn(e, t.parse);
|
|
942
1494
|
},
|
|
943
1495
|
renderHTML({ mark: n }) {
|
|
944
|
-
return
|
|
1496
|
+
return R((t.toExternalHTML || t.render)(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
|
|
945
1497
|
},
|
|
946
1498
|
addMarkView() {
|
|
947
|
-
return ({ mark: n }) =>
|
|
1499
|
+
return ({ mark: n }) => R(t.render(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
|
|
948
1500
|
}
|
|
949
1501
|
});
|
|
950
|
-
return
|
|
1502
|
+
return kn(e, {
|
|
951
1503
|
...t,
|
|
952
1504
|
mark: n,
|
|
953
|
-
render: (n) =>
|
|
954
|
-
toExternalHTML: (n) =>
|
|
1505
|
+
render: (n) => R(t.render(n), e.type, n, e.propSchema),
|
|
1506
|
+
toExternalHTML: (n) => R((t.toExternalHTML || t.render)(n), e.type, n, e.propSchema)
|
|
955
1507
|
});
|
|
956
1508
|
}
|
|
957
1509
|
//#endregion
|
|
958
1510
|
//#region src/util/topo-sort.ts
|
|
959
|
-
function
|
|
960
|
-
let t =
|
|
1511
|
+
function Nn(e) {
|
|
1512
|
+
let t = Fn(e), { roots: n, nonRoots: r } = In(t), i = [];
|
|
961
1513
|
for (; n.size;) {
|
|
962
1514
|
i.push(n);
|
|
963
1515
|
let r = /* @__PURE__ */ new Set();
|
|
@@ -972,13 +1524,13 @@ function wt(e) {
|
|
|
972
1524
|
}
|
|
973
1525
|
n = r;
|
|
974
1526
|
}
|
|
975
|
-
if (r =
|
|
1527
|
+
if (r = In(t).nonRoots, r.size) throw Error(`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(r).join(", ")}`);
|
|
976
1528
|
return i;
|
|
977
1529
|
}
|
|
978
|
-
function
|
|
979
|
-
return
|
|
1530
|
+
function Pn(e) {
|
|
1531
|
+
return Nn(Ln(e));
|
|
980
1532
|
}
|
|
981
|
-
function
|
|
1533
|
+
function Fn(e) {
|
|
982
1534
|
let t = /* @__PURE__ */ new Map();
|
|
983
1535
|
for (let [n, r] of e.entries()) {
|
|
984
1536
|
t.has(n) || t.set(n, 0);
|
|
@@ -989,7 +1541,7 @@ function Et(e) {
|
|
|
989
1541
|
}
|
|
990
1542
|
return t;
|
|
991
1543
|
}
|
|
992
|
-
function
|
|
1544
|
+
function In(e) {
|
|
993
1545
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
994
1546
|
for (let [r, i] of e.entries()) i === 0 ? t.add(r) : n.add(r);
|
|
995
1547
|
return {
|
|
@@ -997,7 +1549,7 @@ function Dt(e) {
|
|
|
997
1549
|
nonRoots: n
|
|
998
1550
|
};
|
|
999
1551
|
}
|
|
1000
|
-
function
|
|
1552
|
+
function Ln(e) {
|
|
1001
1553
|
let t = /* @__PURE__ */ new Map();
|
|
1002
1554
|
for (let [n, r] of e.entries()) {
|
|
1003
1555
|
t.has(n) || t.set(n, /* @__PURE__ */ new Set());
|
|
@@ -1005,26 +1557,52 @@ function Ot(e) {
|
|
|
1005
1557
|
}
|
|
1006
1558
|
return t;
|
|
1007
1559
|
}
|
|
1008
|
-
function
|
|
1560
|
+
function Rn() {
|
|
1009
1561
|
return /* @__PURE__ */ new Map();
|
|
1010
1562
|
}
|
|
1011
|
-
function
|
|
1563
|
+
function zn(e, t, n) {
|
|
1012
1564
|
return e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n), e;
|
|
1013
1565
|
}
|
|
1014
|
-
function
|
|
1015
|
-
let t =
|
|
1566
|
+
function Bn(e) {
|
|
1567
|
+
let t = Rn();
|
|
1016
1568
|
for (let n of e) Array.isArray(n.runsBefore) && n.runsBefore.length > 0 ? n.runsBefore.forEach((e) => {
|
|
1017
|
-
|
|
1018
|
-
}) :
|
|
1019
|
-
let n =
|
|
1569
|
+
zn(t, n.key, e);
|
|
1570
|
+
}) : zn(t, "default", n.key);
|
|
1571
|
+
let n = Pn(t), r = n.findIndex((e) => e.has("default"));
|
|
1020
1572
|
return (e) => 91 + (n.findIndex((t) => t.has(e)) + r) * 10;
|
|
1021
1573
|
}
|
|
1022
1574
|
//#endregion
|
|
1575
|
+
//#region src/schema/blocks/validateChildren.ts
|
|
1576
|
+
function Vn(e) {
|
|
1577
|
+
for (let [t, { config: n }] of Object.entries(e)) {
|
|
1578
|
+
if (n.layoutOnly === !0 && n.content !== "none" && B(t, "`layoutOnly: true` is only for blocks without content (`content: \"none\"`). A layout block holds only child blocks, no content of its own."), n.placeable === "namedOnly" && n.layoutOnly !== !0 && B(t, "`placeable: \"namedOnly\"` is only for layout blocks (`layoutOnly: true`). Only a layout block can be limited to the blocks that name it in `children.allow`."), !n.children) continue;
|
|
1579
|
+
let { allow: r = "blocks", min: i, exclude: a, dissolve: o } = n.children;
|
|
1580
|
+
if (n.layoutOnly !== !0) {
|
|
1581
|
+
(r !== "blocks" || i !== void 0 || a !== void 0 || o !== void 0) && B(t, "restricting child types, a minimum count or `dissolve` requires `layoutOnly: true`. Other blocks can always have any child blocks (`{ allow: \"blocks\" }`).");
|
|
1582
|
+
continue;
|
|
1583
|
+
}
|
|
1584
|
+
if (r === "blocks" && (i !== void 0 || o !== void 0) && B(t, `\`children.${i === void 0 ? "dissolve" : "min"}\` needs an \`allow\` list. A layout block that accepts any blocks always holds at least one child, and dissolves when its last child is removed.`), i !== void 0 && !(Number.isInteger(i) && i >= 0) && B(t, `\`children.min\` must be a whole number that is 0 or more, not ${String(i)}.`), a !== void 0) {
|
|
1585
|
+
r !== "blocks" && B(t, "`children.exclude` is only for a layout block that accepts any blocks. An `allow` list already names exactly what the layout block holds.");
|
|
1586
|
+
for (let n of a) {
|
|
1587
|
+
Object.prototype.hasOwnProperty.call(e, n) || B(t, `\`exclude\` contains "${n}", which is not a configured block type.`);
|
|
1588
|
+
let { config: r } = e[n];
|
|
1589
|
+
r.layoutOnly !== !0 && B(t, `\`exclude\` contains "${n}", which is not a layout block. Only layout blocks (\`layoutOnly: true\`) can be excluded.`), r.placeable === "namedOnly" && B(t, `\`exclude\` contains "${n}", which is \`placeable: "namedOnly"\` and never a child of a layout block that accepts any blocks.`);
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
if (r !== "blocks") for (let n of r) Object.prototype.hasOwnProperty.call(e, n) || B(t, `\`allow\` contains "${n}", which is not a configured block type.`), e[n].config.layoutOnly !== !0 && B(t, `\`allow\` contains "${n}", which is not a layout block. An \`allow\` list can name only layout blocks (\`layoutOnly: true\`); naming other blocks is not supported yet. Use \`allow: "blocks"\` to accept all other blocks.`);
|
|
1593
|
+
}
|
|
1594
|
+
let t = new Set(Object.values(e).flatMap(({ config: e }) => e.children?.allow && e.children.allow !== "blocks" ? e.children.allow : []));
|
|
1595
|
+
for (let [n, { config: r }] of Object.entries(e)) r.placeable === "namedOnly" && !t.has(n) && B(n, "`placeable: \"namedOnly\"` limits this block to the blocks that name it in `children.allow`, but no block names it. Name it in the `allow` list of a layout block.");
|
|
1596
|
+
}
|
|
1597
|
+
function B(e, t) {
|
|
1598
|
+
throw Error(`Invalid config for block "${e}": ${t}`);
|
|
1599
|
+
}
|
|
1600
|
+
//#endregion
|
|
1023
1601
|
//#region src/schema/schema.ts
|
|
1024
|
-
function
|
|
1602
|
+
function Hn(e) {
|
|
1025
1603
|
return e && Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
|
|
1026
1604
|
}
|
|
1027
|
-
var
|
|
1605
|
+
var Un = class {
|
|
1028
1606
|
opts;
|
|
1029
1607
|
BlockNoteEditor = "only for types";
|
|
1030
1608
|
Block = "only for types";
|
|
@@ -1041,14 +1619,16 @@ var Nt = class {
|
|
|
1041
1619
|
this.blockSpecs = t, this.styleSpecs = r, this.styleSchema = o, this.inlineContentSpecs = n, this.blockSchema = i, this.inlineContentSchema = a;
|
|
1042
1620
|
}
|
|
1043
1621
|
init() {
|
|
1044
|
-
let e =
|
|
1622
|
+
let e = Bn(Object.entries({
|
|
1045
1623
|
...this.opts.blockSpecs,
|
|
1046
1624
|
...this.opts.inlineContentSpecs,
|
|
1047
1625
|
...this.opts.styleSpecs
|
|
1048
1626
|
}).map(([e, t]) => ({
|
|
1049
1627
|
key: e,
|
|
1050
1628
|
runsBefore: t.implementation?.runsBefore ?? []
|
|
1051
|
-
})))
|
|
1629
|
+
})));
|
|
1630
|
+
Vn(this.opts.blockSpecs);
|
|
1631
|
+
let t = Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([t, n]) => [t, Sn(n.config, n.implementation, n.extensions, e(t))])), n = Object.fromEntries(Object.entries(this.opts.inlineContentSpecs).map(([t, n]) => typeof n.config == "object" ? [t, {
|
|
1052
1632
|
...n,
|
|
1053
1633
|
implementation: {
|
|
1054
1634
|
...n.implementation,
|
|
@@ -1064,10 +1644,10 @@ var Nt = class {
|
|
|
1064
1644
|
return {
|
|
1065
1645
|
blockSpecs: t,
|
|
1066
1646
|
blockSchema: Object.fromEntries(Object.entries(t).map(([e, t]) => [e, t.config])),
|
|
1067
|
-
inlineContentSpecs:
|
|
1068
|
-
styleSpecs:
|
|
1069
|
-
inlineContentSchema:
|
|
1070
|
-
styleSchema:
|
|
1647
|
+
inlineContentSpecs: Hn(n),
|
|
1648
|
+
styleSpecs: Hn(r),
|
|
1649
|
+
inlineContentSchema: Dn(n),
|
|
1650
|
+
styleSchema: An(r)
|
|
1071
1651
|
};
|
|
1072
1652
|
}
|
|
1073
1653
|
extend(e) {
|
|
@@ -1091,8 +1671,8 @@ var Nt = class {
|
|
|
1091
1671
|
};
|
|
1092
1672
|
//#endregion
|
|
1093
1673
|
//#region src/api/blockManipulation/tables/tables.ts
|
|
1094
|
-
function
|
|
1095
|
-
let { height: t, width: n } =
|
|
1674
|
+
function V(e) {
|
|
1675
|
+
let { height: t, width: n } = Wn(e), r = Array(t).fill(!1).map(() => Array(n).fill(null)), i = (e, i) => {
|
|
1096
1676
|
for (let a = e; a < t; a++) for (let e = i; e < n; e++) if (!r[a][e]) return {
|
|
1097
1677
|
row: a,
|
|
1098
1678
|
col: e
|
|
@@ -1100,7 +1680,7 @@ function z(e) {
|
|
|
1100
1680
|
throw Error("Unable to create occupancy grid for table, no more available cells");
|
|
1101
1681
|
};
|
|
1102
1682
|
for (let t = 0; t < e.content.rows.length; t++) for (let n = 0; n < e.content.rows[t].cells.length; n++) {
|
|
1103
|
-
let a =
|
|
1683
|
+
let a = mt(e.content.rows[t].cells[n]), o = T(a), s = w(a), { row: c, col: l } = i(t, n);
|
|
1104
1684
|
for (let e = c; e < c + o; e++) for (let i = l; i < l + s; i++) {
|
|
1105
1685
|
if (r[e][i]) throw Error(`Unable to create occupancy grid for table, cell at ${e},${i} is already occupied`);
|
|
1106
1686
|
r[e][i] = {
|
|
@@ -1114,11 +1694,11 @@ function z(e) {
|
|
|
1114
1694
|
}
|
|
1115
1695
|
return r;
|
|
1116
1696
|
}
|
|
1117
|
-
function
|
|
1697
|
+
function H(e) {
|
|
1118
1698
|
let t = /* @__PURE__ */ new Set();
|
|
1119
1699
|
return e.map((e) => ({ cells: e.map((e) => !t.has(e.row + ":" + e.col) && (t.add(e.row + ":" + e.col), e.cell)).filter((e) => e !== !1) }));
|
|
1120
1700
|
}
|
|
1121
|
-
function
|
|
1701
|
+
function U(e, t, n = V(t)) {
|
|
1122
1702
|
for (let t = 0; t < n.length; t++) for (let r = 0; r < n[t].length; r++) {
|
|
1123
1703
|
let i = n[t][r];
|
|
1124
1704
|
if (i && i.row === e.row && i.col === e.col) return {
|
|
@@ -1129,19 +1709,19 @@ function V(e, t, n = z(t)) {
|
|
|
1129
1709
|
}
|
|
1130
1710
|
throw Error(`Unable to resolve relative table cell indices for table, cell at ${e.row},${e.col} is not occupied`);
|
|
1131
1711
|
}
|
|
1132
|
-
function
|
|
1712
|
+
function Wn(e) {
|
|
1133
1713
|
let t = e.content.rows.length, n = 0;
|
|
1134
1714
|
return e.content.rows.forEach((e) => {
|
|
1135
1715
|
let t = 0;
|
|
1136
1716
|
e.cells.forEach((e) => {
|
|
1137
|
-
t +=
|
|
1717
|
+
t += w(e);
|
|
1138
1718
|
}), n = Math.max(n, t);
|
|
1139
1719
|
}), {
|
|
1140
1720
|
height: t,
|
|
1141
1721
|
width: n
|
|
1142
1722
|
};
|
|
1143
1723
|
}
|
|
1144
|
-
function
|
|
1724
|
+
function Gn(e, t, n = V(t)) {
|
|
1145
1725
|
let r = n[e.row]?.[e.col];
|
|
1146
1726
|
if (r) return {
|
|
1147
1727
|
row: r.row,
|
|
@@ -1149,8 +1729,8 @@ function Ft(e, t, n = z(t)) {
|
|
|
1149
1729
|
cell: r.cell
|
|
1150
1730
|
};
|
|
1151
1731
|
}
|
|
1152
|
-
function
|
|
1153
|
-
let n =
|
|
1732
|
+
function Kn(e, t) {
|
|
1733
|
+
let n = V(e);
|
|
1154
1734
|
if (t < 0 || t >= n.length) return [];
|
|
1155
1735
|
let r = 0;
|
|
1156
1736
|
for (let e = 0; e < t; e++) {
|
|
@@ -1158,14 +1738,14 @@ function It(e, t) {
|
|
|
1158
1738
|
if (!e) return [];
|
|
1159
1739
|
r += e.rowspan;
|
|
1160
1740
|
}
|
|
1161
|
-
let i = Array(n[0].length).fill(!1).map((t, i) =>
|
|
1741
|
+
let i = Array(n[0].length).fill(!1).map((t, i) => Gn({
|
|
1162
1742
|
row: r,
|
|
1163
1743
|
col: i
|
|
1164
1744
|
}, e, n)).filter((e) => e !== void 0);
|
|
1165
1745
|
return i.filter((e, t) => i.findIndex((t) => t.row === e.row && t.col === e.col) === t);
|
|
1166
1746
|
}
|
|
1167
|
-
function
|
|
1168
|
-
let n =
|
|
1747
|
+
function qn(e, t) {
|
|
1748
|
+
let n = V(e);
|
|
1169
1749
|
if (t < 0 || t >= n[0].length) return [];
|
|
1170
1750
|
let r = 0;
|
|
1171
1751
|
for (let e = 0; e < t; e++) {
|
|
@@ -1173,62 +1753,62 @@ function Lt(e, t) {
|
|
|
1173
1753
|
if (!e) return [];
|
|
1174
1754
|
r += e.colspan;
|
|
1175
1755
|
}
|
|
1176
|
-
let i = Array(n.length).fill(!1).map((t, i) =>
|
|
1756
|
+
let i = Array(n.length).fill(!1).map((t, i) => Gn({
|
|
1177
1757
|
row: i,
|
|
1178
1758
|
col: r
|
|
1179
1759
|
}, e, n)).filter((e) => e !== void 0);
|
|
1180
1760
|
return i.filter((e, t) => i.findIndex((t) => t.row === e.row && t.col === e.col) === t);
|
|
1181
1761
|
}
|
|
1182
|
-
function
|
|
1183
|
-
let { col: i } =
|
|
1762
|
+
function Jn(e, t, n, r = V(e)) {
|
|
1763
|
+
let { col: i } = U({
|
|
1184
1764
|
row: 0,
|
|
1185
1765
|
col: t
|
|
1186
|
-
}, e, r), { col: a } =
|
|
1766
|
+
}, e, r), { col: a } = U({
|
|
1187
1767
|
row: 0,
|
|
1188
1768
|
col: n
|
|
1189
1769
|
}, e, r);
|
|
1190
1770
|
return r.forEach((e) => {
|
|
1191
1771
|
let [t] = e.splice(i, 1);
|
|
1192
1772
|
e.splice(a, 0, t);
|
|
1193
|
-
}),
|
|
1773
|
+
}), H(r);
|
|
1194
1774
|
}
|
|
1195
|
-
function
|
|
1196
|
-
let { row: i } =
|
|
1775
|
+
function Yn(e, t, n, r = V(e)) {
|
|
1776
|
+
let { row: i } = U({
|
|
1197
1777
|
row: t,
|
|
1198
1778
|
col: 0
|
|
1199
|
-
}, e, r), { row: a } =
|
|
1779
|
+
}, e, r), { row: a } = U({
|
|
1200
1780
|
row: n,
|
|
1201
1781
|
col: 0
|
|
1202
1782
|
}, e, r), [o] = r.splice(i, 1);
|
|
1203
|
-
return r.splice(a, 0, o),
|
|
1783
|
+
return r.splice(a, 0, o), H(r);
|
|
1204
1784
|
}
|
|
1205
|
-
function
|
|
1206
|
-
return e ?
|
|
1785
|
+
function Xn(e) {
|
|
1786
|
+
return e ? C(e) ? Xn(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 : pt(e) ? typeof e.content == "string" ? e.content.length === 0 : e.content.every((e) => e.text.length === 0) : !1) : !1 : !0;
|
|
1207
1787
|
}
|
|
1208
|
-
function
|
|
1788
|
+
function Zn(e, t, n = V(e)) {
|
|
1209
1789
|
if (t === "columns") {
|
|
1210
1790
|
let e = 0;
|
|
1211
|
-
for (let t = n[0].length - 1; t >= 0 && n.every((e) =>
|
|
1791
|
+
for (let t = n[0].length - 1; t >= 0 && n.every((e) => Xn(e[t].cell) && e[t].colspan === 1); t--) e++;
|
|
1212
1792
|
for (let t = n.length - 1; t >= 0; t--) {
|
|
1213
1793
|
let r = Math.max(n[t].length - e, 1);
|
|
1214
1794
|
n[t] = n[t].slice(0, r);
|
|
1215
1795
|
}
|
|
1216
|
-
return
|
|
1796
|
+
return H(n);
|
|
1217
1797
|
}
|
|
1218
1798
|
let r = 0;
|
|
1219
|
-
for (let e = n.length - 1; e >= 0 && n[e].every((e) =>
|
|
1799
|
+
for (let e = n.length - 1; e >= 0 && n[e].every((e) => Xn(e.cell) && e.rowspan === 1); e--) r++;
|
|
1220
1800
|
let i = Math.min(r, n.length - 1);
|
|
1221
|
-
return n.splice(n.length - i, i),
|
|
1801
|
+
return n.splice(n.length - i, i), H(n);
|
|
1222
1802
|
}
|
|
1223
|
-
function
|
|
1224
|
-
let { width: i, height: a } =
|
|
1803
|
+
function Qn(e, t, n, r = V(e)) {
|
|
1804
|
+
let { width: i, height: a } = Wn(e);
|
|
1225
1805
|
if (t === "columns") r.forEach((e, t) => {
|
|
1226
1806
|
if (n >= 0) for (let r = 0; r < n; r++) e.push({
|
|
1227
1807
|
row: t,
|
|
1228
1808
|
col: Math.max(...e.map((e) => e.col)) + 1,
|
|
1229
1809
|
rowspan: 1,
|
|
1230
1810
|
colspan: 1,
|
|
1231
|
-
cell:
|
|
1811
|
+
cell: mt("")
|
|
1232
1812
|
});
|
|
1233
1813
|
else e.splice(i + n, -1 * n);
|
|
1234
1814
|
});
|
|
@@ -1238,78 +1818,78 @@ function Ht(e, t, n, r = z(e)) {
|
|
|
1238
1818
|
col: n,
|
|
1239
1819
|
rowspan: 1,
|
|
1240
1820
|
colspan: 1,
|
|
1241
|
-
cell:
|
|
1821
|
+
cell: mt("")
|
|
1242
1822
|
}));
|
|
1243
1823
|
r.push(t);
|
|
1244
1824
|
}
|
|
1245
1825
|
else n < 0 && r.splice(a + n, -1 * n);
|
|
1246
|
-
return
|
|
1826
|
+
return H(r);
|
|
1247
1827
|
}
|
|
1248
|
-
function
|
|
1249
|
-
let r =
|
|
1250
|
-
if (!r.some((e) =>
|
|
1828
|
+
function $n(e, t, n) {
|
|
1829
|
+
let r = Kn(e, n);
|
|
1830
|
+
if (!r.some((e) => T(e.cell) > 1)) return !0;
|
|
1251
1831
|
let i = n, a = n;
|
|
1252
1832
|
return r.forEach((e) => {
|
|
1253
|
-
let t =
|
|
1833
|
+
let t = T(e.cell);
|
|
1254
1834
|
i = Math.max(i, e.row + t - 1), a = Math.min(a, e.row);
|
|
1255
1835
|
}), t < n ? n === i : n === a;
|
|
1256
1836
|
}
|
|
1257
|
-
function
|
|
1258
|
-
let r =
|
|
1259
|
-
if (!r.some((e) =>
|
|
1837
|
+
function er(e, t, n) {
|
|
1838
|
+
let r = qn(e, n);
|
|
1839
|
+
if (!r.some((e) => w(e.cell) > 1)) return !0;
|
|
1260
1840
|
let i = n, a = n;
|
|
1261
1841
|
return r.forEach((e) => {
|
|
1262
|
-
let t =
|
|
1842
|
+
let t = w(e.cell);
|
|
1263
1843
|
i = Math.max(i, e.col + t - 1), a = Math.min(a, e.col);
|
|
1264
1844
|
}), t < n ? n === i : n === a;
|
|
1265
1845
|
}
|
|
1266
|
-
function
|
|
1267
|
-
let r =
|
|
1846
|
+
function tr(e, t, n) {
|
|
1847
|
+
let r = U(e, n), i = U(t, n);
|
|
1268
1848
|
return r.col === i.col;
|
|
1269
1849
|
}
|
|
1270
1850
|
//#endregion
|
|
1271
1851
|
//#region src/api/nodeConversions/blockToNode.ts
|
|
1272
|
-
function
|
|
1852
|
+
function nr(e, t, n, r) {
|
|
1273
1853
|
let i = [];
|
|
1274
1854
|
for (let [r, a] of Object.entries(e.styles || {})) {
|
|
1275
1855
|
let e = n[r];
|
|
1276
1856
|
if (!e) throw Error(`style ${r} not found in styleSchema`);
|
|
1277
1857
|
if (e.propSchema === "boolean") a && i.push(t.mark(r));
|
|
1278
1858
|
else if (e.propSchema === "string") a && i.push(t.mark(r, { stringValue: a }));
|
|
1279
|
-
else throw new
|
|
1859
|
+
else throw new E(e.propSchema);
|
|
1280
1860
|
}
|
|
1281
|
-
let a = r && t.nodes[r] &&
|
|
1282
|
-
return
|
|
1861
|
+
let a = r && t.nodes[r] && Rt(t, t.nodes[r]) ? [...t.nodes[r].allowedMarks(i)] : i;
|
|
1862
|
+
return r && Rt(t, t.nodes[r]) ? e.text.length > 0 ? [t.text(e.text, a)] : [] : e.text.split(/(\n)/g).filter((e) => e.length > 0).map((e) => e === "\n" ? t.nodes.hardBreak.createChecked() : t.text(e, a));
|
|
1283
1863
|
}
|
|
1284
|
-
function
|
|
1864
|
+
function rr(e, t, n) {
|
|
1285
1865
|
let r = t.marks.link.create({ href: e.href });
|
|
1286
|
-
return
|
|
1866
|
+
return ir(e.content, t, n).map((e) => {
|
|
1287
1867
|
if (e.type.name === "text") return e.mark([...e.marks, r]);
|
|
1288
1868
|
if (e.type.name === "hardBreak") return e;
|
|
1289
1869
|
throw Error("unexpected node type");
|
|
1290
1870
|
});
|
|
1291
1871
|
}
|
|
1292
|
-
function
|
|
1872
|
+
function ir(e, t, n, r) {
|
|
1293
1873
|
let i = [];
|
|
1294
|
-
if (typeof e == "string") return i.push(...
|
|
1874
|
+
if (typeof e == "string") return i.push(...nr({
|
|
1295
1875
|
type: "text",
|
|
1296
1876
|
text: e,
|
|
1297
1877
|
styles: {}
|
|
1298
1878
|
}, t, n, r)), i;
|
|
1299
|
-
for (let a of e) i.push(...
|
|
1879
|
+
for (let a of e) i.push(...nr(a, t, n, r));
|
|
1300
1880
|
return i;
|
|
1301
1881
|
}
|
|
1302
|
-
function
|
|
1882
|
+
function W(e, t, n, r = N(t)) {
|
|
1303
1883
|
let i = [];
|
|
1304
|
-
for (let a of e) typeof a == "string" ? i.push(...
|
|
1884
|
+
for (let a of e) typeof a == "string" ? i.push(...ir(a, t, r, n)) : pt(a) ? i.push(...rr(a, t, r)) : S(a) ? i.push(...ir([a], t, r, n)) : i.push(or(a, t, r));
|
|
1305
1885
|
return i;
|
|
1306
1886
|
}
|
|
1307
|
-
function
|
|
1887
|
+
function ar(e, t, n = N(t)) {
|
|
1308
1888
|
let r = [], i = Array(e.headerRows ?? 0).fill(!0), a = Array(e.headerCols ?? 0).fill(!0), o = e.columnWidths ?? [];
|
|
1309
1889
|
for (let s = 0; s < e.rows.length; s++) {
|
|
1310
1890
|
let c = e.rows[s], l = [], u = i[s];
|
|
1311
1891
|
for (let r = 0; r < c.cells.length; r++) {
|
|
1312
|
-
let i = c.cells[r], d = a[r], f = null, p =
|
|
1892
|
+
let i = c.cells[r], d = a[r], f = null, p = U({
|
|
1313
1893
|
row: s,
|
|
1314
1894
|
col: r
|
|
1315
1895
|
}, {
|
|
@@ -1318,14 +1898,14 @@ function Yt(e, t, n = M(t)) {
|
|
|
1318
1898
|
}), m = o[p.col] ? [o[p.col]] : null;
|
|
1319
1899
|
if (i) {
|
|
1320
1900
|
if (typeof i == "string") f = t.text(i);
|
|
1321
|
-
else if (
|
|
1322
|
-
i.content && (f =
|
|
1323
|
-
let e =
|
|
1901
|
+
else if (C(i)) {
|
|
1902
|
+
i.content && (f = W(i.content, t, "tableParagraph", n));
|
|
1903
|
+
let e = w(i);
|
|
1324
1904
|
e > 1 && (m = Array(e).fill(!1).map((e, t) => o[p.col + t] ?? void 0));
|
|
1325
|
-
} else f =
|
|
1905
|
+
} else f = W(i, t, "tableParagraph", n);
|
|
1326
1906
|
}
|
|
1327
1907
|
let h = t.nodes[d || u ? "tableHeader" : "tableCell"].createChecked({
|
|
1328
|
-
...
|
|
1908
|
+
...C(i) ? i.props : {},
|
|
1329
1909
|
colwidth: m
|
|
1330
1910
|
}, t.nodes.tableParagraph.createChecked(void 0, f));
|
|
1331
1911
|
l.push(h);
|
|
@@ -1335,203 +1915,57 @@ function Yt(e, t, n = M(t)) {
|
|
|
1335
1915
|
}
|
|
1336
1916
|
return r;
|
|
1337
1917
|
}
|
|
1338
|
-
function
|
|
1918
|
+
function or(e, t, n) {
|
|
1339
1919
|
let r, i = e.type;
|
|
1340
1920
|
if (i === void 0 && (i = "paragraph"), !t.nodes[i]) throw Error(`node type ${i} not found in schema`);
|
|
1341
1921
|
if (!e.content) r = t.nodes[i].createChecked(e.props);
|
|
1342
1922
|
else if (typeof e.content == "string") {
|
|
1343
|
-
let a =
|
|
1923
|
+
let a = W([e.content], t, i, n);
|
|
1344
1924
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1345
1925
|
} else if (Array.isArray(e.content)) {
|
|
1346
|
-
let a =
|
|
1926
|
+
let a = W(e.content, t, i, n);
|
|
1347
1927
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1348
1928
|
} else if (e.content.type === "tableContent") {
|
|
1349
|
-
let a =
|
|
1929
|
+
let a = ar(e.content, t, n);
|
|
1350
1930
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1351
|
-
} else throw new
|
|
1931
|
+
} else throw new E(e.content.type);
|
|
1352
1932
|
return r;
|
|
1353
1933
|
}
|
|
1354
|
-
function
|
|
1934
|
+
function sr(e) {
|
|
1935
|
+
if (e.isText) return e;
|
|
1936
|
+
let t = [];
|
|
1937
|
+
e.forEach((e) => t.push(sr(e)));
|
|
1938
|
+
let n = e.type.isInGroup("bnBlock") && e.attrs.id === null;
|
|
1939
|
+
return e.type.create(n ? {
|
|
1940
|
+
...e.attrs,
|
|
1941
|
+
id: dt.options.generateID()
|
|
1942
|
+
} : e.attrs, p.from(t), e.marks);
|
|
1943
|
+
}
|
|
1944
|
+
function cr(e, t, n = N(t)) {
|
|
1355
1945
|
let r = e.id;
|
|
1356
|
-
r === void 0 && (r =
|
|
1946
|
+
r === void 0 && (r = dt.options.generateID());
|
|
1357
1947
|
let i = [];
|
|
1358
|
-
if (e.children) for (let r of e.children) i.push(
|
|
1948
|
+
if (e.children) for (let r of e.children) i.push(cr(r, t, n));
|
|
1359
1949
|
if (!e.type || t.nodes[e.type].isInGroup("blockContent")) {
|
|
1360
|
-
let a =
|
|
1950
|
+
let a = or(e, t, n), o = i.length > 0 ? Ae(t, i) : void 0;
|
|
1361
1951
|
return t.nodes.blockContainer.createChecked({
|
|
1362
1952
|
id: r,
|
|
1363
1953
|
...e.props
|
|
1364
1954
|
}, o ? [a, o] : a);
|
|
1365
1955
|
}
|
|
1366
|
-
if (t.nodes[e.type]
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
//#region src/api/nodeUtil.ts
|
|
1374
|
-
function Zt(e, t) {
|
|
1375
|
-
let n, r;
|
|
1376
|
-
if (t.firstChild.descendants((i, a) => n ? !1 : !Qt(i) || !i.attrs.id || ke(i, t) !== e || (n = i, r = a + 1, !1)), n !== void 0 && r !== void 0) return {
|
|
1377
|
-
node: n,
|
|
1378
|
-
posBeforeNode: r
|
|
1379
|
-
};
|
|
1380
|
-
}
|
|
1381
|
-
function Qt(e) {
|
|
1382
|
-
return e.type.isInGroup("bnBlock");
|
|
1383
|
-
}
|
|
1384
|
-
//#endregion
|
|
1385
|
-
//#region src/api/blockManipulation/commands/updateBlock/updateBlock.ts
|
|
1386
|
-
var $t = (e, t) => ({ tr: n, dispatch: r }) => (r && en(n, e, t), !0);
|
|
1387
|
-
function en(e, t, n, r, i) {
|
|
1388
|
-
let a = je(e.doc.resolve(t)), o = null;
|
|
1389
|
-
a.blockNoteType === "table" && (o = cn(e));
|
|
1390
|
-
let s = j(e);
|
|
1391
|
-
if (r !== void 0 && i !== void 0 && r > i) throw Error("Invalid replaceFromPos or replaceToPos");
|
|
1392
|
-
let c = s.nodes[a.blockNoteType], l = s.nodes[n.type || a.blockNoteType], u = l.isInGroup("bnBlock") ? l : s.nodes.blockContainer;
|
|
1393
|
-
if (a.isBlockContainer && l.isInGroup("blockContent")) {
|
|
1394
|
-
let t = r !== void 0 && r > a.blockContent.beforePos && r < a.blockContent.afterPos ? r - a.blockContent.beforePos - 1 : void 0, o = i !== void 0 && i > a.blockContent.beforePos && i < a.blockContent.afterPos ? i - a.blockContent.beforePos - 1 : void 0;
|
|
1395
|
-
on(n, e, a), tn(n, e, c, l, a, t, o);
|
|
1396
|
-
} else if (!a.isBlockContainer && l.isInGroup("bnBlock")) on(n, e, a);
|
|
1397
|
-
else {
|
|
1398
|
-
let t = U({
|
|
1399
|
-
children: N(a.bnBlock.node, e.doc).children,
|
|
1400
|
-
...n
|
|
1401
|
-
}, s);
|
|
1402
|
-
t.check(), e.replaceWith(a.bnBlock.beforePos, a.bnBlock.afterPos, t);
|
|
1403
|
-
return;
|
|
1404
|
-
}
|
|
1405
|
-
rn(e, a.bnBlock.beforePos, u, { ...n.props }), o && ln(e, a, o);
|
|
1406
|
-
}
|
|
1407
|
-
function tn(e, t, n, r, o, s, c) {
|
|
1408
|
-
let l = j(t), u = "keep";
|
|
1409
|
-
if (e.content) {
|
|
1410
|
-
if (typeof e.content == "string") u = H([e.content], l, r.name);
|
|
1411
|
-
else if (Array.isArray(e.content)) u = H(e.content, l, r.name);
|
|
1412
|
-
else if (e.content.type === "tableContent") u = Yt(e.content, l);
|
|
1413
|
-
else throw new O(e.content.type);
|
|
1414
|
-
} else {
|
|
1415
|
-
let e = o.blockContent.node.content;
|
|
1416
|
-
if (n.spec.content !== "" && r.spec.content !== n.spec.content && !r.validContent(e)) {
|
|
1417
|
-
if (r.inlineContent && n.inlineContent) {
|
|
1418
|
-
let e = o.blockContent.node.textContent;
|
|
1419
|
-
u = e.length > 0 ? [l.text(e)] : [];
|
|
1420
|
-
} else u = [];
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
if (u === "keep") rn(t, o.blockContent.beforePos, r, { ...e.props });
|
|
1424
|
-
else if (s !== void 0 || c !== void 0) {
|
|
1425
|
-
let n = an(t, o.blockContent.beforePos, r, { ...e.props }), l = n + 1 + (s ?? 0), d = n + 1 + (c ?? o.blockContent.node.content.size), f = t.doc.resolve(n).depth, p = t.doc.resolve(l).depth, m = t.doc.resolve(d).depth;
|
|
1426
|
-
t.replace(l, d, new a(i.from(u), p - f - 1, m - f - 1));
|
|
1427
|
-
} else r === n || r.validContent(o.blockContent.node.content) ? nn(t, an(t, o.blockContent.beforePos, r, { ...e.props }), i.from(u)) : t.replaceWith(o.blockContent.beforePos, o.blockContent.afterPos, r.createChecked({
|
|
1428
|
-
...o.blockContent.node.attrs,
|
|
1429
|
-
...e.props
|
|
1430
|
-
}, u));
|
|
1431
|
-
}
|
|
1432
|
-
function nn(e, t, n) {
|
|
1433
|
-
let r = e.doc.nodeAt(t);
|
|
1434
|
-
if (!r) throw RangeError("No node at given position");
|
|
1435
|
-
let s = r.content, c = t + 1;
|
|
1436
|
-
if (r.isTextblock) {
|
|
1437
|
-
let t = s.findDiffStart(n);
|
|
1438
|
-
if (t === null) return;
|
|
1439
|
-
let { a: r, b: i } = s.findDiffEnd(n), o = Math.max(0, t - r, t - i);
|
|
1440
|
-
o > 0 && (r += o, i += o), e.replace(c + t, c + r, new a(n.cut(t, i), 0, 0));
|
|
1441
|
-
return;
|
|
1442
|
-
}
|
|
1443
|
-
let l = s.childCount, u = n.childCount, d = 0;
|
|
1444
|
-
for (; d < l && d < u && s.child(d).eq(n.child(d));) d++;
|
|
1445
|
-
let f = l, p = u;
|
|
1446
|
-
for (; f > d && p > d && s.child(f - 1).eq(n.child(p - 1));) f--, p--;
|
|
1447
|
-
if (d === f && d === p) return;
|
|
1448
|
-
let m = c;
|
|
1449
|
-
for (let e = 0; e < d; e++) m += s.child(e).nodeSize;
|
|
1450
|
-
let h = m;
|
|
1451
|
-
for (let e = d; e < f; e++) h += s.child(e).nodeSize;
|
|
1452
|
-
let g = [];
|
|
1453
|
-
for (let e = d; e < p; e++) g.push(n.child(e));
|
|
1454
|
-
e.step(new o(m, h, new a(i.from(g), 0, 0)));
|
|
1455
|
-
}
|
|
1456
|
-
function rn(e, t, n, r) {
|
|
1457
|
-
let i = e.doc.nodeAt(t);
|
|
1458
|
-
if (!i) throw RangeError("No node at given position");
|
|
1459
|
-
let a = n.spec.attrs ?? {}, o = {};
|
|
1460
|
-
for (let e of Object.keys(r)) e in a && (o[e] = r[e]);
|
|
1461
|
-
let s = {
|
|
1462
|
-
...i.attrs,
|
|
1463
|
-
...o
|
|
1464
|
-
};
|
|
1465
|
-
if (i.type === n) {
|
|
1466
|
-
for (let n of Object.keys(s)) s[n] !== i.attrs[n] && e.setNodeAttribute(t, n, s[n]);
|
|
1467
|
-
return;
|
|
1468
|
-
}
|
|
1469
|
-
e.setNodeMarkup(t, n, s);
|
|
1470
|
-
}
|
|
1471
|
-
function an(e, t, n, r) {
|
|
1472
|
-
let i = e.mapping.maps.length;
|
|
1473
|
-
return rn(e, t, n, r), e.mapping.slice(i).map(t, -1);
|
|
1474
|
-
}
|
|
1475
|
-
function on(e, t, n) {
|
|
1476
|
-
let r = j(t);
|
|
1477
|
-
if (e.children !== void 0 && e.children.length > 0) {
|
|
1478
|
-
let a = e.children.map((e) => {
|
|
1479
|
-
let t = U(e, r);
|
|
1480
|
-
return t.check(), t;
|
|
1481
|
-
});
|
|
1482
|
-
if (n.childContainer) nn(t, n.childContainer.beforePos, i.from(a));
|
|
1483
|
-
else {
|
|
1484
|
-
if (!n.isBlockContainer) throw Error("impossible");
|
|
1485
|
-
t.insert(n.blockContent.afterPos, r.nodes.blockGroup.createChecked({}, a));
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
function sn(e, t, n, r, i) {
|
|
1490
|
-
let a = typeof t == "string" ? t : t.id, o = Zt(a, e.doc);
|
|
1491
|
-
if (!o) throw Error(`Block with ID ${a} not found`);
|
|
1492
|
-
return en(e, o.posBeforeNode, n, r, i), N(e.doc.resolve(o.posBeforeNode + 1).node(), e.doc);
|
|
1493
|
-
}
|
|
1494
|
-
function cn(e) {
|
|
1495
|
-
let t = "selection" in e ? e.selection : null;
|
|
1496
|
-
if (!(t instanceof re)) return null;
|
|
1497
|
-
let n = e.doc.resolve(t.head), r = -1, i = -1;
|
|
1498
|
-
for (let e = n.depth; e >= 0; e--) {
|
|
1499
|
-
let t = n.node(e).type.name;
|
|
1500
|
-
if (r < 0 && (t === "tableCell" || t === "tableHeader") && (r = e), t === "table") {
|
|
1501
|
-
i = e;
|
|
1502
|
-
break;
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
if (r < 0 || i < 0) return null;
|
|
1506
|
-
let a = n.before(r), o = n.before(i), s = e.doc.nodeAt(o);
|
|
1507
|
-
if (!s || s.type.name !== "table") return null;
|
|
1508
|
-
let c = ce.get(s), l = a - (o + 1), u = c.map.indexOf(l);
|
|
1509
|
-
if (u < 0) return null;
|
|
1510
|
-
let d = Math.floor(u / c.width), f = u % c.width, p = a + 1 + 1;
|
|
1511
|
-
return {
|
|
1512
|
-
row: d,
|
|
1513
|
-
col: f,
|
|
1514
|
-
offset: Math.max(0, t.head - p)
|
|
1515
|
-
};
|
|
1516
|
-
}
|
|
1517
|
-
function ln(e, t, n) {
|
|
1518
|
-
if (t.blockNoteType !== "table") return !1;
|
|
1519
|
-
let r = -1;
|
|
1520
|
-
if (t.isBlockContainer) r = e.mapping.map(t.blockContent.beforePos);
|
|
1521
|
-
else {
|
|
1522
|
-
let n = e.mapping.map(t.bnBlock.beforePos), i = n + (e.doc.nodeAt(n)?.nodeSize || 0);
|
|
1523
|
-
e.doc.nodesBetween(n, i, (e, t) => e.type.name !== "table" || (r = t, !1));
|
|
1956
|
+
if (y(t.nodes[e.type])) {
|
|
1957
|
+
let n = t.nodes[e.type], a = {
|
|
1958
|
+
id: r,
|
|
1959
|
+
...e.props
|
|
1960
|
+
}, o = n.createAndFill(a, i);
|
|
1961
|
+
if (!o) throw Error(`Cannot create block "${e.type}": its children don't fit its \`children\` config (it accepts \`${n.spec.content}\`).`);
|
|
1962
|
+
return sr(o);
|
|
1524
1963
|
}
|
|
1525
|
-
|
|
1526
|
-
if (!i || i.type.name !== "table") return !1;
|
|
1527
|
-
let a = ce.get(i), o = Math.max(0, Math.min(n.row, a.height - 1)), s = Math.max(0, Math.min(n.col, a.width - 1)), c = o * a.width + s, l = a.map[c];
|
|
1528
|
-
if (l == null) return !1;
|
|
1529
|
-
let u = r + 1 + l + 1, d = e.doc.nodeAt(u), f = u + 1, p = d ? d.content.size : 0, m = f + Math.max(0, Math.min(n.offset, p));
|
|
1530
|
-
return "selection" in e && e.setSelection(re.create(e.doc, m)), !0;
|
|
1964
|
+
throw Error(`block type ${e.type} doesn't match blockContent or bnBlock group`);
|
|
1531
1965
|
}
|
|
1532
1966
|
//#endregion
|
|
1533
1967
|
//#region src/editor/defaultColors.ts
|
|
1534
|
-
var
|
|
1968
|
+
var G = {
|
|
1535
1969
|
gray: {
|
|
1536
1970
|
text: "#9b9a97",
|
|
1537
1971
|
background: "#ebeced"
|
|
@@ -1568,7 +2002,7 @@ var W = {
|
|
|
1568
2002
|
text: "#ad1a72",
|
|
1569
2003
|
background: "#f4dfeb"
|
|
1570
2004
|
}
|
|
1571
|
-
},
|
|
2005
|
+
}, lr = {
|
|
1572
2006
|
gray: {
|
|
1573
2007
|
text: "#bebdb8",
|
|
1574
2008
|
background: "#9b9a97"
|
|
@@ -1605,7 +2039,7 @@ var W = {
|
|
|
1605
2039
|
text: "#da208f",
|
|
1606
2040
|
background: "#ad1a72"
|
|
1607
2041
|
}
|
|
1608
|
-
},
|
|
2042
|
+
}, K = {
|
|
1609
2043
|
backgroundColor: { default: "default" },
|
|
1610
2044
|
textColor: { default: "default" },
|
|
1611
2045
|
textAlignment: {
|
|
@@ -1617,30 +2051,30 @@ var W = {
|
|
|
1617
2051
|
"justify"
|
|
1618
2052
|
]
|
|
1619
2053
|
}
|
|
1620
|
-
},
|
|
2054
|
+
}, q = (e) => {
|
|
1621
2055
|
let t = {};
|
|
1622
|
-
return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment =
|
|
1623
|
-
},
|
|
1624
|
-
e.backgroundColor && e.backgroundColor !==
|
|
1625
|
-
},
|
|
1626
|
-
default:
|
|
1627
|
-
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : e.style.backgroundColor ? e.style.backgroundColor :
|
|
1628
|
-
renderHTML: (t) => t[e] ===
|
|
1629
|
-
}),
|
|
1630
|
-
default:
|
|
1631
|
-
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : e.style.color ? e.style.color :
|
|
1632
|
-
renderHTML: (t) => t[e] ===
|
|
1633
|
-
}),
|
|
1634
|
-
default:
|
|
1635
|
-
parseHTML: (e) => e.hasAttribute("data-text-alignment") ? e.getAttribute("data-text-alignment") : e.style.textAlign ? e.style.textAlign :
|
|
1636
|
-
renderHTML: (t) => t[e] ===
|
|
1637
|
-
}),
|
|
2056
|
+
return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment = K.textAlignment.values.includes(e.style.textAlign) ? e.style.textAlign : void 0, t;
|
|
2057
|
+
}, J = (e, t) => {
|
|
2058
|
+
e.backgroundColor && e.backgroundColor !== K.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in G ? G[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== K.textColor.default && (t.style.color = e.textColor in G ? G[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== K.textAlignment.default && (t.style.textAlign = e.textAlignment);
|
|
2059
|
+
}, ur = (e = "backgroundColor") => ({
|
|
2060
|
+
default: K.backgroundColor.default,
|
|
2061
|
+
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : e.style.backgroundColor ? e.style.backgroundColor : K.backgroundColor.default,
|
|
2062
|
+
renderHTML: (t) => t[e] === K.backgroundColor.default ? {} : { "data-background-color": t[e] }
|
|
2063
|
+
}), dr = (e = "textColor") => ({
|
|
2064
|
+
default: K.textColor.default,
|
|
2065
|
+
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : e.style.color ? e.style.color : K.textColor.default,
|
|
2066
|
+
renderHTML: (t) => t[e] === K.textColor.default ? {} : { "data-text-color": t[e] }
|
|
2067
|
+
}), fr = (e = "textAlignment") => ({
|
|
2068
|
+
default: K.textAlignment.default,
|
|
2069
|
+
parseHTML: (e) => e.hasAttribute("data-text-alignment") ? e.getAttribute("data-text-alignment") : e.style.textAlign ? e.style.textAlign : K.textAlignment.default,
|
|
2070
|
+
renderHTML: (t) => t[e] === K.textAlignment.default ? {} : { "data-text-alignment": t[e] }
|
|
2071
|
+
}), pr = (e, t) => {
|
|
1638
2072
|
let n = e.querySelector(t);
|
|
1639
2073
|
if (n) return {
|
|
1640
2074
|
targetElement: n,
|
|
1641
2075
|
caption: e.querySelector("figcaption")?.textContent ?? void 0
|
|
1642
2076
|
};
|
|
1643
|
-
},
|
|
2077
|
+
}, Y = r(({ editor: t }) => {
|
|
1644
2078
|
let n = e(void 0);
|
|
1645
2079
|
function r() {
|
|
1646
2080
|
n.setState(void 0);
|
|
@@ -1659,7 +2093,7 @@ var W = {
|
|
|
1659
2093
|
n.setState(e);
|
|
1660
2094
|
}
|
|
1661
2095
|
};
|
|
1662
|
-
}),
|
|
2096
|
+
}), mr = (e, t, n) => {
|
|
1663
2097
|
let r = document.createElement("div");
|
|
1664
2098
|
r.className = "bn-add-file-button";
|
|
1665
2099
|
let i = document.createElement("div");
|
|
@@ -1669,7 +2103,7 @@ var W = {
|
|
|
1669
2103
|
let o = (e) => {
|
|
1670
2104
|
e.preventDefault(), e.stopPropagation();
|
|
1671
2105
|
}, s = () => {
|
|
1672
|
-
t.isEditable && t.getExtension(
|
|
2106
|
+
t.isEditable && t.getExtension(Y)?.showMenu(e.id);
|
|
1673
2107
|
};
|
|
1674
2108
|
return r.addEventListener("mousedown", o, !0), r.addEventListener("click", s, !0), {
|
|
1675
2109
|
dom: r,
|
|
@@ -1677,17 +2111,17 @@ var W = {
|
|
|
1677
2111
|
r.removeEventListener("mousedown", o, !0), r.removeEventListener("click", s, !0);
|
|
1678
2112
|
}
|
|
1679
2113
|
};
|
|
1680
|
-
},
|
|
2114
|
+
}, hr = "<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>", gr = (e) => {
|
|
1681
2115
|
let t = document.createElement("div");
|
|
1682
2116
|
t.className = "bn-file-name-with-icon";
|
|
1683
2117
|
let n = document.createElement("div");
|
|
1684
|
-
n.className = "bn-file-icon", n.innerHTML =
|
|
2118
|
+
n.className = "bn-file-icon", n.innerHTML = hr, t.appendChild(n);
|
|
1685
2119
|
let r = document.createElement("p");
|
|
1686
2120
|
return r.className = "bn-file-name", r.textContent = e.props.name, t.appendChild(r), { dom: t };
|
|
1687
|
-
},
|
|
2121
|
+
}, _r = (e, t, n, r) => {
|
|
1688
2122
|
let i = e.props.url !== "" && !!e.props.caption, a = document.createElement(i ? "figure" : "div");
|
|
1689
2123
|
if (a.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
1690
|
-
let n =
|
|
2124
|
+
let n = mr(e, t, r);
|
|
1691
2125
|
a.appendChild(n.dom);
|
|
1692
2126
|
let i = t.onUploadStart((t) => {
|
|
1693
2127
|
if (t === e.id) {
|
|
@@ -1705,7 +2139,7 @@ var W = {
|
|
|
1705
2139
|
}
|
|
1706
2140
|
let o = { dom: a };
|
|
1707
2141
|
if (e.props.showPreview === !1 || !n) {
|
|
1708
|
-
let t =
|
|
2142
|
+
let t = gr(e);
|
|
1709
2143
|
a.appendChild(t.dom), o.destroy = () => {
|
|
1710
2144
|
t.destroy?.();
|
|
1711
2145
|
};
|
|
@@ -1715,71 +2149,71 @@ var W = {
|
|
|
1715
2149
|
t.className = "bn-file-caption", t.textContent = e.props.caption, a.appendChild(t);
|
|
1716
2150
|
}
|
|
1717
2151
|
return o;
|
|
1718
|
-
},
|
|
2152
|
+
}, vr = (e, t) => {
|
|
1719
2153
|
let n = document.createElement("figure"), r = document.createElement("figcaption");
|
|
1720
2154
|
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
1721
|
-
},
|
|
2155
|
+
}, yr = (e, t) => {
|
|
1722
2156
|
let n = document.createElement("div"), r = document.createElement("p");
|
|
1723
2157
|
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
1724
|
-
},
|
|
2158
|
+
}, br = (e) => ({ url: e.src || void 0 }), xr = "<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>", Sr = I((e) => ({
|
|
1725
2159
|
type: "audio",
|
|
1726
2160
|
propSchema: {
|
|
1727
|
-
backgroundColor:
|
|
2161
|
+
backgroundColor: K.backgroundColor,
|
|
1728
2162
|
name: { default: "" },
|
|
1729
2163
|
url: { default: "" },
|
|
1730
2164
|
caption: { default: "" },
|
|
1731
2165
|
showPreview: { default: !0 }
|
|
1732
2166
|
},
|
|
1733
2167
|
content: "none"
|
|
1734
|
-
})),
|
|
2168
|
+
})), Cr = (e = {}) => (e) => {
|
|
1735
2169
|
if (e.tagName === "AUDIO") {
|
|
1736
2170
|
if (e.closest("figure")) return;
|
|
1737
|
-
let { backgroundColor: t } =
|
|
2171
|
+
let { backgroundColor: t } = q(e);
|
|
1738
2172
|
return {
|
|
1739
|
-
...
|
|
2173
|
+
...br(e),
|
|
1740
2174
|
backgroundColor: t
|
|
1741
2175
|
};
|
|
1742
2176
|
}
|
|
1743
2177
|
if (e.tagName === "FIGURE") {
|
|
1744
|
-
let t =
|
|
2178
|
+
let t = pr(e, "audio");
|
|
1745
2179
|
if (!t) return;
|
|
1746
|
-
let { targetElement: n, caption: r } = t, { backgroundColor: i } =
|
|
2180
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
|
|
1747
2181
|
return {
|
|
1748
|
-
...
|
|
2182
|
+
...br(n),
|
|
1749
2183
|
backgroundColor: i,
|
|
1750
2184
|
caption: r
|
|
1751
2185
|
};
|
|
1752
2186
|
}
|
|
1753
|
-
},
|
|
2187
|
+
}, wr = (e = {}) => (t, n) => {
|
|
1754
2188
|
let r = document.createElement("div");
|
|
1755
2189
|
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>";
|
|
1756
2190
|
let i = document.createElement("audio");
|
|
1757
2191
|
return i.className = "bn-audio", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
1758
2192
|
i.src = e;
|
|
1759
|
-
}) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1,
|
|
1760
|
-
},
|
|
2193
|
+
}) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1, _r(t, n, { dom: i }, r.firstElementChild);
|
|
2194
|
+
}, Tr = (e = {}) => (e, t) => {
|
|
1761
2195
|
if (!e.props.url) return { dom: document.createElement("audio") };
|
|
1762
2196
|
let n;
|
|
1763
|
-
return e.props.showPreview ? (n = document.createElement("audio"), n.src = e.props.url) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
1764
|
-
},
|
|
2197
|
+
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 ? vr(n, e.props.caption) : yr(n, e.props.caption) : { dom: n };
|
|
2198
|
+
}, Er = L(Sr, (e) => ({
|
|
1765
2199
|
meta: { fileBlockAccept: ["audio/*"] },
|
|
1766
|
-
parse:
|
|
1767
|
-
render:
|
|
1768
|
-
toExternalHTML:
|
|
2200
|
+
parse: Cr(e),
|
|
2201
|
+
render: wr(e),
|
|
2202
|
+
toExternalHTML: Tr(e),
|
|
1769
2203
|
runsBefore: ["file"]
|
|
1770
|
-
})),
|
|
2204
|
+
})), Dr = (e) => {
|
|
1771
2205
|
{
|
|
1772
2206
|
if (e.tagName !== "PRE" || e.childElementCount !== 1 || e.firstElementChild?.tagName !== "CODE") return;
|
|
1773
2207
|
let t = e.firstElementChild;
|
|
1774
2208
|
return { language: t.getAttribute("data-language") || t.className.split(" ").find((e) => e.startsWith("language-"))?.replace("language-", "") };
|
|
1775
2209
|
}
|
|
1776
|
-
},
|
|
1777
|
-
let r =
|
|
2210
|
+
}, Or = ({ el: e, schema: t }, n) => {
|
|
2211
|
+
let r = d.fromSchema(t), i = e.firstElementChild;
|
|
1778
2212
|
return r.parse(i, {
|
|
1779
2213
|
preserveWhitespace: "full",
|
|
1780
2214
|
topNode: t.nodes[n].create()
|
|
1781
2215
|
}).content;
|
|
1782
|
-
},
|
|
2216
|
+
}, kr = (e) => {
|
|
1783
2217
|
let t = document.createElement("pre"), n = document.createElement("code");
|
|
1784
2218
|
return n.className = `language-${e.props.language}`, n.dataset.language = e.props.language, t.appendChild(n), {
|
|
1785
2219
|
dom: t,
|
|
@@ -1788,55 +2222,55 @@ var W = {
|
|
|
1788
2222
|
};
|
|
1789
2223
|
//#endregion
|
|
1790
2224
|
//#region src/blocks/Code/CodeBlockOptions.ts
|
|
1791
|
-
function
|
|
2225
|
+
function Ar(e, t) {
|
|
1792
2226
|
let n = t.trim().toLowerCase();
|
|
1793
2227
|
return Object.entries(e.supportedLanguages ?? {}).find(([e, { aliases: t }]) => e.toLowerCase() === n || t?.some((e) => e.toLowerCase() === n))?.[0];
|
|
1794
2228
|
}
|
|
1795
2229
|
//#endregion
|
|
1796
2230
|
//#region src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.ts
|
|
1797
|
-
var
|
|
2231
|
+
var jr = (e) => (t, n) => r({
|
|
1798
2232
|
key: t,
|
|
1799
2233
|
keyboardShortcuts: {
|
|
1800
2234
|
Delete: ({ editor: e }) => e.transact((t) => {
|
|
1801
|
-
let { block:
|
|
1802
|
-
if (
|
|
2235
|
+
let { block: r } = e.getTextCursorPosition();
|
|
2236
|
+
if (r.type !== n) return !1;
|
|
1803
2237
|
let { $from: i } = t.selection;
|
|
1804
|
-
return !i.parent.textContent && (e.removeBlocks([
|
|
2238
|
+
return !i.parent.textContent && (e.removeBlocks([r]), !0);
|
|
1805
2239
|
}),
|
|
1806
2240
|
Tab: ({ editor: t }) => e.indentLineWithTab !== !1 && t.transact((e) => {
|
|
1807
|
-
let { block:
|
|
1808
|
-
return
|
|
2241
|
+
let { block: r } = t.getTextCursorPosition();
|
|
2242
|
+
return r.type === n && (e.insertText(" "), !0);
|
|
1809
2243
|
}),
|
|
1810
2244
|
Enter: ({ editor: e }) => e.transact((t) => {
|
|
1811
|
-
let { block:
|
|
1812
|
-
if (
|
|
2245
|
+
let { block: r, nextBlock: i } = e.getTextCursorPosition();
|
|
2246
|
+
if (r.type !== n) return !1;
|
|
1813
2247
|
let { $from: a } = t.selection, o = a.parentOffset === a.parent.nodeSize - 2, s = a.parent.textContent.endsWith("\n\n");
|
|
1814
2248
|
if (o && s) {
|
|
1815
2249
|
if (t.delete(a.pos - 2, a.pos), i) return e.setTextCursorPosition(i, "start"), !0;
|
|
1816
|
-
let [
|
|
1817
|
-
return e.setTextCursorPosition(
|
|
2250
|
+
let [n] = e.insertBlocks([{ type: "paragraph" }], r, "after");
|
|
2251
|
+
return e.setTextCursorPosition(n, "start"), !0;
|
|
1818
2252
|
}
|
|
1819
2253
|
return t.insertText("\n"), !0;
|
|
1820
2254
|
}),
|
|
1821
2255
|
"Shift-Enter": ({ editor: e }) => e.transact(() => {
|
|
1822
2256
|
let { block: t } = e.getTextCursorPosition();
|
|
1823
|
-
if (t.type !==
|
|
1824
|
-
let [
|
|
1825
|
-
return e.setTextCursorPosition(
|
|
2257
|
+
if (t.type !== n) return !1;
|
|
2258
|
+
let [r] = e.insertBlocks([{ type: "paragraph" }], t, "after");
|
|
2259
|
+
return e.setTextCursorPosition(r, "start"), !0;
|
|
1826
2260
|
})
|
|
1827
2261
|
},
|
|
1828
2262
|
inputRules: [{
|
|
1829
2263
|
find: /^```(.*?)\s$/,
|
|
1830
2264
|
replace: ({ match: t }) => {
|
|
1831
|
-
let
|
|
2265
|
+
let r = t[1].trim();
|
|
1832
2266
|
return {
|
|
1833
|
-
type:
|
|
1834
|
-
props: { language: { language:
|
|
2267
|
+
type: n,
|
|
2268
|
+
props: { language: { language: Ar(e, r) ?? (r || e.defaultLanguage || "text") }.language },
|
|
1835
2269
|
content: []
|
|
1836
2270
|
};
|
|
1837
2271
|
}
|
|
1838
2272
|
}]
|
|
1839
|
-
}),
|
|
2273
|
+
}), Mr = (e, t, n, r) => {
|
|
1840
2274
|
if (!(n in r)) throw Error(`Language ${n} is not supported.`);
|
|
1841
2275
|
let i = document.createElement("select");
|
|
1842
2276
|
Object.entries(r).forEach(([e, { name: t }]) => {
|
|
@@ -1852,40 +2286,40 @@ var Mn = (e) => (t, r) => n({
|
|
|
1852
2286
|
dom: o,
|
|
1853
2287
|
destroy: () => i.removeEventListener("change", a)
|
|
1854
2288
|
};
|
|
1855
|
-
},
|
|
2289
|
+
}, Nr = (e, t, n) => {
|
|
1856
2290
|
let r = document.createElement("pre"), i = document.createElement("code");
|
|
1857
2291
|
r.appendChild(i);
|
|
1858
2292
|
let a = document.createDocumentFragment(), o;
|
|
1859
|
-
return n && Object.keys(n.supportedLanguages).length > 1 && (o =
|
|
2293
|
+
return n && Object.keys(n.supportedLanguages).length > 1 && (o = Mr(e, t, n.selectedLanguage, n.supportedLanguages), a.appendChild(o.dom)), a.appendChild(r), {
|
|
1860
2294
|
dom: a,
|
|
1861
2295
|
contentDOM: i,
|
|
1862
2296
|
destroy: () => {
|
|
1863
2297
|
o?.destroy();
|
|
1864
2298
|
}
|
|
1865
2299
|
};
|
|
1866
|
-
},
|
|
2300
|
+
}, Pr = "code-block-keyboard-shortcuts", Fr = I(({ defaultLanguage: e = "text" }) => ({
|
|
1867
2301
|
type: "codeBlock",
|
|
1868
2302
|
propSchema: { language: { default: e } },
|
|
1869
2303
|
content: "plain"
|
|
1870
|
-
})),
|
|
2304
|
+
})), Ir = L(Fr, (e) => ({
|
|
1871
2305
|
meta: {
|
|
1872
2306
|
code: !0,
|
|
1873
2307
|
defining: !0,
|
|
1874
2308
|
isolating: !1,
|
|
1875
2309
|
highlight: (e) => e.props.language
|
|
1876
2310
|
},
|
|
1877
|
-
parse: (e) =>
|
|
1878
|
-
parseContent: (e) =>
|
|
1879
|
-
render: (t, n) =>
|
|
2311
|
+
parse: (e) => Dr(e),
|
|
2312
|
+
parseContent: (e) => Or(e, "codeBlock"),
|
|
2313
|
+
render: (t, n) => Nr(t, n, e.supportedLanguages && {
|
|
1880
2314
|
selectedLanguage: t.props.language,
|
|
1881
2315
|
supportedLanguages: e.supportedLanguages
|
|
1882
2316
|
}),
|
|
1883
|
-
toExternalHTML: (e) =>
|
|
1884
|
-
}), (e) => [
|
|
2317
|
+
toExternalHTML: (e) => kr(e)
|
|
2318
|
+
}), (e) => [jr(e)(Pr, "codeBlock")]), Lr = I(() => ({
|
|
1885
2319
|
type: "divider",
|
|
1886
2320
|
propSchema: {},
|
|
1887
2321
|
content: "none"
|
|
1888
|
-
})),
|
|
2322
|
+
})), Rr = L(Lr, {
|
|
1889
2323
|
meta: { isolating: !1 },
|
|
1890
2324
|
parse(e) {
|
|
1891
2325
|
if (e.tagName === "HR") return {};
|
|
@@ -1893,7 +2327,7 @@ var Mn = (e) => (t, r) => n({
|
|
|
1893
2327
|
render() {
|
|
1894
2328
|
return { dom: document.createElement("hr") };
|
|
1895
2329
|
}
|
|
1896
|
-
}, [
|
|
2330
|
+
}, [r({
|
|
1897
2331
|
key: "divider-block-shortcuts",
|
|
1898
2332
|
inputRules: [{
|
|
1899
2333
|
find: /* @__PURE__ */ RegExp("^---$"),
|
|
@@ -1905,138 +2339,132 @@ var Mn = (e) => (t, r) => n({
|
|
|
1905
2339
|
};
|
|
1906
2340
|
}
|
|
1907
2341
|
}]
|
|
1908
|
-
})]),
|
|
2342
|
+
})]), zr = (e) => ({ url: e.src || void 0 }), Br = I(() => ({
|
|
1909
2343
|
type: "file",
|
|
1910
2344
|
propSchema: {
|
|
1911
|
-
backgroundColor:
|
|
2345
|
+
backgroundColor: K.backgroundColor,
|
|
1912
2346
|
name: { default: "" },
|
|
1913
2347
|
url: { default: "" },
|
|
1914
2348
|
caption: { default: "" }
|
|
1915
2349
|
},
|
|
1916
2350
|
content: "none"
|
|
1917
|
-
})),
|
|
2351
|
+
})), Vr = () => (e) => {
|
|
1918
2352
|
if (e.tagName === "EMBED") {
|
|
1919
2353
|
if (e.closest("figure")) return;
|
|
1920
|
-
let { backgroundColor: t } =
|
|
2354
|
+
let { backgroundColor: t } = q(e);
|
|
1921
2355
|
return {
|
|
1922
|
-
...
|
|
2356
|
+
...zr(e),
|
|
1923
2357
|
backgroundColor: t
|
|
1924
2358
|
};
|
|
1925
2359
|
}
|
|
1926
2360
|
if (e.tagName === "FIGURE") {
|
|
1927
|
-
let t =
|
|
2361
|
+
let t = pr(e, "embed");
|
|
1928
2362
|
if (!t) return;
|
|
1929
|
-
let { targetElement: n, caption: r } = t, { backgroundColor: i } =
|
|
2363
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
|
|
1930
2364
|
return {
|
|
1931
|
-
...
|
|
2365
|
+
...zr(n),
|
|
1932
2366
|
backgroundColor: i,
|
|
1933
2367
|
caption: r
|
|
1934
2368
|
};
|
|
1935
2369
|
}
|
|
1936
|
-
},
|
|
2370
|
+
}, Hr = L(Br, {
|
|
1937
2371
|
meta: { fileBlockAccept: ["*/*"] },
|
|
1938
|
-
parse:
|
|
2372
|
+
parse: Vr(),
|
|
1939
2373
|
render(e, t) {
|
|
1940
|
-
return
|
|
2374
|
+
return _r(e, t);
|
|
1941
2375
|
},
|
|
1942
2376
|
toExternalHTML(e) {
|
|
1943
2377
|
if (!e.props.url) return { dom: document.createElement("embed") };
|
|
1944
2378
|
let t = document.createElement("a");
|
|
1945
|
-
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ?
|
|
2379
|
+
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? yr(t, e.props.caption) : { dom: t };
|
|
1946
2380
|
}
|
|
1947
2381
|
});
|
|
1948
2382
|
//#endregion
|
|
1949
2383
|
//#region src/blocks/getDetailsContent.ts
|
|
1950
|
-
function
|
|
1951
|
-
let
|
|
2384
|
+
function Ur(e, t, n) {
|
|
2385
|
+
let r = i.fromSchema(t), o = e.querySelector(":scope > summary"), s;
|
|
1952
2386
|
if (o) {
|
|
1953
2387
|
let e = o.cloneNode(!0);
|
|
1954
|
-
|
|
2388
|
+
wt(e), s = r.parse(e, {
|
|
1955
2389
|
topNode: t.nodes.paragraph.create(),
|
|
1956
2390
|
preserveWhitespace: !0
|
|
1957
2391
|
}).content;
|
|
1958
|
-
} else s =
|
|
2392
|
+
} else s = a.empty;
|
|
1959
2393
|
let c = document.createElement("div");
|
|
1960
2394
|
c.setAttribute("data-node-type", "blockGroup");
|
|
1961
2395
|
let l = !1;
|
|
1962
|
-
for (let t of Array.from(e.childNodes)) t.tagName !== "SUMMARY" && (t.nodeType
|
|
2396
|
+
for (let t of Array.from(e.childNodes)) t.tagName !== "SUMMARY" && (t.nodeType !== 3 || t.textContent?.trim()) && (l = !0, c.appendChild(t.cloneNode(!0)));
|
|
1963
2397
|
let u = t.nodes[n].create({}, s);
|
|
1964
2398
|
if (!l) return u.content;
|
|
1965
|
-
let d =
|
|
2399
|
+
let d = r.parse(c, { topNode: t.nodes.blockGroup.create() });
|
|
1966
2400
|
return d.content.size > 0 ? u.content.addToEnd(d) : u.content;
|
|
1967
2401
|
}
|
|
1968
2402
|
//#endregion
|
|
1969
|
-
//#region src/blocks/ToggleWrapper/
|
|
1970
|
-
var
|
|
2403
|
+
//#region src/blocks/ToggleWrapper/createToggleFrame.ts
|
|
2404
|
+
var Wr = {
|
|
1971
2405
|
set: (e, t) => window.localStorage.setItem(`toggle-${e.id}`, t ? "true" : "false"),
|
|
1972
2406
|
get: (e) => window.localStorage.getItem(`toggle-${e.id}`) === "true"
|
|
1973
|
-
},
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
2407
|
+
}, Gr = "<svg aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"CURRENTCOLOR\"><path d=\"M320-200v-560l440 280-440 280Z\"/></svg>";
|
|
2408
|
+
function Kr(e) {
|
|
2409
|
+
return Wr.get(e);
|
|
2410
|
+
}
|
|
2411
|
+
function qr(e, t, n = Wr) {
|
|
2412
|
+
let r = document.createElement("div");
|
|
2413
|
+
r.className = "bn-toggle-wrapper bn-toggle-frame";
|
|
2414
|
+
let i = document.createElement("button");
|
|
2415
|
+
i.className = "bn-toggle-button", i.type = "button", i.setAttribute("aria-label", t.dictionary.toggle_blocks.toggle_button), i.innerHTML = Gr, i.addEventListener("mousedown", (e) => e.preventDefault());
|
|
2416
|
+
let a = document.createElement("div");
|
|
2417
|
+
a.className = "bn-toggle-slot";
|
|
1977
2418
|
let o = document.createElement("button");
|
|
1978
|
-
o.className = "bn-toggle-button", o.type = "button", o.
|
|
1979
|
-
let s = (e) => e.preventDefault();
|
|
1980
|
-
o.addEventListener("mousedown", s);
|
|
1981
|
-
let c = () => {
|
|
1982
|
-
let n = t.getBlock(e);
|
|
1983
|
-
n && (a.getAttribute("data-show-children") === "true" ? (a.setAttribute("data-show-children", "false"), r.set(n, !1), i.contains(l) && i.removeChild(l)) : (a.setAttribute("data-show-children", "true"), r.set(n, !0), t.isEditable && n.children.length === 0 && !i.contains(l) && i.appendChild(l)));
|
|
1984
|
-
};
|
|
1985
|
-
o.addEventListener("click", c), a.appendChild(o), a.appendChild(n);
|
|
1986
|
-
let l = document.createElement("button");
|
|
1987
|
-
l.className = "bn-toggle-add-block-button", l.type = "button", l.textContent = t.dictionary.toggle_blocks.add_block_button;
|
|
1988
|
-
let u = (e) => e.preventDefault();
|
|
1989
|
-
l.addEventListener("mousedown", u);
|
|
1990
|
-
let d = () => {
|
|
2419
|
+
o.className = "bn-toggle-add-block-button", o.type = "button", o.textContent = t.dictionary.toggle_blocks.add_block_button, o.addEventListener("mousedown", (e) => e.preventDefault()), o.addEventListener("click", () => {
|
|
1991
2420
|
t.transact(() => {
|
|
1992
|
-
let n = t.updateBlock(e, { children: [{}] });
|
|
1993
|
-
t.setTextCursorPosition(n.children[0]
|
|
2421
|
+
let n = t.updateBlock(e.id, { children: [{}] });
|
|
2422
|
+
t.setTextCursorPosition(n.children[0], "end"), t.focus();
|
|
1994
2423
|
});
|
|
1995
|
-
};
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
n && r.set(n, !1);
|
|
2011
|
-
}
|
|
2012
|
-
i.contains(l) && i.removeChild(l);
|
|
2013
|
-
}
|
|
2014
|
-
f = n;
|
|
2015
|
-
});
|
|
2016
|
-
return r.get(e) ? (a.setAttribute("data-show-children", "true"), t.isEditable && e.children.length === 0 && i.appendChild(l)) : a.setAttribute("data-show-children", "false"), {
|
|
2017
|
-
dom: i,
|
|
2018
|
-
ignoreMutation: (e) => e instanceof MutationRecord && (e.type === "attributes" && e.target === a && e.attributeName === "data-show-children" || e.type === "childList" && (e.addedNodes[0] === l || e.removedNodes[0] === l)),
|
|
2019
|
-
destroy: () => {
|
|
2020
|
-
o.removeEventListener("mousedown", s), o.removeEventListener("click", c), l.removeEventListener("mousedown", u), l.removeEventListener("click", d), p?.();
|
|
2424
|
+
}), r.append(i, a);
|
|
2425
|
+
let s = e.children.length, c = n.get(e);
|
|
2426
|
+
function l() {
|
|
2427
|
+
i.setAttribute("aria-expanded", String(c));
|
|
2428
|
+
let e = c && s === 0 && t.isEditable;
|
|
2429
|
+
e && !o.isConnected ? r.append(o) : e || o.remove();
|
|
2430
|
+
}
|
|
2431
|
+
return i.addEventListener("click", () => {
|
|
2432
|
+
c = !c, n.set(e, c), l();
|
|
2433
|
+
}), l(), {
|
|
2434
|
+
dom: r,
|
|
2435
|
+
slot: a,
|
|
2436
|
+
update(e) {
|
|
2437
|
+
let t = e.children.length, r = c;
|
|
2438
|
+
return t > s && (c = !0), c !== r && n.set(e, c), s = t, l(), !0;
|
|
2021
2439
|
}
|
|
2022
2440
|
};
|
|
2023
|
-
}
|
|
2441
|
+
}
|
|
2442
|
+
//#endregion
|
|
2443
|
+
//#region src/blocks/Heading/block.ts
|
|
2444
|
+
var Jr = [
|
|
2024
2445
|
1,
|
|
2025
2446
|
2,
|
|
2026
2447
|
3,
|
|
2027
2448
|
4,
|
|
2028
2449
|
5,
|
|
2029
2450
|
6
|
|
2030
|
-
]
|
|
2031
|
-
|
|
2032
|
-
return t
|
|
2451
|
+
];
|
|
2452
|
+
function Yr(e, t) {
|
|
2453
|
+
return t ? {
|
|
2454
|
+
level: e,
|
|
2455
|
+
isToggleable: !1
|
|
2456
|
+
} : { level: e };
|
|
2457
|
+
}
|
|
2458
|
+
var Xr = (e, t) => ({ editor: n }) => {
|
|
2459
|
+
let r = n.getTextCursorPosition();
|
|
2460
|
+
return n.schema.blockSchema[r.block.type].content === "inline" && (n.updateBlock(r.block, {
|
|
2033
2461
|
type: "heading",
|
|
2034
|
-
props:
|
|
2462
|
+
props: Yr(e, t)
|
|
2035
2463
|
}), !0);
|
|
2036
|
-
},
|
|
2464
|
+
}, Zr = I(({ defaultLevel: e = 1, levels: t = Jr, allowToggleHeadings: n = !0 } = {}) => ({
|
|
2037
2465
|
type: "heading",
|
|
2038
2466
|
propSchema: {
|
|
2039
|
-
...
|
|
2467
|
+
...K,
|
|
2040
2468
|
level: {
|
|
2041
2469
|
default: e,
|
|
2042
2470
|
values: t
|
|
@@ -2047,15 +2475,32 @@ var Gn = {
|
|
|
2047
2475
|
} } : {}
|
|
2048
2476
|
},
|
|
2049
2477
|
content: "inline"
|
|
2050
|
-
})),
|
|
2051
|
-
meta: {
|
|
2478
|
+
})), Qr = L(Zr, ({ allowToggleHeadings: e = !0 } = {}) => ({
|
|
2479
|
+
meta: {
|
|
2480
|
+
isolating: !1,
|
|
2481
|
+
dropsIntoChildren: (t) => e && t.props.isToggleable === !0
|
|
2482
|
+
},
|
|
2483
|
+
experimental_keyboard: e ? (e) => {
|
|
2484
|
+
if (!e.props.isToggleable) return {};
|
|
2485
|
+
let t = Kr(e);
|
|
2486
|
+
return {
|
|
2487
|
+
resetsTo: {
|
|
2488
|
+
type: "heading",
|
|
2489
|
+
props: { isToggleable: !1 }
|
|
2490
|
+
},
|
|
2491
|
+
emptyEnterResets: !0,
|
|
2492
|
+
enter: t ? "into-children" : "split",
|
|
2493
|
+
splitKeepsChildren: !t,
|
|
2494
|
+
emptyChildEnter: t ? "stay" : "outdent"
|
|
2495
|
+
};
|
|
2496
|
+
} : void 0,
|
|
2052
2497
|
parse(t) {
|
|
2053
2498
|
if (e && t.tagName === "DETAILS") {
|
|
2054
2499
|
let e = t.querySelector(":scope > summary");
|
|
2055
2500
|
if (!e) return;
|
|
2056
2501
|
let n = e.querySelector("h1, h2, h3, h4, h5, h6");
|
|
2057
2502
|
return n ? {
|
|
2058
|
-
...
|
|
2503
|
+
...q(n),
|
|
2059
2504
|
level: parseInt(n.tagName[1]),
|
|
2060
2505
|
isToggleable: !0
|
|
2061
2506
|
} : void 0;
|
|
@@ -2083,27 +2528,32 @@ var Gn = {
|
|
|
2083
2528
|
default: return;
|
|
2084
2529
|
}
|
|
2085
2530
|
return {
|
|
2086
|
-
...
|
|
2531
|
+
...q(t),
|
|
2087
2532
|
level: n
|
|
2088
2533
|
};
|
|
2089
2534
|
},
|
|
2090
2535
|
...e ? { parseContent: ({ el: e, schema: t }) => {
|
|
2091
|
-
if (e.tagName === "DETAILS") return
|
|
2536
|
+
if (e.tagName === "DETAILS") return Ur(e, t, "heading");
|
|
2092
2537
|
} } : {},
|
|
2093
2538
|
runsBefore: ["toggleListItem"],
|
|
2094
|
-
render(
|
|
2095
|
-
let
|
|
2096
|
-
return
|
|
2097
|
-
|
|
2098
|
-
contentDOM:
|
|
2099
|
-
}
|
|
2100
|
-
|
|
2101
|
-
|
|
2539
|
+
render(e) {
|
|
2540
|
+
let t = document.createElement(`h${e.props.level}`);
|
|
2541
|
+
return {
|
|
2542
|
+
dom: t,
|
|
2543
|
+
contentDOM: t
|
|
2544
|
+
};
|
|
2545
|
+
},
|
|
2546
|
+
renderFrame(t, n) {
|
|
2547
|
+
if (!e || !t.props.isToggleable) return;
|
|
2548
|
+
let r = qr(t, n);
|
|
2549
|
+
return {
|
|
2550
|
+
...r,
|
|
2551
|
+
update: (e) => !!e.props.isToggleable && r.update(e)
|
|
2102
2552
|
};
|
|
2103
2553
|
},
|
|
2104
2554
|
toExternalHTML(t) {
|
|
2105
2555
|
let n = document.createElement(`h${t.props.level}`);
|
|
2106
|
-
if (
|
|
2556
|
+
if (J(t.props, n), e && t.props.isToggleable) {
|
|
2107
2557
|
let e = document.createElement("details");
|
|
2108
2558
|
e.setAttribute("open", "");
|
|
2109
2559
|
let t = document.createElement("summary");
|
|
@@ -2118,20 +2568,20 @@ var Gn = {
|
|
|
2118
2568
|
contentDOM: n
|
|
2119
2569
|
};
|
|
2120
2570
|
}
|
|
2121
|
-
}), ({ levels: e =
|
|
2571
|
+
}), ({ levels: e = Jr, allowToggleHeadings: t = !0 } = {}) => [r({
|
|
2122
2572
|
key: "heading-shortcuts",
|
|
2123
|
-
keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`,
|
|
2573
|
+
keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`, Xr(e, t)]) ?? []),
|
|
2124
2574
|
inputRules: e.map((e) => ({
|
|
2125
2575
|
find: RegExp(`^(#{${e}})\\s$`),
|
|
2126
2576
|
replace({ match: e }) {
|
|
2127
2577
|
return {
|
|
2128
2578
|
type: "heading",
|
|
2129
|
-
props:
|
|
2579
|
+
props: Yr(e[1].length, t)
|
|
2130
2580
|
};
|
|
2131
2581
|
}
|
|
2132
2582
|
}))
|
|
2133
|
-
})]),
|
|
2134
|
-
let { dom: a, destroy: o } =
|
|
2583
|
+
})]), $r = (e, t, n, r, i) => {
|
|
2584
|
+
let { dom: a, destroy: o } = _r(e, t, n, i), s = a;
|
|
2135
2585
|
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");
|
|
2136
2586
|
let c = document.createElement("div");
|
|
2137
2587
|
c.className = "bn-resize-handle", c.style.left = "4px", c.style.display = "none", r.appendChild(c);
|
|
@@ -2175,15 +2625,15 @@ var Gn = {
|
|
|
2175
2625
|
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);
|
|
2176
2626
|
}
|
|
2177
2627
|
};
|
|
2178
|
-
},
|
|
2628
|
+
}, ei = (e) => ({
|
|
2179
2629
|
url: e.src || void 0,
|
|
2180
2630
|
previewWidth: e.width || void 0,
|
|
2181
2631
|
name: e.alt || void 0
|
|
2182
|
-
}),
|
|
2632
|
+
}), ti = "<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>", ni = I((e = {}) => ({
|
|
2183
2633
|
type: "image",
|
|
2184
2634
|
propSchema: {
|
|
2185
|
-
textAlignment:
|
|
2186
|
-
backgroundColor:
|
|
2635
|
+
textAlignment: K.textAlignment,
|
|
2636
|
+
backgroundColor: K.backgroundColor,
|
|
2187
2637
|
name: { default: "" },
|
|
2188
2638
|
url: { default: "" },
|
|
2189
2639
|
caption: { default: "" },
|
|
@@ -2194,26 +2644,26 @@ var Gn = {
|
|
|
2194
2644
|
}
|
|
2195
2645
|
},
|
|
2196
2646
|
content: "none"
|
|
2197
|
-
})),
|
|
2647
|
+
})), ri = (e = {}) => (e) => {
|
|
2198
2648
|
if (e.tagName === "IMG") {
|
|
2199
2649
|
if (e.closest("figure")) return;
|
|
2200
|
-
let { backgroundColor: t } =
|
|
2650
|
+
let { backgroundColor: t } = q(e);
|
|
2201
2651
|
return {
|
|
2202
|
-
...
|
|
2652
|
+
...ei(e),
|
|
2203
2653
|
backgroundColor: t
|
|
2204
2654
|
};
|
|
2205
2655
|
}
|
|
2206
2656
|
if (e.tagName === "FIGURE") {
|
|
2207
|
-
let t =
|
|
2657
|
+
let t = pr(e, "img");
|
|
2208
2658
|
if (!t) return;
|
|
2209
|
-
let { targetElement: n, caption: r } = t, { backgroundColor: i } =
|
|
2659
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
|
|
2210
2660
|
return {
|
|
2211
|
-
...
|
|
2661
|
+
...ei(n),
|
|
2212
2662
|
backgroundColor: i,
|
|
2213
2663
|
caption: r
|
|
2214
2664
|
};
|
|
2215
2665
|
}
|
|
2216
|
-
},
|
|
2666
|
+
}, ii = (e = {}) => (t, n) => {
|
|
2217
2667
|
let r = document.createElement("div");
|
|
2218
2668
|
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>";
|
|
2219
2669
|
let i = document.createElement("div");
|
|
@@ -2221,55 +2671,28 @@ var Gn = {
|
|
|
2221
2671
|
let a = document.createElement("img");
|
|
2222
2672
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
2223
2673
|
a.src = e;
|
|
2224
|
-
}) : a.src = t.props.url, a.alt = t.props.name || "", a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a),
|
|
2225
|
-
},
|
|
2674
|
+
}) : 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), $r(t, n, { dom: i }, i, r.firstElementChild);
|
|
2675
|
+
}, ai = (e = {}) => (e, t) => {
|
|
2226
2676
|
if (!e.props.url) return { dom: document.createElement("img") };
|
|
2227
2677
|
let n;
|
|
2228
|
-
return e.props.showPreview ? (n = document.createElement("img"), n.src = e.props.url, n.alt = e.props.name || "", e.props.previewWidth && (n.width = e.props.previewWidth)) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
2229
|
-
},
|
|
2678
|
+
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 ? vr(n, e.props.caption) : yr(n, e.props.caption) : { dom: n };
|
|
2679
|
+
}, oi = L(ni, (e) => ({
|
|
2230
2680
|
meta: { fileBlockAccept: ["image/*"] },
|
|
2231
|
-
parse:
|
|
2232
|
-
render:
|
|
2233
|
-
toExternalHTML:
|
|
2681
|
+
parse: ri(e),
|
|
2682
|
+
render: ii(e),
|
|
2683
|
+
toExternalHTML: ai(e),
|
|
2234
2684
|
runsBefore: ["file"]
|
|
2235
|
-
}))
|
|
2236
|
-
let i = b(Ae(e.doc, t));
|
|
2237
|
-
if (!i.isBlockContainer) return !1;
|
|
2238
|
-
let a = j(e), o = [{
|
|
2239
|
-
type: i.bnBlock.node.type,
|
|
2240
|
-
attrs: r ? {
|
|
2241
|
-
...i.bnBlock.node.attrs,
|
|
2242
|
-
id: void 0
|
|
2243
|
-
} : {}
|
|
2244
|
-
}, {
|
|
2245
|
-
type: n ? i.blockContent.node.type : a.nodes.paragraph,
|
|
2246
|
-
attrs: r ? { ...i.blockContent.node.attrs } : {}
|
|
2247
|
-
}];
|
|
2248
|
-
return e.split(t, 2, o), !0;
|
|
2249
|
-
}, sr = (e, t) => {
|
|
2250
|
-
let { blockInfo: n, selectionEmpty: r } = e.transact((e) => ({
|
|
2251
|
-
blockInfo: x(e),
|
|
2252
|
-
selectionEmpty: e.selection.anchor === e.selection.head
|
|
2253
|
-
}));
|
|
2254
|
-
if (!n.isBlockContainer) return !1;
|
|
2255
|
-
let { bnBlock: i, blockContent: a } = n;
|
|
2256
|
-
return a.node.type.name !== t || !r ? !1 : a.node.childCount === 0 ? (e.transact((e) => {
|
|
2257
|
-
en(e, i.beforePos, {
|
|
2258
|
-
type: "paragraph",
|
|
2259
|
-
props: {}
|
|
2260
|
-
});
|
|
2261
|
-
}), !0) : a.node.childCount > 0 && e.transact((e) => (e.deleteSelection(), e.scrollIntoView(), or(e, e.selection.from, !0)));
|
|
2262
|
-
};
|
|
2685
|
+
}));
|
|
2263
2686
|
//#endregion
|
|
2264
2687
|
//#region src/blocks/ListItem/getListItemContent.ts
|
|
2265
|
-
function
|
|
2266
|
-
let
|
|
2688
|
+
function si(e, t, n) {
|
|
2689
|
+
let r = i.fromSchema(t), o = e, s = document.createElement("div");
|
|
2267
2690
|
s.setAttribute("data-node-type", "blockGroup");
|
|
2268
2691
|
for (let e of Array.from(o.childNodes)) s.appendChild(e.cloneNode(!0));
|
|
2269
|
-
let c =
|
|
2692
|
+
let c = r.parse(s, { topNode: t.nodes.blockGroup.create() });
|
|
2270
2693
|
c.firstChild?.firstChild?.type.name === "checkListItem" && (c = c.copy(c.content.cut(c.firstChild.firstChild.nodeSize + 2)));
|
|
2271
2694
|
let l = c.firstChild?.firstChild;
|
|
2272
|
-
if (!l?.isTextblock) return
|
|
2695
|
+
if (!l?.isTextblock) return a.from(c);
|
|
2273
2696
|
let u = t.nodes[n].create({}, l.content), d = c.content.cut(l.nodeSize + 2);
|
|
2274
2697
|
if (d.size > 0) {
|
|
2275
2698
|
let e = c.copy(d);
|
|
@@ -2279,18 +2702,22 @@ function cr(e, t, n) {
|
|
|
2279
2702
|
}
|
|
2280
2703
|
//#endregion
|
|
2281
2704
|
//#region src/blocks/ListItem/BulletListItem/block.ts
|
|
2282
|
-
var
|
|
2705
|
+
var ci = I(() => ({
|
|
2283
2706
|
type: "bulletListItem",
|
|
2284
|
-
propSchema: { ...
|
|
2707
|
+
propSchema: { ...K },
|
|
2285
2708
|
content: "inline"
|
|
2286
|
-
})),
|
|
2709
|
+
})), li = L(ci, {
|
|
2710
|
+
experimental_keyboard: {
|
|
2711
|
+
splitKeepsType: !0,
|
|
2712
|
+
emptyEnterResets: !0
|
|
2713
|
+
},
|
|
2287
2714
|
meta: { isolating: !1 },
|
|
2288
2715
|
parse(e) {
|
|
2289
2716
|
if (e.tagName !== "LI") return;
|
|
2290
2717
|
let t = e.parentElement;
|
|
2291
|
-
if (t === null || t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL" || !e.closest("ul, ol")) return
|
|
2718
|
+
if (t === null || t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL" || !e.closest("ul, ol")) return q(e);
|
|
2292
2719
|
},
|
|
2293
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2720
|
+
parseContent: ({ el: e, schema: t }) => si(e, t, "bulletListItem"),
|
|
2294
2721
|
render() {
|
|
2295
2722
|
let e = document.createElement("p");
|
|
2296
2723
|
return {
|
|
@@ -2300,43 +2727,44 @@ var lr = F(() => ({
|
|
|
2300
2727
|
},
|
|
2301
2728
|
toExternalHTML(e) {
|
|
2302
2729
|
let t = document.createElement("li"), n = document.createElement("p");
|
|
2303
|
-
return
|
|
2730
|
+
return J(e.props, t), t.appendChild(n), {
|
|
2304
2731
|
dom: t,
|
|
2305
2732
|
contentDOM: n
|
|
2306
2733
|
};
|
|
2307
2734
|
}
|
|
2308
|
-
}, [
|
|
2735
|
+
}, [r({
|
|
2309
2736
|
key: "bullet-list-item-shortcuts",
|
|
2310
|
-
keyboardShortcuts: {
|
|
2311
|
-
|
|
2312
|
-
"
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
}), !0);
|
|
2318
|
-
}
|
|
2319
|
-
},
|
|
2737
|
+
keyboardShortcuts: { "Mod-Shift-8": ({ editor: e }) => {
|
|
2738
|
+
let t = e.getTextCursorPosition();
|
|
2739
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
2740
|
+
type: "bulletListItem",
|
|
2741
|
+
props: {}
|
|
2742
|
+
}), !0);
|
|
2743
|
+
} },
|
|
2320
2744
|
inputRules: [{
|
|
2321
2745
|
find: /^\s?[-+*]\s$/,
|
|
2322
2746
|
replace({ editor: e }) {
|
|
2323
|
-
if (
|
|
2747
|
+
if (qe(e.prosemirrorState).blockNoteType !== "heading") return {
|
|
2324
2748
|
type: "bulletListItem",
|
|
2325
2749
|
props: {}
|
|
2326
2750
|
};
|
|
2327
2751
|
}
|
|
2328
2752
|
}]
|
|
2329
|
-
})]),
|
|
2753
|
+
})]), ui = I(() => ({
|
|
2330
2754
|
type: "checkListItem",
|
|
2331
2755
|
propSchema: {
|
|
2332
|
-
...
|
|
2756
|
+
...K,
|
|
2333
2757
|
checked: {
|
|
2334
2758
|
default: !1,
|
|
2335
2759
|
type: "boolean"
|
|
2336
2760
|
}
|
|
2337
2761
|
},
|
|
2338
2762
|
content: "inline"
|
|
2339
|
-
})),
|
|
2763
|
+
})), di = L(ui, {
|
|
2764
|
+
experimental_keyboard: {
|
|
2765
|
+
splitKeepsType: !0,
|
|
2766
|
+
emptyEnterResets: !0
|
|
2767
|
+
},
|
|
2340
2768
|
meta: { isolating: !1 },
|
|
2341
2769
|
parse(e) {
|
|
2342
2770
|
if (e.tagName === "input") return e.closest("[data-content-type]") || e.closest("li") ? void 0 : e.type === "checkbox" ? { checked: e.checked } : void 0;
|
|
@@ -2345,12 +2773,12 @@ var lr = F(() => ({
|
|
|
2345
2773
|
if (t !== null && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL")) {
|
|
2346
2774
|
let t = e.querySelector("input[type=checkbox]") || null;
|
|
2347
2775
|
return t === null ? void 0 : {
|
|
2348
|
-
...
|
|
2776
|
+
...q(e),
|
|
2349
2777
|
checked: t.checked
|
|
2350
2778
|
};
|
|
2351
2779
|
}
|
|
2352
2780
|
},
|
|
2353
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2781
|
+
parseContent: ({ el: e, schema: t }) => si(e, t, "checkListItem"),
|
|
2354
2782
|
render(e, t) {
|
|
2355
2783
|
let n = document.createDocumentFragment(), r = document.createElement("input");
|
|
2356
2784
|
r.type = "checkbox", r.checked = e.props.checked, e.props.checked && r.setAttribute("checked", ""), r.disabled = !t.isEditable, r.addEventListener("change", () => {
|
|
@@ -2366,24 +2794,21 @@ var lr = F(() => ({
|
|
|
2366
2794
|
let t = document.createElement("li"), n = document.createElement("input");
|
|
2367
2795
|
n.type = "checkbox", n.checked = e.props.checked, e.props.checked && n.setAttribute("checked", "");
|
|
2368
2796
|
let r = document.createElement("p");
|
|
2369
|
-
return
|
|
2797
|
+
return J(e.props, t), t.appendChild(n), t.appendChild(r), {
|
|
2370
2798
|
dom: t,
|
|
2371
2799
|
contentDOM: r
|
|
2372
2800
|
};
|
|
2373
2801
|
},
|
|
2374
2802
|
runsBefore: ["bulletListItem"]
|
|
2375
|
-
}, [
|
|
2803
|
+
}, [r({
|
|
2376
2804
|
key: "check-list-item-shortcuts",
|
|
2377
|
-
keyboardShortcuts: {
|
|
2378
|
-
|
|
2379
|
-
"
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
}), !0);
|
|
2385
|
-
}
|
|
2386
|
-
},
|
|
2805
|
+
keyboardShortcuts: { "Mod-Shift-9": ({ editor: e }) => {
|
|
2806
|
+
let t = e.getTextCursorPosition();
|
|
2807
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
2808
|
+
type: "checkListItem",
|
|
2809
|
+
props: {}
|
|
2810
|
+
}), !0);
|
|
2811
|
+
} },
|
|
2387
2812
|
inputRules: [{
|
|
2388
2813
|
find: /^\s?\[\s*\]\s$/,
|
|
2389
2814
|
replace() {
|
|
@@ -2404,13 +2829,10 @@ var lr = F(() => ({
|
|
|
2404
2829
|
})]);
|
|
2405
2830
|
//#endregion
|
|
2406
2831
|
//#region src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts
|
|
2407
|
-
function
|
|
2408
|
-
let i = !!e.firstChild.attrs.start, a = b(
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
});
|
|
2412
|
-
if (!a.isBlockContainer) throw Error("impossible");
|
|
2413
|
-
let o = n.doc.resolve(a.bnBlock.beforePos).nodeBefore, s = o ? r.get(o) : void 0;
|
|
2832
|
+
function fi(e, t, n, r) {
|
|
2833
|
+
let i = !!e.firstChild.attrs.start, a = b(e, t);
|
|
2834
|
+
if (!a.hasContent) throw Error("impossible");
|
|
2835
|
+
let o = n.doc.resolve(a.block.beforePos).nodeBefore, s = o ? r.get(o) : void 0;
|
|
2414
2836
|
if (s !== void 0) {
|
|
2415
2837
|
let t = s + 1;
|
|
2416
2838
|
return r.set(e, t), {
|
|
@@ -2422,26 +2844,20 @@ function pr(e, t, n, r) {
|
|
|
2422
2844
|
let c = [{
|
|
2423
2845
|
node: e,
|
|
2424
2846
|
pos: t
|
|
2425
|
-
}], l = o, u = a.
|
|
2847
|
+
}], l = o, u = a.block.beforePos;
|
|
2426
2848
|
for (; l && r.get(l) === void 0;) {
|
|
2427
|
-
let e = b(
|
|
2428
|
-
posBeforeNode: u - l.nodeSize,
|
|
2429
|
-
node: l
|
|
2430
|
-
});
|
|
2849
|
+
let e = b(l, u - l.nodeSize);
|
|
2431
2850
|
if (e.blockNoteType !== "numberedListItem") break;
|
|
2432
2851
|
c.push({
|
|
2433
2852
|
node: l,
|
|
2434
2853
|
pos: u - l.nodeSize
|
|
2435
2854
|
});
|
|
2436
|
-
let t = n.doc.resolve(e.
|
|
2437
|
-
u = e.
|
|
2855
|
+
let t = n.doc.resolve(e.block.beforePos).nodeBefore;
|
|
2856
|
+
u = e.block.beforePos, l = t;
|
|
2438
2857
|
}
|
|
2439
|
-
let d, f, p = c[c.length - 1], m = b(
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
});
|
|
2443
|
-
if (!m.isBlockContainer) throw Error("impossible");
|
|
2444
|
-
let h = n.doc.resolve(m.bnBlock.beforePos).nodeBefore, g = h ? r.get(h) : void 0;
|
|
2858
|
+
let d, f, p = c[c.length - 1], m = b(p.node, p.pos);
|
|
2859
|
+
if (!m.hasContent) throw Error("impossible");
|
|
2860
|
+
let h = n.doc.resolve(m.block.beforePos).nodeBefore, g = h ? r.get(h) : void 0;
|
|
2445
2861
|
g === void 0 ? (d = (p.node.firstChild.attrs.start || 1) - 1, f = !0) : (d = g, f = !1);
|
|
2446
2862
|
for (let e = c.length - 1; e >= 0; e--) {
|
|
2447
2863
|
let t = c[e];
|
|
@@ -2453,7 +2869,7 @@ function pr(e, t, n, r) {
|
|
|
2453
2869
|
hasStart: i
|
|
2454
2870
|
};
|
|
2455
2871
|
}
|
|
2456
|
-
function
|
|
2872
|
+
function pi(e, t) {
|
|
2457
2873
|
let n = /* @__PURE__ */ new Map(), r = t.decorations.map(e.mapping, e.doc), i = e.changedRange() ?? {
|
|
2458
2874
|
from: 0,
|
|
2459
2875
|
to: e.doc.nodeSize - 2
|
|
@@ -2461,7 +2877,7 @@ function mr(e, t) {
|
|
|
2461
2877
|
e.doc.nodesBetween(i.from, e.doc.nodeSize - 2, (t, s, c) => {
|
|
2462
2878
|
if (c && o.has(c)) return !1;
|
|
2463
2879
|
if (t.type.name === "blockContainer" && t.firstChild.type.name === "numberedListItem") {
|
|
2464
|
-
let { index: l, isFirst: u, hasStart: d } =
|
|
2880
|
+
let { index: l, isFirst: u, hasStart: d } = fi(t, s, e, n), f = e.doc.nodeAt(s + 1);
|
|
2465
2881
|
if (r.find(s + 1, s + 1 + f.nodeSize, (e) => e.index === l && e.isFirst === u && e.hasStart === d).length === 0) a.push(ye.node(s + 1, s + 1 + f.nodeSize, { "data-index": l.toString() }, {
|
|
2466
2882
|
index: l,
|
|
2467
2883
|
isFirst: u,
|
|
@@ -2473,43 +2889,47 @@ function mr(e, t) {
|
|
|
2473
2889
|
let s = a.flatMap((e) => r.find(e.from, e.to));
|
|
2474
2890
|
return { decorations: r.remove(s).add(e.doc, a) };
|
|
2475
2891
|
}
|
|
2476
|
-
var
|
|
2892
|
+
var mi = () => new _e({
|
|
2477
2893
|
key: new ve("numbered-list-indexing-decorations"),
|
|
2478
2894
|
state: {
|
|
2479
2895
|
init(e, t) {
|
|
2480
|
-
return
|
|
2896
|
+
return pi(t.tr, { decorations: be.empty });
|
|
2481
2897
|
},
|
|
2482
2898
|
apply(e, t) {
|
|
2483
|
-
return !e.docChanged && t.decorations ? t :
|
|
2899
|
+
return !e.docChanged && t.decorations ? t : pi(e, t);
|
|
2484
2900
|
}
|
|
2485
2901
|
},
|
|
2486
2902
|
props: { decorations(e) {
|
|
2487
2903
|
return this.getState(e)?.decorations ?? be.empty;
|
|
2488
2904
|
} }
|
|
2489
|
-
}),
|
|
2905
|
+
}), hi = I(() => ({
|
|
2490
2906
|
type: "numberedListItem",
|
|
2491
2907
|
propSchema: {
|
|
2492
|
-
...
|
|
2908
|
+
...K,
|
|
2493
2909
|
start: {
|
|
2494
2910
|
default: void 0,
|
|
2495
2911
|
type: "number"
|
|
2496
2912
|
}
|
|
2497
2913
|
},
|
|
2498
2914
|
content: "inline"
|
|
2499
|
-
})),
|
|
2915
|
+
})), gi = L(hi, {
|
|
2916
|
+
experimental_keyboard: {
|
|
2917
|
+
splitKeepsType: !0,
|
|
2918
|
+
emptyEnterResets: !0
|
|
2919
|
+
},
|
|
2500
2920
|
meta: { isolating: !1 },
|
|
2501
2921
|
parse(e) {
|
|
2502
2922
|
if (e.tagName !== "LI") return;
|
|
2503
2923
|
let t = e.parentElement;
|
|
2504
2924
|
if (t !== null && (t.tagName === "OL" || t.tagName === "DIV" && t.parentElement?.tagName === "OL")) {
|
|
2505
|
-
let n = parseInt(t.getAttribute("start") || "1"), r =
|
|
2925
|
+
let n = parseInt(t.getAttribute("start") || "1"), r = q(e);
|
|
2506
2926
|
return e.previousElementSibling || n === 1 ? r : {
|
|
2507
2927
|
...r,
|
|
2508
2928
|
start: n
|
|
2509
2929
|
};
|
|
2510
2930
|
}
|
|
2511
2931
|
},
|
|
2512
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2932
|
+
parseContent: ({ el: e, schema: t }) => si(e, t, "numberedListItem"),
|
|
2513
2933
|
render() {
|
|
2514
2934
|
let e = document.createElement("p");
|
|
2515
2935
|
return {
|
|
@@ -2519,17 +2939,17 @@ var hr = () => new _e({
|
|
|
2519
2939
|
},
|
|
2520
2940
|
toExternalHTML(e) {
|
|
2521
2941
|
let t = document.createElement("li"), n = document.createElement("p");
|
|
2522
|
-
return
|
|
2942
|
+
return J(e.props, t), t.appendChild(n), {
|
|
2523
2943
|
dom: t,
|
|
2524
2944
|
contentDOM: n
|
|
2525
2945
|
};
|
|
2526
2946
|
}
|
|
2527
|
-
}, [
|
|
2947
|
+
}, [r({
|
|
2528
2948
|
key: "numbered-list-item-shortcuts",
|
|
2529
2949
|
inputRules: [{
|
|
2530
2950
|
find: /^\s?(\d+)\.\s$/,
|
|
2531
2951
|
replace({ match: e, editor: t }) {
|
|
2532
|
-
if (
|
|
2952
|
+
if (qe(t.prosemirrorState).blockNoteType === "heading") return;
|
|
2533
2953
|
let n = parseInt(e[1]);
|
|
2534
2954
|
return {
|
|
2535
2955
|
type: "numberedListItem",
|
|
@@ -2537,70 +2957,78 @@ var hr = () => new _e({
|
|
|
2537
2957
|
};
|
|
2538
2958
|
}
|
|
2539
2959
|
}],
|
|
2540
|
-
keyboardShortcuts: {
|
|
2541
|
-
|
|
2542
|
-
"
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
},
|
|
2550
|
-
prosemirrorPlugins: [hr()]
|
|
2551
|
-
})]), vr = F(() => ({
|
|
2960
|
+
keyboardShortcuts: { "Mod-Shift-7": ({ editor: e }) => {
|
|
2961
|
+
let t = e.getTextCursorPosition();
|
|
2962
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
2963
|
+
type: "numberedListItem",
|
|
2964
|
+
props: {}
|
|
2965
|
+
}), !0);
|
|
2966
|
+
} },
|
|
2967
|
+
prosemirrorPlugins: [mi()]
|
|
2968
|
+
})]), _i = I(() => ({
|
|
2552
2969
|
type: "toggleListItem",
|
|
2553
|
-
propSchema: { ...
|
|
2970
|
+
propSchema: { ...K },
|
|
2554
2971
|
content: "inline"
|
|
2555
|
-
})),
|
|
2556
|
-
|
|
2972
|
+
})), vi = L(_i, {
|
|
2973
|
+
experimental_keyboard: (e) => {
|
|
2974
|
+
let t = Kr(e);
|
|
2975
|
+
return {
|
|
2976
|
+
splitKeepsType: !0,
|
|
2977
|
+
emptyEnterResets: !0,
|
|
2978
|
+
enter: t ? "into-children" : "split",
|
|
2979
|
+
splitKeepsChildren: !t,
|
|
2980
|
+
emptyChildEnter: t ? "stay" : "outdent"
|
|
2981
|
+
};
|
|
2982
|
+
},
|
|
2983
|
+
meta: {
|
|
2984
|
+
isolating: !1,
|
|
2985
|
+
dropsIntoChildren: () => !0
|
|
2986
|
+
},
|
|
2557
2987
|
parse(e) {
|
|
2558
|
-
if (e.tagName === "DETAILS") return
|
|
2988
|
+
if (e.tagName === "DETAILS") return q(e);
|
|
2559
2989
|
if (e.tagName === "LI") {
|
|
2560
2990
|
let t = e.parentElement;
|
|
2561
|
-
if (t && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL") && e.querySelector(":scope > details")) return
|
|
2991
|
+
if (t && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL") && e.querySelector(":scope > details")) return q(e);
|
|
2562
2992
|
}
|
|
2563
2993
|
},
|
|
2564
2994
|
parseContent: ({ el: e, schema: t }) => {
|
|
2565
2995
|
let n = e.tagName === "DETAILS" ? e : e.querySelector(":scope > details");
|
|
2566
2996
|
if (!n) throw Error("No details found in toggleListItem parseContent");
|
|
2567
|
-
return
|
|
2997
|
+
return Ur(n, t, "toggleListItem");
|
|
2568
2998
|
},
|
|
2569
2999
|
runsBefore: ["bulletListItem"],
|
|
2570
|
-
render(
|
|
2571
|
-
let
|
|
3000
|
+
render() {
|
|
3001
|
+
let e = document.createElement("p");
|
|
2572
3002
|
return {
|
|
2573
|
-
|
|
2574
|
-
contentDOM:
|
|
3003
|
+
dom: e,
|
|
3004
|
+
contentDOM: e
|
|
2575
3005
|
};
|
|
2576
3006
|
},
|
|
3007
|
+
renderFrame: qr,
|
|
2577
3008
|
toExternalHTML(e) {
|
|
2578
3009
|
let t = document.createElement("li"), n = document.createElement("details");
|
|
2579
3010
|
n.setAttribute("open", "");
|
|
2580
3011
|
let r = document.createElement("summary"), i = document.createElement("p");
|
|
2581
|
-
return r.appendChild(i), n.appendChild(r),
|
|
3012
|
+
return r.appendChild(i), n.appendChild(r), J(e.props, t), t.appendChild(n), {
|
|
2582
3013
|
dom: t,
|
|
2583
3014
|
contentDOM: i,
|
|
2584
3015
|
childrenDOM: n
|
|
2585
3016
|
};
|
|
2586
3017
|
}
|
|
2587
|
-
}, [
|
|
3018
|
+
}, [r({
|
|
2588
3019
|
key: "toggle-list-item-shortcuts",
|
|
2589
|
-
keyboardShortcuts: {
|
|
2590
|
-
|
|
2591
|
-
"
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
}
|
|
2598
|
-
}
|
|
2599
|
-
})]), br = F(() => ({
|
|
3020
|
+
keyboardShortcuts: { "Mod-Shift-6": ({ editor: e }) => {
|
|
3021
|
+
let t = e.getTextCursorPosition();
|
|
3022
|
+
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
3023
|
+
type: "toggleListItem",
|
|
3024
|
+
props: {}
|
|
3025
|
+
}), !0);
|
|
3026
|
+
} }
|
|
3027
|
+
})]), yi = I(() => ({
|
|
2600
3028
|
type: "pageBreak",
|
|
2601
3029
|
propSchema: {},
|
|
2602
3030
|
content: "none"
|
|
2603
|
-
})),
|
|
3031
|
+
})), bi = L(yi, {
|
|
2604
3032
|
parse(e) {
|
|
2605
3033
|
if (e.tagName === "DIV" && e.hasAttribute("data-page-break")) return {};
|
|
2606
3034
|
},
|
|
@@ -2612,14 +3040,14 @@ var hr = () => new _e({
|
|
|
2612
3040
|
let e = document.createElement("div");
|
|
2613
3041
|
return e.setAttribute("data-page-break", ""), { dom: e };
|
|
2614
3042
|
}
|
|
2615
|
-
}),
|
|
3043
|
+
}), xi = (e) => e.extend({ blockSpecs: { pageBreak: bi() } }), Si = I(() => ({
|
|
2616
3044
|
type: "paragraph",
|
|
2617
|
-
propSchema:
|
|
3045
|
+
propSchema: K,
|
|
2618
3046
|
content: "inline"
|
|
2619
|
-
})),
|
|
3047
|
+
})), Ci = L(Si, {
|
|
2620
3048
|
meta: { isolating: !1 },
|
|
2621
3049
|
parse: (e) => {
|
|
2622
|
-
if (e.tagName === "P" && e.textContent?.trim()) return
|
|
3050
|
+
if (e.tagName === "P" && e.textContent?.trim()) return q(e);
|
|
2623
3051
|
},
|
|
2624
3052
|
render: () => {
|
|
2625
3053
|
let e = document.createElement("p");
|
|
@@ -2630,13 +3058,13 @@ var hr = () => new _e({
|
|
|
2630
3058
|
},
|
|
2631
3059
|
toExternalHTML: (e) => {
|
|
2632
3060
|
let t = document.createElement("p");
|
|
2633
|
-
return
|
|
3061
|
+
return J(e.props, t), {
|
|
2634
3062
|
dom: t,
|
|
2635
3063
|
contentDOM: t
|
|
2636
3064
|
};
|
|
2637
3065
|
},
|
|
2638
3066
|
runsBefore: ["default", "heading"]
|
|
2639
|
-
}, [
|
|
3067
|
+
}, [r({
|
|
2640
3068
|
key: "paragraph-shortcuts",
|
|
2641
3069
|
keyboardShortcuts: { "Mod-Alt-0": ({ editor: e }) => {
|
|
2642
3070
|
let t = e.getTextCursorPosition();
|
|
@@ -2645,18 +3073,18 @@ var hr = () => new _e({
|
|
|
2645
3073
|
props: {}
|
|
2646
3074
|
}), !0);
|
|
2647
3075
|
} }
|
|
2648
|
-
})]),
|
|
3076
|
+
})]), wi = I(() => ({
|
|
2649
3077
|
type: "quote",
|
|
2650
3078
|
propSchema: {
|
|
2651
|
-
backgroundColor:
|
|
2652
|
-
textColor:
|
|
3079
|
+
backgroundColor: K.backgroundColor,
|
|
3080
|
+
textColor: K.textColor
|
|
2653
3081
|
},
|
|
2654
3082
|
content: "inline"
|
|
2655
|
-
})),
|
|
3083
|
+
})), Ti = L(wi, {
|
|
2656
3084
|
meta: { isolating: !1 },
|
|
2657
3085
|
parse(e) {
|
|
2658
3086
|
if (e.tagName === "BLOCKQUOTE") {
|
|
2659
|
-
let { backgroundColor: t, textColor: n } =
|
|
3087
|
+
let { backgroundColor: t, textColor: n } = q(e);
|
|
2660
3088
|
return {
|
|
2661
3089
|
backgroundColor: t,
|
|
2662
3090
|
textColor: n
|
|
@@ -2672,12 +3100,12 @@ var hr = () => new _e({
|
|
|
2672
3100
|
},
|
|
2673
3101
|
toExternalHTML(e) {
|
|
2674
3102
|
let t = document.createElement("blockquote");
|
|
2675
|
-
return
|
|
3103
|
+
return J(e.props, t), {
|
|
2676
3104
|
dom: t,
|
|
2677
3105
|
contentDOM: t
|
|
2678
3106
|
};
|
|
2679
3107
|
}
|
|
2680
|
-
}, [
|
|
3108
|
+
}, [r({
|
|
2681
3109
|
key: "quote-block-shortcuts",
|
|
2682
3110
|
keyboardShortcuts: { "Mod-Alt-q": ({ editor: e }) => {
|
|
2683
3111
|
let t = e.getTextCursorPosition();
|
|
@@ -2703,15 +3131,7 @@ var hr = () => new _e({
|
|
|
2703
3131
|
};
|
|
2704
3132
|
}
|
|
2705
3133
|
}]
|
|
2706
|
-
})]),
|
|
2707
|
-
function Y(e) {
|
|
2708
|
-
return e && e.options.extensions.some((e) => {
|
|
2709
|
-
if (e.type !== "mark") return !1;
|
|
2710
|
-
let t = g(e, "group");
|
|
2711
|
-
return typeof t == "string" && t.split(" ").includes("blockLevelSuggestion");
|
|
2712
|
-
}) ? Dr : "";
|
|
2713
|
-
}
|
|
2714
|
-
var Or = 120, kr = 31, Ar = s.create({
|
|
3134
|
+
})]), Ei = 120, Di = 31, Oi = m.create({
|
|
2715
3135
|
name: "BlockNoteTableExtension",
|
|
2716
3136
|
addProseMirrorPlugins: () => [ue({
|
|
2717
3137
|
cellMinWidth: 35,
|
|
@@ -2722,7 +3142,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2722
3142
|
return {
|
|
2723
3143
|
Enter: () => fe(this.editor.state) ? this.editor.commands.command(({ state: e, dispatch: t }) => {
|
|
2724
3144
|
let n = he(e), r = n ? me(n, "vert", 1) : null;
|
|
2725
|
-
return r && t && t(e.tr.setSelection(
|
|
3145
|
+
return r && t && t(e.tr.setSelection(u.between(r, pe(r))).scrollIntoView()), !0;
|
|
2726
3146
|
}) : !1,
|
|
2727
3147
|
Backspace: () => {
|
|
2728
3148
|
let e = this.editor.state.selection, t = e.empty, n = e.$head.parentOffset === 0, r = e.$head.node().type.name === "tableParagraph";
|
|
@@ -2738,16 +3158,16 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2738
3158
|
options: e.options,
|
|
2739
3159
|
storage: e.storage
|
|
2740
3160
|
};
|
|
2741
|
-
return { tableRole:
|
|
3161
|
+
return { tableRole: v(ie(e, "tableRole", t)) };
|
|
2742
3162
|
}
|
|
2743
|
-
}),
|
|
3163
|
+
}), ki = { textColor: K.textColor }, Ai = _.create({
|
|
2744
3164
|
name: "tableHeader",
|
|
2745
3165
|
addOptions() {
|
|
2746
3166
|
return { HTMLAttributes: {} };
|
|
2747
3167
|
},
|
|
2748
3168
|
content: "tableContent+",
|
|
2749
3169
|
marks() {
|
|
2750
|
-
return
|
|
3170
|
+
return k(this.editor);
|
|
2751
3171
|
},
|
|
2752
3172
|
addAttributes() {
|
|
2753
3173
|
return {
|
|
@@ -2767,24 +3187,24 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2767
3187
|
parseHTML() {
|
|
2768
3188
|
return [{
|
|
2769
3189
|
tag: "th",
|
|
2770
|
-
getContent: (e, t) =>
|
|
3190
|
+
getContent: (e, t) => Fi(e, t)
|
|
2771
3191
|
}];
|
|
2772
3192
|
},
|
|
2773
3193
|
renderHTML({ HTMLAttributes: e }) {
|
|
2774
3194
|
return [
|
|
2775
3195
|
"th",
|
|
2776
|
-
|
|
3196
|
+
oe(this.options.HTMLAttributes, e),
|
|
2777
3197
|
0
|
|
2778
3198
|
];
|
|
2779
3199
|
}
|
|
2780
|
-
}),
|
|
3200
|
+
}), ji = _.create({
|
|
2781
3201
|
name: "tableCell",
|
|
2782
3202
|
addOptions() {
|
|
2783
3203
|
return { HTMLAttributes: {} };
|
|
2784
3204
|
},
|
|
2785
3205
|
content: "tableContent+",
|
|
2786
3206
|
marks() {
|
|
2787
|
-
return
|
|
3207
|
+
return k(this.editor);
|
|
2788
3208
|
},
|
|
2789
3209
|
addAttributes() {
|
|
2790
3210
|
return {
|
|
@@ -2804,30 +3224,30 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2804
3224
|
parseHTML() {
|
|
2805
3225
|
return [{
|
|
2806
3226
|
tag: "td",
|
|
2807
|
-
getContent: (e, t) =>
|
|
3227
|
+
getContent: (e, t) => Fi(e, t)
|
|
2808
3228
|
}];
|
|
2809
3229
|
},
|
|
2810
3230
|
renderHTML({ HTMLAttributes: e }) {
|
|
2811
3231
|
return [
|
|
2812
3232
|
"td",
|
|
2813
|
-
|
|
3233
|
+
oe(this.options.HTMLAttributes, e),
|
|
2814
3234
|
0
|
|
2815
3235
|
];
|
|
2816
3236
|
}
|
|
2817
|
-
}),
|
|
3237
|
+
}), Mi = _.create({
|
|
2818
3238
|
name: "table",
|
|
2819
3239
|
content: "tableRow+",
|
|
2820
3240
|
group: "blockContent",
|
|
2821
3241
|
tableRole: "table",
|
|
2822
3242
|
marks() {
|
|
2823
|
-
return
|
|
3243
|
+
return k(this.editor);
|
|
2824
3244
|
},
|
|
2825
3245
|
isolating: !0,
|
|
2826
3246
|
parseHTML() {
|
|
2827
3247
|
return [{ tag: "table" }];
|
|
2828
3248
|
},
|
|
2829
3249
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
2830
|
-
let n =
|
|
3250
|
+
let n = St(this.name, "table", {
|
|
2831
3251
|
...this.options.domAttributes?.blockContent || {},
|
|
2832
3252
|
...t
|
|
2833
3253
|
}, this.options.domAttributes?.inlineContent || {}), r = document.createElement("colgroup");
|
|
@@ -2847,7 +3267,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2847
3267
|
constructor(e, t, n) {
|
|
2848
3268
|
super(e, t), this.node = e, this.cellMinWidth = t, this.blockContentHTMLAttributes = n;
|
|
2849
3269
|
let r = document.createElement("div");
|
|
2850
|
-
r.className =
|
|
3270
|
+
r.className = O("bn-block-content", n.class), r.setAttribute("data-content-type", "table");
|
|
2851
3271
|
for (let [e, t] of Object.entries(n)) e !== "class" && r.setAttribute(e, t);
|
|
2852
3272
|
let i = this.dom, a = document.createElement("div");
|
|
2853
3273
|
a.className = "tableWrapper-inner", a.appendChild(i.firstChild), i.appendChild(a), r.appendChild(i);
|
|
@@ -2858,12 +3278,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2858
3278
|
return !e.target.closest(".tableWrapper-inner") || super.ignoreMutation(e);
|
|
2859
3279
|
}
|
|
2860
3280
|
update(e) {
|
|
2861
|
-
|
|
2862
|
-
for (let [t, n] of Object.entries(jr)) {
|
|
2863
|
-
let r = P(t), i = e.attrs[t];
|
|
2864
|
-
i === n.default ? this.dom.removeAttribute(r) : this.dom.setAttribute(r, String(i));
|
|
2865
|
-
}
|
|
2866
|
-
return !0;
|
|
3281
|
+
return super.update(e) ? (j(this.dom, e.attrs, ki), !0) : !1;
|
|
2867
3282
|
}
|
|
2868
3283
|
}
|
|
2869
3284
|
return new n(e, 120, {
|
|
@@ -2872,7 +3287,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2872
3287
|
});
|
|
2873
3288
|
};
|
|
2874
3289
|
}
|
|
2875
|
-
}),
|
|
3290
|
+
}), Ni = _.create({
|
|
2876
3291
|
name: "tableParagraph",
|
|
2877
3292
|
group: "tableContent",
|
|
2878
3293
|
content: "inline*",
|
|
@@ -2894,7 +3309,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2894
3309
|
0
|
|
2895
3310
|
];
|
|
2896
3311
|
}
|
|
2897
|
-
}),
|
|
3312
|
+
}), Pi = _.create({
|
|
2898
3313
|
name: "tableRow",
|
|
2899
3314
|
addOptions() {
|
|
2900
3315
|
return { HTMLAttributes: {} };
|
|
@@ -2902,7 +3317,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2902
3317
|
content: "(tableCell | tableHeader)+",
|
|
2903
3318
|
tableRole: "row",
|
|
2904
3319
|
marks() {
|
|
2905
|
-
return
|
|
3320
|
+
return k(this.editor);
|
|
2906
3321
|
},
|
|
2907
3322
|
parseHTML() {
|
|
2908
3323
|
return [{ tag: "tr" }];
|
|
@@ -2910,34 +3325,34 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2910
3325
|
renderHTML({ HTMLAttributes: e }) {
|
|
2911
3326
|
return [
|
|
2912
3327
|
"tr",
|
|
2913
|
-
|
|
3328
|
+
oe(this.options.HTMLAttributes, e),
|
|
2914
3329
|
0
|
|
2915
3330
|
];
|
|
2916
3331
|
}
|
|
2917
3332
|
});
|
|
2918
|
-
function
|
|
2919
|
-
let n =
|
|
3333
|
+
function Fi(e, t) {
|
|
3334
|
+
let n = i.fromSchema(t).parse(e, { topNode: t.nodes.blockGroup.create() }), r = [];
|
|
2920
3335
|
return n.content.descendants((e) => {
|
|
2921
|
-
if (e.isInline) return
|
|
2922
|
-
}),
|
|
3336
|
+
if (e.isInline) return r.push(e), !1;
|
|
3337
|
+
}), a.fromArray(r);
|
|
2923
3338
|
}
|
|
2924
|
-
var
|
|
2925
|
-
node:
|
|
3339
|
+
var Ii = () => pn({
|
|
3340
|
+
node: Mi,
|
|
2926
3341
|
type: "table",
|
|
2927
3342
|
content: "table"
|
|
2928
|
-
},
|
|
3343
|
+
}, ki, [r({
|
|
2929
3344
|
key: "table-extensions",
|
|
2930
3345
|
tiptapExtensions: [
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
3346
|
+
Oi,
|
|
3347
|
+
Ni,
|
|
3348
|
+
Ai,
|
|
3349
|
+
ji,
|
|
3350
|
+
Pi
|
|
2936
3351
|
]
|
|
2937
|
-
}),
|
|
3352
|
+
}), r({
|
|
2938
3353
|
key: "table-keyboard-delete",
|
|
2939
3354
|
keyboardShortcuts: { Backspace: ({ editor: e }) => {
|
|
2940
|
-
if (!(e.prosemirrorState.selection instanceof
|
|
3355
|
+
if (!(e.prosemirrorState.selection instanceof ce)) return !1;
|
|
2941
3356
|
let t = e.getTextCursorPosition().block, n = t.content, r = 0;
|
|
2942
3357
|
for (let e of n.rows) for (let t of e.cells) {
|
|
2943
3358
|
if ("type" in t && t.content.length > 0 || !("type" in t) && t.length > 0) return !1;
|
|
@@ -2950,15 +3365,15 @@ var Rr = () => ut({
|
|
|
2950
3365
|
(e.getPrevBlock(t) || e.getNextBlock(t)) && e.setTextCursorPosition(t), e.removeBlocks([t]);
|
|
2951
3366
|
}), !0);
|
|
2952
3367
|
} }
|
|
2953
|
-
})]),
|
|
3368
|
+
})]), Li = (e) => ({
|
|
2954
3369
|
url: e.src || void 0,
|
|
2955
3370
|
previewWidth: e.width || void 0,
|
|
2956
3371
|
name: e.getAttribute("data-name") || void 0
|
|
2957
|
-
}),
|
|
3372
|
+
}), Ri = "<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>", zi = I((e) => ({
|
|
2958
3373
|
type: "video",
|
|
2959
3374
|
propSchema: {
|
|
2960
|
-
textAlignment:
|
|
2961
|
-
backgroundColor:
|
|
3375
|
+
textAlignment: K.textAlignment,
|
|
3376
|
+
backgroundColor: K.backgroundColor,
|
|
2962
3377
|
name: { default: "" },
|
|
2963
3378
|
url: { default: "" },
|
|
2964
3379
|
caption: { default: "" },
|
|
@@ -2969,28 +3384,28 @@ var Rr = () => ut({
|
|
|
2969
3384
|
}
|
|
2970
3385
|
},
|
|
2971
3386
|
content: "none"
|
|
2972
|
-
})),
|
|
3387
|
+
})), Bi = (e) => (e) => {
|
|
2973
3388
|
if (e.tagName === "VIDEO") {
|
|
2974
3389
|
if (e.closest("figure")) return;
|
|
2975
|
-
let { backgroundColor: t } =
|
|
3390
|
+
let { backgroundColor: t } = q(e);
|
|
2976
3391
|
return {
|
|
2977
|
-
...
|
|
3392
|
+
...Li(e),
|
|
2978
3393
|
backgroundColor: t
|
|
2979
3394
|
};
|
|
2980
3395
|
}
|
|
2981
3396
|
if (e.tagName === "FIGURE") {
|
|
2982
|
-
let t =
|
|
3397
|
+
let t = pr(e, "video");
|
|
2983
3398
|
if (!t) return;
|
|
2984
|
-
let { targetElement: n, caption: r } = t, { backgroundColor: i } =
|
|
3399
|
+
let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
|
|
2985
3400
|
return {
|
|
2986
|
-
...
|
|
3401
|
+
...Li(n),
|
|
2987
3402
|
backgroundColor: i,
|
|
2988
3403
|
caption: r
|
|
2989
3404
|
};
|
|
2990
3405
|
}
|
|
2991
|
-
},
|
|
3406
|
+
}, Vi = L(zi, (e) => ({
|
|
2992
3407
|
meta: { fileBlockAccept: ["video/*"] },
|
|
2993
|
-
parse:
|
|
3408
|
+
parse: Bi(e),
|
|
2994
3409
|
render(t, n) {
|
|
2995
3410
|
let r = document.createElement("div");
|
|
2996
3411
|
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>";
|
|
@@ -2999,12 +3414,12 @@ var Rr = () => ut({
|
|
|
2999
3414
|
let a = document.createElement("video");
|
|
3000
3415
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
3001
3416
|
a.src = e;
|
|
3002
|
-
}) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a),
|
|
3417
|
+
}) : 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), $r(t, n, { dom: i }, i, r.firstElementChild);
|
|
3003
3418
|
},
|
|
3004
3419
|
toExternalHTML(e) {
|
|
3005
3420
|
if (!e.props.url) return { dom: document.createElement("video") };
|
|
3006
3421
|
let t;
|
|
3007
|
-
return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, e.props.previewWidth && (t.width = e.props.previewWidth)) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
3422
|
+
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 ? vr(t, e.props.caption) : yr(t, e.props.caption) : { dom: t };
|
|
3008
3423
|
},
|
|
3009
3424
|
runsBefore: ["file"]
|
|
3010
3425
|
}));
|
|
@@ -3026,21 +3441,85 @@ function X(e, t, n) {
|
|
|
3026
3441
|
}
|
|
3027
3442
|
return !0;
|
|
3028
3443
|
}
|
|
3029
|
-
function
|
|
3444
|
+
function Hi(e, t, n, r) {
|
|
3030
3445
|
return X(t, n, r) && e.type === n;
|
|
3031
3446
|
}
|
|
3032
|
-
function
|
|
3033
|
-
return e instanceof
|
|
3447
|
+
function Ui(e) {
|
|
3448
|
+
return e instanceof ce;
|
|
3034
3449
|
}
|
|
3035
|
-
function
|
|
3450
|
+
function Wi(e) {
|
|
3036
3451
|
let t = e.type.spec.tableRole;
|
|
3037
3452
|
return t === "cell" || t === "header_cell";
|
|
3038
3453
|
}
|
|
3039
3454
|
//#endregion
|
|
3455
|
+
//#region src/blocks/defaultBlockTypeItems.ts
|
|
3456
|
+
var Gi = {
|
|
3457
|
+
1: "heading",
|
|
3458
|
+
2: "heading_2",
|
|
3459
|
+
3: "heading_3",
|
|
3460
|
+
4: "heading_4",
|
|
3461
|
+
5: "heading_5",
|
|
3462
|
+
6: "heading_6"
|
|
3463
|
+
}, Ki = {
|
|
3464
|
+
1: "toggle_heading",
|
|
3465
|
+
2: "toggle_heading_2",
|
|
3466
|
+
3: "toggle_heading_3"
|
|
3467
|
+
};
|
|
3468
|
+
function qi(e) {
|
|
3469
|
+
let t = [];
|
|
3470
|
+
if (X(e, "paragraph") && t.push({
|
|
3471
|
+
key: "paragraph",
|
|
3472
|
+
type: "paragraph"
|
|
3473
|
+
}), X(e, "heading", { level: "number" })) {
|
|
3474
|
+
let n = e.schema.blockSchema.heading.propSchema.level.values, r = X(e, "heading", {
|
|
3475
|
+
level: "number",
|
|
3476
|
+
isToggleable: "boolean"
|
|
3477
|
+
});
|
|
3478
|
+
for (let e of [
|
|
3479
|
+
1,
|
|
3480
|
+
2,
|
|
3481
|
+
3,
|
|
3482
|
+
4,
|
|
3483
|
+
5,
|
|
3484
|
+
6
|
|
3485
|
+
]) n?.includes(e) && t.push({
|
|
3486
|
+
key: Gi[e],
|
|
3487
|
+
type: "heading",
|
|
3488
|
+
props: r ? {
|
|
3489
|
+
level: e,
|
|
3490
|
+
isToggleable: !1
|
|
3491
|
+
} : { level: e }
|
|
3492
|
+
});
|
|
3493
|
+
if (r) for (let e of [
|
|
3494
|
+
1,
|
|
3495
|
+
2,
|
|
3496
|
+
3
|
|
3497
|
+
]) n?.includes(e) && t.push({
|
|
3498
|
+
key: Ki[e],
|
|
3499
|
+
type: "heading",
|
|
3500
|
+
props: {
|
|
3501
|
+
level: e,
|
|
3502
|
+
isToggleable: !0
|
|
3503
|
+
}
|
|
3504
|
+
});
|
|
3505
|
+
}
|
|
3506
|
+
for (let [n, r] of [
|
|
3507
|
+
["quote", "quote"],
|
|
3508
|
+
["toggle_list", "toggleListItem"],
|
|
3509
|
+
["bullet_list", "bulletListItem"],
|
|
3510
|
+
["numbered_list", "numberedListItem"],
|
|
3511
|
+
["check_list", "checkListItem"]
|
|
3512
|
+
]) X(e, r) && t.push({
|
|
3513
|
+
key: n,
|
|
3514
|
+
type: r
|
|
3515
|
+
});
|
|
3516
|
+
return t;
|
|
3517
|
+
}
|
|
3518
|
+
//#endregion
|
|
3040
3519
|
//#region src/extensions/FormattingToolbar/FormattingToolbar.ts
|
|
3041
|
-
var Z =
|
|
3520
|
+
var Z = r(({ editor: t }) => {
|
|
3042
3521
|
let n = e(!1), r = () => t.transact((e) => {
|
|
3043
|
-
if (e.selection.empty || e.selection instanceof
|
|
3522
|
+
if (e.selection.empty || e.selection instanceof u && e.doc.textBetween(e.selection.from, e.selection.to).length === 0) return !1;
|
|
3044
3523
|
let t = !1;
|
|
3045
3524
|
return e.selection.content().content.descendants((e) => (e.type.spec.content === "text*" && (t = !0), !t)), !t;
|
|
3046
3525
|
});
|
|
@@ -3052,7 +3531,13 @@ var Z = n(({ editor: t }) => {
|
|
|
3052
3531
|
a || o || n.setState(r());
|
|
3053
3532
|
}), c = t.onSelectionChange(() => {
|
|
3054
3533
|
a || o || n.setState(r());
|
|
3055
|
-
})
|
|
3534
|
+
}), l = t.onFocusChange((e, { focused: i }) => {
|
|
3535
|
+
if (!i) {
|
|
3536
|
+
n.setState(!1);
|
|
3537
|
+
return;
|
|
3538
|
+
}
|
|
3539
|
+
a || o || t.isFocused() && n.setState(r());
|
|
3540
|
+
}, { includeEditorUI: !0 });
|
|
3056
3541
|
e.addEventListener("pointerdown", () => {
|
|
3057
3542
|
a = !0, n.setState(!1);
|
|
3058
3543
|
}, { signal: i }), t.prosemirrorView.root.addEventListener("pointerup", () => {
|
|
@@ -3070,14 +3555,14 @@ var Z = n(({ editor: t }) => {
|
|
|
3070
3555
|
}, { signal: i }), t.prosemirrorView.root.addEventListener("dragend", () => {
|
|
3071
3556
|
o = !1;
|
|
3072
3557
|
}, { signal: i }), i.addEventListener("abort", () => {
|
|
3073
|
-
s(), c();
|
|
3558
|
+
s(), c(), l();
|
|
3074
3559
|
});
|
|
3075
3560
|
}
|
|
3076
3561
|
};
|
|
3077
3562
|
});
|
|
3078
3563
|
//#endregion
|
|
3079
3564
|
//#region src/api/positionMapping.ts
|
|
3080
|
-
function
|
|
3565
|
+
function Ji(e, t, n = "left") {
|
|
3081
3566
|
let r = e.getExtension("yPositionMapping");
|
|
3082
3567
|
if (r) return r.mapPosition(t, n);
|
|
3083
3568
|
let i = e.getExtension("positionMapping");
|
|
@@ -3086,7 +3571,7 @@ function qr(e, t, n = "left") {
|
|
|
3086
3571
|
}
|
|
3087
3572
|
//#endregion
|
|
3088
3573
|
//#region src/extensions/SuggestionMenu/SuggestionMenu.ts
|
|
3089
|
-
var
|
|
3574
|
+
var Yi = ne((e) => e.type.name === "blockContainer"), Xi = class {
|
|
3090
3575
|
editor;
|
|
3091
3576
|
state;
|
|
3092
3577
|
emitUpdate;
|
|
@@ -3101,11 +3586,11 @@ var Jr = m((e) => e.type.name === "blockContainer"), Yr = class {
|
|
|
3101
3586
|
});
|
|
3102
3587
|
}, this.rootEl = n.root, this.rootEl?.addEventListener("scroll", this.handleScroll, !0);
|
|
3103
3588
|
}
|
|
3104
|
-
handleScroll = () => {
|
|
3589
|
+
handleScroll = (e) => {
|
|
3105
3590
|
if (this.state?.show) {
|
|
3106
|
-
let
|
|
3107
|
-
if (!e) return;
|
|
3108
|
-
this.state.referencePos =
|
|
3591
|
+
let t = this.rootEl?.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);
|
|
3592
|
+
if (!t || e.target instanceof Node && !e.target.contains(t)) return;
|
|
3593
|
+
this.state.referencePos = t.getBoundingClientRect().toJSON(), this.emitUpdate(this.pluginState.triggerCharacter);
|
|
3109
3594
|
}
|
|
3110
3595
|
};
|
|
3111
3596
|
update(e, t) {
|
|
@@ -3134,7 +3619,7 @@ var Jr = m((e) => e.type.name === "blockContainer"), Yr = class {
|
|
|
3134
3619
|
to: this.editor.transact((e) => e.selection.from)
|
|
3135
3620
|
}).run();
|
|
3136
3621
|
};
|
|
3137
|
-
}, Q = new
|
|
3622
|
+
}, Q = new l("SuggestionMenuPlugin"), Zi = r(({ editor: t }) => {
|
|
3138
3623
|
let n = /* @__PURE__ */ new Map(), r, i = e(void 0);
|
|
3139
3624
|
return {
|
|
3140
3625
|
key: "suggestionMenu",
|
|
@@ -3161,9 +3646,9 @@ var Jr = m((e) => e.type.name === "blockContainer"), Yr = class {
|
|
|
3161
3646
|
});
|
|
3162
3647
|
}));
|
|
3163
3648
|
},
|
|
3164
|
-
prosemirrorPlugins: [new
|
|
3649
|
+
prosemirrorPlugins: [new c({
|
|
3165
3650
|
key: Q,
|
|
3166
|
-
view: (e) => (r = new
|
|
3651
|
+
view: (e) => (r = new Xi(t, (e, t) => {
|
|
3167
3652
|
i.setState({
|
|
3168
3653
|
...t,
|
|
3169
3654
|
triggerCharacter: e
|
|
@@ -3176,7 +3661,7 @@ var Jr = m((e) => e.type.name === "blockContainer"), Yr = class {
|
|
|
3176
3661
|
let o = e.getMeta(Q);
|
|
3177
3662
|
if (typeof o == "object" && o) {
|
|
3178
3663
|
n && r?.closeMenu();
|
|
3179
|
-
let e =
|
|
3664
|
+
let e = Ji(t, a.selection.from - o.triggerCharacter.length);
|
|
3180
3665
|
return {
|
|
3181
3666
|
triggerCharacter: o.triggerCharacter,
|
|
3182
3667
|
deleteTriggerCharacter: o.deleteTriggerCharacter !== !1,
|
|
@@ -3208,7 +3693,7 @@ var Jr = m((e) => e.type.name === "blockContainer"), Yr = class {
|
|
|
3208
3693
|
let t = this.getState(e);
|
|
3209
3694
|
if (t === void 0) return null;
|
|
3210
3695
|
if (!t.deleteTriggerCharacter) {
|
|
3211
|
-
let n =
|
|
3696
|
+
let n = Yi(e.selection);
|
|
3212
3697
|
if (n) return Se.create(e.doc, [xe.node(n.pos, n.pos + n.node.nodeSize, {
|
|
3213
3698
|
nodeName: "span",
|
|
3214
3699
|
class: "bn-suggestion-decorator",
|
|
@@ -3227,7 +3712,7 @@ var Jr = m((e) => e.type.name === "blockContainer"), Yr = class {
|
|
|
3227
3712
|
});
|
|
3228
3713
|
//#endregion
|
|
3229
3714
|
//#region src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts
|
|
3230
|
-
function
|
|
3715
|
+
function Qi(e) {
|
|
3231
3716
|
let t = e.getTextCursorPosition().block, n = e.schema.blockSchema[t.type].content;
|
|
3232
3717
|
for (; n === "none";) {
|
|
3233
3718
|
if (t = e.getTextCursorPosition().nextBlock, t === void 0) {
|
|
@@ -3242,68 +3727,29 @@ function $(e, t) {
|
|
|
3242
3727
|
let n = e.getTextCursorPosition().block;
|
|
3243
3728
|
if (n.content === void 0) throw Error("Slash Menu open in a block that doesn't contain content.");
|
|
3244
3729
|
let r;
|
|
3245
|
-
return Array.isArray(n.content) && (n.content.length === 1 && S(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (r = e.updateBlock(n, t), e.setTextCursorPosition(r)) : (r = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)),
|
|
3730
|
+
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)), Qi(e), r;
|
|
3246
3731
|
}
|
|
3247
|
-
function
|
|
3248
|
-
let t = [];
|
|
3249
|
-
|
|
3250
|
-
|
|
3732
|
+
function $i(e) {
|
|
3733
|
+
let t = [], n = new Map(qi(e).map((e) => [e.key, e]));
|
|
3734
|
+
function r(r, i) {
|
|
3735
|
+
let a = n.get(r);
|
|
3736
|
+
a && t.push({
|
|
3251
3737
|
onItemClick: () => {
|
|
3252
3738
|
$(e, {
|
|
3253
|
-
type:
|
|
3254
|
-
props:
|
|
3739
|
+
type: a.type,
|
|
3740
|
+
props: a.props
|
|
3255
3741
|
});
|
|
3256
3742
|
},
|
|
3257
|
-
badge:
|
|
3258
|
-
key:
|
|
3259
|
-
...e.dictionary.slash_menu[
|
|
3743
|
+
badge: i,
|
|
3744
|
+
key: r,
|
|
3745
|
+
...e.dictionary.slash_menu[r]
|
|
3260
3746
|
});
|
|
3261
|
-
}
|
|
3262
|
-
|
|
3263
|
-
$(e, { type: "quote" });
|
|
3264
|
-
},
|
|
3265
|
-
key: "quote",
|
|
3266
|
-
...e.dictionary.slash_menu.quote
|
|
3267
|
-
}), X(e, "toggleListItem") && t.push({
|
|
3268
|
-
onItemClick: () => {
|
|
3269
|
-
$(e, { type: "toggleListItem" });
|
|
3270
|
-
},
|
|
3271
|
-
badge: k("Mod-Shift-6"),
|
|
3272
|
-
key: "toggle_list",
|
|
3273
|
-
...e.dictionary.slash_menu.toggle_list
|
|
3274
|
-
}), X(e, "numberedListItem") && t.push({
|
|
3275
|
-
onItemClick: () => {
|
|
3276
|
-
$(e, { type: "numberedListItem" });
|
|
3277
|
-
},
|
|
3278
|
-
badge: k("Mod-Shift-7"),
|
|
3279
|
-
key: "numbered_list",
|
|
3280
|
-
...e.dictionary.slash_menu.numbered_list
|
|
3281
|
-
}), X(e, "bulletListItem") && t.push({
|
|
3282
|
-
onItemClick: () => {
|
|
3283
|
-
$(e, { type: "bulletListItem" });
|
|
3284
|
-
},
|
|
3285
|
-
badge: k("Mod-Shift-8"),
|
|
3286
|
-
key: "bullet_list",
|
|
3287
|
-
...e.dictionary.slash_menu.bullet_list
|
|
3288
|
-
}), X(e, "checkListItem") && t.push({
|
|
3289
|
-
onItemClick: () => {
|
|
3290
|
-
$(e, { type: "checkListItem" });
|
|
3291
|
-
},
|
|
3292
|
-
badge: k("Mod-Shift-9"),
|
|
3293
|
-
key: "check_list",
|
|
3294
|
-
...e.dictionary.slash_menu.check_list
|
|
3295
|
-
}), X(e, "paragraph") && t.push({
|
|
3296
|
-
onItemClick: () => {
|
|
3297
|
-
$(e, { type: "paragraph" });
|
|
3298
|
-
},
|
|
3299
|
-
badge: k("Mod-Alt-0"),
|
|
3300
|
-
key: "paragraph",
|
|
3301
|
-
...e.dictionary.slash_menu.paragraph
|
|
3302
|
-
}), X(e, "codeBlock") && t.push({
|
|
3747
|
+
}
|
|
3748
|
+
return r("heading", D("Mod-Alt-1")), r("heading_2", D("Mod-Alt-2")), r("heading_3", D("Mod-Alt-3")), r("quote"), r("toggle_list", D("Mod-Shift-6")), r("numbered_list", D("Mod-Shift-7")), r("bullet_list", D("Mod-Shift-8")), r("check_list", D("Mod-Shift-9")), r("paragraph", D("Mod-Alt-0")), X(e, "codeBlock") && t.push({
|
|
3303
3749
|
onItemClick: () => {
|
|
3304
3750
|
$(e, { type: "codeBlock" });
|
|
3305
3751
|
},
|
|
3306
|
-
badge:
|
|
3752
|
+
badge: D("Mod-Alt-c"),
|
|
3307
3753
|
key: "code_block",
|
|
3308
3754
|
...e.dictionary.slash_menu.code_block
|
|
3309
3755
|
}), X(e, "divider") && t.push({
|
|
@@ -3336,63 +3782,34 @@ function Qr(e) {
|
|
|
3336
3782
|
}), X(e, "image", { url: "string" }) && t.push({
|
|
3337
3783
|
onItemClick: () => {
|
|
3338
3784
|
let t = $(e, { type: "image" });
|
|
3339
|
-
e.getExtension(
|
|
3785
|
+
e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3340
3786
|
},
|
|
3341
3787
|
key: "image",
|
|
3342
3788
|
...e.dictionary.slash_menu.image
|
|
3343
3789
|
}), X(e, "video", { url: "string" }) && t.push({
|
|
3344
3790
|
onItemClick: () => {
|
|
3345
3791
|
let t = $(e, { type: "video" });
|
|
3346
|
-
e.getExtension(
|
|
3792
|
+
e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3347
3793
|
},
|
|
3348
3794
|
key: "video",
|
|
3349
3795
|
...e.dictionary.slash_menu.video
|
|
3350
3796
|
}), X(e, "audio", { url: "string" }) && t.push({
|
|
3351
3797
|
onItemClick: () => {
|
|
3352
3798
|
let t = $(e, { type: "audio" });
|
|
3353
|
-
e.getExtension(
|
|
3799
|
+
e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3354
3800
|
},
|
|
3355
3801
|
key: "audio",
|
|
3356
3802
|
...e.dictionary.slash_menu.audio
|
|
3357
3803
|
}), X(e, "file", { url: "string" }) && t.push({
|
|
3358
3804
|
onItemClick: () => {
|
|
3359
3805
|
let t = $(e, { type: "file" });
|
|
3360
|
-
e.getExtension(
|
|
3806
|
+
e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
|
|
3361
3807
|
},
|
|
3362
3808
|
key: "file",
|
|
3363
3809
|
...e.dictionary.slash_menu.file
|
|
3364
|
-
}),
|
|
3365
|
-
level: "number",
|
|
3366
|
-
isToggleable: "boolean"
|
|
3367
|
-
}) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((e) => e <= 3).forEach((n) => {
|
|
3368
|
-
t.push({
|
|
3369
|
-
onItemClick: () => {
|
|
3370
|
-
$(e, {
|
|
3371
|
-
type: "heading",
|
|
3372
|
-
props: {
|
|
3373
|
-
level: n,
|
|
3374
|
-
isToggleable: !0
|
|
3375
|
-
}
|
|
3376
|
-
});
|
|
3377
|
-
},
|
|
3378
|
-
key: n === 1 ? "toggle_heading" : `toggle_heading_${n}`,
|
|
3379
|
-
...e.dictionary.slash_menu[n === 1 ? "toggle_heading" : `toggle_heading_${n}`]
|
|
3380
|
-
});
|
|
3381
|
-
}), X(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((e) => e > 3).forEach((n) => {
|
|
3382
|
-
t.push({
|
|
3383
|
-
onItemClick: () => {
|
|
3384
|
-
$(e, {
|
|
3385
|
-
type: "heading",
|
|
3386
|
-
props: { level: n }
|
|
3387
|
-
});
|
|
3388
|
-
},
|
|
3389
|
-
badge: k(`Mod-Alt-${n}`),
|
|
3390
|
-
key: `heading_${n}`,
|
|
3391
|
-
...e.dictionary.slash_menu[`heading_${n}`]
|
|
3392
|
-
});
|
|
3393
|
-
}), t.push({
|
|
3810
|
+
}), r("toggle_heading"), r("toggle_heading_2"), r("toggle_heading_3"), r("heading_4", D("Mod-Alt-4")), r("heading_5", D("Mod-Alt-5")), r("heading_6", D("Mod-Alt-6")), t.push({
|
|
3394
3811
|
onItemClick: () => {
|
|
3395
|
-
e.getExtension(
|
|
3812
|
+
e.getExtension(Zi)?.openSuggestionMenu(":", {
|
|
3396
3813
|
deleteTriggerCharacter: !0,
|
|
3397
3814
|
ignoreQueryLength: !0
|
|
3398
3815
|
});
|
|
@@ -3401,17 +3818,17 @@ function Qr(e) {
|
|
|
3401
3818
|
...e.dictionary.slash_menu.emoji
|
|
3402
3819
|
}), t;
|
|
3403
3820
|
}
|
|
3404
|
-
function
|
|
3821
|
+
function ea(e, t) {
|
|
3405
3822
|
return e.filter(({ title: e, aliases: n }) => e.toLowerCase().includes(t.toLowerCase()) || n && n.filter((e) => e.toLowerCase().includes(t.toLowerCase())).length !== 0);
|
|
3406
3823
|
}
|
|
3407
3824
|
//#endregion
|
|
3408
3825
|
//#region src/blocks/PageBreak/getPageBreakSlashMenuItems.ts
|
|
3409
|
-
function
|
|
3826
|
+
function ta(e) {
|
|
3410
3827
|
return "pageBreak" in e.schema.blockSchema;
|
|
3411
3828
|
}
|
|
3412
|
-
function
|
|
3829
|
+
function na(e) {
|
|
3413
3830
|
let t = [];
|
|
3414
|
-
return
|
|
3831
|
+
return ta(e) && t.push({
|
|
3415
3832
|
...e.dictionary.slash_menu.page_break,
|
|
3416
3833
|
onItemClick: () => {
|
|
3417
3834
|
$(e, { type: "pageBreak" });
|
|
@@ -3421,22 +3838,22 @@ function ti(e) {
|
|
|
3421
3838
|
}
|
|
3422
3839
|
//#endregion
|
|
3423
3840
|
//#region src/blocks/defaultBlocks.ts
|
|
3424
|
-
var
|
|
3425
|
-
audio:
|
|
3426
|
-
bulletListItem:
|
|
3427
|
-
checkListItem:
|
|
3428
|
-
codeBlock:
|
|
3429
|
-
divider:
|
|
3430
|
-
file:
|
|
3431
|
-
heading:
|
|
3432
|
-
image:
|
|
3433
|
-
numberedListItem:
|
|
3434
|
-
paragraph:
|
|
3435
|
-
quote:
|
|
3436
|
-
table:
|
|
3437
|
-
toggleListItem:
|
|
3438
|
-
video:
|
|
3439
|
-
},
|
|
3841
|
+
var ra = {
|
|
3842
|
+
audio: Er(),
|
|
3843
|
+
bulletListItem: li(),
|
|
3844
|
+
checkListItem: di(),
|
|
3845
|
+
codeBlock: Ir(),
|
|
3846
|
+
divider: Rr(),
|
|
3847
|
+
file: Hr(),
|
|
3848
|
+
heading: Qr(),
|
|
3849
|
+
image: oi(),
|
|
3850
|
+
numberedListItem: gi(),
|
|
3851
|
+
paragraph: Ci(),
|
|
3852
|
+
quote: Ti(),
|
|
3853
|
+
table: Ii(),
|
|
3854
|
+
toggleListItem: vi(),
|
|
3855
|
+
video: Vi()
|
|
3856
|
+
}, ia = Mn({
|
|
3440
3857
|
type: "textColor",
|
|
3441
3858
|
propSchema: "string"
|
|
3442
3859
|
}, {
|
|
@@ -3449,7 +3866,7 @@ var ni = {
|
|
|
3449
3866
|
},
|
|
3450
3867
|
toExternalHTML: (e) => {
|
|
3451
3868
|
let t = document.createElement("span");
|
|
3452
|
-
return e !==
|
|
3869
|
+
return e !== K.textColor.default && (t.style.color = e in G ? G[e].text : e), {
|
|
3453
3870
|
dom: t,
|
|
3454
3871
|
contentDOM: t
|
|
3455
3872
|
};
|
|
@@ -3457,7 +3874,7 @@ var ni = {
|
|
|
3457
3874
|
parse: (e) => {
|
|
3458
3875
|
if (e.tagName === "SPAN" && e.style.color) return e.style.color;
|
|
3459
3876
|
}
|
|
3460
|
-
}),
|
|
3877
|
+
}), aa = Mn({
|
|
3461
3878
|
type: "backgroundColor",
|
|
3462
3879
|
propSchema: "string"
|
|
3463
3880
|
}, {
|
|
@@ -3470,7 +3887,7 @@ var ni = {
|
|
|
3470
3887
|
},
|
|
3471
3888
|
toExternalHTML: (e) => {
|
|
3472
3889
|
let t = document.createElement("span");
|
|
3473
|
-
return e !==
|
|
3890
|
+
return e !== K.backgroundColor.default && (t.style.backgroundColor = e in G ? G[e].background : e), {
|
|
3474
3891
|
dom: t,
|
|
3475
3892
|
contentDOM: t
|
|
3476
3893
|
};
|
|
@@ -3478,26 +3895,31 @@ var ni = {
|
|
|
3478
3895
|
parse: (e) => {
|
|
3479
3896
|
if (e.tagName === "SPAN" && e.style.backgroundColor) return e.style.backgroundColor;
|
|
3480
3897
|
}
|
|
3481
|
-
}),
|
|
3482
|
-
bold:
|
|
3483
|
-
italic:
|
|
3484
|
-
underline:
|
|
3485
|
-
strike:
|
|
3486
|
-
code:
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
}
|
|
3898
|
+
}), oa = {
|
|
3899
|
+
bold: z(Ce, "boolean"),
|
|
3900
|
+
italic: z(Te, "boolean"),
|
|
3901
|
+
underline: z(De, "boolean"),
|
|
3902
|
+
strike: z(Ee, "boolean"),
|
|
3903
|
+
code: z(we.extend({
|
|
3904
|
+
excludes() {
|
|
3905
|
+
return t(this.editor);
|
|
3906
|
+
},
|
|
3907
|
+
addInputRules() {
|
|
3908
|
+
return [ae({
|
|
3909
|
+
find: /(^|[^`])`([^`]+)`(?!`)$/,
|
|
3910
|
+
type: this.type
|
|
3911
|
+
}), new h({
|
|
3912
|
+
find: /(^|[^`])`([^`]+)`(?!`) $/,
|
|
3913
|
+
handler: ({ state: e, range: t, match: n }) => {
|
|
3914
|
+
let { tr: r, schema: i } = e, a = n[1], o = n[2];
|
|
3915
|
+
r.replaceWith(t.from + a.length, t.to, [i.text(o, [this.type.create()]), i.text(" ")]);
|
|
3916
|
+
}
|
|
3917
|
+
})];
|
|
3918
|
+
}
|
|
3919
|
+
}), "boolean"),
|
|
3920
|
+
textColor: ia,
|
|
3921
|
+
backgroundColor: aa
|
|
3922
|
+
}, sa = An(oa), ca = {
|
|
3501
3923
|
text: {
|
|
3502
3924
|
config: "text",
|
|
3503
3925
|
implementation: {}
|
|
@@ -3506,16 +3928,16 @@ var ni = {
|
|
|
3506
3928
|
config: "link",
|
|
3507
3929
|
implementation: {}
|
|
3508
3930
|
}
|
|
3509
|
-
},
|
|
3931
|
+
}, la = Dn(ca), ua = class e extends Un {
|
|
3510
3932
|
static create(t) {
|
|
3511
3933
|
return new e({
|
|
3512
|
-
blockSpecs: t?.blockSpecs ??
|
|
3513
|
-
inlineContentSpecs: t?.inlineContentSpecs ??
|
|
3514
|
-
styleSpecs: t?.styleSpecs ??
|
|
3934
|
+
blockSpecs: t?.blockSpecs ?? ra,
|
|
3935
|
+
inlineContentSpecs: t?.inlineContentSpecs ?? ca,
|
|
3936
|
+
styleSpecs: t?.styleSpecs ?? oa
|
|
3515
3937
|
});
|
|
3516
3938
|
}
|
|
3517
3939
|
};
|
|
3518
3940
|
//#endregion
|
|
3519
|
-
export {
|
|
3941
|
+
export { Kr as $, xt as $n, Tn as $t, Si as A, Lt as An, Ve as Ar, ar as At, ui as B, Ot as Bn, Yn as Bt, Bi as C, Gt as Cn, Qe as Cr, fr as Ct, Ei as D, P as Dn, We as Dr, G as Dt, Di as E, Ut as En, Xe as Er, lr as Et, _i as F, N as Fn, je as Fr, Zn as Ft, oi as G, k as Gn, R as Gt, li as H, At as Hn, Bn as Ht, vi as I, Rt as In, Fe as Ir, qn as It, ai as J, wt as Jn, An as Jt, ri as K, St as Kn, kn as Kt, hi as L, j as Ln, Kn as Lt, yi as M, Ft as Mn, Oe as Mr, tr as Mt, bi as N, It as Nn, Ae as Nr, er as Nt, wi as O, Ht as On, Je as Or, cr as Ot, xi as P, Nt as Pn, y as Pr, $n as Pt, Wr as Q, vt as Qn, En as Qt, gi as R, A as Rn, Wn as Rt, Vi as S, Yt as Sn, $e as Sr, ur as St, ki as T, Bt as Tn, Ge as Tr, q as Tt, ti as U, Dt as Un, Mn as Ut, ci as V, kt as Vn, Un as Vt, ni as W, Tt as Wn, jn as Wt, Qr as X, yt as Xn, Cn as Xt, Zr as Y, D as Yn, On as Yt, qr as Z, _t as Zn, wn as Zt, X as _, nn as _n, tt as _r, Er as _t, sa as a, gn as an, C as ar, Fr as at, Ri as b, qt as bn, qe as br, J as bt, na as c, pn as cn, ft as cr, Mr as ct, $ as d, dn, dt as dr, Or as dt, Dn as en, O as er, Br as et, Zi as f, sn as fn, rt as fr, xr as ft, Hi as g, Jt as gn, Be as gr, Sr as gt, qi as h, Zt as hn, ze as hr, Tr as ht, ca as i, L as in, T as ir, Rr as it, Ci as j, M as jn, Re as jr, Qn as jt, Ti as k, Wt as kn, Ye as kr, W as kt, ea as l, ln, pt as lr, kr as lt, Z as m, Kt as mn, et as mr, wr as mt, ra as n, mn as nn, gt as nr, Vr as nt, oa as o, _n as on, ht as or, Ir as ot, Ji as p, F as pn, nt as pr, Cr as pt, ii as q, Ct as qn, z as qt, la as r, I as rn, w as rr, Lr as rt, ta as s, fn as sn, mt as sr, Nr as st, ua as t, Sn as tn, E as tr, Hr as tt, $i as u, cn as un, S as ur, Dr as ut, Wi as v, en as vn, x as vr, br as vt, Ii as w, Vt as wn, Ze as wr, dr as wt, zi as x, Xt as xn, Ke as xr, K as xt, Ui as y, tn as yn, b as yr, Y as yt, di as z, Mt as zn, Jn as zt };
|
|
3520
3942
|
|
|
3521
|
-
//# sourceMappingURL=blocks-
|
|
3943
|
+
//# sourceMappingURL=blocks-COYcDVg7.js.map
|