@atlaskit/editor-core 172.1.1 → 172.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/cjs/analytics-api/api.js +38 -0
- package/dist/cjs/analytics-api/attach-payload-into-transaction.js +36 -0
- package/dist/cjs/analytics-api/editor-state-context.js +96 -0
- package/dist/cjs/analytics-api/map-attributes.js +30 -0
- package/dist/cjs/create-editor/ReactEditorView.js +47 -6
- package/dist/cjs/create-editor/ReactEditorViewContext.js +2 -6
- package/dist/cjs/create-editor/create-plugins-list.js +12 -3
- package/dist/cjs/event-dispatcher/index.js +12 -81
- package/dist/cjs/insert-api/api.js +48 -0
- package/dist/cjs/insert-api/insert-content-handlers.js +101 -0
- package/dist/cjs/insert-api/insert-node-helpers.js +157 -0
- package/dist/cjs/{plugins/analytics/types/avatar.js → insert-api/types.js} +0 -0
- package/dist/cjs/keymaps/index.js +437 -288
- package/dist/cjs/messages.js +8 -125
- package/dist/cjs/plugins/analytics/index.js +26 -26
- package/dist/cjs/plugins/analytics/types/enums.js +49 -344
- package/dist/cjs/plugins/analytics/types/extension-events.js +19 -26
- package/dist/cjs/plugins/analytics/types/general-events.js +25 -34
- package/dist/cjs/plugins/analytics/types/index.js +10 -56
- package/dist/cjs/plugins/analytics/types/inline-comment-events.js +7 -8
- package/dist/cjs/plugins/analytics/types/node-events.js +13 -20
- package/dist/cjs/plugins/analytics/types/smart-links.js +8 -14
- package/dist/cjs/plugins/analytics/types/toolbar-button.js +7 -20
- package/dist/cjs/plugins/analytics/utils.js +37 -127
- package/dist/cjs/plugins/expand/utils.js +18 -45
- package/dist/cjs/plugins/extension/actions.js +10 -30
- package/dist/cjs/plugins/extension/ui/Extension/styles.js +18 -8
- package/dist/cjs/plugins/insert-block/index.js +1 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +31 -22
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +6 -170
- package/dist/cjs/plugins/layout/styles.js +14 -6
- package/dist/cjs/plugins/layout/utils.js +25 -66
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +10 -0
- package/dist/cjs/plugins/paste/handlers.js +19 -15
- package/dist/cjs/plugins/paste/util/index.js +30 -1
- package/dist/cjs/plugins/selection/gap-cursor/selection.js +23 -188
- package/dist/cjs/plugins/selection/gap-cursor/utils/is-ignored.js +7 -8
- package/dist/cjs/plugins/selection/gap-cursor/utils/is-valid-target-node.js +7 -8
- package/dist/cjs/plugins/selection/gap-cursor/utils.js +6 -6
- package/dist/cjs/plugins/selection/gap-cursor-selection.js +1 -1
- package/dist/cjs/plugins/selection/types.js +9 -11
- package/dist/cjs/plugins/selection/utils.js +2 -2
- package/dist/cjs/plugins/table/commands/go-to-next-cell.js +40 -38
- package/dist/cjs/plugins/table/commands/insert.js +57 -49
- package/dist/cjs/plugins/table/commands/selection.js +302 -218
- package/dist/cjs/plugins/table/commands-with-analytics.js +241 -219
- package/dist/cjs/plugins/table/event-handlers.js +60 -60
- package/dist/cjs/plugins/table/index.js +64 -20
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +20 -22
- package/dist/cjs/plugins/table/nodeviews/table.js +19 -11
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +11 -13
- package/dist/cjs/plugins/table/nodeviews/update-overflow-shadows.js +25 -25
- package/dist/cjs/plugins/table/pm-plugins/keymap.js +15 -13
- package/dist/cjs/plugins/table/pm-plugins/main.js +8 -8
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +4 -8
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +2 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +7 -10
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +30 -28
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +4 -7
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +3 -2
- package/dist/cjs/plugins/table/pm-plugins/table-selection-keymap.js +3 -3
- package/dist/cjs/plugins/table/toolbar.js +74 -72
- package/dist/cjs/plugins/table/transforms/column-width.js +41 -38
- package/dist/cjs/plugins/table/transforms/replace-table.js +4 -4
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +2 -4
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +25 -21
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +6 -2
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +7 -4
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +12 -11
- package/dist/cjs/plugins/table/ui/LayoutButton/index.js +2 -2
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +4 -6
- package/dist/cjs/plugins/table/ui/common-styles.js +3 -3
- package/dist/cjs/plugins/table/utils/analytics.js +26 -1
- package/dist/cjs/plugins/table/utils/index.js +0 -6
- package/dist/cjs/selection-api/api.js +34 -0
- package/dist/cjs/types/browser.js +1 -2
- package/dist/cjs/ui/ColorPalette/Color/index.js +2 -106
- package/dist/cjs/ui/ColorPalette/Palettes/cellBackgroundColorPalette.js +2 -21
- package/dist/cjs/ui/ColorPalette/Palettes/common.js +7 -25
- package/dist/cjs/ui/ColorPalette/Palettes/paletteMessages.js +2 -114
- package/dist/cjs/ui/ColorPalette/Palettes/panelBackgroundPalette.js +12 -152
- package/dist/cjs/ui/ColorPalette/Palettes/statusColorPalette.js +13 -61
- package/dist/cjs/ui/ColorPalette/Palettes/textColorPalette.js +12 -34
- package/dist/cjs/ui/ColorPalette/index.js +2 -76
- package/dist/cjs/ui/Dropdown/index.js +3 -119
- package/dist/cjs/ui/DropdownMenu/index.js +3 -286
- package/dist/cjs/ui/Toolbar/types.js +19 -33
- package/dist/cjs/ui/ToolbarButton/index.js +8 -120
- package/dist/cjs/ui/WithPluginState/index.js +1 -3
- package/dist/cjs/ui/styles.js +35 -27
- package/dist/cjs/ui/with-outer-listeners.js +4 -152
- package/dist/cjs/utils/dom.js +46 -123
- package/dist/cjs/utils/index.js +40 -42
- package/dist/cjs/utils/node-width.js +7 -79
- package/dist/cjs/utils/nodes.js +57 -124
- package/dist/cjs/utils/plugin-state-factory.js +7 -107
- package/dist/cjs/utils/selection.js +11 -62
- package/dist/cjs/utils/slice.js +28 -68
- package/dist/cjs/utils/step.js +18 -46
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics-api/api.js +30 -0
- package/dist/es2019/analytics-api/attach-payload-into-transaction.js +25 -0
- package/dist/es2019/analytics-api/editor-state-context.js +85 -0
- package/dist/es2019/analytics-api/map-attributes.js +14 -0
- package/dist/es2019/create-editor/ReactEditorView.js +33 -4
- package/dist/es2019/create-editor/ReactEditorViewContext.js +1 -2
- package/dist/es2019/create-editor/create-plugins-list.js +13 -4
- package/dist/es2019/event-dispatcher/index.js +1 -60
- package/dist/es2019/insert-api/api.js +43 -0
- package/dist/es2019/insert-api/insert-content-handlers.js +85 -0
- package/dist/es2019/insert-api/insert-node-helpers.js +149 -0
- package/dist/es2019/{plugins/analytics/types/avatar.js → insert-api/types.js} +0 -0
- package/dist/es2019/keymaps/index.js +1 -186
- package/dist/es2019/messages.js +2 -123
- package/dist/es2019/plugins/analytics/index.js +1 -1
- package/dist/es2019/plugins/analytics/types/enums.js +1 -336
- package/dist/es2019/plugins/analytics/types/extension-events.js +1 -22
- package/dist/es2019/plugins/analytics/types/general-events.js +1 -30
- package/dist/es2019/plugins/analytics/types/index.js +1 -6
- package/dist/es2019/plugins/analytics/types/inline-comment-events.js +1 -7
- package/dist/es2019/plugins/analytics/types/node-events.js +1 -18
- package/dist/es2019/plugins/analytics/types/smart-links.js +1 -12
- package/dist/es2019/plugins/analytics/types/toolbar-button.js +1 -19
- package/dist/es2019/plugins/analytics/utils.js +12 -113
- package/dist/es2019/plugins/expand/utils.js +1 -36
- package/dist/es2019/plugins/extension/actions.js +1 -26
- package/dist/es2019/plugins/extension/ui/Extension/styles.js +2 -3
- package/dist/es2019/plugins/insert-block/index.js +1 -0
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -12
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +1 -168
- package/dist/es2019/plugins/layout/styles.js +2 -3
- package/dist/es2019/plugins/layout/utils.js +1 -54
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +10 -0
- package/dist/es2019/plugins/paste/handlers.js +8 -4
- package/dist/es2019/plugins/paste/util/index.js +23 -0
- package/dist/es2019/plugins/selection/gap-cursor/selection.js +1 -136
- package/dist/es2019/plugins/selection/gap-cursor/utils/is-ignored.js +1 -5
- package/dist/es2019/plugins/selection/gap-cursor/utils/is-valid-target-node.js +1 -4
- package/dist/es2019/plugins/selection/gap-cursor/utils.js +4 -4
- package/dist/es2019/plugins/selection/gap-cursor-selection.js +1 -1
- package/dist/es2019/plugins/selection/types.js +2 -9
- package/dist/es2019/plugins/selection/utils.js +1 -1
- package/dist/es2019/plugins/table/commands/go-to-next-cell.js +4 -4
- package/dist/es2019/plugins/table/commands/insert.js +26 -24
- package/dist/es2019/plugins/table/commands/selection.js +109 -51
- package/dist/es2019/plugins/table/commands-with-analytics.js +39 -38
- package/dist/es2019/plugins/table/event-handlers.js +6 -7
- package/dist/es2019/plugins/table/index.js +56 -16
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +11 -12
- package/dist/es2019/plugins/table/nodeviews/table.js +18 -8
- package/dist/es2019/plugins/table/nodeviews/tableCell.js +2 -3
- package/dist/es2019/plugins/table/nodeviews/update-overflow-shadows.js +3 -4
- package/dist/es2019/plugins/table/pm-plugins/keymap.js +13 -12
- package/dist/es2019/plugins/table/pm-plugins/main.js +8 -8
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +4 -6
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin.js +2 -2
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +7 -8
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +2 -2
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +4 -4
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +3 -2
- package/dist/es2019/plugins/table/pm-plugins/table-selection-keymap.js +3 -3
- package/dist/es2019/plugins/table/toolbar.js +24 -24
- package/dist/es2019/plugins/table/transforms/column-width.js +3 -2
- package/dist/es2019/plugins/table/transforms/replace-table.js +4 -4
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +2 -2
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +19 -16
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +6 -2
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +8 -4
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +9 -6
- package/dist/es2019/plugins/table/ui/LayoutButton/index.js +2 -2
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +2 -3
- package/dist/es2019/plugins/table/ui/common-styles.js +1 -1
- package/dist/es2019/plugins/table/utils/analytics.js +16 -1
- package/dist/es2019/plugins/table/utils/index.js +1 -1
- package/dist/es2019/selection-api/api.js +22 -0
- package/dist/es2019/types/browser.js +0 -1
- package/dist/es2019/ui/ColorPalette/Color/index.js +1 -66
- package/dist/es2019/ui/ColorPalette/Palettes/cellBackgroundColorPalette.js +1 -14
- package/dist/es2019/ui/ColorPalette/Palettes/common.js +1 -20
- package/dist/es2019/ui/ColorPalette/Palettes/paletteMessages.js +2 -113
- package/dist/es2019/ui/ColorPalette/Palettes/panelBackgroundPalette.js +1 -137
- package/dist/es2019/ui/ColorPalette/Palettes/statusColorPalette.js +1 -51
- package/dist/es2019/ui/ColorPalette/Palettes/textColorPalette.js +1 -25
- package/dist/es2019/ui/ColorPalette/index.js +2 -62
- package/dist/es2019/ui/Dropdown/index.js +2 -84
- package/dist/es2019/ui/DropdownMenu/index.js +2 -244
- package/dist/es2019/ui/Toolbar/types.js +1 -30
- package/dist/es2019/ui/ToolbarButton/index.js +2 -94
- package/dist/es2019/ui/WithPluginState/index.js +1 -1
- package/dist/es2019/ui/styles.js +9 -47
- package/dist/es2019/ui/with-outer-listeners.js +2 -104
- package/dist/es2019/utils/dom.js +1 -113
- package/dist/es2019/utils/index.js +2 -21
- package/dist/es2019/utils/node-width.js +1 -75
- package/dist/es2019/utils/nodes.js +1 -88
- package/dist/es2019/utils/plugin-state-factory.js +1 -107
- package/dist/es2019/utils/selection.js +2 -52
- package/dist/es2019/utils/slice.js +1 -56
- package/dist/es2019/utils/step.js +1 -35
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics-api/api.js +27 -0
- package/dist/esm/analytics-api/attach-payload-into-transaction.js +22 -0
- package/dist/esm/analytics-api/editor-state-context.js +81 -0
- package/dist/esm/analytics-api/map-attributes.js +20 -0
- package/dist/esm/create-editor/ReactEditorView.js +44 -6
- package/dist/esm/create-editor/ReactEditorViewContext.js +1 -2
- package/dist/esm/create-editor/create-plugins-list.js +15 -4
- package/dist/esm/event-dispatcher/index.js +1 -74
- package/dist/esm/insert-api/api.js +37 -0
- package/dist/esm/insert-api/insert-content-handlers.js +88 -0
- package/dist/esm/insert-api/insert-node-helpers.js +138 -0
- package/dist/{es2019/plugins/analytics/types/config-panel-events.js → esm/insert-api/types.js} +0 -0
- package/dist/esm/keymaps/index.js +1 -184
- package/dist/esm/messages.js +2 -123
- package/dist/esm/plugins/analytics/index.js +1 -1
- package/dist/esm/plugins/analytics/types/enums.js +1 -336
- package/dist/esm/plugins/analytics/types/extension-events.js +1 -22
- package/dist/esm/plugins/analytics/types/general-events.js +1 -30
- package/dist/esm/plugins/analytics/types/index.js +1 -6
- package/dist/esm/plugins/analytics/types/inline-comment-events.js +1 -7
- package/dist/esm/plugins/analytics/types/node-events.js +1 -18
- package/dist/esm/plugins/analytics/types/smart-links.js +1 -12
- package/dist/esm/plugins/analytics/types/toolbar-button.js +1 -19
- package/dist/esm/plugins/analytics/utils.js +12 -113
- package/dist/esm/plugins/expand/utils.js +1 -34
- package/dist/esm/plugins/extension/actions.js +1 -24
- package/dist/esm/plugins/extension/ui/Extension/styles.js +2 -3
- package/dist/esm/plugins/insert-block/index.js +1 -0
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +22 -12
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +1 -168
- package/dist/esm/plugins/layout/styles.js +2 -3
- package/dist/esm/plugins/layout/utils.js +1 -58
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +10 -0
- package/dist/esm/plugins/paste/handlers.js +8 -4
- package/dist/esm/plugins/paste/util/index.js +23 -0
- package/dist/esm/plugins/selection/gap-cursor/selection.js +1 -176
- package/dist/esm/plugins/selection/gap-cursor/utils/is-ignored.js +1 -5
- package/dist/esm/plugins/selection/gap-cursor/utils/is-valid-target-node.js +1 -4
- package/dist/esm/plugins/selection/gap-cursor/utils.js +4 -4
- package/dist/esm/plugins/selection/gap-cursor-selection.js +1 -1
- package/dist/esm/plugins/selection/types.js +2 -9
- package/dist/esm/plugins/selection/utils.js +1 -1
- package/dist/esm/plugins/table/commands/go-to-next-cell.js +34 -32
- package/dist/esm/plugins/table/commands/insert.js +57 -49
- package/dist/esm/plugins/table/commands/selection.js +303 -215
- package/dist/esm/plugins/table/commands-with-analytics.js +241 -220
- package/dist/esm/plugins/table/event-handlers.js +60 -59
- package/dist/esm/plugins/table/index.js +62 -18
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +20 -21
- package/dist/esm/plugins/table/nodeviews/table.js +19 -9
- package/dist/esm/plugins/table/nodeviews/tableCell.js +11 -12
- package/dist/esm/plugins/table/nodeviews/update-overflow-shadows.js +25 -24
- package/dist/esm/plugins/table/pm-plugins/keymap.js +14 -13
- package/dist/esm/plugins/table/pm-plugins/main.js +8 -8
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +4 -6
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin.js +2 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +7 -8
- package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +30 -28
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +4 -4
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +3 -2
- package/dist/esm/plugins/table/pm-plugins/table-selection-keymap.js +3 -3
- package/dist/esm/plugins/table/toolbar.js +75 -73
- package/dist/esm/plugins/table/transforms/column-width.js +41 -38
- package/dist/esm/plugins/table/transforms/replace-table.js +4 -4
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +2 -2
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +25 -21
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +6 -2
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +6 -4
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +9 -6
- package/dist/esm/plugins/table/ui/LayoutButton/index.js +2 -2
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +4 -5
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/utils/analytics.js +22 -1
- package/dist/esm/plugins/table/utils/index.js +1 -1
- package/dist/esm/selection-api/api.js +23 -0
- package/dist/esm/types/browser.js +0 -1
- package/dist/esm/ui/ColorPalette/Color/index.js +1 -93
- package/dist/esm/ui/ColorPalette/Palettes/cellBackgroundColorPalette.js +1 -14
- package/dist/esm/ui/ColorPalette/Palettes/common.js +1 -19
- package/dist/esm/ui/ColorPalette/Palettes/paletteMessages.js +2 -113
- package/dist/esm/ui/ColorPalette/Palettes/panelBackgroundPalette.js +1 -147
- package/dist/esm/ui/ColorPalette/Palettes/statusColorPalette.js +1 -51
- package/dist/esm/ui/ColorPalette/Palettes/textColorPalette.js +1 -25
- package/dist/esm/ui/ColorPalette/index.js +2 -64
- package/dist/esm/ui/Dropdown/index.js +2 -106
- package/dist/esm/ui/DropdownMenu/index.js +2 -265
- package/dist/esm/ui/Toolbar/types.js +1 -30
- package/dist/esm/ui/ToolbarButton/index.js +2 -102
- package/dist/esm/ui/WithPluginState/index.js +1 -1
- package/dist/esm/ui/styles.js +17 -20
- package/dist/esm/ui/with-outer-listeners.js +2 -139
- package/dist/esm/utils/dom.js +1 -113
- package/dist/esm/utils/index.js +5 -23
- package/dist/esm/utils/node-width.js +1 -73
- package/dist/esm/utils/nodes.js +1 -100
- package/dist/esm/utils/plugin-state-factory.js +1 -106
- package/dist/esm/utils/selection.js +2 -50
- package/dist/esm/utils/slice.js +1 -59
- package/dist/esm/utils/step.js +1 -37
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +2 -16
- package/dist/types/analytics-api/api.d.ts +9 -0
- package/dist/types/analytics-api/attach-payload-into-transaction.d.ts +10 -0
- package/dist/types/analytics-api/editor-state-context.d.ts +9 -0
- package/dist/types/analytics-api/map-attributes.d.ts +2 -0
- package/dist/types/create-editor/ReactEditorView.d.ts +1 -0
- package/dist/types/create-editor/ReactEditorViewContext.d.ts +1 -7
- package/dist/types/create-editor/create-plugins-list.d.ts +5 -1
- package/dist/types/event-dispatcher/index.d.ts +2 -19
- package/dist/types/insert-api/api.d.ts +9 -0
- package/dist/types/insert-api/insert-content-handlers.d.ts +9 -0
- package/dist/types/insert-api/insert-node-helpers.d.ts +30 -0
- package/dist/types/insert-api/types.d.ts +16 -0
- package/dist/types/keymaps/index.d.ts +2 -89
- package/dist/types/labs/next/presets/cxhtml.d.ts +1 -1
- package/dist/types/labs/next/presets/mobile.d.ts +1 -1
- package/dist/types/messages.d.ts +2 -124
- package/dist/types/plugins/analytics/index.d.ts +2 -2
- package/dist/types/plugins/analytics/types/dispatch-analytics-event.d.ts +1 -2
- package/dist/types/plugins/analytics/types/enums.d.ts +1 -313
- package/dist/types/plugins/analytics/types/events.d.ts +1 -111
- package/dist/types/plugins/analytics/types/experimental-events.d.ts +1 -17
- package/dist/types/plugins/analytics/types/extension-events.d.ts +2 -43
- package/dist/types/plugins/analytics/types/general-events.d.ts +2 -179
- package/dist/types/plugins/analytics/types/index.d.ts +4 -14
- package/dist/types/plugins/analytics/types/inline-comment-events.d.ts +2 -17
- package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -76
- package/dist/types/plugins/analytics/types/media-events.d.ts +1 -16
- package/dist/types/plugins/analytics/types/node-events.d.ts +2 -56
- package/dist/types/plugins/analytics/types/selection-events.d.ts +1 -18
- package/dist/types/plugins/analytics/types/smart-links.d.ts +2 -13
- package/dist/types/plugins/analytics/types/toolbar-button.d.ts +2 -22
- package/dist/types/plugins/analytics/types/type-ahead.d.ts +1 -27
- package/dist/types/plugins/analytics/utils.d.ts +3 -8
- package/dist/types/plugins/annotation/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +1 -1
- package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types/plugins/context-panel/types.d.ts +1 -3
- package/dist/types/plugins/expand/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types/plugins/expand/utils.d.ts +1 -5
- package/dist/types/plugins/extension/actions.d.ts +2 -6
- package/dist/types/plugins/extension/commands.d.ts +7 -7
- package/dist/types/plugins/extension/plugin-factory.d.ts +2 -2
- package/dist/types/plugins/extension/ui/Extension/styles.d.ts +2 -2
- package/dist/types/plugins/find-replace/commands.d.ts +7 -7
- package/dist/types/plugins/find-replace/plugin.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/types.d.ts +1 -153
- package/dist/types/plugins/floating-toolbar/ui/Button.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +2 -12
- package/dist/types/plugins/floating-toolbar/ui/types.d.ts +1 -20
- package/dist/types/plugins/insert-block/index.d.ts +2 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/messages.d.ts +1 -167
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +3 -1
- package/dist/types/plugins/layout/styles.d.ts +2 -2
- package/dist/types/plugins/layout/utils.d.ts +1 -15
- package/dist/types/plugins/media/commands/linking.d.ts +3 -3
- package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +1 -1
- package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
- package/dist/types/plugins/media/pm-plugins/alt-text/commands.d.ts +2 -2
- package/dist/types/plugins/media/pm-plugins/alt-text/index.d.ts +1 -1
- package/dist/types/plugins/media/pm-plugins/linking/index.d.ts +1 -1
- package/dist/types/plugins/mobile-dimensions/commands.d.ts +4 -4
- package/dist/types/plugins/mobile-dimensions/plugin-factory.d.ts +1 -1
- package/dist/types/plugins/paste/util/index.d.ts +2 -1
- package/dist/types/plugins/selection/commands.d.ts +1 -1
- package/dist/types/plugins/selection/gap-cursor/selection.d.ts +1 -40
- package/dist/types/plugins/selection/gap-cursor/utils/is-ignored.d.ts +1 -2
- package/dist/types/plugins/selection/gap-cursor/utils/is-valid-target-node.d.ts +1 -2
- package/dist/types/plugins/selection/gap-cursor-selection.d.ts +1 -1
- package/dist/types/plugins/selection/plugin-factory.d.ts +1 -1
- package/dist/types/plugins/selection/types.d.ts +4 -19
- package/dist/types/plugins/table/commands/go-to-next-cell.d.ts +3 -2
- package/dist/types/plugins/table/commands/hover.d.ts +7 -7
- package/dist/types/plugins/table/commands/insert.d.ts +5 -4
- package/dist/types/plugins/table/commands/misc.d.ts +8 -8
- package/dist/types/plugins/table/commands/selection.d.ts +4 -3
- package/dist/types/plugins/table/commands/toggle.d.ts +1 -1
- package/dist/types/plugins/table/commands-with-analytics.d.ts +21 -19
- package/dist/types/plugins/table/event-handlers.d.ts +4 -2
- package/dist/types/plugins/table/index.d.ts +7 -0
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +4 -2
- package/dist/types/plugins/table/nodeviews/table.d.ts +2 -1
- package/dist/types/plugins/table/nodeviews/tableCell.d.ts +2 -1
- package/dist/types/plugins/table/nodeviews/types.d.ts +3 -0
- package/dist/types/plugins/table/nodeviews/update-overflow-shadows.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/keymap.d.ts +3 -1
- package/dist/types/plugins/table/pm-plugins/main.d.ts +4 -2
- package/dist/types/plugins/table/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/commands.d.ts +2 -2
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/commands.d.ts +4 -4
- package/dist/types/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +3 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +2 -2
- package/dist/types/plugins/table/pm-plugins/table-resizing/plugin.d.ts +3 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +3 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/table-selection-keymap.d.ts +2 -1
- package/dist/types/plugins/table/toolbar.d.ts +5 -3
- package/dist/types/plugins/table/transforms/column-width.d.ts +2 -1
- package/dist/types/plugins/table/transforms/replace-table.d.ts +3 -2
- package/dist/types/plugins/table/types.d.ts +3 -1
- package/dist/types/plugins/table/ui/FloatingContextualButton/index.d.ts +1 -1
- package/dist/types/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +4 -0
- package/dist/types/plugins/table/ui/FloatingContextualMenu/index.d.ts +5 -1
- package/dist/types/plugins/table/ui/FloatingDeleteButton/index.d.ts +2 -0
- package/dist/types/plugins/table/ui/FloatingInsertButton/index.d.ts +5 -1
- package/dist/types/plugins/table/ui/LayoutButton/index.d.ts +2 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +2 -0
- package/dist/types/plugins/table/utils/analytics.d.ts +3 -0
- package/dist/types/plugins/table/utils/index.d.ts +1 -1
- package/dist/types/plugins/type-ahead/types.d.ts +2 -50
- package/dist/types/plugins/width/index.d.ts +3 -6
- package/dist/types/selection-api/api.d.ts +11 -0
- package/dist/types/types/browser.d.ts +1 -10
- package/dist/types/types/editor-appearance.d.ts +1 -1
- package/dist/types/types/editor-plugin.d.ts +1 -59
- package/dist/types/types/editor-react-context.d.ts +1 -6
- package/dist/types/types/empty-state-handler.d.ts +1 -7
- package/dist/types/types/feature-flags.d.ts +1 -343
- package/dist/types/types/pm-config.d.ts +1 -14
- package/dist/types/types/pm-plugin.d.ts +1 -27
- package/dist/types/types/ui-components.d.ts +1 -22
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +118 -118
- package/dist/types/ui/ColorPalette/Color/index.d.ts +1 -19
- package/dist/types/ui/ColorPalette/Palettes/cellBackgroundColorPalette.d.ts +1 -2
- package/dist/types/ui/ColorPalette/Palettes/common.d.ts +1 -1
- package/dist/types/ui/ColorPalette/Palettes/paletteMessages.d.ts +2 -113
- package/dist/types/ui/ColorPalette/Palettes/panelBackgroundPalette.d.ts +1 -3
- package/dist/types/ui/ColorPalette/Palettes/statusColorPalette.d.ts +1 -3
- package/dist/types/ui/ColorPalette/Palettes/textColorPalette.d.ts +1 -3
- package/dist/types/ui/ColorPalette/Palettes/type.d.ts +1 -8
- package/dist/types/ui/ColorPalette/index.d.ts +2 -23
- package/dist/types/ui/ColorPickerButton/index.d.ts +1 -1
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/Dropdown/index.d.ts +2 -33
- package/dist/types/ui/DropdownMenu/index.d.ts +2 -18
- package/dist/types/ui/DropdownMenu/types.d.ts +1 -43
- package/dist/types/ui/Toolbar/types.d.ts +2 -30
- package/dist/types/ui/ToolbarButton/index.d.ts +3 -52
- package/dist/types/ui/styles.d.ts +3 -3
- package/dist/types/ui/with-outer-listeners.d.ts +2 -10
- package/dist/types/utils/document-logger.d.ts +2 -7
- package/dist/types/utils/dom.d.ts +2 -26
- package/dist/types/utils/index.d.ts +3 -6
- package/dist/types/utils/node-width.d.ts +1 -7
- package/dist/types/utils/nodes.d.ts +1 -35
- package/dist/types/utils/performance/plugin-performance-report.d.ts +2 -25
- package/dist/types/utils/plugin-state-factory.d.ts +2 -16
- package/dist/types/utils/selection.d.ts +3 -6
- package/dist/types/utils/slice.d.ts +2 -11
- package/dist/types/utils/step.d.ts +1 -15
- package/package.json +8 -9
- package/dist/cjs/plugins/analytics/types/config-panel-events.js +0 -5
- package/dist/cjs/plugins/analytics/types/cut-copy-events.js +0 -5
- package/dist/cjs/plugins/analytics/types/date-events.js +0 -5
- package/dist/cjs/plugins/analytics/types/element-browser-events.js +0 -5
- package/dist/cjs/plugins/analytics/types/find-replace-events.js +0 -5
- package/dist/cjs/plugins/analytics/types/format-events.js +0 -24
- package/dist/cjs/plugins/analytics/types/insert-events.js +0 -51
- package/dist/cjs/plugins/analytics/types/list-events.js +0 -25
- package/dist/cjs/plugins/analytics/types/paste-events.js +0 -55
- package/dist/cjs/plugins/analytics/types/substitute-events.js +0 -24
- package/dist/cjs/plugins/analytics/types/table-events.js +0 -43
- package/dist/cjs/plugins/analytics/types/utils.js +0 -27
- package/dist/cjs/ui/ColorPalette/Color/styles.js +0 -21
- package/dist/cjs/ui/ColorPalette/Palettes/getColorMessage.js +0 -17
- package/dist/cjs/ui/ColorPalette/styles.js +0 -19
- package/dist/cjs/ui/DropList/index.js +0 -215
- package/dist/cjs/ui/Layer/index.js +0 -245
- package/dist/cjs/ui/Layer/internal/helpers.js +0 -70
- package/dist/cjs/ui/ToolbarButton/styles.js +0 -26
- package/dist/es2019/plugins/analytics/types/cut-copy-events.js +0 -1
- package/dist/es2019/plugins/analytics/types/date-events.js +0 -1
- package/dist/es2019/plugins/analytics/types/element-browser-events.js +0 -1
- package/dist/es2019/plugins/analytics/types/find-replace-events.js +0 -1
- package/dist/es2019/plugins/analytics/types/format-events.js +0 -16
- package/dist/es2019/plugins/analytics/types/insert-events.js +0 -41
- package/dist/es2019/plugins/analytics/types/list-events.js +0 -17
- package/dist/es2019/plugins/analytics/types/paste-events.js +0 -46
- package/dist/es2019/plugins/analytics/types/substitute-events.js +0 -16
- package/dist/es2019/plugins/analytics/types/table-events.js +0 -34
- package/dist/es2019/plugins/analytics/types/utils.js +0 -19
- package/dist/es2019/ui/ColorPalette/Color/styles.js +0 -24
- package/dist/es2019/ui/ColorPalette/Palettes/getColorMessage.js +0 -14
- package/dist/es2019/ui/ColorPalette/styles.js +0 -7
- package/dist/es2019/ui/DropList/index.js +0 -186
- package/dist/es2019/ui/Layer/index.js +0 -195
- package/dist/es2019/ui/Layer/internal/helpers.js +0 -62
- package/dist/es2019/ui/ToolbarButton/styles.js +0 -12
- package/dist/esm/plugins/analytics/types/avatar.js +0 -1
- package/dist/esm/plugins/analytics/types/config-panel-events.js +0 -1
- package/dist/esm/plugins/analytics/types/cut-copy-events.js +0 -1
- package/dist/esm/plugins/analytics/types/date-events.js +0 -1
- package/dist/esm/plugins/analytics/types/element-browser-events.js +0 -1
- package/dist/esm/plugins/analytics/types/find-replace-events.js +0 -1
- package/dist/esm/plugins/analytics/types/format-events.js +0 -16
- package/dist/esm/plugins/analytics/types/insert-events.js +0 -41
- package/dist/esm/plugins/analytics/types/list-events.js +0 -17
- package/dist/esm/plugins/analytics/types/paste-events.js +0 -46
- package/dist/esm/plugins/analytics/types/substitute-events.js +0 -16
- package/dist/esm/plugins/analytics/types/table-events.js +0 -34
- package/dist/esm/plugins/analytics/types/utils.js +0 -19
- package/dist/esm/ui/ColorPalette/Color/styles.js +0 -8
- package/dist/esm/ui/ColorPalette/Palettes/getColorMessage.js +0 -10
- package/dist/esm/ui/ColorPalette/styles.js +0 -7
- package/dist/esm/ui/DropList/index.js +0 -203
- package/dist/esm/ui/Layer/index.js +0 -228
- package/dist/esm/ui/Layer/internal/helpers.js +0 -62
- package/dist/esm/ui/ToolbarButton/styles.js +0 -12
- package/dist/types/plugins/analytics/types/avatar.d.ts +0 -5
- package/dist/types/plugins/analytics/types/config-panel-events.d.ts +0 -17
- package/dist/types/plugins/analytics/types/cut-copy-events.d.ts +0 -12
- package/dist/types/plugins/analytics/types/date-events.d.ts +0 -17
- package/dist/types/plugins/analytics/types/element-browser-events.d.ts +0 -11
- package/dist/types/plugins/analytics/types/find-replace-events.d.ts +0 -23
- package/dist/types/plugins/analytics/types/format-events.d.ts +0 -49
- package/dist/types/plugins/analytics/types/insert-events.d.ts +0 -128
- package/dist/types/plugins/analytics/types/list-events.d.ts +0 -52
- package/dist/types/plugins/analytics/types/paste-events.d.ts +0 -39
- package/dist/types/plugins/analytics/types/substitute-events.d.ts +0 -26
- package/dist/types/plugins/analytics/types/table-events.d.ts +0 -94
- package/dist/types/plugins/analytics/types/utils.d.ts +0 -45
- package/dist/types/ui/ColorPalette/Color/styles.d.ts +0 -2
- package/dist/types/ui/ColorPalette/Palettes/getColorMessage.d.ts +0 -2
- package/dist/types/ui/ColorPalette/styles.d.ts +0 -1
- package/dist/types/ui/DropList/index.d.ts +0 -22
- package/dist/types/ui/Layer/index.d.ts +0 -47
- package/dist/types/ui/Layer/internal/helpers.d.ts +0 -5
- package/dist/types/ui/ToolbarButton/styles.d.ts +0 -4
|
@@ -4,9 +4,9 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
|
4
4
|
import { selectedRect } from '@atlaskit/editor-tables/utils';
|
|
5
5
|
import { flatten, findParentNode } from 'prosemirror-utils';
|
|
6
6
|
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
7
|
+
import { isSelectionAtStartOfNode, isSelectionAtEndOfNode } from '@atlaskit/editor-common/selection';
|
|
7
8
|
import { selectNode } from '../../utils/commands';
|
|
8
9
|
import { isEmptyParagraph } from '../../utils/document';
|
|
9
|
-
import { isSelectionAtStartOfNode, isSelectionAtEndOfNode } from '../../utils/selection';
|
|
10
10
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analytics';
|
|
11
11
|
import { isIgnored as isIgnoredByGapCursor } from '../selection/gap-cursor/utils/is-ignored';
|
|
12
12
|
import { selectionPluginKey } from './types';
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { findTable, goToNextCell as baseGotoNextCell } from '@atlaskit/editor-tables/utils';
|
|
3
3
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
4
4
|
import { findParentNodeOfType } from 'prosemirror-utils';
|
|
5
|
-
import { INPUT_METHOD } from '
|
|
5
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { insertRowWithAnalytics } from '../commands-with-analytics';
|
|
7
7
|
const TAB_FORWARD_DIRECTION = 1;
|
|
8
8
|
const TAB_BACKWARD_DIRECTION = -1;
|
|
9
|
-
export const goToNextCell = direction => (state, dispatch) => {
|
|
9
|
+
export const goToNextCell = editorAnalyticsAPI => direction => (state, dispatch) => {
|
|
10
10
|
const table = findTable(state.selection);
|
|
11
11
|
|
|
12
12
|
if (!table) {
|
|
@@ -23,7 +23,7 @@ export const goToNextCell = direction => (state, dispatch) => {
|
|
|
23
23
|
const lastCellPos = map.positionAt(map.height - 1, map.width - 1, table.node) + table.start; // when tabbing backwards at first cell (top left), insert row at the start of table
|
|
24
24
|
|
|
25
25
|
if (firstCellPos === cell.pos && direction === TAB_BACKWARD_DIRECTION) {
|
|
26
|
-
insertRowWithAnalytics(INPUT_METHOD.KEYBOARD, {
|
|
26
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, {
|
|
27
27
|
index: 0,
|
|
28
28
|
moveCursorToInsertedRow: true
|
|
29
29
|
})(state, dispatch);
|
|
@@ -32,7 +32,7 @@ export const goToNextCell = direction => (state, dispatch) => {
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
if (lastCellPos === cell.pos && direction === TAB_FORWARD_DIRECTION) {
|
|
35
|
-
insertRowWithAnalytics(INPUT_METHOD.KEYBOARD, {
|
|
35
|
+
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, {
|
|
36
36
|
index: map.height,
|
|
37
37
|
moveCursorToInsertedRow: true
|
|
38
38
|
})(state, dispatch);
|
|
@@ -21,29 +21,31 @@ function addColumnAtCustomStep(column) {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export function addColumnAt(
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
export function addColumnAt(getEditorContainerWidth) {
|
|
25
|
+
return (column, allowAddColumnCustomStep = false, view) => {
|
|
26
|
+
return tr => {
|
|
27
|
+
let updatedTr = tr;
|
|
28
|
+
|
|
29
|
+
if (allowAddColumnCustomStep) {
|
|
30
|
+
updatedTr = addColumnAtCustomStep(column)(updatedTr);
|
|
31
|
+
} else {
|
|
32
|
+
updatedTr = addColumnAtPMUtils(column)(updatedTr);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const table = findTable(updatedTr.selection);
|
|
36
|
+
|
|
37
|
+
if (table) {
|
|
38
|
+
// [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
|
|
39
|
+
updatedTr = rescaleColumns(getEditorContainerWidth)(table, view)(updatedTr);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return updatedTr;
|
|
43
|
+
};
|
|
42
44
|
};
|
|
43
45
|
} // :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
44
46
|
// Command to add a column before the column with the selection.
|
|
45
47
|
|
|
46
|
-
export const addColumnBefore = (state, dispatch, view) => {
|
|
48
|
+
export const addColumnBefore = getEditorContainerWidth => (state, dispatch, view) => {
|
|
47
49
|
const table = findTable(state.selection);
|
|
48
50
|
|
|
49
51
|
if (!table) {
|
|
@@ -52,14 +54,14 @@ export const addColumnBefore = (state, dispatch, view) => {
|
|
|
52
54
|
|
|
53
55
|
if (dispatch) {
|
|
54
56
|
let rect = selectedRect(state);
|
|
55
|
-
dispatch(addColumnAt(rect.left, getAllowAddColumnCustomStep(state), view)(state.tr));
|
|
57
|
+
dispatch(addColumnAt(getEditorContainerWidth)(rect.left, getAllowAddColumnCustomStep(state), view)(state.tr));
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
return true;
|
|
59
61
|
}; // :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
60
62
|
// Command to add a column after the column with the selection.
|
|
61
63
|
|
|
62
|
-
export const addColumnAfter = (state, dispatch, view) => {
|
|
64
|
+
export const addColumnAfter = getEditorContainerWidth => (state, dispatch, view) => {
|
|
63
65
|
const table = findTable(state.selection);
|
|
64
66
|
|
|
65
67
|
if (!table) {
|
|
@@ -68,14 +70,14 @@ export const addColumnAfter = (state, dispatch, view) => {
|
|
|
68
70
|
|
|
69
71
|
if (dispatch) {
|
|
70
72
|
let rect = selectedRect(state);
|
|
71
|
-
dispatch(addColumnAt(rect.right, getAllowAddColumnCustomStep(state), view)(state.tr));
|
|
73
|
+
dispatch(addColumnAt(getEditorContainerWidth)(rect.right, getAllowAddColumnCustomStep(state), view)(state.tr));
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
return true;
|
|
75
77
|
}; // #region Commands
|
|
76
78
|
|
|
77
|
-
export const insertColumn = column => (state, dispatch, view) => {
|
|
78
|
-
let tr = addColumnAt(column, getAllowAddColumnCustomStep(state), view)(state.tr);
|
|
79
|
+
export const insertColumn = getEditorContainerWidth => column => (state, dispatch, view) => {
|
|
80
|
+
let tr = addColumnAt(getEditorContainerWidth)(column, getAllowAddColumnCustomStep(state), view)(state.tr);
|
|
79
81
|
const table = findTable(tr.selection);
|
|
80
82
|
|
|
81
83
|
if (!table) {
|
|
@@ -2,11 +2,7 @@ import { TextSelection, Selection } from 'prosemirror-state';
|
|
|
2
2
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
3
3
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
4
4
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
5
|
-
import { GapCursorSelection, Side } from '
|
|
6
|
-
import { setSelectionRelativeToNode } from '../../selection/commands';
|
|
7
|
-
import { RelativeSelectionPos } from '../../selection/types';
|
|
8
|
-
import { getPluginState as getSelectionPluginState } from '../../selection/plugin-factory';
|
|
9
|
-
import { isSelectionAtStartOfNode, isSelectionAtEndOfNode } from '../../../utils/selection';
|
|
5
|
+
import { RelativeSelectionPos, GapCursorSelection, Side, isSelectionAtStartOfNode, isSelectionAtEndOfNode } from '@atlaskit/editor-common/selection';
|
|
10
6
|
export let TableSelectionDirection;
|
|
11
7
|
|
|
12
8
|
(function (TableSelectionDirection) {
|
|
@@ -14,77 +10,77 @@ export let TableSelectionDirection;
|
|
|
14
10
|
TableSelectionDirection["BottomToTop"] = "BottomToTop";
|
|
15
11
|
})(TableSelectionDirection || (TableSelectionDirection = {}));
|
|
16
12
|
|
|
17
|
-
export const arrowLeftFromTable = (state, dispatch) => {
|
|
13
|
+
export const arrowLeftFromTable = editorSelectionAPI => () => (state, dispatch) => {
|
|
18
14
|
const {
|
|
19
15
|
selection
|
|
20
16
|
} = state;
|
|
21
17
|
|
|
22
18
|
if (selection instanceof CellSelection) {
|
|
23
|
-
return arrowLeftFromCellSelection(selection)(state, dispatch);
|
|
19
|
+
return arrowLeftFromCellSelection(editorSelectionAPI)(selection)(state, dispatch);
|
|
24
20
|
} else if (selection instanceof GapCursorSelection) {
|
|
25
|
-
return arrowLeftFromGapCursor(selection)(state, dispatch);
|
|
21
|
+
return arrowLeftFromGapCursor(editorSelectionAPI)(selection)(state, dispatch);
|
|
26
22
|
} else if (selection instanceof TextSelection) {
|
|
27
|
-
return arrowLeftFromText(selection)(state, dispatch);
|
|
23
|
+
return arrowLeftFromText(editorSelectionAPI)(selection)(state, dispatch);
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
return false;
|
|
31
27
|
};
|
|
32
|
-
export const arrowRightFromTable = (state, dispatch) => {
|
|
28
|
+
export const arrowRightFromTable = editorSelectionAPI => () => (state, dispatch) => {
|
|
33
29
|
const {
|
|
34
30
|
selection
|
|
35
31
|
} = state;
|
|
36
32
|
|
|
37
33
|
if (selection instanceof CellSelection) {
|
|
38
|
-
return arrowRightFromCellSelection(selection)(state, dispatch);
|
|
34
|
+
return arrowRightFromCellSelection(editorSelectionAPI)(selection)(state, dispatch);
|
|
39
35
|
} else if (selection instanceof GapCursorSelection) {
|
|
40
|
-
return arrowRightFromGapCursor(selection)(state, dispatch);
|
|
36
|
+
return arrowRightFromGapCursor(editorSelectionAPI)(selection)(state, dispatch);
|
|
41
37
|
} else if (selection instanceof TextSelection) {
|
|
42
|
-
return arrowRightFromText(selection)(state, dispatch);
|
|
38
|
+
return arrowRightFromText(editorSelectionAPI)(selection)(state, dispatch);
|
|
43
39
|
}
|
|
44
40
|
|
|
45
41
|
return false;
|
|
46
42
|
};
|
|
47
43
|
|
|
48
|
-
const arrowLeftFromCellSelection = selection => (state, dispatch) => {
|
|
49
|
-
if (isTableSelected(state.selection)) {
|
|
44
|
+
const arrowLeftFromCellSelection = editorSelectionAPI => selection => (state, dispatch) => {
|
|
45
|
+
if (isTableSelected(state.selection) && editorSelectionAPI) {
|
|
50
46
|
const {
|
|
51
47
|
selectionRelativeToNode
|
|
52
|
-
} = getSelectionPluginState(state);
|
|
48
|
+
} = editorSelectionAPI.getSelectionPluginState(state);
|
|
53
49
|
|
|
54
50
|
if (selectionRelativeToNode === RelativeSelectionPos.Start) {
|
|
55
51
|
// we have full table cell selection and want to set gap cursor selection before table
|
|
56
|
-
return setGapCursorBeforeTable()(state, dispatch);
|
|
52
|
+
return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
|
|
57
53
|
} else if (selectionRelativeToNode === RelativeSelectionPos.End) {
|
|
58
54
|
// we have full table cell selection and want to set selection at end of last cell
|
|
59
|
-
return setSelectionAtEndOfLastCell(selection)(state, dispatch);
|
|
55
|
+
return setSelectionAtEndOfLastCell(editorSelectionAPI)(selection)(state, dispatch);
|
|
60
56
|
} else if (selectionRelativeToNode === undefined) {
|
|
61
57
|
// we have full table cell selection and want to set selection at start of first cell
|
|
62
|
-
return setSelectionAtStartOfFirstCell(selection, RelativeSelectionPos.Before)(state, dispatch);
|
|
58
|
+
return setSelectionAtStartOfFirstCell(editorSelectionAPI)(selection, RelativeSelectionPos.Before)(state, dispatch);
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
|
|
66
62
|
return false;
|
|
67
63
|
};
|
|
68
64
|
|
|
69
|
-
const arrowRightFromCellSelection = selection => (state, dispatch) => {
|
|
70
|
-
if (isTableSelected(state.selection)) {
|
|
65
|
+
const arrowRightFromCellSelection = editorSelectionAPI => selection => (state, dispatch) => {
|
|
66
|
+
if (isTableSelected(state.selection) && editorSelectionAPI) {
|
|
71
67
|
const {
|
|
72
68
|
selectionRelativeToNode
|
|
73
|
-
} = getSelectionPluginState(state);
|
|
69
|
+
} = editorSelectionAPI.getSelectionPluginState(state);
|
|
74
70
|
|
|
75
71
|
if (selectionRelativeToNode === RelativeSelectionPos.Start) {
|
|
76
72
|
// we have full table cell selection and want to set selection at start of first cell
|
|
77
|
-
return setSelectionAtStartOfFirstCell(selection)(state, dispatch);
|
|
73
|
+
return setSelectionAtStartOfFirstCell(editorSelectionAPI)(selection)(state, dispatch);
|
|
78
74
|
} else if (selectionRelativeToNode === RelativeSelectionPos.End || selectionRelativeToNode === undefined) {
|
|
79
75
|
// we have full table cell selection and want to set gap cursor selection after table
|
|
80
|
-
return setGapCursorAfterTable()(state, dispatch);
|
|
76
|
+
return setGapCursorAfterTable(editorSelectionAPI)()(state, dispatch);
|
|
81
77
|
}
|
|
82
78
|
}
|
|
83
79
|
|
|
84
80
|
return false;
|
|
85
81
|
};
|
|
86
82
|
|
|
87
|
-
const arrowLeftFromGapCursor = selection => (state, dispatch) => {
|
|
83
|
+
const arrowLeftFromGapCursor = editorSelectionAPI => selection => (state, dispatch) => {
|
|
88
84
|
const {
|
|
89
85
|
doc
|
|
90
86
|
} = state;
|
|
@@ -97,7 +93,7 @@ const arrowLeftFromGapCursor = selection => (state, dispatch) => {
|
|
|
97
93
|
if (side === Side.RIGHT) {
|
|
98
94
|
if ($from.nodeBefore && $from.nodeBefore.type.name === 'table') {
|
|
99
95
|
// we have a gap cursor after a table node and want to set a full table cell selection
|
|
100
|
-
return selectFullTable({
|
|
96
|
+
return selectFullTable(editorSelectionAPI)({
|
|
101
97
|
node: $from.nodeBefore,
|
|
102
98
|
startPos: doc.resolve(from - 1).start($from.depth + 1),
|
|
103
99
|
dir: TableSelectionDirection.TopToBottom
|
|
@@ -106,17 +102,17 @@ const arrowLeftFromGapCursor = selection => (state, dispatch) => {
|
|
|
106
102
|
} else if (side === Side.LEFT) {
|
|
107
103
|
const table = findTable(selection);
|
|
108
104
|
|
|
109
|
-
if (table && isSelectionAtStartOfTable($from, selection)) {
|
|
105
|
+
if (table && isSelectionAtStartOfTable($from, selection) && editorSelectionAPI) {
|
|
110
106
|
const {
|
|
111
107
|
selectionRelativeToNode
|
|
112
|
-
} = getSelectionPluginState(state);
|
|
108
|
+
} = editorSelectionAPI.getSelectionPluginState(state);
|
|
113
109
|
|
|
114
110
|
if (selectionRelativeToNode === RelativeSelectionPos.Before) {
|
|
115
111
|
// we have a gap cursor at start of first table cell and want to set a gap cursor selection before table
|
|
116
|
-
return setGapCursorBeforeTable()(state, dispatch);
|
|
112
|
+
return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
|
|
117
113
|
} else {
|
|
118
114
|
// we have a gap cursor at start of first table cell and want to set a full table cell selection
|
|
119
|
-
return selectFullTable({
|
|
115
|
+
return selectFullTable(editorSelectionAPI)({
|
|
120
116
|
node: table.node,
|
|
121
117
|
startPos: table.start,
|
|
122
118
|
dir: TableSelectionDirection.BottomToTop
|
|
@@ -128,7 +124,7 @@ const arrowLeftFromGapCursor = selection => (state, dispatch) => {
|
|
|
128
124
|
return false;
|
|
129
125
|
};
|
|
130
126
|
|
|
131
|
-
const arrowRightFromGapCursor = selection => (state, dispatch) => {
|
|
127
|
+
const arrowRightFromGapCursor = editorSelectionAPI => selection => (state, dispatch) => {
|
|
132
128
|
const {
|
|
133
129
|
$from,
|
|
134
130
|
from,
|
|
@@ -139,7 +135,7 @@ const arrowRightFromGapCursor = selection => (state, dispatch) => {
|
|
|
139
135
|
if (side === Side.LEFT) {
|
|
140
136
|
if ($from.nodeAfter && $from.nodeAfter.type.name === 'table') {
|
|
141
137
|
// we have a gap cursor before a table node and want to set a full table cell selection
|
|
142
|
-
return selectFullTable({
|
|
138
|
+
return selectFullTable(editorSelectionAPI)({
|
|
143
139
|
node: $from.nodeAfter,
|
|
144
140
|
startPos: from + 1,
|
|
145
141
|
dir: TableSelectionDirection.BottomToTop
|
|
@@ -150,7 +146,7 @@ const arrowRightFromGapCursor = selection => (state, dispatch) => {
|
|
|
150
146
|
|
|
151
147
|
if (table && isSelectionAtEndOfTable($to, selection)) {
|
|
152
148
|
// we have a gap cursor at end of last table cell and want to set a full table cell selection
|
|
153
|
-
return selectFullTable({
|
|
149
|
+
return selectFullTable(editorSelectionAPI)({
|
|
154
150
|
node: table.node,
|
|
155
151
|
startPos: table.start,
|
|
156
152
|
dir: TableSelectionDirection.TopToBottom
|
|
@@ -161,7 +157,7 @@ const arrowRightFromGapCursor = selection => (state, dispatch) => {
|
|
|
161
157
|
return false;
|
|
162
158
|
};
|
|
163
159
|
|
|
164
|
-
const arrowLeftFromText = selection => (state, dispatch) => {
|
|
160
|
+
const arrowLeftFromText = editorSelectionAPI => selection => (state, dispatch) => {
|
|
165
161
|
const table = findTable(selection);
|
|
166
162
|
|
|
167
163
|
if (table) {
|
|
@@ -169,20 +165,20 @@ const arrowLeftFromText = selection => (state, dispatch) => {
|
|
|
169
165
|
$from
|
|
170
166
|
} = selection;
|
|
171
167
|
|
|
172
|
-
if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 // + 3 for: row, cell & paragraph nodes
|
|
173
|
-
) {
|
|
168
|
+
if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 && // + 3 for: row, cell & paragraph nodes
|
|
169
|
+
editorSelectionAPI) {
|
|
174
170
|
const {
|
|
175
171
|
selectionRelativeToNode
|
|
176
|
-
} = getSelectionPluginState(state);
|
|
172
|
+
} = editorSelectionAPI.getSelectionPluginState(state);
|
|
177
173
|
|
|
178
174
|
if (selectionRelativeToNode === RelativeSelectionPos.Before) {
|
|
179
175
|
// we have a text selection at start of first table cell, directly inside a top level paragraph,
|
|
180
176
|
// and want to set gap cursor selection before table
|
|
181
|
-
return setGapCursorBeforeTable()(state, dispatch);
|
|
177
|
+
return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
|
|
182
178
|
} else {
|
|
183
179
|
// we have a text selection at start of first table cell, directly inside a top level paragraph,
|
|
184
180
|
// and want to set a full table cell selection
|
|
185
|
-
return selectFullTable({
|
|
181
|
+
return selectFullTable(editorSelectionAPI)({
|
|
186
182
|
node: table.node,
|
|
187
183
|
startPos: table.start,
|
|
188
184
|
dir: TableSelectionDirection.BottomToTop
|
|
@@ -194,7 +190,7 @@ const arrowLeftFromText = selection => (state, dispatch) => {
|
|
|
194
190
|
return false;
|
|
195
191
|
};
|
|
196
192
|
|
|
197
|
-
const arrowRightFromText = selection => (state, dispatch) => {
|
|
193
|
+
const arrowRightFromText = editorSelectionAPI => selection => (state, dispatch) => {
|
|
198
194
|
const table = findTable(selection);
|
|
199
195
|
|
|
200
196
|
if (table) {
|
|
@@ -206,7 +202,7 @@ const arrowRightFromText = selection => (state, dispatch) => {
|
|
|
206
202
|
) {
|
|
207
203
|
// we have a text selection at end of last table cell, directly inside a top level paragraph,
|
|
208
204
|
// and want to set a full table cell selection
|
|
209
|
-
return selectFullTable({
|
|
205
|
+
return selectFullTable(editorSelectionAPI)({
|
|
210
206
|
node: table.node,
|
|
211
207
|
startPos: table.start,
|
|
212
208
|
dir: TableSelectionDirection.TopToBottom
|
|
@@ -224,7 +220,7 @@ const arrowRightFromText = selection => (state, dispatch) => {
|
|
|
224
220
|
*/
|
|
225
221
|
|
|
226
222
|
|
|
227
|
-
const selectFullTable = ({
|
|
223
|
+
const selectFullTable = editorSelectionAPI => ({
|
|
228
224
|
node,
|
|
229
225
|
startPos,
|
|
230
226
|
dir
|
|
@@ -248,10 +244,22 @@ const selectFullTable = ({
|
|
|
248
244
|
selectionRelativeToNode = RelativeSelectionPos.Start;
|
|
249
245
|
}
|
|
250
246
|
|
|
251
|
-
|
|
247
|
+
if (editorSelectionAPI) {
|
|
248
|
+
const tr = editorSelectionAPI.setSelectionRelativeToNode({
|
|
249
|
+
selectionRelativeToNode,
|
|
250
|
+
selection: fullTableSelection
|
|
251
|
+
})(state);
|
|
252
|
+
|
|
253
|
+
if (dispatch) {
|
|
254
|
+
dispatch(tr);
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return false;
|
|
252
260
|
};
|
|
253
261
|
|
|
254
|
-
const setSelectionAtStartOfFirstCell = (selection, selectionRelativeToNode) => (state, dispatch) => {
|
|
262
|
+
const setSelectionAtStartOfFirstCell = editorSelectionAPI => (selection, selectionRelativeToNode) => (state, dispatch) => {
|
|
255
263
|
const {
|
|
256
264
|
$anchorCell,
|
|
257
265
|
$headCell
|
|
@@ -260,10 +268,23 @@ const setSelectionAtStartOfFirstCell = (selection, selectionRelativeToNode) => (
|
|
|
260
268
|
const $firstPosInsideCell = state.doc.resolve($firstCell.pos + 1); // check if first pos should have a gap cursor, otherwise find closest text selection
|
|
261
269
|
|
|
262
270
|
const selectionAtStartOfCell = GapCursorSelection.valid($firstPosInsideCell) ? new GapCursorSelection($firstPosInsideCell, Side.LEFT) : Selection.findFrom($firstPosInsideCell, 1);
|
|
263
|
-
|
|
271
|
+
|
|
272
|
+
if (editorSelectionAPI) {
|
|
273
|
+
const tr = editorSelectionAPI.setSelectionRelativeToNode({
|
|
274
|
+
selectionRelativeToNode,
|
|
275
|
+
selection: selectionAtStartOfCell
|
|
276
|
+
})(state);
|
|
277
|
+
|
|
278
|
+
if (dispatch) {
|
|
279
|
+
dispatch(tr);
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return false;
|
|
264
285
|
};
|
|
265
286
|
|
|
266
|
-
const setSelectionAtEndOfLastCell = (selection, selectionRelativeToNode) => (state, dispatch) => {
|
|
287
|
+
const setSelectionAtEndOfLastCell = editorSelectionAPI => (selection, selectionRelativeToNode) => (state, dispatch) => {
|
|
267
288
|
const {
|
|
268
289
|
$anchorCell,
|
|
269
290
|
$headCell
|
|
@@ -273,10 +294,23 @@ const setSelectionAtEndOfLastCell = (selection, selectionRelativeToNode) => (sta
|
|
|
273
294
|
const $lastPosInsideCell = state.doc.resolve(lastPosInsideCell); // check if last pos should have a gap cursor, otherwise find closest text selection
|
|
274
295
|
|
|
275
296
|
const selectionAtEndOfCell = GapCursorSelection.valid($lastPosInsideCell) ? new GapCursorSelection($lastPosInsideCell, Side.RIGHT) : Selection.findFrom($lastPosInsideCell, -1);
|
|
276
|
-
|
|
297
|
+
|
|
298
|
+
if (editorSelectionAPI) {
|
|
299
|
+
const tr = editorSelectionAPI.setSelectionRelativeToNode({
|
|
300
|
+
selectionRelativeToNode,
|
|
301
|
+
selection: selectionAtEndOfCell
|
|
302
|
+
})(state);
|
|
303
|
+
|
|
304
|
+
if (dispatch) {
|
|
305
|
+
dispatch(tr);
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return false;
|
|
277
311
|
};
|
|
278
312
|
|
|
279
|
-
const setGapCursorBeforeTable = () => (state, dispatch) => {
|
|
313
|
+
const setGapCursorBeforeTable = editorSelectionAPI => () => (state, dispatch) => {
|
|
280
314
|
const table = findTable(state.selection);
|
|
281
315
|
|
|
282
316
|
if (table) {
|
|
@@ -284,14 +318,25 @@ const setGapCursorBeforeTable = () => (state, dispatch) => {
|
|
|
284
318
|
|
|
285
319
|
if (GapCursorSelection.valid($beforeTablePos)) {
|
|
286
320
|
const selectionBeforeTable = new GapCursorSelection($beforeTablePos, Side.LEFT);
|
|
287
|
-
|
|
321
|
+
|
|
322
|
+
if (editorSelectionAPI) {
|
|
323
|
+
const tr = editorSelectionAPI.setSelectionRelativeToNode({
|
|
324
|
+
selectionRelativeToNode: undefined,
|
|
325
|
+
selection: selectionBeforeTable
|
|
326
|
+
})(state);
|
|
327
|
+
|
|
328
|
+
if (dispatch) {
|
|
329
|
+
dispatch(tr);
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
288
333
|
}
|
|
289
334
|
}
|
|
290
335
|
|
|
291
336
|
return false;
|
|
292
337
|
};
|
|
293
338
|
|
|
294
|
-
const setGapCursorAfterTable = () => (state, dispatch) => {
|
|
339
|
+
const setGapCursorAfterTable = editorSelectionAPI => () => (state, dispatch) => {
|
|
295
340
|
const table = findTable(state.selection);
|
|
296
341
|
|
|
297
342
|
if (table) {
|
|
@@ -299,7 +344,20 @@ const setGapCursorAfterTable = () => (state, dispatch) => {
|
|
|
299
344
|
|
|
300
345
|
if (GapCursorSelection.valid($afterTablePos)) {
|
|
301
346
|
const selectionAfterTable = new GapCursorSelection($afterTablePos, Side.RIGHT);
|
|
302
|
-
|
|
347
|
+
|
|
348
|
+
if (editorSelectionAPI) {
|
|
349
|
+
const tr = editorSelectionAPI.setSelectionRelativeToNode({
|
|
350
|
+
selectionRelativeToNode: undefined,
|
|
351
|
+
selection: selectionAfterTable
|
|
352
|
+
})(state);
|
|
353
|
+
|
|
354
|
+
if (dispatch) {
|
|
355
|
+
dispatch(tr);
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
return false;
|
|
303
361
|
}
|
|
304
362
|
}
|
|
305
363
|
|