@atlaskit/editor-plugin-table 5.2.1 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/plugins/table/commands/selection.js +20 -1
- package/dist/cjs/plugins/table/pm-plugins/table-selection-keymap.js +4 -0
- package/dist/cjs/plugins/table/toolbar.js +2 -2
- package/dist/es2019/plugins/table/commands/selection.js +18 -1
- package/dist/es2019/plugins/table/pm-plugins/table-selection-keymap.js +6 -2
- package/dist/es2019/plugins/table/toolbar.js +1 -1
- package/dist/esm/plugins/table/commands/selection.js +19 -0
- package/dist/esm/plugins/table/pm-plugins/table-selection-keymap.js +6 -2
- package/dist/esm/plugins/table/toolbar.js +1 -1
- package/dist/types/plugins/table/commands/selection.d.ts +1 -0
- package/dist/types/plugins/table/toolbar.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/commands/selection.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/toolbar.d.ts +1 -0
- package/package.json +5 -2
- package/src/plugins/table/commands/selection.ts +24 -0
- package/src/plugins/table/pm-plugins/table-selection-keymap.ts +15 -1
- package/src/plugins/table/toolbar.tsx +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 5.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#41510](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41510) [`12e9528f975`](https://bitbucket.org/atlassian/atlassian-frontend/commits/12e9528f975) - [ux] Adds a command for shift+arrowUp when pressed inside table to select the whole table when we reach top row.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
3
10
|
## 5.2.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.arrowRightFromTable = exports.arrowLeftFromTable = exports.TableSelectionDirection = void 0;
|
|
6
|
+
exports.shiftArrowUpFromTable = exports.arrowRightFromTable = exports.arrowLeftFromTable = exports.TableSelectionDirection = void 0;
|
|
7
7
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
10
10
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
11
11
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
12
|
+
var _toolbar = require("../toolbar");
|
|
12
13
|
var TableSelectionDirection = exports.TableSelectionDirection = /*#__PURE__*/function (TableSelectionDirection) {
|
|
13
14
|
TableSelectionDirection["TopToBottom"] = "TopToBottom";
|
|
14
15
|
TableSelectionDirection["BottomToTop"] = "BottomToTop";
|
|
@@ -344,4 +345,22 @@ var isSelectionAtStartOfTable = function isSelectionAtStartOfTable($pos, selecti
|
|
|
344
345
|
};
|
|
345
346
|
var isSelectionAtEndOfTable = function isSelectionAtEndOfTable($pos, selection) {
|
|
346
347
|
return (0, _selection.isSelectionAtEndOfNode)($pos, (0, _utils.findTable)(selection));
|
|
348
|
+
};
|
|
349
|
+
var shiftArrowUpFromTable = exports.shiftArrowUpFromTable = function shiftArrowUpFromTable(editorSelectionAPI) {
|
|
350
|
+
return function () {
|
|
351
|
+
return function (state, dispatch) {
|
|
352
|
+
var selection = state.selection;
|
|
353
|
+
var table = (0, _utils.findTable)(selection);
|
|
354
|
+
var selectionRect = (0, _toolbar.getClosestSelectionRect)(state);
|
|
355
|
+
var index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.top;
|
|
356
|
+
if (table && index === 0) {
|
|
357
|
+
return selectFullTable(editorSelectionAPI)({
|
|
358
|
+
node: table.node,
|
|
359
|
+
startPos: table.start,
|
|
360
|
+
dir: TableSelectionDirection.BottomToTop
|
|
361
|
+
})(state, dispatch);
|
|
362
|
+
}
|
|
363
|
+
return false;
|
|
364
|
+
};
|
|
365
|
+
};
|
|
347
366
|
};
|
|
@@ -7,11 +7,15 @@ exports.default = void 0;
|
|
|
7
7
|
exports.tableSelectionKeymapPlugin = tableSelectionKeymapPlugin;
|
|
8
8
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
9
9
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var _selection = require("../commands/selection");
|
|
11
12
|
function tableSelectionKeymapPlugin(editorSelectionAPI) {
|
|
12
13
|
var list = {};
|
|
13
14
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRight.common, (0, _selection.arrowRightFromTable)(editorSelectionAPI)(), list);
|
|
14
15
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveLeft.common, (0, _selection.arrowLeftFromTable)(editorSelectionAPI)(), list);
|
|
16
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.shift-arrowup-fix')) {
|
|
17
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.shiftArrowUp.common, (0, _selection.shiftArrowUpFromTable)(editorSelectionAPI)(), list);
|
|
18
|
+
}
|
|
15
19
|
return (0, _keymap.keymap)(list);
|
|
16
20
|
}
|
|
17
21
|
var _default = exports.default = tableSelectionKeymapPlugin;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.messages = exports.getToolbarMenuConfig = exports.getToolbarConfig = exports.getToolbarCellOptionsConfig = void 0;
|
|
7
|
+
exports.messages = exports.getToolbarMenuConfig = exports.getToolbarConfig = exports.getToolbarCellOptionsConfig = exports.getClosestSelectionRect = void 0;
|
|
8
8
|
var _react = require("@emotion/react");
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
10
|
var _customSteps = require("@atlaskit/custom-steps");
|
|
@@ -291,7 +291,7 @@ var getToolbarCellOptionsConfig = exports.getToolbarCellOptionsConfig = function
|
|
|
291
291
|
showSelected: false
|
|
292
292
|
};
|
|
293
293
|
};
|
|
294
|
-
var getClosestSelectionRect = function getClosestSelectionRect(state) {
|
|
294
|
+
var getClosestSelectionRect = exports.getClosestSelectionRect = function getClosestSelectionRect(state) {
|
|
295
295
|
var selection = state.selection;
|
|
296
296
|
return (0, _utils3.isSelectionType)(selection, 'cell') ? (0, _utils3.getSelectionRect)(selection) : (0, _utils3.findCellRectClosestToPos)(selection.$from);
|
|
297
297
|
};
|
|
@@ -3,6 +3,7 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
4
4
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
5
5
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
6
|
+
import { getClosestSelectionRect } from '../toolbar';
|
|
6
7
|
export let TableSelectionDirection = /*#__PURE__*/function (TableSelectionDirection) {
|
|
7
8
|
TableSelectionDirection["TopToBottom"] = "TopToBottom";
|
|
8
9
|
TableSelectionDirection["BottomToTop"] = "BottomToTop";
|
|
@@ -305,4 +306,20 @@ const setGapCursorAfterTable = editorSelectionAPI => () => (state, dispatch) =>
|
|
|
305
306
|
return false;
|
|
306
307
|
};
|
|
307
308
|
const isSelectionAtStartOfTable = ($pos, selection) => isSelectionAtStartOfNode($pos, findTable(selection));
|
|
308
|
-
const isSelectionAtEndOfTable = ($pos, selection) => isSelectionAtEndOfNode($pos, findTable(selection));
|
|
309
|
+
const isSelectionAtEndOfTable = ($pos, selection) => isSelectionAtEndOfNode($pos, findTable(selection));
|
|
310
|
+
export const shiftArrowUpFromTable = editorSelectionAPI => () => (state, dispatch) => {
|
|
311
|
+
const {
|
|
312
|
+
selection
|
|
313
|
+
} = state;
|
|
314
|
+
const table = findTable(selection);
|
|
315
|
+
const selectionRect = getClosestSelectionRect(state);
|
|
316
|
+
const index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.top;
|
|
317
|
+
if (table && index === 0) {
|
|
318
|
+
return selectFullTable(editorSelectionAPI)({
|
|
319
|
+
node: table.node,
|
|
320
|
+
startPos: table.start,
|
|
321
|
+
dir: TableSelectionDirection.BottomToTop
|
|
322
|
+
})(state, dispatch);
|
|
323
|
+
}
|
|
324
|
+
return false;
|
|
325
|
+
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { bindKeymapWithCommand, moveLeft, moveRight } from '@atlaskit/editor-common/keymaps';
|
|
1
|
+
import { bindKeymapWithCommand, moveLeft, moveRight, shiftArrowUp } from '@atlaskit/editor-common/keymaps';
|
|
2
2
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
3
|
-
import {
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { arrowLeftFromTable, arrowRightFromTable, shiftArrowUpFromTable } from '../commands/selection';
|
|
4
5
|
export function tableSelectionKeymapPlugin(editorSelectionAPI) {
|
|
5
6
|
const list = {};
|
|
6
7
|
bindKeymapWithCommand(moveRight.common, arrowRightFromTable(editorSelectionAPI)(), list);
|
|
7
8
|
bindKeymapWithCommand(moveLeft.common, arrowLeftFromTable(editorSelectionAPI)(), list);
|
|
9
|
+
if (getBooleanFF('platform.editor.table.shift-arrowup-fix')) {
|
|
10
|
+
bindKeymapWithCommand(shiftArrowUp.common, shiftArrowUpFromTable(editorSelectionAPI)(), list);
|
|
11
|
+
}
|
|
8
12
|
return keymap(list);
|
|
9
13
|
}
|
|
10
14
|
export default tableSelectionKeymapPlugin;
|
|
@@ -286,7 +286,7 @@ export const getToolbarCellOptionsConfig = (editorState, editorView, initialSele
|
|
|
286
286
|
showSelected: false
|
|
287
287
|
};
|
|
288
288
|
};
|
|
289
|
-
const getClosestSelectionRect = state => {
|
|
289
|
+
export const getClosestSelectionRect = state => {
|
|
290
290
|
const selection = state.selection;
|
|
291
291
|
return isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
292
292
|
};
|
|
@@ -3,6 +3,7 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
4
4
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
5
5
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
6
|
+
import { getClosestSelectionRect } from '../toolbar';
|
|
6
7
|
export var TableSelectionDirection = /*#__PURE__*/function (TableSelectionDirection) {
|
|
7
8
|
TableSelectionDirection["TopToBottom"] = "TopToBottom";
|
|
8
9
|
TableSelectionDirection["BottomToTop"] = "BottomToTop";
|
|
@@ -338,4 +339,22 @@ var isSelectionAtStartOfTable = function isSelectionAtStartOfTable($pos, selecti
|
|
|
338
339
|
};
|
|
339
340
|
var isSelectionAtEndOfTable = function isSelectionAtEndOfTable($pos, selection) {
|
|
340
341
|
return isSelectionAtEndOfNode($pos, findTable(selection));
|
|
342
|
+
};
|
|
343
|
+
export var shiftArrowUpFromTable = function shiftArrowUpFromTable(editorSelectionAPI) {
|
|
344
|
+
return function () {
|
|
345
|
+
return function (state, dispatch) {
|
|
346
|
+
var selection = state.selection;
|
|
347
|
+
var table = findTable(selection);
|
|
348
|
+
var selectionRect = getClosestSelectionRect(state);
|
|
349
|
+
var index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.top;
|
|
350
|
+
if (table && index === 0) {
|
|
351
|
+
return selectFullTable(editorSelectionAPI)({
|
|
352
|
+
node: table.node,
|
|
353
|
+
startPos: table.start,
|
|
354
|
+
dir: TableSelectionDirection.BottomToTop
|
|
355
|
+
})(state, dispatch);
|
|
356
|
+
}
|
|
357
|
+
return false;
|
|
358
|
+
};
|
|
359
|
+
};
|
|
341
360
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { bindKeymapWithCommand, moveLeft, moveRight } from '@atlaskit/editor-common/keymaps';
|
|
1
|
+
import { bindKeymapWithCommand, moveLeft, moveRight, shiftArrowUp } from '@atlaskit/editor-common/keymaps';
|
|
2
2
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
3
|
-
import {
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { arrowLeftFromTable, arrowRightFromTable, shiftArrowUpFromTable } from '../commands/selection';
|
|
4
5
|
export function tableSelectionKeymapPlugin(editorSelectionAPI) {
|
|
5
6
|
var list = {};
|
|
6
7
|
bindKeymapWithCommand(moveRight.common, arrowRightFromTable(editorSelectionAPI)(), list);
|
|
7
8
|
bindKeymapWithCommand(moveLeft.common, arrowLeftFromTable(editorSelectionAPI)(), list);
|
|
9
|
+
if (getBooleanFF('platform.editor.table.shift-arrowup-fix')) {
|
|
10
|
+
bindKeymapWithCommand(shiftArrowUp.common, shiftArrowUpFromTable(editorSelectionAPI)(), list);
|
|
11
|
+
}
|
|
8
12
|
return keymap(list);
|
|
9
13
|
}
|
|
10
14
|
export default tableSelectionKeymapPlugin;
|
|
@@ -283,7 +283,7 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
283
283
|
showSelected: false
|
|
284
284
|
};
|
|
285
285
|
};
|
|
286
|
-
var getClosestSelectionRect = function getClosestSelectionRect(state) {
|
|
286
|
+
export var getClosestSelectionRect = function getClosestSelectionRect(state) {
|
|
287
287
|
var selection = state.selection;
|
|
288
288
|
return isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
289
289
|
};
|
|
@@ -6,3 +6,4 @@ export declare enum TableSelectionDirection {
|
|
|
6
6
|
}
|
|
7
7
|
export declare const arrowLeftFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
8
8
|
export declare const arrowRightFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
9
|
+
export declare const shiftArrowUpFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
@@ -33,4 +33,5 @@ export declare const messages: {
|
|
|
33
33
|
};
|
|
34
34
|
export declare const getToolbarMenuConfig: (config: ToolbarMenuConfig, state: ToolbarMenuState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => FloatingToolbarItem<Command>;
|
|
35
35
|
export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => FloatingToolbarDropdown<Command>;
|
|
36
|
+
export declare const getClosestSelectionRect: (state: EditorState) => Rect | undefined;
|
|
36
37
|
export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null) => (config: PluginConfig) => FloatingToolbarHandler;
|
|
@@ -6,3 +6,4 @@ export declare enum TableSelectionDirection {
|
|
|
6
6
|
}
|
|
7
7
|
export declare const arrowLeftFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
8
8
|
export declare const arrowRightFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
9
|
+
export declare const shiftArrowUpFromTable: (editorSelectionAPI: ExtractInjectionAPI<typeof tablePlugin>['selection'] | undefined) => () => Command;
|
|
@@ -33,4 +33,5 @@ export declare const messages: {
|
|
|
33
33
|
};
|
|
34
34
|
export declare const getToolbarMenuConfig: (config: ToolbarMenuConfig, state: ToolbarMenuState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => FloatingToolbarItem<Command>;
|
|
35
35
|
export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => FloatingToolbarDropdown<Command>;
|
|
36
|
+
export declare const getClosestSelectionRect: (state: EditorState) => Rect | undefined;
|
|
36
37
|
export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null) => (config: PluginConfig) => FloatingToolbarHandler;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.2",
|
|
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.11.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",
|
|
@@ -127,6 +127,9 @@
|
|
|
127
127
|
"platform.editor.table.increase-shadow-visibility_lh89r": {
|
|
128
128
|
"type": "boolean"
|
|
129
129
|
},
|
|
130
|
+
"platform.editor.table.shift-arrowup-fix": {
|
|
131
|
+
"type": "boolean"
|
|
132
|
+
},
|
|
130
133
|
"platform.editor.table.update-table-resizer-styles": {
|
|
131
134
|
"type": "boolean"
|
|
132
135
|
},
|
|
@@ -20,6 +20,7 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
20
20
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
21
21
|
|
|
22
22
|
import type tablePlugin from '../index';
|
|
23
|
+
import { getClosestSelectionRect } from '../toolbar';
|
|
23
24
|
|
|
24
25
|
export enum TableSelectionDirection {
|
|
25
26
|
TopToBottom = 'TopToBottom',
|
|
@@ -485,3 +486,26 @@ const isSelectionAtStartOfTable = ($pos: ResolvedPos, selection: Selection) =>
|
|
|
485
486
|
|
|
486
487
|
const isSelectionAtEndOfTable = ($pos: ResolvedPos, selection: Selection) =>
|
|
487
488
|
isSelectionAtEndOfNode($pos, findTable(selection));
|
|
489
|
+
|
|
490
|
+
export const shiftArrowUpFromTable =
|
|
491
|
+
(
|
|
492
|
+
editorSelectionAPI:
|
|
493
|
+
| ExtractInjectionAPI<typeof tablePlugin>['selection']
|
|
494
|
+
| undefined,
|
|
495
|
+
) =>
|
|
496
|
+
(): Command =>
|
|
497
|
+
(state, dispatch) => {
|
|
498
|
+
const { selection } = state;
|
|
499
|
+
const table = findTable(selection);
|
|
500
|
+
const selectionRect = getClosestSelectionRect(state);
|
|
501
|
+
const index = selectionRect?.top;
|
|
502
|
+
if (table && index === 0) {
|
|
503
|
+
return selectFullTable(editorSelectionAPI)({
|
|
504
|
+
node: table.node,
|
|
505
|
+
startPos: table.start,
|
|
506
|
+
dir: TableSelectionDirection.BottomToTop,
|
|
507
|
+
})(state, dispatch);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
return false;
|
|
511
|
+
};
|
|
@@ -2,12 +2,18 @@ import {
|
|
|
2
2
|
bindKeymapWithCommand,
|
|
3
3
|
moveLeft,
|
|
4
4
|
moveRight,
|
|
5
|
+
shiftArrowUp,
|
|
5
6
|
} from '@atlaskit/editor-common/keymaps';
|
|
6
7
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
8
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
8
9
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
10
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
11
|
|
|
10
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
arrowLeftFromTable,
|
|
14
|
+
arrowRightFromTable,
|
|
15
|
+
shiftArrowUpFromTable,
|
|
16
|
+
} from '../commands/selection';
|
|
11
17
|
import type tablePlugin from '../index';
|
|
12
18
|
|
|
13
19
|
export function tableSelectionKeymapPlugin(
|
|
@@ -29,6 +35,14 @@ export function tableSelectionKeymapPlugin(
|
|
|
29
35
|
list,
|
|
30
36
|
);
|
|
31
37
|
|
|
38
|
+
if (getBooleanFF('platform.editor.table.shift-arrowup-fix')) {
|
|
39
|
+
bindKeymapWithCommand(
|
|
40
|
+
shiftArrowUp.common!,
|
|
41
|
+
shiftArrowUpFromTable(editorSelectionAPI)(),
|
|
42
|
+
list,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
32
46
|
return keymap(list) as SafePlugin;
|
|
33
47
|
}
|
|
34
48
|
|
|
@@ -420,7 +420,9 @@ export const getToolbarCellOptionsConfig = (
|
|
|
420
420
|
};
|
|
421
421
|
};
|
|
422
422
|
|
|
423
|
-
const getClosestSelectionRect = (
|
|
423
|
+
export const getClosestSelectionRect = (
|
|
424
|
+
state: EditorState,
|
|
425
|
+
): Rect | undefined => {
|
|
424
426
|
const selection = state.selection;
|
|
425
427
|
return isSelectionType(selection, 'cell')
|
|
426
428
|
? getSelectionRect(selection)!
|