@atlaskit/editor-plugin-table 4.2.1 → 5.1.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 +16 -0
- package/dist/cjs/plugins/table/commands/selection.js +19 -22
- package/dist/cjs/plugins/table/index.js +45 -38
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/actions.js +12 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +27 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/consts.js +11 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/index.js +32 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +13 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +8 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +28 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/reducer.js +28 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/types.js +5 -0
- package/dist/es2019/plugins/table/commands/selection.js +14 -20
- package/dist/es2019/plugins/table/index.js +10 -5
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/actions.js +6 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +14 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/consts.js +5 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/index.js +3 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +8 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +22 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/reducer.js +20 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/types.js +1 -0
- package/dist/esm/plugins/table/commands/selection.js +19 -22
- package/dist/esm/plugins/table/index.js +45 -39
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/actions.js +6 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +22 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/consts.js +5 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/index.js +3 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +7 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +22 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/reducer.js +21 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/types.js +1 -0
- package/dist/types/plugins/table/commands/selection.d.ts +4 -4
- package/dist/types/plugins/table/index.d.ts +3 -10
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +15 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +4 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/consts.d.ts +6 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/index.d.ts +4 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin-factory.d.ts +2 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin-key.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/reducer.d.ts +4 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/types.d.ts +5 -0
- package/dist/types/plugins/table/pm-plugins/table-selection-keymap.d.ts +4 -3
- package/dist/types-ts4.5/i18n/cs.d.ts +37 -0
- package/dist/types-ts4.5/i18n/da.d.ts +35 -0
- package/dist/types-ts4.5/i18n/de.d.ts +35 -0
- package/dist/types-ts4.5/i18n/en.d.ts +37 -0
- package/dist/types-ts4.5/i18n/en_GB.d.ts +37 -0
- package/dist/types-ts4.5/i18n/en_ZZ.d.ts +37 -0
- package/dist/types-ts4.5/i18n/es.d.ts +35 -0
- package/dist/types-ts4.5/i18n/fi.d.ts +35 -0
- package/dist/types-ts4.5/i18n/fr.d.ts +37 -0
- package/dist/types-ts4.5/i18n/hu.d.ts +37 -0
- package/dist/types-ts4.5/i18n/it.d.ts +37 -0
- package/dist/types-ts4.5/i18n/ja.d.ts +37 -0
- package/dist/types-ts4.5/i18n/ko.d.ts +35 -0
- package/dist/types-ts4.5/i18n/nb.d.ts +35 -0
- package/dist/types-ts4.5/i18n/nl.d.ts +37 -0
- package/dist/types-ts4.5/i18n/pl.d.ts +37 -0
- package/dist/types-ts4.5/i18n/pt_BR.d.ts +37 -0
- package/dist/types-ts4.5/i18n/ru.d.ts +37 -0
- package/dist/types-ts4.5/i18n/sv.d.ts +35 -0
- package/dist/types-ts4.5/i18n/th.d.ts +35 -0
- package/dist/types-ts4.5/i18n/tr.d.ts +37 -0
- package/dist/types-ts4.5/i18n/uk.d.ts +37 -0
- package/dist/types-ts4.5/i18n/vi.d.ts +35 -0
- package/dist/types-ts4.5/i18n/zh.d.ts +37 -0
- package/dist/types-ts4.5/i18n/zh_TW.d.ts +37 -0
- package/dist/types-ts4.5/index.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/commands/clear.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/commands/collapse.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/commands/delete.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/commands/go-to-next-cell.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/commands/index.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/commands/insert.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +29 -0
- package/dist/types-ts4.5/plugins/table/commands/referentiality.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/commands/selection.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/commands/sort.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/commands/split-cell.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/commands/toggle.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/commands-with-analytics.d.ts +25 -0
- package/dist/types-ts4.5/plugins/table/create-plugin-config.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/handlers.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/index.d.ts +38 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +24 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +73 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +44 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +25 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableStickyScrollbar.d.ts +24 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +33 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/tableCell.d.ts +17 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +26 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/update-overflow-shadows.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +7 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/index.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/types.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/default-table-selection.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/consts.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin-factory.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/reducer.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/types.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/keymap.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-factory.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/commands.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/index.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +73 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/types.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/util.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-analytics.d.ts +23 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-local-id.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/commands.d.ts +23 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/index.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/reducer.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +23 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +14 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/consts.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +13 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +20 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +29 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +21 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +22 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-selection-keymap.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-width.d.ts +17 -0
- package/dist/types-ts4.5/plugins/table/reducer.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/toolbar.d.ts +36 -0
- package/dist/types-ts4.5/plugins/table/transforms/column-width.d.ts +37 -0
- package/dist/types-ts4.5/plugins/table/transforms/delete-columns.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/transforms/delete-rows.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/transforms/fix-tables.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/transforms/index.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/transforms/merge.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/transforms/replace-table.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/transforms/split.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/types.d.ts +342 -0
- package/dist/types-ts4.5/plugins/table/ui/ColumnResizeWidget/index.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/FixedButton.d.ts +23 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/index.d.ts +21 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/styles.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +87 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/index.d.ts +23 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/styles.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +13 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/index.d.ts +54 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +13 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +35 -0
- package/dist/types-ts4.5/plugins/table/ui/LayoutButton/index.d.ts +21 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +21 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +17 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +39 -0
- package/dist/types-ts4.5/plugins/table/ui/common-styles.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +50 -0
- package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +63 -0
- package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/utils/analytics.d.ts +45 -0
- package/dist/types-ts4.5/plugins/table/utils/collapse.d.ts +29 -0
- package/dist/types-ts4.5/plugins/table/utils/column-controls.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +19 -0
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +20 -0
- package/dist/types-ts4.5/plugins/table/utils/get-allow-add-column-custom-step.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/utils/guidelines.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +11 -0
- package/dist/types-ts4.5/plugins/table/utils/nodes.d.ts +13 -0
- package/dist/types-ts4.5/plugins/table/utils/paste.d.ts +14 -0
- package/dist/types-ts4.5/plugins/table/utils/row-controls.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/utils/selection.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/utils/snapping.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/utils/table.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/utils/update-plugin-state-decorations.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table-plugin.d.ts +2 -0
- package/dist/types-ts4.5/types/i18n.d.ts +5 -0
- package/package.json +4 -3
- package/report.api.md +2 -17
- package/src/__tests__/unit/analytics.ts +1 -1
- package/src/__tests__/unit/collab.ts +1 -1
- package/src/__tests__/unit/commands/go-to-next-cell.ts +1 -1
- package/src/__tests__/unit/commands/insert.ts +1 -1
- package/src/__tests__/unit/commands/misc.ts +1 -1
- package/src/__tests__/unit/commands/sort.ts +1 -1
- package/src/__tests__/unit/commands.ts +1 -1
- package/src/__tests__/unit/copy-paste.ts +1 -1
- package/src/__tests__/unit/event-handlers/index.ts +1 -1
- package/src/__tests__/unit/event-handlers.ts +1 -1
- package/src/__tests__/unit/fix-tables.ts +1 -1
- package/src/__tests__/unit/get-toolbar-config.ts +1 -1
- package/src/__tests__/unit/handlers.ts +1 -2
- package/src/__tests__/unit/hover-selection.ts +1 -2
- package/src/__tests__/unit/index.ts +1 -2
- package/src/__tests__/unit/layout.ts +1 -2
- package/src/__tests__/unit/nodeviews/cell.ts +1 -1
- package/src/__tests__/unit/nodeviews/table.ts +1 -1
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +1 -1
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +1 -1
- package/src/__tests__/unit/pm-plugins/main.ts +1 -1
- package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +1 -1
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +1 -1
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +1 -1
- package/src/__tests__/unit/pm-plugins/table-width.ts +1 -1
- package/src/__tests__/unit/sort-column.ts +1 -1
- package/src/__tests__/unit/toolbar.ts +1 -1
- package/src/__tests__/unit/transforms/delete-columns.ts +1 -1
- package/src/__tests__/unit/transforms/delete-rows.ts +1 -1
- package/src/__tests__/unit/transforms/merging.ts +1 -1
- package/src/__tests__/unit/ui/ContextualMenu.tsx +1 -1
- package/src/__tests__/unit/ui/CornerControls.tsx +1 -1
- package/src/__tests__/unit/ui/FloatingContextualButton.tsx +1 -1
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +1 -1
- package/src/__tests__/unit/ui/RowControls.tsx +1 -1
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +1 -1
- package/src/__tests__/unit/undo-redo.ts +1 -1
- package/src/__tests__/unit/utils/collapse.ts +1 -1
- package/src/__tests__/unit/utils/nodes.ts +1 -1
- package/src/__tests__/unit/utils/row-controls.ts +1 -1
- package/src/__tests__/unit/utils.ts +1 -1
- package/src/plugins/table/commands/selection.ts +101 -33
- package/src/plugins/table/index.tsx +15 -17
- package/src/plugins/table/pm-plugins/drag-and-drop/actions.ts +29 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +32 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/consts.ts +8 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/index.ts +5 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin-factory.ts +8 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin-key.ts +7 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +32 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/reducer.ts +26 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/types.ts +6 -0
- package/src/plugins/table/pm-plugins/table-selection-keymap.ts +6 -3
- package/tmp/api-report-tmp.d.ts +100 -0
- package/tsconfig.app.json +3 -0
- package/tsconfig.dev.json +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 5.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#41273](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41273) [`322add4eb2a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/322add4eb2a) - Created table drag N drop plugin
|
|
8
|
+
|
|
9
|
+
## 5.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [#40750](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40750) [`fc19a7b9edd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fc19a7b9edd) - [ED-19875] Extraction of Editor Core's Selection Plugin into independent package '@atlaskit/editor-plugin-selection'.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 4.2.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -48,15 +48,14 @@ var arrowLeftFromCellSelection = function arrowLeftFromCellSelection(editorSelec
|
|
|
48
48
|
return function (selection) {
|
|
49
49
|
return function (state, dispatch) {
|
|
50
50
|
if ((0, _utils.isTableSelected)(state.selection) && editorSelectionAPI) {
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
if (selectionRelativeToNode === _selection.RelativeSelectionPos.Start) {
|
|
51
|
+
var selectionState = editorSelectionAPI.sharedState.currentState() || {};
|
|
52
|
+
if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === _selection.RelativeSelectionPos.Start) {
|
|
54
53
|
// we have full table cell selection and want to set gap cursor selection before table
|
|
55
54
|
return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
|
|
56
|
-
} else if (selectionRelativeToNode === _selection.RelativeSelectionPos.End) {
|
|
55
|
+
} else if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === _selection.RelativeSelectionPos.End) {
|
|
57
56
|
// we have full table cell selection and want to set selection at end of last cell
|
|
58
57
|
return setSelectionAtEndOfLastCell(editorSelectionAPI)(selection)(state, dispatch);
|
|
59
|
-
} else if (selectionRelativeToNode === undefined) {
|
|
58
|
+
} else if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === undefined) {
|
|
60
59
|
// we have full table cell selection and want to set selection at start of first cell
|
|
61
60
|
return setSelectionAtStartOfFirstCell(editorSelectionAPI)(selection, _selection.RelativeSelectionPos.Before)(state, dispatch);
|
|
62
61
|
}
|
|
@@ -69,8 +68,8 @@ var arrowRightFromCellSelection = function arrowRightFromCellSelection(editorSel
|
|
|
69
68
|
return function (selection) {
|
|
70
69
|
return function (state, dispatch) {
|
|
71
70
|
if ((0, _utils.isTableSelected)(state.selection) && editorSelectionAPI) {
|
|
72
|
-
var
|
|
73
|
-
selectionRelativeToNode =
|
|
71
|
+
var _ref = editorSelectionAPI.sharedState.currentState() || {},
|
|
72
|
+
selectionRelativeToNode = _ref.selectionRelativeToNode;
|
|
74
73
|
if (selectionRelativeToNode === _selection.RelativeSelectionPos.Start) {
|
|
75
74
|
// we have full table cell selection and want to set selection at start of first cell
|
|
76
75
|
return setSelectionAtStartOfFirstCell(editorSelectionAPI)(selection)(state, dispatch);
|
|
@@ -102,9 +101,8 @@ var arrowLeftFromGapCursor = function arrowLeftFromGapCursor(editorSelectionAPI)
|
|
|
102
101
|
} else if (side === _selection.Side.LEFT) {
|
|
103
102
|
var table = (0, _utils.findTable)(selection);
|
|
104
103
|
if (table && isSelectionAtStartOfTable($from, selection) && editorSelectionAPI) {
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
if (selectionRelativeToNode === _selection.RelativeSelectionPos.Before) {
|
|
104
|
+
var selectionState = editorSelectionAPI.sharedState.currentState() || {};
|
|
105
|
+
if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === _selection.RelativeSelectionPos.Before) {
|
|
108
106
|
// we have a gap cursor at start of first table cell and want to set a gap cursor selection before table
|
|
109
107
|
return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
|
|
110
108
|
} else {
|
|
@@ -161,9 +159,8 @@ var arrowLeftFromText = function arrowLeftFromText(editorSelectionAPI) {
|
|
|
161
159
|
if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 &&
|
|
162
160
|
// + 3 for: row, cell & paragraph nodes
|
|
163
161
|
editorSelectionAPI) {
|
|
164
|
-
var
|
|
165
|
-
|
|
166
|
-
if (selectionRelativeToNode === _selection.RelativeSelectionPos.Before) {
|
|
162
|
+
var selectionState = editorSelectionAPI.sharedState.currentState() || {};
|
|
163
|
+
if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === _selection.RelativeSelectionPos.Before) {
|
|
167
164
|
// we have a text selection at start of first table cell, directly inside a top level paragraph,
|
|
168
165
|
// and want to set gap cursor selection before table
|
|
169
166
|
return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
|
|
@@ -211,10 +208,10 @@ var arrowRightFromText = function arrowRightFromText(editorSelectionAPI) {
|
|
|
211
208
|
* pos in the selection plugin
|
|
212
209
|
*/
|
|
213
210
|
var selectFullTable = function selectFullTable(editorSelectionAPI) {
|
|
214
|
-
return function (
|
|
215
|
-
var node =
|
|
216
|
-
startPos =
|
|
217
|
-
dir =
|
|
211
|
+
return function (_ref2) {
|
|
212
|
+
var node = _ref2.node,
|
|
213
|
+
startPos = _ref2.startPos,
|
|
214
|
+
dir = _ref2.dir;
|
|
218
215
|
return function (state, dispatch) {
|
|
219
216
|
var doc = state.doc;
|
|
220
217
|
var _TableMap$get = _tableMap.TableMap.get(node),
|
|
@@ -231,7 +228,7 @@ var selectFullTable = function selectFullTable(editorSelectionAPI) {
|
|
|
231
228
|
selectionRelativeToNode = _selection.RelativeSelectionPos.Start;
|
|
232
229
|
}
|
|
233
230
|
if (editorSelectionAPI) {
|
|
234
|
-
var tr = editorSelectionAPI.
|
|
231
|
+
var tr = editorSelectionAPI.actions.selectNearNode({
|
|
235
232
|
selectionRelativeToNode: selectionRelativeToNode,
|
|
236
233
|
selection: fullTableSelection
|
|
237
234
|
})(state);
|
|
@@ -255,7 +252,7 @@ var setSelectionAtStartOfFirstCell = function setSelectionAtStartOfFirstCell(edi
|
|
|
255
252
|
// check if first pos should have a gap cursor, otherwise find closest text selection
|
|
256
253
|
var selectionAtStartOfCell = _selection.GapCursorSelection.valid($firstPosInsideCell) ? new _selection.GapCursorSelection($firstPosInsideCell, _selection.Side.LEFT) : _state.Selection.findFrom($firstPosInsideCell, 1);
|
|
257
254
|
if (editorSelectionAPI) {
|
|
258
|
-
var tr = editorSelectionAPI.
|
|
255
|
+
var tr = editorSelectionAPI.actions.selectNearNode({
|
|
259
256
|
selectionRelativeToNode: selectionRelativeToNode,
|
|
260
257
|
selection: selectionAtStartOfCell
|
|
261
258
|
})(state);
|
|
@@ -280,7 +277,7 @@ var setSelectionAtEndOfLastCell = function setSelectionAtEndOfLastCell(editorSel
|
|
|
280
277
|
// check if last pos should have a gap cursor, otherwise find closest text selection
|
|
281
278
|
var selectionAtEndOfCell = _selection.GapCursorSelection.valid($lastPosInsideCell) ? new _selection.GapCursorSelection($lastPosInsideCell, _selection.Side.RIGHT) : _state.Selection.findFrom($lastPosInsideCell, -1);
|
|
282
279
|
if (editorSelectionAPI) {
|
|
283
|
-
var tr = editorSelectionAPI.
|
|
280
|
+
var tr = editorSelectionAPI.actions.selectNearNode({
|
|
284
281
|
selectionRelativeToNode: selectionRelativeToNode,
|
|
285
282
|
selection: selectionAtEndOfCell
|
|
286
283
|
})(state);
|
|
@@ -302,7 +299,7 @@ var setGapCursorBeforeTable = function setGapCursorBeforeTable(editorSelectionAP
|
|
|
302
299
|
if (_selection.GapCursorSelection.valid($beforeTablePos)) {
|
|
303
300
|
var selectionBeforeTable = new _selection.GapCursorSelection($beforeTablePos, _selection.Side.LEFT);
|
|
304
301
|
if (editorSelectionAPI) {
|
|
305
|
-
var tr = editorSelectionAPI.
|
|
302
|
+
var tr = editorSelectionAPI.actions.selectNearNode({
|
|
306
303
|
selectionRelativeToNode: undefined,
|
|
307
304
|
selection: selectionBeforeTable
|
|
308
305
|
})(state);
|
|
@@ -326,7 +323,7 @@ var setGapCursorAfterTable = function setGapCursorAfterTable(editorSelectionAPI)
|
|
|
326
323
|
if (_selection.GapCursorSelection.valid($afterTablePos)) {
|
|
327
324
|
var selectionAfterTable = new _selection.GapCursorSelection($afterTablePos, _selection.Side.RIGHT);
|
|
328
325
|
if (editorSelectionAPI) {
|
|
329
|
-
var tr = editorSelectionAPI.
|
|
326
|
+
var tr = editorSelectionAPI.actions.selectNearNode({
|
|
330
327
|
selectionRelativeToNode: undefined,
|
|
331
328
|
selection: selectionAfterTable
|
|
332
329
|
})(state);
|
|
@@ -20,6 +20,7 @@ var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
|
20
20
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
21
|
var _createPluginConfig = require("./create-plugin-config");
|
|
22
22
|
var _plugin = require("./pm-plugins/decorations/plugin");
|
|
23
|
+
var _dragAndDrop = require("./pm-plugins/drag-and-drop");
|
|
23
24
|
var _keymap = require("./pm-plugins/keymap");
|
|
24
25
|
var _main = require("./pm-plugins/main");
|
|
25
26
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
@@ -37,8 +38,6 @@ var _FloatingDeleteButton = _interopRequireDefault(require("./ui/FloatingDeleteB
|
|
|
37
38
|
var _FloatingInsertButton = _interopRequireDefault(require("./ui/FloatingInsertButton"));
|
|
38
39
|
var _LayoutButton = _interopRequireDefault(require("./ui/LayoutButton"));
|
|
39
40
|
var _utils3 = require("./utils");
|
|
40
|
-
// TODO: duplicated SelectionPlugin type as it's still in editor-core, doing this avoid
|
|
41
|
-
// circular dependencies
|
|
42
41
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
43
42
|
return {};
|
|
44
43
|
};
|
|
@@ -146,7 +145,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
146
145
|
}, {
|
|
147
146
|
name: 'tableSelectionKeymap',
|
|
148
147
|
plugin: function plugin() {
|
|
149
|
-
return (0, _tableSelectionKeymap.tableSelectionKeymapPlugin)(
|
|
148
|
+
return (0, _tableSelectionKeymap.tableSelectionKeymapPlugin)(api === null || api === void 0 ? void 0 : api.selection);
|
|
150
149
|
}
|
|
151
150
|
}, {
|
|
152
151
|
name: 'tableEditing',
|
|
@@ -177,25 +176,32 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
177
176
|
}, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags) : undefined;
|
|
178
177
|
}
|
|
179
178
|
}, {
|
|
180
|
-
name: '
|
|
179
|
+
name: 'tableDragAndDrop',
|
|
181
180
|
plugin: function plugin(_ref8) {
|
|
182
|
-
var dispatch = _ref8.dispatch
|
|
181
|
+
var dispatch = _ref8.dispatch,
|
|
182
|
+
eventDispatcher = _ref8.eventDispatcher;
|
|
183
|
+
return options !== null && options !== void 0 && options.dragAndDropEnabled ? (0, _dragAndDrop.createPlugin)(dispatch, eventDispatcher) : undefined;
|
|
184
|
+
}
|
|
185
|
+
}, {
|
|
186
|
+
name: 'tableLocalId',
|
|
187
|
+
plugin: function plugin(_ref9) {
|
|
188
|
+
var dispatch = _ref9.dispatch;
|
|
183
189
|
return (0, _tableLocalId.createPlugin)(dispatch);
|
|
184
190
|
}
|
|
185
191
|
}, {
|
|
186
192
|
name: 'tableWidth',
|
|
187
|
-
plugin: function plugin(
|
|
193
|
+
plugin: function plugin(_ref10) {
|
|
188
194
|
var _options$fullWidthEna;
|
|
189
|
-
var dispatchAnalyticsEvent =
|
|
190
|
-
dispatch =
|
|
195
|
+
var dispatchAnalyticsEvent = _ref10.dispatchAnalyticsEvent,
|
|
196
|
+
dispatch = _ref10.dispatch;
|
|
191
197
|
return options !== null && options !== void 0 && options.tableResizingEnabled ? (0, _tableWidth.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
|
|
192
198
|
}
|
|
193
199
|
}, {
|
|
194
200
|
name: 'tableAnalyticsPlugin',
|
|
195
|
-
plugin: function plugin(
|
|
201
|
+
plugin: function plugin(_ref11) {
|
|
196
202
|
var _options$tableResizin;
|
|
197
|
-
var dispatch =
|
|
198
|
-
dispatchAnalyticsEvent =
|
|
203
|
+
var dispatch = _ref11.dispatch,
|
|
204
|
+
dispatchAnalyticsEvent = _ref11.dispatchAnalyticsEvent;
|
|
199
205
|
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.overflow-state-analytics') ? (0, _tableAnalytics.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$tableResizin = options === null || options === void 0 ? void 0 : options.tableResizingEnabled) !== null && _options$tableResizin !== void 0 ? _options$tableResizin : false) : undefined;
|
|
200
206
|
}
|
|
201
207
|
}, {
|
|
@@ -226,12 +232,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
226
232
|
}
|
|
227
233
|
return plugins;
|
|
228
234
|
},
|
|
229
|
-
contentComponent: function contentComponent(
|
|
230
|
-
var editorView =
|
|
231
|
-
popupsMountPoint =
|
|
232
|
-
popupsBoundariesElement =
|
|
233
|
-
popupsScrollableElement =
|
|
234
|
-
dispatchAnalyticsEvent =
|
|
235
|
+
contentComponent: function contentComponent(_ref12) {
|
|
236
|
+
var editorView = _ref12.editorView,
|
|
237
|
+
popupsMountPoint = _ref12.popupsMountPoint,
|
|
238
|
+
popupsBoundariesElement = _ref12.popupsBoundariesElement,
|
|
239
|
+
popupsScrollableElement = _ref12.popupsScrollableElement,
|
|
240
|
+
dispatchAnalyticsEvent = _ref12.dispatchAnalyticsEvent;
|
|
235
241
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
236
242
|
component: _analytics.ACTION_SUBJECT.TABLES_PLUGIN,
|
|
237
243
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -242,30 +248,31 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
242
248
|
tablePluginState: _pluginKey.pluginKey,
|
|
243
249
|
tableWidthPluginState: _tableWidth.pluginKey,
|
|
244
250
|
tableResizingPluginState: _tableResizing.pluginKey,
|
|
245
|
-
stickyHeadersState: _stickyHeaders.pluginKey
|
|
251
|
+
stickyHeadersState: _stickyHeaders.pluginKey,
|
|
252
|
+
dragAndDropState: _dragAndDrop.pluginKey
|
|
246
253
|
},
|
|
247
|
-
render: function render(
|
|
248
|
-
var resizingPluginState =
|
|
249
|
-
stickyHeadersState =
|
|
250
|
-
tablePluginState =
|
|
251
|
-
tableWidthPluginState =
|
|
254
|
+
render: function render(_ref13) {
|
|
255
|
+
var resizingPluginState = _ref13.tableResizingPluginState,
|
|
256
|
+
stickyHeadersState = _ref13.stickyHeadersState,
|
|
257
|
+
tablePluginState = _ref13.tablePluginState,
|
|
258
|
+
tableWidthPluginState = _ref13.tableWidthPluginState;
|
|
252
259
|
var state = editorView.state;
|
|
253
260
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
254
261
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
255
262
|
var isResizing = isColumnResizing || isTableResizing;
|
|
256
|
-
var
|
|
257
|
-
tableNode =
|
|
258
|
-
tablePos =
|
|
259
|
-
targetCellPosition =
|
|
260
|
-
isContextualMenuOpen =
|
|
261
|
-
layout =
|
|
262
|
-
tableRef =
|
|
263
|
-
pluginConfig =
|
|
264
|
-
insertColumnButtonIndex =
|
|
265
|
-
insertRowButtonIndex =
|
|
266
|
-
isHeaderColumnEnabled =
|
|
267
|
-
isHeaderRowEnabled =
|
|
268
|
-
tableWrapperTarget =
|
|
263
|
+
var _ref14 = tablePluginState,
|
|
264
|
+
tableNode = _ref14.tableNode,
|
|
265
|
+
tablePos = _ref14.tablePos,
|
|
266
|
+
targetCellPosition = _ref14.targetCellPosition,
|
|
267
|
+
isContextualMenuOpen = _ref14.isContextualMenuOpen,
|
|
268
|
+
layout = _ref14.layout,
|
|
269
|
+
tableRef = _ref14.tableRef,
|
|
270
|
+
pluginConfig = _ref14.pluginConfig,
|
|
271
|
+
insertColumnButtonIndex = _ref14.insertColumnButtonIndex,
|
|
272
|
+
insertRowButtonIndex = _ref14.insertRowButtonIndex,
|
|
273
|
+
isHeaderColumnEnabled = _ref14.isHeaderColumnEnabled,
|
|
274
|
+
isHeaderRowEnabled = _ref14.isHeaderRowEnabled,
|
|
275
|
+
tableWrapperTarget = _ref14.tableWrapperTarget;
|
|
269
276
|
var allowControls = pluginConfig.allowControls;
|
|
270
277
|
var stickyHeader = stickyHeadersState ? (0, _stickyHeaders.findStickyHeaderForTable)(stickyHeadersState, tablePos) : undefined;
|
|
271
278
|
var LayoutContent = options && !options.tableResizingEnabled && (0, _utils3.isLayoutSupported)(state) && options.breakoutEnabled ? /*#__PURE__*/_react.default.createElement(_LayoutButton.default, {
|
|
@@ -331,8 +338,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
331
338
|
}));
|
|
332
339
|
},
|
|
333
340
|
pluginsOptions: {
|
|
334
|
-
quickInsert: function quickInsert(
|
|
335
|
-
var formatMessage =
|
|
341
|
+
quickInsert: function quickInsert(_ref15) {
|
|
342
|
+
var formatMessage = _ref15.formatMessage;
|
|
336
343
|
return [{
|
|
337
344
|
id: 'table',
|
|
338
345
|
title: formatMessage(_messages.toolbarInsertBlockMessages.table),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DragAndDropActionType = void 0;
|
|
7
|
+
var DragAndDropActionType = exports.DragAndDropActionType = {
|
|
8
|
+
SET_DROP_TARGET: 'SET_DROP_TARGET',
|
|
9
|
+
CLEAR_DROP_TARGET: 'CLEAR_DROP_TARGET'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// NOTE: This should be a Union of all possible actions
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setDropTarget = exports.clearDropTarget = void 0;
|
|
7
|
+
var _actions = require("./actions");
|
|
8
|
+
var _pluginFactory = require("./plugin-factory");
|
|
9
|
+
// TODO: This command is a placeholder example. Please replace this if required.
|
|
10
|
+
var setDropTarget = exports.setDropTarget = function setDropTarget(type, index, tr) {
|
|
11
|
+
return (0, _pluginFactory.createCommand)({
|
|
12
|
+
type: _actions.DragAndDropActionType.SET_DROP_TARGET,
|
|
13
|
+
data: {
|
|
14
|
+
type: type,
|
|
15
|
+
index: index
|
|
16
|
+
}
|
|
17
|
+
}, function (originalTr) {
|
|
18
|
+
return (tr || originalTr).setMeta('addToHistory', false);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var clearDropTarget = exports.clearDropTarget = function clearDropTarget(tr) {
|
|
22
|
+
return (0, _pluginFactory.createCommand)({
|
|
23
|
+
type: _actions.DragAndDropActionType.CLEAR_DROP_TARGET
|
|
24
|
+
}, function (originalTr) {
|
|
25
|
+
return (tr || originalTr).setMeta('addToHistory', false);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "clearDropTarget", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _commands.clearDropTarget;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "createPlugin", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _plugin.createPlugin;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "pluginKey", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _pluginKey.pluginKey;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "setDropTarget", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _commands.setDropTarget;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _plugin = require("./plugin");
|
|
31
|
+
var _pluginKey = require("./plugin-key");
|
|
32
|
+
var _commands = require("./commands");
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createPluginState = exports.createCommand = void 0;
|
|
8
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
|
+
var _pluginKey = require("./plugin-key");
|
|
10
|
+
var _reducer = _interopRequireDefault(require("./reducer"));
|
|
11
|
+
var _pluginFactory = (0, _utils.pluginFactory)(_pluginKey.pluginKey, _reducer.default),
|
|
12
|
+
createPluginState = exports.createPluginState = _pluginFactory.createPluginState,
|
|
13
|
+
createCommand = exports.createCommand = _pluginFactory.createCommand;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createPlugin = void 0;
|
|
7
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
+
var _consts = require("./consts");
|
|
9
|
+
var _pluginFactory = require("./plugin-factory");
|
|
10
|
+
var _pluginKey = require("./plugin-key");
|
|
11
|
+
var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventDispatcher) {
|
|
12
|
+
return new _safePlugin.SafePlugin({
|
|
13
|
+
state: (0, _pluginFactory.createPluginState)(dispatch, {
|
|
14
|
+
// TODO: This is example placeholder state. We could use this to track which row/col is currently set as the drop target
|
|
15
|
+
// This would result in a blue highlight being displayed on the corrisponding row/column to single the drop target location.
|
|
16
|
+
dropTargetType: _consts.DropTargetType.NONE,
|
|
17
|
+
dropTargetIndex: 0
|
|
18
|
+
}),
|
|
19
|
+
key: _pluginKey.pluginKey,
|
|
20
|
+
view: function view(editorView) {
|
|
21
|
+
// TODO: Add Pragmatic DnD monitor when the view is constructed.
|
|
22
|
+
return {
|
|
23
|
+
// TODO: Cleanup monitor instance
|
|
24
|
+
// destroy: cleanup,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _actions = require("./actions");
|
|
10
|
+
var _consts = require("./consts");
|
|
11
|
+
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; }
|
|
12
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
13
|
+
var _default = exports.default = function _default(pluginState, action) {
|
|
14
|
+
switch (action.type) {
|
|
15
|
+
case _actions.DragAndDropActionType.SET_DROP_TARGET:
|
|
16
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
17
|
+
dropTargetType: action.data.type,
|
|
18
|
+
dropTargetIndex: action.data.index
|
|
19
|
+
});
|
|
20
|
+
case _actions.DragAndDropActionType.CLEAR_DROP_TARGET:
|
|
21
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
22
|
+
dropTargetType: _consts.DropTargetType.NONE,
|
|
23
|
+
dropTargetIndex: 0
|
|
24
|
+
});
|
|
25
|
+
default:
|
|
26
|
+
return pluginState;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -36,16 +36,14 @@ export const arrowRightFromTable = editorSelectionAPI => () => (state, dispatch)
|
|
|
36
36
|
};
|
|
37
37
|
const arrowLeftFromCellSelection = editorSelectionAPI => selection => (state, dispatch) => {
|
|
38
38
|
if (isTableSelected(state.selection) && editorSelectionAPI) {
|
|
39
|
-
const {
|
|
40
|
-
|
|
41
|
-
} = editorSelectionAPI.getSelectionPluginState(state);
|
|
42
|
-
if (selectionRelativeToNode === RelativeSelectionPos.Start) {
|
|
39
|
+
const selectionState = editorSelectionAPI.sharedState.currentState() || {};
|
|
40
|
+
if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === RelativeSelectionPos.Start) {
|
|
43
41
|
// we have full table cell selection and want to set gap cursor selection before table
|
|
44
42
|
return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
|
|
45
|
-
} else if (selectionRelativeToNode === RelativeSelectionPos.End) {
|
|
43
|
+
} else if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === RelativeSelectionPos.End) {
|
|
46
44
|
// we have full table cell selection and want to set selection at end of last cell
|
|
47
45
|
return setSelectionAtEndOfLastCell(editorSelectionAPI)(selection)(state, dispatch);
|
|
48
|
-
} else if (selectionRelativeToNode === undefined) {
|
|
46
|
+
} else if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === undefined) {
|
|
49
47
|
// we have full table cell selection and want to set selection at start of first cell
|
|
50
48
|
return setSelectionAtStartOfFirstCell(editorSelectionAPI)(selection, RelativeSelectionPos.Before)(state, dispatch);
|
|
51
49
|
}
|
|
@@ -56,7 +54,7 @@ const arrowRightFromCellSelection = editorSelectionAPI => selection => (state, d
|
|
|
56
54
|
if (isTableSelected(state.selection) && editorSelectionAPI) {
|
|
57
55
|
const {
|
|
58
56
|
selectionRelativeToNode
|
|
59
|
-
} = editorSelectionAPI.
|
|
57
|
+
} = editorSelectionAPI.sharedState.currentState() || {};
|
|
60
58
|
if (selectionRelativeToNode === RelativeSelectionPos.Start) {
|
|
61
59
|
// we have full table cell selection and want to set selection at start of first cell
|
|
62
60
|
return setSelectionAtStartOfFirstCell(editorSelectionAPI)(selection)(state, dispatch);
|
|
@@ -88,10 +86,8 @@ const arrowLeftFromGapCursor = editorSelectionAPI => selection => (state, dispat
|
|
|
88
86
|
} else if (side === Side.LEFT) {
|
|
89
87
|
const table = findTable(selection);
|
|
90
88
|
if (table && isSelectionAtStartOfTable($from, selection) && editorSelectionAPI) {
|
|
91
|
-
const {
|
|
92
|
-
|
|
93
|
-
} = editorSelectionAPI.getSelectionPluginState(state);
|
|
94
|
-
if (selectionRelativeToNode === RelativeSelectionPos.Before) {
|
|
89
|
+
const selectionState = editorSelectionAPI.sharedState.currentState() || {};
|
|
90
|
+
if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === RelativeSelectionPos.Before) {
|
|
95
91
|
// we have a gap cursor at start of first table cell and want to set a gap cursor selection before table
|
|
96
92
|
return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
|
|
97
93
|
} else {
|
|
@@ -144,10 +140,8 @@ const arrowLeftFromText = editorSelectionAPI => selection => (state, dispatch) =
|
|
|
144
140
|
if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 &&
|
|
145
141
|
// + 3 for: row, cell & paragraph nodes
|
|
146
142
|
editorSelectionAPI) {
|
|
147
|
-
const {
|
|
148
|
-
|
|
149
|
-
} = editorSelectionAPI.getSelectionPluginState(state);
|
|
150
|
-
if (selectionRelativeToNode === RelativeSelectionPos.Before) {
|
|
143
|
+
const selectionState = editorSelectionAPI.sharedState.currentState() || {};
|
|
144
|
+
if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === RelativeSelectionPos.Before) {
|
|
151
145
|
// we have a text selection at start of first table cell, directly inside a top level paragraph,
|
|
152
146
|
// and want to set gap cursor selection before table
|
|
153
147
|
return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
|
|
@@ -213,7 +207,7 @@ const selectFullTable = editorSelectionAPI => ({
|
|
|
213
207
|
selectionRelativeToNode = RelativeSelectionPos.Start;
|
|
214
208
|
}
|
|
215
209
|
if (editorSelectionAPI) {
|
|
216
|
-
const tr = editorSelectionAPI.
|
|
210
|
+
const tr = editorSelectionAPI.actions.selectNearNode({
|
|
217
211
|
selectionRelativeToNode,
|
|
218
212
|
selection: fullTableSelection
|
|
219
213
|
})(state);
|
|
@@ -235,7 +229,7 @@ const setSelectionAtStartOfFirstCell = editorSelectionAPI => (selection, selecti
|
|
|
235
229
|
// check if first pos should have a gap cursor, otherwise find closest text selection
|
|
236
230
|
const selectionAtStartOfCell = GapCursorSelection.valid($firstPosInsideCell) ? new GapCursorSelection($firstPosInsideCell, Side.LEFT) : Selection.findFrom($firstPosInsideCell, 1);
|
|
237
231
|
if (editorSelectionAPI) {
|
|
238
|
-
const tr = editorSelectionAPI.
|
|
232
|
+
const tr = editorSelectionAPI.actions.selectNearNode({
|
|
239
233
|
selectionRelativeToNode,
|
|
240
234
|
selection: selectionAtStartOfCell
|
|
241
235
|
})(state);
|
|
@@ -258,7 +252,7 @@ const setSelectionAtEndOfLastCell = editorSelectionAPI => (selection, selectionR
|
|
|
258
252
|
// check if last pos should have a gap cursor, otherwise find closest text selection
|
|
259
253
|
const selectionAtEndOfCell = GapCursorSelection.valid($lastPosInsideCell) ? new GapCursorSelection($lastPosInsideCell, Side.RIGHT) : Selection.findFrom($lastPosInsideCell, -1);
|
|
260
254
|
if (editorSelectionAPI) {
|
|
261
|
-
const tr = editorSelectionAPI.
|
|
255
|
+
const tr = editorSelectionAPI.actions.selectNearNode({
|
|
262
256
|
selectionRelativeToNode,
|
|
263
257
|
selection: selectionAtEndOfCell
|
|
264
258
|
})(state);
|
|
@@ -276,7 +270,7 @@ const setGapCursorBeforeTable = editorSelectionAPI => () => (state, dispatch) =>
|
|
|
276
270
|
if (GapCursorSelection.valid($beforeTablePos)) {
|
|
277
271
|
const selectionBeforeTable = new GapCursorSelection($beforeTablePos, Side.LEFT);
|
|
278
272
|
if (editorSelectionAPI) {
|
|
279
|
-
const tr = editorSelectionAPI.
|
|
273
|
+
const tr = editorSelectionAPI.actions.selectNearNode({
|
|
280
274
|
selectionRelativeToNode: undefined,
|
|
281
275
|
selection: selectionBeforeTable
|
|
282
276
|
})(state);
|
|
@@ -296,7 +290,7 @@ const setGapCursorAfterTable = editorSelectionAPI => () => (state, dispatch) =>
|
|
|
296
290
|
if (GapCursorSelection.valid($afterTablePos)) {
|
|
297
291
|
const selectionAfterTable = new GapCursorSelection($afterTablePos, Side.RIGHT);
|
|
298
292
|
if (editorSelectionAPI) {
|
|
299
|
-
const tr = editorSelectionAPI.
|
|
293
|
+
const tr = editorSelectionAPI.actions.selectNearNode({
|
|
300
294
|
selectionRelativeToNode: undefined,
|
|
301
295
|
selection: selectionAfterTable
|
|
302
296
|
})(state);
|
|
@@ -13,6 +13,7 @@ import { createTable } from '@atlaskit/editor-tables/utils';
|
|
|
13
13
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
import { pluginConfig } from './create-plugin-config';
|
|
15
15
|
import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
|
|
16
|
+
import { createPlugin as createDragAndDropPlugin, pluginKey as dragAndDropPluginKey } from './pm-plugins/drag-and-drop';
|
|
16
17
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
17
18
|
import { createPlugin } from './pm-plugins/main';
|
|
18
19
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
@@ -30,9 +31,6 @@ import FloatingDeleteButton from './ui/FloatingDeleteButton';
|
|
|
30
31
|
import FloatingInsertButton from './ui/FloatingInsertButton';
|
|
31
32
|
import LayoutButton from './ui/LayoutButton';
|
|
32
33
|
import { isLayoutSupported } from './utils';
|
|
33
|
-
|
|
34
|
-
// TODO: duplicated SelectionPlugin type as it's still in editor-core, doing this avoid
|
|
35
|
-
// circular dependencies
|
|
36
34
|
const defaultGetEditorFeatureFlags = () => ({});
|
|
37
35
|
/**
|
|
38
36
|
* Table plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
@@ -137,7 +135,7 @@ const tablesPlugin = ({
|
|
|
137
135
|
plugin: () => keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI)
|
|
138
136
|
}, {
|
|
139
137
|
name: 'tableSelectionKeymap',
|
|
140
|
-
plugin: () => tableSelectionKeymapPlugin(
|
|
138
|
+
plugin: () => tableSelectionKeymapPlugin(api === null || api === void 0 ? void 0 : api.selection)
|
|
141
139
|
}, {
|
|
142
140
|
name: 'tableEditing',
|
|
143
141
|
plugin: () => tableEditing({
|
|
@@ -162,6 +160,12 @@ const tablesPlugin = ({
|
|
|
162
160
|
dispatch,
|
|
163
161
|
eventDispatcher
|
|
164
162
|
}) => options && options.tableOptions.stickyHeaders ? createStickyHeadersPlugin(dispatch, eventDispatcher, () => [], (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags) : undefined
|
|
163
|
+
}, {
|
|
164
|
+
name: 'tableDragAndDrop',
|
|
165
|
+
plugin: ({
|
|
166
|
+
dispatch,
|
|
167
|
+
eventDispatcher
|
|
168
|
+
}) => options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, eventDispatcher) : undefined
|
|
165
169
|
}, {
|
|
166
170
|
name: 'tableLocalId',
|
|
167
171
|
plugin: ({
|
|
@@ -230,7 +234,8 @@ const tablesPlugin = ({
|
|
|
230
234
|
tablePluginState: pluginKey,
|
|
231
235
|
tableWidthPluginState: tableWidthPluginKey,
|
|
232
236
|
tableResizingPluginState: tableResizingPluginKey,
|
|
233
|
-
stickyHeadersState: stickyHeadersPluginKey
|
|
237
|
+
stickyHeadersState: stickyHeadersPluginKey,
|
|
238
|
+
dragAndDropState: dragAndDropPluginKey
|
|
234
239
|
},
|
|
235
240
|
render: ({
|
|
236
241
|
tableResizingPluginState: resizingPluginState,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DragAndDropActionType } from './actions';
|
|
2
|
+
import { createCommand } from './plugin-factory';
|
|
3
|
+
|
|
4
|
+
// TODO: This command is a placeholder example. Please replace this if required.
|
|
5
|
+
export const setDropTarget = (type, index, tr) => createCommand({
|
|
6
|
+
type: DragAndDropActionType.SET_DROP_TARGET,
|
|
7
|
+
data: {
|
|
8
|
+
type,
|
|
9
|
+
index
|
|
10
|
+
}
|
|
11
|
+
}, originalTr => (tr || originalTr).setMeta('addToHistory', false));
|
|
12
|
+
export const clearDropTarget = tr => createCommand({
|
|
13
|
+
type: DragAndDropActionType.CLEAR_DROP_TARGET
|
|
14
|
+
}, originalTr => (tr || originalTr).setMeta('addToHistory', false));
|