@atlaskit/editor-plugin-table 7.2.3 → 7.3.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 +6 -0
- package/dist/cjs/commands/column-resize.js +115 -45
- package/dist/cjs/commands/go-to-next-cell.js +7 -11
- package/dist/cjs/commands/misc.js +3 -2
- package/dist/cjs/commands/selection.js +3 -3
- package/dist/cjs/event-handlers.js +38 -25
- package/dist/cjs/pm-plugins/keymap.js +1 -0
- package/dist/cjs/pm-plugins/main.js +43 -9
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +37 -7
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +20 -6
- package/dist/cjs/reducer.js +5 -2
- package/dist/es2019/commands/column-resize.js +100 -35
- package/dist/es2019/commands/go-to-next-cell.js +7 -9
- package/dist/es2019/commands/misc.js +3 -2
- package/dist/es2019/commands/selection.js +5 -5
- package/dist/es2019/event-handlers.js +17 -3
- package/dist/es2019/pm-plugins/keymap.js +3 -2
- package/dist/es2019/pm-plugins/main.js +41 -5
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +37 -4
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +16 -1
- package/dist/es2019/reducer.js +5 -2
- package/dist/esm/commands/column-resize.js +105 -35
- package/dist/esm/commands/go-to-next-cell.js +7 -11
- package/dist/esm/commands/misc.js +3 -2
- package/dist/esm/commands/selection.js +5 -5
- package/dist/esm/event-handlers.js +38 -25
- package/dist/esm/pm-plugins/keymap.js +3 -2
- package/dist/esm/pm-plugins/main.js +38 -4
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +34 -4
- package/dist/esm/pm-plugins/table-resizing/plugin.js +15 -1
- package/dist/esm/reducer.js +5 -2
- package/dist/types/commands/column-resize.d.ts +2 -0
- package/dist/types/commands/misc.d.ts +1 -1
- package/dist/types/types.d.ts +16 -0
- package/dist/types-ts4.5/commands/column-resize.d.ts +2 -0
- package/dist/types-ts4.5/commands/misc.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +16 -0
- package/package.json +2 -2
- package/src/commands/column-resize.ts +155 -40
- package/src/commands/go-to-next-cell.ts +6 -15
- package/src/commands/misc.ts +2 -0
- package/src/commands/selection.ts +5 -5
- package/src/event-handlers.ts +21 -4
- package/src/pm-plugins/keymap.ts +3 -0
- package/src/pm-plugins/main.ts +47 -2
- package/src/pm-plugins/table-resizing/event-handlers.ts +33 -5
- package/src/pm-plugins/table-resizing/plugin.ts +18 -1
- package/src/reducer.ts +5 -2
- package/src/types.ts +16 -0
|
@@ -11,12 +11,14 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
11
11
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
12
12
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
13
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
|
+
var _columnResize = require("../../commands/column-resize");
|
|
14
15
|
var _misc = require("../../commands/misc");
|
|
15
16
|
var _transforms = require("../../transforms");
|
|
16
17
|
var _utils2 = require("../../utils");
|
|
18
|
+
var _pluginFactory = require("../plugin-factory");
|
|
17
19
|
var _tableAnalytics = require("../table-analytics");
|
|
18
20
|
var _commands = require("./commands");
|
|
19
|
-
var
|
|
21
|
+
var _pluginFactory2 = require("./plugin-factory");
|
|
20
22
|
var _utils3 = require("./utils");
|
|
21
23
|
var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI) {
|
|
22
24
|
var state = view.state,
|
|
@@ -26,6 +28,8 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
|
|
|
26
28
|
if (editorDisabled || localResizeHandlePos === null || !(0, _utils3.pointsAtCell)(state.doc.resolve(localResizeHandlePos))) {
|
|
27
29
|
return false;
|
|
28
30
|
}
|
|
31
|
+
var _getTablePluginState = (0, _pluginFactory.getPluginState)(state),
|
|
32
|
+
isKeyboardResize = _getTablePluginState.isKeyboardResize;
|
|
29
33
|
event.preventDefault();
|
|
30
34
|
var tr = view.state.tr;
|
|
31
35
|
tr.setMeta(_tableAnalytics.META_KEYS.OVERFLOW_TRIGGER, {
|
|
@@ -92,9 +96,11 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
|
|
|
92
96
|
var clientX = event.clientX;
|
|
93
97
|
var state = view.state,
|
|
94
98
|
dispatch = view.dispatch;
|
|
95
|
-
var _getPluginState = (0,
|
|
99
|
+
var _getPluginState = (0, _pluginFactory2.getPluginState)(state),
|
|
96
100
|
dragging = _getPluginState.dragging,
|
|
97
101
|
resizeHandlePos = _getPluginState.resizeHandlePos;
|
|
102
|
+
var _getTablePluginState2 = (0, _pluginFactory.getPluginState)(state),
|
|
103
|
+
isTableHovered = _getTablePluginState2.isTableHovered;
|
|
98
104
|
if (resizeHandlePos === null) {
|
|
99
105
|
return (0, _commands.stopResizing)()(state, dispatch);
|
|
100
106
|
}
|
|
@@ -107,9 +113,20 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
|
|
|
107
113
|
var start = $cell.start(-1);
|
|
108
114
|
var table = $cell.node(-1);
|
|
109
115
|
|
|
110
|
-
// If we let go in the same place we started,
|
|
116
|
+
// If we let go in the same place we started, don't need to do anything.
|
|
111
117
|
if (dragging && clientX === dragging.startX) {
|
|
112
|
-
|
|
118
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
119
|
+
if (isKeyboardResize || !isTableHovered) {
|
|
120
|
+
/** if column resize had started via keyboard but continued by mouse
|
|
121
|
+
* or mouse pointer leaves the table but mouse button still pressed
|
|
122
|
+
*/
|
|
123
|
+
return (0, _columnResize.stopKeyboardColumnResizing)()(state, dispatch, view);
|
|
124
|
+
} else {
|
|
125
|
+
return (0, _commands.stopResizing)()(state, dispatch);
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
return (0, _commands.stopResizing)()(state, dispatch);
|
|
129
|
+
}
|
|
113
130
|
}
|
|
114
131
|
var tr = state.tr;
|
|
115
132
|
if (dragging) {
|
|
@@ -143,17 +160,30 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
|
|
|
143
160
|
})(tr);
|
|
144
161
|
}
|
|
145
162
|
}
|
|
146
|
-
|
|
163
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
164
|
+
if (isKeyboardResize || !isTableHovered) {
|
|
165
|
+
/** if column resize had started via keyboard but continued by mouse
|
|
166
|
+
* or mouse pointer leaves the table but mouse button still pressed
|
|
167
|
+
*/
|
|
168
|
+
return (0, _columnResize.stopKeyboardColumnResizing)(tr)(state, dispatch, view);
|
|
169
|
+
} else {
|
|
170
|
+
return (0, _commands.stopResizing)(tr)(state, dispatch);
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
return (0, _commands.stopResizing)(tr)(state, dispatch);
|
|
174
|
+
}
|
|
147
175
|
}
|
|
148
176
|
}
|
|
149
177
|
function move(event) {
|
|
150
178
|
var clientX = event.clientX,
|
|
151
179
|
which = event.which;
|
|
152
180
|
var state = view.state;
|
|
153
|
-
var _getPluginState2 = (0,
|
|
181
|
+
var _getPluginState2 = (0, _pluginFactory2.getPluginState)(state),
|
|
154
182
|
dragging = _getPluginState2.dragging,
|
|
155
183
|
resizeHandlePos = _getPluginState2.resizeHandlePos;
|
|
156
|
-
|
|
184
|
+
var _getTablePluginState3 = (0, _pluginFactory.getPluginState)(state),
|
|
185
|
+
isTableHovered = _getTablePluginState3.isTableHovered;
|
|
186
|
+
if (!which || !dragging || resizeHandlePos === null || !(0, _utils3.pointsAtCell)(state.doc.resolve(resizeHandlePos)) || !isTableHovered && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
157
187
|
return finish(event);
|
|
158
188
|
}
|
|
159
189
|
var $cell = state.doc.resolve(resizeHandlePos);
|
|
@@ -8,10 +8,12 @@ exports.createPlugin = createPlugin;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var _types = require("../../types");
|
|
13
|
+
var _pluginFactory = require("../plugin-factory");
|
|
12
14
|
var _commands = require("./commands");
|
|
13
15
|
var _eventHandlers = require("./event-handlers");
|
|
14
|
-
var
|
|
16
|
+
var _pluginFactory2 = require("./plugin-factory");
|
|
15
17
|
var _pluginKey = require("./plugin-key");
|
|
16
18
|
var _utils = require("./utils");
|
|
17
19
|
function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI) {
|
|
@@ -19,7 +21,7 @@ function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureF
|
|
|
19
21
|
lastColumnResizable = _ref$lastColumnResiza === void 0 ? true : _ref$lastColumnResiza;
|
|
20
22
|
return new _safePlugin.SafePlugin({
|
|
21
23
|
key: _pluginKey.pluginKey,
|
|
22
|
-
state: (0,
|
|
24
|
+
state: (0, _pluginFactory2.createPluginState)(dispatch, {
|
|
23
25
|
lastColumnResizable: lastColumnResizable,
|
|
24
26
|
resizeHandlePos: null,
|
|
25
27
|
dragging: null,
|
|
@@ -28,7 +30,7 @@ function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureF
|
|
|
28
30
|
props: {
|
|
29
31
|
attributes: function attributes(state) {
|
|
30
32
|
var _classnames;
|
|
31
|
-
var pluginState = (0,
|
|
33
|
+
var pluginState = (0, _pluginFactory2.getPluginState)(state);
|
|
32
34
|
return {
|
|
33
35
|
class: (0, _classnames2.default)(_types.TableCssClassName.RESIZING_PLUGIN, (_classnames = {}, (0, _defineProperty2.default)(_classnames, _types.TableCssClassName.RESIZE_CURSOR, pluginState.resizeHandlePos !== null), (0, _defineProperty2.default)(_classnames, _types.TableCssClassName.IS_RESIZING, !!pluginState.dragging), _classnames))
|
|
34
36
|
};
|
|
@@ -38,10 +40,22 @@ function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureF
|
|
|
38
40
|
var state = view.state;
|
|
39
41
|
var resizeHandlePos =
|
|
40
42
|
// we're setting `resizeHandlePos` via command in unit tests
|
|
41
|
-
(0,
|
|
42
|
-
var _getPluginState = (0,
|
|
43
|
+
(0, _pluginFactory2.getPluginState)(state).resizeHandlePos || (0, _utils.getResizeCellPos)(view, event);
|
|
44
|
+
var _getPluginState = (0, _pluginFactory2.getPluginState)(state),
|
|
43
45
|
dragging = _getPluginState.dragging;
|
|
44
|
-
|
|
46
|
+
var isColumnKeyboardResizeStarted = false;
|
|
47
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
48
|
+
/*
|
|
49
|
+
We need to start listening mouse events if column resize started from keyboard.
|
|
50
|
+
This will allow continue resizing via mouse
|
|
51
|
+
*/
|
|
52
|
+
var _getTablePluginState = (0, _pluginFactory.getPluginState)(state),
|
|
53
|
+
isKeyboardResize = _getTablePluginState.isKeyboardResize;
|
|
54
|
+
if (isKeyboardResize) {
|
|
55
|
+
isColumnKeyboardResizeStarted = isKeyboardResize;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
|
|
45
59
|
if ((0, _eventHandlers.handleMouseDown)(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI)) {
|
|
46
60
|
var _state = view.state,
|
|
47
61
|
_dispatch = view.dispatch;
|
package/dist/cjs/reducer.js
CHANGED
|
@@ -64,8 +64,9 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
64
64
|
resizeHandleColumnIndex: undefined,
|
|
65
65
|
resizeHandleRowIndex: undefined
|
|
66
66
|
});
|
|
67
|
+
case 'START_KEYBOARD_COLUMN_RESIZE':
|
|
67
68
|
case 'ADD_RESIZE_HANDLE_DECORATIONS':
|
|
68
|
-
if (action.data.resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex && action.data.resizeHandleRowIndex === pluginState.resizeHandleRowIndex && action.data.resizeHandleIncludeTooltip === pluginState.resizeHandleIncludeTooltip) {
|
|
69
|
+
if (action.data.resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex && action.data.resizeHandleRowIndex === pluginState.resizeHandleRowIndex && action.data.resizeHandleIncludeTooltip === pluginState.resizeHandleIncludeTooltip && action.data.isKeyboardResize === pluginState.isKeyboardResize) {
|
|
69
70
|
return pluginState;
|
|
70
71
|
}
|
|
71
72
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), {}, {
|
|
@@ -84,6 +85,7 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
84
85
|
resizeHandleRowIndex: resizeHandleRowIndex !== null && resizeHandleRowIndex !== void 0 ? resizeHandleRowIndex : pluginState.resizeHandleRowIndex,
|
|
85
86
|
resizeHandleIncludeTooltip: resizeHandleIncludeTooltip !== null && resizeHandleIncludeTooltip !== void 0 ? resizeHandleIncludeTooltip : pluginState.resizeHandleIncludeTooltip
|
|
86
87
|
});
|
|
88
|
+
case 'STOP_KEYBOARD_COLUMN_RESIZE':
|
|
87
89
|
case 'REMOVE_RESIZE_HANDLE_DECORATIONS':
|
|
88
90
|
if (!pluginState.isResizeHandleWidgetAdded) {
|
|
89
91
|
return pluginState;
|
|
@@ -91,7 +93,8 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
91
93
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), {}, {
|
|
92
94
|
resizeHandleColumnIndex: undefined,
|
|
93
95
|
resizeHandleRowIndex: undefined,
|
|
94
|
-
isResizeHandleWidgetAdded: false
|
|
96
|
+
isResizeHandleWidgetAdded: false,
|
|
97
|
+
isKeyboardResize: undefined
|
|
95
98
|
});
|
|
96
99
|
case 'SET_TABLE_REF':
|
|
97
100
|
case 'HOVER_ROWS':
|
|
@@ -2,24 +2,59 @@ import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
|
2
2
|
import { TableMap } from '@atlaskit/editor-tables';
|
|
3
3
|
import { findCellClosestToPos, findCellRectClosestToPos, findTableClosestToPos, getSelectionRect, isSelectionType, nextCell } from '@atlaskit/editor-tables/utils';
|
|
4
4
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { getDecorations } from '../pm-plugins/decorations/plugin';
|
|
6
|
+
import { buildColumnResizingDecorations, clearColumnResizingDecorations } from '../pm-plugins/decorations/utils';
|
|
7
|
+
import { createCommand, getPluginState } from '../pm-plugins/plugin-factory';
|
|
5
8
|
import { getPluginState as getTableResizingPluginState, createCommand as tableResizingPluginCreateCommand } from '../pm-plugins/table-resizing/plugin-factory';
|
|
9
|
+
import { pluginKey as tableResizingPK } from '../pm-plugins/table-resizing/plugin-key';
|
|
6
10
|
import { currentColWidth, getResizeState, getTableMaxWidth, resizeColumn, updateControls } from '../pm-plugins/table-resizing/utils';
|
|
7
11
|
import { updateColumnWidths } from '../transforms';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
12
|
+
import { TableDecorations } from '../types';
|
|
13
|
+
import { createColumnLineResize, getSelectedColumnIndexes, updateDecorations } from '../utils';
|
|
14
|
+
const getTablePluginCommand = (actionPayload, originalTr) => {
|
|
15
|
+
return createCommand(() => actionPayload, tr => (originalTr || tr).setMeta('addToHistory', false));
|
|
16
|
+
};
|
|
10
17
|
const updateResizeHandleAndStatePosition = (rowIndex, columnIndex, nextResizeHandlePos) => (state, dispatch) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
let customTr = state.tr;
|
|
19
|
+
const {
|
|
20
|
+
pluginConfig: {
|
|
21
|
+
allowColumnResizing
|
|
22
|
+
},
|
|
23
|
+
getIntl
|
|
24
|
+
} = getPluginState(state);
|
|
25
|
+
const fakeDispatch = tr => {
|
|
26
|
+
customTr = tr;
|
|
27
|
+
};
|
|
28
|
+
if (!allowColumnResizing) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
const decorationsWithWidget = buildColumnResizingDecorations(rowIndex, columnIndex, true, getIntl)({
|
|
32
|
+
tr: customTr,
|
|
33
|
+
decorationSet: getDecorations(state)
|
|
34
|
+
});
|
|
35
|
+
const decorationsWithWidgetAndHandle = updateDecorations(customTr.doc, decorationsWithWidget, createColumnLineResize(state.selection, {
|
|
15
36
|
right: columnIndex
|
|
16
|
-
})
|
|
17
|
-
|
|
37
|
+
}), TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
|
|
38
|
+
getTablePluginCommand({
|
|
39
|
+
type: 'START_KEYBOARD_COLUMN_RESIZE',
|
|
40
|
+
data: {
|
|
41
|
+
resizeHandleRowIndex: rowIndex,
|
|
42
|
+
resizeHandleColumnIndex: columnIndex,
|
|
43
|
+
resizeHandleIncludeTooltip: true,
|
|
44
|
+
isKeyboardResize: true,
|
|
45
|
+
decorationSet: decorationsWithWidgetAndHandle
|
|
46
|
+
}
|
|
47
|
+
}, customTr)(state, fakeDispatch);
|
|
48
|
+
customTr.setMeta(tableResizingPK, {
|
|
18
49
|
type: 'SET_RESIZE_HANDLE_POSITION',
|
|
19
50
|
data: {
|
|
20
51
|
resizeHandlePos: nextResizeHandlePos
|
|
21
52
|
}
|
|
22
|
-
})
|
|
53
|
+
});
|
|
54
|
+
if (dispatch) {
|
|
55
|
+
dispatch(customTr);
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
23
58
|
return false;
|
|
24
59
|
};
|
|
25
60
|
export const initiateKeyboardColumnResizing = (state, dispatch, view) => {
|
|
@@ -32,32 +67,19 @@ export const initiateKeyboardColumnResizing = (state, dispatch, view) => {
|
|
|
32
67
|
const selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
33
68
|
const cell = findCellClosestToPos(selection.$from);
|
|
34
69
|
if (selectionRect && cell && view) {
|
|
35
|
-
|
|
36
|
-
const width = currentColWidth(view, cell.pos, cellAttrs);
|
|
37
|
-
updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
|
|
38
|
-
tableResizingPluginCreateCommand({
|
|
39
|
-
type: 'SET_DRAGGING',
|
|
40
|
-
data: {
|
|
41
|
-
dragging: {
|
|
42
|
-
startX: 0,
|
|
43
|
-
startWidth: width
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
})(state, dispatch);
|
|
47
|
-
return true;
|
|
70
|
+
return updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
|
|
48
71
|
}
|
|
49
72
|
return false;
|
|
50
73
|
};
|
|
51
|
-
export const activateNextResizeArea = direction => (state, dispatch) => {
|
|
74
|
+
export const activateNextResizeArea = direction => (state, dispatch, view) => {
|
|
52
75
|
if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
53
76
|
return false;
|
|
54
77
|
}
|
|
55
78
|
const {
|
|
56
|
-
resizeHandlePos
|
|
57
|
-
dragging
|
|
79
|
+
resizeHandlePos
|
|
58
80
|
} = getTableResizingPluginState(state) || {};
|
|
59
81
|
// If No resizing has initiated, skip to regular handler
|
|
60
|
-
if (!resizeHandlePos
|
|
82
|
+
if (!resizeHandlePos) {
|
|
61
83
|
return false;
|
|
62
84
|
}
|
|
63
85
|
const {
|
|
@@ -84,30 +106,34 @@ export const activateNextResizeArea = direction => (state, dispatch) => {
|
|
|
84
106
|
// we are somewhere in between the side columns of the table
|
|
85
107
|
const offset = $nextCell.pos - $nextCell.start(-1);
|
|
86
108
|
const rectForNextCell = tableMap.findCell(offset);
|
|
87
|
-
updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos)(state, dispatch);
|
|
109
|
+
return updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos)(state, dispatch, view);
|
|
88
110
|
} else {
|
|
89
111
|
// current position is in the one of the side columns of the table(left or right)
|
|
90
112
|
if (currentCellRect.left === 0) {
|
|
91
113
|
const lastCellInCurrentRow = tableMap.positionAt(currentCellRect.top, tableMap.width - 1, tableNode) + closestTable.start;
|
|
92
114
|
const $lastCell = state.doc.resolve(lastCellInCurrentRow);
|
|
93
|
-
updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos)(state, dispatch);
|
|
115
|
+
return updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos)(state, dispatch, view);
|
|
94
116
|
} else if (tableMap.width === currentCellRect.right) {
|
|
95
117
|
const firsCellInCurrentRow = tableMap.positionAt(currentCellRect.top, 0, tableNode) + closestTable.start;
|
|
96
118
|
const $nextCell = state.doc.resolve(firsCellInCurrentRow);
|
|
97
|
-
updateResizeHandleAndStatePosition(currentCellRect.top, 1, $nextCell.pos)(state, dispatch);
|
|
119
|
+
return updateResizeHandleAndStatePosition(currentCellRect.top, 1, $nextCell.pos)(state, dispatch);
|
|
98
120
|
}
|
|
99
121
|
}
|
|
100
|
-
return
|
|
122
|
+
return false;
|
|
101
123
|
};
|
|
102
124
|
export const changeColumnWidthByStep = (stepSize, getEditorContainerWidth) => (state, dispatch, view) => {
|
|
125
|
+
let customTr = state.tr;
|
|
126
|
+
const fakeDispatch = tr => {
|
|
127
|
+
customTr = tr;
|
|
128
|
+
};
|
|
103
129
|
if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
104
130
|
return false;
|
|
105
131
|
}
|
|
106
132
|
const {
|
|
107
|
-
resizeHandlePos
|
|
108
|
-
dragging
|
|
133
|
+
resizeHandlePos
|
|
109
134
|
} = getTableResizingPluginState(state);
|
|
110
|
-
|
|
135
|
+
const cell = findCellClosestToPos(state.selection.$from);
|
|
136
|
+
if (!view || !resizeHandlePos || !cell) {
|
|
111
137
|
return false;
|
|
112
138
|
}
|
|
113
139
|
const $cell = state.doc.resolve(resizeHandlePos);
|
|
@@ -120,6 +146,17 @@ export const changeColumnWidthByStep = (stepSize, getEditorContainerWidth) => (s
|
|
|
120
146
|
if (dom && dom.nodeName !== 'TABLE') {
|
|
121
147
|
dom = dom.closest('table');
|
|
122
148
|
}
|
|
149
|
+
const cellAttrs = cell === null || cell === void 0 ? void 0 : cell.node.attrs;
|
|
150
|
+
const width = currentColWidth(view, cell === null || cell === void 0 ? void 0 : cell.pos, cellAttrs);
|
|
151
|
+
tableResizingPluginCreateCommand({
|
|
152
|
+
type: 'SET_DRAGGING',
|
|
153
|
+
data: {
|
|
154
|
+
dragging: {
|
|
155
|
+
startX: 0,
|
|
156
|
+
startWidth: width
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
})(state, fakeDispatch);
|
|
123
160
|
const maxSize = getTableMaxWidth({
|
|
124
161
|
table: originalTable,
|
|
125
162
|
tableStart: tableStartPosition,
|
|
@@ -141,9 +178,37 @@ export const changeColumnWidthByStep = (stepSize, getEditorContainerWidth) => (s
|
|
|
141
178
|
// only selected (or selected - 1) columns should be distributed
|
|
142
179
|
const resizingSelectedColumns = selectedColumns.indexOf(colIndex) > -1 || selectedColumns.indexOf(colIndex + 1) > -1;
|
|
143
180
|
const newResizeState = resizeColumn(initialResizeState, colIndex, stepSize, dom, resizingSelectedColumns ? selectedColumns : undefined);
|
|
144
|
-
|
|
181
|
+
customTr = updateColumnWidths(newResizeState, originalTable, tableStartPosition)(customTr);
|
|
145
182
|
if (dispatch) {
|
|
146
|
-
dispatch(
|
|
183
|
+
dispatch(customTr);
|
|
147
184
|
}
|
|
148
185
|
return true;
|
|
186
|
+
};
|
|
187
|
+
export const stopKeyboardColumnResizing = originalTr => (state, dispatch) => {
|
|
188
|
+
if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
let customTr = originalTr || state.tr;
|
|
192
|
+
const fakeDispatch = tr => {
|
|
193
|
+
customTr = tr;
|
|
194
|
+
};
|
|
195
|
+
const decorationWithoutWidget = clearColumnResizingDecorations()({
|
|
196
|
+
tr: customTr,
|
|
197
|
+
decorationSet: getDecorations(state)
|
|
198
|
+
});
|
|
199
|
+
const decorationWithoutWidgetAndHandle = updateDecorations(customTr.doc, decorationWithoutWidget, [], TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
|
|
200
|
+
getTablePluginCommand({
|
|
201
|
+
type: 'STOP_KEYBOARD_COLUMN_RESIZE',
|
|
202
|
+
data: {
|
|
203
|
+
decorationSet: decorationWithoutWidgetAndHandle
|
|
204
|
+
}
|
|
205
|
+
}, customTr)(state, fakeDispatch);
|
|
206
|
+
tableResizingPluginCreateCommand({
|
|
207
|
+
type: 'STOP_RESIZING'
|
|
208
|
+
}, () => customTr.setMeta('scrollIntoView', false))(state, fakeDispatch);
|
|
209
|
+
if (dispatch) {
|
|
210
|
+
dispatch(customTr);
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
return false;
|
|
149
214
|
};
|
|
@@ -6,23 +6,21 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
6
6
|
import { goToNextCell as baseGotoNextCell, findTable } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { insertRowWithAnalytics } from '../commands-with-analytics';
|
|
9
|
-
import { getPluginState
|
|
10
|
-
import {
|
|
9
|
+
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
10
|
+
import { stopKeyboardColumnResizing } from './column-resize';
|
|
11
11
|
const TAB_FORWARD_DIRECTION = 1;
|
|
12
12
|
const TAB_BACKWARD_DIRECTION = -1;
|
|
13
|
-
export const goToNextCell = editorAnalyticsAPI => direction => (state, dispatch) => {
|
|
13
|
+
export const goToNextCell = editorAnalyticsAPI => direction => (state, dispatch, view) => {
|
|
14
14
|
const table = findTable(state.selection);
|
|
15
15
|
if (!table) {
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
18
|
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
19
|
-
var
|
|
20
|
-
const isColumnResizing =
|
|
19
|
+
var _getPluginState;
|
|
20
|
+
const isColumnResizing = (_getPluginState = getPluginState(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.isKeyboardResize;
|
|
21
21
|
if (isColumnResizing) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, originalTr => (state.tr || originalTr).setMeta('scrollIntoView', false))(state, dispatch);
|
|
25
|
-
hideResizeHandleLine()(state, dispatch);
|
|
22
|
+
stopKeyboardColumnResizing()(state, dispatch, view);
|
|
23
|
+
return true;
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
const map = TableMap.get(table.node);
|
|
@@ -423,7 +423,7 @@ export const showInsertRowButton = rowIndex => createCommand(_ => rowIndex > -1
|
|
|
423
423
|
export const hideInsertColumnOrRowButton = () => createCommand({
|
|
424
424
|
type: 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON'
|
|
425
425
|
}, tr => tr.setMeta('addToHistory', false));
|
|
426
|
-
export const addResizeHandleDecorations = (rowIndex, columnIndex, includeTooltip) => createCommand(state => {
|
|
426
|
+
export const addResizeHandleDecorations = (rowIndex, columnIndex, includeTooltip, isKeyboardResize) => createCommand(state => {
|
|
427
427
|
const tableNode = findTable(state.selection);
|
|
428
428
|
const {
|
|
429
429
|
pluginConfig: {
|
|
@@ -443,7 +443,8 @@ export const addResizeHandleDecorations = (rowIndex, columnIndex, includeTooltip
|
|
|
443
443
|
}),
|
|
444
444
|
resizeHandleRowIndex: rowIndex,
|
|
445
445
|
resizeHandleColumnIndex: columnIndex,
|
|
446
|
-
resizeHandleIncludeTooltip: includeTooltip
|
|
446
|
+
resizeHandleIncludeTooltip: includeTooltip,
|
|
447
|
+
isKeyboardResize: isKeyboardResize || false
|
|
447
448
|
}
|
|
448
449
|
};
|
|
449
450
|
}, tr => tr.setMeta('addToHistory', false));
|
|
@@ -5,7 +5,7 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
5
5
|
import { findTable, isColumnSelected, isRowSelected, isTableSelected, selectedRect } from '@atlaskit/editor-tables/utils';
|
|
6
6
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { selectColumn, selectRow } from '../commands/misc';
|
|
8
|
-
import { getPluginState
|
|
8
|
+
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
9
9
|
import { getClosestSelectionRect } from '../toolbar';
|
|
10
10
|
export let TableSelectionDirection = /*#__PURE__*/function (TableSelectionDirection) {
|
|
11
11
|
TableSelectionDirection["TopToBottom"] = "TopToBottom";
|
|
@@ -179,8 +179,8 @@ const arrowLeftFromText = editorSelectionAPI => selection => (state, dispatch) =
|
|
|
179
179
|
} = selection;
|
|
180
180
|
let isColumnResizing = false;
|
|
181
181
|
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
182
|
-
const columResizePluginState =
|
|
183
|
-
isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.
|
|
182
|
+
const columResizePluginState = getPluginState(state) || {};
|
|
183
|
+
isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
|
|
184
184
|
}
|
|
185
185
|
if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 &&
|
|
186
186
|
// + 3 for: row, cell & paragraph nodes
|
|
@@ -211,8 +211,8 @@ const arrowRightFromText = editorSelectionAPI => selection => (state, dispatch)
|
|
|
211
211
|
} = selection;
|
|
212
212
|
let isColumnResizing = false;
|
|
213
213
|
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
214
|
-
const columResizePluginState =
|
|
215
|
-
isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.
|
|
214
|
+
const columResizePluginState = getPluginState(state) || {};
|
|
215
|
+
isColumnResizing = Boolean(columResizePluginState === null || columResizePluginState === void 0 ? void 0 : columResizePluginState.isKeyboardResize);
|
|
216
216
|
}
|
|
217
217
|
if (isSelectionAtEndOfTable($to, selection) && $to.parent.type.name === 'paragraph' && $to.depth === table.depth + 3 &&
|
|
218
218
|
// + 3 for: row, cell & paragraph nodes
|
|
@@ -4,6 +4,7 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
5
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
6
6
|
import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
|
|
7
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverCell, hoverColumns, selectColumn, setEditorFocus, setTableHovered, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from './commands';
|
|
8
9
|
import { getPluginState as getDragDropPluginState } from './pm-plugins/drag-and-drop/plugin-factory';
|
|
9
10
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
@@ -164,7 +165,18 @@ export const handleMouseOut = (view, mouseEvent) => {
|
|
|
164
165
|
state,
|
|
165
166
|
dispatch
|
|
166
167
|
} = view;
|
|
167
|
-
|
|
168
|
+
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
169
|
+
const {
|
|
170
|
+
isKeyboardResize
|
|
171
|
+
} = getPluginState(state);
|
|
172
|
+
if (isKeyboardResize) {
|
|
173
|
+
// no need to hide decoration if column resizing started by keyboard
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
return hideResizeHandleLine()(state, dispatch);
|
|
177
|
+
} else {
|
|
178
|
+
return hideResizeHandleLine()(state, dispatch);
|
|
179
|
+
}
|
|
168
180
|
}
|
|
169
181
|
return false;
|
|
170
182
|
};
|
|
@@ -265,16 +277,18 @@ export const handleMouseMove = (view, event, elementContentRects) => {
|
|
|
265
277
|
resizeHandleColumnIndex,
|
|
266
278
|
resizeHandleRowIndex
|
|
267
279
|
} = getPluginState(state);
|
|
280
|
+
const isKeyboardResize = getBooleanFF('platform.editor.a11y-column-resizing_emcvz') ? getPluginState(state).isKeyboardResize : false;
|
|
268
281
|
const tableCell = closestElement(element, 'td, th');
|
|
269
282
|
const cellStartPosition = view.posAtDOM(tableCell, 0);
|
|
270
283
|
const rect = findCellRectClosestToPos(state.doc.resolve(cellStartPosition));
|
|
271
284
|
if (rect) {
|
|
272
285
|
const columnEndIndexTarget = positionColumn === 'left' ? rect.left : rect.right;
|
|
273
286
|
const rowIndexTarget = rect.top;
|
|
274
|
-
if (columnEndIndexTarget !== resizeHandleColumnIndex || rowIndexTarget !== resizeHandleRowIndex || !hasResizeHandler({
|
|
287
|
+
if ((columnEndIndexTarget !== resizeHandleColumnIndex || rowIndexTarget !== resizeHandleRowIndex || !hasResizeHandler({
|
|
275
288
|
target: element,
|
|
276
289
|
columnEndIndexTarget
|
|
277
|
-
}))
|
|
290
|
+
})) && !isKeyboardResize // if initiated by keyboard don't need to react on hover for other resize sliders
|
|
291
|
+
) {
|
|
278
292
|
return addResizeHandleDecorations(rowIndexTarget, columnEndIndexTarget, true)(state, dispatch);
|
|
279
293
|
}
|
|
280
294
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, increaseMediaSize, moveColumnLeft, moveColumnRight, moveLeft, moveRight, moveRowDown, moveRowUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
2
|
+
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, decreaseMediaSize, deleteColumn, deleteRow, escape, increaseMediaSize, moveColumnLeft, moveColumnRight, moveLeft, moveRight, moveRowDown, moveRowUp, nextCell, previousCell, startColumnResizing, toggleTable } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
4
4
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
5
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { createTable, goToNextCell, moveCursorBackward } from '../commands';
|
|
7
7
|
import { addRowAroundSelection, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
8
|
-
import { activateNextResizeArea, changeColumnWidthByStep, initiateKeyboardColumnResizing } from '../commands/column-resize';
|
|
8
|
+
import { activateNextResizeArea, changeColumnWidthByStep, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
9
9
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
|
|
10
10
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
11
|
import { withEditorAnalyticsAPI } from '../utils/analytics';
|
|
@@ -48,6 +48,7 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
|
|
|
48
48
|
bindKeymapWithCommand(moveLeft.common, activateNextResizeArea(-1), list);
|
|
49
49
|
bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStep(-10, getEditorContainerWidth), list);
|
|
50
50
|
bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStep(10, getEditorContainerWidth), list);
|
|
51
|
+
bindKeymapWithCommand(escape.common, stopKeyboardColumnResizing(), list);
|
|
51
52
|
}
|
|
52
53
|
return keymap(list);
|
|
53
54
|
}
|
|
@@ -4,7 +4,11 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
4
4
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension } from '@atlaskit/editor-common/transforms';
|
|
5
5
|
import { browser, closestElement } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
+
import { TableMap } from '@atlaskit/editor-tables';
|
|
8
|
+
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
9
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
10
|
import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
|
|
11
|
+
import { stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
8
12
|
import { removeResizeHandleDecorations, transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
|
|
9
13
|
import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseEnter, handleMouseLeave, handleMouseMove, handleMouseOut, handleMouseOver, handleTripleClick, whenTableInFocus, withCellTracking } from '../event-handlers';
|
|
10
14
|
import { createTableView } from '../nodeviews/table';
|
|
@@ -91,7 +95,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
91
95
|
const domAtPos = editorView.domAtPos.bind(editorView);
|
|
92
96
|
editorViewRef = editorView;
|
|
93
97
|
return {
|
|
94
|
-
update: view => {
|
|
98
|
+
update: (view, prevState) => {
|
|
95
99
|
const {
|
|
96
100
|
state,
|
|
97
101
|
dispatch
|
|
@@ -106,6 +110,28 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
106
110
|
if (parent) {
|
|
107
111
|
tableRef = parent.querySelector('table') || undefined;
|
|
108
112
|
}
|
|
113
|
+
const tableNode = findTable(state.selection);
|
|
114
|
+
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
115
|
+
// when cursor leaves the table we need to stop column resizing
|
|
116
|
+
const pluginPrevState = getPluginState(prevState);
|
|
117
|
+
const isStopKeyboardColumResizing = pluginPrevState.isResizeHandleWidgetAdded && pluginPrevState.isKeyboardResize;
|
|
118
|
+
if (isStopKeyboardColumResizing) {
|
|
119
|
+
const isTableNodesDifferent = (pluginPrevState === null || pluginPrevState === void 0 ? void 0 : pluginPrevState.tableNode) !== (tableNode === null || tableNode === void 0 ? void 0 : tableNode.node);
|
|
120
|
+
if (pluginPrevState !== null && pluginPrevState !== void 0 && pluginPrevState.tableNode && tableNode && isTableNodesDifferent) {
|
|
121
|
+
const oldRowsNumber = TableMap.get(pluginPrevState.tableNode).height;
|
|
122
|
+
const newRowsNumber = TableMap.get(tableNode.node).height;
|
|
123
|
+
if (oldRowsNumber !== newRowsNumber ||
|
|
124
|
+
// Add/delete row
|
|
125
|
+
tableNode.node.attrs.localId !== pluginPrevState.tableNode.attrs.localId) {
|
|
126
|
+
// Jump to another table
|
|
127
|
+
stopKeyboardColumnResizing()(state, dispatch);
|
|
128
|
+
}
|
|
129
|
+
} else if (!tableNode) {
|
|
130
|
+
// selection outside of table
|
|
131
|
+
stopKeyboardColumnResizing()(state, dispatch);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
109
135
|
}
|
|
110
136
|
if (pluginState.tableRef !== tableRef) {
|
|
111
137
|
setTableRef(tableRef)(state, dispatch);
|
|
@@ -208,10 +234,20 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
208
234
|
const maybeTr = closestElement(domRef, 'tr');
|
|
209
235
|
return maybeTr ? maybeTr.classList.contains('sticky') : false;
|
|
210
236
|
},
|
|
211
|
-
handleTextInput: ({
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
237
|
+
handleTextInput: (view, _from, _to, text) => {
|
|
238
|
+
const {
|
|
239
|
+
state,
|
|
240
|
+
dispatch
|
|
241
|
+
} = view;
|
|
242
|
+
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
243
|
+
const {
|
|
244
|
+
isKeyboardResize
|
|
245
|
+
} = getPluginState(state);
|
|
246
|
+
if (isKeyboardResize) {
|
|
247
|
+
stopKeyboardColumnResizing()(state, dispatch);
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
215
251
|
const tr = replaceSelectedTable(state, text, INPUT_METHOD.KEYBOARD, editorAnalyticsAPI);
|
|
216
252
|
if (tr.selectionSet) {
|
|
217
253
|
dispatch(tr);
|