@ctzhian/tiptap 3.0.0 → 3.0.2
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/{app/editor/Editor → Editor}/demo.d.ts +1 -1
- package/dist/{app/editor/Editor → Editor}/demo.js +2 -5
- package/dist/{app/editor/Editor → Editor}/index.d.ts +1 -1
- package/dist/{app/editor/Editor → Editor}/index.js +9 -10
- package/dist/{app/editor/EditorDiff → EditorDiff}/demo.d.ts +1 -1
- package/dist/{app/editor/EditorDiff → EditorDiff}/demo.js +2 -3
- package/dist/{app/editor/EditorDiff → EditorDiff}/index.js +2 -2
- package/dist/{features/markdown → EditorMarkdown}/Toolbar.d.ts +1 -2
- package/dist/EditorMarkdown/Toolbar.js +942 -0
- package/dist/{app/editor/EditorMarkdown → EditorMarkdown}/demo.d.ts +1 -1
- package/dist/{app/editor/EditorMarkdown → EditorMarkdown}/demo.js +2 -4
- package/dist/{features/markdown → EditorMarkdown}/index.d.ts +3 -3
- package/dist/EditorMarkdown/index.js +566 -0
- package/dist/{app/editor/EditorThemeProvider → EditorThemeProvider}/index.d.ts +1 -1
- package/dist/{app/editor/EditorThemeProvider → EditorThemeProvider}/index.js +2 -2
- package/dist/{features/toolbar → EditorToolbar}/index.d.ts +1 -1
- package/dist/EditorToolbar/index.js +361 -0
- package/dist/{components → component}/ActionDropdown/index.d.ts +1 -1
- package/dist/{components → component}/ActionDropdown/index.js +37 -23
- package/dist/{components → component}/CustomBubbleMenu/index.d.ts +1 -1
- package/dist/{components → component}/CustomBubbleMenu/index.js +3 -4
- package/dist/{features/drag-handle → component/CustomDragHandle}/index.d.ts +1 -1
- package/dist/component/CustomDragHandle/index.js +1372 -0
- package/dist/component/FloatingPopover/index.js +120 -0
- package/dist/component/HoverPopover/index.js +162 -0
- package/dist/{components → component}/Menu/NestedList.d.ts +1 -1
- package/dist/{components → component}/Menu/NestedList.js +41 -19
- package/dist/{components → component}/Menu/index.d.ts +1 -1
- package/dist/{components → component}/Menu/index.js +21 -13
- package/dist/component/Toolbar/EditorAlignSelect.js +187 -0
- package/dist/component/Toolbar/EditorCode.js +161 -0
- package/dist/{components → component}/Toolbar/EditorHeading.js +1 -1
- package/dist/component/Toolbar/EditorInsert/index.js +491 -0
- package/dist/component/Toolbar/EditorListSelect.js +174 -0
- package/dist/{components/Toolbar/CommandSelect.js → component/Toolbar/EditorMath.js} +84 -54
- package/dist/{components → component}/Toolbar/EditorMore/NotificationDialog.js +2 -2
- package/dist/{components → component}/Toolbar/EditorMore/index.d.ts +1 -1
- package/dist/{components → component}/Toolbar/EditorMore/index.js +11 -6
- package/dist/component/Toolbar/EditorScript.js +161 -0
- package/dist/component/Toolbar/EditorVerticalAlignSelect.js +174 -0
- package/dist/{components → component}/Toolbar/Item.js +1 -1
- package/dist/{components → component}/Toolbar/TableSizePicker.js +1 -1
- package/dist/{components → component}/Toolbar/index.d.ts +0 -1
- package/dist/{components → component}/Toolbar/index.js +0 -1
- package/dist/{constants → contants}/enums.d.ts +0 -2
- package/dist/{constants → contants}/enums.js +5 -19
- package/dist/{constants → contants}/slash-commands.js +1 -1
- package/dist/{editor-core/extensions → extension}/component/Alert/index.js +3 -3
- package/dist/{editor-core/extensions → extension}/component/Attachment/AttachmentContent.js +2 -2
- package/dist/{editor-core/extensions → extension}/component/Attachment/Insert.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/component/Attachment/Insert.js +58 -50
- package/dist/{editor-core/extensions → extension}/component/Attachment/index.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/component/Attachment/index.js +28 -20
- package/dist/{editor-core/extensions → extension}/component/Audio/AudioPlayer.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/component/Audio/AudioPlayer.js +4 -13
- package/dist/{editor-core/extensions → extension}/component/Audio/Insert.d.ts +2 -2
- package/dist/{editor-core/extensions → extension}/component/Audio/Insert.js +249 -85
- package/dist/extension/component/Audio/index.d.ts +14 -0
- package/dist/{editor-core/extensions → extension}/component/Audio/index.js +208 -111
- package/dist/{editor-core/extensions/component/CodeBlock/shared.js → extension/component/CodeBlock/Readonly.js} +134 -42
- package/dist/extension/component/CodeBlock/index.js +374 -0
- package/dist/{editor-core/extensions → extension}/component/DrawPanel/index.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/component/DrawPanel/index.js +2 -2
- package/dist/{editor-core/extensions → extension}/component/FlipGrid/ColumnView.js +3 -3
- package/dist/{editor-core/extensions → extension}/component/Flow/Edit.js +1 -1
- package/dist/{editor-core/extensions → extension}/component/Flow/Insert.js +2 -2
- package/dist/{editor-core/extensions → extension}/component/Flow/index.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/component/Flow/index.js +4 -4
- package/dist/{features/media/iframe → extension/component/Iframe}/Insert.d.ts +1 -1
- package/dist/{features/media/iframe → extension/component/Iframe}/Insert.js +52 -21
- package/dist/{features/media/iframe → extension/component/Iframe}/index.d.ts +1 -1
- package/dist/{features/media/iframe → extension/component/Iframe}/index.js +393 -97
- package/dist/{features/media/image → extension/component/Image}/Crop.d.ts +1 -1
- package/dist/{features/media/image → extension/component/Image}/Insert.d.ts +1 -1
- package/dist/{features/media/image → extension/component/Image}/Insert.js +107 -35
- package/dist/{features/media/image → extension/component/Image}/Readonly.js +1 -1
- package/dist/{features/media/image → extension/component/Image}/index.d.ts +1 -1
- package/dist/{features/media/image → extension/component/Image}/index.js +296 -102
- package/dist/{editor-core/extensions → extension}/component/Link/Insert.d.ts +1 -1
- package/dist/extension/component/Link/Insert.js +252 -0
- package/dist/{editor-core/extensions → extension}/component/Link/LinkContent.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/component/Link/LinkContent.js +9 -6
- package/dist/{editor-core/extensions → extension}/component/Link/Markdown.js +1 -1
- package/dist/{editor-core/extensions → extension}/component/Link/index.d.ts +8 -0
- package/dist/{editor-core/extensions → extension}/component/Link/index.js +124 -72
- package/dist/{editor-core/extensions → extension}/component/Mathematics/block/Readonly.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/component/Mathematics/block/index.d.ts +4 -3
- package/dist/{editor-core/extensions → extension}/component/Mathematics/block/index.js +39 -18
- package/dist/{editor-core/extensions → extension}/component/Mathematics/inline/Readonly.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/component/Mathematics/inline/index.d.ts +4 -3
- package/dist/{editor-core/extensions → extension}/component/Mathematics/inline/index.js +40 -17
- package/dist/{editor-core/extensions → extension}/component/SlashCommandsList/Overlay.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/component/SlashCommandsList/Overlay.js +1 -1
- package/dist/{editor-core/extensions → extension}/component/SlashCommandsList/index.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/component/SlashCommandsList/index.js +5 -5
- package/dist/extension/component/TableCellHandleMenu/index.js +512 -0
- package/dist/{features/table → extension/component}/TableExtendButton/index.d.ts +1 -1
- package/dist/{features/table → extension/component}/TableExtendButton/index.js +2 -2
- package/dist/{features/table → extension/component}/TableHandle/TableHandleAddButton.d.ts +1 -1
- package/dist/{features/table → extension/component}/TableHandle/TableHandleAddButton.js +2 -2
- package/dist/{features/table → extension/component}/TableHandle/TableHandleMenu.d.ts +1 -1
- package/dist/{features/table → extension/component}/TableHandle/TableHandleMenu.js +265 -48
- package/dist/{features/table → extension/component}/TableHandle/index.d.ts +12 -0
- package/dist/extension/component/TableHandle/index.js +140 -0
- package/dist/{features/table → extension/component}/TableHandle/use-table-handle-positioning.js +1 -1
- package/dist/{features/table → extension/component}/TableHandle/use-table-handle-state.d.ts +1 -1
- package/dist/{features/table → extension/component}/TableSelectionOverlay/index.js +1 -1
- package/dist/{editor-core/extensions → extension}/component/Tooltip/EditPopover.js +22 -12
- package/dist/{editor-core/extensions → extension}/component/Tooltip/index.js +1 -1
- package/dist/{editor-core/extensions → extension}/component/UploadProgress/Inline.d.ts +1 -2
- package/dist/{editor-core/extensions/component/UploadProgress/shared.js → extension/component/UploadProgress/Inline.js} +50 -39
- package/dist/{editor-core/extensions → extension}/component/UploadProgress/index.d.ts +3 -2
- package/dist/extension/component/UploadProgress/index.js +111 -0
- package/dist/{features/media/video → extension/component/Video}/Insert.d.ts +1 -1
- package/dist/{features/media/video → extension/component/Video}/Insert.js +111 -35
- package/dist/{features/media/video → extension/component/Video}/index.d.ts +1 -1
- package/dist/{features/media/video → extension/component/Video}/index.js +379 -86
- package/dist/extension/extension/ImeComposition.d.ts +2 -0
- package/dist/{editor-core/extensions → extension}/extension/ImeComposition.js +23 -10
- package/dist/{editor-core/extensions → extension}/extension/StructuredDiff.js +2 -1
- package/dist/extension/index.d.ts +2 -0
- package/dist/{editor-core/extensions/builders.js → extension/index.js} +92 -126
- package/dist/{editor-core/extensions → extension}/node/Attachment.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/node/Attachment.js +3 -15
- package/dist/{editor-core/extensions → extension}/node/Audio.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/node/Audio.js +19 -11
- package/dist/{editor-core/extensions → extension}/node/CodeBlockLowlight.js +33 -6
- package/dist/{editor-core/extensions → extension}/node/DrawPanel.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/node/FileHandler.d.ts +2 -2
- package/dist/{editor-core/extensions → extension}/node/FileHandler.js +2 -2
- package/dist/{editor-core/extensions → extension}/node/Flow/index.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/node/Iframe.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/node/Iframe.js +1 -1
- package/dist/{editor-core/extensions → extension}/node/Image.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/node/Image.js +2 -2
- package/dist/{editor-core/extensions → extension}/node/Link/index.js +5 -11
- package/dist/extension/node/ListKit.js +23 -0
- package/dist/{editor-core/extensions → extension}/node/Mathematics.d.ts +1 -1
- package/dist/extension/node/Mathematics.js +97 -0
- package/dist/{editor-core/extensions → extension}/node/Mention.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/node/Table.js +1 -1
- package/dist/{features/table/plugin → extension/node/TableHandler}/index.d.ts +1 -3
- package/dist/{features/table/plugin → extension/node/TableHandler}/index.js +2 -5
- package/dist/{features/table/plugin/shared.d.ts → extension/node/TableHandler/plugin.d.ts} +16 -8
- package/dist/extension/node/TableHandler/plugin.js +1083 -0
- package/dist/{editor-core/extensions → extension}/node/TableOfContents/index.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/node/TableOfContents/index.js +1 -1
- package/dist/{editor-core/extensions → extension}/node/TableOfContents/plugin.js +3 -2
- package/dist/{editor-core/extensions → extension}/node/Video.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/node/Video.js +2 -2
- package/dist/{editor-core/extensions → extension}/suggestion/mention.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/suggestion/mention.js +1 -1
- package/dist/{editor-core/extensions → extension}/suggestion/slash.d.ts +1 -1
- package/dist/{editor-core/extensions → extension}/suggestion/slash.js +1 -1
- package/dist/{hooks → hook}/fn.d.ts +1 -1
- package/dist/{hooks → hook}/fn.js +1 -1
- package/dist/{hooks → hook}/index.d.ts +1 -1
- package/dist/{hooks → hook}/index.js +13 -23
- package/dist/index.d.ts +10 -10
- package/dist/index.js +10 -10
- package/dist/themes/componentStyleOverrides.js +1 -1
- package/dist/themes/index.d.ts +1 -1
- package/dist/{utils → util}/fileHandler.d.ts +2 -2
- package/dist/util/fileHandler.js +82 -0
- package/dist/util/index.d.ts +35 -0
- package/dist/util/index.js +165 -0
- package/dist/{utils → util}/resourceExtractor.d.ts +1 -1
- package/dist/{utils → util}/resourceExtractor.js +1 -1
- package/dist/{utils → util}/shortcutKey.js +1 -1
- package/package.json +32 -36
- package/dist/app/editor/EditorMarkdown/index.d.ts +0 -1
- package/dist/app/editor/EditorMarkdown/index.js +0 -1
- package/dist/components/FloatingPopover/index.js +0 -66
- package/dist/components/HoverPopover/index.js +0 -56
- package/dist/components/Toolbar/CommandSelect.d.ts +0 -20
- package/dist/components/Toolbar/EditorAlignSelect.js +0 -76
- package/dist/components/Toolbar/EditorCode.js +0 -50
- package/dist/components/Toolbar/EditorInsert/index.js +0 -40
- package/dist/components/Toolbar/EditorInsert/menu-builders.d.ts +0 -3
- package/dist/components/Toolbar/EditorInsert/menu-builders.js +0 -407
- package/dist/components/Toolbar/EditorListSelect.js +0 -62
- package/dist/components/Toolbar/EditorMath.js +0 -54
- package/dist/components/Toolbar/EditorMore/menu-builders.d.ts +0 -5
- package/dist/components/Toolbar/EditorMore/menu-builders.js +0 -13
- package/dist/components/Toolbar/EditorScript.js +0 -50
- package/dist/components/Toolbar/EditorVerticalAlignSelect.js +0 -64
- package/dist/components/shared/menu-item-content.d.ts +0 -7
- package/dist/components/shared/menu-item-content.js +0 -23
- package/dist/components/shared/menu-surface.d.ts +0 -13
- package/dist/components/shared/menu-surface.js +0 -35
- package/dist/components/shared/use-floating-popover.d.ts +0 -16
- package/dist/components/shared/use-floating-popover.js +0 -79
- package/dist/components/shared/use-hover-popover.d.ts +0 -15
- package/dist/components/shared/use-hover-popover.js +0 -96
- package/dist/components/shared/use-popover-anchor.d.ts +0 -8
- package/dist/components/shared/use-popover-anchor.js +0 -26
- package/dist/editor-core/extensions/builders.d.ts +0 -13
- package/dist/editor-core/extensions/catalog.d.ts +0 -22
- package/dist/editor-core/extensions/catalog.js +0 -326
- package/dist/editor-core/extensions/component/Audio/index.d.ts +0 -5
- package/dist/editor-core/extensions/component/Audio/shared.d.ts +0 -12
- package/dist/editor-core/extensions/component/Audio/shared.js +0 -48
- package/dist/editor-core/extensions/component/Audio/use-audio-upload-fields.d.ts +0 -21
- package/dist/editor-core/extensions/component/Audio/use-audio-upload-fields.js +0 -48
- package/dist/editor-core/extensions/component/CodeBlock/Readonly.js +0 -124
- package/dist/editor-core/extensions/component/CodeBlock/index.js +0 -330
- package/dist/editor-core/extensions/component/CodeBlock/shared.d.ts +0 -15
- package/dist/editor-core/extensions/component/Link/Insert.js +0 -162
- package/dist/editor-core/extensions/component/Link/shared.d.ts +0 -26
- package/dist/editor-core/extensions/component/Link/shared.js +0 -74
- package/dist/editor-core/extensions/component/Mathematics/shared.d.ts +0 -18
- package/dist/editor-core/extensions/component/Mathematics/shared.js +0 -64
- package/dist/editor-core/extensions/component/UploadProgress/Inline.js +0 -28
- package/dist/editor-core/extensions/component/UploadProgress/file-meta.d.ts +0 -4
- package/dist/editor-core/extensions/component/UploadProgress/file-meta.js +0 -42
- package/dist/editor-core/extensions/component/UploadProgress/index.js +0 -19
- package/dist/editor-core/extensions/component/UploadProgress/shared.d.ts +0 -10
- package/dist/editor-core/extensions/component/shared/edit-popover.d.ts +0 -27
- package/dist/editor-core/extensions/component/shared/edit-popover.js +0 -82
- package/dist/editor-core/extensions/component/shared/insert-popover.d.ts +0 -34
- package/dist/editor-core/extensions/component/shared/insert-popover.js +0 -160
- package/dist/editor-core/extensions/component/shared/resource-form.d.ts +0 -26
- package/dist/editor-core/extensions/component/shared/resource-form.js +0 -78
- package/dist/editor-core/extensions/component/shared/upload-flow.d.ts +0 -25
- package/dist/editor-core/extensions/component/shared/upload-flow.js +0 -143
- package/dist/editor-core/extensions/extension/ImeComposition.d.ts +0 -12
- package/dist/editor-core/extensions/extension/ime-shared.d.ts +0 -11
- package/dist/editor-core/extensions/extension/ime-shared.js +0 -20
- package/dist/editor-core/extensions/index.d.ts +0 -4
- package/dist/editor-core/extensions/index.js +0 -6
- package/dist/editor-core/extensions/node/ListKit.js +0 -18
- package/dist/editor-core/extensions/node/Mathematics.js +0 -58
- package/dist/editor-core/extensions/node/code-block-lowlight-shared.d.ts +0 -14
- package/dist/editor-core/extensions/node/code-block-lowlight-shared.js +0 -34
- package/dist/editor-core/extensions/node/list-shared.d.ts +0 -18
- package/dist/editor-core/extensions/node/list-shared.js +0 -18
- package/dist/editor-core/extensions/node/mathematics-shared.d.ts +0 -7
- package/dist/editor-core/extensions/node/mathematics-shared.js +0 -40
- package/dist/editor-core/extensions/node/resource-shared.d.ts +0 -13
- package/dist/editor-core/extensions/node/resource-shared.js +0 -45
- package/dist/editor-core/extensions/plugin-keys.d.ts +0 -2
- package/dist/editor-core/extensions/plugin-keys.js +0 -2
- package/dist/features/drag-handle/action-count-badge.d.ts +0 -5
- package/dist/features/drag-handle/action-count-badge.js +0 -23
- package/dist/features/drag-handle/action-groups.d.ts +0 -13
- package/dist/features/drag-handle/action-groups.js +0 -49
- package/dist/features/drag-handle/convert-builders.d.ts +0 -8
- package/dist/features/drag-handle/convert-builders.js +0 -201
- package/dist/features/drag-handle/download-builders.d.ts +0 -7
- package/dist/features/drag-handle/download-builders.js +0 -237
- package/dist/features/drag-handle/drag-handle-header.d.ts +0 -17
- package/dist/features/drag-handle/drag-handle-header.js +0 -233
- package/dist/features/drag-handle/index.js +0 -210
- package/dist/features/drag-handle/insert-builders.d.ts +0 -3
- package/dist/features/drag-handle/insert-builders.js +0 -81
- package/dist/features/drag-handle/menu-builders.d.ts +0 -4
- package/dist/features/drag-handle/menu-builders.js +0 -4
- package/dist/features/drag-handle/menu-shared.d.ts +0 -11
- package/dist/features/drag-handle/menu-shared.js +0 -102
- package/dist/features/drag-handle/node-actions.d.ts +0 -5
- package/dist/features/drag-handle/node-actions.js +0 -57
- package/dist/features/drag-handle/style-builders.d.ts +0 -8
- package/dist/features/drag-handle/style-builders.js +0 -197
- package/dist/features/drag-handle/types.d.ts +0 -27
- package/dist/features/drag-handle/types.js +0 -1
- package/dist/features/drag-handle/use-current-node-context.d.ts +0 -11
- package/dist/features/drag-handle/use-current-node-context.js +0 -109
- package/dist/features/markdown/Toolbar.js +0 -81
- package/dist/features/markdown/index.js +0 -284
- package/dist/features/markdown/toolbar-actions.d.ts +0 -82
- package/dist/features/markdown/toolbar-actions.js +0 -734
- package/dist/features/markdown/toolbar-menu.d.ts +0 -9
- package/dist/features/markdown/toolbar-menu.js +0 -87
- package/dist/features/markdown/toolbar-tool-list.d.ts +0 -12
- package/dist/features/markdown/toolbar-tool-list.js +0 -24
- package/dist/features/markdown/use-ace-composition.d.ts +0 -5
- package/dist/features/markdown/use-ace-composition.js +0 -39
- package/dist/features/markdown/use-display-mode.d.ts +0 -8
- package/dist/features/markdown/use-display-mode.js +0 -28
- package/dist/features/markdown/use-markdown-file-inputs.d.ts +0 -10
- package/dist/features/markdown/use-markdown-file-inputs.js +0 -69
- package/dist/features/markdown/use-markdown-sync.d.ts +0 -13
- package/dist/features/markdown/use-markdown-sync.js +0 -56
- package/dist/features/markdown/use-markdown-transfer.d.ts +0 -18
- package/dist/features/markdown/use-markdown-transfer.js +0 -123
- package/dist/features/markdown/use-markdown-upload.d.ts +0 -13
- package/dist/features/markdown/use-markdown-upload.js +0 -98
- package/dist/features/media/shared/media-edit-popover.d.ts +0 -26
- package/dist/features/media/shared/media-edit-popover.js +0 -105
- package/dist/features/media/shared/media-hover-toolbar.d.ts +0 -18
- package/dist/features/media/shared/media-hover-toolbar.js +0 -140
- package/dist/features/media/shared/media-resize-handles.d.ts +0 -8
- package/dist/features/media/shared/media-resize-handles.js +0 -70
- package/dist/features/media/shared/use-media-resize.d.ts +0 -20
- package/dist/features/media/shared/use-media-resize.js +0 -88
- package/dist/features/media/shared/use-media-width.d.ts +0 -14
- package/dist/features/media/shared/use-media-width.js +0 -76
- package/dist/features/table/TableCellHandleMenu/index.js +0 -234
- package/dist/features/table/TableHandle/index.js +0 -73
- package/dist/features/table/TableHandle/menu-builders.d.ts +0 -14
- package/dist/features/table/TableHandle/menu-builders.js +0 -242
- package/dist/features/table/TableHandle/table-handle-group.d.ts +0 -16
- package/dist/features/table/TableHandle/table-handle-group.js +0 -84
- package/dist/features/table/TableHandle/use-table-handle-visibility.d.ts +0 -14
- package/dist/features/table/TableHandle/use-table-handle-visibility.js +0 -47
- package/dist/features/table/TableHandle/use-table-menu-open.d.ts +0 -12
- package/dist/features/table/TableHandle/use-table-menu-open.js +0 -39
- package/dist/features/table/plugin/decorations.d.ts +0 -9
- package/dist/features/table/plugin/decorations.js +0 -80
- package/dist/features/table/plugin/drag-helpers.d.ts +0 -11
- package/dist/features/table/plugin/drag-helpers.js +0 -188
- package/dist/features/table/plugin/hover-state.d.ts +0 -27
- package/dist/features/table/plugin/hover-state.js +0 -60
- package/dist/features/table/plugin/plugin.d.ts +0 -4
- package/dist/features/table/plugin/plugin.js +0 -512
- package/dist/features/table/plugin/positioning.d.ts +0 -40
- package/dist/features/table/plugin/positioning.js +0 -124
- package/dist/features/table/plugin/shared.js +0 -9
- package/dist/features/table/plugin/state-sync.d.ts +0 -12
- package/dist/features/table/plugin/state-sync.js +0 -75
- package/dist/features/toolbar/index.js +0 -179
- package/dist/features/toolbar/toolbar-config.d.ts +0 -32
- package/dist/features/toolbar/toolbar-config.js +0 -209
- package/dist/features/toolbar/toolbar-divider.d.ts +0 -3
- package/dist/features/toolbar/toolbar-divider.js +0 -14
- package/dist/features/toolbar/toolbar-sections.d.ts +0 -23
- package/dist/features/toolbar/toolbar-sections.js +0 -107
- package/dist/utils/color.d.ts +0 -1
- package/dist/utils/color.js +0 -18
- package/dist/utils/diff/index.d.ts +0 -2
- package/dist/utils/diff/index.js +0 -2
- package/dist/utils/editor.d.ts +0 -6
- package/dist/utils/editor.js +0 -29
- package/dist/utils/embed.d.ts +0 -2
- package/dist/utils/embed.js +0 -27
- package/dist/utils/file/index.d.ts +0 -3
- package/dist/utils/file/index.js +0 -3
- package/dist/utils/file.d.ts +0 -3
- package/dist/utils/file.js +0 -20
- package/dist/utils/fileHandler.js +0 -69
- package/dist/utils/index.d.ts +0 -10
- package/dist/utils/index.js +0 -10
- package/dist/utils/link.d.ts +0 -5
- package/dist/utils/link.js +0 -25
- package/dist/utils/resource.d.ts +0 -2
- package/dist/utils/resource.js +0 -38
- package/dist/utils/table/index.d.ts +0 -1
- package/dist/utils/table/index.js +0 -1
- /package/dist/{app/editor/EditorDiff → EditorDiff}/index.d.ts +0 -0
- /package/dist/{features/markdown → EditorMarkdown}/UploadProgress.d.ts +0 -0
- /package/dist/{features/markdown → EditorMarkdown}/UploadProgress.js +0 -0
- /package/dist/{features/markdown → EditorMarkdown}/util.d.ts +0 -0
- /package/dist/{features/markdown → EditorMarkdown}/util.js +0 -0
- /package/dist/{components → component}/CustomFloatingMenu/index.d.ts +0 -0
- /package/dist/{components → component}/CustomFloatingMenu/index.js +0 -0
- /package/dist/{components → component}/FloatingPopover/index.d.ts +0 -0
- /package/dist/{components → component}/HoverPopover/index.d.ts +0 -0
- /package/dist/{components → component}/Icons/add-circle-fill-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/add-circle-fill-icon.js +0 -0
- /package/dist/{components → component}/Icons/add-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/add-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/ai-generate-2-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/ai-generate-2-icon.js +0 -0
- /package/dist/{components → component}/Icons/ai-generate-text-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/ai-generate-text-icon.js +0 -0
- /package/dist/{components → component}/Icons/align-bottom-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/align-bottom-icon.js +0 -0
- /package/dist/{components → component}/Icons/align-center-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/align-center-icon.js +0 -0
- /package/dist/{components → component}/Icons/align-justify-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/align-justify-icon.js +0 -0
- /package/dist/{components → component}/Icons/align-left-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/align-left-icon.js +0 -0
- /package/dist/{components → component}/Icons/align-right-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/align-right-icon.js +0 -0
- /package/dist/{components → component}/Icons/align-top-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/align-top-icon.js +0 -0
- /package/dist/{components → component}/Icons/align-vertically-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/align-vertically-icon.js +0 -0
- /package/dist/{components → component}/Icons/anticlockwise-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/anticlockwise-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/arrow-down-s-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/arrow-down-s-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/arrow-go-back-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/arrow-go-back-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/arrow-go-forward-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/arrow-go-forward-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/arrow-left-wide-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/arrow-left-wide-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/at-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/at-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/attachment-2-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/attachment-2-icon.js +0 -0
- /package/dist/{components → component}/Icons/attachment-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/attachment-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/bilibili-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/bilibili-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/bold-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/bold-icon.js +0 -0
- /package/dist/{components → component}/Icons/brush-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/brush-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/carousel-view-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/carousel-view-icon.js +0 -0
- /package/dist/{components → component}/Icons/checkbox-blank-circle-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/checkbox-blank-circle-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/checkbox-circle-fill-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/checkbox-circle-fill-icon.js +0 -0
- /package/dist/{components → component}/Icons/checkbox-circle-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/checkbox-circle-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/chrome-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/chrome-icon.js +0 -0
- /package/dist/{components → component}/Icons/clockwise-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/clockwise-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/close-circle-fill-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/close-circle-fill-icon.js +0 -0
- /package/dist/{components → component}/Icons/code-box-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/code-box-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/code-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/code-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/code-s-slash-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/code-s-slash-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/collapse-horizontal-line.d.ts +0 -0
- /package/dist/{components → component}/Icons/collapse-horizontal-line.js +0 -0
- /package/dist/{components → component}/Icons/collapse-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/collapse-icon.js +0 -0
- /package/dist/{components → component}/Icons/command-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/command-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/copy-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/copy-icon.js +0 -0
- /package/dist/{components → component}/Icons/custom-size-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/custom-size-icon.js +0 -0
- /package/dist/{components → component}/Icons/delete-back-2-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/delete-back-2-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/delete-column-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/delete-column-icon.js +0 -0
- /package/dist/{components → component}/Icons/delete-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/delete-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/delete-row-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/delete-row-icon.js +0 -0
- /package/dist/{components → component}/Icons/double-quotes-l-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/double-quotes-l-icon.js +0 -0
- /package/dist/{components → component}/Icons/download-2-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/download-2-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/download-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/download-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/draggable-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/draggable-icon.js +0 -0
- /package/dist/{components → component}/Icons/edit-box-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/edit-box-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/edit-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/edit-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/emotion-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/emotion-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/eraser-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/eraser-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/error-warning-fill-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/error-warning-fill-icon.js +0 -0
- /package/dist/{components → component}/Icons/expand-horizontal-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/expand-horizontal-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/expend-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/expend-icon.js +0 -0
- /package/dist/{components → component}/Icons/export-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/export-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/eye-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/eye-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/file-copy-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/file-copy-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/file-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/file-icon.js +0 -0
- /package/dist/{components → component}/Icons/file-upload-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/file-upload-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/flip-grid-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/flip-grid-icon.js +0 -0
- /package/dist/{components → component}/Icons/flip-left-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/flip-left-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/flip-right-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/flip-right-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/flow-chart-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/flow-chart-icon.js +0 -0
- /package/dist/{components → component}/Icons/folder-2-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/folder-2-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/font-color-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/font-color-icon.js +0 -0
- /package/dist/{components → component}/Icons/font-family-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/font-family-icon.js +0 -0
- /package/dist/{components → component}/Icons/font-size-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/font-size-icon.js +0 -0
- /package/dist/{components → component}/Icons/format-clear-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/format-clear-icon.js +0 -0
- /package/dist/{components → component}/Icons/formula-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/formula-icon.js +0 -0
- /package/dist/{components → component}/Icons/fullscreen-exit-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/fullscreen-exit-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/fullscreen-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/fullscreen-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/functions-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/functions-icon.js +0 -0
- /package/dist/{components → component}/Icons/game-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/game-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/h-1-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/h-1-icon.js +0 -0
- /package/dist/{components → component}/Icons/h-2-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/h-2-icon.js +0 -0
- /package/dist/{components → component}/Icons/h-3-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/h-3-icon.js +0 -0
- /package/dist/{components → component}/Icons/h-4-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/h-4-icon.js +0 -0
- /package/dist/{components → component}/Icons/h-5-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/h-5-icon.js +0 -0
- /package/dist/{components → component}/Icons/h-6-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/h-6-icon.js +0 -0
- /package/dist/{components → component}/Icons/heading-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/heading-icon.js +0 -0
- /package/dist/{components → component}/Icons/image-add-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/image-add-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/image-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/image-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/import-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/import-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/indent-decrease-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/indent-decrease-icon.js +0 -0
- /package/dist/{components → component}/Icons/indent-increase-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/indent-increase-icon.js +0 -0
- /package/dist/{components → component}/Icons/index.d.ts +0 -0
- /package/dist/{components → component}/Icons/index.js +0 -0
- /package/dist/{components → component}/Icons/information-2-fill-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/information-2-fill-icon.js +0 -0
- /package/dist/{components → component}/Icons/information-2-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/information-2-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/insert-column-left-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/insert-column-left-icon.js +0 -0
- /package/dist/{components → component}/Icons/insert-column-right-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/insert-column-right-icon.js +0 -0
- /package/dist/{components → component}/Icons/insert-row-bottom-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/insert-row-bottom-icon.js +0 -0
- /package/dist/{components → component}/Icons/insert-row-top-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/insert-row-top-icon.js +0 -0
- /package/dist/{components → component}/Icons/italic-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/italic-icon.js +0 -0
- /package/dist/{components → component}/Icons/keyboard-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/keyboard-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/layout-left-2-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/layout-left-2-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/layout-top-2-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/layout-top-2-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/link-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/link-icon.js +0 -0
- /package/dist/{components → component}/Icons/link-unlink-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/link-unlink-icon.js +0 -0
- /package/dist/{components → component}/Icons/list-check-2-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/list-check-2-icon.js +0 -0
- /package/dist/{components → component}/Icons/list-check-3-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/list-check-3-icon.js +0 -0
- /package/dist/{components → component}/Icons/list-ordered-2-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/list-ordered-2-icon.js +0 -0
- /package/dist/{components → component}/Icons/list-unordered-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/list-unordered-icon.js +0 -0
- /package/dist/{components → component}/Icons/mark-pen-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/mark-pen-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/markdown-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/markdown-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/markup-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/markup-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/menu-fold-2-fill-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/menu-fold-2-fill-icon.js +0 -0
- /package/dist/{components → component}/Icons/merge-cells-horizontal-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/merge-cells-horizontal-icon.js +0 -0
- /package/dist/{components → component}/Icons/merge-cells-vertical-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/merge-cells-vertical-icon.js +0 -0
- /package/dist/{components → component}/Icons/mind-map-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/mind-map-icon.js +0 -0
- /package/dist/{components → component}/Icons/more-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/more-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/movie-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/movie-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/music-2-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/music-2-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/node-tree-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/node-tree-icon.js +0 -0
- /package/dist/{components → component}/Icons/notification-3-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/notification-3-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/organization-chart-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/organization-chart-icon.js +0 -0
- /package/dist/{components → component}/Icons/pause-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/pause-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/play-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/play-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/question-fill-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/question-fill-icon.js +0 -0
- /package/dist/{components → component}/Icons/quote-text-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/quote-text-icon.js +0 -0
- /package/dist/{components → component}/Icons/repeat-2-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/repeat-2-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/reset-left-fill-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/reset-left-fill-icon.js +0 -0
- /package/dist/{components → component}/Icons/scissors-cut-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/scissors-cut-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/screenshot-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/screenshot-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/scroll-to-bottom-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/scroll-to-bottom-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/separator-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/separator-icon.js +0 -0
- /package/dist/{components → component}/Icons/share-box-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/share-box-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/sketching-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/sketching-icon.js +0 -0
- /package/dist/{components → component}/Icons/skip-down-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/skip-down-icon.js +0 -0
- /package/dist/{components → component}/Icons/skip-left-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/skip-left-icon.js +0 -0
- /package/dist/{components → component}/Icons/skip-right-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/skip-right-icon.js +0 -0
- /package/dist/{components → component}/Icons/skip-up-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/skip-up-icon.js +0 -0
- /package/dist/{components → component}/Icons/slash-commands-2-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/slash-commands-2-icon.js +0 -0
- /package/dist/{components → component}/Icons/speed-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/speed-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/split-cells-horizontal-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/split-cells-horizontal-icon.js +0 -0
- /package/dist/{components → component}/Icons/split-cells-vertical-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/split-cells-vertical-icon.js +0 -0
- /package/dist/{components → component}/Icons/square-root-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/square-root-icon.js +0 -0
- /package/dist/{components → component}/Icons/strikethrough-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/strikethrough-icon.js +0 -0
- /package/dist/{components → component}/Icons/subscript-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/subscript-icon.js +0 -0
- /package/dist/{components → component}/Icons/superscript-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/superscript-icon.js +0 -0
- /package/dist/{components → component}/Icons/table-2-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/table-2-icon.js +0 -0
- /package/dist/{components → component}/Icons/table-view-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/table-view-icon.js +0 -0
- /package/dist/{components → component}/Icons/text-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/text-icon.js +0 -0
- /package/dist/{components → component}/Icons/text-wrap-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/text-wrap-icon.js +0 -0
- /package/dist/{components → component}/Icons/title-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/title-icon.js +0 -0
- /package/dist/{components → component}/Icons/tooltip-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/tooltip-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/underline-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/underline-icon.js +0 -0
- /package/dist/{components → component}/Icons/upload-cloud-2-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/upload-cloud-2-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/upload-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/upload-icon.js +0 -0
- /package/dist/{components → component}/Icons/user-smile-fill-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/user-smile-fill-icon.js +0 -0
- /package/dist/{components → component}/Icons/volume-down-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/volume-down-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/volume-mute-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/volume-mute-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/volume-up-line-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/volume-up-line-icon.js +0 -0
- /package/dist/{components → component}/Icons/window-fill-icon.d.ts +0 -0
- /package/dist/{components → component}/Icons/window-fill-icon.js +0 -0
- /package/dist/{components → component}/ImageViewer/Item.d.ts +0 -0
- /package/dist/{components → component}/ImageViewer/Item.js +0 -0
- /package/dist/{components → component}/ImageViewer/Provider.d.ts +0 -0
- /package/dist/{components → component}/ImageViewer/Provider.js +0 -0
- /package/dist/{components → component}/ImageViewer/Toolbar.d.ts +0 -0
- /package/dist/{components → component}/ImageViewer/Toolbar.js +0 -0
- /package/dist/{components → component}/ImageViewer/context.d.ts +0 -0
- /package/dist/{components → component}/ImageViewer/context.js +0 -0
- /package/dist/{components → component}/ImageViewer/index.d.ts +0 -0
- /package/dist/{components → component}/ImageViewer/index.js +0 -0
- /package/dist/{components → component}/ImageViewer/styles.d.ts +0 -0
- /package/dist/{components → component}/ImageViewer/styles.js +0 -0
- /package/dist/{components → component}/ImageViewer/types.d.ts +0 -0
- /package/dist/{components → component}/ImageViewer/types.js +0 -0
- /package/dist/{components → component}/Toolbar/EditorAlignSelect.d.ts +0 -0
- /package/dist/{components → component}/Toolbar/EditorCode.d.ts +0 -0
- /package/dist/{components → component}/Toolbar/EditorFontBgColor.d.ts +0 -0
- /package/dist/{components → component}/Toolbar/EditorFontBgColor.js +0 -0
- /package/dist/{components → component}/Toolbar/EditorFontColor.d.ts +0 -0
- /package/dist/{components → component}/Toolbar/EditorFontColor.js +0 -0
- /package/dist/{components → component}/Toolbar/EditorFontSize.d.ts +0 -0
- /package/dist/{components → component}/Toolbar/EditorFontSize.js +0 -0
- /package/dist/{components → component}/Toolbar/EditorHeading.d.ts +0 -0
- /package/dist/{components → component}/Toolbar/EditorInsert/index.d.ts +0 -0
- /package/dist/{components → component}/Toolbar/EditorListSelect.d.ts +0 -0
- /package/dist/{components → component}/Toolbar/EditorMath.d.ts +0 -0
- /package/dist/{components → component}/Toolbar/EditorMore/NotificationDialog.d.ts +0 -0
- /package/dist/{components → component}/Toolbar/EditorScript.d.ts +0 -0
- /package/dist/{components → component}/Toolbar/EditorVerticalAlignSelect.d.ts +0 -0
- /package/dist/{components → component}/Toolbar/Item.d.ts +0 -0
- /package/dist/{components → component}/Toolbar/TableSizePicker.d.ts +0 -0
- /package/dist/{components → component}/index.d.ts +0 -0
- /package/dist/{components → component}/index.js +0 -0
- /package/dist/{constants → contants}/highlight.d.ts +0 -0
- /package/dist/{constants → contants}/highlight.js +0 -0
- /package/dist/{constants → contants}/markdown-placeholder.d.ts +0 -0
- /package/dist/{constants → contants}/markdown-placeholder.js +0 -0
- /package/dist/{constants → contants}/placeholder.d.ts +0 -0
- /package/dist/{constants → contants}/placeholder.js +0 -0
- /package/dist/{constants → contants}/shortcut-key.d.ts +0 -0
- /package/dist/{constants → contants}/shortcut-key.js +0 -0
- /package/dist/{constants → contants}/slash-commands.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Alert/index.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Attachment/AttachmentContent.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/CodeBlock/Readonly.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/CodeBlock/index.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/DrawPanel/ExcalidrawEditor.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/DrawPanel/ExcalidrawEditor.js +0 -0
- /package/dist/{editor-core/extensions → extension}/component/DrawPanel/Modal.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/DrawPanel/Modal.js +0 -0
- /package/dist/{editor-core/extensions → extension}/component/EmojiList/index.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/EmojiList/index.js +0 -0
- /package/dist/{editor-core/extensions → extension}/component/FlipGrid/ColumnView.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/FlipGrid/index.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/FlipGrid/index.js +0 -0
- /package/dist/{editor-core/extensions → extension}/component/FlipGrid/utils.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/FlipGrid/utils.js +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Flow/Edit.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Flow/FlowDiagram.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Flow/FlowDiagram.js +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Flow/Insert.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Flow/Readonly.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Flow/Readonly.js +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Flow/useMermaidRender.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Flow/useMermaidRender.js +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Flow/utils.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Flow/utils.js +0 -0
- /package/dist/{features/media/iframe → extension/component/Iframe}/Readonly.d.ts +0 -0
- /package/dist/{features/media/iframe → extension/component/Iframe}/Readonly.js +0 -0
- /package/dist/{features/media/image → extension/component/Image}/Crop.js +0 -0
- /package/dist/{features/media/image → extension/component/Image}/Readonly.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Link/Markdown.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Mathematics/block/Readonly.js +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Mathematics/index.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Mathematics/index.js +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Mathematics/inline/Readonly.js +0 -0
- /package/dist/{editor-core/extensions → extension}/component/MentionList/index.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/MentionList/index.js +0 -0
- /package/dist/{features/table → extension/component}/TableCellHandleMenu/index.d.ts +0 -0
- /package/dist/{features/table → extension/component}/TableExtendButton/TableExtendButton.css +0 -0
- /package/dist/{features/table → extension/component}/TableExtendButton/use-table-extend-row-column.d.ts +0 -0
- /package/dist/{features/table → extension/component}/TableExtendButton/use-table-extend-row-column.js +0 -0
- /package/dist/{features/table → extension/component}/TableHandle/TableHandleMenu.css +0 -0
- /package/dist/{features/table → extension/component}/TableHandle/use-table-handle-positioning.d.ts +0 -0
- /package/dist/{features/table → extension/component}/TableHandle/use-table-handle-state.js +0 -0
- /package/dist/{features/table → extension/component}/TableSelectionOverlay/index.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Tooltip/EditPopover.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/component/Tooltip/index.d.ts +0 -0
- /package/dist/{features/media/video → extension/component/Video}/Readonly.d.ts +0 -0
- /package/dist/{features/media/video → extension/component/Video}/Readonly.js +0 -0
- /package/dist/{editor-core/extensions → extension}/extension/AiWriting.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/extension/AiWriting.js +0 -0
- /package/dist/{editor-core/extensions → extension}/extension/SlashCommands.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/extension/SlashCommands.js +0 -0
- /package/dist/{editor-core/extensions → extension}/extension/StructuredDiff.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/extension/index.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/extension/index.js +0 -0
- /package/dist/{editor-core/extensions → extension}/mark/Code.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/mark/Code.js +0 -0
- /package/dist/{editor-core/extensions → extension}/mark/Tooltip.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/mark/Tooltip.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Alert.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Alert.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/CodeBlockLowlight.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Details.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Details.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/DrawPanel.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Emoji.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Emoji.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/FlipGrid.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/FlipGrid.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Flow/index.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/HorizontalRule.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/HorizontalRule.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Indent.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Indent.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/InlineUploadProgress.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/InlineUploadProgress.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Link/helpers/autolink.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Link/helpers/autolink.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Link/helpers/clickHandler.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Link/helpers/clickHandler.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Link/helpers/pasteHandler.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Link/helpers/pasteHandler.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Link/helpers/whitespace.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Link/helpers/whitespace.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Link/index.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/ListKit.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Mention.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Script.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Script.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Table.d.ts +0 -0
- /package/dist/{features/table/plugin → extension/node/TableHandler}/create-image.d.ts +0 -0
- /package/dist/{features/table/plugin → extension/node/TableHandler}/create-image.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/TableOfContents/plugin.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/TableOfContents/types.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/TableOfContents/types.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/TableOfContents/util.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/TableOfContents/util.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/UploadProgress.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/UploadProgress.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/VerticalAlign.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/VerticalAlign.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/YamlFormat.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/YamlFormat.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Youtube.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/Youtube.js +0 -0
- /package/dist/{editor-core/extensions → extension}/node/index.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/node/index.js +0 -0
- /package/dist/{editor-core/extensions → extension}/suggestion/emoji.d.ts +0 -0
- /package/dist/{editor-core/extensions → extension}/suggestion/emoji.js +0 -0
- /package/dist/{types → type}/index.d.ts +0 -0
- /package/dist/{types → type}/index.js +0 -0
- /package/dist/{utils → util}/decorations.d.ts +0 -0
- /package/dist/{utils → util}/decorations.js +0 -0
- /package/dist/{utils → util}/fileDownload.d.ts +0 -0
- /package/dist/{utils → util}/fileDownload.js +0 -0
- /package/dist/{utils → util}/floating.d.ts +0 -0
- /package/dist/{utils → util}/floating.js +0 -0
- /package/dist/{utils → util}/linewiseConvert.d.ts +0 -0
- /package/dist/{utils → util}/linewiseConvert.js +0 -0
- /package/dist/{utils → util}/shortcutKey.d.ts +0 -0
- /package/dist/{utils → util}/structuredDiff.d.ts +0 -0
- /package/dist/{utils → util}/structuredDiff.js +0 -0
- /package/dist/{utils → util}/table-utils.d.ts +0 -0
- /package/dist/{utils → util}/table-utils.js +0 -0
|
@@ -0,0 +1,1083 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
import { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';
|
|
14
|
+
import { CellSelection, moveTableColumn, moveTableRow, TableMap } from '@tiptap/pm/tables';
|
|
15
|
+
import { Decoration, DecorationSet } from '@tiptap/pm/view';
|
|
16
|
+
import { clamp, domCellAround, getCellIndicesFromDOM, getColumnCells, getIndexCoordinates, getRowCells, getTableFromDOM, isHTMLElement, isTableNode, safeClosest, selectCellsByCoords } from "../../../util/table-utils";
|
|
17
|
+
import { createTableDragImage } from "./create-image";
|
|
18
|
+
function hideElements(selector, rootEl) {
|
|
19
|
+
rootEl.querySelectorAll(selector).forEach(function (el) {
|
|
20
|
+
el.style.visibility = 'hidden';
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export var tableHandlePluginKey = new PluginKey('tableHandlePlugin');
|
|
24
|
+
var TableHandleView = /*#__PURE__*/function () {
|
|
25
|
+
function TableHandleView(editor, editorView, emitUpdate) {
|
|
26
|
+
var _this = this;
|
|
27
|
+
_classCallCheck(this, TableHandleView);
|
|
28
|
+
_defineProperty(this, "editor", void 0);
|
|
29
|
+
_defineProperty(this, "editorView", void 0);
|
|
30
|
+
_defineProperty(this, "state", undefined);
|
|
31
|
+
_defineProperty(this, "menuFrozen", false);
|
|
32
|
+
_defineProperty(this, "mouseState", 'up');
|
|
33
|
+
_defineProperty(this, "tableId", void 0);
|
|
34
|
+
_defineProperty(this, "tablePos", void 0);
|
|
35
|
+
_defineProperty(this, "tableElement", void 0);
|
|
36
|
+
_defineProperty(this, "emitUpdate", void 0);
|
|
37
|
+
_defineProperty(this, "viewMousedownHandler", function (event) {
|
|
38
|
+
_this.mouseState = 'down';
|
|
39
|
+
var _this$editor = _this.editor,
|
|
40
|
+
state = _this$editor.state,
|
|
41
|
+
view = _this$editor.view;
|
|
42
|
+
if (!(state.selection instanceof CellSelection) || _this.editor.isFocused) return;
|
|
43
|
+
var posInfo = view.posAtCoords({
|
|
44
|
+
left: event.clientX,
|
|
45
|
+
top: event.clientY
|
|
46
|
+
});
|
|
47
|
+
if (!posInfo) return;
|
|
48
|
+
var $pos = state.doc.resolve(posInfo.pos);
|
|
49
|
+
var nodes = state.schema.nodes;
|
|
50
|
+
var paraDepth = -1;
|
|
51
|
+
var inTableCell = false;
|
|
52
|
+
for (var d = $pos.depth; d >= 0; d--) {
|
|
53
|
+
var node = $pos.node(d);
|
|
54
|
+
if (!inTableCell && (node.type === nodes.tableCell || node.type === nodes.tableHeader)) {
|
|
55
|
+
inTableCell = true;
|
|
56
|
+
}
|
|
57
|
+
if (paraDepth === -1 && node.type === nodes.paragraph) {
|
|
58
|
+
paraDepth = d;
|
|
59
|
+
}
|
|
60
|
+
if (inTableCell && paraDepth !== -1) break;
|
|
61
|
+
}
|
|
62
|
+
if (!inTableCell || paraDepth === -1) return;
|
|
63
|
+
var from = $pos.start(paraDepth);
|
|
64
|
+
var to = $pos.end(paraDepth);
|
|
65
|
+
var nextSel = TextSelection.create(state.doc, from, to);
|
|
66
|
+
if (state.selection.eq(nextSel)) return;
|
|
67
|
+
view.dispatch(state.tr.setSelection(nextSel));
|
|
68
|
+
view.focus();
|
|
69
|
+
});
|
|
70
|
+
_defineProperty(this, "mouseUpHandler", function (event) {
|
|
71
|
+
_this.mouseState = 'up';
|
|
72
|
+
_this.mouseMoveHandler(event);
|
|
73
|
+
});
|
|
74
|
+
_defineProperty(this, "mouseMoveHandler", function (event) {
|
|
75
|
+
if (_this.menuFrozen || _this.mouseState === 'selecting') return;
|
|
76
|
+
var target = event.target;
|
|
77
|
+
// 鼠标不在编辑器内时不处理,避免拖拽出界导致状态被清空
|
|
78
|
+
if (!isHTMLElement(target) || !_this.editorView.dom.contains(target)) return;
|
|
79
|
+
|
|
80
|
+
// 判断是否悬停在手柄或扩展按钮上
|
|
81
|
+
var isOverHandle = target.closest('.tiptap-table-handle-menu') !== null;
|
|
82
|
+
var isOverExtendButton = target.closest('.tiptap-table-extend-row-column-button, .tiptap-table-add-button') !== null;
|
|
83
|
+
|
|
84
|
+
// 悬停其上时保持显示
|
|
85
|
+
if (isOverHandle || isOverExtendButton) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 检查鼠标是否在手柄或按钮附近,使用缓存优化性能
|
|
90
|
+
var handleRects = _this._getCachedHandleRects();
|
|
91
|
+
var isNearHandle = false;
|
|
92
|
+
var _iterator = _createForOfIteratorHelper(handleRects),
|
|
93
|
+
_step;
|
|
94
|
+
try {
|
|
95
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
96
|
+
var rect = _step.value;
|
|
97
|
+
// 周围扩展 10px 容错便于移动
|
|
98
|
+
var expandedRect = new DOMRect(rect.left - 10, rect.top - 10, rect.width + 20, rect.height + 20);
|
|
99
|
+
if (event.clientX >= expandedRect.left && event.clientX <= expandedRect.right && event.clientY >= expandedRect.top && event.clientY <= expandedRect.bottom) {
|
|
100
|
+
isNearHandle = true;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// 靠近手柄时不继续处理,避免闪烁
|
|
106
|
+
} catch (err) {
|
|
107
|
+
_iterator.e(err);
|
|
108
|
+
} finally {
|
|
109
|
+
_iterator.f();
|
|
110
|
+
}
|
|
111
|
+
if (isNearHandle) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
_this._handleMouseMoveNow(event);
|
|
115
|
+
});
|
|
116
|
+
_defineProperty(this, "dragOverHandler", function (event) {
|
|
117
|
+
var _this$state;
|
|
118
|
+
if (((_this$state = _this.state) === null || _this$state === void 0 ? void 0 : _this$state.draggingState) === undefined) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
event.dataTransfer.dropEffect = 'move';
|
|
123
|
+
hideElements('.prosemirror-dropcursor-block, .prosemirror-dropcursor-inline', _this.editorView.root);
|
|
124
|
+
|
|
125
|
+
// 将鼠标坐标限制在表格包围框内
|
|
126
|
+
var _this$state$reference = _this.state.referencePosTable,
|
|
127
|
+
tableLeft = _this$state$reference.left,
|
|
128
|
+
tableRight = _this$state$reference.right,
|
|
129
|
+
tableTop = _this$state$reference.top,
|
|
130
|
+
tableBottom = _this$state$reference.bottom;
|
|
131
|
+
var boundedMouseCoords = {
|
|
132
|
+
left: clamp(event.clientX, tableLeft + 1, tableRight - 1),
|
|
133
|
+
top: clamp(event.clientY, tableTop + 1, tableBottom - 1)
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// 获取所在位置的单元格元素
|
|
137
|
+
var tableCellElements = _this.editorView.root.elementsFromPoint(boundedMouseCoords.left, boundedMouseCoords.top).filter(function (element) {
|
|
138
|
+
return element.tagName === 'TD' || element.tagName === 'TH';
|
|
139
|
+
});
|
|
140
|
+
if (tableCellElements.length === 0) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
var tableCellElement = tableCellElements[0];
|
|
144
|
+
if (!isHTMLElement(tableCellElement)) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
var cellPosition = getCellIndicesFromDOM(tableCellElement, _this.state.block, _this.editor);
|
|
148
|
+
if (!cellPosition) return;
|
|
149
|
+
var rowIndex = cellPosition.rowIndex,
|
|
150
|
+
colIndex = cellPosition.colIndex;
|
|
151
|
+
|
|
152
|
+
// 判断被拖动的索引是否改变
|
|
153
|
+
var oldIndex = _this.state.draggingState.draggedCellOrientation === 'row' ? _this.state.rowIndex : _this.state.colIndex;
|
|
154
|
+
var newIndex = _this.state.draggingState.draggedCellOrientation === 'row' ? rowIndex : colIndex;
|
|
155
|
+
var dispatchDecorationsTransaction = newIndex !== oldIndex;
|
|
156
|
+
var mousePos = _this.state.draggingState.draggedCellOrientation === 'row' ? boundedMouseCoords.top : boundedMouseCoords.left;
|
|
157
|
+
|
|
158
|
+
// 仅在单元格或鼠标位置变化时更新
|
|
159
|
+
var cellChanged = _this.state.rowIndex !== rowIndex || _this.state.colIndex !== colIndex;
|
|
160
|
+
var mousePosChanged = _this.state.draggingState.mousePos !== mousePos;
|
|
161
|
+
if (cellChanged || mousePosChanged) {
|
|
162
|
+
var _this$state$draggingS;
|
|
163
|
+
var newCellRect = tableCellElement.getBoundingClientRect();
|
|
164
|
+
// 拖拽时保持初始单元格尺寸,避免手柄高度抖动
|
|
165
|
+
var preservedCellRect = (_this$state$draggingS = _this.state.draggingState) !== null && _this$state$draggingS !== void 0 && _this$state$draggingS.originalCellSize ? new DOMRect(newCellRect.x, newCellRect.y, _this.state.draggingState.originalCellSize.width, _this.state.draggingState.originalCellSize.height) : newCellRect;
|
|
166
|
+
_this.state = _objectSpread(_objectSpread({}, _this.state), {}, {
|
|
167
|
+
rowIndex: rowIndex,
|
|
168
|
+
colIndex: colIndex,
|
|
169
|
+
referencePosCell: preservedCellRect,
|
|
170
|
+
draggingState: _objectSpread(_objectSpread({}, _this.state.draggingState), {}, {
|
|
171
|
+
mousePos: mousePos
|
|
172
|
+
})
|
|
173
|
+
});
|
|
174
|
+
_this.emitUpdate();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// 如需刷新拖拽装饰则派发事务
|
|
178
|
+
if (dispatchDecorationsTransaction) {
|
|
179
|
+
_this.editor.view.dispatch(_this.editor.state.tr.setMeta(tableHandlePluginKey, true));
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
_defineProperty(this, "dropHandler", function () {
|
|
183
|
+
_this.mouseState = 'up';
|
|
184
|
+
var st = _this.state;
|
|
185
|
+
if (!(st !== null && st !== void 0 && st.draggingState)) return false;
|
|
186
|
+
var draggingState = st.draggingState,
|
|
187
|
+
rowIndex = st.rowIndex,
|
|
188
|
+
colIndex = st.colIndex,
|
|
189
|
+
blockPos = st.blockPos;
|
|
190
|
+
if (typeof blockPos !== 'number' || blockPos < 0) return false;
|
|
191
|
+
if (draggingState.draggedCellOrientation === 'row' && rowIndex === undefined || draggingState.draggedCellOrientation === 'col' && colIndex === undefined) {
|
|
192
|
+
throw new Error('Attempted to drop table row or column, but no table block was hovered prior.');
|
|
193
|
+
}
|
|
194
|
+
var isRow = draggingState.draggedCellOrientation === 'row';
|
|
195
|
+
var orientation = isRow ? 'row' : 'column';
|
|
196
|
+
var destIndex = isRow ? rowIndex : colIndex;
|
|
197
|
+
var cellCoords = getIndexCoordinates({
|
|
198
|
+
editor: _this.editor,
|
|
199
|
+
index: draggingState.originalIndex,
|
|
200
|
+
orientation: orientation,
|
|
201
|
+
tablePos: blockPos
|
|
202
|
+
});
|
|
203
|
+
if (!cellCoords) return false;
|
|
204
|
+
var stateWithCellSel = selectCellsByCoords(_this.editor, blockPos, cellCoords, {
|
|
205
|
+
mode: 'state'
|
|
206
|
+
});
|
|
207
|
+
if (!stateWithCellSel) return false;
|
|
208
|
+
|
|
209
|
+
// mode 为 state 时 selectCellsByCoords 返回 EditorState,这里的断言是安全的
|
|
210
|
+
var editorState = stateWithCellSel;
|
|
211
|
+
var dispatch = function dispatch(tr) {
|
|
212
|
+
return _this.editor.view.dispatch(tr);
|
|
213
|
+
};
|
|
214
|
+
if (isRow) {
|
|
215
|
+
moveTableRow({
|
|
216
|
+
from: draggingState.originalIndex,
|
|
217
|
+
to: destIndex,
|
|
218
|
+
select: true,
|
|
219
|
+
pos: blockPos + 1
|
|
220
|
+
})(editorState, dispatch);
|
|
221
|
+
} else {
|
|
222
|
+
moveTableColumn({
|
|
223
|
+
from: draggingState.originalIndex,
|
|
224
|
+
to: destIndex,
|
|
225
|
+
select: true,
|
|
226
|
+
pos: blockPos + 1
|
|
227
|
+
})(editorState, dispatch);
|
|
228
|
+
}
|
|
229
|
+
_this.state = _objectSpread(_objectSpread({}, st), {}, {
|
|
230
|
+
draggingState: undefined
|
|
231
|
+
});
|
|
232
|
+
_this.emitUpdate();
|
|
233
|
+
_this.editor.view.dispatch(_this.editor.state.tr.setMeta(tableHandlePluginKey, null));
|
|
234
|
+
return true;
|
|
235
|
+
});
|
|
236
|
+
_defineProperty(this, "scrollHandler", function () {
|
|
237
|
+
var _this$state2, _this$tableElement;
|
|
238
|
+
// 滚动时若手柄可见则重新计算位置
|
|
239
|
+
if ((_this$state2 = _this.state) !== null && _this$state2 !== void 0 && _this$state2.show && (_this$tableElement = _this.tableElement) !== null && _this$tableElement !== void 0 && _this$tableElement.isConnected) {
|
|
240
|
+
// 强制刷新定位
|
|
241
|
+
_this.updatePositions();
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
this.editor = editor;
|
|
245
|
+
this.editorView = editorView;
|
|
246
|
+
this.emitUpdate = function () {
|
|
247
|
+
return _this.state && emitUpdate(_this.state);
|
|
248
|
+
};
|
|
249
|
+
this.editorView.dom.addEventListener('mousemove', this.mouseMoveHandler);
|
|
250
|
+
this.editorView.dom.addEventListener('mousedown', this.viewMousedownHandler);
|
|
251
|
+
window.addEventListener('mouseup', this.mouseUpHandler);
|
|
252
|
+
this.editorView.root.addEventListener('dragover', this.dragOverHandler);
|
|
253
|
+
this.editorView.root.addEventListener('drop', this.dropHandler);
|
|
254
|
+
|
|
255
|
+
// 监听滚动事件以更新手柄位置
|
|
256
|
+
window.addEventListener('scroll', this.scrollHandler, true);
|
|
257
|
+
// 同时监听窗口尺寸变化
|
|
258
|
+
window.addEventListener('resize', this.scrollHandler);
|
|
259
|
+
}
|
|
260
|
+
_createClass(TableHandleView, [{
|
|
261
|
+
key: "_getCachedHandleRects",
|
|
262
|
+
value:
|
|
263
|
+
// 获取缓存的手柄边界矩形,每100ms更新一次以提高性能
|
|
264
|
+
function _getCachedHandleRects() {
|
|
265
|
+
var _this$state3;
|
|
266
|
+
var now = Date.now();
|
|
267
|
+
if ((_this$state3 = this.state) !== null && _this$state3 !== void 0 && _this$state3._cachedHandleRects && this.state._cachedHandleRectsTime && now - this.state._cachedHandleRectsTime < 100) {
|
|
268
|
+
return this.state._cachedHandleRects;
|
|
269
|
+
}
|
|
270
|
+
var handleElements = Array.from(this.editorView.root.querySelectorAll('.tiptap-table-handle-menu, .tiptap-table-extend-row-column-button, .tiptap-table-add-button'));
|
|
271
|
+
var rects = handleElements.filter(isHTMLElement).map(function (el) {
|
|
272
|
+
return el.getBoundingClientRect();
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// 更新缓存
|
|
276
|
+
if (this.state) {
|
|
277
|
+
this.state._cachedHandleRects = rects;
|
|
278
|
+
this.state._cachedHandleRectsTime = now;
|
|
279
|
+
}
|
|
280
|
+
return rects;
|
|
281
|
+
}
|
|
282
|
+
}, {
|
|
283
|
+
key: "hideHandles",
|
|
284
|
+
value: function hideHandles() {
|
|
285
|
+
var _this$state4;
|
|
286
|
+
if (!((_this$state4 = this.state) !== null && _this$state4 !== void 0 && _this$state4.show)) return;
|
|
287
|
+
|
|
288
|
+
// 拖拽进行中保持手柄显示,保留拖拽状态
|
|
289
|
+
if (this.state.draggingState) return;
|
|
290
|
+
this.state = _objectSpread(_objectSpread({}, this.state), {}, {
|
|
291
|
+
show: false,
|
|
292
|
+
showAddOrRemoveRowsButton: false,
|
|
293
|
+
showAddOrRemoveColumnsButton: false,
|
|
294
|
+
colIndex: undefined,
|
|
295
|
+
rowIndex: undefined,
|
|
296
|
+
referencePosCell: undefined,
|
|
297
|
+
referencePosLastRow: undefined,
|
|
298
|
+
referencePosLastCol: undefined
|
|
299
|
+
});
|
|
300
|
+
this.emitUpdate();
|
|
301
|
+
}
|
|
302
|
+
}, {
|
|
303
|
+
key: "_handleMouseMoveNow",
|
|
304
|
+
value: function _handleMouseMoveNow(event) {
|
|
305
|
+
var _this$state5;
|
|
306
|
+
var around = domCellAround(event.target);
|
|
307
|
+
|
|
308
|
+
// 在单元格内拖拽选区时隐藏手柄
|
|
309
|
+
if ((around === null || around === void 0 ? void 0 : around.type) === 'cell' && this.mouseState === 'down' && !((_this$state5 = this.state) !== null && _this$state5 !== void 0 && _this$state5.draggingState)) {
|
|
310
|
+
this.mouseState = 'selecting';
|
|
311
|
+
this.hideHandles();
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (!around || !this.editor.isEditable) {
|
|
315
|
+
this.hideHandles();
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
var tbody = around.tbodyNode;
|
|
319
|
+
if (!tbody) return;
|
|
320
|
+
var tableRect = tbody.getBoundingClientRect();
|
|
321
|
+
var coords = this.editor.view.posAtCoords({
|
|
322
|
+
left: event.clientX,
|
|
323
|
+
top: event.clientY
|
|
324
|
+
});
|
|
325
|
+
if (!coords) return;
|
|
326
|
+
|
|
327
|
+
// 基于坐标解析当前所在的表格节点
|
|
328
|
+
var $pos = this.editor.view.state.doc.resolve(coords.pos);
|
|
329
|
+
var blockInfo;
|
|
330
|
+
for (var d = $pos.depth; d >= 0; d--) {
|
|
331
|
+
var node = $pos.node(d);
|
|
332
|
+
if (isTableNode(node)) {
|
|
333
|
+
blockInfo = {
|
|
334
|
+
node: node,
|
|
335
|
+
pos: d === 0 ? 0 : $pos.before(d)
|
|
336
|
+
};
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (!blockInfo || blockInfo.node.type.name !== 'table') return;
|
|
341
|
+
this.tableElement = this.editor.view.nodeDOM(blockInfo.pos);
|
|
342
|
+
this.tablePos = blockInfo.pos;
|
|
343
|
+
this.tableId = blockInfo.node.attrs.id;
|
|
344
|
+
var wrapper = safeClosest(around.domNode, '.tableWrapper');
|
|
345
|
+
var widgetContainer = wrapper === null || wrapper === void 0 ? void 0 : wrapper.querySelector(':scope > .table-controls');
|
|
346
|
+
|
|
347
|
+
// 悬停在表格外围(非单元格区域)
|
|
348
|
+
if (around.type === 'wrapper') {
|
|
349
|
+
var _this$state6, _nearestRowIndex, _this$state7, _nearestCellRect, _this$state8;
|
|
350
|
+
var below = event.clientY >= tableRect.bottom - 1 && event.clientY < tableRect.bottom + 20;
|
|
351
|
+
var right = event.clientX >= tableRect.right - 1 && event.clientX < tableRect.right + 20;
|
|
352
|
+
var cursorBeyondRightOrBottom = event.clientX > tableRect.right || event.clientY > tableRect.bottom;
|
|
353
|
+
|
|
354
|
+
// 悬停在边缘时预先计算扩展按钮位置
|
|
355
|
+
var referencePosLastRow;
|
|
356
|
+
var referencePosLastCol;
|
|
357
|
+
if (below || right) {
|
|
358
|
+
var _this$tableElement2;
|
|
359
|
+
var _tbody = (_this$tableElement2 = this.tableElement) === null || _this$tableElement2 === void 0 ? void 0 : _this$tableElement2.querySelector('tbody');
|
|
360
|
+
if (_tbody) {
|
|
361
|
+
var _blockInfo$node$conte, _blockInfo$node$conte2;
|
|
362
|
+
var lastRowIndex = blockInfo.node.content.childCount - 1;
|
|
363
|
+
var lastColIndex = ((_blockInfo$node$conte = (_blockInfo$node$conte2 = blockInfo.node.content.firstChild) === null || _blockInfo$node$conte2 === void 0 ? void 0 : _blockInfo$node$conte2.content.childCount) !== null && _blockInfo$node$conte !== void 0 ? _blockInfo$node$conte : 0) - 1;
|
|
364
|
+
if (below) {
|
|
365
|
+
var lastRow = _tbody.children[lastRowIndex];
|
|
366
|
+
if (lastRow) {
|
|
367
|
+
referencePosLastRow = lastRow.getBoundingClientRect();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
if (right) {
|
|
371
|
+
var maxRight = 0;
|
|
372
|
+
var lastColRect = null;
|
|
373
|
+
for (var i = 0; i < _tbody.children.length; i++) {
|
|
374
|
+
var row = _tbody.children[i];
|
|
375
|
+
if (row && row.children[lastColIndex]) {
|
|
376
|
+
var cell = row.children[lastColIndex];
|
|
377
|
+
var cellRect = cell.getBoundingClientRect();
|
|
378
|
+
if (cellRect.right > maxRight) {
|
|
379
|
+
maxRight = cellRect.right;
|
|
380
|
+
lastColRect = cellRect;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (lastColRect) {
|
|
385
|
+
var firstRow = _tbody.children[0];
|
|
386
|
+
var _lastRow = _tbody.children[lastRowIndex];
|
|
387
|
+
if (firstRow && _lastRow) {
|
|
388
|
+
var firstCell = firstRow.children[lastColIndex];
|
|
389
|
+
if (firstCell) {
|
|
390
|
+
var firstRect = firstCell.getBoundingClientRect();
|
|
391
|
+
referencePosLastCol = new DOMRect(lastColRect.right, firstRect.top, 0, _lastRow.getBoundingClientRect().bottom - firstRect.top);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// 尝试根据鼠标 Y 找到最近的行,并使用该行的首个单元格尺寸作为句柄参考,避免整行/整表尺寸
|
|
400
|
+
var nearestRowIndex;
|
|
401
|
+
var nearestCellRect;
|
|
402
|
+
if (!cursorBeyondRightOrBottom && tbody) {
|
|
403
|
+
var rows = Array.from(tbody.children);
|
|
404
|
+
var minDist = Number.POSITIVE_INFINITY;
|
|
405
|
+
rows.forEach(function (rowEl, idx) {
|
|
406
|
+
var rowRect = rowEl.getBoundingClientRect();
|
|
407
|
+
var dist = Math.abs(event.clientY - (rowRect.top + rowRect.height / 2));
|
|
408
|
+
if (dist < minDist) {
|
|
409
|
+
var _firstCell$getBoundin;
|
|
410
|
+
minDist = dist;
|
|
411
|
+
nearestRowIndex = idx;
|
|
412
|
+
var _firstCell = rowEl.children[0];
|
|
413
|
+
nearestCellRect = (_firstCell$getBoundin = _firstCell === null || _firstCell === void 0 ? void 0 : _firstCell.getBoundingClientRect()) !== null && _firstCell$getBoundin !== void 0 ? _firstCell$getBoundin : rowRect;
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
this.state = _objectSpread(_objectSpread({}, this.state), {}, {
|
|
418
|
+
show: true,
|
|
419
|
+
showAddOrRemoveRowsButton: below,
|
|
420
|
+
showAddOrRemoveColumnsButton: right,
|
|
421
|
+
referencePosTable: tableRect,
|
|
422
|
+
referencePosLastRow: referencePosLastRow,
|
|
423
|
+
referencePosLastCol: referencePosLastCol,
|
|
424
|
+
block: blockInfo.node,
|
|
425
|
+
blockPos: blockInfo.pos,
|
|
426
|
+
widgetContainer: widgetContainer,
|
|
427
|
+
colIndex: cursorBeyondRightOrBottom ? undefined : (_this$state6 = this.state) === null || _this$state6 === void 0 ? void 0 : _this$state6.colIndex,
|
|
428
|
+
rowIndex: cursorBeyondRightOrBottom ? undefined : (_nearestRowIndex = nearestRowIndex) !== null && _nearestRowIndex !== void 0 ? _nearestRowIndex : (_this$state7 = this.state) === null || _this$state7 === void 0 ? void 0 : _this$state7.rowIndex,
|
|
429
|
+
referencePosCell: cursorBeyondRightOrBottom ? undefined : (_nearestCellRect = nearestCellRect) !== null && _nearestCellRect !== void 0 ? _nearestCellRect : (_this$state8 = this.state) === null || _this$state8 === void 0 ? void 0 : _this$state8.referencePosCell
|
|
430
|
+
});
|
|
431
|
+
} else {
|
|
432
|
+
var _blockInfo$node$conte3, _blockInfo$node$conte4, _this$state9;
|
|
433
|
+
// 悬停在单元格上
|
|
434
|
+
var cellPosition = getCellIndicesFromDOM(around.domNode, blockInfo.node, this.editor);
|
|
435
|
+
if (!cellPosition) return;
|
|
436
|
+
var tbodyEl = around.tbodyNode;
|
|
437
|
+
var rowIndex = cellPosition.rowIndex,
|
|
438
|
+
colIndex = cellPosition.colIndex;
|
|
439
|
+
|
|
440
|
+
// 如果单元格跨行,map 计算的 rowIndex 会指向起始行;这里用 DOM 行索引兜底,保证手柄定位在实际行
|
|
441
|
+
var trEl = safeClosest(around.domNode, 'tr');
|
|
442
|
+
if (tbodyEl && trEl) {
|
|
443
|
+
var domRowIndex = Array.from(tbodyEl.children).indexOf(trEl);
|
|
444
|
+
if (domRowIndex >= 0 && domRowIndex !== rowIndex) {
|
|
445
|
+
rowIndex = domRowIndex;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
var _cellRect = around.domNode.getBoundingClientRect();
|
|
449
|
+
var map = TableMap.get(blockInfo.node);
|
|
450
|
+
var cellIndex = rowIndex * map.width + colIndex;
|
|
451
|
+
var cellOffset = map.map[cellIndex];
|
|
452
|
+
var rect = cellOffset !== undefined ? map.findCell(cellOffset) : null;
|
|
453
|
+
var effectiveCellRect = _cellRect;
|
|
454
|
+
|
|
455
|
+
// 如果单元格跨行,按鼠标所在行拆分高度,句柄高度限定为单行高度
|
|
456
|
+
if (rect && rect.bottom - rect.top > 1) {
|
|
457
|
+
var span = rect.bottom - rect.top;
|
|
458
|
+
var unitHeight = _cellRect.height / span;
|
|
459
|
+
var clampedY = clamp(event.clientY, _cellRect.top, _cellRect.bottom);
|
|
460
|
+
var rowOffset = Math.min(span - 1, Math.max(0, Math.floor((clampedY - _cellRect.top) / unitHeight)));
|
|
461
|
+
var rowTop = _cellRect.top + unitHeight * rowOffset;
|
|
462
|
+
rowIndex = rect.top + rowOffset;
|
|
463
|
+
effectiveCellRect = new DOMRect(_cellRect.x, rowTop, _cellRect.width, unitHeight);
|
|
464
|
+
} else if (trEl) {
|
|
465
|
+
var trRect = trEl.getBoundingClientRect();
|
|
466
|
+
effectiveCellRect = new DOMRect(_cellRect.x, trRect.y, _cellRect.width, trRect.height);
|
|
467
|
+
}
|
|
468
|
+
var _lastRowIndex = blockInfo.node.content.childCount - 1;
|
|
469
|
+
var _lastColIndex = ((_blockInfo$node$conte3 = (_blockInfo$node$conte4 = blockInfo.node.content.firstChild) === null || _blockInfo$node$conte4 === void 0 ? void 0 : _blockInfo$node$conte4.content.childCount) !== null && _blockInfo$node$conte3 !== void 0 ? _blockInfo$node$conte3 : 0) - 1;
|
|
470
|
+
|
|
471
|
+
// 与上次同一单元格则跳过
|
|
472
|
+
if ((_this$state9 = this.state) !== null && _this$state9 !== void 0 && _this$state9.show && this.tableId === blockInfo.node.attrs.id && this.state.rowIndex === rowIndex && this.state.colIndex === colIndex) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// 计算扩展按钮位置
|
|
477
|
+
var _referencePosLastRow;
|
|
478
|
+
var _referencePosLastCol;
|
|
479
|
+
if (rowIndex === _lastRowIndex || colIndex === _lastColIndex) {
|
|
480
|
+
var _this$tableElement3;
|
|
481
|
+
var _tbody2 = (_this$tableElement3 = this.tableElement) === null || _this$tableElement3 === void 0 ? void 0 : _this$tableElement3.querySelector('tbody');
|
|
482
|
+
if (_tbody2) {
|
|
483
|
+
// 记录末行位置
|
|
484
|
+
if (rowIndex === _lastRowIndex) {
|
|
485
|
+
var _lastRow2 = _tbody2.children[_lastRowIndex];
|
|
486
|
+
if (_lastRow2) {
|
|
487
|
+
_referencePosLastRow = _lastRow2.getBoundingClientRect();
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
// 记录末列位置
|
|
491
|
+
if (colIndex === _lastColIndex) {
|
|
492
|
+
// 在所有行里取最右侧单元格
|
|
493
|
+
var _maxRight = 0;
|
|
494
|
+
var _lastColRect = null;
|
|
495
|
+
for (var _i = 0; _i < _tbody2.children.length; _i++) {
|
|
496
|
+
var _row = _tbody2.children[_i];
|
|
497
|
+
if (_row && _row.children[_lastColIndex]) {
|
|
498
|
+
var _cell = _row.children[_lastColIndex];
|
|
499
|
+
var _cellRect2 = _cell.getBoundingClientRect();
|
|
500
|
+
if (_cellRect2.right > _maxRight) {
|
|
501
|
+
_maxRight = _cellRect2.right;
|
|
502
|
+
_lastColRect = _cellRect2;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
if (_lastColRect) {
|
|
507
|
+
// 生成代表整列的矩形
|
|
508
|
+
var _firstRow = _tbody2.children[0];
|
|
509
|
+
var _lastRow3 = _tbody2.children[_lastRowIndex];
|
|
510
|
+
if (_firstRow && _lastRow3) {
|
|
511
|
+
var _firstCell2 = _firstRow.children[_lastColIndex];
|
|
512
|
+
if (_firstCell2) {
|
|
513
|
+
var _firstRect = _firstCell2.getBoundingClientRect();
|
|
514
|
+
_referencePosLastCol = new DOMRect(_lastColRect.right, _firstRect.top, 0, _lastRow3.getBoundingClientRect().bottom - _firstRect.top);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
this.state = {
|
|
522
|
+
show: true,
|
|
523
|
+
showAddOrRemoveColumnsButton: colIndex === _lastColIndex,
|
|
524
|
+
showAddOrRemoveRowsButton: rowIndex === _lastRowIndex,
|
|
525
|
+
referencePosTable: tableRect,
|
|
526
|
+
referencePosLastRow: _referencePosLastRow,
|
|
527
|
+
referencePosLastCol: _referencePosLastCol,
|
|
528
|
+
block: blockInfo.node,
|
|
529
|
+
blockPos: blockInfo.pos,
|
|
530
|
+
draggingState: undefined,
|
|
531
|
+
referencePosCell: effectiveCellRect,
|
|
532
|
+
colIndex: colIndex,
|
|
533
|
+
rowIndex: rowIndex,
|
|
534
|
+
widgetContainer: widgetContainer
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
this.emitUpdate();
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
}, {
|
|
541
|
+
key: "update",
|
|
542
|
+
value: function update(view) {
|
|
543
|
+
var _this$state10, _this$tableElement4, _this$tableElement5;
|
|
544
|
+
var pluginState = tableHandlePluginKey.getState(view.state);
|
|
545
|
+
if (pluginState !== undefined && pluginState !== this.menuFrozen) {
|
|
546
|
+
this.menuFrozen = pluginState;
|
|
547
|
+
}
|
|
548
|
+
if (!((_this$state10 = this.state) !== null && _this$state10 !== void 0 && _this$state10.show)) return;
|
|
549
|
+
if (!((_this$tableElement4 = this.tableElement) !== null && _this$tableElement4 !== void 0 && _this$tableElement4.isConnected)) {
|
|
550
|
+
this.hideHandles();
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
var tableInfo = getTableFromDOM(this.tableElement, this.editor);
|
|
554
|
+
if (!tableInfo) {
|
|
555
|
+
this.hideHandles();
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// 检查表格是否已变更
|
|
560
|
+
var blockChanged = this.state.block !== tableInfo.node || this.state.blockPos !== tableInfo.pos;
|
|
561
|
+
if (!tableInfo.node || tableInfo.node.type.name !== 'table' || !((_this$tableElement5 = this.tableElement) !== null && _this$tableElement5 !== void 0 && _this$tableElement5.isConnected)) {
|
|
562
|
+
this.hideHandles();
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
var _TableMap$get = TableMap.get(tableInfo.node),
|
|
566
|
+
rowCount = _TableMap$get.height,
|
|
567
|
+
colCount = _TableMap$get.width;
|
|
568
|
+
|
|
569
|
+
// 计算新的行列索引
|
|
570
|
+
var newRowIndex = this.state.rowIndex;
|
|
571
|
+
var newColIndex = this.state.colIndex;
|
|
572
|
+
|
|
573
|
+
// 若删除了行/列则裁剪索引
|
|
574
|
+
if (newRowIndex !== undefined && newRowIndex >= rowCount) {
|
|
575
|
+
newRowIndex = rowCount ? rowCount - 1 : undefined;
|
|
576
|
+
}
|
|
577
|
+
if (newColIndex !== undefined && newColIndex >= colCount) {
|
|
578
|
+
newColIndex = colCount ? colCount - 1 : undefined;
|
|
579
|
+
}
|
|
580
|
+
var tableBody = this.tableElement.querySelector('tbody');
|
|
581
|
+
if (!tableBody) {
|
|
582
|
+
throw new Error("Table block does not contain a 'tbody' HTML element. This should never happen.");
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// 计算新的参考位置信息
|
|
586
|
+
var newReferencePosCell = this.state.referencePosCell;
|
|
587
|
+
if (newRowIndex !== undefined && newColIndex !== undefined) {
|
|
588
|
+
var rowEl = tableBody.children[newRowIndex];
|
|
589
|
+
var cellEl = rowEl === null || rowEl === void 0 ? void 0 : rowEl.children[newColIndex];
|
|
590
|
+
if (cellEl) {
|
|
591
|
+
var _this$state$draggingS2;
|
|
592
|
+
var newCellRect = cellEl.getBoundingClientRect();
|
|
593
|
+
// 拖拽时保持最初的单元格尺寸,避免高度抖动
|
|
594
|
+
if ((_this$state$draggingS2 = this.state.draggingState) !== null && _this$state$draggingS2 !== void 0 && _this$state$draggingS2.originalCellSize) {
|
|
595
|
+
newReferencePosCell = new DOMRect(newCellRect.x, newCellRect.y, this.state.draggingState.originalCellSize.width, this.state.draggingState.originalCellSize.height);
|
|
596
|
+
} else {
|
|
597
|
+
newReferencePosCell = newCellRect;
|
|
598
|
+
}
|
|
599
|
+
} else {
|
|
600
|
+
newRowIndex = undefined;
|
|
601
|
+
newColIndex = undefined;
|
|
602
|
+
newReferencePosCell = undefined;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
var newReferencePosTable = tableBody.getBoundingClientRect();
|
|
606
|
+
|
|
607
|
+
// 如需显示扩展按钮则刷新末行末列位置
|
|
608
|
+
var newReferencePosLastRow = this.state.referencePosLastRow;
|
|
609
|
+
var newReferencePosLastCol = this.state.referencePosLastCol;
|
|
610
|
+
if (this.state.showAddOrRemoveRowsButton || this.state.showAddOrRemoveColumnsButton) {
|
|
611
|
+
var _tableInfo$node$conte, _tableInfo$node$conte2;
|
|
612
|
+
var lastRowIndex = tableInfo.node.content.childCount - 1;
|
|
613
|
+
var lastColIndex = ((_tableInfo$node$conte = (_tableInfo$node$conte2 = tableInfo.node.content.firstChild) === null || _tableInfo$node$conte2 === void 0 ? void 0 : _tableInfo$node$conte2.content.childCount) !== null && _tableInfo$node$conte !== void 0 ? _tableInfo$node$conte : 0) - 1;
|
|
614
|
+
if (this.state.showAddOrRemoveRowsButton) {
|
|
615
|
+
var lastRow = tableBody.children[lastRowIndex];
|
|
616
|
+
if (lastRow) {
|
|
617
|
+
newReferencePosLastRow = lastRow.getBoundingClientRect();
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
if (this.state.showAddOrRemoveColumnsButton) {
|
|
621
|
+
var maxRight = 0;
|
|
622
|
+
var lastColRect = null;
|
|
623
|
+
for (var i = 0; i < tableBody.children.length; i++) {
|
|
624
|
+
var row = tableBody.children[i];
|
|
625
|
+
if (row && row.children[lastColIndex]) {
|
|
626
|
+
var cell = row.children[lastColIndex];
|
|
627
|
+
var cellRect = cell.getBoundingClientRect();
|
|
628
|
+
if (cellRect.right > maxRight) {
|
|
629
|
+
maxRight = cellRect.right;
|
|
630
|
+
lastColRect = cellRect;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
if (lastColRect) {
|
|
635
|
+
var firstRow = tableBody.children[0];
|
|
636
|
+
var _lastRow4 = tableBody.children[lastRowIndex];
|
|
637
|
+
if (firstRow && _lastRow4) {
|
|
638
|
+
var firstCell = firstRow.children[lastColIndex];
|
|
639
|
+
if (firstCell) {
|
|
640
|
+
var firstRect = firstCell.getBoundingClientRect();
|
|
641
|
+
newReferencePosLastCol = new DOMRect(lastColRect.right, firstRect.top, 0, _lastRow4.getBoundingClientRect().bottom - firstRect.top);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
// 若任一关键数据变化则推送更新
|
|
649
|
+
var indicesChanged = newRowIndex !== this.state.rowIndex || newColIndex !== this.state.colIndex;
|
|
650
|
+
var refPosChanged = newReferencePosCell !== this.state.referencePosCell || newReferencePosTable !== this.state.referencePosTable || newReferencePosLastRow !== this.state.referencePosLastRow || newReferencePosLastCol !== this.state.referencePosLastCol;
|
|
651
|
+
if (blockChanged || indicesChanged || refPosChanged) {
|
|
652
|
+
this.state = _objectSpread(_objectSpread({}, this.state), {}, {
|
|
653
|
+
block: tableInfo.node,
|
|
654
|
+
blockPos: tableInfo.pos,
|
|
655
|
+
rowIndex: newRowIndex,
|
|
656
|
+
colIndex: newColIndex,
|
|
657
|
+
referencePosCell: newReferencePosCell,
|
|
658
|
+
referencePosTable: newReferencePosTable,
|
|
659
|
+
referencePosLastRow: newReferencePosLastRow,
|
|
660
|
+
referencePosLastCol: newReferencePosLastCol
|
|
661
|
+
});
|
|
662
|
+
this.emitUpdate();
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}, {
|
|
666
|
+
key: "updatePositions",
|
|
667
|
+
value: function updatePositions() {
|
|
668
|
+
var _this$state11, _this$tableElement6;
|
|
669
|
+
if (!((_this$state11 = this.state) !== null && _this$state11 !== void 0 && _this$state11.show) || !((_this$tableElement6 = this.tableElement) !== null && _this$tableElement6 !== void 0 && _this$tableElement6.isConnected)) return;
|
|
670
|
+
var tableInfo = getTableFromDOM(this.tableElement, this.editor);
|
|
671
|
+
if (!tableInfo || tableInfo.node.type.name !== 'table') return;
|
|
672
|
+
var tableBody = this.tableElement.querySelector('tbody');
|
|
673
|
+
if (!tableBody) return;
|
|
674
|
+
var newReferencePosTable = tableBody.getBoundingClientRect();
|
|
675
|
+
|
|
676
|
+
// 若已有行列索引则同步单元格位置
|
|
677
|
+
var newReferencePosCell = this.state.referencePosCell;
|
|
678
|
+
if (this.state.rowIndex !== undefined && this.state.colIndex !== undefined) {
|
|
679
|
+
var rowEl = tableBody.children[this.state.rowIndex];
|
|
680
|
+
var cellEl = rowEl === null || rowEl === void 0 ? void 0 : rowEl.children[this.state.colIndex];
|
|
681
|
+
if (cellEl) {
|
|
682
|
+
var _this$state$draggingS3;
|
|
683
|
+
var newCellRect = cellEl.getBoundingClientRect();
|
|
684
|
+
// 拖拽时保留初始尺寸
|
|
685
|
+
if ((_this$state$draggingS3 = this.state.draggingState) !== null && _this$state$draggingS3 !== void 0 && _this$state$draggingS3.originalCellSize) {
|
|
686
|
+
newReferencePosCell = new DOMRect(newCellRect.x, newCellRect.y, this.state.draggingState.originalCellSize.width, this.state.draggingState.originalCellSize.height);
|
|
687
|
+
} else {
|
|
688
|
+
newReferencePosCell = newCellRect;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
// 如需显示扩展按钮则刷新末行末列位置
|
|
694
|
+
var newReferencePosLastRow = this.state.referencePosLastRow;
|
|
695
|
+
var newReferencePosLastCol = this.state.referencePosLastCol;
|
|
696
|
+
if (this.state.showAddOrRemoveRowsButton || this.state.showAddOrRemoveColumnsButton) {
|
|
697
|
+
var _tableInfo$node$conte3, _tableInfo$node$conte4;
|
|
698
|
+
var lastRowIndex = tableInfo.node.content.childCount - 1;
|
|
699
|
+
var lastColIndex = ((_tableInfo$node$conte3 = (_tableInfo$node$conte4 = tableInfo.node.content.firstChild) === null || _tableInfo$node$conte4 === void 0 ? void 0 : _tableInfo$node$conte4.content.childCount) !== null && _tableInfo$node$conte3 !== void 0 ? _tableInfo$node$conte3 : 0) - 1;
|
|
700
|
+
if (this.state.showAddOrRemoveRowsButton) {
|
|
701
|
+
var lastRow = tableBody.children[lastRowIndex];
|
|
702
|
+
if (lastRow) {
|
|
703
|
+
newReferencePosLastRow = lastRow.getBoundingClientRect();
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
if (this.state.showAddOrRemoveColumnsButton) {
|
|
707
|
+
var maxRight = 0;
|
|
708
|
+
var lastColRect = null;
|
|
709
|
+
for (var i = 0; i < tableBody.children.length; i++) {
|
|
710
|
+
var row = tableBody.children[i];
|
|
711
|
+
if (row && row.children[lastColIndex]) {
|
|
712
|
+
var cell = row.children[lastColIndex];
|
|
713
|
+
var cellRect = cell.getBoundingClientRect();
|
|
714
|
+
if (cellRect.right > maxRight) {
|
|
715
|
+
maxRight = cellRect.right;
|
|
716
|
+
lastColRect = cellRect;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
if (lastColRect) {
|
|
721
|
+
var firstRow = tableBody.children[0];
|
|
722
|
+
var _lastRow5 = tableBody.children[lastRowIndex];
|
|
723
|
+
if (firstRow && _lastRow5) {
|
|
724
|
+
var firstCell = firstRow.children[lastColIndex];
|
|
725
|
+
if (firstCell) {
|
|
726
|
+
var firstRect = firstCell.getBoundingClientRect();
|
|
727
|
+
newReferencePosLastCol = new DOMRect(lastColRect.right, firstRect.top, 0, _lastRow5.getBoundingClientRect().bottom - firstRect.top);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
// 对比具体属性,确认位置是否发生变化
|
|
735
|
+
var refPosChanged = !newReferencePosCell || !this.state.referencePosCell || newReferencePosCell.x !== this.state.referencePosCell.x || newReferencePosCell.y !== this.state.referencePosCell.y || newReferencePosTable.x !== this.state.referencePosTable.x || newReferencePosTable.y !== this.state.referencePosTable.y || newReferencePosLastRow && this.state.referencePosLastRow && (newReferencePosLastRow.x !== this.state.referencePosLastRow.x || newReferencePosLastRow.y !== this.state.referencePosLastRow.y) || newReferencePosLastCol && this.state.referencePosLastCol && (newReferencePosLastCol.x !== this.state.referencePosLastCol.x || newReferencePosLastCol.y !== this.state.referencePosLastCol.y);
|
|
736
|
+
if (refPosChanged) {
|
|
737
|
+
this.state = _objectSpread(_objectSpread({}, this.state), {}, {
|
|
738
|
+
referencePosCell: newReferencePosCell,
|
|
739
|
+
referencePosTable: newReferencePosTable,
|
|
740
|
+
referencePosLastRow: newReferencePosLastRow,
|
|
741
|
+
referencePosLastCol: newReferencePosLastCol
|
|
742
|
+
});
|
|
743
|
+
this.emitUpdate();
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
}, {
|
|
747
|
+
key: "destroy",
|
|
748
|
+
value: function destroy() {
|
|
749
|
+
this.editorView.dom.removeEventListener('mousemove', this.mouseMoveHandler);
|
|
750
|
+
window.removeEventListener('mouseup', this.mouseUpHandler);
|
|
751
|
+
this.editorView.dom.removeEventListener('mousedown', this.viewMousedownHandler);
|
|
752
|
+
this.editorView.root.removeEventListener('dragover', this.dragOverHandler);
|
|
753
|
+
this.editorView.root.removeEventListener('drop', this.dropHandler);
|
|
754
|
+
window.removeEventListener('scroll', this.scrollHandler, true);
|
|
755
|
+
window.removeEventListener('resize', this.scrollHandler);
|
|
756
|
+
}
|
|
757
|
+
}]);
|
|
758
|
+
return TableHandleView;
|
|
759
|
+
}();
|
|
760
|
+
var tableHandleView = null;
|
|
761
|
+
export function TableHandlePlugin(editor, emitUpdate) {
|
|
762
|
+
return new Plugin({
|
|
763
|
+
key: tableHandlePluginKey,
|
|
764
|
+
state: {
|
|
765
|
+
init: function init() {
|
|
766
|
+
return false;
|
|
767
|
+
},
|
|
768
|
+
apply: function apply(tr, frozen) {
|
|
769
|
+
var meta = tr.getMeta(tableHandlePluginKey);
|
|
770
|
+
return meta !== undefined ? meta : frozen;
|
|
771
|
+
}
|
|
772
|
+
},
|
|
773
|
+
view: function view(editorView) {
|
|
774
|
+
tableHandleView = new TableHandleView(editor, editorView, emitUpdate);
|
|
775
|
+
return tableHandleView;
|
|
776
|
+
},
|
|
777
|
+
props: {
|
|
778
|
+
decorations: function decorations(state) {
|
|
779
|
+
if (!tableHandleView) return null;
|
|
780
|
+
if (tableHandleView === undefined || tableHandleView.state === undefined || tableHandleView.state.draggingState === undefined || tableHandleView.tablePos === undefined) {
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
var newIndex = tableHandleView.state.draggingState.draggedCellOrientation === 'row' ? tableHandleView.state.rowIndex : tableHandleView.state.colIndex;
|
|
784
|
+
if (newIndex === undefined) {
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
var decorations = [];
|
|
788
|
+
var draggingState = tableHandleView.state.draggingState;
|
|
789
|
+
var originalIndex = draggingState.originalIndex;
|
|
790
|
+
if (tableHandleView.state.draggingState.draggedCellOrientation === 'row') {
|
|
791
|
+
var originalCells = getRowCells(editor, originalIndex, tableHandleView.state.blockPos);
|
|
792
|
+
originalCells.cells.forEach(function (cell) {
|
|
793
|
+
if (cell.node) {
|
|
794
|
+
decorations.push(Decoration.node(cell.pos, cell.pos + cell.node.nodeSize, {
|
|
795
|
+
class: 'table-cell-dragging-source'
|
|
796
|
+
}));
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
} else {
|
|
800
|
+
var _originalCells = getColumnCells(editor, originalIndex, tableHandleView.state.blockPos);
|
|
801
|
+
_originalCells.cells.forEach(function (cell) {
|
|
802
|
+
if (cell.node) {
|
|
803
|
+
decorations.push(Decoration.node(cell.pos, cell.pos + cell.node.nodeSize, {
|
|
804
|
+
class: 'table-cell-dragging-source'
|
|
805
|
+
}));
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// 若无变更或 editor 不存在,直接返回已有装饰
|
|
811
|
+
if (newIndex === originalIndex || !editor) {
|
|
812
|
+
return DecorationSet.create(state.doc, decorations);
|
|
813
|
+
}
|
|
814
|
+
if (tableHandleView.state.draggingState.draggedCellOrientation === 'row') {
|
|
815
|
+
var cellsInRow = getRowCells(editor, newIndex, tableHandleView.state.blockPos);
|
|
816
|
+
cellsInRow.cells.forEach(function (cell) {
|
|
817
|
+
var cellNode = cell.node;
|
|
818
|
+
if (!cellNode) {
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
// 根据拖动方向在单元格首尾插入装饰
|
|
823
|
+
var decorationPos = cell.pos + (newIndex > originalIndex ? cellNode.nodeSize - 2 : 2);
|
|
824
|
+
decorations.push(Decoration.widget(decorationPos, function () {
|
|
825
|
+
var widget = document.createElement('div');
|
|
826
|
+
widget.className = 'tiptap-table-dropcursor';
|
|
827
|
+
widget.style.position = 'absolute';
|
|
828
|
+
widget.style.left = '0';
|
|
829
|
+
widget.style.right = '0';
|
|
830
|
+
widget.style.zIndex = '20';
|
|
831
|
+
widget.style.pointerEvents = 'none';
|
|
832
|
+
// 处理奇偶像素差,避免行插入指示线的视觉偏差
|
|
833
|
+
if (newIndex > originalIndex) {
|
|
834
|
+
widget.style.bottom = '-1px';
|
|
835
|
+
} else {
|
|
836
|
+
widget.style.top = '-1px';
|
|
837
|
+
}
|
|
838
|
+
widget.style.height = '3px';
|
|
839
|
+
widget.style.backgroundColor = 'var(--mui-palette-primary-main, #1976d2)';
|
|
840
|
+
return widget;
|
|
841
|
+
}));
|
|
842
|
+
});
|
|
843
|
+
} else {
|
|
844
|
+
var cellsInColumn = getColumnCells(editor, newIndex, tableHandleView.state.blockPos);
|
|
845
|
+
cellsInColumn.cells.forEach(function (cell) {
|
|
846
|
+
var cellNode = cell.node;
|
|
847
|
+
if (!cellNode) {
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
// 根据拖动方向在单元格首尾插入装饰
|
|
851
|
+
var decorationPos = cell.pos + (newIndex > originalIndex ? cellNode.nodeSize - 2 : 2);
|
|
852
|
+
decorations.push(Decoration.widget(decorationPos, function () {
|
|
853
|
+
var widget = document.createElement('div');
|
|
854
|
+
widget.className = 'tiptap-table-dropcursor';
|
|
855
|
+
widget.style.position = 'absolute';
|
|
856
|
+
widget.style.top = '0';
|
|
857
|
+
widget.style.bottom = '0';
|
|
858
|
+
widget.style.zIndex = '20';
|
|
859
|
+
widget.style.pointerEvents = 'none';
|
|
860
|
+
// 处理奇偶像素差,避免列插入指示线的视觉偏差
|
|
861
|
+
if (newIndex > originalIndex) {
|
|
862
|
+
widget.style.right = '-1px';
|
|
863
|
+
} else {
|
|
864
|
+
widget.style.left = '-1px';
|
|
865
|
+
}
|
|
866
|
+
widget.style.width = '3px';
|
|
867
|
+
widget.style.backgroundColor = 'var(--mui-palette-primary-main, #1976d2)';
|
|
868
|
+
return widget;
|
|
869
|
+
}));
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
return DecorationSet.create(state.doc, decorations);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/** 行/列通用的拖拽起始处理 */
|
|
879
|
+
var tableDragStart = function tableDragStart(orientation, event) {
|
|
880
|
+
var _tableHandleView;
|
|
881
|
+
// 若状态不存在,尝试从 DOM 或 data 属性恢复
|
|
882
|
+
if (!((_tableHandleView = tableHandleView) !== null && _tableHandleView !== void 0 && _tableHandleView.state)) {
|
|
883
|
+
var _tableHandleView2, _tableHandleView3;
|
|
884
|
+
var handleElement = event.currentTarget;
|
|
885
|
+
|
|
886
|
+
// 优先使用组件写入的 data 属性恢复
|
|
887
|
+
var dataIndex = handleElement.dataset.tableIndex;
|
|
888
|
+
var dataTablePos = handleElement.dataset.tablePos;
|
|
889
|
+
var dataTableId = handleElement.dataset.tableId;
|
|
890
|
+
if (dataIndex && dataTablePos && tableHandleView) {
|
|
891
|
+
var _index = parseInt(dataIndex, 10);
|
|
892
|
+
var _blockPos = parseInt(dataTablePos, 10);
|
|
893
|
+
if (!isNaN(_index) && !isNaN(_blockPos)) {
|
|
894
|
+
// 尝试找到对应表格节点
|
|
895
|
+
var tableNode = tableHandleView.editor.state.doc.nodeAt(_blockPos);
|
|
896
|
+
if (tableNode && isTableNode(tableNode)) {
|
|
897
|
+
var tableWrapper = safeClosest(handleElement, '.tableWrapper');
|
|
898
|
+
var tbody = tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.querySelector('tbody');
|
|
899
|
+
if (tbody) {
|
|
900
|
+
var tableRect = tbody.getBoundingClientRect();
|
|
901
|
+
|
|
902
|
+
// 构造最小拖拽状态
|
|
903
|
+
var recoveredState = {
|
|
904
|
+
show: true,
|
|
905
|
+
showAddOrRemoveRowsButton: false,
|
|
906
|
+
showAddOrRemoveColumnsButton: false,
|
|
907
|
+
referencePosTable: tableRect,
|
|
908
|
+
block: tableNode,
|
|
909
|
+
blockPos: _blockPos,
|
|
910
|
+
colIndex: orientation === 'col' ? _index : undefined,
|
|
911
|
+
rowIndex: orientation === 'row' ? _index : undefined,
|
|
912
|
+
referencePosCell: undefined,
|
|
913
|
+
widgetContainer: undefined
|
|
914
|
+
};
|
|
915
|
+
tableHandleView.state = recoveredState;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
// 若仍无状态,再尝试基于 DOM 恢复
|
|
922
|
+
if (!((_tableHandleView2 = tableHandleView) !== null && _tableHandleView2 !== void 0 && _tableHandleView2.state)) {
|
|
923
|
+
var _tableWrapper = safeClosest(handleElement, '.tableWrapper');
|
|
924
|
+
if (!_tableWrapper || !tableHandleView) {
|
|
925
|
+
// 无法恢复则静默取消拖拽
|
|
926
|
+
if (event.dataTransfer) {
|
|
927
|
+
event.dataTransfer.effectAllowed = 'none';
|
|
928
|
+
}
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
// 基于 DOM 获取表格信息
|
|
933
|
+
var tableInfo = getTableFromDOM(_tableWrapper, tableHandleView.editor);
|
|
934
|
+
if (!tableInfo) {
|
|
935
|
+
if (event.dataTransfer) {
|
|
936
|
+
event.dataTransfer.effectAllowed = 'none';
|
|
937
|
+
}
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// 构建基础状态
|
|
942
|
+
var _tbody3 = _tableWrapper.querySelector('tbody');
|
|
943
|
+
if (!_tbody3) {
|
|
944
|
+
if (event.dataTransfer) {
|
|
945
|
+
event.dataTransfer.effectAllowed = 'none';
|
|
946
|
+
}
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
// 通过手柄位置估算索引(兜底方案)
|
|
951
|
+
var _tableRect = _tbody3.getBoundingClientRect();
|
|
952
|
+
var handleRect = handleElement.getBoundingClientRect();
|
|
953
|
+
|
|
954
|
+
// 通过坐标粗略推算索引,避免报错
|
|
955
|
+
var approximateIndex = 0;
|
|
956
|
+
if (orientation === 'row') {
|
|
957
|
+
var rowHeight = _tableRect.height / tableInfo.node.content.childCount;
|
|
958
|
+
approximateIndex = Math.floor((handleRect.top - _tableRect.top) / rowHeight);
|
|
959
|
+
} else {
|
|
960
|
+
var _tableInfo$node$conte5, _tableInfo$node$conte6;
|
|
961
|
+
var colWidth = _tableRect.width / ((_tableInfo$node$conte5 = (_tableInfo$node$conte6 = tableInfo.node.content.firstChild) === null || _tableInfo$node$conte6 === void 0 ? void 0 : _tableInfo$node$conte6.content.childCount) !== null && _tableInfo$node$conte5 !== void 0 ? _tableInfo$node$conte5 : 1);
|
|
962
|
+
approximateIndex = Math.floor((handleRect.left - _tableRect.left) / colWidth);
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
// 构造最小拖拽状态
|
|
966
|
+
var _recoveredState = {
|
|
967
|
+
show: true,
|
|
968
|
+
showAddOrRemoveRowsButton: false,
|
|
969
|
+
showAddOrRemoveColumnsButton: false,
|
|
970
|
+
referencePosTable: _tableRect,
|
|
971
|
+
block: tableInfo.node,
|
|
972
|
+
blockPos: tableInfo.pos,
|
|
973
|
+
colIndex: orientation === 'col' ? approximateIndex : undefined,
|
|
974
|
+
rowIndex: orientation === 'row' ? approximateIndex : undefined,
|
|
975
|
+
referencePosCell: undefined,
|
|
976
|
+
widgetContainer: undefined
|
|
977
|
+
};
|
|
978
|
+
tableHandleView.state = _recoveredState;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
// 最终仍无状态则取消拖拽
|
|
982
|
+
if (!((_tableHandleView3 = tableHandleView) !== null && _tableHandleView3 !== void 0 && _tableHandleView3.state)) {
|
|
983
|
+
if (event.dataTransfer) {
|
|
984
|
+
event.dataTransfer.effectAllowed = 'none';
|
|
985
|
+
}
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
var _tableHandleView4 = tableHandleView,
|
|
990
|
+
state = _tableHandleView4.state,
|
|
991
|
+
editor = _tableHandleView4.editor;
|
|
992
|
+
var index = orientation === 'col' ? state.colIndex : state.rowIndex;
|
|
993
|
+
if (index === undefined) {
|
|
994
|
+
// 无法确定索引,静默取消
|
|
995
|
+
if (event.dataTransfer) {
|
|
996
|
+
event.dataTransfer.effectAllowed = 'none';
|
|
997
|
+
}
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
var blockPos = state.blockPos,
|
|
1001
|
+
referencePosCell = state.referencePosCell;
|
|
1002
|
+
var mousePos = orientation === 'col' ? event.clientX : event.clientY;
|
|
1003
|
+
|
|
1004
|
+
// 清除单元格选区,避免表格引用塌缩
|
|
1005
|
+
if (editor.state.selection instanceof CellSelection) {
|
|
1006
|
+
var safeSel = TextSelection.near(editor.state.doc.resolve(blockPos), 1);
|
|
1007
|
+
editor.view.dispatch(editor.state.tr.setSelection(safeSel));
|
|
1008
|
+
}
|
|
1009
|
+
var dragImage = createTableDragImage(editor, orientation, index, blockPos);
|
|
1010
|
+
|
|
1011
|
+
// 配置拖拽预览图
|
|
1012
|
+
if (event.dataTransfer) {
|
|
1013
|
+
var _handleRect = event.currentTarget.getBoundingClientRect();
|
|
1014
|
+
var offset = orientation === 'col' ? {
|
|
1015
|
+
x: _handleRect.width / 2,
|
|
1016
|
+
y: 0
|
|
1017
|
+
} : {
|
|
1018
|
+
x: 0,
|
|
1019
|
+
y: _handleRect.height / 2
|
|
1020
|
+
};
|
|
1021
|
+
event.dataTransfer.effectAllowed = orientation === 'col' ? 'move' : 'copyMove';
|
|
1022
|
+
event.dataTransfer.setDragImage(dragImage, offset.x, offset.y);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
// 清理拖拽预览图
|
|
1026
|
+
var cleanup = function cleanup() {
|
|
1027
|
+
var _dragImage$parentNode;
|
|
1028
|
+
return (_dragImage$parentNode = dragImage.parentNode) === null || _dragImage$parentNode === void 0 ? void 0 : _dragImage$parentNode.removeChild(dragImage);
|
|
1029
|
+
};
|
|
1030
|
+
document.addEventListener('drop', cleanup, {
|
|
1031
|
+
once: true
|
|
1032
|
+
});
|
|
1033
|
+
document.addEventListener('dragend', cleanup, {
|
|
1034
|
+
once: true
|
|
1035
|
+
});
|
|
1036
|
+
var initialOffset = referencePosCell ? (orientation === 'col' ? referencePosCell.left : referencePosCell.top) - mousePos : 0;
|
|
1037
|
+
|
|
1038
|
+
// 记录原始单元格尺寸,拖拽中保持不变
|
|
1039
|
+
var originalCellSize = referencePosCell ? {
|
|
1040
|
+
width: referencePosCell.width,
|
|
1041
|
+
height: referencePosCell.height
|
|
1042
|
+
} : undefined;
|
|
1043
|
+
|
|
1044
|
+
// 写回拖拽状态
|
|
1045
|
+
tableHandleView.state = _objectSpread(_objectSpread({}, state), {}, {
|
|
1046
|
+
draggingState: {
|
|
1047
|
+
draggedCellOrientation: orientation,
|
|
1048
|
+
originalIndex: index,
|
|
1049
|
+
mousePos: mousePos,
|
|
1050
|
+
initialOffset: initialOffset,
|
|
1051
|
+
originalCellSize: originalCellSize
|
|
1052
|
+
}
|
|
1053
|
+
});
|
|
1054
|
+
tableHandleView.emitUpdate();
|
|
1055
|
+
editor.view.dispatch(editor.state.tr.setMeta(tableHandlePluginKey, true));
|
|
1056
|
+
};
|
|
1057
|
+
|
|
1058
|
+
/** 列拖拽句柄回调 */
|
|
1059
|
+
export var colDragStart = function colDragStart(event) {
|
|
1060
|
+
return tableDragStart('col', _objectSpread(_objectSpread({}, event), {}, {
|
|
1061
|
+
clientY: 0
|
|
1062
|
+
}));
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
/** 行拖拽句柄回调 */
|
|
1066
|
+
export var rowDragStart = function rowDragStart(event) {
|
|
1067
|
+
return tableDragStart('row', _objectSpread(_objectSpread({}, event), {}, {
|
|
1068
|
+
clientX: 0
|
|
1069
|
+
}));
|
|
1070
|
+
};
|
|
1071
|
+
|
|
1072
|
+
/** 拖拽结束后的清理 */
|
|
1073
|
+
export var dragEnd = function dragEnd() {
|
|
1074
|
+
if (!tableHandleView || tableHandleView.state === undefined) {
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
tableHandleView.state = _objectSpread(_objectSpread({}, tableHandleView.state), {}, {
|
|
1078
|
+
draggingState: undefined
|
|
1079
|
+
});
|
|
1080
|
+
tableHandleView.emitUpdate();
|
|
1081
|
+
var editor = tableHandleView.editor;
|
|
1082
|
+
editor.view.dispatch(editor.state.tr.setMeta(tableHandlePluginKey, null));
|
|
1083
|
+
};
|