@atlaskit/editor-plugin-table 4.2.0 → 5.0.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 +1 -3
- package/dist/cjs/plugins/table/transforms/column-width.js +2 -2
- package/dist/es2019/plugins/table/commands/selection.js +14 -20
- package/dist/es2019/plugins/table/index.js +1 -4
- package/dist/es2019/plugins/table/transforms/column-width.js +2 -2
- package/dist/esm/plugins/table/commands/selection.js +19 -22
- package/dist/esm/plugins/table/index.js +1 -4
- package/dist/esm/plugins/table/transforms/column-width.js +2 -2
- 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/table-selection-keymap.d.ts +4 -3
- package/package.json +3 -2
- 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 +3 -17
- package/src/plugins/table/pm-plugins/table-selection-keymap.ts +6 -3
- package/src/plugins/table/transforms/column-width.ts +8 -2
- package/tsconfig.app.json +3 -0
- package/tsconfig.dev.json +3 -0
- package/dist/types-ts4.5/i18n/cs.d.ts +0 -37
- package/dist/types-ts4.5/i18n/da.d.ts +0 -35
- package/dist/types-ts4.5/i18n/de.d.ts +0 -35
- package/dist/types-ts4.5/i18n/en.d.ts +0 -37
- package/dist/types-ts4.5/i18n/en_GB.d.ts +0 -37
- package/dist/types-ts4.5/i18n/en_ZZ.d.ts +0 -37
- package/dist/types-ts4.5/i18n/es.d.ts +0 -35
- package/dist/types-ts4.5/i18n/fi.d.ts +0 -35
- package/dist/types-ts4.5/i18n/fr.d.ts +0 -37
- package/dist/types-ts4.5/i18n/hu.d.ts +0 -37
- package/dist/types-ts4.5/i18n/it.d.ts +0 -37
- package/dist/types-ts4.5/i18n/ja.d.ts +0 -37
- package/dist/types-ts4.5/i18n/ko.d.ts +0 -35
- package/dist/types-ts4.5/i18n/nb.d.ts +0 -35
- package/dist/types-ts4.5/i18n/nl.d.ts +0 -37
- package/dist/types-ts4.5/i18n/pl.d.ts +0 -37
- package/dist/types-ts4.5/i18n/pt_BR.d.ts +0 -37
- package/dist/types-ts4.5/i18n/ru.d.ts +0 -37
- package/dist/types-ts4.5/i18n/sv.d.ts +0 -35
- package/dist/types-ts4.5/i18n/th.d.ts +0 -35
- package/dist/types-ts4.5/i18n/tr.d.ts +0 -37
- package/dist/types-ts4.5/i18n/uk.d.ts +0 -37
- package/dist/types-ts4.5/i18n/vi.d.ts +0 -35
- package/dist/types-ts4.5/i18n/zh.d.ts +0 -37
- package/dist/types-ts4.5/i18n/zh_TW.d.ts +0 -37
- package/dist/types-ts4.5/index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/commands/clear.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/commands/collapse.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/commands/delete.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/commands/go-to-next-cell.d.ts +0 -4
- package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +0 -8
- package/dist/types-ts4.5/plugins/table/commands/index.d.ts +0 -8
- package/dist/types-ts4.5/plugins/table/commands/insert.d.ts +0 -9
- package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +0 -29
- package/dist/types-ts4.5/plugins/table/commands/referentiality.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/commands/selection.d.ts +0 -8
- package/dist/types-ts4.5/plugins/table/commands/sort.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/commands/split-cell.d.ts +0 -6
- package/dist/types-ts4.5/plugins/table/commands/toggle.d.ts +0 -12
- package/dist/types-ts4.5/plugins/table/commands-with-analytics.d.ts +0 -25
- package/dist/types-ts4.5/plugins/table/create-plugin-config.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +0 -15
- package/dist/types-ts4.5/plugins/table/handlers.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/index.d.ts +0 -45
- package/dist/types-ts4.5/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +0 -24
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +0 -73
- package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +0 -44
- package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +0 -25
- package/dist/types-ts4.5/plugins/table/nodeviews/TableStickyScrollbar.d.ts +0 -24
- package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +0 -9
- package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +0 -9
- package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +0 -33
- package/dist/types-ts4.5/plugins/table/nodeviews/tableCell.d.ts +0 -17
- package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +0 -26
- package/dist/types-ts4.5/plugins/table/nodeviews/update-overflow-shadows.d.ts +0 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +0 -7
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +0 -4
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/index.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/types.d.ts +0 -6
- package/dist/types-ts4.5/plugins/table/pm-plugins/default-table-selection.d.ts +0 -4
- package/dist/types-ts4.5/plugins/table/pm-plugins/keymap.d.ts +0 -5
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +0 -8
- package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-factory.d.ts +0 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +0 -15
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/commands.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/index.d.ts +0 -6
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +0 -6
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +0 -73
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +0 -4
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/types.d.ts +0 -16
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/util.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-analytics.d.ts +0 -23
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-local-id.d.ts +0 -10
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/commands.d.ts +0 -23
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +0 -4
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/index.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +0 -4
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +0 -6
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/reducer.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +0 -23
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +0 -14
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/consts.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +0 -4
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +0 -12
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +0 -13
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +0 -20
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +0 -4
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +0 -29
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -21
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +0 -22
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +0 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-selection-keymap.d.ts +0 -4
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-width.d.ts +0 -17
- package/dist/types-ts4.5/plugins/table/reducer.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/toolbar.d.ts +0 -36
- package/dist/types-ts4.5/plugins/table/transforms/column-width.d.ts +0 -37
- package/dist/types-ts4.5/plugins/table/transforms/delete-columns.d.ts +0 -4
- package/dist/types-ts4.5/plugins/table/transforms/delete-rows.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/transforms/fix-tables.d.ts +0 -9
- package/dist/types-ts4.5/plugins/table/transforms/index.d.ts +0 -6
- package/dist/types-ts4.5/plugins/table/transforms/merge.d.ts +0 -5
- package/dist/types-ts4.5/plugins/table/transforms/replace-table.d.ts +0 -5
- package/dist/types-ts4.5/plugins/table/transforms/split.d.ts +0 -9
- package/dist/types-ts4.5/plugins/table/types.d.ts +0 -342
- package/dist/types-ts4.5/plugins/table/ui/ColumnResizeWidget/index.d.ts +0 -9
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/FixedButton.d.ts +0 -23
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/index.d.ts +0 -21
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/styles.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +0 -87
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/index.d.ts +0 -23
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/styles.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +0 -13
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +0 -10
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/index.d.ts +0 -54
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/types.d.ts +0 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +0 -13
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +0 -3
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +0 -35
- package/dist/types-ts4.5/plugins/table/ui/LayoutButton/index.d.ts +0 -21
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +0 -16
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +0 -21
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +0 -17
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +0 -39
- package/dist/types-ts4.5/plugins/table/ui/common-styles.d.ts +0 -9
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +0 -50
- package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +0 -63
- package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +0 -15
- package/dist/types-ts4.5/plugins/table/utils/analytics.d.ts +0 -45
- package/dist/types-ts4.5/plugins/table/utils/collapse.d.ts +0 -29
- package/dist/types-ts4.5/plugins/table/utils/column-controls.d.ts +0 -10
- package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +0 -19
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +0 -20
- package/dist/types-ts4.5/plugins/table/utils/get-allow-add-column-custom-step.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/utils/guidelines.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +0 -11
- package/dist/types-ts4.5/plugins/table/utils/nodes.d.ts +0 -13
- package/dist/types-ts4.5/plugins/table/utils/paste.d.ts +0 -14
- package/dist/types-ts4.5/plugins/table/utils/row-controls.d.ts +0 -16
- package/dist/types-ts4.5/plugins/table/utils/selection.d.ts +0 -6
- package/dist/types-ts4.5/plugins/table/utils/snapping.d.ts +0 -10
- package/dist/types-ts4.5/plugins/table/utils/table.d.ts +0 -4
- package/dist/types-ts4.5/plugins/table/utils/update-plugin-state-decorations.d.ts +0 -4
- package/dist/types-ts4.5/plugins/table-plugin.d.ts +0 -2
- package/dist/types-ts4.5/types/i18n.d.ts +0 -5
- package/tmp/api-report-tmp.d.ts +0 -112
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 5.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#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'.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 4.2.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#40795](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40795) [`fec7aa5c761`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fec7aa5c761) - [ux] Fix distribute column resize will not been override when undefined
|
|
18
|
+
|
|
3
19
|
## 4.2.0
|
|
4
20
|
|
|
5
21
|
### Minor 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);
|
|
@@ -37,8 +37,6 @@ var _FloatingDeleteButton = _interopRequireDefault(require("./ui/FloatingDeleteB
|
|
|
37
37
|
var _FloatingInsertButton = _interopRequireDefault(require("./ui/FloatingInsertButton"));
|
|
38
38
|
var _LayoutButton = _interopRequireDefault(require("./ui/LayoutButton"));
|
|
39
39
|
var _utils3 = require("./utils");
|
|
40
|
-
// TODO: duplicated SelectionPlugin type as it's still in editor-core, doing this avoid
|
|
41
|
-
// circular dependencies
|
|
42
40
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
43
41
|
return {};
|
|
44
42
|
};
|
|
@@ -146,7 +144,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
146
144
|
}, {
|
|
147
145
|
name: 'tableSelectionKeymap',
|
|
148
146
|
plugin: function plugin() {
|
|
149
|
-
return (0, _tableSelectionKeymap.tableSelectionKeymapPlugin)(
|
|
147
|
+
return (0, _tableSelectionKeymap.tableSelectionKeymapPlugin)(api === null || api === void 0 ? void 0 : api.selection);
|
|
150
148
|
}
|
|
151
149
|
}, {
|
|
152
150
|
name: 'tableEditing',
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.updateColumnWidths = exports.rescaleColumnsOld = exports.rescaleColumnsNew = exports.rescaleColumns = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _steps = require("@atlaskit/adf-schema/steps");
|
|
10
9
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
10
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
11
11
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
12
12
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
13
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -76,7 +76,7 @@ var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidth
|
|
|
76
76
|
var cell = table.nodeAt(pos);
|
|
77
77
|
if (!seen[pos] && cell) {
|
|
78
78
|
if (updatedCellsAttrs[pos]) {
|
|
79
|
-
tr.step(new
|
|
79
|
+
tr.step(new _transform.AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
|
|
80
80
|
}
|
|
81
81
|
seen[pos] = true;
|
|
82
82
|
}
|
|
@@ -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);
|
|
@@ -30,9 +30,6 @@ import FloatingDeleteButton from './ui/FloatingDeleteButton';
|
|
|
30
30
|
import FloatingInsertButton from './ui/FloatingInsertButton';
|
|
31
31
|
import LayoutButton from './ui/LayoutButton';
|
|
32
32
|
import { isLayoutSupported } from './utils';
|
|
33
|
-
|
|
34
|
-
// TODO: duplicated SelectionPlugin type as it's still in editor-core, doing this avoid
|
|
35
|
-
// circular dependencies
|
|
36
33
|
const defaultGetEditorFeatureFlags = () => ({});
|
|
37
34
|
/**
|
|
38
35
|
* Table plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
@@ -137,7 +134,7 @@ const tablesPlugin = ({
|
|
|
137
134
|
plugin: () => keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI)
|
|
138
135
|
}, {
|
|
139
136
|
name: 'tableSelectionKeymap',
|
|
140
|
-
plugin: () => tableSelectionKeymapPlugin(
|
|
137
|
+
plugin: () => tableSelectionKeymapPlugin(api === null || api === void 0 ? void 0 : api.selection)
|
|
141
138
|
}, {
|
|
142
139
|
name: 'tableEditing',
|
|
143
140
|
plugin: () => tableEditing({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
2
1
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
2
|
+
import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { TableMap, tableNewColumnMinWidth } from '@atlaskit/editor-tables/table-map';
|
|
5
5
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -69,7 +69,7 @@ export const updateColumnWidths = (resizeState, table, start) => tr => {
|
|
|
69
69
|
const cell = table.nodeAt(pos);
|
|
70
70
|
if (!seen[pos] && cell) {
|
|
71
71
|
if (updatedCellsAttrs[pos]) {
|
|
72
|
-
tr.step(new
|
|
72
|
+
tr.step(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
|
|
73
73
|
}
|
|
74
74
|
seen[pos] = true;
|
|
75
75
|
}
|
|
@@ -42,15 +42,14 @@ var arrowLeftFromCellSelection = function arrowLeftFromCellSelection(editorSelec
|
|
|
42
42
|
return function (selection) {
|
|
43
43
|
return function (state, dispatch) {
|
|
44
44
|
if (isTableSelected(state.selection) && editorSelectionAPI) {
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
if (selectionRelativeToNode === RelativeSelectionPos.Start) {
|
|
45
|
+
var selectionState = editorSelectionAPI.sharedState.currentState() || {};
|
|
46
|
+
if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === RelativeSelectionPos.Start) {
|
|
48
47
|
// we have full table cell selection and want to set gap cursor selection before table
|
|
49
48
|
return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
|
|
50
|
-
} else if (selectionRelativeToNode === RelativeSelectionPos.End) {
|
|
49
|
+
} else if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === RelativeSelectionPos.End) {
|
|
51
50
|
// we have full table cell selection and want to set selection at end of last cell
|
|
52
51
|
return setSelectionAtEndOfLastCell(editorSelectionAPI)(selection)(state, dispatch);
|
|
53
|
-
} else if (selectionRelativeToNode === undefined) {
|
|
52
|
+
} else if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === undefined) {
|
|
54
53
|
// we have full table cell selection and want to set selection at start of first cell
|
|
55
54
|
return setSelectionAtStartOfFirstCell(editorSelectionAPI)(selection, RelativeSelectionPos.Before)(state, dispatch);
|
|
56
55
|
}
|
|
@@ -63,8 +62,8 @@ var arrowRightFromCellSelection = function arrowRightFromCellSelection(editorSel
|
|
|
63
62
|
return function (selection) {
|
|
64
63
|
return function (state, dispatch) {
|
|
65
64
|
if (isTableSelected(state.selection) && editorSelectionAPI) {
|
|
66
|
-
var
|
|
67
|
-
selectionRelativeToNode =
|
|
65
|
+
var _ref = editorSelectionAPI.sharedState.currentState() || {},
|
|
66
|
+
selectionRelativeToNode = _ref.selectionRelativeToNode;
|
|
68
67
|
if (selectionRelativeToNode === RelativeSelectionPos.Start) {
|
|
69
68
|
// we have full table cell selection and want to set selection at start of first cell
|
|
70
69
|
return setSelectionAtStartOfFirstCell(editorSelectionAPI)(selection)(state, dispatch);
|
|
@@ -96,9 +95,8 @@ var arrowLeftFromGapCursor = function arrowLeftFromGapCursor(editorSelectionAPI)
|
|
|
96
95
|
} else if (side === Side.LEFT) {
|
|
97
96
|
var table = findTable(selection);
|
|
98
97
|
if (table && isSelectionAtStartOfTable($from, selection) && editorSelectionAPI) {
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
if (selectionRelativeToNode === RelativeSelectionPos.Before) {
|
|
98
|
+
var selectionState = editorSelectionAPI.sharedState.currentState() || {};
|
|
99
|
+
if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === RelativeSelectionPos.Before) {
|
|
102
100
|
// we have a gap cursor at start of first table cell and want to set a gap cursor selection before table
|
|
103
101
|
return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
|
|
104
102
|
} else {
|
|
@@ -155,9 +153,8 @@ var arrowLeftFromText = function arrowLeftFromText(editorSelectionAPI) {
|
|
|
155
153
|
if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 &&
|
|
156
154
|
// + 3 for: row, cell & paragraph nodes
|
|
157
155
|
editorSelectionAPI) {
|
|
158
|
-
var
|
|
159
|
-
|
|
160
|
-
if (selectionRelativeToNode === RelativeSelectionPos.Before) {
|
|
156
|
+
var selectionState = editorSelectionAPI.sharedState.currentState() || {};
|
|
157
|
+
if ((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selectionRelativeToNode) === RelativeSelectionPos.Before) {
|
|
161
158
|
// we have a text selection at start of first table cell, directly inside a top level paragraph,
|
|
162
159
|
// and want to set gap cursor selection before table
|
|
163
160
|
return setGapCursorBeforeTable(editorSelectionAPI)()(state, dispatch);
|
|
@@ -205,10 +202,10 @@ var arrowRightFromText = function arrowRightFromText(editorSelectionAPI) {
|
|
|
205
202
|
* pos in the selection plugin
|
|
206
203
|
*/
|
|
207
204
|
var selectFullTable = function selectFullTable(editorSelectionAPI) {
|
|
208
|
-
return function (
|
|
209
|
-
var node =
|
|
210
|
-
startPos =
|
|
211
|
-
dir =
|
|
205
|
+
return function (_ref2) {
|
|
206
|
+
var node = _ref2.node,
|
|
207
|
+
startPos = _ref2.startPos,
|
|
208
|
+
dir = _ref2.dir;
|
|
212
209
|
return function (state, dispatch) {
|
|
213
210
|
var doc = state.doc;
|
|
214
211
|
var _TableMap$get = TableMap.get(node),
|
|
@@ -225,7 +222,7 @@ var selectFullTable = function selectFullTable(editorSelectionAPI) {
|
|
|
225
222
|
selectionRelativeToNode = RelativeSelectionPos.Start;
|
|
226
223
|
}
|
|
227
224
|
if (editorSelectionAPI) {
|
|
228
|
-
var tr = editorSelectionAPI.
|
|
225
|
+
var tr = editorSelectionAPI.actions.selectNearNode({
|
|
229
226
|
selectionRelativeToNode: selectionRelativeToNode,
|
|
230
227
|
selection: fullTableSelection
|
|
231
228
|
})(state);
|
|
@@ -249,7 +246,7 @@ var setSelectionAtStartOfFirstCell = function setSelectionAtStartOfFirstCell(edi
|
|
|
249
246
|
// check if first pos should have a gap cursor, otherwise find closest text selection
|
|
250
247
|
var selectionAtStartOfCell = GapCursorSelection.valid($firstPosInsideCell) ? new GapCursorSelection($firstPosInsideCell, Side.LEFT) : Selection.findFrom($firstPosInsideCell, 1);
|
|
251
248
|
if (editorSelectionAPI) {
|
|
252
|
-
var tr = editorSelectionAPI.
|
|
249
|
+
var tr = editorSelectionAPI.actions.selectNearNode({
|
|
253
250
|
selectionRelativeToNode: selectionRelativeToNode,
|
|
254
251
|
selection: selectionAtStartOfCell
|
|
255
252
|
})(state);
|
|
@@ -274,7 +271,7 @@ var setSelectionAtEndOfLastCell = function setSelectionAtEndOfLastCell(editorSel
|
|
|
274
271
|
// check if last pos should have a gap cursor, otherwise find closest text selection
|
|
275
272
|
var selectionAtEndOfCell = GapCursorSelection.valid($lastPosInsideCell) ? new GapCursorSelection($lastPosInsideCell, Side.RIGHT) : Selection.findFrom($lastPosInsideCell, -1);
|
|
276
273
|
if (editorSelectionAPI) {
|
|
277
|
-
var tr = editorSelectionAPI.
|
|
274
|
+
var tr = editorSelectionAPI.actions.selectNearNode({
|
|
278
275
|
selectionRelativeToNode: selectionRelativeToNode,
|
|
279
276
|
selection: selectionAtEndOfCell
|
|
280
277
|
})(state);
|
|
@@ -296,7 +293,7 @@ var setGapCursorBeforeTable = function setGapCursorBeforeTable(editorSelectionAP
|
|
|
296
293
|
if (GapCursorSelection.valid($beforeTablePos)) {
|
|
297
294
|
var selectionBeforeTable = new GapCursorSelection($beforeTablePos, Side.LEFT);
|
|
298
295
|
if (editorSelectionAPI) {
|
|
299
|
-
var tr = editorSelectionAPI.
|
|
296
|
+
var tr = editorSelectionAPI.actions.selectNearNode({
|
|
300
297
|
selectionRelativeToNode: undefined,
|
|
301
298
|
selection: selectionBeforeTable
|
|
302
299
|
})(state);
|
|
@@ -320,7 +317,7 @@ var setGapCursorAfterTable = function setGapCursorAfterTable(editorSelectionAPI)
|
|
|
320
317
|
if (GapCursorSelection.valid($afterTablePos)) {
|
|
321
318
|
var selectionAfterTable = new GapCursorSelection($afterTablePos, Side.RIGHT);
|
|
322
319
|
if (editorSelectionAPI) {
|
|
323
|
-
var tr = editorSelectionAPI.
|
|
320
|
+
var tr = editorSelectionAPI.actions.selectNearNode({
|
|
324
321
|
selectionRelativeToNode: undefined,
|
|
325
322
|
selection: selectionAfterTable
|
|
326
323
|
})(state);
|
|
@@ -30,9 +30,6 @@ import FloatingDeleteButton from './ui/FloatingDeleteButton';
|
|
|
30
30
|
import FloatingInsertButton from './ui/FloatingInsertButton';
|
|
31
31
|
import LayoutButton from './ui/LayoutButton';
|
|
32
32
|
import { isLayoutSupported } from './utils';
|
|
33
|
-
|
|
34
|
-
// TODO: duplicated SelectionPlugin type as it's still in editor-core, doing this avoid
|
|
35
|
-
// circular dependencies
|
|
36
33
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
37
34
|
return {};
|
|
38
35
|
};
|
|
@@ -140,7 +137,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
140
137
|
}, {
|
|
141
138
|
name: 'tableSelectionKeymap',
|
|
142
139
|
plugin: function plugin() {
|
|
143
|
-
return tableSelectionKeymapPlugin(
|
|
140
|
+
return tableSelectionKeymapPlugin(api === null || api === void 0 ? void 0 : api.selection);
|
|
144
141
|
}
|
|
145
142
|
}, {
|
|
146
143
|
name: 'tableEditing',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
5
4
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
5
|
+
import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
6
6
|
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
import { TableMap, tableNewColumnMinWidth } from '@atlaskit/editor-tables/table-map';
|
|
8
8
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -70,7 +70,7 @@ export var updateColumnWidths = function updateColumnWidths(resizeState, table,
|
|
|
70
70
|
var cell = table.nodeAt(pos);
|
|
71
71
|
if (!seen[pos] && cell) {
|
|
72
72
|
if (updatedCellsAttrs[pos]) {
|
|
73
|
-
tr.step(new
|
|
73
|
+
tr.step(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
|
|
74
74
|
}
|
|
75
75
|
seen[pos] = true;
|
|
76
76
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type
|
|
1
|
+
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type tablePlugin from '../index';
|
|
3
3
|
export declare enum TableSelectionDirection {
|
|
4
4
|
TopToBottom = "TopToBottom",
|
|
5
5
|
BottomToTop = "BottomToTop"
|
|
6
6
|
}
|
|
7
|
-
export declare const arrowLeftFromTable: (editorSelectionAPI:
|
|
8
|
-
export declare const arrowRightFromTable: (editorSelectionAPI:
|
|
7
|
+
export declare const arrowLeftFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
8
|
+
export declare const arrowRightFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type {
|
|
3
|
-
import type { Command, EditorCommand, GetEditorFeatureFlags, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Command, GetEditorFeatureFlags, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
4
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
4
|
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
6
5
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
6
|
+
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
7
7
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
8
8
|
import type { PluginConfig } from './types';
|
|
9
9
|
interface TablePluginOptions {
|
|
@@ -14,16 +14,9 @@ interface TablePluginOptions {
|
|
|
14
14
|
allowContextualMenu?: boolean;
|
|
15
15
|
fullWidthEnabled?: boolean;
|
|
16
16
|
wasFullWidthEnabled?: boolean;
|
|
17
|
-
editorSelectionAPI?: EditorSelectionAPI;
|
|
18
17
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
19
18
|
}
|
|
20
19
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
21
|
-
type SelectionPlugin = NextEditorPlugin<'selection', {
|
|
22
|
-
pluginConfiguration: unknown;
|
|
23
|
-
commands: {
|
|
24
|
-
displayGapCursor: (toggle: boolean) => EditorCommand;
|
|
25
|
-
};
|
|
26
|
-
}>;
|
|
27
20
|
export type TablePlugin = NextEditorPlugin<'table', {
|
|
28
21
|
pluginConfiguration: TablePluginOptions | undefined;
|
|
29
22
|
actions: {
|
|
@@ -34,7 +27,7 @@ export type TablePlugin = NextEditorPlugin<'table', {
|
|
|
34
27
|
ContentInsertionPlugin,
|
|
35
28
|
WidthPlugin,
|
|
36
29
|
GuidelinePlugin,
|
|
37
|
-
|
|
30
|
+
SelectionPlugin
|
|
38
31
|
];
|
|
39
32
|
}>;
|
|
40
33
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
1
|
+
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type tablePlugin from '../index';
|
|
4
|
+
export declare function tableSelectionKeymapPlugin(editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined): SafePlugin;
|
|
4
5
|
export default tableSelectionKeymapPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "^32.0.0",
|
|
31
31
|
"@atlaskit/custom-steps": "^0.0.2",
|
|
32
|
-
"@atlaskit/editor-common": "^76.
|
|
32
|
+
"@atlaskit/editor-common": "^76.8.0",
|
|
33
33
|
"@atlaskit/editor-palette": "1.5.1",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
35
35
|
"@atlaskit/editor-plugin-content-insertion": "^0.1.0",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"@atlaskit/editor-plugin-grid": "^0.3.0",
|
|
62
62
|
"@atlaskit/editor-plugin-guideline": "^0.5.0",
|
|
63
63
|
"@atlaskit/editor-plugin-hyperlink": "^0.5.0",
|
|
64
|
+
"@atlaskit/editor-plugin-selection": "^0.1.0",
|
|
64
65
|
"@atlaskit/editor-plugin-width": "^0.2.0",
|
|
65
66
|
"@atlaskit/visual-regression": "*",
|
|
66
67
|
"@atlaskit/webdriver-runner": "*",
|
|
@@ -2,11 +2,11 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { DocBuilder } from '@atlaskit/editor-common/types';
|
|
4
4
|
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
5
|
-
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
6
5
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
7
6
|
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
8
7
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
9
8
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
9
|
+
import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
10
10
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
11
11
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
12
12
|
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { DocBuilder } from '@atlaskit/editor-common/types';
|
|
2
2
|
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
3
|
-
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
4
3
|
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
4
|
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
6
5
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
7
6
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
7
|
+
import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
8
8
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
9
9
|
import { removeColumnAt } from '@atlaskit/editor-tables/utils';
|
|
10
10
|
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { DocBuilder } from '@atlaskit/editor-common/types';
|
|
3
3
|
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
4
|
-
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
5
4
|
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
6
5
|
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
7
6
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
8
7
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
8
|
+
import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
9
9
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
10
10
|
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
11
11
|
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
@@ -3,11 +3,11 @@ import type {
|
|
|
3
3
|
GetEditorContainerWidth,
|
|
4
4
|
} from '@atlaskit/editor-common/types';
|
|
5
5
|
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
6
|
-
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
7
6
|
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
8
7
|
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
9
8
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
10
9
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
10
|
+
import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
11
11
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
12
12
|
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { DocBuilder } from '@atlaskit/editor-common/types';
|
|
2
2
|
// eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
|
|
3
|
-
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
4
3
|
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
4
|
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
6
5
|
import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
7
6
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
8
7
|
import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
8
|
+
import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
9
9
|
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
10
10
|
import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
11
11
|
import { isColumnSelected } from '@atlaskit/editor-tables/utils';
|