@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,4 +1,5 @@
|
|
|
1
1
|
import { Mark } from "@tiptap/core";
|
|
2
|
+
import { Mark as PMMark } from "prosemirror-model";
|
|
2
3
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
3
4
|
/**
|
|
4
5
|
* Describes a suggestion mark to {@link GetAttributionMarkClassName}: whether it
|
|
@@ -8,7 +9,7 @@ import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
|
8
9
|
*/
|
|
9
10
|
export type AttributionMarkStyleInfo = {
|
|
10
11
|
contentType: "inline-content" | "block";
|
|
11
|
-
modificationType: "insert" | "delete" | "format";
|
|
12
|
+
modificationType: "insert" | "delete" | "format" | "attrs";
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* The class name(s) an app returns to style a suggestion mark. Either:
|
|
@@ -37,6 +38,13 @@ export type GetAttributionMarkClassName = (info: AttributionMarkStyleInfo) => At
|
|
|
37
38
|
* target (the mark `content` or its `tooltip`).
|
|
38
39
|
*/
|
|
39
40
|
export declare const resolveAttributionMarkClassName: (result: AttributionMarkClassNames | undefined, target: "content" | "tooltip") => string | undefined;
|
|
41
|
+
/** The upstream attribute mark stores authors separately for each changed property. */
|
|
42
|
+
export type AttributeChanges = Record<string, {
|
|
43
|
+
userIds: string[];
|
|
44
|
+
timestamp: number | null;
|
|
45
|
+
}>;
|
|
46
|
+
export declare function getAttributeChanges(mark: PMMark): AttributeChanges;
|
|
47
|
+
export declare function getAttributionUserIds(mark: PMMark): string[];
|
|
40
48
|
export declare const YAttributedInsertion: Mark<{
|
|
41
49
|
getAttributionMarkClassName?: GetAttributionMarkClassName;
|
|
42
50
|
}, any>;
|
|
@@ -47,8 +55,11 @@ export declare const YAttributedDeletion: Mark<{
|
|
|
47
55
|
export declare const YAttributedFormat: Mark<{
|
|
48
56
|
getAttributionMarkClassName?: GetAttributionMarkClassName;
|
|
49
57
|
}, any>;
|
|
58
|
+
export declare const YAttributedAttributes: Mark<{
|
|
59
|
+
getAttributionMarkClassName?: GetAttributionMarkClassName;
|
|
60
|
+
}, any>;
|
|
50
61
|
/**
|
|
51
|
-
* Bundles the
|
|
62
|
+
* Bundles the four `y-attributed-*` suggestion marks into a single BlockNote
|
|
52
63
|
* extension, so they can be registered wherever they're actually needed (the
|
|
53
64
|
* Yjs collaboration extension, or a test that exercises suggestions) instead of
|
|
54
65
|
* living in the default schema. The marks opt into being allowed on block nodes
|
|
@@ -9,6 +9,7 @@ export declare const YCursorExtension: (options: CollaborationOptions) => import
|
|
|
9
9
|
readonly key: "yCursor";
|
|
10
10
|
readonly prosemirrorPlugins: import("prosemirror-state").Plugin<import("prosemirror-view").DecorationSet>[];
|
|
11
11
|
readonly dependsOn: readonly ["ySync"];
|
|
12
|
+
readonly clearCursor: () => void;
|
|
12
13
|
readonly updateUser: (user: CollaborationUser) => void;
|
|
13
14
|
readonly getUser: () => CollaborationUser | undefined;
|
|
14
15
|
}>;
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
import { CollaborationOptions } from "./index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Maps a Y attribution to BlockNote's `y-attributed-*` mark attrs.
|
|
4
|
-
*
|
|
5
|
-
* The mapper must be deterministic in `(format, attribution)` and emit attrs
|
|
6
|
-
* that exactly match the declared mark schema in YAttributionMarks.ts. Any
|
|
7
|
-
* mismatch causes the sync plugin to fire phantom reconcile dispatches in a
|
|
8
|
-
* loop. See ATTRIBUTION.md in @y/prosemirror.
|
|
9
|
-
*
|
|
10
|
-
* Crucially the marks carry only stable identity (`userIds`, plus `format` for
|
|
11
|
-
* the modification mark) — *not* user colors. Colors resolve asynchronously
|
|
12
|
-
* from the {@link UserStore}, so baking them in here would make the mapper's
|
|
13
|
-
* output change under a fixed `(format, attribution)` once a user loads, which
|
|
14
|
-
* is exactly the non-determinism that triggers the reconcile loop. Instead the
|
|
15
|
-
* `AttributionExtension` applies colors as a decoration layer that can
|
|
16
|
-
* update independently of the mark representation.
|
|
17
|
-
*/
|
|
18
2
|
export declare const mapAttributionToMark: (format: Record<string, unknown> | null, attribution: {
|
|
19
3
|
insert?: readonly string[];
|
|
20
4
|
delete?: readonly string[];
|
|
@@ -25,8 +9,10 @@ export declare const mapAttributionToMark: (format: Record<string, unknown> | nu
|
|
|
25
9
|
}) => Record<string, unknown>;
|
|
26
10
|
export declare const YSyncExtension: (options: Pick<CollaborationOptions, "fragment" | "getAttributionMarkClassName" | "provider" | "renderer" | "suggestionDoc">) => import("../../index.js").ExtensionFactoryInstance<{
|
|
27
11
|
readonly key: "ySync";
|
|
28
|
-
readonly fragment: import("@y/y").
|
|
29
|
-
readonly mount: (
|
|
12
|
+
readonly fragment: import("@y/y").Node<any>;
|
|
13
|
+
readonly mount: ({ signal }: {
|
|
14
|
+
signal: AbortSignal;
|
|
15
|
+
}) => (() => void) | undefined;
|
|
30
16
|
readonly prosemirrorPlugins: readonly [import("prosemirror-state").Plugin<any>];
|
|
31
17
|
readonly runsBefore: readonly ["default"];
|
|
32
18
|
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,25 +1,3 @@
|
|
|
1
1
|
import { $prosemirrorDelta } from "@y/prosemirror";
|
|
2
2
|
import * as schema from "lib0/schema";
|
|
3
|
-
/**
|
|
4
|
-
* BlockNote's node-pairing policy for y-prosemirror's `matchNodes` option
|
|
5
|
-
* (forwarded to `lib0/delta.diff`). This is the schema-specific bit that lives
|
|
6
|
-
* in userland - the binding itself stays schema-agnostic.
|
|
7
|
-
*
|
|
8
|
-
* A `blockContainer` holds exactly one block content (`blockContent
|
|
9
|
-
* blockGroup?`). Diffing a *type change* of that content as an in-place child
|
|
10
|
-
* delete+insert would, under a suggestion, tombstone the old content next to the
|
|
11
|
-
* new one => two block-contents in one container => schema-invalid. So we
|
|
12
|
-
* declare a container's identity to be its first block-content child's type:
|
|
13
|
-
* when that changes, the two containers are reported as *different*, the PM->Y
|
|
14
|
-
* diff replaces the whole container, and the deleted + inserted containers sit
|
|
15
|
-
* as siblings in the blockGroup (`blockGroupChild+` allows that). Each carries
|
|
16
|
-
* the `y-attributed-*` node mark - which `blockContainer` already whitelists -
|
|
17
|
-
* so no schema change and no storage transform are needed. A plain text edit
|
|
18
|
-
* keeps the same first-child type => same identity => the diff descends and
|
|
19
|
-
* merges as usual.
|
|
20
|
-
*
|
|
21
|
-
* @param a removed (old) node
|
|
22
|
-
* @param b inserted (new) node
|
|
23
|
-
* @returns whether `a` and `b` are the same node (diff in place) vs different (replace)
|
|
24
|
-
*/
|
|
25
3
|
export declare const blockMatchNodes: (a: schema.Unwrap<typeof $prosemirrorDelta>, b: schema.Unwrap<typeof $prosemirrorDelta>) => boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Awareness } from "@y/protocols/awareness";
|
|
2
2
|
import type * as Y from "@y/y";
|
|
3
3
|
import { BlockNoteEditorOptions } from "../../editor/BlockNoteEditor.js";
|
|
4
|
-
import { VersioningEndpoints, VersioningEndpointsFactory } from "../../extensions/Versioning/index.js";
|
|
5
4
|
import { UserStoreOrResolver } from "../../user/index.js";
|
|
6
5
|
import { CollaborationUser } from "./YCursorPlugin.js";
|
|
7
6
|
import type { GetAttributionMarkClassName } from "./YAttributionMarks.js";
|
|
@@ -9,7 +8,7 @@ export type CollaborationOptions = {
|
|
|
9
8
|
/**
|
|
10
9
|
* The Yjs Type that's used for collaboration.
|
|
11
10
|
*/
|
|
12
|
-
fragment: Y.
|
|
11
|
+
fragment: Y.Node;
|
|
13
12
|
/**
|
|
14
13
|
* The user info for the current user that's shown to other collaborators.
|
|
15
14
|
*/
|
|
@@ -58,44 +57,12 @@ export type CollaborationOptions = {
|
|
|
58
57
|
* dropped for that mark. See {@link GetAttributionMarkClassName}.
|
|
59
58
|
*/
|
|
60
59
|
getAttributionMarkClassName?: GetAttributionMarkClassName;
|
|
61
|
-
/**
|
|
62
|
-
* The endpoints for the versioning functionality.
|
|
63
|
-
*/
|
|
64
|
-
versioningEndpoints?: VersioningEndpoints<Y.Type, Uint8Array> | VersioningEndpointsFactory<Y.Type, Uint8Array>;
|
|
65
60
|
};
|
|
66
61
|
export declare const CollaborationExtension: (options: CollaborationOptions) => import("../../index.js").ExtensionFactoryInstance<{
|
|
67
62
|
readonly key: "collaboration";
|
|
63
|
+
readonly fragment: Y.Node<any>;
|
|
68
64
|
readonly userStore: import("../../index.js").UserStore<import("../../index.js").User>;
|
|
69
65
|
readonly blockNoteExtensions: (import("../../index.js").ExtensionFactoryInstance<{
|
|
70
|
-
readonly key: "versioning";
|
|
71
|
-
readonly store: import("../../index.js").Store<{
|
|
72
|
-
snapshots: import("../../index.js").VersionSnapshot[];
|
|
73
|
-
previewedSnapshotId?: string | typeof import("../../index.js").CURRENT_VERSION_ID;
|
|
74
|
-
compareToSnapshotId?: string | typeof import("../../index.js").CURRENT_VERSION_ID;
|
|
75
|
-
}>;
|
|
76
|
-
readonly userStore: import("../../index.js").UserStore<import("../../index.js").User>;
|
|
77
|
-
readonly list: () => Promise<import("../../index.js").VersionSnapshot[]>;
|
|
78
|
-
readonly canCompare: boolean;
|
|
79
|
-
readonly canCreate: boolean;
|
|
80
|
-
readonly create: ((options?: {
|
|
81
|
-
name?: string;
|
|
82
|
-
restoredFromSnapshot?: import("../../index.js").VersionSnapshotIdentifier;
|
|
83
|
-
}) => Promise<import("../../index.js").VersionSnapshot>) | undefined;
|
|
84
|
-
readonly canRestore: boolean;
|
|
85
|
-
readonly restore: ((id: import("../../index.js").VersionSnapshotIdentifier) => Promise<any>) | undefined;
|
|
86
|
-
readonly canRename: boolean;
|
|
87
|
-
readonly rename: ((id: import("../../index.js").VersionSnapshotIdentifier, name?: string) => Promise<void>) | undefined;
|
|
88
|
-
readonly canRemove: boolean;
|
|
89
|
-
readonly remove: ((id: import("../../index.js").VersionSnapshotIdentifier) => Promise<void>) | undefined;
|
|
90
|
-
readonly previewSnapshot: (id: import("../../index.js").VersionSnapshotIdentifier, previewOptions?: {
|
|
91
|
-
compareTo?: import("../../index.js").VersionSnapshotIdentifier;
|
|
92
|
-
}) => Promise<void>;
|
|
93
|
-
readonly canPreviewCurrent: boolean;
|
|
94
|
-
readonly previewCurrentVersion: ((previewOptions?: {
|
|
95
|
-
compareTo?: import("../../index.js").VersionSnapshotIdentifier;
|
|
96
|
-
}) => Promise<void>) | undefined;
|
|
97
|
-
readonly exitPreview: () => void;
|
|
98
|
-
}> | import("../../index.js").ExtensionFactoryInstance<{
|
|
99
66
|
key: string;
|
|
100
67
|
userStore: import("../../index.js").UserStore<import("../../index.js").User>;
|
|
101
68
|
store: import("../../index.js").Store<import("./AttributionExtension.js").AttributionTooltipState | undefined>;
|
|
@@ -114,6 +81,25 @@ export declare const CollaborationExtension: (options: CollaborationOptions) =>
|
|
|
114
81
|
getAttributionMarkClassName?: GetAttributionMarkClassName;
|
|
115
82
|
}, any>)[];
|
|
116
83
|
}>[];
|
|
84
|
+
}> | import("../../index.js").ExtensionFactoryInstance<{
|
|
85
|
+
readonly key: "yCursor";
|
|
86
|
+
readonly prosemirrorPlugins: import("prosemirror-state").Plugin<import("prosemirror-view").DecorationSet>[];
|
|
87
|
+
readonly dependsOn: readonly ["ySync"];
|
|
88
|
+
readonly clearCursor: () => void;
|
|
89
|
+
readonly updateUser: (user: CollaborationUser) => void;
|
|
90
|
+
readonly getUser: () => CollaborationUser | undefined;
|
|
91
|
+
}> | import("../../index.js").ExtensionFactoryInstance<{
|
|
92
|
+
readonly key: "yForkDoc";
|
|
93
|
+
readonly store: import("../../index.js").Store<{
|
|
94
|
+
isForked: boolean;
|
|
95
|
+
}>;
|
|
96
|
+
readonly fork: ({ initialUpdate, }?: {
|
|
97
|
+
initialUpdate?: Uint8Array;
|
|
98
|
+
}) => void;
|
|
99
|
+
readonly merge: ({ keepChanges, renderer, }: {
|
|
100
|
+
keepChanges: boolean;
|
|
101
|
+
renderer?: Y.DiffRenderer | null;
|
|
102
|
+
}) => void;
|
|
117
103
|
}> | import("../../index.js").ExtensionFactoryInstance<{
|
|
118
104
|
readonly key: "yPositionMapping";
|
|
119
105
|
readonly mapPosition: (position: number, side?: "left" | "right") => () => number;
|
|
@@ -151,16 +137,12 @@ export declare const CollaborationExtension: (options: CollaborationOptions) =>
|
|
|
151
137
|
readonly position: DOMRect;
|
|
152
138
|
} | undefined;
|
|
153
139
|
readonly checkUnresolvedSuggestions: () => false;
|
|
154
|
-
}> | import("../../index.js").ExtensionFactoryInstance<{
|
|
155
|
-
readonly key: "yCursor";
|
|
156
|
-
readonly prosemirrorPlugins: import("prosemirror-state").Plugin<import("prosemirror-view").DecorationSet>[];
|
|
157
|
-
readonly dependsOn: readonly ["ySync"];
|
|
158
|
-
readonly updateUser: (user: CollaborationUser) => void;
|
|
159
|
-
readonly getUser: () => CollaborationUser | undefined;
|
|
160
140
|
}> | import("../../index.js").ExtensionFactoryInstance<{
|
|
161
141
|
readonly key: "ySync";
|
|
162
|
-
readonly fragment: Y.
|
|
163
|
-
readonly mount: (
|
|
142
|
+
readonly fragment: Y.Node<any>;
|
|
143
|
+
readonly mount: ({ signal }: {
|
|
144
|
+
signal: AbortSignal;
|
|
145
|
+
}) => (() => void) | undefined;
|
|
164
146
|
readonly prosemirrorPlugins: readonly [import("prosemirror-state").Plugin<any>];
|
|
165
147
|
readonly runsBefore: readonly ["default"];
|
|
166
148
|
}>)[];
|
|
@@ -173,9 +155,10 @@ export declare function withCollaboration<Options extends Partial<BlockNoteEdito
|
|
|
173
155
|
}): Options;
|
|
174
156
|
export * from "./AttributionExtension.js";
|
|
175
157
|
export * from "./DiffVersioningExtension.js";
|
|
158
|
+
export * from "./ForkYDoc.js";
|
|
159
|
+
export * from "./persistentBlockGroups.js";
|
|
176
160
|
export * from "./RelativePositionMapping.js";
|
|
177
161
|
export * from "./Suggestions.js";
|
|
178
|
-
export * from "./Versioning.js";
|
|
179
162
|
export * from "./YAttributionMarks.js";
|
|
180
163
|
export * from "./YCursorPlugin.js";
|
|
181
164
|
export * from "./YSync.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import * as delta from "lib0/delta";
|
|
2
|
+
import * as dt from "lib0/delta/transformer";
|
|
3
|
+
import type * as s from "lib0/schema";
|
|
4
|
+
/**
|
|
5
|
+
* # Persistent block groups
|
|
6
|
+
*
|
|
7
|
+
* A `@y/prosemirror` transformer (the `transformers` option of `syncPlugin`)
|
|
8
|
+
* that keeps BlockNote's nested `blockGroup` nodes alive in the Yjs document
|
|
9
|
+
* and hides the empty ones from ProseMirror.
|
|
10
|
+
*
|
|
11
|
+
* ## The problem
|
|
12
|
+
*
|
|
13
|
+
* BlockNote nests child blocks as `blockContainer > [blockContent, blockGroup?]`
|
|
14
|
+
* and its ProseMirror schema forbids an empty `blockGroup`
|
|
15
|
+
* (`content: "blockGroupChild+"`). So the editor creates the group together
|
|
16
|
+
* with the first nested block and removes it with the last one. Under
|
|
17
|
+
* concurrency that is a conflict generator: two users who nest a first child
|
|
18
|
+
* under the same block at the same time each insert their own `blockGroup`,
|
|
19
|
+
* and after the merge the container holds two groups, which the schema
|
|
20
|
+
* rejects. BlockNote worked around it by replacing the whole container
|
|
21
|
+
* whenever a group appeared or disappeared (the nesting check that used to be
|
|
22
|
+
* in `blockMatchNodes`), which turns the same race into two copies of the
|
|
23
|
+
* parent block and rewrites the parent on every first nesting and last
|
|
24
|
+
* un-nesting.
|
|
25
|
+
*
|
|
26
|
+
* ## The model
|
|
27
|
+
*
|
|
28
|
+
* What Yjs stores is decoupled from what ProseMirror shows:
|
|
29
|
+
*
|
|
30
|
+
* - **Yjs (side A)** keeps every `blockGroup` once it exists. Emptying one
|
|
31
|
+
* leaves it in place, and (with `implicitGroups`, the default) a container
|
|
32
|
+
* the editor creates gets an empty group right away. Two users nesting a
|
|
33
|
+
* first child concurrently therefore write into the *same* group item, and
|
|
34
|
+
* Yjs merges their children like any other concurrent list insert.
|
|
35
|
+
* - **ProseMirror (side B)** sees one `blockGroup` per container, present only
|
|
36
|
+
* while it has children.
|
|
37
|
+
*
|
|
38
|
+
* Yjs ProseMirror
|
|
39
|
+
* blockContainer[ content, group[] ] ⇄ blockContainer[ content ]
|
|
40
|
+
* blockContainer[ content, group[a] ] ⇄ blockContainer[ content, group[a] ]
|
|
41
|
+
* blockContainer[ content, g1[a], g2[b] ] ⇄ blockContainer[ content, group[a, b] ]
|
|
42
|
+
* blockContainer[ content ] ⇄ blockContainer[ content ] (legacy)
|
|
43
|
+
*
|
|
44
|
+
* The third row is what a document written before this transformer (no
|
|
45
|
+
* groups until the first nesting) produces when two users nest a first child
|
|
46
|
+
* concurrently: the view merges every group of a container into one, so the
|
|
47
|
+
* race degrades to an ordering question instead of invalid content. Edits
|
|
48
|
+
* inside the merged group route back to the Yjs group that holds that
|
|
49
|
+
* position. A legacy container never gets a group implicitly (that would be a
|
|
50
|
+
* concurrent write by every client that opens the document); its first nesting
|
|
51
|
+
* creates the group, as before.
|
|
52
|
+
*
|
|
53
|
+
* ## Rules, per `blockContainer`
|
|
54
|
+
*
|
|
55
|
+
* Yjs → view (`applyA`):
|
|
56
|
+
* - every `blockGroup` child collapses into one view group placed after all
|
|
57
|
+
* other children; it exists iff the groups hold at least one child in total
|
|
58
|
+
* - a change that makes the total go 0 → n inserts the view group, n → 0
|
|
59
|
+
* deletes it, n → m modifies it with the inner change re-based onto merged
|
|
60
|
+
* coordinates (a group's children start at the sum of the lengths of the
|
|
61
|
+
* groups before it)
|
|
62
|
+
* - the group wrapper's own attributes, formats and attribution have no view
|
|
63
|
+
* counterpart and are dropped; a group inserted by a suggestion renders its
|
|
64
|
+
* *children* as inserted, which is what the user sees anyway
|
|
65
|
+
*
|
|
66
|
+
* view → Yjs (`applyB`):
|
|
67
|
+
* - an edit at a merged offset routes into the group covering it; at a
|
|
68
|
+
* boundary between two groups the earlier group wins
|
|
69
|
+
* - deleting the view group empties every Yjs group and keeps them all
|
|
70
|
+
* - inserting a view group (only possible while no view group exists) routes
|
|
71
|
+
* its children into the first Yjs group, or, when the container has no
|
|
72
|
+
* group at all (a legacy container), inserts the group as the editor built
|
|
73
|
+
* it
|
|
74
|
+
* - a container the view inserts without a group gets an empty group appended
|
|
75
|
+
* (`implicitGroups`)
|
|
76
|
+
*
|
|
77
|
+
* Cursor positions (root marks) map through the same layout, in both
|
|
78
|
+
* directions.
|
|
79
|
+
*
|
|
80
|
+
* ## Shape of the implementation
|
|
81
|
+
*
|
|
82
|
+
* {@link persistentBlockGroups} composes lib0's `children` template
|
|
83
|
+
* recursively over the node types that can hold containers (`blockGroup`,
|
|
84
|
+
* `column`, `columnList`) and pipes the stateful per-container stage
|
|
85
|
+
* ({@link PersistentGroupTransformer}) after the recursion, so that stage sees
|
|
86
|
+
* its container's children in Yjs layout on the way in and in view layout on
|
|
87
|
+
* the way back. Every other node type (block content, inline content) opts
|
|
88
|
+
* out of the recursion and costs nothing.
|
|
89
|
+
*
|
|
90
|
+
* The per-container state is the container's Yjs child layout: a list of
|
|
91
|
+
* {@link Seg}s, one per child, telling groups (with their child count) apart
|
|
92
|
+
* from everything else. It is kept current from the changes that flow through,
|
|
93
|
+
* so no stage ever re-reads a document; a change costs O(size of the change)
|
|
94
|
+
* plus O(children of the containers on its path), and a container has two or
|
|
95
|
+
* three children.
|
|
96
|
+
*
|
|
97
|
+
* ## Assumptions
|
|
98
|
+
*
|
|
99
|
+
* - `blockContainer` children are a content node followed by zero or more
|
|
100
|
+
* `blockGroup`s (BlockNote never produces anything else). The code tolerates
|
|
101
|
+
* other layouts, but the view then shows non-group children in Yjs order
|
|
102
|
+
* followed by the merged group, which may differ from the Yjs order.
|
|
103
|
+
* - the view inserts at most one `blockGroup` per container (its schema
|
|
104
|
+
* guarantees that).
|
|
105
|
+
*/
|
|
106
|
+
/**
|
|
107
|
+
* Options of {@link persistentBlockGroups}.
|
|
108
|
+
*/
|
|
109
|
+
export type PersistentBlockGroupsOptions = {
|
|
110
|
+
/** The nested list node that is kept and hidden. Default `"blockGroup"`. */
|
|
111
|
+
groupName?: string;
|
|
112
|
+
/** The block node whose children the group lives in. Default `"blockContainer"`. */
|
|
113
|
+
containerName?: string;
|
|
114
|
+
/**
|
|
115
|
+
* The node types (besides the container) that can hold containers, so the
|
|
116
|
+
* recursion descends into them. Default `["blockGroup", "column", "columnList"]`.
|
|
117
|
+
*/
|
|
118
|
+
nestingNodes?: readonly string[];
|
|
119
|
+
/**
|
|
120
|
+
* Whether a container the view creates gets an empty group right away
|
|
121
|
+
* (default `true`). With `false`, groups are only kept once the first
|
|
122
|
+
* nesting creates them; concurrent first nestings then leave two groups in
|
|
123
|
+
* Yjs, which the view merges.
|
|
124
|
+
*/
|
|
125
|
+
implicitGroups?: boolean;
|
|
126
|
+
};
|
|
127
|
+
type AnyDelta = delta.DeltaAny;
|
|
128
|
+
type AnyBuilder = delta.DeltaBuilderAny;
|
|
129
|
+
/**
|
|
130
|
+
* One child of a container in Yjs layout: a group with its child count, or
|
|
131
|
+
* anything else.
|
|
132
|
+
*/
|
|
133
|
+
type Seg = {
|
|
134
|
+
readonly group: false;
|
|
135
|
+
} | {
|
|
136
|
+
readonly group: true;
|
|
137
|
+
readonly len: number;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* The stateful per-container stage. Side A is the container's children in
|
|
141
|
+
* Yjs layout, side B in view layout (see the module doc for the rules).
|
|
142
|
+
*/
|
|
143
|
+
export declare class PersistentGroupTransformer extends dt.Transformer<any, any> {
|
|
144
|
+
readonly groupName: string;
|
|
145
|
+
readonly implicitGroups: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* The container's Yjs child layout, kept current from the changes that
|
|
148
|
+
* flow through (both directions).
|
|
149
|
+
*/
|
|
150
|
+
segs: Seg[];
|
|
151
|
+
/**
|
|
152
|
+
* Whether no change has been seen yet. The first change a stage receives
|
|
153
|
+
* is the whole container node (lib0's `children` feeds a freshly inserted
|
|
154
|
+
* child through a fresh stage); when that node comes from the view, the
|
|
155
|
+
* container is new and gets its implicit group.
|
|
156
|
+
*/
|
|
157
|
+
fresh: boolean;
|
|
158
|
+
constructor($in: s.Schema<AnyDelta>, $out: s.Schema<AnyDelta>, groupName: string, implicitGroups: boolean);
|
|
159
|
+
/** Yjs layout change → view layout change. */
|
|
160
|
+
applyA(da: AnyBuilder): dt.TransformResultAny;
|
|
161
|
+
/** View layout change → Yjs layout change. */
|
|
162
|
+
applyB(db: AnyBuilder): dt.TransformResultAny;
|
|
163
|
+
}
|
|
164
|
+
/** Template of the per-container stage. */
|
|
165
|
+
export declare class PersistentGroup extends dt.Template<any, any> {
|
|
166
|
+
readonly groupName: string;
|
|
167
|
+
readonly implicitGroups: boolean;
|
|
168
|
+
constructor($d: s.Schema<AnyDelta>, groupName: string, implicitGroups: boolean);
|
|
169
|
+
get name(): string;
|
|
170
|
+
init(): dt.Transformer<any, any>;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The transformer: hide empty `blockGroup`s from the view, keep them in Yjs,
|
|
174
|
+
* create them with every new container, and merge concurrently created ones
|
|
175
|
+
* (module doc above). Slot it into the sync plugin:
|
|
176
|
+
*
|
|
177
|
+
* ```ts
|
|
178
|
+
* syncPlugin({ transformers: [persistentBlockGroups], customCompare: blockMatchNodes })
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
* and into the standalone conversions with
|
|
182
|
+
* `defaultTransformer({ mapAttributionToMark, transformers: [persistentBlockGroups] })`.
|
|
183
|
+
*
|
|
184
|
+
* The returned template is the recursion over the document (lib0's
|
|
185
|
+
* `children`): containers get the per-container stage, the `nestingNodes`
|
|
186
|
+
* descend, every other node opts out.
|
|
187
|
+
*/
|
|
188
|
+
export declare function persistentBlockGroups<IN extends delta.DeltaConf>($d: s.Schema<delta.Delta<IN>>, options?: PersistentBlockGroupsOptions): dt.Template<IN, any>;
|
|
189
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as Y from "@y/y";
|
|
2
|
+
/** Serialize the live fragment as a V2 update. */
|
|
3
|
+
export declare function serializeFragment(fragment: Y.Node): Uint8Array;
|
|
4
|
+
export type DecodedFragment = {
|
|
5
|
+
doc: Y.Doc;
|
|
6
|
+
fragment: Y.Node;
|
|
7
|
+
};
|
|
8
|
+
/** Materialize a stored update into a throwaway doc and resolve `fragment` inside it. */
|
|
9
|
+
export declare function decodeFragmentUpdate(fragment: Y.Node, content: Uint8Array, opts?: {
|
|
10
|
+
suggestionDoc?: boolean;
|
|
11
|
+
}): DecodedFragment;
|
|
12
|
+
/** Release a decoded throwaway doc. */
|
|
13
|
+
export declare function destroyDecodedFragment(decoded: DecodedFragment | undefined): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as Y from "@y/y";
|
|
2
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
3
|
+
/**
|
|
4
|
+
* Throws when something syncs `doc` (a provider or a persistence layer listens
|
|
5
|
+
* to its updates). A decoded snapshot is written to (see
|
|
6
|
+
* {@link splitChangedBlocks}), and that write must never reach a stored
|
|
7
|
+
* document.
|
|
8
|
+
*/
|
|
9
|
+
export declare function assertUnsyncedDoc(doc: Y.Doc): void;
|
|
10
|
+
/**
|
|
11
|
+
* Decode a snapshot, diff it against a baseline if given, and render it.
|
|
12
|
+
*
|
|
13
|
+
* Snapshots are decoded into throwaway documents, so pointing the binding at
|
|
14
|
+
* one is already an isolated state: the live fragment stops receiving view
|
|
15
|
+
* updates, and nothing typed into the preview reaches the live document.
|
|
16
|
+
* {@link configureYProsemirror} rebuilds the binding against the decoded
|
|
17
|
+
* fragment through the same `customCompare`/attribution pipeline the live
|
|
18
|
+
* binding uses; passing the `renderer` keeps the attribution tooltips
|
|
19
|
+
* ("who/when") working.
|
|
20
|
+
*/
|
|
21
|
+
export declare function showSnapshotPreview(editor: BlockNoteEditor<any, any, any>, fragment: Y.Node, snapshotContent: Uint8Array, compareToContent?: Uint8Array, attributions?: Y.ContentMap): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/src/y/index.d.ts
CHANGED
package/types/src/y/utils.d.ts
CHANGED
|
@@ -1,15 +1,38 @@
|
|
|
1
|
+
import { defaultTransformer, ynodeToPmnode } from "@y/prosemirror";
|
|
1
2
|
import * as d from "lib0/delta";
|
|
2
3
|
import { Node } from "prosemirror-model";
|
|
3
|
-
import { Transaction } from "prosemirror-state";
|
|
4
|
+
import type { Transaction } from "prosemirror-state";
|
|
4
5
|
import { type Block, type BlockNoteEditor, type BlockSchema, type InlineContentSchema, type PartialBlock, type StyleSchema } from "../index.js";
|
|
5
6
|
import * as Y from "@y/y";
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* The Y ⇄ ProseMirror pipeline of the collaboration binding (see
|
|
9
|
+
* `YSyncExtension`): attributions become `y-attributed-*` marks and nested
|
|
10
|
+
* `blockGroup`s are persistent (kept in Y, hidden while empty, merged in the
|
|
11
|
+
* view). Every conversion outside a bound editor goes through the same
|
|
12
|
+
* pipeline, so a document imported with `blocksToYDoc` gets its groups and one
|
|
13
|
+
* read with `yDocToBlocks` hides the empty ones.
|
|
14
|
+
*/
|
|
15
|
+
export declare const blockNoteTransformer: ReturnType<typeof defaultTransformer>;
|
|
16
|
+
/**
|
|
17
|
+
* Find the equivalent of a Y.Node in another Y.Doc.
|
|
8
18
|
*
|
|
9
19
|
* For root types this looks up the matching shared key; for sub-types it
|
|
10
20
|
* locates the item by its client/clock ID in the target doc's store.
|
|
11
21
|
*/
|
|
12
|
-
export declare function findTypeInOtherYdoc<T extends Y.
|
|
22
|
+
export declare function findTypeInOtherYdoc<T extends Y.Node<any>>(ytype: T, otherYdoc: Y.Doc): T;
|
|
23
|
+
/**
|
|
24
|
+
* Collect all stored Yjs ID ranges belonging to a fragment, including deleted
|
|
25
|
+
* descendants. Items belonging to other shared types are excluded.
|
|
26
|
+
*
|
|
27
|
+
* Resolves the fragment in the supplied document and scans its stored items:
|
|
28
|
+
* walking visible content would miss deleted subtrees. To include all deleted
|
|
29
|
+
* descendants, the document or update must retain them; content already
|
|
30
|
+
* garbage-collected cannot be recovered here.
|
|
31
|
+
*
|
|
32
|
+
* Updates are loaded into a temporary document with `gc: false`, which is
|
|
33
|
+
* destroyed after collection. Caller-provided documents are never destroyed.
|
|
34
|
+
*/
|
|
35
|
+
export declare function collectFragmentIds(fragment: Y.Node, docOrUpdate: Uint8Array | Y.Doc): Y.IdSet;
|
|
13
36
|
/**
|
|
14
37
|
* Turn Prosemirror JSON to BlockNote style JSON
|
|
15
38
|
* @param editor BlockNote editor
|
|
@@ -24,16 +47,15 @@ export declare function _prosemirrorJSONToBlocks<BSchema extends BlockSchema, IS
|
|
|
24
47
|
* @returns Prosemirror root node
|
|
25
48
|
*/
|
|
26
49
|
export declare function _blocksToProsemirrorNode<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema>(editor: BlockNoteEditor<BSchema, ISchema, SSchema>, blocks: PartialBlock<BSchema, ISchema, SSchema>[]): Node;
|
|
27
|
-
/** YJS / BLOCKNOTE conversions */
|
|
28
50
|
/**
|
|
29
|
-
* Turn a Y.
|
|
51
|
+
* Turn a Y.Node collaborative doc into a BlockNote document (BlockNote style JSON of all blocks)
|
|
30
52
|
* @param editor BlockNote editor
|
|
31
|
-
* @param fragment Y.
|
|
53
|
+
* @param fragment Y.Node
|
|
32
54
|
* @returns BlockNote document (BlockNote style JSON of all blocks)
|
|
33
55
|
*/
|
|
34
|
-
export declare function yfragmentToBlocks<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema>(editor: BlockNoteEditor<BSchema, ISchema, SSchema>, fragment: Y.
|
|
56
|
+
export declare function yfragmentToBlocks<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema>(editor: BlockNoteEditor<BSchema, ISchema, SSchema>, fragment: Y.Node): Block<BSchema, ISchema, SSchema>[];
|
|
35
57
|
/**
|
|
36
|
-
* Convert blocks to a Y.
|
|
58
|
+
* Convert blocks to a Y.Node
|
|
37
59
|
*
|
|
38
60
|
* This can be used when importing existing content to Y.Doc for the first time,
|
|
39
61
|
* note that this should not be used to rehydrate a Y.Doc from a database once
|
|
@@ -42,9 +64,9 @@ export declare function yfragmentToBlocks<BSchema extends BlockSchema, ISchema e
|
|
|
42
64
|
* @param editor BlockNote editor
|
|
43
65
|
* @param blocks the blocks to convert
|
|
44
66
|
* @param fragment XML fragment name
|
|
45
|
-
* @returns Y.
|
|
67
|
+
* @returns Y.Node
|
|
46
68
|
*/
|
|
47
|
-
export declare function blocksToYType<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema>(editor: BlockNoteEditor<BSchema, ISchema, SSchema>, blocks: Block<BSchema, ISchema, SSchema>[], fragment?: Y.
|
|
69
|
+
export declare function blocksToYType<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema>(editor: BlockNoteEditor<BSchema, ISchema, SSchema>, blocks: Block<BSchema, ISchema, SSchema>[], fragment?: Y.Node): Y.Node<any>;
|
|
48
70
|
/**
|
|
49
71
|
* Turn a Y.Doc collaborative doc into a BlockNote document (BlockNote style JSON of all blocks)
|
|
50
72
|
* @param editor BlockNote editor
|
|
@@ -70,13 +92,11 @@ export declare function blocksToYDoc<BSchema extends BlockSchema, ISchema extend
|
|
|
70
92
|
*/
|
|
71
93
|
export declare function docDiffToDelta(previousDoc: Node, newDoc: Node): d.Delta<d.DeltaConf>;
|
|
72
94
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
95
|
+
* Append steps that render a Y node into the transaction's current document.
|
|
96
|
+
* Supports both plain and already-attributed documents, replacing old preview
|
|
97
|
+
* marks with the renderer's attributions using BlockNote's node-pairing policy.
|
|
98
|
+
* Defaults to the binding's pipeline ({@link blockNoteTransformer}). Does not
|
|
99
|
+
* dispatch or write to the Y node; the caller controls sync configuration and
|
|
100
|
+
* dispatch.
|
|
77
101
|
*/
|
|
78
|
-
export declare function
|
|
79
|
-
tr: Transaction;
|
|
80
|
-
fragment: Y.Type;
|
|
81
|
-
renderer?: Y.AbstractRenderer | null;
|
|
82
|
-
}): Transaction;
|
|
102
|
+
export declare function yNodeToTransaction(tr: Transaction, node: Y.Node, options?: NonNullable<Parameters<typeof ynodeToPmnode>[2]>): Transaction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { createYHubVersionStorage, YVersioningExtension, YHubVersioningExtension, type YHubVersionStorageOptions, } from "./yhub.js";
|