@blocknote/core 0.51.4 → 0.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BlockNoteExtension-B_IEJHS8.js +38 -0
- package/dist/BlockNoteExtension-B_IEJHS8.js.map +1 -0
- package/dist/BlockNoteExtension-M0znTzxP.cjs +2 -0
- package/dist/BlockNoteExtension-M0znTzxP.cjs.map +1 -0
- package/dist/ThreadStore-Bx-gSEh1.cjs +2 -0
- package/dist/ThreadStore-Bx-gSEh1.cjs.map +1 -0
- package/dist/ThreadStore-et9wB5Xt.js +11 -0
- package/dist/ThreadStore-et9wB5Xt.js.map +1 -0
- package/dist/UserStore-DCG6lsla.cjs +2 -0
- package/dist/UserStore-DCG6lsla.cjs.map +1 -0
- package/dist/UserStore-QbbPFj0z.js +73 -0
- package/dist/UserStore-QbbPFj0z.js.map +1 -0
- package/dist/blocknote.cjs +1 -1
- package/dist/blocknote.js +6 -7
- package/dist/blocks-BqHv0xhc.cjs +12 -0
- package/dist/blocks-BqHv0xhc.cjs.map +1 -0
- package/dist/{blocks-DGsP5WKr.js → blocks-CiuUGa1E.js} +1093 -994
- package/dist/blocks-CiuUGa1E.js.map +1 -0
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/comments.cjs +1 -1
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.js +75 -340
- package/dist/comments.js.map +1 -1
- package/dist/{en-Cj5r8sW_.cjs → en-C5Z4Ag9_.cjs} +2 -2
- package/dist/en-C5Z4Ag9_.cjs.map +1 -0
- package/dist/{en-B9hMApn4.js → en-CGKXfWma.js} +9 -1
- package/dist/en-CGKXfWma.js.map +1 -0
- package/dist/{extensions-Co4y7P63.js → extensions-CrUGDOks.js} +655 -583
- package/dist/extensions-CrUGDOks.js.map +1 -0
- package/dist/extensions-Ghr9QqqR.cjs +52 -0
- package/dist/extensions-Ghr9QqqR.cjs.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +4 -4
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +177 -1
- package/dist/locales.js.map +1 -1
- package/dist/{src-Bcud0PIg.js → src-DTF83Cl9.js} +1243 -1297
- package/dist/src-DTF83Cl9.js.map +1 -0
- package/dist/src-OfbaVbMw.cjs +21 -0
- package/dist/src-OfbaVbMw.cjs.map +1 -0
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/dist/y.cjs +2 -0
- package/dist/y.cjs.map +1 -0
- package/dist/y.js +989 -0
- package/dist/y.js.map +1 -0
- package/dist/yjs.cjs +1 -1
- package/dist/yjs.cjs.map +1 -1
- package/dist/yjs.js +535 -14
- package/dist/yjs.js.map +1 -1
- package/package.json +46 -19
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +1 -1
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +1 -1
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +3 -3
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +25 -20
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +39 -29
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.test.ts +2 -2
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +4 -8
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +1 -1
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +21 -9
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +6 -5
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +362 -4
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +240 -30
- package/src/api/blockManipulation/getBlock/getBlock.ts +4 -9
- package/src/api/blockManipulation/selections/selection.ts +3 -6
- package/src/api/blockManipulation/selections/textCursorPosition.ts +10 -10
- package/src/api/blockManipulation/setupTestEnv.ts +1 -1
- package/src/api/blockManipulation/tables/tables.test.ts +1 -1
- package/src/api/clipboard/fromClipboard/fileDropExtension.ts +1 -1
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +8 -4
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +1 -1
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +2 -1
- package/src/api/exporters/markdown/htmlToMarkdown.ts +79 -43
- package/src/api/getBlockInfoFromPos.test.ts +256 -0
- package/src/api/getBlockInfoFromPos.ts +53 -15
- package/src/api/getBlocksChangedByTransaction.test.ts +2 -1
- package/src/api/getBlocksChangedByTransaction.ts +6 -6
- package/src/api/nodeConversions/blockToNode.test.ts +113 -0
- package/src/api/nodeConversions/blockToNode.ts +15 -3
- package/src/api/nodeConversions/fragmentToBlocks.ts +2 -4
- package/src/api/nodeConversions/nodeToBlock.ts +28 -58
- package/src/api/nodeUtil.ts +6 -2
- package/src/api/parsers/html/parseHTML.ts +1 -1
- package/src/api/parsers/html/util/nestedLists.test.ts +1 -1
- package/src/api/parsers/markdown/detectMarkdown.test.ts +1 -1
- package/src/api/parsers/markdown/markdownToHtml.ts +228 -82
- package/src/api/pmUtil.ts +18 -1
- package/src/api/positionMapping.test.ts +20 -345
- package/src/api/positionMapping.ts +13 -83
- package/src/blocks/Audio/block.ts +1 -1
- package/src/blocks/Code/block.test.ts +14 -7
- package/src/blocks/Code/block.ts +2 -2
- package/src/blocks/Image/block.ts +1 -1
- package/src/blocks/ListItem/CheckListItem/block.test.ts +1 -1
- package/src/blocks/ListItem/ListItemKeyboardShortcuts.ts +2 -2
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.ts +4 -11
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +47 -50
- package/src/blocks/Table/TableExtension.test.ts +9 -6
- package/src/blocks/Table/TableExtension.ts +20 -6
- package/src/blocks/Table/block.ts +18 -5
- package/src/blocks/Video/block.ts +1 -1
- package/src/blocks/utils/listItemEnterHandler.ts +3 -2
- package/src/comments/extension.ts +30 -21
- package/src/comments/index.ts +0 -3
- package/src/comments/mark.ts +4 -0
- package/src/comments/threadstore/ThreadStore.ts +4 -8
- package/src/comments/types.ts +0 -8
- package/src/editor/Block.css +307 -3
- package/src/editor/BlockNoteEditor.test.ts +21 -18
- package/src/editor/BlockNoteEditor.ts +22 -57
- package/src/editor/BlockNoteExtension.test.ts +1 -1
- package/src/editor/managers/BlockManager.ts +1 -1
- package/src/editor/managers/ExtensionManager/ExtensionManager.test.ts +249 -0
- package/src/editor/managers/ExtensionManager/extensions.ts +7 -18
- package/src/editor/managers/ExtensionManager/index.ts +168 -68
- package/src/editor/managers/StateManager.ts +4 -3
- package/src/editor/performance.test.ts +14 -1
- package/src/editor/transformPasted.test.ts +1 -1
- package/src/extensions/Placeholder/Placeholder.ts +1 -0
- package/src/extensions/PositionMapping/PositionMapping.ts +68 -0
- package/src/extensions/PreviousBlockType/PreviousBlockType.test.ts +14 -1
- package/src/extensions/PreviousBlockType/PreviousBlockType.ts +14 -11
- package/src/extensions/SideMenu/SideMenu.ts +9 -2
- package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +1 -1
- package/src/extensions/TableHandles/TableHandles.ts +18 -20
- package/src/extensions/TrailingNode/TrailingNode.ts +33 -1
- package/src/extensions/Versioning/Versioning.test.ts +435 -0
- package/src/extensions/Versioning/Versioning.ts +628 -0
- package/src/extensions/Versioning/inMemoryVersioning.test.ts +469 -0
- package/src/extensions/Versioning/inMemoryVersioning.ts +263 -0
- package/src/extensions/Versioning/index.ts +2 -0
- package/src/extensions/index.ts +6 -9
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.ts +155 -0
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +6 -8
- package/src/extensions/tiptap-extensions/Link/helpers/autolink.ts +9 -9
- package/src/extensions/tiptap-extensions/Link/helpers/linkDetector.ts +8 -10
- package/src/extensions/tiptap-extensions/Link/helpers/whitespace.ts +2 -2
- package/src/extensions/tiptap-extensions/Link/link.test.ts +26 -22
- package/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.ts +187 -0
- package/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts +37 -24
- package/src/extensions/tiptap-extensions/index.ts +1 -25
- package/src/i18n/locales/ar.ts +9 -0
- package/src/i18n/locales/de.ts +9 -0
- package/src/i18n/locales/en.ts +10 -1
- package/src/i18n/locales/es.ts +9 -0
- package/src/i18n/locales/fa.ts +11 -1
- package/src/i18n/locales/fr.ts +9 -0
- package/src/i18n/locales/he.ts +10 -1
- package/src/i18n/locales/hr.ts +10 -0
- package/src/i18n/locales/is.ts +10 -0
- package/src/i18n/locales/it.ts +9 -0
- package/src/i18n/locales/ja.ts +9 -0
- package/src/i18n/locales/ko.ts +9 -0
- package/src/i18n/locales/nl.ts +10 -0
- package/src/i18n/locales/no.ts +10 -0
- package/src/i18n/locales/pl.ts +9 -0
- package/src/i18n/locales/pt.ts +10 -0
- package/src/i18n/locales/ru.ts +10 -0
- package/src/i18n/locales/sk.ts +10 -1
- package/src/i18n/locales/uk.ts +9 -0
- package/src/i18n/locales/uz.ts +9 -0
- package/src/i18n/locales/vi.ts +9 -0
- package/src/i18n/locales/zh-tw.ts +9 -0
- package/src/i18n/locales/zh.ts +9 -0
- package/src/index.ts +2 -0
- package/src/pm-nodes/BlockContainer.ts +4 -1
- package/src/pm-nodes/BlockGroup.ts +4 -1
- package/src/pm-nodes/Doc.ts +4 -1
- package/src/pm-nodes/suggestionMarks.ts +43 -0
- package/src/schema/blocks/createSpec.test.ts +123 -0
- package/src/schema/blocks/createSpec.ts +82 -24
- package/src/schema/blocks/extendBlockSpec.test.ts +188 -0
- package/src/schema/blocks/internal.ts +13 -43
- package/src/schema/blocks/types.ts +69 -22
- package/src/schema/contentTypePropagation.test.ts +182 -0
- package/src/schema/index.ts +1 -0
- package/src/schema/inlineContent/internal.ts +1 -1
- package/src/schema/inlineContent/types.ts +3 -3
- package/src/schema/markGroups.ts +50 -0
- package/src/user/UserStore.ts +199 -0
- package/src/user/createUserStore.test.ts +126 -0
- package/src/user/index.ts +2 -0
- package/src/user/userColors.ts +72 -0
- package/src/util/string.ts +1 -1
- package/src/util/topo-sort.test.ts +1 -1
- package/src/util/typescript.ts +2 -1
- package/src/vite-env.d.ts +1 -1
- package/src/y/README.md +5 -0
- package/src/{comments/threadstore/yjs → y/comments}/RESTYjsThreadStore.ts +8 -14
- package/src/y/comments/YjsThreadStore.test.ts +295 -0
- package/src/y/comments/YjsThreadStore.ts +358 -0
- package/src/y/comments/YjsThreadStoreBase.ts +50 -0
- package/src/y/comments/index.ts +3 -0
- package/src/y/comments/yjsHelpers.ts +125 -0
- package/src/y/extensions/AttributionExtension.test.ts +86 -0
- package/src/y/extensions/AttributionExtension.ts +378 -0
- package/src/y/extensions/DiffVersioningExtension.test.ts +193 -0
- package/src/y/extensions/DiffVersioningExtension.ts +228 -0
- package/src/y/extensions/ForkYDoc.test.ts +253 -0
- package/src/y/extensions/ForkYDoc.ts +108 -0
- package/src/y/extensions/RelativePositionMapping.test.ts +418 -0
- package/src/y/extensions/RelativePositionMapping.ts +49 -0
- package/src/y/extensions/Suggestions.ts +174 -0
- package/src/y/extensions/Versioning.test.ts +395 -0
- package/src/y/extensions/Versioning.ts +115 -0
- package/src/y/extensions/YAttributionMarks.ts +320 -0
- package/src/{extensions/Collaboration → y/extensions}/YCursorPlugin.ts +15 -7
- package/src/y/extensions/YSync.ts +125 -0
- package/src/y/extensions/blockMatchNodes.ts +182 -0
- package/src/y/extensions/index.ts +156 -0
- package/src/y/index.ts +4 -0
- package/src/y/utils.test.ts +1042 -0
- package/src/y/utils.ts +242 -0
- package/src/y/versioning/__test__/fixtures/activity-all-after.bin +0 -0
- package/src/y/versioning/__test__/fixtures/activity-all-after.json +50 -0
- package/src/y/versioning/__test__/fixtures/activity-all.bin +0 -0
- package/src/y/versioning/__test__/fixtures/activity-all.json +20 -0
- package/src/y/versioning/__test__/fixtures/activity-filtered-after.bin +0 -0
- package/src/y/versioning/__test__/fixtures/activity-filtered-after.json +32 -0
- package/src/y/versioning/__test__/fixtures/activity-filtered-before.json +1 -0
- package/src/y/versioning/__test__/fixtures/changeset.bin +0 -0
- package/src/y/versioning/__test__/fixtures/patch-response.json +4 -0
- package/src/y/versioning/__test__/yhub.test.ts +752 -0
- package/src/y/versioning/index.ts +1 -0
- package/src/y/versioning/yhub.ts +631 -0
- package/src/yjs/README.md +5 -0
- package/src/yjs/comments/RESTYjsThreadStore.ts +166 -0
- package/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStore.test.ts +3 -3
- package/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStore.ts +7 -3
- package/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStoreBase.ts +3 -3
- package/src/yjs/comments/index.ts +3 -0
- package/src/{comments/threadstore/yjs → yjs/comments}/yjsHelpers.ts +5 -1
- package/src/yjs/extensions/FixUpSchema.test.ts +421 -0
- package/src/yjs/extensions/FixUpSchema.ts +88 -0
- package/src/yjs/extensions/ForkYDoc.test.ts +216 -0
- package/src/{extensions/Collaboration → yjs/extensions}/ForkYDoc.ts +38 -57
- package/src/yjs/extensions/RelativePositionMapping.test.ts +418 -0
- package/src/yjs/extensions/RelativePositionMapping.ts +71 -0
- package/src/yjs/extensions/Versioning.test.ts +549 -0
- package/src/yjs/extensions/Versioning.ts +83 -0
- package/src/yjs/extensions/YCursorPlugin.ts +201 -0
- package/src/{extensions/Collaboration → yjs/extensions}/YSync.ts +1 -1
- package/src/yjs/extensions/index.ts +89 -0
- package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.test.ts +1 -1
- package/src/yjs/index.ts +2 -0
- package/src/yjs/utils.test.ts +5 -15
- package/src/yjs/utils.ts +36 -0
- package/types/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.d.ts +3 -1
- package/types/src/api/blockManipulation/selections/selection.d.ts +1 -1
- package/types/src/api/getBlockInfoFromPos.d.ts +5 -9
- package/types/src/api/nodeConversions/nodeToBlock.d.ts +4 -6
- package/types/src/api/pmUtil.d.ts +12 -1
- package/types/src/blocks/Audio/block.d.ts +2 -2
- package/types/src/blocks/Code/block.d.ts +2 -2
- package/types/src/blocks/File/block.d.ts +2 -2
- package/types/src/blocks/Heading/block.d.ts +21 -21
- package/types/src/blocks/Image/block.d.ts +3 -3
- package/types/src/blocks/ListItem/CheckListItem/block.d.ts +6 -6
- package/types/src/blocks/ListItem/NumberedListItem/block.d.ts +6 -6
- package/types/src/blocks/Video/block.d.ts +3 -3
- package/types/src/blocks/defaultBlocks.d.ts +17 -17
- package/types/src/comments/extension.d.ts +18 -5
- package/types/src/comments/index.d.ts +0 -3
- package/types/src/comments/threadstore/ThreadStore.d.ts +4 -8
- package/types/src/comments/types.d.ts +0 -8
- package/types/src/editor/BlockNoteEditor.d.ts +8 -9
- package/types/src/editor/managers/BlockManager.d.ts +1 -1
- package/types/src/editor/managers/ExtensionManager/extensions.d.ts +2 -2
- package/types/src/editor/managers/ExtensionManager/index.d.ts +13 -0
- package/types/src/editor/managers/SelectionManager.d.ts +1 -1
- package/types/src/extensions/PositionMapping/PositionMapping.d.ts +4 -0
- package/types/src/extensions/TableHandles/TableHandles.d.ts +6 -6
- package/types/src/extensions/Versioning/Versioning.d.ts +352 -0
- package/types/src/extensions/Versioning/Versioning.test.d.ts +1 -0
- package/types/src/extensions/Versioning/inMemoryVersioning.d.ts +37 -0
- package/types/src/extensions/Versioning/inMemoryVersioning.test.d.ts +1 -0
- package/types/src/extensions/Versioning/index.d.ts +2 -0
- package/types/src/extensions/index.d.ts +6 -9
- package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.d.ts +1 -0
- package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.d.ts +6 -1
- package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.d.ts +4 -0
- package/types/src/extensions/tiptap-extensions/index.d.ts +1 -5
- package/types/src/i18n/locales/en.d.ts +9 -1
- package/types/src/i18n/locales/fa.d.ts +9 -1
- package/types/src/i18n/locales/sk.d.ts +9 -1
- package/types/src/index.d.ts +2 -0
- package/types/src/pm-nodes/suggestionMarks.d.ts +26 -0
- package/types/src/schema/blocks/createSpec.d.ts +4 -4
- package/types/src/schema/blocks/createSpec.test.d.ts +1 -0
- package/types/src/schema/blocks/extendBlockSpec.test.d.ts +1 -0
- package/types/src/schema/blocks/internal.d.ts +5 -7
- package/types/src/schema/blocks/types.d.ts +22 -14
- package/types/src/schema/contentTypePropagation.test.d.ts +1 -0
- package/types/src/schema/index.d.ts +1 -0
- package/types/src/schema/inlineContent/types.d.ts +3 -3
- package/types/src/schema/markGroups.d.ts +33 -0
- package/types/src/user/UserStore.d.ts +105 -0
- package/types/src/user/createUserStore.test.d.ts +1 -0
- package/types/src/user/index.d.ts +2 -0
- package/types/src/user/userColors.d.ts +36 -0
- package/types/src/y/comments/RESTYjsThreadStore.d.ts +77 -0
- package/types/src/y/comments/YjsThreadStore.d.ts +79 -0
- package/types/src/y/comments/YjsThreadStore.test.d.ts +1 -0
- package/types/src/y/comments/YjsThreadStoreBase.d.ts +15 -0
- package/types/src/y/comments/index.d.ts +3 -0
- package/types/src/y/comments/yjsHelpers.d.ts +13 -0
- package/types/src/y/extensions/AttributionExtension.d.ts +74 -0
- package/types/src/y/extensions/AttributionExtension.test.d.ts +1 -0
- package/types/src/y/extensions/DiffVersioningExtension.d.ts +69 -0
- package/types/src/y/extensions/DiffVersioningExtension.test.d.ts +1 -0
- package/types/src/{extensions/Collaboration → y/extensions}/ForkYDoc.d.ts +4 -2
- package/types/src/y/extensions/ForkYDoc.test.d.ts +1 -0
- package/types/src/y/extensions/RelativePositionMapping.d.ts +4 -0
- package/types/src/y/extensions/RelativePositionMapping.test.d.ts +1 -0
- package/types/src/y/extensions/Suggestions.d.ts +36 -0
- package/types/src/y/extensions/Versioning.d.ts +17 -0
- package/types/src/y/extensions/Versioning.test.d.ts +1 -0
- package/types/src/y/extensions/YAttributionMarks.d.ts +67 -0
- package/types/src/y/extensions/YCursorPlugin.d.ts +14 -0
- package/types/src/y/extensions/YSync.d.ts +32 -0
- package/types/src/y/extensions/blockMatchNodes.d.ts +25 -0
- package/types/src/y/extensions/index.d.ts +189 -0
- package/types/src/y/index.d.ts +4 -0
- package/types/src/y/utils.d.ts +82 -0
- package/types/src/y/utils.test.d.ts +1 -0
- package/types/src/y/versioning/__test__/yhub.test.d.ts +1 -0
- package/types/src/y/versioning/index.d.ts +1 -0
- package/types/src/y/versioning/yhub.d.ts +87 -0
- package/types/src/{comments/threadstore/yjs → yjs/comments}/RESTYjsThreadStore.d.ts +6 -10
- package/types/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStore.d.ts +3 -3
- package/types/src/yjs/comments/YjsThreadStore.test.d.ts +1 -0
- package/types/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStoreBase.d.ts +3 -3
- package/types/src/yjs/comments/index.d.ts +3 -0
- package/types/src/{comments/threadstore/yjs → yjs/comments}/yjsHelpers.d.ts +1 -1
- package/types/src/yjs/extensions/FixUpSchema.d.ts +3 -0
- package/types/src/yjs/extensions/FixUpSchema.test.d.ts +1 -0
- package/types/src/yjs/extensions/ForkYDoc.d.ts +27 -0
- package/types/src/yjs/extensions/ForkYDoc.test.d.ts +1 -0
- package/types/src/yjs/extensions/RelativePositionMapping.d.ts +4 -0
- package/types/src/yjs/extensions/RelativePositionMapping.test.d.ts +1 -0
- package/types/src/yjs/extensions/Versioning.d.ts +26 -0
- package/types/src/yjs/extensions/Versioning.test.d.ts +1 -0
- package/types/src/{extensions/Collaboration → yjs/extensions}/YCursorPlugin.d.ts +5 -2
- package/types/src/{extensions/Collaboration → yjs/extensions}/YSync.d.ts +1 -1
- package/types/src/{extensions/Collaboration/Collaboration.d.ts → yjs/extensions/index.d.ts} +36 -15
- package/types/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.test.d.ts +1 -0
- package/types/src/yjs/index.d.ts +2 -0
- package/types/src/yjs/utils.d.ts +5 -0
- package/dist/BlockNoteExtension-B6RhuQ3V.js +0 -27
- package/dist/BlockNoteExtension-B6RhuQ3V.js.map +0 -1
- package/dist/BlockNoteExtension-ab0REuob.cjs +0 -2
- package/dist/BlockNoteExtension-ab0REuob.cjs.map +0 -1
- package/dist/EventEmitter-CuPnGDYt.js +0 -22
- package/dist/EventEmitter-CuPnGDYt.js.map +0 -1
- package/dist/EventEmitter-DHdSnYCD.cjs +0 -2
- package/dist/EventEmitter-DHdSnYCD.cjs.map +0 -1
- package/dist/ShowSelection-BsHFfdMi.js +0 -29
- package/dist/ShowSelection-BsHFfdMi.js.map +0 -1
- package/dist/ShowSelection-DhXglbt8.cjs +0 -2
- package/dist/ShowSelection-DhXglbt8.cjs.map +0 -1
- package/dist/blocks-Bm6IfL1R.cjs +0 -11
- package/dist/blocks-Bm6IfL1R.cjs.map +0 -1
- package/dist/blocks-DGsP5WKr.js.map +0 -1
- package/dist/en-B9hMApn4.js.map +0 -1
- package/dist/en-Cj5r8sW_.cjs.map +0 -1
- package/dist/extensions-Co4y7P63.js.map +0 -1
- package/dist/extensions-IJK3t0sz.cjs +0 -52
- package/dist/extensions-IJK3t0sz.cjs.map +0 -1
- package/dist/src-B6rlChSc.cjs +0 -21
- package/dist/src-B6rlChSc.cjs.map +0 -1
- package/dist/src-Bcud0PIg.js.map +0 -1
- package/src/comments/userstore/UserStore.ts +0 -72
- package/src/extensions/Collaboration/Collaboration.ts +0 -55
- package/src/extensions/Collaboration/ForkYDoc.test.ts +0 -179
- package/src/extensions/tiptap-extensions/Suggestions/SuggestionMarks.ts +0 -175
- package/types/src/comments/userstore/UserStore.d.ts +0 -31
- package/types/src/extensions/tiptap-extensions/Suggestions/SuggestionMarks.d.ts +0 -4
- /package/src/{extensions/Collaboration → yjs/extensions}/YUndo.ts +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-editor-forked.json +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-editor.json +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-forked.html +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap.html +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/SchemaMigration.ts +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/index.ts +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/migrationRule.ts +0 -0
- /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.ts +0 -0
- /package/types/src/{comments/threadstore/yjs/YjsThreadStore.test.d.ts → api/getBlockInfoFromPos.test.d.ts} +0 -0
- /package/types/src/{extensions/Collaboration/ForkYDoc.test.d.ts → api/nodeConversions/blockToNode.test.d.ts} +0 -0
- /package/types/src/{extensions/Collaboration/schemaMigration/migrationRules/moveColorAttributes.test.d.ts → editor/managers/ExtensionManager/ExtensionManager.test.d.ts} +0 -0
- /package/types/src/{extensions/Collaboration → yjs/extensions}/YUndo.d.ts +0 -0
- /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/SchemaMigration.d.ts +0 -0
- /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/index.d.ts +0 -0
- /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/migrationRule.d.ts +0 -0
- /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.d.ts +0 -0
|
@@ -112,7 +112,8 @@ function calculateListItemIndex(
|
|
|
112
112
|
// chain.length > 1 means we found predecessor list items, so not first.
|
|
113
113
|
return {
|
|
114
114
|
index,
|
|
115
|
-
isFirst:
|
|
115
|
+
isFirst:
|
|
116
|
+
chain.length === 1 ? isFirst || predecessorIndex === undefined : false,
|
|
116
117
|
hasStart,
|
|
117
118
|
};
|
|
118
119
|
}
|
|
@@ -146,58 +147,54 @@ function getDecorations(
|
|
|
146
147
|
// in *other* blockGroups (e.g. nested lists) are independent.
|
|
147
148
|
const completedGroups = new Set<Node>();
|
|
148
149
|
|
|
149
|
-
tr.doc.nodesBetween(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (parent && completedGroups.has(parent)) {
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (
|
|
158
|
-
node.type.name === "blockContainer" &&
|
|
159
|
-
node.firstChild!.type.name === "numberedListItem"
|
|
160
|
-
) {
|
|
161
|
-
const { index, isFirst, hasStart } = calculateListItemIndex(
|
|
162
|
-
node,
|
|
163
|
-
pos,
|
|
164
|
-
tr,
|
|
165
|
-
map,
|
|
166
|
-
);
|
|
150
|
+
tr.doc.nodesBetween(range.from, tr.doc.nodeSize - 2, (node, pos, parent) => {
|
|
151
|
+
if (parent && completedGroups.has(parent)) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
167
154
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
155
|
+
if (
|
|
156
|
+
node.type.name === "blockContainer" &&
|
|
157
|
+
node.firstChild!.type.name === "numberedListItem"
|
|
158
|
+
) {
|
|
159
|
+
const { index, isFirst, hasStart } = calculateListItemIndex(
|
|
160
|
+
node,
|
|
161
|
+
pos,
|
|
162
|
+
tr,
|
|
163
|
+
map,
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
// Search only the numberedListItem node range, not the full
|
|
167
|
+
// blockContainer (which includes nested blockGroups whose
|
|
168
|
+
// decorations could falsely match).
|
|
169
|
+
const blockNode = tr.doc.nodeAt(pos + 1)!;
|
|
170
|
+
const existingDecorations = nextDecorationSet.find(
|
|
171
|
+
pos + 1,
|
|
172
|
+
pos + 1 + blockNode.nodeSize,
|
|
173
|
+
(deco: DecoSpec) =>
|
|
174
|
+
deco.index === index &&
|
|
175
|
+
deco.isFirst === isFirst &&
|
|
176
|
+
deco.hasStart === hasStart,
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
if (existingDecorations.length === 0) {
|
|
180
|
+
decorationsToAdd.push(
|
|
181
|
+
Decoration.node(
|
|
182
|
+
pos + 1,
|
|
183
|
+
pos + 1 + blockNode.nodeSize,
|
|
184
|
+
{ "data-index": index.toString() },
|
|
185
|
+
{ index, isFirst, hasStart },
|
|
186
|
+
) as Deco,
|
|
179
187
|
);
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
{ "data-index": index.toString() },
|
|
187
|
-
{ index, isFirst, hasStart },
|
|
188
|
-
) as Deco,
|
|
189
|
-
);
|
|
190
|
-
} else if (pos >= range.to && parent) {
|
|
191
|
-
// Past the changed range and decoration matches in this blockGroup:
|
|
192
|
-
// all subsequent siblings must also match. Mark group as done and
|
|
193
|
-
// skip this node's children (nested lists are unaffected too).
|
|
194
|
-
completedGroups.add(parent);
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
188
|
+
} else if (pos >= range.to && parent) {
|
|
189
|
+
// Past the changed range and decoration matches in this blockGroup:
|
|
190
|
+
// all subsequent siblings must also match. Mark group as done and
|
|
191
|
+
// skip this node's children (nested lists are unaffected too).
|
|
192
|
+
completedGroups.add(parent);
|
|
193
|
+
return false;
|
|
197
194
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
);
|
|
195
|
+
}
|
|
196
|
+
return undefined;
|
|
197
|
+
});
|
|
201
198
|
|
|
202
199
|
// Remove any decorations that exist at the same position, they will be replaced by the new decorations
|
|
203
200
|
const decorationsToRemove = decorationsToAdd.flatMap((deco) =>
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { TextSelection } from "prosemirror-state";
|
|
2
2
|
import { CellSelection } from "prosemirror-tables";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
afterAll,
|
|
5
|
+
beforeAll,
|
|
6
|
+
beforeEach,
|
|
7
|
+
describe,
|
|
8
|
+
expect,
|
|
9
|
+
it,
|
|
10
|
+
} from "vite-plus/test";
|
|
4
11
|
|
|
5
12
|
import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
6
13
|
import type { PartialBlock } from "../defaultBlocks.js";
|
|
@@ -111,11 +118,7 @@ describe("Table Enter keyboard shortcut", () => {
|
|
|
111
118
|
|
|
112
119
|
editor.transact((tr) =>
|
|
113
120
|
tr.setSelection(
|
|
114
|
-
CellSelection.create(
|
|
115
|
-
tr.doc,
|
|
116
|
-
cellPositions[0],
|
|
117
|
-
cellPositions[1],
|
|
118
|
-
) as any,
|
|
121
|
+
CellSelection.create(tr.doc, cellPositions[0], cellPositions[1]) as any,
|
|
119
122
|
),
|
|
120
123
|
);
|
|
121
124
|
|
|
@@ -73,14 +73,28 @@ export const TableExtension = Extension.create({
|
|
|
73
73
|
},
|
|
74
74
|
// Enables navigating cells using the tab key.
|
|
75
75
|
Tab: () => {
|
|
76
|
-
return this.editor.commands.command(({ state, dispatch, view }) =>
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
return this.editor.commands.command(({ state, dispatch, view }) => {
|
|
77
|
+
if (!isInTable(state)) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
goToNextCell(1)(state, dispatch, view);
|
|
82
|
+
|
|
83
|
+
// Always return true to avoid accidental indents.
|
|
84
|
+
return true;
|
|
85
|
+
});
|
|
79
86
|
},
|
|
80
87
|
"Shift-Tab": () => {
|
|
81
|
-
return this.editor.commands.command(({ state, dispatch, view }) =>
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
return this.editor.commands.command(({ state, dispatch, view }) => {
|
|
89
|
+
if (!isInTable(state)) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Always return true to avoid accidental un-indents.
|
|
94
|
+
goToNextCell(-1)(state, dispatch, view);
|
|
95
|
+
|
|
96
|
+
return true;
|
|
97
|
+
});
|
|
84
98
|
},
|
|
85
99
|
};
|
|
86
100
|
},
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "../../schema/index.js";
|
|
12
12
|
import { mergeCSSClasses } from "../../util/browser.js";
|
|
13
13
|
import { camelToDataKebab } from "../../util/string.js";
|
|
14
|
+
import { suggestionMarks } from "../../pm-nodes/suggestionMarks.js";
|
|
14
15
|
import { createDefaultBlockDOMOutputSpec } from "../defaultBlockHelpers.js";
|
|
15
16
|
import { defaultProps } from "../defaultProps.js";
|
|
16
17
|
import { EMPTY_CELL_WIDTH, TableExtension } from "./TableExtension.js";
|
|
@@ -39,6 +40,10 @@ const TiptapTableHeader = Node.create<{
|
|
|
39
40
|
*/
|
|
40
41
|
content: "tableContent+",
|
|
41
42
|
|
|
43
|
+
marks() {
|
|
44
|
+
return suggestionMarks(this.editor);
|
|
45
|
+
},
|
|
46
|
+
|
|
42
47
|
addAttributes() {
|
|
43
48
|
return {
|
|
44
49
|
colspan: {
|
|
@@ -99,6 +104,10 @@ const TiptapTableCell = Node.create<{
|
|
|
99
104
|
|
|
100
105
|
content: "tableContent+",
|
|
101
106
|
|
|
107
|
+
marks() {
|
|
108
|
+
return suggestionMarks(this.editor);
|
|
109
|
+
},
|
|
110
|
+
|
|
102
111
|
addAttributes() {
|
|
103
112
|
return {
|
|
104
113
|
colspan: {
|
|
@@ -152,7 +161,9 @@ const TiptapTableNode = Node.create({
|
|
|
152
161
|
group: "blockContent",
|
|
153
162
|
tableRole: "table",
|
|
154
163
|
|
|
155
|
-
marks
|
|
164
|
+
marks() {
|
|
165
|
+
return suggestionMarks(this.editor);
|
|
166
|
+
},
|
|
156
167
|
isolating: true,
|
|
157
168
|
|
|
158
169
|
parseHTML() {
|
|
@@ -256,9 +267,9 @@ const TiptapTableNode = Node.create({
|
|
|
256
267
|
|
|
257
268
|
// `TableView` implements its own `update` method, as the view needs to
|
|
258
269
|
// be persisted across updates for column resizing to work properly.
|
|
259
|
-
// However, it doesn't do anything else, so we have to re-apply the
|
|
260
|
-
// HTML attributes from props manually. This isn't an issue for node
|
|
261
|
-
// views created e.g. by custom blocks, as those aren't persisted
|
|
270
|
+
// However, it doesn't do anything else, so we have to re-apply the
|
|
271
|
+
// HTML attributes from props manually. This isn't an issue for node
|
|
272
|
+
// views created e.g. by custom blocks, as those aren't persisted
|
|
262
273
|
// across updates (they are reinstantiated each time), and so
|
|
263
274
|
// `HTMLAttributes` is always up-to-date for those.
|
|
264
275
|
update(updatedNode: PMNode): boolean {
|
|
@@ -347,7 +358,9 @@ const TiptapTableRow = Node.create<{
|
|
|
347
358
|
content: "(tableCell | tableHeader)+",
|
|
348
359
|
|
|
349
360
|
tableRole: "row",
|
|
350
|
-
marks
|
|
361
|
+
marks() {
|
|
362
|
+
return suggestionMarks(this.editor);
|
|
363
|
+
},
|
|
351
364
|
parseHTML() {
|
|
352
365
|
return [{ tag: "tr" }];
|
|
353
366
|
},
|
|
@@ -83,7 +83,7 @@ export const createVideoBlockSpec = createBlockSpec(
|
|
|
83
83
|
const video = document.createElement("video");
|
|
84
84
|
video.className = "bn-visual-media";
|
|
85
85
|
if (editor.resolveFileUrl) {
|
|
86
|
-
editor.resolveFileUrl(block.props.url).then((downloadUrl) => {
|
|
86
|
+
void editor.resolveFileUrl(block.props.url).then((downloadUrl) => {
|
|
87
87
|
video.src = downloadUrl;
|
|
88
88
|
});
|
|
89
89
|
} else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { splitBlockTr } from "../../api/blockManipulation/commands/splitBlock/splitBlock.js";
|
|
2
2
|
import { updateBlockTr } from "../../api/blockManipulation/commands/updateBlock/updateBlock.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getBlockInfoFromSelection } from "../../api/getBlockInfoFromPos.js";
|
|
4
4
|
import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
5
5
|
|
|
6
6
|
export const handleEnter = (
|
|
@@ -9,7 +9,7 @@ export const handleEnter = (
|
|
|
9
9
|
) => {
|
|
10
10
|
const { blockInfo, selectionEmpty } = editor.transact((tr) => {
|
|
11
11
|
return {
|
|
12
|
-
blockInfo:
|
|
12
|
+
blockInfo: getBlockInfoFromSelection(tr),
|
|
13
13
|
selectionEmpty: tr.selection.anchor === tr.selection.head,
|
|
14
14
|
};
|
|
15
15
|
});
|
|
@@ -34,6 +34,7 @@ export const handleEnter = (
|
|
|
34
34
|
} else if (blockContent.node.childCount > 0) {
|
|
35
35
|
return editor.transact((tr) => {
|
|
36
36
|
tr.deleteSelection();
|
|
37
|
+
tr.scrollIntoView();
|
|
37
38
|
return splitBlockTr(tr, tr.selection.from, true);
|
|
38
39
|
});
|
|
39
40
|
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { Node } from "prosemirror-model";
|
|
2
2
|
import { Plugin, PluginKey } from "prosemirror-state";
|
|
3
3
|
import { Decoration, DecorationSet } from "prosemirror-view";
|
|
4
|
-
import { getRelativeSelection, ySyncPluginKey } from "y-prosemirror";
|
|
5
4
|
import {
|
|
6
5
|
createExtension,
|
|
7
6
|
createStore,
|
|
8
7
|
ExtensionOptions,
|
|
9
8
|
} from "../editor/BlockNoteExtension.js";
|
|
10
9
|
import { ShowSelectionExtension } from "../extensions/ShowSelection/ShowSelection.js";
|
|
10
|
+
import { normalizeToUserStore, UserStoreOrResolver } from "../user/index.js";
|
|
11
11
|
import { CustomBlockNoteSchema } from "../schema/schema.js";
|
|
12
12
|
import { CommentMark } from "./mark.js";
|
|
13
13
|
import type { ThreadStore } from "./threadstore/ThreadStore.js";
|
|
14
14
|
import type { CommentBody, ThreadData } from "./types.js";
|
|
15
|
-
import { User } from "./types.js";
|
|
16
|
-
import { UserStore } from "./userstore/UserStore.js";
|
|
17
15
|
|
|
18
16
|
const PLUGIN_KEY = new PluginKey("blocknote-comments");
|
|
19
17
|
|
|
@@ -61,22 +59,40 @@ function getUpdatedThreadPositions(doc: Node, markType: string) {
|
|
|
61
59
|
export const CommentsExtension = createExtension(
|
|
62
60
|
({
|
|
63
61
|
editor,
|
|
64
|
-
options: {
|
|
62
|
+
options: {
|
|
63
|
+
schema: commentEditorSchema,
|
|
64
|
+
threadStore,
|
|
65
|
+
resolveUsers,
|
|
66
|
+
confirmBeforeDiscard = true,
|
|
67
|
+
},
|
|
65
68
|
}: ExtensionOptions<{
|
|
66
69
|
/**
|
|
67
70
|
* The thread store implementation to use for storing and retrieving comment threads
|
|
68
71
|
*/
|
|
69
72
|
threadStore: ThreadStore;
|
|
70
73
|
/**
|
|
71
|
-
* Resolve user information for
|
|
74
|
+
* Resolve user information (names, avatars) for comment authors.
|
|
75
|
+
*
|
|
76
|
+
* Either a resolver function (called with the ids of users that are not yet
|
|
77
|
+
* cached, returning their information) or a pre-built user store (see
|
|
78
|
+
* `createUserStore`). Pass the same store to the collaboration options so a
|
|
79
|
+
* single de-duped user cache is shared across comments and collaboration.
|
|
72
80
|
*
|
|
73
81
|
* See [Comments](https://www.blocknotejs.org/docs/features/collaboration/comments) for more info.
|
|
74
82
|
*/
|
|
75
|
-
resolveUsers:
|
|
83
|
+
resolveUsers: UserStoreOrResolver;
|
|
76
84
|
/**
|
|
77
85
|
* A schema to use for the comment editor (which allows you to customize the blocks and styles that are available in the comment editor)
|
|
78
86
|
*/
|
|
79
87
|
schema?: CustomBlockNoteSchema<any, any, any>;
|
|
88
|
+
/**
|
|
89
|
+
* Whether to ask the user for confirmation before discarding unsaved text
|
|
90
|
+
* in a comment composer (a new comment, a reply, or an in-progress edit)
|
|
91
|
+
* when it's dismissed (e.g. by clicking outside or pressing Escape).
|
|
92
|
+
*
|
|
93
|
+
* @default true
|
|
94
|
+
*/
|
|
95
|
+
confirmBeforeDiscard?: boolean;
|
|
80
96
|
}>) => {
|
|
81
97
|
if (!resolveUsers) {
|
|
82
98
|
throw new Error(
|
|
@@ -88,9 +104,12 @@ export const CommentsExtension = createExtension(
|
|
|
88
104
|
"threadStore is required to be defined when using comments",
|
|
89
105
|
);
|
|
90
106
|
}
|
|
107
|
+
// Resolve users through this store, exposed on the extension instance so the
|
|
108
|
+
// comments UI can read from it directly. Accepts a resolver callback or a
|
|
109
|
+
// shared store (see the option docs above).
|
|
110
|
+
const userStore = normalizeToUserStore(resolveUsers);
|
|
91
111
|
const markType = CommentMark.name;
|
|
92
112
|
|
|
93
|
-
const userStore = new UserStore<User>(resolveUsers);
|
|
94
113
|
const store = createStore(
|
|
95
114
|
{
|
|
96
115
|
pendingComment: false,
|
|
@@ -158,6 +177,7 @@ export const CommentsExtension = createExtension(
|
|
|
158
177
|
return {
|
|
159
178
|
key: "comments",
|
|
160
179
|
store,
|
|
180
|
+
userStore,
|
|
161
181
|
runsBefore: ["link"],
|
|
162
182
|
tiptapExtensions: [CommentMark],
|
|
163
183
|
prosemirrorPlugins: [
|
|
@@ -351,21 +371,10 @@ export const CommentsExtension = createExtension(
|
|
|
351
371
|
}) {
|
|
352
372
|
const thread = await threadStore.createThread(options);
|
|
353
373
|
if (threadStore.addThreadToDocument) {
|
|
354
|
-
const view = editor.prosemirrorView!;
|
|
355
|
-
const pmSelection = view.state.selection;
|
|
356
|
-
const ystate = ySyncPluginKey.getState(view.state);
|
|
357
|
-
const selection = {
|
|
358
|
-
prosemirror: {
|
|
359
|
-
head: pmSelection.head,
|
|
360
|
-
anchor: pmSelection.anchor,
|
|
361
|
-
},
|
|
362
|
-
yjs: ystate
|
|
363
|
-
? getRelativeSelection(ystate.binding, view.state)
|
|
364
|
-
: undefined,
|
|
365
|
-
};
|
|
366
374
|
await threadStore.addThreadToDocument({
|
|
367
375
|
threadId: thread.id,
|
|
368
|
-
selection,
|
|
376
|
+
selection: editor.transact((tr) => tr.selection),
|
|
377
|
+
editor,
|
|
369
378
|
});
|
|
370
379
|
} else {
|
|
371
380
|
(editor as any)._tiptapEditor.commands.setMark(markType, {
|
|
@@ -374,8 +383,8 @@ export const CommentsExtension = createExtension(
|
|
|
374
383
|
});
|
|
375
384
|
}
|
|
376
385
|
},
|
|
377
|
-
userStore,
|
|
378
386
|
commentEditorSchema,
|
|
387
|
+
confirmBeforeDiscard,
|
|
379
388
|
} as const;
|
|
380
389
|
},
|
|
381
390
|
);
|
package/src/comments/index.ts
CHANGED
|
@@ -4,7 +4,4 @@ export * from "./threadstore/DefaultThreadStoreAuth.js";
|
|
|
4
4
|
export * from "./threadstore/ThreadStore.js";
|
|
5
5
|
export * from "./threadstore/ThreadStoreAuth.js";
|
|
6
6
|
export * from "./threadstore/TipTapThreadStore.js";
|
|
7
|
-
export * from "./threadstore/yjs/RESTYjsThreadStore.js";
|
|
8
|
-
export * from "./threadstore/yjs/YjsThreadStore.js";
|
|
9
|
-
export * from "./threadstore/yjs/YjsThreadStoreBase.js";
|
|
10
7
|
export * from "./types.js";
|
package/src/comments/mark.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Mark, mergeAttributes } from "@tiptap/core";
|
|
2
2
|
|
|
3
|
+
import { NON_FORMATTING_MARK_GROUP } from "../schema/markGroups.js";
|
|
4
|
+
|
|
3
5
|
export const CommentMark = Mark.create({
|
|
4
6
|
name: "comment",
|
|
5
7
|
excludes: "",
|
|
6
8
|
inclusive: false,
|
|
7
9
|
keepOnSplit: true,
|
|
10
|
+
// Allowed on "plain" blocks (e.g. code blocks) via this group.
|
|
11
|
+
group: NON_FORMATTING_MARK_GROUP,
|
|
8
12
|
|
|
9
13
|
addAttributes() {
|
|
10
14
|
// Return an object with attribute configuration
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
1
2
|
import { CommentBody, CommentData, ThreadData } from "../types.js";
|
|
2
3
|
import { ThreadStoreAuth } from "./ThreadStoreAuth.js";
|
|
3
4
|
|
|
@@ -23,15 +24,10 @@ export abstract class ThreadStore {
|
|
|
23
24
|
abstract addThreadToDocument?(options: {
|
|
24
25
|
threadId: string;
|
|
25
26
|
selection: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
anchor: number;
|
|
29
|
-
};
|
|
30
|
-
yjs?: {
|
|
31
|
-
head: any;
|
|
32
|
-
anchor: any;
|
|
33
|
-
};
|
|
27
|
+
head: number;
|
|
28
|
+
anchor: number;
|
|
34
29
|
};
|
|
30
|
+
editor: BlockNoteEditor<any, any, any>;
|
|
35
31
|
}): Promise<void>;
|
|
36
32
|
|
|
37
33
|
/**
|