@blocknote/core 0.56.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.txt +101 -0
- package/dist/BlockNoteExtension-U58cXw1g.js +64 -0
- package/dist/ThreadStore-CSEwCO0O.js +8 -0
- package/dist/{UserStore-OZJP3K8T.js → UserStore-BFv6NXA-.js} +3 -7
- package/dist/ar-DPJDxCQI.js +3 -0
- package/dist/blocknote.js +8 -6
- package/dist/blocks-BUX9dXi9.js +2063 -0
- package/dist/blocks.js +3 -2
- package/dist/comments.js +8 -9
- package/dist/de-CakHBokE.js +3 -0
- package/dist/emoji-data.js +102 -0
- package/dist/en-BGdzE27X.js +3 -0
- package/dist/{en-Ch-vvt5e.js → en-Ne9rlj9Y.js} +9 -6
- package/dist/es-VeBX6MEG.js +3 -0
- package/dist/{extensions-BbM81hHa.js → extensions-CEgexSyF.js} +846 -824
- package/dist/extensions.js +4 -4
- package/dist/fa-Dt7EYtKf.js +3 -0
- package/dist/fr-DUhhjxrJ.js +3 -0
- package/dist/getDefaultSlashMenuItems-DfDOr807.js +1939 -0
- package/dist/he-BShJg1dK.js +3 -0
- package/dist/hr-BXtyqmwg.js +3 -0
- package/dist/is-2Fb-0w_j.js +3 -0
- package/dist/it-CiZtVb3Y.js +3 -0
- package/dist/ja-CsxD3kEL.js +3 -0
- package/dist/ko-It6g03Cy.js +3 -0
- package/dist/locales.js +692 -54
- package/dist/markGroups-BszXCkX8.js +18 -0
- package/dist/nb-CLao87La.js +3 -0
- package/dist/nl-JQSo8dht.js +3 -0
- package/dist/pl-DEMBgHEP.js +3 -0
- package/dist/pt-CBCdYAax.js +3 -0
- package/dist/ru-BQk_9Q-L.js +3 -0
- package/dist/sk-kgB2DtDL.js +3 -0
- package/dist/{src-BmLsLZfE.js → src-DksfoQmN.js} +1173 -1090
- package/dist/style.css +1 -1
- package/dist/tr-DkcSXX8f.js +3 -0
- package/dist/uk-Bib-e6bV.js +3 -0
- package/dist/uz-B2jaKhJb.js +3 -0
- package/dist/vi-V_GFRxE8.js +3 -0
- package/dist/y.js +356 -361
- package/dist/yjs.js +134 -135
- package/dist/zh-hant-2ZrAkFnC.js +3 -0
- package/dist/zh-jglyCmjs.js +3 -0
- package/package.json +45 -21
- package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.fixture.d.ts +5 -0
- package/types/src/api/blockManipulation/tables/tables.d.ts +9 -4
- package/types/src/api/clipboard/fromClipboard/normalizeOfficeHTML.d.ts +5 -0
- package/types/src/api/exporters/markdown/wrapWithDelimiter.d.ts +6 -0
- package/types/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.d.ts +4 -0
- package/types/src/blocks/defaultBlocks.d.ts +10 -0
- package/types/src/editor/BlockNoteEditor.d.ts +2 -1
- package/types/src/editor/managers/ExtensionManager/index.d.ts +4 -4
- package/types/src/editor/managers/StyleManager.d.ts +2 -1
- package/types/src/emoji-data/frimousse/ar.d.ts +2 -0
- package/types/src/emoji-data/frimousse/common.d.ts +3 -0
- package/types/src/emoji-data/frimousse/de.d.ts +2 -0
- package/types/src/emoji-data/frimousse/en.d.ts +2 -0
- package/types/src/emoji-data/frimousse/es.d.ts +2 -0
- package/types/src/emoji-data/frimousse/fa.d.ts +2 -0
- package/types/src/emoji-data/frimousse/fr.d.ts +2 -0
- package/types/src/emoji-data/frimousse/he.d.ts +2 -0
- package/types/src/emoji-data/frimousse/hr.d.ts +2 -0
- package/types/src/emoji-data/frimousse/is.d.ts +2 -0
- package/types/src/emoji-data/frimousse/it.d.ts +2 -0
- package/types/src/emoji-data/frimousse/ja.d.ts +2 -0
- package/types/src/emoji-data/frimousse/ko.d.ts +2 -0
- package/types/src/emoji-data/frimousse/loadFrimousseData.d.ts +2 -0
- package/types/src/emoji-data/frimousse/nb.d.ts +2 -0
- package/types/src/emoji-data/frimousse/nl.d.ts +2 -0
- package/types/src/emoji-data/frimousse/pl.d.ts +2 -0
- package/types/src/emoji-data/frimousse/pt.d.ts +2 -0
- package/types/src/emoji-data/frimousse/ru.d.ts +2 -0
- package/types/src/emoji-data/frimousse/sk.d.ts +2 -0
- package/types/src/emoji-data/frimousse/tr.d.ts +2 -0
- package/types/src/emoji-data/frimousse/types.d.ts +21 -0
- package/types/src/emoji-data/frimousse/uk.d.ts +2 -0
- package/types/src/emoji-data/frimousse/uz.d.ts +2 -0
- package/types/src/emoji-data/frimousse/vi.d.ts +2 -0
- package/types/src/emoji-data/frimousse/zh-hant.d.ts +2 -0
- package/types/src/emoji-data/frimousse/zh.d.ts +2 -0
- package/types/src/emoji-data/index.d.ts +3 -0
- package/types/src/emoji-data/searchEmojis.d.ts +5 -0
- package/types/src/extensions/Loading/Loading.d.ts +11 -0
- package/types/src/extensions/SideMenu/MultipleNodeSelection.d.ts +13 -4
- package/types/src/extensions/SideMenu/SideMenu.d.ts +2 -1
- package/types/src/extensions/Versioning/Versioning.d.ts +2 -0
- package/types/src/extensions/Versioning/inMemoryVersioning.d.ts +1 -0
- package/types/src/extensions/Versioning/types.d.ts +12 -6
- package/types/src/extensions/Versioning/versioningState.d.ts +6 -0
- package/types/src/extensions/index.d.ts +1 -2
- package/types/src/i18n/dictionary.d.ts +4 -1
- package/types/src/i18n/locales/en.d.ts +6 -0
- package/types/src/i18n/locales/fa.d.ts +6 -0
- package/types/src/i18n/locales/index.d.ts +1 -0
- package/types/src/i18n/locales/sk.d.ts +6 -0
- package/types/src/i18n/locales/tr.d.ts +378 -0
- package/types/src/index.d.ts +0 -1
- package/types/src/schema/inlineContent/createSpec.d.ts +2 -1
- package/types/src/schema/inlineContent/internal.d.ts +1 -1
- package/types/src/schema/inlineContent/types.d.ts +2 -4
- package/types/src/schema/styles/createSpec.d.ts +2 -1
- package/types/src/schema/styles/internal.d.ts +4 -1
- package/types/src/schema/styles/types.d.ts +2 -0
- package/types/src/y/extensions/YSync.d.ts +1 -1
- package/types/src/y/extensions/index.d.ts +1 -1
- package/types/src/y/versioning/yhub.d.ts +2 -0
- package/types/src/yjs/extensions/Versioning.d.ts +1 -0
- package/types/src/yjs/extensions/YUndo.d.ts +3 -2
- package/types/src/yjs/extensions/index.d.ts +1 -1
- package/dist/BlockNoteExtension-DjEkXkR5.cjs +0 -2
- package/dist/BlockNoteExtension-DjEkXkR5.cjs.map +0 -1
- package/dist/BlockNoteExtension-TsTGtIeX.js +0 -87
- package/dist/BlockNoteExtension-TsTGtIeX.js.map +0 -1
- package/dist/ThreadStore-Bx-gSEh1.cjs +0 -2
- package/dist/ThreadStore-Bx-gSEh1.cjs.map +0 -1
- package/dist/ThreadStore-et9wB5Xt.js +0 -11
- package/dist/ThreadStore-et9wB5Xt.js.map +0 -1
- package/dist/UserStore-CTVzVGh-.cjs +0 -2
- package/dist/UserStore-CTVzVGh-.cjs.map +0 -1
- package/dist/UserStore-OZJP3K8T.js.map +0 -1
- package/dist/blocknote.cjs +0 -1
- package/dist/blocks-COVwe5Cf.cjs +0 -12
- package/dist/blocks-COVwe5Cf.cjs.map +0 -1
- package/dist/blocks-COYcDVg7.js +0 -3943
- package/dist/blocks-COYcDVg7.js.map +0 -1
- package/dist/blocks.cjs +0 -1
- package/dist/comments.cjs +0 -2
- package/dist/comments.cjs.map +0 -1
- package/dist/comments.js.map +0 -1
- package/dist/en-Ch-vvt5e.js.map +0 -1
- package/dist/en-N5lu0-j8.cjs +0 -2
- package/dist/en-N5lu0-j8.cjs.map +0 -1
- package/dist/extensions-BbM81hHa.js.map +0 -1
- package/dist/extensions-D_WkAfSt.cjs +0 -58
- package/dist/extensions-D_WkAfSt.cjs.map +0 -1
- package/dist/extensions.cjs +0 -1
- package/dist/locales.cjs +0 -2
- package/dist/locales.cjs.map +0 -1
- package/dist/locales.js.map +0 -1
- package/dist/src-4OQT3z5S.cjs +0 -23
- package/dist/src-4OQT3z5S.cjs.map +0 -1
- package/dist/src-BmLsLZfE.js.map +0 -1
- package/dist/webpack-stats.json +0 -1
- package/dist/y.cjs +0 -2
- package/dist/y.cjs.map +0 -1
- package/dist/y.js.map +0 -1
- package/dist/yjs.cjs +0 -2
- package/dist/yjs.cjs.map +0 -1
- package/dist/yjs.js.map +0 -1
- package/src/api/README.md +0 -8
- package/src/api/__snapshots__/blocks-deleted-nested-deep.json +0 -26
- package/src/api/__snapshots__/blocks-deleted-nested.json +0 -68
- package/src/api/__snapshots__/blocks-deleted.json +0 -26
- package/src/api/__snapshots__/blocks-indented-changed.json +0 -129
- package/src/api/__snapshots__/blocks-inserted-nested.json +0 -62
- package/src/api/__snapshots__/blocks-inserted.json +0 -20
- package/src/api/__snapshots__/blocks-moved-deeper-into-nesting.json +0 -164
- package/src/api/__snapshots__/blocks-moved-down-twice-in-same-parent.json +0 -44
- package/src/api/__snapshots__/blocks-moved-insert-changes-sibling-order.json +0 -26
- package/src/api/__snapshots__/blocks-moved-multiple-in-same-transaction.json +0 -188
- package/src/api/__snapshots__/blocks-moved-nested-sibling-reorder.json +0 -180
- package/src/api/__snapshots__/blocks-moved-to-different-parent.json +0 -78
- package/src/api/__snapshots__/blocks-moved-to-root-level.json +0 -78
- package/src/api/__snapshots__/blocks-moved-up-down-in-same-parent.json +0 -44
- package/src/api/__snapshots__/blocks-moved-up-down-in-same-transaction.json +0 -44
- package/src/api/__snapshots__/blocks-outdented-changed.json +0 -129
- package/src/api/__snapshots__/blocks-updated-content-inserted.json +0 -42
- package/src/api/__snapshots__/blocks-updated-multiple-insert.json +0 -50
- package/src/api/__snapshots__/blocks-updated-multiple.json +0 -82
- package/src/api/__snapshots__/blocks-updated-nested-deep.json +0 -42
- package/src/api/__snapshots__/blocks-updated-nested-multiple.json +0 -118
- package/src/api/__snapshots__/blocks-updated-nested.json +0 -78
- package/src/api/__snapshots__/blocks-updated-single.json +0 -42
- package/src/api/__snapshots__/blocks-updated.json +0 -42
- package/src/api/blockManipulation/__snapshots__/transactions.test.ts.snap +0 -34
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +0 -4570
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +0 -176
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +0 -95
- package/src/api/blockManipulation/commands/insertBlocks/insertPlacement.test.ts +0 -217
- package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +0 -2761
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +0 -251
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +0 -187
- package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +0 -13625
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +0 -391
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +0 -350
- package/src/api/blockManipulation/commands/nestBlock/__snapshots__/nestBlock.test.ts.snap +0 -952
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.test.ts +0 -917
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +0 -248
- package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +0 -5710
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +0 -306
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +0 -143
- package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +0 -3507
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +0 -364
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +0 -90
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +0 -15085
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +0 -1210
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +0 -706
- package/src/api/blockManipulation/getBlock/getBlock.ts +0 -104
- package/src/api/blockManipulation/insertContentAt.ts +0 -83
- package/src/api/blockManipulation/layoutBlocks/fixLayoutBlock.ts +0 -173
- package/src/api/blockManipulation/layoutBlocks/layoutBlocks.browser.test.ts +0 -293
- package/src/api/blockManipulation/layoutBlocks/layoutBlocks.fixture.ts +0 -145
- package/src/api/blockManipulation/layoutBlocks/layoutBlocks.test.ts +0 -783
- package/src/api/blockManipulation/layoutBlocks/plainBlocks.test.ts +0 -180
- package/src/api/blockManipulation/layoutBlocks/titledBlocks.test.ts +0 -365
- package/src/api/blockManipulation/selections/selection.ts +0 -234
- package/src/api/blockManipulation/selections/textCursorPosition.ts +0 -63
- package/src/api/blockManipulation/setupTestEnv.ts +0 -223
- package/src/api/blockManipulation/tables/tables.test.ts +0 -2127
- package/src/api/blockManipulation/tables/tables.ts +0 -887
- package/src/api/clipboard/fromClipboard/acceptedMIMETypes.ts +0 -8
- package/src/api/clipboard/fromClipboard/fileDropExtension.ts +0 -55
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +0 -209
- package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +0 -38
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +0 -157
- package/src/api/clipboard/toClipboard/copyExtension.ts +0 -299
- package/src/api/combineTransactionSteps.ts +0 -22
- package/src/api/exporters/html/externalHTMLExporter.ts +0 -76
- package/src/api/exporters/html/internalHTMLSerializer.ts +0 -182
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +0 -510
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +0 -283
- package/src/api/exporters/markdown/htmlToMarkdown.ts +0 -895
- package/src/api/exporters/markdown/markdownExporter.ts +0 -41
- package/src/api/getBlockInfoFromPos.test.ts +0 -681
- package/src/api/getBlockInfoFromPos.ts +0 -693
- package/src/api/getBlocksChangedByTransaction.test.ts +0 -783
- package/src/api/getBlocksChangedByTransaction.ts +0 -458
- package/src/api/getChangedRangeWithAttrs.ts +0 -54
- package/src/api/getChangedRanges.test.ts +0 -391
- package/src/api/getChangedRanges.ts +0 -368
- package/src/api/nodeConversions/blockToNode.test.ts +0 -113
- package/src/api/nodeConversions/blockToNode.ts +0 -427
- package/src/api/nodeConversions/fragmentToBlocks.ts +0 -48
- package/src/api/nodeConversions/nodeToBlock.ts +0 -717
- package/src/api/nodeUtil.ts +0 -46
- package/src/api/parsers/html/parseHTML.ts +0 -80
- package/src/api/parsers/html/util/__snapshots__/nestedLists.test.ts.snap +0 -144
- package/src/api/parsers/html/util/nestedLists.test.ts +0 -165
- package/src/api/parsers/html/util/nestedLists.ts +0 -123
- package/src/api/parsers/html/util/normalizeWhitespace.ts +0 -87
- package/src/api/parsers/markdown/autolink.ts +0 -23
- package/src/api/parsers/markdown/detectMarkdown.test.ts +0 -211
- package/src/api/parsers/markdown/detectMarkdown.ts +0 -61
- package/src/api/parsers/markdown/markdownToHtml.ts +0 -1444
- package/src/api/parsers/markdown/parseMarkdown.ts +0 -24
- package/src/api/pmUtil.ts +0 -79
- package/src/api/positionMapping.test.ts +0 -209
- package/src/api/positionMapping.ts +0 -42
- package/src/blocks/Audio/block.ts +0 -171
- package/src/blocks/Audio/parseAudioElement.ts +0 -5
- package/src/blocks/BlockNoteSchema.ts +0 -59
- package/src/blocks/Code/CodeBlockOptions.ts +0 -83
- package/src/blocks/Code/block.test.ts +0 -265
- package/src/blocks/Code/block.ts +0 -56
- package/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.ts +0 -125
- package/src/blocks/Code/helpers/parse/parsePreCode.ts +0 -45
- package/src/blocks/Code/helpers/render/createCodeBlock.ts +0 -98
- package/src/blocks/Code/helpers/toExternalHTML/createPreCode.ts +0 -14
- package/src/blocks/Divider/block.ts +0 -49
- package/src/blocks/File/block.ts +0 -95
- package/src/blocks/File/helpers/parse/parseEmbedElement.ts +0 -5
- package/src/blocks/File/helpers/parse/parseFigureElement.ts +0 -16
- package/src/blocks/File/helpers/render/createAddFileButton.ts +0 -69
- package/src/blocks/File/helpers/render/createFileBlockWrapper.ts +0 -88
- package/src/blocks/File/helpers/render/createFileNameWithIcon.ts +0 -37
- package/src/blocks/File/helpers/render/createResizableFileBlockWrapper.ts +0 -271
- package/src/blocks/File/helpers/toExternalHTML/createFigureWithCaption.ts +0 -13
- package/src/blocks/File/helpers/toExternalHTML/createLinkWithCaption.ts +0 -15
- package/src/blocks/Heading/block.ts +0 -227
- package/src/blocks/Image/block.ts +0 -193
- package/src/blocks/Image/parseImageElement.ts +0 -7
- package/src/blocks/ListItem/BulletListItem/block.ts +0 -129
- package/src/blocks/ListItem/CheckListItem/block.test.ts +0 -61
- package/src/blocks/ListItem/CheckListItem/block.ts +0 -184
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.ts +0 -352
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +0 -239
- package/src/blocks/ListItem/NumberedListItem/block.ts +0 -143
- package/src/blocks/ListItem/ToggleListItem/block.ts +0 -139
- package/src/blocks/ListItem/getListItemContent.ts +0 -115
- package/src/blocks/PageBreak/block.ts +0 -72
- package/src/blocks/PageBreak/getPageBreakSlashMenuItems.ts +0 -47
- package/src/blocks/Paragraph/block.ts +0 -80
- package/src/blocks/Quote/block.ts +0 -99
- package/src/blocks/README.md +0 -3
- package/src/blocks/Table/TableExtension.test.ts +0 -231
- package/src/blocks/Table/TableExtension.ts +0 -115
- package/src/blocks/Table/block.ts +0 -492
- package/src/blocks/ToggleWrapper/createToggleFrame.ts +0 -126
- package/src/blocks/ToggleWrapper/toggleBlocks.browser.test.ts +0 -1056
- package/src/blocks/Video/block.ts +0 -142
- package/src/blocks/Video/parseVideoElement.ts +0 -7
- package/src/blocks/defaultBlockHelpers.ts +0 -113
- package/src/blocks/defaultBlockTypeGuards.ts +0 -167
- package/src/blocks/defaultBlockTypeItems.test.ts +0 -70
- package/src/blocks/defaultBlockTypeItems.ts +0 -99
- package/src/blocks/defaultBlocks.test.ts +0 -67
- package/src/blocks/defaultBlocks.ts +0 -214
- package/src/blocks/defaultProps.ts +0 -165
- package/src/blocks/getDetailsContent.ts +0 -77
- package/src/blocks/index.ts +0 -30
- package/src/comments/CommentEditorSubmitExtension.test.ts +0 -141
- package/src/comments/CommentEditorSubmitExtension.ts +0 -56
- package/src/comments/extension.ts +0 -396
- package/src/comments/index.ts +0 -8
- package/src/comments/mark.ts +0 -64
- package/src/comments/threadstore/DefaultThreadStoreAuth.ts +0 -106
- package/src/comments/threadstore/ThreadStore.ts +0 -130
- package/src/comments/threadstore/ThreadStoreAuth.ts +0 -13
- package/src/comments/threadstore/TipTapThreadStore.ts +0 -292
- package/src/comments/threadstore/tiptap/types.ts +0 -131
- package/src/comments/types.ts +0 -121
- package/src/editor/Block.css +0 -1498
- package/src/editor/BlockNoteEditor.node.test.ts +0 -35
- package/src/editor/BlockNoteEditor.test.ts +0 -278
- package/src/editor/BlockNoteEditor.ts +0 -1559
- package/src/editor/BlockNoteExtension.test.ts +0 -103
- package/src/editor/BlockNoteExtension.ts +0 -246
- package/src/editor/README.md +0 -3
- package/src/editor/blockColors.browser.test.ts +0 -127
- package/src/editor/cursorPositionTypes.ts +0 -17
- package/src/editor/defaultColors.ts +0 -77
- package/src/editor/editor.css +0 -257
- package/src/editor/managers/BlockManager.ts +0 -256
- package/src/editor/managers/EventManager.browser.test.ts +0 -334
- package/src/editor/managers/EventManager.ts +0 -260
- package/src/editor/managers/ExportManager.ts +0 -137
- package/src/editor/managers/ExtensionManager/ExtensionManager.browser.test.ts +0 -45
- package/src/editor/managers/ExtensionManager/ExtensionManager.node.test.ts +0 -209
- package/src/editor/managers/ExtensionManager/ExtensionManager.test.ts +0 -336
- package/src/editor/managers/ExtensionManager/extensions.ts +0 -200
- package/src/editor/managers/ExtensionManager/index.ts +0 -764
- package/src/editor/managers/ExtensionManager/symbol.ts +0 -5
- package/src/editor/managers/SelectionManager.ts +0 -120
- package/src/editor/managers/StateManager.ts +0 -261
- package/src/editor/managers/StyleManager.browser.test.ts +0 -122
- package/src/editor/managers/StyleManager.test.ts +0 -98
- package/src/editor/managers/StyleManager.ts +0 -278
- package/src/editor/managers/index.ts +0 -8
- package/src/editor/performance.test.ts +0 -192
- package/src/editor/selectionTypes.ts +0 -14
- package/src/editor/transformPasted.test.ts +0 -295
- package/src/editor/transformPasted.ts +0 -294
- package/src/exporter/ExportImage.ts +0 -50
- package/src/exporter/Exporter.test.ts +0 -255
- package/src/exporter/Exporter.ts +0 -185
- package/src/exporter/index.ts +0 -3
- package/src/exporter/mapping.ts +0 -110
- package/src/extensions/BlockChange/BlockChange.ts +0 -67
- package/src/extensions/DropCursor/DropCursor.ts +0 -376
- package/src/extensions/DropCursor/dropIntoChildren.ts +0 -80
- package/src/extensions/DropCursor/utils.ts +0 -195
- package/src/extensions/FilePanel/FilePanel.ts +0 -41
- package/src/extensions/FormattingToolbar/FormattingToolbar.ts +0 -157
- package/src/extensions/History/History.ts +0 -11
- package/src/extensions/InlineContentBoundaryEdit/InlineContentBoundaryEdit.ts +0 -109
- package/src/extensions/LinkToolbar/LinkToolbar.ts +0 -76
- package/src/extensions/LinkToolbar/protocols.ts +0 -13
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.test.ts +0 -190
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.ts +0 -112
- package/src/extensions/Placeholder/Placeholder.test.ts +0 -23
- package/src/extensions/Placeholder/Placeholder.ts +0 -150
- package/src/extensions/PositionMapping/PositionMapping.ts +0 -68
- package/src/extensions/PreviousBlockType/PreviousBlockType.test.ts +0 -156
- package/src/extensions/PreviousBlockType/PreviousBlockType.ts +0 -201
- package/src/extensions/README.md +0 -3
- package/src/extensions/ReadOnly/ReadOnly.test.ts +0 -181
- package/src/extensions/ReadOnly/ReadOnly.ts +0 -73
- package/src/extensions/ShowSelection/ShowSelection.ts +0 -61
- package/src/extensions/SideMenu/MultipleNodeSelection.ts +0 -89
- package/src/extensions/SideMenu/SideMenu.ts +0 -470
- package/src/extensions/SideMenu/blockDropHandling.ts +0 -372
- package/src/extensions/SideMenu/blockGeometry.browser.test.ts +0 -148
- package/src/extensions/SideMenu/blockGeometry.test.ts +0 -46
- package/src/extensions/SideMenu/blockGeometry.ts +0 -53
- package/src/extensions/SideMenu/dragging.ts +0 -200
- package/src/extensions/SideMenu/sideMenuHover.test.ts +0 -36
- package/src/extensions/SideMenu/sideMenuHover.ts +0 -270
- package/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.ts +0 -193
- package/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.ts +0 -142
- package/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.ts +0 -4
- package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +0 -11
- package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +0 -309
- package/src/extensions/SuggestionMenu/SuggestionMenu.ts +0 -436
- package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +0 -76
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +0 -299
- package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.ts +0 -130
- package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.ts +0 -89
- package/src/extensions/SyntaxHighlighting/inlineHighlight.test.ts +0 -135
- package/src/extensions/SyntaxHighlighting/shiki.ts +0 -116
- package/src/extensions/TableHandles/TableHandles.browser.test.ts +0 -307
- package/src/extensions/TableHandles/TableHandles.ts +0 -1263
- package/src/extensions/TrailingNode/TrailingNode.ts +0 -233
- package/src/extensions/Versioning/Versioning.browser.test.ts +0 -151
- package/src/extensions/Versioning/Versioning.node.test.ts +0 -177
- package/src/extensions/Versioning/Versioning.ts +0 -161
- package/src/extensions/Versioning/__test__/result.ts +0 -12
- package/src/extensions/Versioning/comparison.test.ts +0 -40
- package/src/extensions/Versioning/createVersioning.test.ts +0 -867
- package/src/extensions/Versioning/createVersioning.ts +0 -499
- package/src/extensions/Versioning/formatVersionDate.ts +0 -24
- package/src/extensions/Versioning/inMemoryVersioning.test.ts +0 -572
- package/src/extensions/Versioning/inMemoryVersioning.ts +0 -268
- package/src/extensions/Versioning/index.ts +0 -6
- package/src/extensions/Versioning/scrollScheduling.test.ts +0 -51
- package/src/extensions/Versioning/scrollToFirstChange.test.ts +0 -320
- package/src/extensions/Versioning/scrollToFirstChange.ts +0 -139
- package/src/extensions/Versioning/types.ts +0 -219
- package/src/extensions/Versioning/versioningState.ts +0 -154
- package/src/extensions/blockDOM.browser.test.ts +0 -102
- package/src/extensions/blockDOM.test.ts +0 -178
- package/src/extensions/blockDOM.ts +0 -135
- package/src/extensions/index.ts +0 -27
- package/src/extensions/tiptap-extensions/BackgroundColor/BackgroundColorExtension.ts +0 -17
- package/src/extensions/tiptap-extensions/HardBreak/HardBreak.ts +0 -35
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.ts +0 -1870
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +0 -1116
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/blockIdentity.browser.test.ts +0 -152
- package/src/extensions/tiptap-extensions/Link/helpers/autolink.ts +0 -174
- package/src/extensions/tiptap-extensions/Link/helpers/clickHandler.ts +0 -82
- package/src/extensions/tiptap-extensions/Link/helpers/linkDetector.ts +0 -412
- package/src/extensions/tiptap-extensions/Link/helpers/pasteHandler.ts +0 -53
- package/src/extensions/tiptap-extensions/Link/helpers/tlds.ts +0 -7
- package/src/extensions/tiptap-extensions/Link/helpers/whitespace.ts +0 -13
- package/src/extensions/tiptap-extensions/Link/index.ts +0 -2
- package/src/extensions/tiptap-extensions/Link/link.test.ts +0 -945
- package/src/extensions/tiptap-extensions/Link/link.ts +0 -238
- package/src/extensions/tiptap-extensions/TextAlignment/TextAlignmentExtension.ts +0 -33
- package/src/extensions/tiptap-extensions/TextColor/TextColorExtension.ts +0 -17
- package/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.ts +0 -173
- package/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts +0 -339
- package/src/extensions/tiptap-extensions/index.ts +0 -7
- package/src/extensions-shared/UiElementPosition.ts +0 -4
- package/src/fonts/inter.browser.test.ts +0 -57
- package/src/i18n/dictionary.ts +0 -17
- package/src/i18n/index.ts +0 -2
- package/src/i18n/locales/ar.ts +0 -443
- package/src/i18n/locales/de.ts +0 -477
- package/src/i18n/locales/en.ts +0 -458
- package/src/i18n/locales/es.ts +0 -456
- package/src/i18n/locales/fa.ts +0 -427
- package/src/i18n/locales/fr.ts +0 -504
- package/src/i18n/locales/he.ts +0 -458
- package/src/i18n/locales/hr.ts +0 -472
- package/src/i18n/locales/index.ts +0 -23
- package/src/i18n/locales/is.ts +0 -472
- package/src/i18n/locales/it.ts +0 -480
- package/src/i18n/locales/ja.ts +0 -498
- package/src/i18n/locales/ko.ts +0 -471
- package/src/i18n/locales/nl.ts +0 -459
- package/src/i18n/locales/no.ts +0 -476
- package/src/i18n/locales/pl.ts +0 -449
- package/src/i18n/locales/pt.ts +0 -451
- package/src/i18n/locales/ru.ts +0 -502
- package/src/i18n/locales/sk.ts +0 -456
- package/src/i18n/locales/uk.ts +0 -482
- package/src/i18n/locales/uz.ts +0 -492
- package/src/i18n/locales/vi.ts +0 -457
- package/src/i18n/locales/zh-tw.ts +0 -499
- package/src/i18n/locales/zh.ts +0 -499
- package/src/index.ts +0 -66
- package/src/locales.ts +0 -1
- package/src/pm-nodes/BlockContainer.test.ts +0 -101
- package/src/pm-nodes/BlockContainer.ts +0 -200
- package/src/pm-nodes/BlockGroup.ts +0 -58
- package/src/pm-nodes/Doc.ts +0 -11
- package/src/pm-nodes/README.md +0 -143
- package/src/pm-nodes/index.ts +0 -3
- package/src/pm-nodes/suggestionMarks.ts +0 -43
- package/src/schema/README.md +0 -3
- package/src/schema/blocks/children.test.ts +0 -288
- package/src/schema/blocks/children.ts +0 -136
- package/src/schema/blocks/createSpec.browser.test.ts +0 -176
- package/src/schema/blocks/createSpec.test.ts +0 -354
- package/src/schema/blocks/createSpec.ts +0 -732
- package/src/schema/blocks/extendBlockSpec.test.ts +0 -188
- package/src/schema/blocks/frame.test.ts +0 -112
- package/src/schema/blocks/frame.ts +0 -337
- package/src/schema/blocks/internal.test.ts +0 -86
- package/src/schema/blocks/internal.ts +0 -288
- package/src/schema/blocks/keyboard.ts +0 -154
- package/src/schema/blocks/layoutBlockAttributes.ts +0 -29
- package/src/schema/blocks/meta.test.ts +0 -53
- package/src/schema/blocks/meta.ts +0 -35
- package/src/schema/blocks/renderFrame.test.ts +0 -691
- package/src/schema/blocks/types.ts +0 -966
- package/src/schema/blocks/validateChildren.ts +0 -156
- package/src/schema/contentTypePropagation.test.ts +0 -182
- package/src/schema/dataAttributes.test.ts +0 -72
- package/src/schema/dataAttributes.ts +0 -69
- package/src/schema/index.ts +0 -15
- package/src/schema/inlineContent/createSpec.test.ts +0 -161
- package/src/schema/inlineContent/createSpec.ts +0 -409
- package/src/schema/inlineContent/internal.ts +0 -131
- package/src/schema/inlineContent/types.ts +0 -204
- package/src/schema/markGroups.ts +0 -82
- package/src/schema/nodeViewMutations.test.ts +0 -146
- package/src/schema/nodeViewMutations.ts +0 -49
- package/src/schema/propTypes.ts +0 -61
- package/src/schema/schema.test.ts +0 -110
- package/src/schema/schema.ts +0 -243
- package/src/schema/styles/createSpec.ts +0 -140
- package/src/schema/styles/internal.ts +0 -155
- package/src/schema/styles/types.ts +0 -57
- package/src/style.css +0 -2
- package/src/user/UserStore.ts +0 -199
- package/src/user/createUserStore.test.ts +0 -126
- package/src/user/index.ts +0 -2
- package/src/user/userColors.test.ts +0 -108
- package/src/user/userColors.ts +0 -101
- package/src/util/EventEmitter.ts +0 -59
- package/src/util/README.md +0 -3
- package/src/util/Store.test.ts +0 -132
- package/src/util/Store.ts +0 -135
- package/src/util/browser.ts +0 -54
- package/src/util/combineByGroup.ts +0 -25
- package/src/util/expandToWords.ts +0 -38
- package/src/util/string.ts +0 -36
- package/src/util/table.ts +0 -110
- package/src/util/topo-sort.test.ts +0 -125
- package/src/util/topo-sort.ts +0 -206
- package/src/util/typescript.ts +0 -17
- package/src/vite-env.d.ts +0 -7
- package/src/y/README.md +0 -5
- package/src/y/comments/RESTYjsThreadStore.ts +0 -138
- package/src/y/comments/YjsThreadStore.test.ts +0 -295
- package/src/y/comments/YjsThreadStore.ts +0 -358
- package/src/y/comments/YjsThreadStoreBase.ts +0 -50
- package/src/y/comments/index.ts +0 -3
- package/src/y/comments/yjsHelpers.ts +0 -125
- package/src/y/extensions/AttributionExtension.test.ts +0 -364
- package/src/y/extensions/AttributionExtension.ts +0 -401
- package/src/y/extensions/DiffVersioningExtension.test.ts +0 -242
- package/src/y/extensions/DiffVersioningExtension.ts +0 -200
- package/src/y/extensions/EmptyDocBinding.test.ts +0 -282
- package/src/y/extensions/ForkYDoc.node.test.ts +0 -77
- package/src/y/extensions/ForkYDoc.test.ts +0 -344
- package/src/y/extensions/ForkYDoc.ts +0 -117
- package/src/y/extensions/History.test.ts +0 -125
- package/src/y/extensions/RelativePositionMapping.test.ts +0 -453
- package/src/y/extensions/RelativePositionMapping.ts +0 -45
- package/src/y/extensions/Suggestions.ts +0 -174
- package/src/y/extensions/Versioning.node.test.ts +0 -126
- package/src/y/extensions/Versioning.test.ts +0 -117
- package/src/y/extensions/Versioning.ts +0 -74
- package/src/y/extensions/YAttributionMarks.ts +0 -422
- package/src/y/extensions/YCursorPlugin.ts +0 -192
- package/src/y/extensions/YSync.node.test.ts +0 -75
- package/src/y/extensions/YSync.ts +0 -197
- package/src/y/extensions/YSyncRemount.test.ts +0 -99
- package/src/y/extensions/blockMatchNodes.ts +0 -173
- package/src/y/extensions/index.ts +0 -140
- package/src/y/extensions/legacyYjsDocBinding.test.ts +0 -652
- package/src/y/extensions/nestingChanges.test.ts +0 -326
- package/src/y/extensions/persistentBlockGroups.test.ts +0 -1709
- package/src/y/extensions/persistentBlockGroups.ts +0 -953
- package/src/y/extensions/snapshotCodec.test.ts +0 -105
- package/src/y/extensions/snapshotCodec.ts +0 -39
- package/src/y/extensions/snapshotPreview.test.ts +0 -201
- package/src/y/extensions/snapshotPreview.ts +0 -292
- package/src/y/extensions/tableReshape.test.ts +0 -121
- package/src/y/extensions/v1BindingSnapshotDiff.test.ts +0 -121
- package/src/y/extensions/versionDiffAttribution.test.ts +0 -944
- package/src/y/extensions/versionDiffPerformance.test.ts +0 -101
- package/src/y/index.ts +0 -5
- package/src/y/utils.test.ts +0 -1309
- package/src/y/utils.ts +0 -366
- package/src/y/versioning/__test__/fixtures/activity-all-after.bin +0 -0
- package/src/y/versioning/__test__/fixtures/activity-all-after.json +0 -50
- package/src/y/versioning/__test__/fixtures/activity-all.bin +0 -0
- package/src/y/versioning/__test__/fixtures/activity-all.json +0 -20
- package/src/y/versioning/__test__/fixtures/activity-filtered-after.bin +0 -0
- package/src/y/versioning/__test__/fixtures/activity-filtered-after.json +0 -32
- package/src/y/versioning/__test__/fixtures/activity-filtered-before.json +0 -1
- package/src/y/versioning/__test__/fixtures/changeset.bin +0 -0
- package/src/y/versioning/__test__/fixtures/patch-response.json +0 -4
- package/src/y/versioning/__test__/yhub.test.ts +0 -966
- package/src/y/versioning/index.ts +0 -6
- package/src/y/versioning/yhub.ts +0 -350
- package/src/y/versioning/yhubClient.ts +0 -345
- package/src/yjs/README.md +0 -5
- package/src/yjs/comments/RESTYjsThreadStore.test.ts +0 -95
- package/src/yjs/comments/RESTYjsThreadStore.ts +0 -172
- package/src/yjs/comments/YjsThreadStore.test.ts +0 -295
- package/src/yjs/comments/YjsThreadStore.ts +0 -345
- package/src/yjs/comments/YjsThreadStoreBase.ts +0 -50
- package/src/yjs/comments/index.ts +0 -3
- package/src/yjs/comments/yjsHelpers.ts +0 -127
- package/src/yjs/extensions/FixUpSchema.test.ts +0 -421
- package/src/yjs/extensions/FixUpSchema.ts +0 -99
- package/src/yjs/extensions/ForkYDoc.browser.test.ts +0 -84
- package/src/yjs/extensions/ForkYDoc.node.test.ts +0 -231
- package/src/yjs/extensions/ForkYDoc.test.ts +0 -320
- package/src/yjs/extensions/ForkYDoc.ts +0 -177
- package/src/yjs/extensions/RelativePositionMapping.test.ts +0 -418
- package/src/yjs/extensions/RelativePositionMapping.ts +0 -77
- package/src/yjs/extensions/Versioning.test.ts +0 -376
- package/src/yjs/extensions/Versioning.ts +0 -126
- package/src/yjs/extensions/YCursorPlugin.ts +0 -201
- package/src/yjs/extensions/YSync.ts +0 -16
- package/src/yjs/extensions/YUndo.ts +0 -12
- package/src/yjs/extensions/__snapshots__/fork-yjs-snap-editor-forked.json +0 -19
- package/src/yjs/extensions/__snapshots__/fork-yjs-snap-editor.json +0 -19
- package/src/yjs/extensions/__snapshots__/fork-yjs-snap-forked.html +0 -1
- package/src/yjs/extensions/__snapshots__/fork-yjs-snap.html +0 -1
- package/src/yjs/extensions/index.ts +0 -89
- package/src/yjs/extensions/schemaMigration/SchemaMigration.ts +0 -59
- package/src/yjs/extensions/schemaMigration/migrationRules/index.ts +0 -4
- package/src/yjs/extensions/schemaMigration/migrationRules/migrationRule.ts +0 -4
- package/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.test.ts +0 -130
- package/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.ts +0 -91
- package/src/yjs/index.ts +0 -7
- package/src/yjs/utils.test.ts +0 -1013
- package/src/yjs/utils.ts +0 -186
- package/types/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/insertBlocks/insertPlacement.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/nestBlock/nestBlock.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/splitBlock/splitBlock.test.d.ts +0 -1
- package/types/src/api/blockManipulation/commands/updateBlock/updateBlock.test.d.ts +0 -1
- package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.browser.test.d.ts +0 -1
- package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/layoutBlocks/plainBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/layoutBlocks/titledBlocks.test.d.ts +0 -1
- package/types/src/api/blockManipulation/tables/tables.test.d.ts +0 -1
- package/types/src/api/getBlockInfoFromPos.test.d.ts +0 -1
- package/types/src/api/getBlocksChangedByTransaction.test.d.ts +0 -1
- package/types/src/api/getChangedRanges.test.d.ts +0 -1
- package/types/src/api/nodeConversions/blockToNode.test.d.ts +0 -1
- package/types/src/api/parsers/html/util/nestedLists.test.d.ts +0 -1
- package/types/src/api/parsers/markdown/detectMarkdown.test.d.ts +0 -1
- package/types/src/api/positionMapping.test.d.ts +0 -1
- package/types/src/blocks/Code/block.test.d.ts +0 -1
- package/types/src/blocks/ListItem/CheckListItem/block.test.d.ts +0 -1
- package/types/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.d.ts +0 -1
- package/types/src/blocks/Table/TableExtension.test.d.ts +0 -1
- package/types/src/blocks/ToggleWrapper/toggleBlocks.browser.test.d.ts +0 -1
- package/types/src/blocks/defaultBlockTypeItems.test.d.ts +0 -1
- package/types/src/blocks/defaultBlocks.test.d.ts +0 -1
- package/types/src/comments/CommentEditorSubmitExtension.test.d.ts +0 -1
- package/types/src/editor/BlockNoteEditor.node.test.d.ts +0 -1
- package/types/src/editor/BlockNoteEditor.test.d.ts +0 -1
- package/types/src/editor/BlockNoteExtension.test.d.ts +0 -1
- package/types/src/editor/blockColors.browser.test.d.ts +0 -1
- package/types/src/editor/managers/EventManager.browser.test.d.ts +0 -1
- package/types/src/editor/managers/ExtensionManager/ExtensionManager.browser.test.d.ts +0 -1
- package/types/src/editor/managers/ExtensionManager/ExtensionManager.node.test.d.ts +0 -1
- package/types/src/editor/managers/ExtensionManager/ExtensionManager.test.d.ts +0 -1
- package/types/src/editor/managers/StyleManager.browser.test.d.ts +0 -1
- package/types/src/editor/managers/StyleManager.test.d.ts +0 -1
- package/types/src/editor/performance.test.d.ts +0 -1
- package/types/src/editor/transformPasted.test.d.ts +0 -1
- package/types/src/exporter/Exporter.test.d.ts +0 -1
- package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.test.d.ts +0 -1
- package/types/src/extensions/Placeholder/Placeholder.test.d.ts +0 -1
- package/types/src/extensions/PreviousBlockType/PreviousBlockType.test.d.ts +0 -1
- package/types/src/extensions/ReadOnly/ReadOnly.test.d.ts +0 -1
- package/types/src/extensions/SideMenu/blockGeometry.browser.test.d.ts +0 -1
- package/types/src/extensions/SideMenu/blockGeometry.test.d.ts +0 -1
- package/types/src/extensions/SideMenu/sideMenuHover.test.d.ts +0 -1
- package/types/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.d.ts +0 -4
- package/types/src/extensions/SuggestionMenu/SuggestionMenu.test.d.ts +0 -1
- package/types/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.d.ts +0 -4
- package/types/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.d.ts +0 -1
- package/types/src/extensions/SyntaxHighlighting/inlineHighlight.test.d.ts +0 -1
- package/types/src/extensions/TableHandles/TableHandles.browser.test.d.ts +0 -1
- package/types/src/extensions/Versioning/Versioning.browser.test.d.ts +0 -1
- package/types/src/extensions/Versioning/Versioning.node.test.d.ts +0 -1
- package/types/src/extensions/Versioning/__test__/result.d.ts +0 -3
- package/types/src/extensions/Versioning/comparison.test.d.ts +0 -1
- package/types/src/extensions/Versioning/createVersioning.test.d.ts +0 -1
- package/types/src/extensions/Versioning/inMemoryVersioning.test.d.ts +0 -1
- package/types/src/extensions/Versioning/scrollScheduling.test.d.ts +0 -1
- package/types/src/extensions/Versioning/scrollToFirstChange.test.d.ts +0 -1
- package/types/src/extensions/blockDOM.browser.test.d.ts +0 -1
- package/types/src/extensions/blockDOM.test.d.ts +0 -1
- package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.d.ts +0 -4
- package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/blockIdentity.browser.test.d.ts +0 -1
- package/types/src/extensions/tiptap-extensions/Link/link.test.d.ts +0 -1
- package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.d.ts +0 -4
- package/types/src/fonts/inter.browser.test.d.ts +0 -2
- package/types/src/pm-nodes/BlockContainer.test.d.ts +0 -1
- package/types/src/schema/blocks/children.test.d.ts +0 -1
- package/types/src/schema/blocks/createSpec.browser.test.d.ts +0 -1
- package/types/src/schema/blocks/createSpec.test.d.ts +0 -1
- package/types/src/schema/blocks/extendBlockSpec.test.d.ts +0 -1
- package/types/src/schema/blocks/frame.test.d.ts +0 -1
- package/types/src/schema/blocks/internal.test.d.ts +0 -1
- package/types/src/schema/blocks/meta.test.d.ts +0 -1
- package/types/src/schema/blocks/renderFrame.test.d.ts +0 -1
- package/types/src/schema/contentTypePropagation.test.d.ts +0 -1
- package/types/src/schema/dataAttributes.test.d.ts +0 -1
- package/types/src/schema/inlineContent/createSpec.test.d.ts +0 -1
- package/types/src/schema/nodeViewMutations.test.d.ts +0 -1
- package/types/src/schema/schema.test.d.ts +0 -1
- package/types/src/user/createUserStore.test.d.ts +0 -1
- package/types/src/user/userColors.test.d.ts +0 -1
- package/types/src/util/Store.test.d.ts +0 -1
- package/types/src/util/topo-sort.test.d.ts +0 -1
- package/types/src/y/comments/YjsThreadStore.test.d.ts +0 -1
- package/types/src/y/extensions/AttributionExtension.test.d.ts +0 -1
- package/types/src/y/extensions/DiffVersioningExtension.test.d.ts +0 -1
- package/types/src/y/extensions/EmptyDocBinding.test.d.ts +0 -1
- package/types/src/y/extensions/ForkYDoc.node.test.d.ts +0 -1
- package/types/src/y/extensions/ForkYDoc.test.d.ts +0 -1
- package/types/src/y/extensions/History.test.d.ts +0 -1
- package/types/src/y/extensions/RelativePositionMapping.test.d.ts +0 -1
- package/types/src/y/extensions/Versioning.node.test.d.ts +0 -1
- package/types/src/y/extensions/Versioning.test.d.ts +0 -1
- package/types/src/y/extensions/YSync.node.test.d.ts +0 -1
- package/types/src/y/extensions/YSyncRemount.test.d.ts +0 -1
- package/types/src/y/extensions/legacyYjsDocBinding.test.d.ts +0 -1
- package/types/src/y/extensions/nestingChanges.test.d.ts +0 -1
- package/types/src/y/extensions/persistentBlockGroups.test.d.ts +0 -1
- package/types/src/y/extensions/snapshotCodec.test.d.ts +0 -1
- package/types/src/y/extensions/snapshotPreview.test.d.ts +0 -1
- package/types/src/y/extensions/tableReshape.test.d.ts +0 -1
- package/types/src/y/extensions/v1BindingSnapshotDiff.test.d.ts +0 -1
- package/types/src/y/extensions/versionDiffAttribution.test.d.ts +0 -1
- package/types/src/y/extensions/versionDiffPerformance.test.d.ts +0 -1
- package/types/src/y/utils.test.d.ts +0 -1
- package/types/src/y/versioning/__test__/yhub.test.d.ts +0 -1
- package/types/src/yjs/comments/RESTYjsThreadStore.test.d.ts +0 -1
- package/types/src/yjs/comments/YjsThreadStore.test.d.ts +0 -1
- package/types/src/yjs/extensions/FixUpSchema.test.d.ts +0 -1
- package/types/src/yjs/extensions/ForkYDoc.browser.test.d.ts +0 -1
- package/types/src/yjs/extensions/ForkYDoc.node.test.d.ts +0 -1
- package/types/src/yjs/extensions/ForkYDoc.test.d.ts +0 -1
- package/types/src/yjs/extensions/RelativePositionMapping.test.d.ts +0 -1
- package/types/src/yjs/extensions/Versioning.test.d.ts +0 -1
- package/types/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.test.d.ts +0 -1
- package/types/src/yjs/utils.test.d.ts +0 -1
package/dist/y.js
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { Y as e, m as t } from "./getDefaultSlashMenuItems-DfDOr807.js";
|
|
2
|
+
import { It as n } from "./blocks-BUX9dXi9.js";
|
|
3
|
+
import { t as r } from "./markGroups-BszXCkX8.js";
|
|
4
|
+
import { S as i, _ as a, b as o, x as s, y as c } from "./src-DksfoQmN.js";
|
|
5
|
+
import { B as l, O as u, i as d } from "./extensions-CEgexSyF.js";
|
|
6
|
+
import { n as f, t as p } from "./BlockNoteExtension-U58cXw1g.js";
|
|
7
|
+
import { n as m, t as h } from "./UserStore-BFv6NXA-.js";
|
|
8
|
+
import { t as g } from "./ThreadStore-CSEwCO0O.js";
|
|
9
|
+
import { Plugin as _, PluginKey as v } from "prosemirror-state";
|
|
10
|
+
import { Mark as y, getMarkRange as ee, posToDOMRect as te } from "@tiptap/core";
|
|
9
11
|
import { uuidv4 as b } from "lib0/random";
|
|
10
|
-
import { acceptAllChanges as
|
|
11
|
-
import * as
|
|
12
|
-
import * as
|
|
13
|
-
import * as
|
|
14
|
-
import { decodeAny as
|
|
15
|
-
|
|
12
|
+
import { acceptAllChanges as ne, acceptChanges as re, configureYProsemirror as x, defaultSelectionBuilder as ie, defaultTransformer as ae, deltaToPSteps as oe, docToDelta as se, nodeToDelta as ce, pauseSync as le, pmnodeToDelta as ue, rejectAllChanges as de, rejectChanges as fe, relativePositionStore as pe, syncPlugin as me, yCursorPlugin as he, ySyncPluginKey as ge, yattr2markname as _e, ynodeToPmnode as ve } from "@y/prosemirror";
|
|
13
|
+
import * as S from "@y/y";
|
|
14
|
+
import * as C from "lib0/delta";
|
|
15
|
+
import * as w from "lib0/delta/transformer";
|
|
16
|
+
import { decodeAny as T, encodeAny as E } from "lib0/buffer";
|
|
17
|
+
// src/y/extensions/YAttributionMarks.ts
|
|
16
18
|
var D = (e, t) => e === void 0 ? void 0 : typeof e == "string" ? e : e[t];
|
|
17
19
|
function O(e) {
|
|
18
20
|
return e.attrs.changes ?? {};
|
|
19
21
|
}
|
|
20
|
-
function
|
|
22
|
+
function ye(e) {
|
|
21
23
|
let t = e.attrs.format ?? {};
|
|
22
|
-
return Object.fromEntries(Object.entries(t).filter(([t]) => !(e.type.schema.marks[
|
|
24
|
+
return Object.fromEntries(Object.entries(t).filter(([t]) => !(e.type.schema.marks[_e(t)]?.spec.group ?? "").split(" ").includes(r)));
|
|
23
25
|
}
|
|
24
26
|
function k(e) {
|
|
25
27
|
return e.type.name === "y-attributed-attrs" ? [...new Set(Object.values(O(e)).flatMap((e) => e.userIds))] : e.attrs.userIds ?? [];
|
|
26
28
|
}
|
|
27
29
|
var A = (e, t) => ({ mark: n, inline: r }) => {
|
|
28
|
-
let i = t?.editor, a = O(n), { id:
|
|
30
|
+
let i = t?.editor, a = O(n), { id: l, ...u } = a, d = r ? a : u, f = e === "modification" ? ye(n) : void 0;
|
|
29
31
|
if (e === "attrs" && Object.keys(d).length === 0 || f && Object.keys(f).length === 0) {
|
|
30
32
|
let e = document.createElement(r ? "span" : "div");
|
|
31
33
|
return e.style.display = "contents", {
|
|
@@ -41,10 +43,10 @@ var A = (e, t) => ({ mark: n, inline: r }) => {
|
|
|
41
43
|
let g = D(t?.getAttributionMarkClassName?.({
|
|
42
44
|
contentType: r ? "inline-content" : "block",
|
|
43
45
|
modificationType: e === "modification" ? "format" : e
|
|
44
|
-
}), "content"), _ = p[0], v = _ ?
|
|
46
|
+
}), "content"), _ = p[0], v = _ ? c(_) : o[0];
|
|
45
47
|
if (g) h.style.cssText = "display: contents";
|
|
46
48
|
else {
|
|
47
|
-
let e = _ ? `var(${
|
|
49
|
+
let e = _ ? `var(${s(_).light}, ${v.light})` : v.light, t = _ ? `var(${s(_).dark}, ${v.dark})` : v.dark;
|
|
48
50
|
h.style.cssText = `display: contents; --user-color-light: ${e}; --user-color-dark: ${t}`;
|
|
49
51
|
}
|
|
50
52
|
let y = document.createElement("span");
|
|
@@ -57,7 +59,7 @@ var A = (e, t) => ({ mark: n, inline: r }) => {
|
|
|
57
59
|
dom: h,
|
|
58
60
|
contentDOM: y
|
|
59
61
|
};
|
|
60
|
-
},
|
|
62
|
+
}, be = y.create({
|
|
61
63
|
name: "y-attributed-insert",
|
|
62
64
|
inclusive: !1,
|
|
63
65
|
group: `${n} ${r}`,
|
|
@@ -70,7 +72,7 @@ var A = (e, t) => ({ mark: n, inline: r }) => {
|
|
|
70
72
|
extendMarkSchema(e) {
|
|
71
73
|
return e.name === this.name ? { blocknoteIgnore: !0 } : {};
|
|
72
74
|
}
|
|
73
|
-
}),
|
|
75
|
+
}), xe = y.create({
|
|
74
76
|
name: "y-attributed-delete",
|
|
75
77
|
inclusive: !1,
|
|
76
78
|
group: `${n} ${r}`,
|
|
@@ -86,7 +88,7 @@ var A = (e, t) => ({ mark: n, inline: r }) => {
|
|
|
86
88
|
extendMarkSchema(e) {
|
|
87
89
|
return e.name === this.name ? { blocknoteIgnore: !0 } : {};
|
|
88
90
|
}
|
|
89
|
-
}),
|
|
91
|
+
}), Se = y.create({
|
|
90
92
|
name: "y-attributed-format",
|
|
91
93
|
inclusive: !1,
|
|
92
94
|
group: `${n} ${r}`,
|
|
@@ -102,7 +104,7 @@ var A = (e, t) => ({ mark: n, inline: r }) => {
|
|
|
102
104
|
extendMarkSchema(e) {
|
|
103
105
|
return e.name === this.name ? { blocknoteIgnore: !0 } : {};
|
|
104
106
|
}
|
|
105
|
-
}),
|
|
107
|
+
}), Ce = y.create({
|
|
106
108
|
name: "y-attributed-attrs",
|
|
107
109
|
priority: 110,
|
|
108
110
|
inclusive: !1,
|
|
@@ -116,20 +118,20 @@ var A = (e, t) => ({ mark: n, inline: r }) => {
|
|
|
116
118
|
extendMarkSchema(e) {
|
|
117
119
|
return e.name === this.name ? { blocknoteIgnore: !0 } : {};
|
|
118
120
|
}
|
|
119
|
-
}),
|
|
121
|
+
}), we = p(({ options: e }) => ({
|
|
120
122
|
key: "yAttributionMarks",
|
|
121
123
|
tiptapExtensions: [
|
|
122
|
-
ye.configure({ getAttributionMarkClassName: e?.getAttributionMarkClassName }),
|
|
123
124
|
be.configure({ getAttributionMarkClassName: e?.getAttributionMarkClassName }),
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
xe.configure({ getAttributionMarkClassName: e?.getAttributionMarkClassName }),
|
|
126
|
+
Ce.configure({ getAttributionMarkClassName: e?.getAttributionMarkClassName }),
|
|
127
|
+
Se.configure({ getAttributionMarkClassName: e?.getAttributionMarkClassName })
|
|
126
128
|
]
|
|
127
|
-
})),
|
|
129
|
+
})), Te = {
|
|
128
130
|
"y-attributed-insert": "insert",
|
|
129
131
|
"y-attributed-delete": "delete",
|
|
130
132
|
"y-attributed-format": "format",
|
|
131
133
|
"y-attributed-attrs": "attrs"
|
|
132
|
-
},
|
|
134
|
+
}, Ee = new v("attributionLoadUsers"), j = "[data-user-ids]", M = (e) => {
|
|
133
135
|
if (!e) return [];
|
|
134
136
|
let t;
|
|
135
137
|
try {
|
|
@@ -147,30 +149,30 @@ var A = (e, t) => ({ mark: n, inline: r }) => {
|
|
|
147
149
|
return [];
|
|
148
150
|
}
|
|
149
151
|
return typeof t != "object" || !t ? [] : Object.keys(t);
|
|
150
|
-
}, P =
|
|
151
|
-
let n =
|
|
152
|
-
let t =
|
|
152
|
+
}, P = p(({ editor: e, options: t }) => {
|
|
153
|
+
let n = m(t?.resolveUsers), r = t?.getAttributionMarkClassName, o = f(void 0), c = (e) => {
|
|
154
|
+
let t = l(e), r = /* @__PURE__ */ new Set();
|
|
153
155
|
t && e.doc.nodesBetween(t.from, t.to, (e) => {
|
|
154
|
-
for (let t of e.marks)
|
|
156
|
+
for (let t of e.marks) Te[t.type.name] && k(t)?.forEach((e) => r.add(e));
|
|
155
157
|
return !0;
|
|
156
158
|
}), r.size > 0 && n.loadUsers(Array.from(r));
|
|
157
159
|
};
|
|
158
160
|
return {
|
|
159
161
|
key: "attribution",
|
|
160
162
|
userStore: n,
|
|
161
|
-
store:
|
|
162
|
-
prosemirrorPlugins: [new
|
|
163
|
-
key:
|
|
163
|
+
store: o,
|
|
164
|
+
prosemirrorPlugins: [new _({
|
|
165
|
+
key: Ee,
|
|
164
166
|
state: {
|
|
165
167
|
init: () => null,
|
|
166
168
|
apply: (e) => (e.docChanged && c(e), null)
|
|
167
169
|
}
|
|
168
170
|
})],
|
|
169
|
-
mount({ dom: t, root:
|
|
171
|
+
mount({ dom: t, root: c, signal: l }) {
|
|
170
172
|
let u = () => {
|
|
171
173
|
for (let [e, r] of n.store.state) {
|
|
172
|
-
let { light: n, dark:
|
|
173
|
-
|
|
174
|
+
let { light: n, dark: a } = s(e), o = i(r);
|
|
175
|
+
o ? (t.style.setProperty(n, o.light), t.style.setProperty(a, o.dark)) : (t.style.removeProperty(n), t.style.removeProperty(a));
|
|
174
176
|
}
|
|
175
177
|
}, d, f = (e) => M(e).map((e) => n.getUser(e)?.username ?? e).filter((e) => e !== ""), p = (e) => {
|
|
176
178
|
let t = M(e.dataset.userIds), n = N(e.dataset.format);
|
|
@@ -182,21 +184,21 @@ var A = (e, t) => ({ mark: n, inline: r }) => {
|
|
|
182
184
|
} : {
|
|
183
185
|
modificationType: "attrs",
|
|
184
186
|
attributes: N(e.dataset.attributes)
|
|
185
|
-
}, { modificationType:
|
|
187
|
+
}, { modificationType: o } = i, s = t ? { modificationType: "change" } : i, c = e.dataset.inline === "false" ? "block" : "inline-content";
|
|
186
188
|
return {
|
|
187
189
|
anchor: e,
|
|
188
|
-
color:
|
|
189
|
-
...
|
|
190
|
+
color: a(n, M(e.dataset.userIds)).dark,
|
|
191
|
+
...s,
|
|
190
192
|
contentType: c,
|
|
191
193
|
users: f(e.dataset.userIds),
|
|
192
194
|
className: D(r?.({
|
|
193
195
|
contentType: c,
|
|
194
|
-
modificationType:
|
|
196
|
+
modificationType: o
|
|
195
197
|
}), "tooltip"),
|
|
196
198
|
...t ? { reference: t } : {}
|
|
197
199
|
};
|
|
198
200
|
}, h = () => {
|
|
199
|
-
d && (d = void 0,
|
|
201
|
+
d && (d = void 0, o.setState(void 0));
|
|
200
202
|
}, g = (n) => {
|
|
201
203
|
if (!t.contains(n)) return;
|
|
202
204
|
let r = e.prosemirrorView, i = r.state.doc.resolve(r.posAtDOM(n, 0));
|
|
@@ -213,8 +215,8 @@ var A = (e, t) => ({ mark: n, inline: r }) => {
|
|
|
213
215
|
preview: a
|
|
214
216
|
} : void 0;
|
|
215
217
|
};
|
|
216
|
-
|
|
217
|
-
let r = e.target instanceof Element ? e.target : null, i = r && t.contains(r) ? r.closest(j) ?? void 0 : void 0,
|
|
218
|
+
c.addEventListener("mouseover", (e) => {
|
|
219
|
+
let r = e.target instanceof Element ? e.target : null, i = r && t.contains(r) ? r.closest(j) ?? void 0 : void 0, a = r && !i ? g(r) : void 0, s = i ?? a?.mark;
|
|
218
220
|
if (!s) {
|
|
219
221
|
h();
|
|
220
222
|
return;
|
|
@@ -225,22 +227,21 @@ var A = (e, t) => ({ mark: n, inline: r }) => {
|
|
|
225
227
|
if (!e || p(e) !== c) break;
|
|
226
228
|
l = e, u = e.parentElement;
|
|
227
229
|
}
|
|
228
|
-
if (d === l &&
|
|
229
|
-
d = l,
|
|
230
|
+
if (d === l && o.state?.reference === a?.preview) return;
|
|
231
|
+
d = l, o.setState(m(l, a?.preview));
|
|
230
232
|
let f = M(l.dataset.userIds);
|
|
231
233
|
f.length > 0 && n.loadUsers(f).then(() => {
|
|
232
|
-
d === l &&
|
|
234
|
+
d === l && o.state?.reference === a?.preview && o.setState(m(l, a?.preview));
|
|
233
235
|
});
|
|
234
|
-
}, { signal:
|
|
236
|
+
}, { signal: l }), l.addEventListener("abort", h), u();
|
|
235
237
|
let _ = n.store.subscribe(u);
|
|
236
|
-
|
|
238
|
+
l.addEventListener("abort", _);
|
|
237
239
|
},
|
|
238
|
-
blockNoteExtensions: [
|
|
240
|
+
blockNoteExtensions: [we({ getAttributionMarkClassName: t?.getAttributionMarkClassName })]
|
|
239
241
|
};
|
|
240
242
|
});
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
function Ee(e) {
|
|
243
|
+
// src/y/extensions/YCursorPlugin.ts
|
|
244
|
+
function De(e) {
|
|
244
245
|
let t = e.charAt(0) === "#" ? e.substring(1, 7) : e, n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), i = parseInt(t.substring(4, 6), 16), a = [
|
|
245
246
|
n / 255,
|
|
246
247
|
r / 255,
|
|
@@ -248,15 +249,15 @@ function Ee(e) {
|
|
|
248
249
|
].map((e) => e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
|
|
249
250
|
return .2126 * a[0] + .7152 * a[1] + .0722 * a[2] <= .179;
|
|
250
251
|
}
|
|
251
|
-
function
|
|
252
|
+
function Oe(e) {
|
|
252
253
|
let t = document.createElement("span");
|
|
253
254
|
t.classList.add("bn-collaboration-cursor__base");
|
|
254
255
|
let n = document.createElement("span");
|
|
255
|
-
n.setAttribute("contentedEditable", "false"), n.classList.add("bn-collaboration-cursor__caret"), n.setAttribute("style", `background-color: ${e.color}; color: ${
|
|
256
|
+
n.setAttribute("contentedEditable", "false"), n.classList.add("bn-collaboration-cursor__caret"), n.setAttribute("style", `background-color: ${e.color}; color: ${De(e.color) ? "white" : "black"}`);
|
|
256
257
|
let r = document.createElement("span");
|
|
257
|
-
return r.classList.add("bn-collaboration-cursor__label"), r.setAttribute("style", `background-color: ${e.color}; color: ${
|
|
258
|
+
return r.classList.add("bn-collaboration-cursor__label"), r.setAttribute("style", `background-color: ${e.color}; color: ${De(e.color) ? "white" : "black"}`), r.insertBefore(document.createTextNode(e.name), null), n.insertBefore(r, null), t.insertBefore(document.createTextNode(""), null), t.insertBefore(n, null), t.insertBefore(document.createTextNode(""), null), t;
|
|
258
259
|
}
|
|
259
|
-
var F =
|
|
260
|
+
var F = p(({ options: e }) => {
|
|
260
261
|
let t = /* @__PURE__ */ new Map(), n = e.provider && "awareness" in e.provider && typeof e.provider.awareness == "object" ? e.provider.awareness : void 0;
|
|
261
262
|
return n && ("setLocalStateField" in n && typeof n.setLocalStateField == "function" && n.setLocalStateField("user", e.user), "on" in n && typeof n.on == "function" && e.showCursorLabels !== "always" && n.on("change", ({ updated: e }) => {
|
|
262
263
|
for (let n of e) {
|
|
@@ -272,12 +273,12 @@ var F = a(({ options: e }) => {
|
|
|
272
273
|
}
|
|
273
274
|
})), {
|
|
274
275
|
key: "yCursor",
|
|
275
|
-
prosemirrorPlugins: [n ?
|
|
276
|
-
selectionBuilder:
|
|
276
|
+
prosemirrorPlugins: [n ? he(n, {
|
|
277
|
+
selectionBuilder: ie,
|
|
277
278
|
cursorBuilder(n, r) {
|
|
278
279
|
let i = t.get(r);
|
|
279
280
|
if (!i) {
|
|
280
|
-
let a = (e.renderCursor ??
|
|
281
|
+
let a = (e.renderCursor ?? Oe)(n);
|
|
281
282
|
e.showCursorLabels !== "always" && (a.addEventListener("mouseenter", () => {
|
|
282
283
|
let e = t.get(r);
|
|
283
284
|
e.element.setAttribute("data-active", ""), e.hideTimeout && (clearTimeout(e.hideTimeout), t.set(r, {
|
|
@@ -312,15 +313,15 @@ var F = a(({ options: e }) => {
|
|
|
312
313
|
if (e) return e.user;
|
|
313
314
|
}
|
|
314
315
|
};
|
|
315
|
-
}),
|
|
316
|
-
for (let t of e.children) if (
|
|
317
|
-
for (let e of t.insert) if (
|
|
316
|
+
}), ke = (e) => {
|
|
317
|
+
for (let t of e.children) if (C.$insertOp.check(t)) {
|
|
318
|
+
for (let e of t.insert) if (C.$deltaAny.check(e)) return e;
|
|
318
319
|
}
|
|
319
320
|
return null;
|
|
320
321
|
}, I = (e, t) => {
|
|
321
322
|
if (e.name !== t.name) return !1;
|
|
322
323
|
if (e.name !== "blockContainer") return !0;
|
|
323
|
-
let n =
|
|
324
|
+
let n = ke(e), r = ke(t);
|
|
324
325
|
return n?.name === r?.name;
|
|
325
326
|
}, L = {
|
|
326
327
|
groupName: "blockGroup",
|
|
@@ -331,29 +332,29 @@ var F = a(({ options: e }) => {
|
|
|
331
332
|
"columnList"
|
|
332
333
|
],
|
|
333
334
|
implicitGroups: !0
|
|
334
|
-
},
|
|
335
|
-
function
|
|
335
|
+
}, R = { group: !1 };
|
|
336
|
+
function z(e) {
|
|
336
337
|
return {
|
|
337
338
|
group: !0,
|
|
338
339
|
len: e
|
|
339
340
|
};
|
|
340
341
|
}
|
|
341
342
|
function Ae(e, t) {
|
|
342
|
-
return
|
|
343
|
+
return C.$deltaAny.check(e) && e.name === t;
|
|
343
344
|
}
|
|
344
345
|
function je(e) {
|
|
345
346
|
let t = 0;
|
|
346
|
-
for (let n of e.children)
|
|
347
|
+
for (let n of e.children) C.$insertOp.check(n) || C.$textOp.check(n) ? t += n.insert.length : C.$deleteOp.check(n) && (t -= n.delete);
|
|
347
348
|
return t;
|
|
348
349
|
}
|
|
349
|
-
function
|
|
350
|
+
function B(e) {
|
|
350
351
|
let t = 0;
|
|
351
352
|
for (let n of e) n.group && (t += n.len);
|
|
352
353
|
return t;
|
|
353
354
|
}
|
|
354
355
|
function Me(e) {
|
|
355
356
|
let t = [];
|
|
356
|
-
for (let n = 0; n < e; n++) t.push(
|
|
357
|
+
for (let n = 0; n < e; n++) t.push(R);
|
|
357
358
|
return t;
|
|
358
359
|
}
|
|
359
360
|
var Ne = class {
|
|
@@ -416,7 +417,7 @@ var Ne = class {
|
|
|
416
417
|
if (n === e.length) break;
|
|
417
418
|
if (this.ops.get(n)?.kind === "delete") continue;
|
|
418
419
|
let i = e[n], a = this.lenAdjust.get(n);
|
|
419
|
-
t.push(a === void 0 || !i.group ? i :
|
|
420
|
+
t.push(a === void 0 || !i.group ? i : z(i.len + a));
|
|
420
421
|
}
|
|
421
422
|
return t;
|
|
422
423
|
}
|
|
@@ -434,10 +435,10 @@ function Fe(e, t) {
|
|
|
434
435
|
}
|
|
435
436
|
return e.length;
|
|
436
437
|
}
|
|
437
|
-
function
|
|
438
|
+
function V(e) {
|
|
438
439
|
return (t) => typeof t == "number" ? e(t) : t;
|
|
439
440
|
}
|
|
440
|
-
var Ie = class extends
|
|
441
|
+
var Ie = class extends w.Transformer {
|
|
441
442
|
groupName;
|
|
442
443
|
implicitGroups;
|
|
443
444
|
segs = [];
|
|
@@ -447,9 +448,9 @@ var Ie = class extends T.Transformer {
|
|
|
447
448
|
}
|
|
448
449
|
applyA(e) {
|
|
449
450
|
this.fresh = !1;
|
|
450
|
-
let t = this.segs, n = this.groupName, r =
|
|
451
|
+
let t = this.segs, n = this.groupName, r = B(t), i = 0;
|
|
451
452
|
for (let e of t) e.group || i++;
|
|
452
|
-
let a = [], o = new Ne(), s =
|
|
453
|
+
let a = [], o = new Ne(), s = C.create(), c = 0, l = 0, u = !1, d = 0, f = 0, p = 0, m = () => {
|
|
453
454
|
if (p > c) {
|
|
454
455
|
let e = p - c;
|
|
455
456
|
s.retain(e), c = p, l += e;
|
|
@@ -458,21 +459,21 @@ var Ie = class extends T.Transformer {
|
|
|
458
459
|
let e = t[d++];
|
|
459
460
|
e.group ? p += e.len : f++;
|
|
460
461
|
};
|
|
461
|
-
for (let r of e.children) if (
|
|
462
|
+
for (let r of e.children) if (C.$retainOp.check(r)) {
|
|
462
463
|
let e = r.format, n = r.attribution;
|
|
463
464
|
for (let i = r.retain; i > 0 && d < t.length; i--) {
|
|
464
465
|
let r = t[d];
|
|
465
|
-
|
|
466
|
+
r.group || e === void 0 && n === void 0 || o.retainAt(f, e, n), a.push(r), h();
|
|
466
467
|
}
|
|
467
|
-
} else if (
|
|
468
|
-
else if (
|
|
468
|
+
} else if (C.$textOp.check(r)) o.insertAt(f, r.insert, r.format, r.attribution, []), a.push(...Me(r.insert.length));
|
|
469
|
+
else if (C.$insertOp.check(r)) for (let e of r.insert) if (Ae(e, n)) {
|
|
469
470
|
m();
|
|
470
471
|
let t = l;
|
|
471
472
|
s.append(e), l += e.childCnt;
|
|
472
473
|
let n = e.marks !== null || e.deleteMarks !== null;
|
|
473
|
-
n &&
|
|
474
|
-
} else o.insertAt(f, [e], r.format, r.attribution, []), a.push(
|
|
475
|
-
else if (
|
|
474
|
+
n && C.mergeRootMarks(s, e, V((e) => t + e)), u ||= e.childCnt > 0 || n, a.push(z(e.childCnt));
|
|
475
|
+
} else o.insertAt(f, [e], r.format, r.attribution, []), a.push(R);
|
|
476
|
+
else if (C.$deleteOp.check(r)) for (let e = r.delete; e > 0 && d < t.length; e--) {
|
|
476
477
|
let e = t[d];
|
|
477
478
|
e.group ? e.len > 0 && (m(), s.delete(e.len), c += e.len, u = !0) : o.deleteAt(f), h();
|
|
478
479
|
}
|
|
@@ -482,21 +483,21 @@ var Ie = class extends T.Transformer {
|
|
|
482
483
|
if (e.group) {
|
|
483
484
|
m();
|
|
484
485
|
let t = l;
|
|
485
|
-
for (let e of n.children)
|
|
486
|
-
(n.marks !== null || n.deleteMarks !== null) && (
|
|
487
|
-
} else o.modifyAt(f,
|
|
486
|
+
for (let e of n.children) C.$retainOp.check(e) ? (s.retain(e.retain, e.format, e.attribution), c += e.retain, l += e.retain, u ||= e.format !== void 0 || e.attribution !== void 0) : C.$deleteOp.check(e) ? (s.delete(e.delete), c += e.delete, u = !0) : C.$modifyOp.check(e) ? (s.modify(C.clone(e.value), e.format, e.attribution), c += 1, l += 1, u = !0) : (C.$insertOp.check(e) || C.$textOp.check(e)) && (s.insert(e.insert, e.format, e.attribution), l += e.insert.length, u = !0);
|
|
487
|
+
(n.marks !== null || n.deleteMarks !== null) && (C.mergeRootMarks(s, n, V((e) => t + e)), u = !0), a.push(z(e.len + je(n)));
|
|
488
|
+
} else o.modifyAt(f, C.clone(n), r.format, r.attribution), a.push(e);
|
|
488
489
|
h();
|
|
489
490
|
}
|
|
490
491
|
for (; d < t.length;) a.push(t[d++]);
|
|
491
|
-
let g =
|
|
492
|
+
let g = B(a), _ = C.cloneShallow(e);
|
|
492
493
|
if (o.emit(_, i), r === 0) {
|
|
493
494
|
if (g > 0) {
|
|
494
|
-
let e =
|
|
495
|
-
for (let t of s.children) (
|
|
496
|
-
|
|
495
|
+
let e = C.create(n);
|
|
496
|
+
for (let t of s.children) (C.$insertOp.check(t) || C.$textOp.check(t)) && e.insert(t.insert, t.format, t.attribution);
|
|
497
|
+
C.mergeRootMarks(e, s), _.insert([e.done(!1)]);
|
|
497
498
|
}
|
|
498
499
|
} else g === 0 ? _.delete(1) : u && _.modify(s.done(!1));
|
|
499
|
-
return
|
|
500
|
+
return C.remapRootMarks(_, V((e) => Pe(a, e, g))), this.segs = a, _.done(!1), w.createTransformResult(null, _);
|
|
500
501
|
}
|
|
501
502
|
applyB(e) {
|
|
502
503
|
let t = this.fresh;
|
|
@@ -512,10 +513,10 @@ var Ie = class extends T.Transformer {
|
|
|
512
513
|
}), e += t.len) : i.push(n);
|
|
513
514
|
});
|
|
514
515
|
}
|
|
515
|
-
let o = i.length, s =
|
|
516
|
+
let o = i.length, s = B(n), c = s > 0, l = new Ne(), u = /* @__PURE__ */ new Map(), d = (e) => {
|
|
516
517
|
let t = u.get(e);
|
|
517
518
|
return t === void 0 && (t = {
|
|
518
|
-
b:
|
|
519
|
+
b: C.create(),
|
|
519
520
|
emitted: 0,
|
|
520
521
|
out: 0,
|
|
521
522
|
net: 0,
|
|
@@ -529,18 +530,18 @@ var Ie = class extends T.Transformer {
|
|
|
529
530
|
}, p = (e) => e < o ? i[e] : n.length, m = !1, h = (e, t, r, i) => {
|
|
530
531
|
let o = a.findIndex((e) => t <= e.start + e.len);
|
|
531
532
|
if (o === -1) {
|
|
532
|
-
l.insertAt(n.length, [e], r, i, [
|
|
533
|
+
l.insertAt(n.length, [e], r, i, [z(e.childCnt)]), m = !0;
|
|
533
534
|
return;
|
|
534
535
|
}
|
|
535
536
|
let s = d(o);
|
|
536
537
|
f(s, t - a[o].start);
|
|
537
538
|
let c = s.out;
|
|
538
|
-
s.b.append(e), s.out += e.childCnt, s.net += e.childCnt, s.touched = !0, (e.marks !== null || e.deleteMarks !== null) &&
|
|
539
|
+
s.b.append(e), s.out += e.childCnt, s.net += e.childCnt, s.touched = !0, (e.marks !== null || e.deleteMarks !== null) && C.mergeRootMarks(s.b, e, V((e) => c + e));
|
|
539
540
|
}, g = (e) => {
|
|
540
541
|
let t = 0, n = 0, r = () => {
|
|
541
542
|
for (; t < a.length && n >= a[t].len;) t++, n = 0;
|
|
542
543
|
};
|
|
543
|
-
for (let i of e.children) if (
|
|
544
|
+
for (let i of e.children) if (C.$retainOp.check(i)) {
|
|
544
545
|
let e = i.format, o = i.attribution, s = i.retain;
|
|
545
546
|
for (; s > 0 && (r(), !(t >= a.length));) {
|
|
546
547
|
let r = Math.min(a[t].len - n, s);
|
|
@@ -550,17 +551,17 @@ var Ie = class extends T.Transformer {
|
|
|
550
551
|
}
|
|
551
552
|
n += r, s -= r;
|
|
552
553
|
}
|
|
553
|
-
} else if (
|
|
554
|
+
} else if (C.$deleteOp.check(i)) {
|
|
554
555
|
let e = i.delete;
|
|
555
556
|
for (; e > 0 && (r(), !(t >= a.length));) {
|
|
556
557
|
let r = Math.min(a[t].len - n, e), i = d(t);
|
|
557
558
|
f(i, n), i.b.delete(r), i.emitted += r, i.net -= r, i.touched = !0, n += r, e -= r;
|
|
558
559
|
}
|
|
559
|
-
} else if (
|
|
560
|
+
} else if (C.$modifyOp.check(i)) {
|
|
560
561
|
if (r(), t >= a.length) continue;
|
|
561
562
|
let e = d(t);
|
|
562
|
-
f(e, n), e.b.modify(
|
|
563
|
-
} else if (
|
|
563
|
+
f(e, n), e.b.modify(C.clone(i.value), i.format, i.attribution), e.emitted += 1, e.out += 1, e.touched = !0, n += 1;
|
|
564
|
+
} else if (C.$insertOp.check(i) || C.$textOp.check(i)) {
|
|
564
565
|
t >= a.length && (t = a.length - 1, n = a[t].len);
|
|
565
566
|
let e = d(t);
|
|
566
567
|
f(e, n), e.b.insert(i.insert, i.format, i.attribution), e.out += i.insert.length, e.net += i.insert.length, e.touched = !0;
|
|
@@ -578,22 +579,22 @@ var Ie = class extends T.Transformer {
|
|
|
578
579
|
let e = t.key, r = n.findIndex((t) => e <= t.start + t.len);
|
|
579
580
|
r === -1 && (r = a.length - 1);
|
|
580
581
|
let i = d(r);
|
|
581
|
-
|
|
582
|
+
C.addRootMark(i.b, t.copy(e - n[r].start)), i.touched = !0;
|
|
582
583
|
}
|
|
583
584
|
}
|
|
584
585
|
if (e.deleteMarks !== null && a.length > 0) {
|
|
585
586
|
let t = d(0);
|
|
586
|
-
for (let n of e.deleteMarks)
|
|
587
|
+
for (let n of e.deleteMarks) C.deleteRootMark(t.b, n);
|
|
587
588
|
t.touched = !0;
|
|
588
589
|
}
|
|
589
590
|
}, _ = 0;
|
|
590
|
-
for (let t of e.children) if (
|
|
591
|
+
for (let t of e.children) if (C.$retainOp.check(t)) {
|
|
591
592
|
let e = t.format, n = t.attribution;
|
|
592
593
|
for (let r = t.retain; r > 0; r--, _++) if (_ < o) (e !== void 0 || n !== void 0) && l.retainAt(i[_], e, n);
|
|
593
594
|
else if (!(_ === o && c)) break;
|
|
594
|
-
} else if (
|
|
595
|
-
else if (
|
|
596
|
-
else if (
|
|
595
|
+
} else if (C.$textOp.check(t)) l.insertAt(p(_), t.insert, t.format, t.attribution, Me(t.insert.length));
|
|
596
|
+
else if (C.$insertOp.check(t)) for (let e of t.insert) Ae(e, r) ? h(e, c && _ > o ? s : 0, t.format, t.attribution) : l.insertAt(p(_), [e], t.format, t.attribution, [R]);
|
|
597
|
+
else if (C.$deleteOp.check(t)) for (let e = t.delete; e > 0; e--, _++) if (_ < o) l.deleteAt(i[_]);
|
|
597
598
|
else if (_ === o && c) a.forEach((e, t) => {
|
|
598
599
|
if (e.len > 0) {
|
|
599
600
|
let n = d(t);
|
|
@@ -601,19 +602,19 @@ var Ie = class extends T.Transformer {
|
|
|
601
602
|
}
|
|
602
603
|
});
|
|
603
604
|
else break;
|
|
604
|
-
else _ < o ? l.modifyAt(i[_],
|
|
605
|
+
else _ < o ? l.modifyAt(i[_], C.clone(t.value), t.format, t.attribution) : _ === o && c && g(t.value), _++;
|
|
605
606
|
for (let [e, t] of u) t.touched && l.modifyAt(a[e].ai, t.b.done(!1), void 0, void 0), t.net !== 0 && l.adjustLen(a[e].ai, t.net);
|
|
606
|
-
this.implicitGroups && t && a.length === 0 && !m && l.insertAt(n.length, [
|
|
607
|
-
let v =
|
|
607
|
+
this.implicitGroups && t && a.length === 0 && !m && l.insertAt(n.length, [C.create(r).done(!1)], void 0, void 0, [z(0)]);
|
|
608
|
+
let v = C.cloneShallow(e);
|
|
608
609
|
l.emit(v, n.length);
|
|
609
610
|
let y = l.rebuildSegs(n);
|
|
610
|
-
return
|
|
611
|
+
return C.remapRootMarks(v, V((e) => Fe(y, e))), this.segs = y, v.done(!1), w.createTransformResult(v, null);
|
|
611
612
|
}
|
|
612
|
-
}, Le = class extends
|
|
613
|
+
}, Le = class extends w.Template {
|
|
613
614
|
groupName;
|
|
614
615
|
implicitGroups;
|
|
615
616
|
constructor(e, t, n) {
|
|
616
|
-
super(e,
|
|
617
|
+
super(e, C.$deltaAny), this.groupName = t, this.implicitGroups = n;
|
|
617
618
|
}
|
|
618
619
|
get name() {
|
|
619
620
|
return `blocknote:persistentGroup:${this.groupName}`;
|
|
@@ -622,63 +623,65 @@ var Ie = class extends T.Transformer {
|
|
|
622
623
|
return new Ie(this.$in, this.$out, this.groupName, this.implicitGroups);
|
|
623
624
|
}
|
|
624
625
|
};
|
|
625
|
-
function
|
|
626
|
+
function H(e, t = {}) {
|
|
626
627
|
let n = t.groupName ?? L.groupName, r = t.containerName ?? L.containerName, i = t.implicitGroups ?? L.implicitGroups, a = new Set(t.nestingNodes ?? L.nestingNodes);
|
|
627
628
|
function o(e) {
|
|
628
|
-
return
|
|
629
|
+
return w.children(e, (e, t) => e.name === r ? s(t) : e.name !== null && a.has(e.name) ? o(t) : null);
|
|
629
630
|
}
|
|
630
631
|
function s(e) {
|
|
631
|
-
return
|
|
632
|
+
return w.pipe(e, (e) => o(e), (e) => new Le(e, n, i));
|
|
632
633
|
}
|
|
633
634
|
return o(e);
|
|
634
635
|
}
|
|
635
|
-
|
|
636
|
-
//#region src/y/extensions/YSync.ts
|
|
636
|
+
// src/y/extensions/YSync.ts
|
|
637
637
|
function Re(t) {
|
|
638
638
|
let n = e(t), r = n.length === 1 ? n[0] : void 0;
|
|
639
639
|
if (!r || r.type !== "paragraph" || r.children.length !== 0) return !1;
|
|
640
640
|
let { content: i } = r;
|
|
641
641
|
return i === void 0 || (typeof i == "string" || Array.isArray(i)) && i.length === 0;
|
|
642
642
|
}
|
|
643
|
-
var
|
|
643
|
+
var U = (e, t) => {
|
|
644
644
|
let n = { ...e };
|
|
645
645
|
return t.insert && (n["y-attributed-insert"] = { userIds: t.insert }), t.delete && (n["y-attributed-delete"] = { userIds: t.delete }), t.format && (n["y-attributed-format"] = {
|
|
646
646
|
userIds: [...new Set(Object.values(t.format).flat())],
|
|
647
647
|
format: t.format
|
|
648
648
|
}), n;
|
|
649
|
-
}, ze =
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
})
|
|
678
|
-
|
|
679
|
-
|
|
649
|
+
}, ze = p(({ options: e, editor: t }) => {
|
|
650
|
+
let n = !1;
|
|
651
|
+
return {
|
|
652
|
+
key: "ySync",
|
|
653
|
+
fragment: e.fragment,
|
|
654
|
+
mount({ signal: r }) {
|
|
655
|
+
let { fragment: i, provider: a } = e, o = a && "synced" in a ? a.synced : void 0;
|
|
656
|
+
if (n ||= i.length > 0 || o !== !1, !n && a) {
|
|
657
|
+
if (!("on" in a) || typeof a.on != "function") throw Error("YSync: an unsynced provider must support sync events");
|
|
658
|
+
let e = t.getExtension(u)?.acquire() ?? (() => {});
|
|
659
|
+
function o(t) {
|
|
660
|
+
t !== !0 || n || r.aborted || (n = !0, e());
|
|
661
|
+
}
|
|
662
|
+
function s() {
|
|
663
|
+
o(i.length > 0);
|
|
664
|
+
}
|
|
665
|
+
i.observe(s), a.on("synced", o), r.addEventListener("abort", () => {
|
|
666
|
+
i.unobserve(s), "off" in a && typeof a.off == "function" && a.off("synced", o), e();
|
|
667
|
+
}, { once: !0 }), s(), "synced" in a && a.synced === !0 && o(!0);
|
|
668
|
+
}
|
|
669
|
+
r.aborted || ge.getState(t.prosemirrorState)?.ytype || t.getExtension(q)?.store.state.isForked || t.exec(x({ ytype: e.fragment }));
|
|
670
|
+
},
|
|
671
|
+
prosemirrorPlugins: [me({
|
|
672
|
+
suggestionDoc: e.suggestionDoc,
|
|
673
|
+
mapAttributionToMark: U,
|
|
674
|
+
customCompare: I,
|
|
675
|
+
transformers: [H],
|
|
676
|
+
isInitialContent: Re
|
|
677
|
+
})],
|
|
678
|
+
runsBefore: ["default"]
|
|
679
|
+
};
|
|
680
|
+
}), W = ae({
|
|
681
|
+
mapAttributionToMark: U,
|
|
682
|
+
transformers: [H]
|
|
680
683
|
});
|
|
681
|
-
function
|
|
684
|
+
function G(e, t) {
|
|
682
685
|
let n = e.doc;
|
|
683
686
|
if (!n) throw Error("type does not have a ydoc");
|
|
684
687
|
if (e._item === null) {
|
|
@@ -687,27 +690,27 @@ function W(e, t) {
|
|
|
687
690
|
return t.get(r, e.name);
|
|
688
691
|
}
|
|
689
692
|
{
|
|
690
|
-
let n = e._item, r = t.store.clients.get(n.id.client) ?? [], i = r[
|
|
693
|
+
let n = e._item, r = t.store.clients.get(n.id.client) ?? [], i = r[S.findIndexSS(r, n.id.clock)];
|
|
691
694
|
if (!i) throw Error("type does not exist in other ydoc");
|
|
692
695
|
let a = i.content;
|
|
693
696
|
if (!a) throw Error("type does not exist in other ydoc");
|
|
694
697
|
return a.type;
|
|
695
698
|
}
|
|
696
699
|
}
|
|
697
|
-
function
|
|
700
|
+
function Be(e, t) {
|
|
698
701
|
if (t instanceof Uint8Array) {
|
|
699
|
-
let n = new
|
|
702
|
+
let n = new S.Doc({ gc: !1 });
|
|
700
703
|
try {
|
|
701
|
-
return
|
|
704
|
+
return S.applyUpdate(n, t), Be(e, n);
|
|
702
705
|
} finally {
|
|
703
706
|
n.destroy();
|
|
704
707
|
}
|
|
705
708
|
}
|
|
706
|
-
let n =
|
|
707
|
-
for (let e of t.store.clients.values()) for (let t of e) t instanceof
|
|
709
|
+
let n = G(e, t), r = S.createIdSet();
|
|
710
|
+
for (let e of t.store.clients.values()) for (let t of e) t instanceof S.Item && S.isParentOf(n, t) && r.add(t.id.client, t.id.clock, t.length);
|
|
708
711
|
return r;
|
|
709
712
|
}
|
|
710
|
-
function
|
|
713
|
+
function Ve(t, n) {
|
|
711
714
|
let r = t.pmSchema.nodeFromJSON(n);
|
|
712
715
|
return e(r);
|
|
713
716
|
}
|
|
@@ -715,51 +718,50 @@ function K(e, n) {
|
|
|
715
718
|
let r = n.map((n) => t(n, e.pmSchema));
|
|
716
719
|
return e.pmSchema.topNodeType.create(null, e.pmSchema.nodes.blockGroup.create(null, r));
|
|
717
720
|
}
|
|
718
|
-
function
|
|
721
|
+
function He(e) {
|
|
719
722
|
if (typeof e != "object" || !e) return !1;
|
|
720
723
|
let t = e;
|
|
721
|
-
return t.name === "blockContainer" ||
|
|
724
|
+
return t.name === "blockContainer" || Ue(t.children) || Ue(t.insert);
|
|
722
725
|
}
|
|
723
|
-
function
|
|
726
|
+
function Ue(e) {
|
|
724
727
|
if (typeof e != "object" || !e || !(Symbol.iterator in e)) return !1;
|
|
725
|
-
for (let t of e) if (
|
|
728
|
+
for (let t of e) if (He(t)) return !0;
|
|
726
729
|
return !1;
|
|
727
730
|
}
|
|
728
|
-
function
|
|
729
|
-
if (n.length === 0 || !
|
|
730
|
-
let r =
|
|
731
|
+
function We(t, n) {
|
|
732
|
+
if (n.length === 0 || !He(n.toDeltaDeep())) return [];
|
|
733
|
+
let r = ve(n, t.pmSchema, {
|
|
731
734
|
renderer: null,
|
|
732
|
-
transformer:
|
|
735
|
+
transformer: W
|
|
733
736
|
});
|
|
734
737
|
return e(r);
|
|
735
738
|
}
|
|
736
|
-
function
|
|
737
|
-
return n ||= new
|
|
738
|
-
}
|
|
739
|
-
function Ge(e, t, n = "prosemirror") {
|
|
740
|
-
return Ue(e, t.get(n));
|
|
739
|
+
function Ge(e, t, n) {
|
|
740
|
+
return n ||= new S.Doc().get("prosemirror"), t.length === 0 || n.applyDelta(ue(K(e, t), { transformer: W })), n;
|
|
741
741
|
}
|
|
742
742
|
function Ke(e, t, n = "prosemirror") {
|
|
743
|
-
|
|
743
|
+
return We(e, t.get(n));
|
|
744
|
+
}
|
|
745
|
+
function qe(e, t, n = "prosemirror") {
|
|
746
|
+
let r = new S.Doc();
|
|
744
747
|
if (t.length === 0) return r.get(n), r;
|
|
745
|
-
let i =
|
|
748
|
+
let i = ue(K(e, t), { transformer: W });
|
|
746
749
|
return r.get(n).applyDelta(i), r;
|
|
747
750
|
}
|
|
748
|
-
function
|
|
749
|
-
let n =
|
|
750
|
-
return
|
|
751
|
+
function Je(e, t) {
|
|
752
|
+
let n = ce(e), r = ce(t);
|
|
753
|
+
return C.diff(n.done(), r.done(), { compare: I });
|
|
751
754
|
}
|
|
752
|
-
function
|
|
753
|
-
let r =
|
|
754
|
-
transformer:
|
|
755
|
+
function Ye(e, t, n = {}) {
|
|
756
|
+
let r = ve(t, e.doc.type.schema, {
|
|
757
|
+
transformer: W,
|
|
755
758
|
...n
|
|
756
|
-
}), i =
|
|
757
|
-
return
|
|
759
|
+
}), i = Je(e.doc, r);
|
|
760
|
+
return oe(e, i).setMeta("y-sync-hydration", { delta: i });
|
|
758
761
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
let n, r = i({ isForked: !1 });
|
|
762
|
+
// src/y/extensions/ForkYDoc.ts
|
|
763
|
+
var q = p(({ editor: e, options: t }) => {
|
|
764
|
+
let n, r = f({ isForked: !1 });
|
|
763
765
|
return {
|
|
764
766
|
key: "yForkDoc",
|
|
765
767
|
store: r,
|
|
@@ -767,9 +769,9 @@ var J = a(({ editor: e, options: t }) => {
|
|
|
767
769
|
if (n) return;
|
|
768
770
|
let a = t.fragment;
|
|
769
771
|
if (!a) throw Error("No fragment to fork from");
|
|
770
|
-
let o = new
|
|
771
|
-
|
|
772
|
-
let s =
|
|
772
|
+
let o = new S.Doc();
|
|
773
|
+
S.applyUpdateV2(o, i ?? S.encodeStateAsUpdateV2(a.doc));
|
|
774
|
+
let s = G(a, o);
|
|
773
775
|
n = {
|
|
774
776
|
originalFragment: a,
|
|
775
777
|
forkedFragment: s,
|
|
@@ -783,18 +785,18 @@ var J = a(({ editor: e, options: t }) => {
|
|
|
783
785
|
ytype: o,
|
|
784
786
|
renderer: a
|
|
785
787
|
})), c && e.registerExtension(c), i) {
|
|
786
|
-
let t =
|
|
787
|
-
|
|
788
|
+
let t = S.encodeStateAsUpdate(s.doc, S.encodeStateVector(o.doc));
|
|
789
|
+
S.applyUpdate(o.doc, t, e);
|
|
788
790
|
}
|
|
789
791
|
n = void 0, s.doc.destroy(), r.setState({ isForked: !1 });
|
|
790
792
|
}
|
|
791
793
|
};
|
|
792
|
-
}),
|
|
794
|
+
}), Xe = p(({ editor: e }) => ({
|
|
793
795
|
key: "yPositionMapping",
|
|
794
796
|
mapPosition: (t, n = "left") => {
|
|
795
|
-
if (!
|
|
797
|
+
if (!ge.getState(e.prosemirrorState)?.ytype) throw Error("YSync plugin state not found");
|
|
796
798
|
if (t === 0) return () => 0;
|
|
797
|
-
let r =
|
|
799
|
+
let r = pe(e.prosemirrorView, e.prosemirrorState.doc.resolve(t + (n === "right" ? 1 : -1)));
|
|
798
800
|
if (r === null) throw Error("Position not found, cannot track positions");
|
|
799
801
|
return () => {
|
|
800
802
|
let t = r(e.prosemirrorView);
|
|
@@ -802,10 +804,10 @@ var J = a(({ editor: e, options: t }) => {
|
|
|
802
804
|
return t.pos + (n === "right" ? -1 : 1);
|
|
803
805
|
};
|
|
804
806
|
}
|
|
805
|
-
})),
|
|
807
|
+
})), Ze = p(({ editor: e, options: t }) => {
|
|
806
808
|
let n = t.suggestionDoc;
|
|
807
809
|
if (!n) throw Error("Suggestion doc not found");
|
|
808
|
-
let r =
|
|
810
|
+
let r = m(t.resolveUsers);
|
|
809
811
|
function i(t) {
|
|
810
812
|
let n = e.prosemirrorView.nodeDOM(t);
|
|
811
813
|
for (; n && n.parentElement;) {
|
|
@@ -818,7 +820,7 @@ var J = a(({ editor: e, options: t }) => {
|
|
|
818
820
|
return e.transact((r) => {
|
|
819
821
|
let i = r.doc.resolve(t), a = i.marks().find((e) => e.type.name === n);
|
|
820
822
|
if (!a) return;
|
|
821
|
-
let o =
|
|
823
|
+
let o = ee(i, a.type);
|
|
822
824
|
if (o) return {
|
|
823
825
|
range: o,
|
|
824
826
|
mark: a,
|
|
@@ -826,7 +828,7 @@ var J = a(({ editor: e, options: t }) => {
|
|
|
826
828
|
return r.doc.textBetween(o.from, o.to);
|
|
827
829
|
},
|
|
828
830
|
get position() {
|
|
829
|
-
return
|
|
831
|
+
return te(e.prosemirrorView, o.from, o.to).toJSON();
|
|
830
832
|
}
|
|
831
833
|
};
|
|
832
834
|
});
|
|
@@ -843,13 +845,13 @@ var J = a(({ editor: e, options: t }) => {
|
|
|
843
845
|
runsBefore: ["ySync"],
|
|
844
846
|
viewSuggestions: () => {
|
|
845
847
|
t.renderer && (t.renderer.suggestionMode = !1), e.exec(x({
|
|
846
|
-
ytype:
|
|
848
|
+
ytype: G(t.fragment, n),
|
|
847
849
|
renderer: t.renderer
|
|
848
850
|
}));
|
|
849
851
|
},
|
|
850
852
|
enableSuggestions: () => {
|
|
851
853
|
t.renderer && (t.renderer.suggestionMode = !0), e.exec(x({
|
|
852
|
-
ytype:
|
|
854
|
+
ytype: G(t.fragment, n),
|
|
853
855
|
renderer: t.renderer
|
|
854
856
|
}));
|
|
855
857
|
},
|
|
@@ -859,10 +861,10 @@ var J = a(({ editor: e, options: t }) => {
|
|
|
859
861
|
renderer: null
|
|
860
862
|
}));
|
|
861
863
|
},
|
|
862
|
-
applyAllSuggestions: () => e.exec(
|
|
863
|
-
applySuggestion: (t, n) => e.exec(
|
|
864
|
-
revertSuggestion: (t, n) => e.exec(
|
|
865
|
-
revertAllSuggestions: () => e.exec(
|
|
864
|
+
applyAllSuggestions: () => e.exec(ne()),
|
|
865
|
+
applySuggestion: (t, n) => e.exec(re(t, n)),
|
|
866
|
+
revertSuggestion: (t, n) => e.exec(fe(t, n)),
|
|
867
|
+
revertAllSuggestions: () => e.exec(de()),
|
|
866
868
|
getSuggestionElementAtPos: i,
|
|
867
869
|
getMarkAtPos: a,
|
|
868
870
|
getSuggestionAtSelection: o,
|
|
@@ -875,17 +877,17 @@ var J = a(({ editor: e, options: t }) => {
|
|
|
875
877
|
return e.prosemirrorState.doc.descendants((e) => !t && (t = e.marks.findIndex((e) => e.type.name === "y-attributed-insert" || e.type.name === "y-attributed-delete" || e.type.name === "y-attributed-format") !== -1, !0)), t;
|
|
876
878
|
}
|
|
877
879
|
};
|
|
878
|
-
}),
|
|
879
|
-
function
|
|
880
|
-
let n =
|
|
880
|
+
}), Qe = "blocknote:version-diff", $e = "#2948b3", et = "#d6defd";
|
|
881
|
+
function tt(e, t) {
|
|
882
|
+
let n = S.createContentMap();
|
|
881
883
|
return e.on("beforeObserverCalls", (e) => {
|
|
882
|
-
e.insertSet.isEmpty() ||
|
|
884
|
+
e.insertSet.isEmpty() || S.insertIntoIdMap(n.inserts, S.createIdMapFromIdSet(e.insertSet, [S.createContentAttribute("insert", t)])), e.deleteSet.isEmpty() || S.insertIntoIdMap(n.deletes, S.createIdMapFromIdSet(e.deleteSet, [S.createContentAttribute("delete", t)]));
|
|
883
885
|
}), n;
|
|
884
886
|
}
|
|
885
|
-
var
|
|
886
|
-
let n = e?.color ??
|
|
887
|
+
var nt = p(({ options: e, editor: t }) => {
|
|
888
|
+
let n = e?.color ?? $e, r = e?.color === void 0 ? et : void 0, i = h(async () => []);
|
|
887
889
|
return i.setUser({
|
|
888
|
-
id:
|
|
890
|
+
id: Qe,
|
|
889
891
|
username: "",
|
|
890
892
|
avatarUrl: "",
|
|
891
893
|
color: n,
|
|
@@ -898,25 +900,25 @@ var $e = a(({ options: e, editor: t }) => {
|
|
|
898
900
|
})],
|
|
899
901
|
renderDiff(e, n) {
|
|
900
902
|
if (!t.pmSchema.marks["y-attributed-insert"]) throw Error("DiffVersioningExtension: the y-attributed-* marks are missing from the schema. This should not happen — the extension registers them via AttributionExtension.");
|
|
901
|
-
let r = K(t, n), i = K(t, e), a = new
|
|
903
|
+
let r = K(t, n), i = K(t, e), a = new S.Doc({ gc: !1 }), o = a.get("prosemirror");
|
|
902
904
|
a.transact(() => {
|
|
903
|
-
o.applyDelta(
|
|
905
|
+
o.applyDelta(se(r));
|
|
904
906
|
});
|
|
905
|
-
let s = new
|
|
906
|
-
|
|
907
|
-
let c =
|
|
907
|
+
let s = new S.Doc({ gc: !1 });
|
|
908
|
+
S.applyUpdateV2(s, S.encodeStateAsUpdateV2(a));
|
|
909
|
+
let c = G(o, s), l = tt(s, Qe), u = Je(r, i);
|
|
908
910
|
s.transact(() => {
|
|
909
911
|
c.applyDelta(u);
|
|
910
|
-
},
|
|
911
|
-
let d =
|
|
912
|
+
}, Qe);
|
|
913
|
+
let d = S.createDiffRenderer(a, s, { attributions: l });
|
|
912
914
|
t.exec((e, t) => {
|
|
913
|
-
let n =
|
|
914
|
-
return t && t(n), !0;
|
|
915
|
+
let n = Ye(e.tr, c, { renderer: d });
|
|
916
|
+
return n.setMeta("blocknoteVersionPreview", !0), t && t(n), !0;
|
|
915
917
|
}), a.destroy(), s.destroy();
|
|
916
918
|
}
|
|
917
919
|
};
|
|
918
|
-
}),
|
|
919
|
-
let t =
|
|
920
|
+
}), J = p(({ options: e }) => {
|
|
921
|
+
let t = m(e.resolveUsers), n = {
|
|
920
922
|
...e,
|
|
921
923
|
resolveUsers: t
|
|
922
924
|
};
|
|
@@ -925,9 +927,9 @@ var $e = a(({ options: e, editor: t }) => {
|
|
|
925
927
|
fragment: e.fragment,
|
|
926
928
|
userStore: t,
|
|
927
929
|
blockNoteExtensions: [
|
|
928
|
-
e.suggestionDoc ?
|
|
929
|
-
|
|
930
|
-
|
|
930
|
+
e.suggestionDoc ? Ze(n) : null,
|
|
931
|
+
Xe(),
|
|
932
|
+
q(e),
|
|
931
933
|
ze(n),
|
|
932
934
|
F(e),
|
|
933
935
|
P({
|
|
@@ -937,38 +939,37 @@ var $e = a(({ options: e, editor: t }) => {
|
|
|
937
939
|
].filter((e) => e !== null)
|
|
938
940
|
};
|
|
939
941
|
});
|
|
940
|
-
function
|
|
942
|
+
function rt(e) {
|
|
941
943
|
return e.initialContent && console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"), {
|
|
942
944
|
...e,
|
|
943
|
-
extensions: [...e.extensions ?? [],
|
|
945
|
+
extensions: [...e.extensions ?? [], J(e.collaboration)],
|
|
944
946
|
initialContent: [{
|
|
945
947
|
type: "paragraph",
|
|
946
948
|
id: "initialBlockId"
|
|
947
949
|
}]
|
|
948
950
|
};
|
|
949
951
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
let t = new C.Node();
|
|
952
|
+
// src/y/comments/yjsHelpers.ts
|
|
953
|
+
function it(e) {
|
|
954
|
+
let t = new S.Node();
|
|
954
955
|
if (t.setAttr("id", e.id), t.setAttr("userId", e.userId), t.setAttr("createdAt", e.createdAt.getTime()), t.setAttr("updatedAt", e.updatedAt.getTime()), e.deletedAt ? (t.setAttr("deletedAt", e.deletedAt.getTime()), t.setAttr("body", void 0)) : t.setAttr("body", e.body), e.reactions.length > 0) throw Error("Reactions should be empty in commentToYType");
|
|
955
|
-
return t.setAttr("reactionsByUser", new
|
|
956
|
+
return t.setAttr("reactionsByUser", new S.Node()), t.setAttr("metadata", e.metadata), t;
|
|
956
957
|
}
|
|
957
|
-
function
|
|
958
|
-
let t = new
|
|
958
|
+
function at(e) {
|
|
959
|
+
let t = new S.Node();
|
|
959
960
|
t.setAttr("id", e.id), t.setAttr("createdAt", e.createdAt.getTime()), t.setAttr("updatedAt", e.updatedAt.getTime());
|
|
960
|
-
let n = new
|
|
961
|
-
return n.push(e.comments.map((e) =>
|
|
961
|
+
let n = new S.Node();
|
|
962
|
+
return n.push(e.comments.map((e) => it(e))), t.setAttr("comments", n), t.setAttr("resolved", e.resolved), t.setAttr("resolvedUpdatedAt", e.resolvedUpdatedAt?.getTime()), t.setAttr("resolvedBy", e.resolvedBy), t.setAttr("metadata", e.metadata), t;
|
|
962
963
|
}
|
|
963
|
-
function
|
|
964
|
+
function ot(e) {
|
|
964
965
|
return {
|
|
965
966
|
emoji: e.getAttr("emoji"),
|
|
966
967
|
createdAt: new Date(e.getAttr("createdAt")),
|
|
967
968
|
userId: e.getAttr("userId")
|
|
968
969
|
};
|
|
969
970
|
}
|
|
970
|
-
function
|
|
971
|
-
return [...e.attrValues()].map((e) =>
|
|
971
|
+
function st(e) {
|
|
972
|
+
return [...e.attrValues()].map((e) => ot(e)).reduce((e, t) => {
|
|
972
973
|
let n = e.find((e) => e.emoji === t.emoji);
|
|
973
974
|
return n ? (n.userIds.push(t.userId), n.createdAt = new Date(Math.min(n.createdAt.getTime(), t.createdAt.getTime()))) : e.push({
|
|
974
975
|
emoji: t.emoji,
|
|
@@ -977,7 +978,7 @@ function it(e) {
|
|
|
977
978
|
}), e;
|
|
978
979
|
}, []);
|
|
979
980
|
}
|
|
980
|
-
function
|
|
981
|
+
function Y(e) {
|
|
981
982
|
return {
|
|
982
983
|
type: "comment",
|
|
983
984
|
id: e.getAttr("id"),
|
|
@@ -985,27 +986,26 @@ function Z(e) {
|
|
|
985
986
|
createdAt: new Date(e.getAttr("createdAt")),
|
|
986
987
|
updatedAt: new Date(e.getAttr("updatedAt")),
|
|
987
988
|
deletedAt: e.getAttr("deletedAt") ? new Date(e.getAttr("deletedAt")) : void 0,
|
|
988
|
-
reactions:
|
|
989
|
+
reactions: st(e.getAttr("reactionsByUser")),
|
|
989
990
|
metadata: e.getAttr("metadata"),
|
|
990
991
|
body: e.getAttr("body")
|
|
991
992
|
};
|
|
992
993
|
}
|
|
993
|
-
function
|
|
994
|
+
function X(e) {
|
|
994
995
|
return {
|
|
995
996
|
type: "thread",
|
|
996
997
|
id: e.getAttr("id"),
|
|
997
998
|
createdAt: new Date(e.getAttr("createdAt")),
|
|
998
999
|
updatedAt: new Date(e.getAttr("updatedAt")),
|
|
999
|
-
comments: (e.getAttr("comments")?.toArray() || []).map((e) =>
|
|
1000
|
+
comments: (e.getAttr("comments")?.toArray() || []).map((e) => Y(e)),
|
|
1000
1001
|
resolved: e.getAttr("resolved"),
|
|
1001
1002
|
resolvedUpdatedAt: new Date(e.getAttr("resolvedUpdatedAt")),
|
|
1002
1003
|
resolvedBy: e.getAttr("resolvedBy"),
|
|
1003
1004
|
metadata: e.getAttr("metadata")
|
|
1004
1005
|
};
|
|
1005
1006
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
var at = class extends h {
|
|
1007
|
+
// src/y/comments/YjsThreadStoreBase.ts
|
|
1008
|
+
var ct = class extends g {
|
|
1009
1009
|
threadsYType;
|
|
1010
1010
|
constructor(e, t) {
|
|
1011
1011
|
super(t), this.threadsYType = e;
|
|
@@ -1013,12 +1013,12 @@ var at = class extends h {
|
|
|
1013
1013
|
getThread(e) {
|
|
1014
1014
|
let t = this.threadsYType.getAttr(e);
|
|
1015
1015
|
if (!t) throw Error("Thread not found");
|
|
1016
|
-
return
|
|
1016
|
+
return X(t);
|
|
1017
1017
|
}
|
|
1018
1018
|
getThreads() {
|
|
1019
1019
|
let e = /* @__PURE__ */ new Map();
|
|
1020
1020
|
return this.threadsYType.forEachAttr((t, n) => {
|
|
1021
|
-
t instanceof
|
|
1021
|
+
t instanceof S.Node && e.set(String(n), X(t));
|
|
1022
1022
|
}), e;
|
|
1023
1023
|
}
|
|
1024
1024
|
subscribe(e) {
|
|
@@ -1029,7 +1029,7 @@ var at = class extends h {
|
|
|
1029
1029
|
this.threadsYType.unobserveDeep(t);
|
|
1030
1030
|
};
|
|
1031
1031
|
}
|
|
1032
|
-
},
|
|
1032
|
+
}, lt = class extends ct {
|
|
1033
1033
|
BASE_URL;
|
|
1034
1034
|
headers;
|
|
1035
1035
|
constructor(e, t, n, r) {
|
|
@@ -1072,7 +1072,7 @@ var at = class extends h {
|
|
|
1072
1072
|
return this.doRequest(`/${t}/comments/${n}/reactions`, "POST", r);
|
|
1073
1073
|
};
|
|
1074
1074
|
deleteReaction = (e) => this.doRequest(`/${e.threadId}/comments/${e.commentId}/reactions/${e.emoji}`, "DELETE");
|
|
1075
|
-
},
|
|
1075
|
+
}, ut = class extends ct {
|
|
1076
1076
|
userId;
|
|
1077
1077
|
constructor(e, t, n) {
|
|
1078
1078
|
super(t, n), this.userId = e;
|
|
@@ -1098,13 +1098,13 @@ var at = class extends h {
|
|
|
1098
1098
|
resolved: !1,
|
|
1099
1099
|
metadata: e.metadata
|
|
1100
1100
|
};
|
|
1101
|
-
return this.threadsYType.setAttr(r.id,
|
|
1101
|
+
return this.threadsYType.setAttr(r.id, at(r)), r;
|
|
1102
1102
|
});
|
|
1103
1103
|
addThreadToDocument = void 0;
|
|
1104
1104
|
addComment = this.transact((e) => {
|
|
1105
1105
|
let t = this.threadsYType.getAttr(e.threadId);
|
|
1106
1106
|
if (!t) throw Error("Thread not found");
|
|
1107
|
-
if (!this.auth.canAddComment(
|
|
1107
|
+
if (!this.auth.canAddComment(X(t))) throw Error("Not authorized");
|
|
1108
1108
|
let n = /* @__PURE__ */ new Date(), r = {
|
|
1109
1109
|
type: "comment",
|
|
1110
1110
|
id: b(),
|
|
@@ -1116,100 +1116,98 @@ var at = class extends h {
|
|
|
1116
1116
|
metadata: e.comment.metadata,
|
|
1117
1117
|
body: e.comment.body
|
|
1118
1118
|
};
|
|
1119
|
-
return t.getAttr("comments").push([
|
|
1119
|
+
return t.getAttr("comments").push([it(r)]), t.setAttr("updatedAt", (/* @__PURE__ */ new Date()).getTime()), r;
|
|
1120
1120
|
});
|
|
1121
1121
|
updateComment = this.transact((e) => {
|
|
1122
1122
|
let t = this.threadsYType.getAttr(e.threadId);
|
|
1123
1123
|
if (!t) throw Error("Thread not found");
|
|
1124
|
-
let n = t.getAttr("comments"), r =
|
|
1124
|
+
let n = t.getAttr("comments"), r = Z(n, (t) => t.getAttr("id") === e.commentId);
|
|
1125
1125
|
if (r === -1) throw Error("Comment not found");
|
|
1126
1126
|
let i = n.get(r);
|
|
1127
|
-
if (!this.auth.canUpdateComment(
|
|
1127
|
+
if (!this.auth.canUpdateComment(Y(i))) throw Error("Not authorized");
|
|
1128
1128
|
i.setAttr("body", e.comment.body), i.setAttr("updatedAt", (/* @__PURE__ */ new Date()).getTime()), i.setAttr("metadata", e.comment.metadata);
|
|
1129
1129
|
});
|
|
1130
1130
|
deleteComment = this.transact((e) => {
|
|
1131
1131
|
let t = this.threadsYType.getAttr(e.threadId);
|
|
1132
1132
|
if (!t) throw Error("Thread not found");
|
|
1133
|
-
let n = t.getAttr("comments"), r =
|
|
1133
|
+
let n = t.getAttr("comments"), r = Z(n, (t) => t.getAttr("id") === e.commentId);
|
|
1134
1134
|
if (r === -1) throw Error("Comment not found");
|
|
1135
1135
|
let i = n.get(r);
|
|
1136
|
-
if (!this.auth.canDeleteComment(
|
|
1136
|
+
if (!this.auth.canDeleteComment(Y(i))) throw Error("Not authorized");
|
|
1137
1137
|
if (i.getAttr("deletedAt")) throw Error("Comment already deleted");
|
|
1138
1138
|
e.softDelete ? (i.setAttr("deletedAt", (/* @__PURE__ */ new Date()).getTime()), i.setAttr("body", void 0)) : n.delete(r), n.toArray().every((e) => e.getAttr("deletedAt")) && (e.softDelete ? t.setAttr("deletedAt", (/* @__PURE__ */ new Date()).getTime()) : this.threadsYType.deleteAttr(e.threadId)), t.setAttr("updatedAt", (/* @__PURE__ */ new Date()).getTime());
|
|
1139
1139
|
});
|
|
1140
1140
|
deleteThread = this.transact((e) => {
|
|
1141
|
-
if (!this.auth.canDeleteThread(
|
|
1141
|
+
if (!this.auth.canDeleteThread(X(this.threadsYType.getAttr(e.threadId)))) throw Error("Not authorized");
|
|
1142
1142
|
this.threadsYType.deleteAttr(e.threadId);
|
|
1143
1143
|
});
|
|
1144
1144
|
resolveThread = this.transact((e) => {
|
|
1145
1145
|
let t = this.threadsYType.getAttr(e.threadId);
|
|
1146
1146
|
if (!t) throw Error("Thread not found");
|
|
1147
|
-
if (!this.auth.canResolveThread(
|
|
1147
|
+
if (!this.auth.canResolveThread(X(t))) throw Error("Not authorized");
|
|
1148
1148
|
t.setAttr("resolved", !0), t.setAttr("resolvedUpdatedAt", (/* @__PURE__ */ new Date()).getTime()), t.setAttr("resolvedBy", this.userId);
|
|
1149
1149
|
});
|
|
1150
1150
|
unresolveThread = this.transact((e) => {
|
|
1151
1151
|
let t = this.threadsYType.getAttr(e.threadId);
|
|
1152
1152
|
if (!t) throw Error("Thread not found");
|
|
1153
|
-
if (!this.auth.canUnresolveThread(
|
|
1153
|
+
if (!this.auth.canUnresolveThread(X(t))) throw Error("Not authorized");
|
|
1154
1154
|
t.setAttr("resolved", !1), t.setAttr("resolvedUpdatedAt", (/* @__PURE__ */ new Date()).getTime());
|
|
1155
1155
|
});
|
|
1156
1156
|
addReaction = this.transact((e) => {
|
|
1157
1157
|
let t = this.threadsYType.getAttr(e.threadId);
|
|
1158
1158
|
if (!t) throw Error("Thread not found");
|
|
1159
|
-
let n = t.getAttr("comments"), r =
|
|
1159
|
+
let n = t.getAttr("comments"), r = Z(n, (t) => t.getAttr("id") === e.commentId);
|
|
1160
1160
|
if (r === -1) throw Error("Comment not found");
|
|
1161
1161
|
let i = n.get(r);
|
|
1162
|
-
if (!this.auth.canAddReaction(
|
|
1162
|
+
if (!this.auth.canAddReaction(Y(i), e.emoji)) throw Error("Not authorized");
|
|
1163
1163
|
let a = /* @__PURE__ */ new Date(), o = `${this.userId}-${e.emoji}`, s = i.getAttr("reactionsByUser");
|
|
1164
1164
|
if (!s.hasAttr(o)) {
|
|
1165
|
-
let t = new
|
|
1165
|
+
let t = new S.Node();
|
|
1166
1166
|
t.setAttr("emoji", e.emoji), t.setAttr("createdAt", a.getTime()), t.setAttr("userId", this.userId), s.setAttr(o, t);
|
|
1167
1167
|
}
|
|
1168
1168
|
});
|
|
1169
1169
|
deleteReaction = this.transact((e) => {
|
|
1170
1170
|
let t = this.threadsYType.getAttr(e.threadId);
|
|
1171
1171
|
if (!t) throw Error("Thread not found");
|
|
1172
|
-
let n = t.getAttr("comments"), r =
|
|
1172
|
+
let n = t.getAttr("comments"), r = Z(n, (t) => t.getAttr("id") === e.commentId);
|
|
1173
1173
|
if (r === -1) throw Error("Comment not found");
|
|
1174
1174
|
let i = n.get(r);
|
|
1175
|
-
if (!this.auth.canDeleteReaction(
|
|
1175
|
+
if (!this.auth.canDeleteReaction(Y(i), e.emoji)) throw Error("Not authorized");
|
|
1176
1176
|
let a = `${this.userId}-${e.emoji}`;
|
|
1177
1177
|
i.getAttr("reactionsByUser").deleteAttr(a);
|
|
1178
1178
|
});
|
|
1179
1179
|
};
|
|
1180
|
-
function
|
|
1180
|
+
function Z(e, t) {
|
|
1181
1181
|
for (let n = 0; n < e.length; n++) if (t(e.get(n))) return n;
|
|
1182
1182
|
return -1;
|
|
1183
1183
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
return C.encodeStateAsUpdateV2(e.doc);
|
|
1184
|
+
// src/y/extensions/snapshotCodec.ts
|
|
1185
|
+
function dt(e) {
|
|
1186
|
+
return S.encodeStateAsUpdateV2(e.doc);
|
|
1188
1187
|
}
|
|
1189
|
-
function
|
|
1190
|
-
let r = new
|
|
1188
|
+
function ft(e, t, n) {
|
|
1189
|
+
let r = new S.Doc(n?.suggestionDoc ? { isSuggestionDoc: !0 } : void 0);
|
|
1191
1190
|
try {
|
|
1192
|
-
return
|
|
1191
|
+
return S.applyUpdateV2(r, t), {
|
|
1193
1192
|
doc: r,
|
|
1194
|
-
fragment:
|
|
1193
|
+
fragment: G(e, r)
|
|
1195
1194
|
};
|
|
1196
1195
|
} catch (e) {
|
|
1197
1196
|
throw r.destroy(), e;
|
|
1198
1197
|
}
|
|
1199
1198
|
}
|
|
1200
|
-
function
|
|
1199
|
+
function pt(e) {
|
|
1201
1200
|
e?.doc.destroy();
|
|
1202
1201
|
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
function dt(e, t) {
|
|
1202
|
+
// src/y/extensions/snapshotPreview.ts
|
|
1203
|
+
function Q(e, t) {
|
|
1206
1204
|
let n = e.store.clients.get(t.client)?.at(-1);
|
|
1207
1205
|
return n !== void 0 && t.clock < n.id.clock + n.length;
|
|
1208
1206
|
}
|
|
1209
|
-
function
|
|
1207
|
+
function mt(e, t, n) {
|
|
1210
1208
|
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
1211
1209
|
for (let a = e._start; a !== null; a = a.right) {
|
|
1212
|
-
let e = !
|
|
1210
|
+
let e = !Q(t, a.id);
|
|
1213
1211
|
if (!e && !a.deleted) continue;
|
|
1214
1212
|
let [o, s] = e ? [r, n.inserts] : [i, n.deletes];
|
|
1215
1213
|
for (let e of s.slice(a.id.client, a.id.clock, a.length)) for (let t of e.attrs ?? []) o.set(`${t.name}:${String(t.val)}`, t);
|
|
@@ -1219,21 +1217,18 @@ function ft(e, t, n) {
|
|
|
1219
1217
|
deleted: [...i.values()]
|
|
1220
1218
|
};
|
|
1221
1219
|
}
|
|
1222
|
-
function
|
|
1220
|
+
function ht(e) {
|
|
1223
1221
|
let t = [];
|
|
1224
1222
|
for (let n = e._start; n !== null; n = n.right) if (!n.deleted) {
|
|
1225
|
-
if (n.content instanceof
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
continue;
|
|
1231
|
-
}
|
|
1232
|
-
for (let e = 0; e < n.length; e++) t.push({ id: C.createID(n.id.client, n.id.clock + e) });
|
|
1223
|
+
if (n.content instanceof S.ContentType) t.push({
|
|
1224
|
+
id: n.id,
|
|
1225
|
+
node: n.content.type
|
|
1226
|
+
});
|
|
1227
|
+
else for (let e = 0; e < n.length; e++) t.push({ id: S.createID(n.id.client, n.id.clock + e) });
|
|
1233
1228
|
}
|
|
1234
1229
|
return t;
|
|
1235
1230
|
}
|
|
1236
|
-
function
|
|
1231
|
+
function gt(e, t, n) {
|
|
1237
1232
|
for (let [r, i] of e._map) {
|
|
1238
1233
|
let e = t._map.get(r);
|
|
1239
1234
|
if (!i.deleted) {
|
|
@@ -1241,33 +1236,33 @@ function mt(e, t, n) {
|
|
|
1241
1236
|
n.push([i.id, e.id]);
|
|
1242
1237
|
}
|
|
1243
1238
|
}
|
|
1244
|
-
let r =
|
|
1239
|
+
let r = ht(e), i = ht(t);
|
|
1245
1240
|
return r.length === i.length && r.every((e, t) => {
|
|
1246
1241
|
let r = i[t];
|
|
1247
|
-
return n.push([e.id, r.id]), e.node && r.node ?
|
|
1242
|
+
return n.push([e.id, r.id]), e.node && r.node ? gt(e.node, r.node, n) : !e.node && !r.node;
|
|
1248
1243
|
});
|
|
1249
1244
|
}
|
|
1250
|
-
function
|
|
1245
|
+
function _t(e) {
|
|
1251
1246
|
let t = e._observers;
|
|
1252
1247
|
if (t.has("update") || t.has("updateV2")) throw Error("DANGER! Refusing to write to a doc that something syncs. splitChangedBlocks should only write to throwaway copies.");
|
|
1253
1248
|
}
|
|
1254
|
-
function
|
|
1255
|
-
return e.map((e) =>
|
|
1249
|
+
function vt(e, t) {
|
|
1250
|
+
return e.map((e) => S.createContentAttribute(e.name.replace(/^(insert|delete)/, t), e.val));
|
|
1256
1251
|
}
|
|
1257
|
-
function
|
|
1258
|
-
|
|
1252
|
+
function yt(e, t, n, r) {
|
|
1253
|
+
_t(e.doc);
|
|
1259
1254
|
for (let i = 0; i < e.length; i++) {
|
|
1260
1255
|
let a = e.get(i);
|
|
1261
|
-
if (a instanceof
|
|
1256
|
+
if (a instanceof S.Node) {
|
|
1262
1257
|
if (a.name === "blockContainer" && a._item) {
|
|
1263
|
-
let o =
|
|
1258
|
+
let o = Q(t, a._item.id) ? G(a, t) : void 0;
|
|
1264
1259
|
if (o && !I(o.toDeltaDeep(), a.toDeltaDeep())) {
|
|
1265
|
-
let { inserted: o, deleted: s } = n ?
|
|
1260
|
+
let { inserted: o, deleted: s } = n ? mt(a, t, n) : {
|
|
1266
1261
|
inserted: [],
|
|
1267
1262
|
deleted: []
|
|
1268
|
-
}, c = a.doc, l = o.length ? o :
|
|
1263
|
+
}, c = a.doc, l = o.length ? o : vt(s, "insert"), u = s.length ? s : vt(o, "delete"), d = S.createIdMap(), f = S.createIdSet();
|
|
1269
1264
|
function p(e) {
|
|
1270
|
-
l.length && (
|
|
1265
|
+
l.length && (S.insertIntoIdMap(r.inserts, S.mergeIdMaps([S.diffIdMap(S.createIdMapFromIdSet(e.insertSet, l), f), d])), S.insertIntoIdMap(r.deletes, S.createIdMapFromIdSet(e.deleteSet, u)));
|
|
1271
1266
|
}
|
|
1272
1267
|
c.on("beforeObserverCalls", p);
|
|
1273
1268
|
try {
|
|
@@ -1275,11 +1270,11 @@ function _t(e, t, n, r) {
|
|
|
1275
1270
|
let r = a.clone();
|
|
1276
1271
|
e.insert(i + 1, [r]);
|
|
1277
1272
|
let o = [];
|
|
1278
|
-
if (n &&
|
|
1279
|
-
let i =
|
|
1273
|
+
if (n && gt(a, r, o)) for (let [e, r] of o) {
|
|
1274
|
+
let i = Q(t, e) ? void 0 : n.inserts.slice(e.client, e.clock, 1)[0]?.attrs;
|
|
1280
1275
|
if (i) {
|
|
1281
|
-
let e =
|
|
1282
|
-
e.add(r.client, r.clock, 1), f.add(r.client, r.clock, 1),
|
|
1276
|
+
let e = S.createIdSet();
|
|
1277
|
+
e.add(r.client, r.clock, 1), f.add(r.client, r.clock, 1), S.insertIntoIdMap(d, S.createIdMapFromIdSet(e, i));
|
|
1283
1278
|
}
|
|
1284
1279
|
}
|
|
1285
1280
|
e.delete(i);
|
|
@@ -1290,65 +1285,69 @@ function _t(e, t, n, r) {
|
|
|
1290
1285
|
continue;
|
|
1291
1286
|
}
|
|
1292
1287
|
}
|
|
1293
|
-
|
|
1288
|
+
yt(a, t, n, r);
|
|
1294
1289
|
}
|
|
1295
1290
|
}
|
|
1296
1291
|
}
|
|
1297
|
-
function
|
|
1298
|
-
let a = r ?
|
|
1292
|
+
function bt(e, t, n, r, i) {
|
|
1293
|
+
let a = r ? ft(t, r, { suggestionDoc: !0 }) : void 0;
|
|
1299
1294
|
try {
|
|
1300
|
-
let r =
|
|
1295
|
+
let r = ft(t, n);
|
|
1301
1296
|
try {
|
|
1302
1297
|
let t = i;
|
|
1303
1298
|
if (a) {
|
|
1304
|
-
let e =
|
|
1305
|
-
|
|
1299
|
+
let e = S.createContentMap();
|
|
1300
|
+
yt(r.fragment, a.doc, i, e), i && (t = S.createContentMap(S.mergeIdMaps([i.inserts, e.inserts]), S.mergeIdMaps([i.deletes, e.deletes])));
|
|
1306
1301
|
}
|
|
1307
1302
|
e.exec(x({
|
|
1308
1303
|
ytype: r.fragment,
|
|
1309
|
-
renderer: a ?
|
|
1304
|
+
renderer: a ? S.createDiffRenderer(a.doc, r.doc, t ? { attributions: t } : void 0) : void 0
|
|
1310
1305
|
}));
|
|
1311
1306
|
} finally {
|
|
1312
|
-
|
|
1307
|
+
pt(r);
|
|
1313
1308
|
}
|
|
1314
1309
|
} finally {
|
|
1315
|
-
|
|
1310
|
+
pt(a);
|
|
1316
1311
|
}
|
|
1317
1312
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
function yt(e, t) {
|
|
1313
|
+
// src/y/extensions/Versioning.ts
|
|
1314
|
+
function $(e, t) {
|
|
1321
1315
|
return {
|
|
1322
1316
|
supportsComparison: !0,
|
|
1323
1317
|
open() {
|
|
1324
|
-
let n = e.getExtension(
|
|
1318
|
+
let n = e.getExtension(q), r = ge.getState(e.prosemirrorState);
|
|
1325
1319
|
if (!n || n.store.state.isForked || r?.renderer || r?.ytype !== t) throw Error("Versioning requires an active plain live binding and an available fork");
|
|
1326
1320
|
let i = {
|
|
1327
|
-
content:
|
|
1321
|
+
content: dt(t),
|
|
1328
1322
|
capturedAt: Date.now()
|
|
1329
1323
|
};
|
|
1330
1324
|
try {
|
|
1331
|
-
n.fork(), e.exec((e, t) =>
|
|
1325
|
+
n.fork(), e.exec((e, t) => le(e, t ?? null));
|
|
1332
1326
|
} catch (e) {
|
|
1333
|
-
throw n.merge({
|
|
1327
|
+
throw n.merge({
|
|
1328
|
+
keepChanges: !1,
|
|
1329
|
+
renderer: r.renderer
|
|
1330
|
+
}), e;
|
|
1334
1331
|
}
|
|
1335
1332
|
let a = !1;
|
|
1336
1333
|
return {
|
|
1337
1334
|
current: i,
|
|
1338
1335
|
show({ content: n, comparison: r }) {
|
|
1339
1336
|
if (a) throw Error("Version view is closed");
|
|
1340
|
-
|
|
1337
|
+
bt(e, t, n, r?.content, r?.attributions);
|
|
1341
1338
|
},
|
|
1342
1339
|
close() {
|
|
1343
|
-
a ||= (n.merge({
|
|
1340
|
+
a ||= (n.merge({
|
|
1341
|
+
keepChanges: !1,
|
|
1342
|
+
renderer: r.renderer
|
|
1343
|
+
}), !0);
|
|
1344
1344
|
}
|
|
1345
1345
|
};
|
|
1346
1346
|
}
|
|
1347
1347
|
};
|
|
1348
1348
|
}
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
var bt = class {
|
|
1349
|
+
// src/y/versioning/yhubClient.ts
|
|
1350
|
+
var xt = class {
|
|
1352
1351
|
baseUrl;
|
|
1353
1352
|
documentPath;
|
|
1354
1353
|
headers;
|
|
@@ -1401,7 +1400,7 @@ var bt = class {
|
|
|
1401
1400
|
}
|
|
1402
1401
|
async getVersion(e) {
|
|
1403
1402
|
return this.request("version", (e) => {
|
|
1404
|
-
let { versions: t } =
|
|
1403
|
+
let { versions: t } = T(e);
|
|
1405
1404
|
return t[0];
|
|
1406
1405
|
}, {
|
|
1407
1406
|
from: e,
|
|
@@ -1415,9 +1414,9 @@ var bt = class {
|
|
|
1415
1414
|
name: t,
|
|
1416
1415
|
...n === void 0 ? {} : { custom: n }
|
|
1417
1416
|
};
|
|
1418
|
-
return this.request("version", (e) =>
|
|
1417
|
+
return this.request("version", (e) => T(e), void 0, {
|
|
1419
1418
|
method: "POST",
|
|
1420
|
-
body:
|
|
1419
|
+
body: E(r)
|
|
1421
1420
|
});
|
|
1422
1421
|
}
|
|
1423
1422
|
async updateVersion(e, t, n = e.custom) {
|
|
@@ -1428,9 +1427,9 @@ var bt = class {
|
|
|
1428
1427
|
name: t,
|
|
1429
1428
|
custom: n
|
|
1430
1429
|
};
|
|
1431
|
-
return this.request("version", (e) =>
|
|
1430
|
+
return this.request("version", (e) => T(e), void 0, {
|
|
1432
1431
|
method: "PATCH",
|
|
1433
|
-
body:
|
|
1432
|
+
body: E(r)
|
|
1434
1433
|
});
|
|
1435
1434
|
}
|
|
1436
1435
|
async deleteVersion(e) {
|
|
@@ -1441,7 +1440,7 @@ var bt = class {
|
|
|
1441
1440
|
}
|
|
1442
1441
|
async getActivity(e, t) {
|
|
1443
1442
|
return this.request("activity", (e) => {
|
|
1444
|
-
let { activity: t } =
|
|
1443
|
+
let { activity: t } = T(e);
|
|
1445
1444
|
return t.map((e) => ({
|
|
1446
1445
|
...e,
|
|
1447
1446
|
by: (Array.isArray(e.by) ? e.by : e.by?.split(",") ?? []).filter((e) => e !== null).map((e) => e.trim()).filter(Boolean),
|
|
@@ -1450,18 +1449,18 @@ var bt = class {
|
|
|
1450
1449
|
}, e, { signal: t });
|
|
1451
1450
|
}
|
|
1452
1451
|
async getChangeset(e, t) {
|
|
1453
|
-
return this.request("changeset", (e) =>
|
|
1452
|
+
return this.request("changeset", (e) => T(e), e, { signal: t });
|
|
1454
1453
|
}
|
|
1455
1454
|
async getDocument(e) {
|
|
1456
1455
|
return this.request("ydoc", (e) => {
|
|
1457
|
-
let { doc: t } =
|
|
1456
|
+
let { doc: t } = T(e);
|
|
1458
1457
|
if (!t) throw Error("YHub returned no document state.");
|
|
1459
1458
|
return t;
|
|
1460
1459
|
}, e);
|
|
1461
1460
|
}
|
|
1462
1461
|
async getContent(e, t) {
|
|
1463
1462
|
return this.request("changeset", (t) => {
|
|
1464
|
-
let { ydoc: n } =
|
|
1463
|
+
let { ydoc: n } = T(t);
|
|
1465
1464
|
if (!n) throw Error(`YHub returned no document state at timestamp ${e}.`);
|
|
1466
1465
|
return n;
|
|
1467
1466
|
}, {
|
|
@@ -1471,7 +1470,7 @@ var bt = class {
|
|
|
1471
1470
|
}
|
|
1472
1471
|
async getAttributions(e, t, n) {
|
|
1473
1472
|
return this.request("changeset", (e) => {
|
|
1474
|
-
let { attributions: t } =
|
|
1473
|
+
let { attributions: t } = T(e);
|
|
1475
1474
|
if (!t) throw Error("YHub returned no attributions.");
|
|
1476
1475
|
return t;
|
|
1477
1476
|
}, {
|
|
@@ -1483,31 +1482,30 @@ var bt = class {
|
|
|
1483
1482
|
async rollback(e) {
|
|
1484
1483
|
return this.request("rollback", () => void 0, void 0, {
|
|
1485
1484
|
method: "POST",
|
|
1486
|
-
body:
|
|
1485
|
+
body: E(e)
|
|
1487
1486
|
});
|
|
1488
1487
|
}
|
|
1489
1488
|
};
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
let n = t.getExtension(X);
|
|
1489
|
+
// src/y/versioning/yhub.ts
|
|
1490
|
+
function St(e) {
|
|
1491
|
+
return d((t) => {
|
|
1492
|
+
let n = t.getExtension(J);
|
|
1495
1493
|
if (!n) throw Error("Y14 versioning requires Y14 collaboration");
|
|
1496
1494
|
return {
|
|
1497
|
-
adapter:
|
|
1495
|
+
adapter: $(t, n.fragment),
|
|
1498
1496
|
storage: e.storage,
|
|
1499
1497
|
resolveUsers: n.userStore,
|
|
1500
1498
|
scrollToFirstChange: e.scrollToFirstChange
|
|
1501
1499
|
};
|
|
1502
1500
|
})();
|
|
1503
1501
|
}
|
|
1504
|
-
function
|
|
1505
|
-
return
|
|
1506
|
-
let n = t.getExtension(
|
|
1502
|
+
function Ct(e) {
|
|
1503
|
+
return d((t) => {
|
|
1504
|
+
let n = t.getExtension(J);
|
|
1507
1505
|
if (!n) throw Error("Y14 versioning requires Y14 collaboration");
|
|
1508
1506
|
return {
|
|
1509
|
-
adapter:
|
|
1510
|
-
storage:
|
|
1507
|
+
adapter: $(t, n.fragment),
|
|
1508
|
+
storage: wt({
|
|
1511
1509
|
...e,
|
|
1512
1510
|
fragment: n.fragment,
|
|
1513
1511
|
beforeRestoreName: t.dictionary.versioning.before_restore
|
|
@@ -1517,8 +1515,8 @@ function St(e) {
|
|
|
1517
1515
|
};
|
|
1518
1516
|
})();
|
|
1519
1517
|
}
|
|
1520
|
-
function
|
|
1521
|
-
let { fragment: t, beforeRestoreName: n } = e, r = new
|
|
1518
|
+
function wt(e) {
|
|
1519
|
+
let { fragment: t, beforeRestoreName: n } = e, r = new xt(e);
|
|
1522
1520
|
function i(e) {
|
|
1523
1521
|
let t = e.split("-"), n = Number(t[0]), r = Number(t[1]);
|
|
1524
1522
|
if (t.length !== 2 || t.some((e) => e.length === 0) || !Number.isFinite(n) || !Number.isFinite(r) || n > r) throw Error("Invalid YHub checkpoint identifier");
|
|
@@ -1607,14 +1605,14 @@ function Ct(e) {
|
|
|
1607
1605
|
let n = await r.getContent(i(e).to, t);
|
|
1608
1606
|
return n.ok ? {
|
|
1609
1607
|
ok: !0,
|
|
1610
|
-
value:
|
|
1608
|
+
value: S.convertUpdateFormatV1ToV2(n.value)
|
|
1611
1609
|
} : n;
|
|
1612
1610
|
},
|
|
1613
1611
|
async getAttributions(e, t, n, a) {
|
|
1614
1612
|
let o = await r.getAttributions(i(t).to + 1, e.type === "current" ? void 0 : i(e.id).to, a);
|
|
1615
1613
|
return o.ok ? {
|
|
1616
1614
|
ok: !0,
|
|
1617
|
-
value:
|
|
1615
|
+
value: S.decodeContentMap(o.value)
|
|
1618
1616
|
} : o;
|
|
1619
1617
|
},
|
|
1620
1618
|
async create(e, n) {
|
|
@@ -1627,9 +1625,9 @@ function Ct(e) {
|
|
|
1627
1625
|
};
|
|
1628
1626
|
let s = await r.getContent(o.to);
|
|
1629
1627
|
if (!s.ok) return s;
|
|
1630
|
-
let c = new
|
|
1628
|
+
let c = new S.Doc(), l = new S.Doc();
|
|
1631
1629
|
try {
|
|
1632
|
-
if (
|
|
1630
|
+
if (S.applyUpdateV2(c, e), S.applyUpdate(l, s.value), JSON.stringify(G(t, c).toJSON()) !== JSON.stringify(G(t, l).toJSON())) return {
|
|
1633
1631
|
ok: !1,
|
|
1634
1632
|
error: { type: "conflict" }
|
|
1635
1633
|
};
|
|
@@ -1656,7 +1654,7 @@ function Ct(e) {
|
|
|
1656
1654
|
let { to: o } = i(e), [s, c] = await Promise.all([a(void 0, { limit: 1 }), r.getDocument({ gc: !1 })]);
|
|
1657
1655
|
if (!s.ok) return s;
|
|
1658
1656
|
if (!c.ok) return c;
|
|
1659
|
-
let l =
|
|
1657
|
+
let l = Be(t, c.value);
|
|
1660
1658
|
if (s.value[0]) {
|
|
1661
1659
|
let e = await r.getVersion(s.value[0].to);
|
|
1662
1660
|
if (!e.ok) return e;
|
|
@@ -1667,14 +1665,14 @@ function Ct(e) {
|
|
|
1667
1665
|
}
|
|
1668
1666
|
let u = await r.rollback({
|
|
1669
1667
|
from: o + 1,
|
|
1670
|
-
contentIds:
|
|
1668
|
+
contentIds: S.encodeContentIds({
|
|
1671
1669
|
inserts: l,
|
|
1672
1670
|
deletes: l
|
|
1673
1671
|
})
|
|
1674
1672
|
});
|
|
1675
1673
|
if (!u.ok) return u;
|
|
1676
1674
|
let d = await r.getDocument({ gc: !1 });
|
|
1677
|
-
return d.ok ? (
|
|
1675
|
+
return d.ok ? (S.applyUpdate(t.doc, d.value), {
|
|
1678
1676
|
ok: !0,
|
|
1679
1677
|
value: void 0
|
|
1680
1678
|
}) : d.error.type === "timeout" ? {
|
|
@@ -1716,7 +1714,4 @@ function Ct(e) {
|
|
|
1716
1714
|
}
|
|
1717
1715
|
};
|
|
1718
1716
|
}
|
|
1719
|
-
|
|
1720
|
-
export { P as AttributionExtension, X as CollaborationExtension, $e as DiffVersioningExtension, J as ForkYDocExtension, Le as PersistentGroup, Ie as PersistentGroupTransformer, ot as RESTYjsThreadStore, Je as RelativePositionMappingExtension, Ye as SuggestionsExtension, Se as YAttributedAttributes, be as YAttributedDeletion, xe as YAttributedFormat, ye as YAttributedInsertion, Ce as YAttributionMarksExtension, F as YCursorExtension, St as YHubVersioningExtension, ze as YSyncExtension, xt as YVersioningExtension, st as YjsThreadStore, at as YjsThreadStoreBase, K as _blocksToProsemirrorNode, Be as _prosemirrorJSONToBlocks, U as blockNoteTransformer, Ke as blocksToYDoc, We as blocksToYType, G as collectFragmentIds, Ct as createYHubVersionStorage, yt as createYVersionView, q as docDiffToDelta, W as findTypeInOtherYdoc, O as getAttributeChanges, k as getAttributionUserIds, H as mapAttributionToMark, V as persistentBlockGroups, D as resolveAttributionMarkClassName, et as withCollaboration, Ge as yDocToBlocks, qe as yNodeToTransaction, Ue as yfragmentToBlocks };
|
|
1721
|
-
|
|
1722
|
-
//# sourceMappingURL=y.js.map
|
|
1717
|
+
export { P as AttributionExtension, J as CollaborationExtension, nt as DiffVersioningExtension, q as ForkYDocExtension, Le as PersistentGroup, Ie as PersistentGroupTransformer, lt as RESTYjsThreadStore, Xe as RelativePositionMappingExtension, Ze as SuggestionsExtension, Ce as YAttributedAttributes, xe as YAttributedDeletion, Se as YAttributedFormat, be as YAttributedInsertion, we as YAttributionMarksExtension, F as YCursorExtension, Ct as YHubVersioningExtension, ze as YSyncExtension, St as YVersioningExtension, ut as YjsThreadStore, ct as YjsThreadStoreBase, K as _blocksToProsemirrorNode, Ve as _prosemirrorJSONToBlocks, W as blockNoteTransformer, qe as blocksToYDoc, Ge as blocksToYType, Be as collectFragmentIds, wt as createYHubVersionStorage, $ as createYVersionView, Je as docDiffToDelta, G as findTypeInOtherYdoc, O as getAttributeChanges, k as getAttributionUserIds, U as mapAttributionToMark, H as persistentBlockGroups, D as resolveAttributionMarkClassName, rt as withCollaboration, Ke as yDocToBlocks, Ye as yNodeToTransaction, We as yfragmentToBlocks };
|