@blocknote/core 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote.js +1602 -1569
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +6 -6
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +3 -3
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +3 -3
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +1 -3
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +1 -1
- package/src/api/blockManipulation/selections/selection.ts +5 -5
- package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraph.html +96 -0
- package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraphText.html +96 -0
- package/src/api/clipboard/__snapshots__/external/pasteImage.html +111 -0
- package/src/api/clipboard/__snapshots__/external/pasteParagraphInCustomBlock.html +96 -0
- package/src/api/clipboard/__snapshots__/external/pasteTable.html +149 -0
- package/src/api/clipboard/__snapshots__/external/pasteTableInExistingTable.html +124 -0
- package/src/api/clipboard/__snapshots__/internal/paragraphInCustomBlock.html +1 -0
- package/src/api/clipboard/__snapshots__/internal/tableAllCells.html +1 -0
- package/src/api/clipboard/__snapshots__/internal/tableCell.html +1 -0
- package/src/api/clipboard/__snapshots__/internal/tableRow.html +1 -0
- package/src/api/clipboard/clipboardExternal.test.ts +161 -0
- package/src/api/clipboard/{clipboard.test.ts → clipboardInternal.test.ts} +66 -40
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +1 -1
- package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +7 -14
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +6 -6
- package/src/api/clipboard/testUtil.ts +27 -0
- package/src/api/clipboard/toClipboard/copyExtension.ts +8 -2
- package/src/api/exporters/html/__snapshots__/file/basic/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/nested/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/noCaption/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/noName/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/basic/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/nested/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noCaption/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noName/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noPreview/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html +1 -1
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +3 -1
- package/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md +1 -1
- package/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md +2 -2
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md +1 -1
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md +1 -1
- package/src/api/nodeConversions/nodeToBlock.ts +4 -1
- package/src/api/parsers/markdown/__snapshots__/pasted/styled.json +2 -2
- package/src/api/parsers/markdown/parseMarkdown.test.ts +5 -7
- package/src/api/testUtil/partialBlockTestUtil.ts +4 -1
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +13 -14
- package/src/blocks/FileBlockContent/FileBlockContent.ts +5 -12
- package/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.ts +5 -0
- package/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts +16 -0
- package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +63 -0
- package/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.ts +80 -0
- package/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.ts +24 -0
- package/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts +204 -0
- package/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.ts +13 -0
- package/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.ts +15 -0
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +3 -19
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +20 -28
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +3 -15
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +11 -3
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +25 -5
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +20 -27
- package/src/editor/Block.css +38 -54
- package/src/editor/BlockNoteEditor.test.ts +21 -1
- package/src/editor/BlockNoteEditor.ts +14 -7
- package/src/editor/BlockNoteExtensions.ts +7 -8
- package/src/editor/editor.css +7 -6
- package/src/editor/transformPasted.ts +57 -4
- package/src/extensions/LinkToolbar/protocols.ts +13 -0
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +6 -6
- package/src/extensions/SideMenu/SideMenuPlugin.ts +5 -1
- package/src/extensions/SideMenu/dragging.ts +3 -0
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +3 -6
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +15 -3
- package/src/index.ts +9 -2
- package/src/schema/blocks/createSpec.ts +1 -1
- package/src/schema/blocks/internal.ts +16 -6
- package/src/schema/inlineContent/createSpec.ts +2 -2
- package/src/schema/inlineContent/internal.ts +4 -1
- package/src/schema/propTypes.ts +41 -18
- package/types/src/api/blockManipulation/setupTestEnv.d.ts +8 -0
- package/types/src/api/clipboard/clipboardInternal.test.d.ts +1 -0
- package/types/src/api/clipboard/fromClipboard/handleVSCodePaste.d.ts +2 -3
- package/types/src/api/clipboard/fromClipboard/pasteExtension.d.ts +1 -3
- package/types/src/api/clipboard/testUtil.d.ts +509 -0
- package/types/src/api/testUtil/cases/customBlocks.d.ts +8 -0
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +8 -0
- package/types/src/api/testUtil/cases/customStyles.d.ts +8 -0
- package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +2 -5
- package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +2 -5
- package/types/src/blocks/FileBlockContent/helpers/parse/parseEmbedElement.d.ts +3 -0
- package/types/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.d.ts +4 -0
- package/types/src/blocks/FileBlockContent/helpers/render/createAddFileButton.d.ts +6 -0
- package/types/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.d.ts +9 -0
- package/types/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.d.ts +6 -0
- package/types/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.d.ts +9 -0
- package/types/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.d.ts +3 -0
- package/types/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.d.ts +3 -0
- package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +2 -5
- package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +12 -0
- package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +2 -5
- package/types/src/blocks/defaultBlocks.d.ts +16 -0
- package/types/src/editor/BlockNoteEditor.d.ts +6 -4
- package/types/src/editor/transformPasted.d.ts +8 -4
- package/types/src/extensions/LinkToolbar/protocols.d.ts +2 -0
- package/types/src/index.d.ts +9 -2
- package/types/src/schema/propTypes.d.ts +20 -2
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js +0 -30
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js +0 -99
- package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js +0 -97
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js +0 -88
- package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js +0 -219
- package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js +0 -175
- package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js +0 -57
- package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js +0 -5
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js +0 -31
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js +0 -71
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js +0 -157
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js +0 -27
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js +0 -67
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js +0 -148
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js.map +0 -1
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js +0 -252
- package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js.map +0 -1
- package/dist/src/api/blockManipulation/getBlock/getBlock.js +0 -56
- package/dist/src/api/blockManipulation/getBlock/getBlock.js.map +0 -1
- package/dist/src/api/blockManipulation/insertContentAt.js +0 -64
- package/dist/src/api/blockManipulation/insertContentAt.js.map +0 -1
- package/dist/src/api/blockManipulation/selections/selection.js +0 -149
- package/dist/src/api/blockManipulation/selections/selection.js.map +0 -1
- package/dist/src/api/blockManipulation/selections/selection.test.js +0 -39
- package/dist/src/api/blockManipulation/selections/selection.test.js.map +0 -1
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js +0 -79
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js.map +0 -1
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js +0 -33
- package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js.map +0 -1
- package/dist/src/api/blockManipulation/setupTestEnv.js +0 -172
- package/dist/src/api/blockManipulation/setupTestEnv.js.map +0 -1
- package/dist/src/api/clipboard/clipboard.test.js +0 -246
- package/dist/src/api/clipboard/clipboard.test.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js +0 -8
- package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js +0 -38
- package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js +0 -111
- package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js +0 -26
- package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js.map +0 -1
- package/dist/src/api/clipboard/fromClipboard/pasteExtension.js +0 -57
- package/dist/src/api/clipboard/fromClipboard/pasteExtension.js.map +0 -1
- package/dist/src/api/clipboard/toClipboard/copyExtension.js +0 -132
- package/dist/src/api/clipboard/toClipboard/copyExtension.js.map +0 -1
- package/dist/src/api/exporters/html/externalHTMLExporter.js +0 -35
- package/dist/src/api/exporters/html/externalHTMLExporter.js.map +0 -1
- package/dist/src/api/exporters/html/htmlConversion.test.js +0 -72
- package/dist/src/api/exporters/html/htmlConversion.test.js.map +0 -1
- package/dist/src/api/exporters/html/internalHTMLSerializer.js +0 -21
- package/dist/src/api/exporters/html/internalHTMLSerializer.js.map +0 -1
- package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js +0 -141
- package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js.map +0 -1
- package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js +0 -96
- package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js.map +0 -1
- package/dist/src/api/exporters/markdown/markdownExporter.js +0 -31
- package/dist/src/api/exporters/markdown/markdownExporter.js.map +0 -1
- package/dist/src/api/exporters/markdown/markdownExporter.test.js +0 -57
- package/dist/src/api/exporters/markdown/markdownExporter.test.js.map +0 -1
- package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js +0 -33
- package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js.map +0 -1
- package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js +0 -37
- package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js.map +0 -1
- package/dist/src/api/getBlockInfoFromPos.js +0 -165
- package/dist/src/api/getBlockInfoFromPos.js.map +0 -1
- package/dist/src/api/nodeConversions/blockToNode.js +0 -197
- package/dist/src/api/nodeConversions/blockToNode.js.map +0 -1
- package/dist/src/api/nodeConversions/fragmentToBlocks.js +0 -50
- package/dist/src/api/nodeConversions/fragmentToBlocks.js.map +0 -1
- package/dist/src/api/nodeConversions/nodeConversions.test.js +0 -54
- package/dist/src/api/nodeConversions/nodeConversions.test.js.map +0 -1
- package/dist/src/api/nodeConversions/nodeToBlock.js +0 -316
- package/dist/src/api/nodeConversions/nodeToBlock.js.map +0 -1
- package/dist/src/api/nodeUtil.js +0 -28
- package/dist/src/api/nodeUtil.js.map +0 -1
- package/dist/src/api/parsers/html/parseHTML.js +0 -19
- package/dist/src/api/parsers/html/parseHTML.js.map +0 -1
- package/dist/src/api/parsers/html/parseHTML.test.js +0 -470
- package/dist/src/api/parsers/html/parseHTML.test.js.map +0 -1
- package/dist/src/api/parsers/html/util/nestedLists.js +0 -106
- package/dist/src/api/parsers/html/util/nestedLists.js.map +0 -1
- package/dist/src/api/parsers/html/util/nestedLists.test.js +0 -166
- package/dist/src/api/parsers/html/util/nestedLists.test.js.map +0 -1
- package/dist/src/api/parsers/markdown/parseMarkdown.js +0 -52
- package/dist/src/api/parsers/markdown/parseMarkdown.js.map +0 -1
- package/dist/src/api/parsers/markdown/parseMarkdown.test.js +0 -109
- package/dist/src/api/parsers/markdown/parseMarkdown.test.js.map +0 -1
- package/dist/src/api/testUtil/cases/customBlocks.js +0 -313
- package/dist/src/api/testUtil/cases/customBlocks.js.map +0 -1
- package/dist/src/api/testUtil/cases/customInlineContent.js +0 -91
- package/dist/src/api/testUtil/cases/customInlineContent.js.map +0 -1
- package/dist/src/api/testUtil/cases/customStyles.js +0 -83
- package/dist/src/api/testUtil/cases/customStyles.js.map +0 -1
- package/dist/src/api/testUtil/cases/defaultSchema.js +0 -673
- package/dist/src/api/testUtil/cases/defaultSchema.js.map +0 -1
- package/dist/src/api/testUtil/index.js +0 -2
- package/dist/src/api/testUtil/index.js.map +0 -1
- package/dist/src/api/testUtil/partialBlockTestUtil.js +0 -114
- package/dist/src/api/testUtil/partialBlockTestUtil.js.map +0 -1
- package/dist/src/api/testUtil/paste.js +0 -29
- package/dist/src/api/testUtil/paste.js.map +0 -1
- package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js +0 -97
- package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js.map +0 -1
- package/dist/src/blocks/AudioBlockContent/audioBlockHelpers.js +0 -5
- package/dist/src/blocks/AudioBlockContent/audioBlockHelpers.js.map +0 -1
- package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js +0 -281
- package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js.map +0 -1
- package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js +0 -110
- package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/FileBlockContent.js +0 -70
- package/dist/src/blocks/FileBlockContent/FileBlockContent.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js +0 -317
- package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js.map +0 -1
- package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js +0 -15
- package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js.map +0 -1
- package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js +0 -145
- package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js.map +0 -1
- package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js +0 -106
- package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js.map +0 -1
- package/dist/src/blocks/ImageBlockContent/imageBlockHelpers.js +0 -6
- package/dist/src/blocks/ImageBlockContent/imageBlockHelpers.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js +0 -113
- package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js +0 -224
- package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js +0 -45
- package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js +0 -58
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js.map +0 -1
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js +0 -130
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js.map +0 -1
- package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js +0 -52
- package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js.map +0 -1
- package/dist/src/blocks/TableBlockContent/TableBlockContent.js +0 -129
- package/dist/src/blocks/TableBlockContent/TableBlockContent.js.map +0 -1
- package/dist/src/blocks/TableBlockContent/TableExtension.js +0 -64
- package/dist/src/blocks/TableBlockContent/TableExtension.js.map +0 -1
- package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js +0 -103
- package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js.map +0 -1
- package/dist/src/blocks/VideoBlockContent/videoBlockHelpers.js +0 -6
- package/dist/src/blocks/VideoBlockContent/videoBlockHelpers.js.map +0 -1
- package/dist/src/blocks/defaultBlockHelpers.js +0 -50
- package/dist/src/blocks/defaultBlockHelpers.js.map +0 -1
- package/dist/src/blocks/defaultBlockTypeGuards.js +0 -40
- package/dist/src/blocks/defaultBlockTypeGuards.js.map +0 -1
- package/dist/src/blocks/defaultBlocks.js +0 -50
- package/dist/src/blocks/defaultBlocks.js.map +0 -1
- package/dist/src/blocks/defaultProps.js +0 -19
- package/dist/src/blocks/defaultProps.js.map +0 -1
- package/dist/src/editor/BlockNoteEditor.js +0 -748
- package/dist/src/editor/BlockNoteEditor.js.map +0 -1
- package/dist/src/editor/BlockNoteEditor.test.js +0 -65
- package/dist/src/editor/BlockNoteEditor.test.js.map +0 -1
- package/dist/src/editor/BlockNoteExtensions.js +0 -196
- package/dist/src/editor/BlockNoteExtensions.js.map +0 -1
- package/dist/src/editor/BlockNoteSchema.js +0 -38
- package/dist/src/editor/BlockNoteSchema.js.map +0 -1
- package/dist/src/editor/BlockNoteTipTapEditor.js +0 -169
- package/dist/src/editor/BlockNoteTipTapEditor.js.map +0 -1
- package/dist/src/editor/cursorPositionTypes.js +0 -2
- package/dist/src/editor/cursorPositionTypes.js.map +0 -1
- package/dist/src/editor/defaultColors.js +0 -77
- package/dist/src/editor/defaultColors.js.map +0 -1
- package/dist/src/editor/selectionTypes.js +0 -2
- package/dist/src/editor/selectionTypes.js.map +0 -1
- package/dist/src/editor/transformPasted.js +0 -79
- package/dist/src/editor/transformPasted.js.map +0 -1
- package/dist/src/exporter/Exporter.js +0 -36
- package/dist/src/exporter/Exporter.js.map +0 -1
- package/dist/src/exporter/index.js +0 -3
- package/dist/src/exporter/index.js.map +0 -1
- package/dist/src/exporter/mapping.js +0 -12
- package/dist/src/exporter/mapping.js.map +0 -1
- package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js +0 -30
- package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js.map +0 -1
- package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js +0 -39
- package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js.map +0 -1
- package/dist/src/extensions/FilePanel/FilePanelPlugin.js +0 -131
- package/dist/src/extensions/FilePanel/FilePanelPlugin.js.map +0 -1
- package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js +0 -197
- package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js.map +0 -1
- package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +0 -341
- package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +0 -1
- package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js +0 -251
- package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js.map +0 -1
- package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js +0 -54
- package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js.map +0 -1
- package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +0 -90
- package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +0 -1
- package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js +0 -187
- package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js.map +0 -1
- package/dist/src/extensions/SideMenu/MultipleNodeSelection.js +0 -68
- package/dist/src/extensions/SideMenu/MultipleNodeSelection.js.map +0 -1
- package/dist/src/extensions/SideMenu/SideMenuPlugin.js +0 -343
- package/dist/src/extensions/SideMenu/SideMenuPlugin.js.map +0 -1
- package/dist/src/extensions/SideMenu/dragging.js +0 -132
- package/dist/src/extensions/SideMenu/dragging.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js +0 -2
- package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js +0 -2
- package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js +0 -245
- package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js +0 -26
- package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js.map +0 -1
- package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js +0 -241
- package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js.map +0 -1
- package/dist/src/extensions/TableHandles/TableHandlesPlugin.js +0 -570
- package/dist/src/extensions/TableHandles/TableHandlesPlugin.js.map +0 -1
- package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js +0 -36
- package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js.map +0 -1
- package/dist/src/extensions/TextColor/TextColorExtension.js +0 -29
- package/dist/src/extensions/TextColor/TextColorExtension.js.map +0 -1
- package/dist/src/extensions/TextColor/TextColorMark.js +0 -37
- package/dist/src/extensions/TextColor/TextColorMark.js.map +0 -1
- package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js +0 -58
- package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js.map +0 -1
- package/dist/src/extensions/UniqueID/UniqueID.js +0 -283
- package/dist/src/extensions/UniqueID/UniqueID.js.map +0 -1
- package/dist/src/extensions/getDraggableBlockFromElement.js +0 -13
- package/dist/src/extensions/getDraggableBlockFromElement.js.map +0 -1
- package/dist/src/extensions-shared/UiElementPosition.js +0 -2
- package/dist/src/extensions-shared/UiElementPosition.js.map +0 -1
- package/dist/src/i18n/dictionary.js +0 -4
- package/dist/src/i18n/dictionary.js.map +0 -1
- package/dist/src/i18n/locales/ar.js +0 -298
- package/dist/src/i18n/locales/ar.js.map +0 -1
- package/dist/src/i18n/locales/de.js +0 -313
- package/dist/src/i18n/locales/de.js.map +0 -1
- package/dist/src/i18n/locales/en.js +0 -314
- package/dist/src/i18n/locales/en.js.map +0 -1
- package/dist/src/i18n/locales/es.js +0 -312
- package/dist/src/i18n/locales/es.js.map +0 -1
- package/dist/src/i18n/locales/fr.js +0 -313
- package/dist/src/i18n/locales/fr.js.map +0 -1
- package/dist/src/i18n/locales/hr.js +0 -308
- package/dist/src/i18n/locales/hr.js.map +0 -1
- package/dist/src/i18n/locales/index.js +0 -16
- package/dist/src/i18n/locales/index.js.map +0 -1
- package/dist/src/i18n/locales/is.js +0 -305
- package/dist/src/i18n/locales/is.js.map +0 -1
- package/dist/src/i18n/locales/ja.js +0 -333
- package/dist/src/i18n/locales/ja.js.map +0 -1
- package/dist/src/i18n/locales/ko.js +0 -326
- package/dist/src/i18n/locales/ko.js.map +0 -1
- package/dist/src/i18n/locales/nl.js +0 -313
- package/dist/src/i18n/locales/nl.js.map +0 -1
- package/dist/src/i18n/locales/pl.js +0 -297
- package/dist/src/i18n/locales/pl.js.map +0 -1
- package/dist/src/i18n/locales/pt.js +0 -305
- package/dist/src/i18n/locales/pt.js.map +0 -1
- package/dist/src/i18n/locales/ru.js +0 -340
- package/dist/src/i18n/locales/ru.js.map +0 -1
- package/dist/src/i18n/locales/vi.js +0 -312
- package/dist/src/i18n/locales/vi.js.map +0 -1
- package/dist/src/i18n/locales/zh.js +0 -346
- package/dist/src/i18n/locales/zh.js.map +0 -1
- package/dist/src/index.js +0 -56
- package/dist/src/index.js.map +0 -1
- package/dist/src/pm-nodes/BlockContainer.js +0 -72
- package/dist/src/pm-nodes/BlockContainer.js.map +0 -1
- package/dist/src/pm-nodes/BlockGroup.js +0 -43
- package/dist/src/pm-nodes/BlockGroup.js.map +0 -1
- package/dist/src/pm-nodes/Doc.js +0 -7
- package/dist/src/pm-nodes/Doc.js.map +0 -1
- package/dist/src/pm-nodes/index.js +0 -4
- package/dist/src/pm-nodes/index.js.map +0 -1
- package/dist/src/schema/blocks/createSpec.js +0 -126
- package/dist/src/schema/blocks/createSpec.js.map +0 -1
- package/dist/src/schema/blocks/internal.js +0 -147
- package/dist/src/schema/blocks/internal.js.map +0 -1
- package/dist/src/schema/blocks/types.js +0 -2
- package/dist/src/schema/blocks/types.js.map +0 -1
- package/dist/src/schema/index.js +0 -11
- package/dist/src/schema/index.js.map +0 -1
- package/dist/src/schema/inlineContent/createSpec.js +0 -64
- package/dist/src/schema/inlineContent/createSpec.js.map +0 -1
- package/dist/src/schema/inlineContent/internal.js +0 -52
- package/dist/src/schema/inlineContent/internal.js.map +0 -1
- package/dist/src/schema/inlineContent/types.js +0 -10
- package/dist/src/schema/inlineContent/types.js.map +0 -1
- package/dist/src/schema/propTypes.js +0 -2
- package/dist/src/schema/propTypes.js.map +0 -1
- package/dist/src/schema/styles/createSpec.js +0 -48
- package/dist/src/schema/styles/createSpec.js.map +0 -1
- package/dist/src/schema/styles/internal.js +0 -53
- package/dist/src/schema/styles/internal.js.map +0 -1
- package/dist/src/schema/styles/types.js +0 -2
- package/dist/src/schema/styles/types.js.map +0 -1
- package/dist/src/util/EventEmitter.js +0 -33
- package/dist/src/util/EventEmitter.js.map +0 -1
- package/dist/src/util/browser.js +0 -17
- package/dist/src/util/browser.js.map +0 -1
- package/dist/src/util/combineByGroup.js +0 -20
- package/dist/src/util/combineByGroup.js.map +0 -1
- package/dist/src/util/esmDependencies.js +0 -35
- package/dist/src/util/esmDependencies.js.map +0 -1
- package/dist/src/util/string.js +0 -14
- package/dist/src/util/string.js.map +0 -1
- package/dist/src/util/typescript.js +0 -12
- package/dist/src/util/typescript.js.map +0 -1
- package/src/api/clipboard/__snapshots__/tableAllCells.html +0 -1
- package/src/api/clipboard/__snapshots__/tableCell.html +0 -1
- package/src/api/clipboard/__snapshots__/tableRow.html +0 -1
- package/src/blocks/FileBlockContent/fileBlockHelpers.ts +0 -456
- package/types/src/blocks/FileBlockContent/fileBlockHelpers.d.ts +0 -41
- /package/src/api/clipboard/__snapshots__/{childToParent.html → internal/childToParent.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{childrenToNextParent.html → internal/childrenToNextParent.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{childrenToNextParentsChildren.html → internal/childrenToNextParentsChildren.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{image.html → internal/image.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{multipleChildren.html → internal/multipleChildren.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{multipleStyledText.html → internal/multipleStyledText.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{nestedImage.html → internal/nestedImage.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{partialChildToParent.html → internal/partialChildToParent.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{styledText.html → internal/styledText.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{tableCellText.html → internal/tableCellText.html} +0 -0
- /package/src/api/clipboard/__snapshots__/{unstyledText.html → internal/unstyledText.html} +0 -0
- /package/src/blocks/AudioBlockContent/{audioBlockHelpers.ts → parseAudioElement.ts} +0 -0
- /package/src/blocks/ImageBlockContent/{imageBlockHelpers.ts → parseImageElement.ts} +0 -0
- /package/src/blocks/VideoBlockContent/{videoBlockHelpers.ts → parseVideoElement.ts} +0 -0
- /package/types/src/api/clipboard/{clipboard.test.d.ts → clipboardExternal.test.d.ts} +0 -0
- /package/types/src/blocks/AudioBlockContent/{audioBlockHelpers.d.ts → parseAudioElement.d.ts} +0 -0
- /package/types/src/blocks/ImageBlockContent/{imageBlockHelpers.d.ts → parseImageElement.d.ts} +0 -0
- /package/types/src/blocks/VideoBlockContent/{videoBlockHelpers.d.ts → parseVideoElement.d.ts} +0 -0
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { Extension } from "@tiptap/core";
|
|
2
|
-
import { TextSelection } from "prosemirror-state";
|
|
3
|
-
import { ReplaceAroundStep } from "prosemirror-transform";
|
|
4
|
-
import { getBottomNestedBlockInfo, getParentBlockInfo, getPrevBlockInfo, mergeBlocksCommand, } from "../../api/blockManipulation/commands/mergeBlocks/mergeBlocks.js";
|
|
5
|
-
import { nestBlock } from "../../api/blockManipulation/commands/nestBlock/nestBlock.js";
|
|
6
|
-
import { splitBlockCommand } from "../../api/blockManipulation/commands/splitBlock/splitBlock.js";
|
|
7
|
-
import { updateBlockCommand } from "../../api/blockManipulation/commands/updateBlock/updateBlock.js";
|
|
8
|
-
import { getBlockInfoFromSelection } from "../../api/getBlockInfoFromPos.js";
|
|
9
|
-
export const KeyboardShortcutsExtension = Extension.create({
|
|
10
|
-
priority: 50,
|
|
11
|
-
// TODO: The shortcuts need a refactor. Do we want to use a command priority
|
|
12
|
-
// design as there is now, or clump the logic into a single function?
|
|
13
|
-
addKeyboardShortcuts() {
|
|
14
|
-
// handleBackspace is partially adapted from https://github.com/ueberdosis/tiptap/blob/ed56337470efb4fd277128ab7ef792b37cfae992/packages/core/src/extensions/keymap.ts
|
|
15
|
-
const handleBackspace = () => this.editor.commands.first(({ chain, commands }) => [
|
|
16
|
-
// Deletes the selection if it's not empty.
|
|
17
|
-
() => commands.deleteSelection(),
|
|
18
|
-
// Undoes an input rule if one was triggered in the last editor state change.
|
|
19
|
-
() => commands.undoInputRule(),
|
|
20
|
-
// Reverts block content type to a paragraph if the selection is at the start of the block.
|
|
21
|
-
() => commands.command(({ state }) => {
|
|
22
|
-
const blockInfo = getBlockInfoFromSelection(state);
|
|
23
|
-
if (!blockInfo.isBlockContainer) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
const selectionAtBlockStart = state.selection.from === blockInfo.blockContent.beforePos + 1;
|
|
27
|
-
const isParagraph = blockInfo.blockContent.node.type.name === "paragraph";
|
|
28
|
-
if (selectionAtBlockStart && !isParagraph) {
|
|
29
|
-
return commands.command(updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {
|
|
30
|
-
type: "paragraph",
|
|
31
|
-
props: {},
|
|
32
|
-
}));
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
-
}),
|
|
36
|
-
// Removes a level of nesting if the block is indented if the selection is at the start of the block.
|
|
37
|
-
() => commands.command(({ state }) => {
|
|
38
|
-
const blockInfo = getBlockInfoFromSelection(state);
|
|
39
|
-
if (!blockInfo.isBlockContainer) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
const { blockContent } = blockInfo;
|
|
43
|
-
const selectionAtBlockStart = state.selection.from === blockContent.beforePos + 1;
|
|
44
|
-
if (selectionAtBlockStart) {
|
|
45
|
-
return commands.liftListItem("blockContainer");
|
|
46
|
-
}
|
|
47
|
-
return false;
|
|
48
|
-
}),
|
|
49
|
-
// Merges block with the previous one if it isn't indented, and the selection is at the start of the
|
|
50
|
-
// block. The target block for merging must contain inline content.
|
|
51
|
-
() => commands.command(({ state }) => {
|
|
52
|
-
const blockInfo = getBlockInfoFromSelection(state);
|
|
53
|
-
if (!blockInfo.isBlockContainer) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
const { bnBlock: blockContainer, blockContent } = blockInfo;
|
|
57
|
-
const selectionAtBlockStart = state.selection.from === blockContent.beforePos + 1;
|
|
58
|
-
const selectionEmpty = state.selection.empty;
|
|
59
|
-
const posBetweenBlocks = blockContainer.beforePos;
|
|
60
|
-
if (selectionAtBlockStart && selectionEmpty) {
|
|
61
|
-
return chain()
|
|
62
|
-
.command(mergeBlocksCommand(posBetweenBlocks))
|
|
63
|
-
.scrollIntoView()
|
|
64
|
-
.run();
|
|
65
|
-
}
|
|
66
|
-
return false;
|
|
67
|
-
}),
|
|
68
|
-
() => commands.command(({ state, dispatch }) => {
|
|
69
|
-
// when at the start of a first block in a column
|
|
70
|
-
const blockInfo = getBlockInfoFromSelection(state);
|
|
71
|
-
if (!blockInfo.isBlockContainer) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
const selectionAtBlockStart = state.selection.from === blockInfo.blockContent.beforePos + 1;
|
|
75
|
-
if (!selectionAtBlockStart) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
const prevBlockInfo = getPrevBlockInfo(state.doc, blockInfo.bnBlock.beforePos);
|
|
79
|
-
if (prevBlockInfo) {
|
|
80
|
-
// should be no previous block
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
const parentBlockInfo = getParentBlockInfo(state.doc, blockInfo.bnBlock.beforePos);
|
|
84
|
-
if (parentBlockInfo?.blockNoteType !== "column") {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
const column = parentBlockInfo;
|
|
88
|
-
const columnList = getParentBlockInfo(state.doc, column.bnBlock.beforePos);
|
|
89
|
-
if (columnList?.blockNoteType !== "columnList") {
|
|
90
|
-
throw new Error("parent of column is not a column list");
|
|
91
|
-
}
|
|
92
|
-
const shouldRemoveColumn = column.childContainer.node.childCount === 1;
|
|
93
|
-
const shouldRemoveColumnList = shouldRemoveColumn &&
|
|
94
|
-
columnList.childContainer.node.childCount === 2;
|
|
95
|
-
const isFirstColumn = columnList.childContainer.node.firstChild ===
|
|
96
|
-
column.bnBlock.node;
|
|
97
|
-
if (dispatch) {
|
|
98
|
-
const blockToMove = state.doc.slice(blockInfo.bnBlock.beforePos, blockInfo.bnBlock.afterPos, false);
|
|
99
|
-
/*
|
|
100
|
-
There are 3 different cases:
|
|
101
|
-
a) remove entire column list (if no columns would be remaining)
|
|
102
|
-
b) remove just a column (if no blocks inside a column would be remaining)
|
|
103
|
-
c) keep columns (if there are blocks remaining inside a column)
|
|
104
|
-
|
|
105
|
-
Each of these 3 cases has 2 sub-cases, depending on whether the backspace happens at the start of the first (most-left) column,
|
|
106
|
-
or at the start of a non-first column.
|
|
107
|
-
*/
|
|
108
|
-
if (shouldRemoveColumnList) {
|
|
109
|
-
if (isFirstColumn) {
|
|
110
|
-
state.tr.step(new ReplaceAroundStep(
|
|
111
|
-
// replace entire column list
|
|
112
|
-
columnList.bnBlock.beforePos, columnList.bnBlock.afterPos,
|
|
113
|
-
// select content of remaining column:
|
|
114
|
-
column.bnBlock.afterPos + 1, columnList.bnBlock.afterPos - 2, blockToMove, blockToMove.size, // append existing content to blockToMove
|
|
115
|
-
false));
|
|
116
|
-
const pos = state.tr.doc.resolve(column.bnBlock.beforePos);
|
|
117
|
-
state.tr.setSelection(TextSelection.between(pos, pos));
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
// replaces the column list with the blockToMove slice, prepended with the content of the remaining column
|
|
121
|
-
state.tr.step(new ReplaceAroundStep(
|
|
122
|
-
// replace entire column list
|
|
123
|
-
columnList.bnBlock.beforePos, columnList.bnBlock.afterPos,
|
|
124
|
-
// select content of existing column:
|
|
125
|
-
columnList.bnBlock.beforePos + 2, column.bnBlock.beforePos - 1, blockToMove, 0, // prepend existing content to blockToMove
|
|
126
|
-
false));
|
|
127
|
-
const pos = state.tr.doc.resolve(state.tr.mapping.map(column.bnBlock.beforePos - 1));
|
|
128
|
-
state.tr.setSelection(TextSelection.between(pos, pos));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
else if (shouldRemoveColumn) {
|
|
132
|
-
if (isFirstColumn) {
|
|
133
|
-
// delete column
|
|
134
|
-
state.tr.delete(column.bnBlock.beforePos, column.bnBlock.afterPos);
|
|
135
|
-
// move before columnlist
|
|
136
|
-
state.tr.insert(columnList.bnBlock.beforePos, blockToMove.content);
|
|
137
|
-
const pos = state.tr.doc.resolve(columnList.bnBlock.beforePos);
|
|
138
|
-
state.tr.setSelection(TextSelection.between(pos, pos));
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
// just delete the </column><column> closing and opening tags to merge the columns
|
|
142
|
-
state.tr.delete(column.bnBlock.beforePos - 1, column.bnBlock.beforePos + 1);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
// delete block
|
|
147
|
-
state.tr.delete(blockInfo.bnBlock.beforePos, blockInfo.bnBlock.afterPos);
|
|
148
|
-
if (isFirstColumn) {
|
|
149
|
-
// move before columnlist
|
|
150
|
-
state.tr.insert(columnList.bnBlock.beforePos - 1, blockToMove.content);
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
// append block to previous column
|
|
154
|
-
state.tr.insert(column.bnBlock.beforePos - 1, blockToMove.content);
|
|
155
|
-
}
|
|
156
|
-
const pos = state.tr.doc.resolve(column.bnBlock.beforePos - 1);
|
|
157
|
-
state.tr.setSelection(TextSelection.between(pos, pos));
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return true;
|
|
161
|
-
}),
|
|
162
|
-
// Deletes previous block if it contains no content and isn't a table,
|
|
163
|
-
// when the selection is empty and at the start of the block. Moves the
|
|
164
|
-
// current block into the deleted block's place.
|
|
165
|
-
() => commands.command(({ state }) => {
|
|
166
|
-
const blockInfo = getBlockInfoFromSelection(state);
|
|
167
|
-
if (!blockInfo.isBlockContainer) {
|
|
168
|
-
// TODO
|
|
169
|
-
throw new Error(`todo`);
|
|
170
|
-
}
|
|
171
|
-
const selectionAtBlockStart = state.selection.from === blockInfo.blockContent.beforePos + 1;
|
|
172
|
-
const selectionEmpty = state.selection.empty;
|
|
173
|
-
const prevBlockInfo = getPrevBlockInfo(state.doc, blockInfo.bnBlock.beforePos);
|
|
174
|
-
if (prevBlockInfo && selectionAtBlockStart && selectionEmpty) {
|
|
175
|
-
const bottomBlock = getBottomNestedBlockInfo(state.doc, prevBlockInfo);
|
|
176
|
-
if (!bottomBlock.isBlockContainer) {
|
|
177
|
-
// TODO
|
|
178
|
-
throw new Error(`todo`);
|
|
179
|
-
}
|
|
180
|
-
const prevBlockNotTableAndNoContent = bottomBlock.blockContent.node.type.spec.content === "" ||
|
|
181
|
-
(bottomBlock.blockContent.node.type.spec.content ===
|
|
182
|
-
"inline*" &&
|
|
183
|
-
bottomBlock.blockContent.node.childCount === 0);
|
|
184
|
-
if (prevBlockNotTableAndNoContent) {
|
|
185
|
-
return chain()
|
|
186
|
-
.cut({
|
|
187
|
-
from: blockInfo.bnBlock.beforePos,
|
|
188
|
-
to: blockInfo.bnBlock.afterPos,
|
|
189
|
-
}, bottomBlock.bnBlock.afterPos)
|
|
190
|
-
.deleteRange({
|
|
191
|
-
from: bottomBlock.bnBlock.beforePos,
|
|
192
|
-
to: bottomBlock.bnBlock.afterPos,
|
|
193
|
-
})
|
|
194
|
-
.run();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return false;
|
|
198
|
-
}),
|
|
199
|
-
]);
|
|
200
|
-
const handleDelete = () => this.editor.commands.first(({ commands }) => [
|
|
201
|
-
// Deletes the selection if it's not empty.
|
|
202
|
-
() => commands.deleteSelection(),
|
|
203
|
-
// Merges block with the next one (at the same nesting level or lower),
|
|
204
|
-
// if one exists, the block has no children, and the selection is at the
|
|
205
|
-
// end of the block.
|
|
206
|
-
() => commands.command(({ state }) => {
|
|
207
|
-
// TODO: Change this to not rely on offsets & schema assumptions
|
|
208
|
-
const blockInfo = getBlockInfoFromSelection(state);
|
|
209
|
-
if (!blockInfo.isBlockContainer) {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
const { bnBlock: blockContainer, blockContent, childContainer, } = blockInfo;
|
|
213
|
-
const { depth } = state.doc.resolve(blockContainer.beforePos);
|
|
214
|
-
const blockAtDocEnd = blockContainer.afterPos === state.doc.nodeSize - 3;
|
|
215
|
-
const selectionAtBlockEnd = state.selection.from === blockContent.afterPos - 1;
|
|
216
|
-
const selectionEmpty = state.selection.empty;
|
|
217
|
-
const hasChildBlocks = childContainer !== undefined;
|
|
218
|
-
if (!blockAtDocEnd &&
|
|
219
|
-
selectionAtBlockEnd &&
|
|
220
|
-
selectionEmpty &&
|
|
221
|
-
!hasChildBlocks) {
|
|
222
|
-
let oldDepth = depth;
|
|
223
|
-
let newPos = blockContainer.afterPos + 1;
|
|
224
|
-
let newDepth = state.doc.resolve(newPos).depth;
|
|
225
|
-
while (newDepth < oldDepth) {
|
|
226
|
-
oldDepth = newDepth;
|
|
227
|
-
newPos += 2;
|
|
228
|
-
newDepth = state.doc.resolve(newPos).depth;
|
|
229
|
-
}
|
|
230
|
-
return commands.command(mergeBlocksCommand(newPos - 1));
|
|
231
|
-
}
|
|
232
|
-
return false;
|
|
233
|
-
}),
|
|
234
|
-
]);
|
|
235
|
-
const handleEnter = () => this.editor.commands.first(({ commands }) => [
|
|
236
|
-
// Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
|
|
237
|
-
// of the block.
|
|
238
|
-
() => commands.command(({ state }) => {
|
|
239
|
-
const blockInfo = getBlockInfoFromSelection(state);
|
|
240
|
-
if (!blockInfo.isBlockContainer) {
|
|
241
|
-
return false;
|
|
242
|
-
}
|
|
243
|
-
const { bnBlock: blockContainer, blockContent } = blockInfo;
|
|
244
|
-
const { depth } = state.doc.resolve(blockContainer.beforePos);
|
|
245
|
-
const selectionAtBlockStart = state.selection.$anchor.parentOffset === 0;
|
|
246
|
-
const selectionEmpty = state.selection.anchor === state.selection.head;
|
|
247
|
-
const blockEmpty = blockContent.node.childCount === 0;
|
|
248
|
-
const blockIndented = depth > 1;
|
|
249
|
-
if (selectionAtBlockStart &&
|
|
250
|
-
selectionEmpty &&
|
|
251
|
-
blockEmpty &&
|
|
252
|
-
blockIndented) {
|
|
253
|
-
return commands.liftListItem("blockContainer");
|
|
254
|
-
}
|
|
255
|
-
return false;
|
|
256
|
-
}),
|
|
257
|
-
// Creates a new block and moves the selection to it if the current one is empty, while the selection is also
|
|
258
|
-
// empty & at the start of the block.
|
|
259
|
-
() => commands.command(({ state, dispatch }) => {
|
|
260
|
-
const blockInfo = getBlockInfoFromSelection(state);
|
|
261
|
-
if (!blockInfo.isBlockContainer) {
|
|
262
|
-
return false;
|
|
263
|
-
}
|
|
264
|
-
const { bnBlock: blockContainer, blockContent } = blockInfo;
|
|
265
|
-
const selectionAtBlockStart = state.selection.$anchor.parentOffset === 0;
|
|
266
|
-
const selectionEmpty = state.selection.anchor === state.selection.head;
|
|
267
|
-
const blockEmpty = blockContent.node.childCount === 0;
|
|
268
|
-
if (selectionAtBlockStart && selectionEmpty && blockEmpty) {
|
|
269
|
-
const newBlockInsertionPos = blockContainer.afterPos;
|
|
270
|
-
const newBlockContentPos = newBlockInsertionPos + 2;
|
|
271
|
-
if (dispatch) {
|
|
272
|
-
const newBlock = state.schema.nodes["blockContainer"].createAndFill();
|
|
273
|
-
state.tr
|
|
274
|
-
.insert(newBlockInsertionPos, newBlock)
|
|
275
|
-
.scrollIntoView();
|
|
276
|
-
state.tr.setSelection(new TextSelection(state.doc.resolve(newBlockContentPos)));
|
|
277
|
-
}
|
|
278
|
-
return true;
|
|
279
|
-
}
|
|
280
|
-
return false;
|
|
281
|
-
}),
|
|
282
|
-
// Splits the current block, moving content inside that's after the cursor to a new text block below. Also
|
|
283
|
-
// deletes the selection beforehand, if it's not empty.
|
|
284
|
-
() => commands.command(({ state, chain }) => {
|
|
285
|
-
const blockInfo = getBlockInfoFromSelection(state);
|
|
286
|
-
if (!blockInfo.isBlockContainer) {
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
const { blockContent } = blockInfo;
|
|
290
|
-
const selectionAtBlockStart = state.selection.$anchor.parentOffset === 0;
|
|
291
|
-
const blockEmpty = blockContent.node.childCount === 0;
|
|
292
|
-
if (!blockEmpty) {
|
|
293
|
-
chain()
|
|
294
|
-
.deleteSelection()
|
|
295
|
-
.command(splitBlockCommand(state.selection.from, selectionAtBlockStart, selectionAtBlockStart))
|
|
296
|
-
.run();
|
|
297
|
-
return true;
|
|
298
|
-
}
|
|
299
|
-
return false;
|
|
300
|
-
}),
|
|
301
|
-
]);
|
|
302
|
-
return {
|
|
303
|
-
Backspace: handleBackspace,
|
|
304
|
-
Delete: handleDelete,
|
|
305
|
-
Enter: handleEnter,
|
|
306
|
-
// Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
|
|
307
|
-
// editor since the browser will try to use tab for keyboard navigation.
|
|
308
|
-
Tab: () => {
|
|
309
|
-
if (this.options.tabBehavior !== "prefer-indent" &&
|
|
310
|
-
(this.options.editor.formattingToolbar?.shown ||
|
|
311
|
-
this.options.editor.linkToolbar?.shown ||
|
|
312
|
-
this.options.editor.filePanel?.shown)) {
|
|
313
|
-
// don't handle tabs if a toolbar is shown, so we can tab into / out of it
|
|
314
|
-
return false;
|
|
315
|
-
}
|
|
316
|
-
return nestBlock(this.options.editor);
|
|
317
|
-
// return true;
|
|
318
|
-
},
|
|
319
|
-
"Shift-Tab": () => {
|
|
320
|
-
if (this.options.tabBehavior !== "prefer-indent" &&
|
|
321
|
-
(this.options.editor.formattingToolbar?.shown ||
|
|
322
|
-
this.options.editor.linkToolbar?.shown ||
|
|
323
|
-
this.options.editor.filePanel?.shown)) {
|
|
324
|
-
// don't handle tabs if a toolbar is shown, so we can tab into / out of it
|
|
325
|
-
return false;
|
|
326
|
-
}
|
|
327
|
-
this.editor.commands.liftListItem("blockContainer");
|
|
328
|
-
return true;
|
|
329
|
-
},
|
|
330
|
-
"Shift-Mod-ArrowUp": () => {
|
|
331
|
-
this.options.editor.moveBlocksUp();
|
|
332
|
-
return true;
|
|
333
|
-
},
|
|
334
|
-
"Shift-Mod-ArrowDown": () => {
|
|
335
|
-
this.options.editor.moveBlocksDown();
|
|
336
|
-
return true;
|
|
337
|
-
},
|
|
338
|
-
};
|
|
339
|
-
},
|
|
340
|
-
});
|
|
341
|
-
//# sourceMappingURL=KeyboardShortcutsExtension.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardShortcutsExtension.js","sourceRoot":"","sources":["../../../../src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,iEAAiE,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,6DAA6D,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+DAA+D,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAE,MAAM,iEAAiE,CAAC;AACrG,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAG7E,MAAM,CAAC,MAAM,0BAA0B,GAAG,SAA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AM,CAAC,WAAW,EAAE,KAAK;wBACtC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,EACvC,CAAC;oBACD,0EAA0E;oBAC1E,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,OAAO,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACtC,eAAe;YACjB,CAAC;YACD,WAAW,EAAE,GAAG,EAAE;gBAChB,IACE,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,eAAe;oBAC5C,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,KAAK;wBAC3C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK;wBACtC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,EACvC,CAAC;oBACD,0EAA0E;oBAC1E,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;gBACpD,OAAO,IAAI,CAAC;YACd,CAAC;YACD,mBAAmB,EAAE,GAAG,EAAE;gBACxB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;gBACnC,OAAO,IAAI,CAAC;YACd,CAAC;YACD,qBAAqB,EAAE,GAAG,EAAE;gBAC1B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;gBACrC,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { getMarkRange, posToDOMRect } from "@tiptap/core";
|
|
2
|
-
import { Plugin, PluginKey } from "prosemirror-state";
|
|
3
|
-
import { EventEmitter } from "../../util/EventEmitter.js";
|
|
4
|
-
class LinkToolbarView {
|
|
5
|
-
editor;
|
|
6
|
-
pmView;
|
|
7
|
-
state;
|
|
8
|
-
emitUpdate;
|
|
9
|
-
menuUpdateTimer;
|
|
10
|
-
startMenuUpdateTimer;
|
|
11
|
-
stopMenuUpdateTimer;
|
|
12
|
-
mouseHoveredLinkMark;
|
|
13
|
-
mouseHoveredLinkMarkRange;
|
|
14
|
-
keyboardHoveredLinkMark;
|
|
15
|
-
keyboardHoveredLinkMarkRange;
|
|
16
|
-
linkMark;
|
|
17
|
-
linkMarkRange;
|
|
18
|
-
constructor(editor, pmView, emitUpdate) {
|
|
19
|
-
this.editor = editor;
|
|
20
|
-
this.pmView = pmView;
|
|
21
|
-
this.emitUpdate = () => {
|
|
22
|
-
if (!this.state) {
|
|
23
|
-
throw new Error("Attempting to update uninitialized link toolbar");
|
|
24
|
-
}
|
|
25
|
-
emitUpdate(this.state);
|
|
26
|
-
};
|
|
27
|
-
this.startMenuUpdateTimer = () => {
|
|
28
|
-
this.menuUpdateTimer = setTimeout(() => {
|
|
29
|
-
this.update(this.pmView);
|
|
30
|
-
}, 250);
|
|
31
|
-
};
|
|
32
|
-
this.stopMenuUpdateTimer = () => {
|
|
33
|
-
if (this.menuUpdateTimer) {
|
|
34
|
-
clearTimeout(this.menuUpdateTimer);
|
|
35
|
-
this.menuUpdateTimer = undefined;
|
|
36
|
-
}
|
|
37
|
-
return false;
|
|
38
|
-
};
|
|
39
|
-
this.pmView.dom.addEventListener("mouseover", this.mouseOverHandler);
|
|
40
|
-
this.pmView.root.addEventListener("click", this.clickHandler, true);
|
|
41
|
-
// Setting capture=true ensures that any parent container of the editor that
|
|
42
|
-
// gets scrolled will trigger the scroll event. Scroll events do not bubble
|
|
43
|
-
// and so won't propagate to the document by default.
|
|
44
|
-
this.pmView.root.addEventListener("scroll", this.scrollHandler, true);
|
|
45
|
-
}
|
|
46
|
-
mouseOverHandler = (event) => {
|
|
47
|
-
// Resets the link mark currently hovered by the mouse cursor.
|
|
48
|
-
this.mouseHoveredLinkMark = undefined;
|
|
49
|
-
this.mouseHoveredLinkMarkRange = undefined;
|
|
50
|
-
this.stopMenuUpdateTimer();
|
|
51
|
-
if (event.target instanceof HTMLAnchorElement &&
|
|
52
|
-
event.target.nodeName === "A") {
|
|
53
|
-
// Finds link mark at the hovered element's position to update mouseHoveredLinkMark and
|
|
54
|
-
// mouseHoveredLinkMarkRange.
|
|
55
|
-
const hoveredLinkElement = event.target;
|
|
56
|
-
const posInHoveredLinkMark = this.pmView.posAtDOM(hoveredLinkElement, 0) + 1;
|
|
57
|
-
const resolvedPosInHoveredLinkMark = this.pmView.state.doc.resolve(posInHoveredLinkMark);
|
|
58
|
-
const marksAtPos = resolvedPosInHoveredLinkMark.marks();
|
|
59
|
-
for (const mark of marksAtPos) {
|
|
60
|
-
if (mark.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
61
|
-
this.mouseHoveredLinkMark = mark;
|
|
62
|
-
this.mouseHoveredLinkMarkRange =
|
|
63
|
-
getMarkRange(resolvedPosInHoveredLinkMark, mark.type, mark.attrs) ||
|
|
64
|
-
undefined;
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
this.startMenuUpdateTimer();
|
|
70
|
-
return false;
|
|
71
|
-
};
|
|
72
|
-
clickHandler = (event) => {
|
|
73
|
-
const editorWrapper = this.pmView.dom.parentElement;
|
|
74
|
-
if (
|
|
75
|
-
// Toolbar is open.
|
|
76
|
-
this.linkMark &&
|
|
77
|
-
// An element is clicked.
|
|
78
|
-
event &&
|
|
79
|
-
event.target &&
|
|
80
|
-
// The clicked element is not the editor.
|
|
81
|
-
!(editorWrapper === event.target ||
|
|
82
|
-
editorWrapper.contains(event.target))) {
|
|
83
|
-
if (this.state?.show) {
|
|
84
|
-
this.state.show = false;
|
|
85
|
-
this.emitUpdate();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
scrollHandler = () => {
|
|
90
|
-
if (this.linkMark !== undefined) {
|
|
91
|
-
if (this.state?.show) {
|
|
92
|
-
this.state.referencePos = posToDOMRect(this.pmView, this.linkMarkRange.from, this.linkMarkRange.to);
|
|
93
|
-
this.emitUpdate();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
editLink(url, text) {
|
|
98
|
-
const tr = this.pmView.state.tr.insertText(text, this.linkMarkRange.from, this.linkMarkRange.to);
|
|
99
|
-
tr.addMark(this.linkMarkRange.from, this.linkMarkRange.from + text.length, this.pmView.state.schema.mark("link", { href: url }));
|
|
100
|
-
this.editor.dispatch(tr);
|
|
101
|
-
this.pmView.focus();
|
|
102
|
-
if (this.state?.show) {
|
|
103
|
-
this.state.show = false;
|
|
104
|
-
this.emitUpdate();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
deleteLink() {
|
|
108
|
-
this.editor.dispatch(this.pmView.state.tr
|
|
109
|
-
.removeMark(this.linkMarkRange.from, this.linkMarkRange.to, this.linkMark.type)
|
|
110
|
-
.setMeta("preventAutolink", true));
|
|
111
|
-
this.pmView.focus();
|
|
112
|
-
if (this.state?.show) {
|
|
113
|
-
this.state.show = false;
|
|
114
|
-
this.emitUpdate();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
update(view, oldState) {
|
|
118
|
-
const { state } = view;
|
|
119
|
-
const isSame = oldState &&
|
|
120
|
-
oldState.selection.from === state.selection.from &&
|
|
121
|
-
oldState.selection.to === state.selection.to;
|
|
122
|
-
if (isSame || !this.pmView.hasFocus()) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
// Saves the currently hovered link mark before it's updated.
|
|
126
|
-
const prevLinkMark = this.linkMark;
|
|
127
|
-
// Resets the currently hovered link mark.
|
|
128
|
-
this.linkMark = undefined;
|
|
129
|
-
this.linkMarkRange = undefined;
|
|
130
|
-
// Resets the link mark currently hovered by the keyboard cursor.
|
|
131
|
-
this.keyboardHoveredLinkMark = undefined;
|
|
132
|
-
this.keyboardHoveredLinkMarkRange = undefined;
|
|
133
|
-
// Finds link mark at the editor selection's position to update keyboardHoveredLinkMark and
|
|
134
|
-
// keyboardHoveredLinkMarkRange.
|
|
135
|
-
if (this.pmView.state.selection.empty) {
|
|
136
|
-
const marksAtPos = this.pmView.state.selection.$from.marks();
|
|
137
|
-
for (const mark of marksAtPos) {
|
|
138
|
-
if (mark.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
139
|
-
this.keyboardHoveredLinkMark = mark;
|
|
140
|
-
this.keyboardHoveredLinkMarkRange =
|
|
141
|
-
getMarkRange(this.pmView.state.selection.$from, mark.type, mark.attrs) || undefined;
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (this.mouseHoveredLinkMark) {
|
|
147
|
-
this.linkMark = this.mouseHoveredLinkMark;
|
|
148
|
-
this.linkMarkRange = this.mouseHoveredLinkMarkRange;
|
|
149
|
-
}
|
|
150
|
-
// Keyboard cursor position takes precedence over mouse hovered link.
|
|
151
|
-
if (this.keyboardHoveredLinkMark) {
|
|
152
|
-
this.linkMark = this.keyboardHoveredLinkMark;
|
|
153
|
-
this.linkMarkRange = this.keyboardHoveredLinkMarkRange;
|
|
154
|
-
}
|
|
155
|
-
if (this.linkMark && this.editor.isEditable) {
|
|
156
|
-
this.state = {
|
|
157
|
-
show: true,
|
|
158
|
-
referencePos: posToDOMRect(this.pmView, this.linkMarkRange.from, this.linkMarkRange.to),
|
|
159
|
-
url: this.linkMark.attrs.href,
|
|
160
|
-
text: this.pmView.state.doc.textBetween(this.linkMarkRange.from, this.linkMarkRange.to),
|
|
161
|
-
};
|
|
162
|
-
this.emitUpdate();
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
// Hides menu.
|
|
166
|
-
if (this.state?.show &&
|
|
167
|
-
prevLinkMark &&
|
|
168
|
-
(!this.linkMark || !this.editor.isEditable)) {
|
|
169
|
-
this.state.show = false;
|
|
170
|
-
this.emitUpdate();
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
closeMenu = () => {
|
|
175
|
-
if (this.state?.show) {
|
|
176
|
-
this.state.show = false;
|
|
177
|
-
this.emitUpdate();
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
destroy() {
|
|
181
|
-
this.pmView.dom.removeEventListener("mouseover", this.mouseOverHandler);
|
|
182
|
-
this.pmView.root.removeEventListener("scroll", this.scrollHandler, true);
|
|
183
|
-
this.pmView.root.removeEventListener("click", this.clickHandler, true);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
export const linkToolbarPluginKey = new PluginKey("LinkToolbarPlugin");
|
|
187
|
-
export class LinkToolbarProsemirrorPlugin extends EventEmitter {
|
|
188
|
-
view;
|
|
189
|
-
plugin;
|
|
190
|
-
constructor(editor) {
|
|
191
|
-
super();
|
|
192
|
-
this.plugin = new Plugin({
|
|
193
|
-
key: linkToolbarPluginKey,
|
|
194
|
-
view: (editorView) => {
|
|
195
|
-
this.view = new LinkToolbarView(editor, editorView, (state) => {
|
|
196
|
-
this.emit("update", state);
|
|
197
|
-
});
|
|
198
|
-
return this.view;
|
|
199
|
-
},
|
|
200
|
-
props: {
|
|
201
|
-
handleKeyDown: (_view, event) => {
|
|
202
|
-
if (event.key === "Escape" && this.shown) {
|
|
203
|
-
this.view.closeMenu();
|
|
204
|
-
return true;
|
|
205
|
-
}
|
|
206
|
-
return false;
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
onUpdate(callback) {
|
|
212
|
-
return this.on("update", callback);
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Edit the currently hovered link.
|
|
216
|
-
*/
|
|
217
|
-
editLink = (url, text) => {
|
|
218
|
-
this.view.editLink(url, text);
|
|
219
|
-
};
|
|
220
|
-
/**
|
|
221
|
-
* Delete the currently hovered link.
|
|
222
|
-
*/
|
|
223
|
-
deleteLink = () => {
|
|
224
|
-
this.view.deleteLink();
|
|
225
|
-
};
|
|
226
|
-
/**
|
|
227
|
-
* When hovering on/off links using the mouse cursor, the link toolbar will
|
|
228
|
-
* open & close with a delay.
|
|
229
|
-
*
|
|
230
|
-
* This function starts the delay timer, and should be used for when the mouse
|
|
231
|
-
* cursor enters the link toolbar.
|
|
232
|
-
*/
|
|
233
|
-
startHideTimer = () => {
|
|
234
|
-
this.view.startMenuUpdateTimer();
|
|
235
|
-
};
|
|
236
|
-
/**
|
|
237
|
-
* When hovering on/off links using the mouse cursor, the link toolbar will
|
|
238
|
-
* open & close with a delay.
|
|
239
|
-
*
|
|
240
|
-
* This function stops the delay timer, and should be used for when the mouse
|
|
241
|
-
* cursor exits the link toolbar.
|
|
242
|
-
*/
|
|
243
|
-
stopHideTimer = () => {
|
|
244
|
-
this.view.stopMenuUpdateTimer();
|
|
245
|
-
};
|
|
246
|
-
get shown() {
|
|
247
|
-
return this.view?.state?.show || false;
|
|
248
|
-
}
|
|
249
|
-
closeMenu = () => this.view.closeMenu();
|
|
250
|
-
}
|
|
251
|
-
//# sourceMappingURL=LinkToolbarPlugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LinkToolbarPlugin.js","sourceRoot":"","sources":["../../../../src/extensions/LinkToolbar/LinkToolbarPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAS,MAAM,cAAc,CAAC;AAIjE,OAAO,EAAe,MAAM,EAAE,SAAS,EAAc,MAAM,mBAAmB,CAAC;AAS/E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAS1D,MAAM,eAAe;IAkBA;IACA;IAlBZ,KAAK,CAAoB;IACzB,UAAU,CAAa;IAE9B,eAAe,CAA4C;IAC3D,oBAAoB,CAAa;IACjC,mBAAmB,CAAa;IAEhC,oBAAoB,CAAmB;IACvC,yBAAyB,CAAoB;IAE7C,uBAAuB,CAAmB;IAC1C,4BAA4B,CAAoB;IAEhD,QAAQ,CAAmB;IAC3B,aAAa,CAAoB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