@atlaskit/editor-plugin-table 2.8.4 → 2.8.6

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 2.8.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5365e42ef97`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5365e42ef97) - cleaned up more of the \* as keymaps imports to enable better tree-shaking
8
+
9
+ ## 2.8.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`58fa188ef48`](https://bitbucket.org/atlassian/atlassian-frontend/commits/58fa188ef48) - [ux] [ED-19461] Reduce draggable zone of adjacent resize handle.
14
+
3
15
  ## 2.8.4
4
16
 
5
17
  ### Patch Changes
@@ -28,6 +28,7 @@ var handles = {
28
28
  right: true
29
29
  };
30
30
  var tableHandleMarginTop = 12;
31
+ var tableHandlePosition = 14;
31
32
  var getResizerHandleHeight = function getResizerHandleHeight(tableRef) {
32
33
  var tableHeight = tableRef === null || tableRef === void 0 ? void 0 : tableRef.clientHeight;
33
34
  var handleHeightSize = 'small';
@@ -193,6 +194,7 @@ var TableResizer = function TableResizer(_ref) {
193
194
  snapGap: _consts.TABLE_SNAP_GAP,
194
195
  snap: guidelineSnaps,
195
196
  handlePositioning: "adjacent",
197
+ innerPadding: tableHandlePosition,
196
198
  isHandleVisible: ((_findTable = (0, _utils.findTable)((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos(),
197
199
  handleComponent: handleComponent
198
200
  }, children);
@@ -1,21 +1,18 @@
1
1
  "use strict";
2
2
 
3
- var _typeof = require("@babel/runtime/helpers/typeof");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.default = void 0;
8
7
  exports.keymapPlugin = keymapPlugin;
9
8
  var _analytics = require("@atlaskit/editor-common/analytics");
10
- var keymaps = _interopRequireWildcard(require("@atlaskit/editor-common/keymaps"));
9
+ var _keymaps = require("@atlaskit/editor-common/keymaps");
11
10
  var _commands = require("@atlaskit/editor-prosemirror/commands");
12
11
  var _keymap = require("@atlaskit/editor-prosemirror/keymap");
13
12
  var _commands2 = require("../commands");
14
13
  var _commandsWithAnalytics = require("../commands-with-analytics");
15
14
  var _insert = require("../commands/insert");
16
15
  var _analytics2 = require("../utils/analytics");
17
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
16
  var createTableWithAnalytics = function createTableWithAnalytics(editorAnalyticsAPI) {
20
17
  return (0, _analytics2.withEditorAnalyticsAPI)({
21
18
  action: _analytics.ACTION.INSERTED,
@@ -29,17 +26,17 @@ var createTableWithAnalytics = function createTableWithAnalytics(editorAnalytics
29
26
  };
30
27
  function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI) {
31
28
  var list = {};
32
- keymaps.bindKeymapWithCommand(keymaps.nextCell.common, (0, _commands2.goToNextCell)(editorAnalyticsAPI)(1), list);
33
- keymaps.bindKeymapWithCommand(keymaps.previousCell.common, (0, _commands2.goToNextCell)(editorAnalyticsAPI)(-1), list);
34
- keymaps.bindKeymapWithCommand(keymaps.toggleTable.common, createTableWithAnalytics(editorAnalyticsAPI), list);
35
- keymaps.bindKeymapWithCommand(keymaps.backspace.common, (0, _commands.chainCommands)((0, _commandsWithAnalytics.deleteTableIfSelectedWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD), (0, _commandsWithAnalytics.emptyMultipleCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD)), list);
36
- keymaps.bindKeymapWithCommand(keymaps.backspace.common, _commands2.moveCursorBackward, list);
29
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.nextCell.common, (0, _commands2.goToNextCell)(editorAnalyticsAPI)(1), list);
30
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.previousCell.common, (0, _commands2.goToNextCell)(editorAnalyticsAPI)(-1), list);
31
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.toggleTable.common, createTableWithAnalytics(editorAnalyticsAPI), list);
32
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.backspace.common, (0, _commands.chainCommands)((0, _commandsWithAnalytics.deleteTableIfSelectedWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD), (0, _commandsWithAnalytics.emptyMultipleCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD)), list);
33
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.backspace.common, _commands2.moveCursorBackward, list);
37
34
 
38
35
  // Add row/column shortcuts
39
- keymaps.bindKeymapWithCommand(keymaps.addRowBefore.common, (0, _commandsWithAnalytics.addRowAroundSelection)(editorAnalyticsAPI)('TOP'), list);
40
- keymaps.bindKeymapWithCommand(keymaps.addRowAfter.common, (0, _commandsWithAnalytics.addRowAroundSelection)(editorAnalyticsAPI)('BOTTOM'), list);
41
- keymaps.bindKeymapWithCommand(keymaps.addColumnBefore.common, (0, _commands2.triggerUnlessTableHeader)((0, _insert.addColumnBefore)(getEditorContainerWidth)), list);
42
- keymaps.bindKeymapWithCommand(keymaps.addColumnAfter.common, (0, _insert.addColumnAfter)(getEditorContainerWidth), list);
36
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.addRowBefore.common, (0, _commandsWithAnalytics.addRowAroundSelection)(editorAnalyticsAPI)('TOP'), list);
37
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.addRowAfter.common, (0, _commandsWithAnalytics.addRowAroundSelection)(editorAnalyticsAPI)('BOTTOM'), list);
38
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.addColumnBefore.common, (0, _commands2.triggerUnlessTableHeader)((0, _insert.addColumnBefore)(getEditorContainerWidth)), list);
39
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.addColumnAfter.common, (0, _insert.addColumnAfter)(getEditorContainerWidth), list);
43
40
  return (0, _keymap.keymap)(list);
44
41
  }
45
42
  var _default = keymapPlugin;
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
8
  var _react = _interopRequireDefault(require("react"));
10
9
  var _reactIntlNext = require("react-intl-next");
11
- var keymaps = _interopRequireWildcard(require("@atlaskit/editor-common/keymaps"));
10
+ var _keymaps = require("@atlaskit/editor-common/keymaps");
12
11
  var _styles = require("@atlaskit/editor-common/styles");
13
12
  var _utils = require("@atlaskit/editor-common/utils");
14
13
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
@@ -16,8 +15,6 @@ var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
16
15
  var _types = require("../../types");
17
16
  var _consts = require("../consts");
18
17
  var _messages = _interopRequireDefault(require("../messages"));
19
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
18
  var getInsertLineHeight = function getInsertLineHeight(tableRef, hasStickyHeaders) {
22
19
  // The line gets height 100% from the table,
23
20
  // but since we have an overflow on the left,
@@ -57,9 +54,9 @@ var InsertButton = function InsertButton(_ref2) {
57
54
  formatMessage = _ref2.intl.formatMessage,
58
55
  hasStickyHeaders = _ref2.hasStickyHeaders;
59
56
  var content = /*#__PURE__*/_react.default.createElement(_tooltip.default, {
60
- content: /*#__PURE__*/_react.default.createElement(keymaps.ToolTipContent, {
57
+ content: /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
61
58
  description: formatMessage(tooltipMessageByType(type)),
62
- keymap: type === 'row' ? keymaps.addRowAfter : keymaps.addColumnAfter
59
+ keymap: type === 'row' ? _keymaps.addRowAfter : _keymaps.addColumnAfter
63
60
  }),
64
61
  position: "top"
65
62
  }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.8.4",
3
+ "version": "2.8.6",
4
4
  "sideEffects": false
5
5
  }
@@ -14,6 +14,7 @@ const handles = {
14
14
  right: true
15
15
  };
16
16
  const tableHandleMarginTop = 12;
17
+ const tableHandlePosition = 14;
17
18
  const getResizerHandleHeight = tableRef => {
18
19
  const tableHeight = tableRef === null || tableRef === void 0 ? void 0 : tableRef.clientHeight;
19
20
  let handleHeightSize = 'small';
@@ -180,6 +181,7 @@ export const TableResizer = ({
180
181
  snapGap: TABLE_SNAP_GAP,
181
182
  snap: guidelineSnaps,
182
183
  handlePositioning: "adjacent",
184
+ innerPadding: tableHandlePosition,
183
185
  isHandleVisible: ((_findTable = findTable((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos(),
184
186
  handleComponent: handleComponent
185
187
  }, children);
@@ -1,10 +1,10 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import * as keymaps from '@atlaskit/editor-common/keymaps';
2
+ import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, nextCell, previousCell, 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 { createTable, goToNextCell, moveCursorBackward, triggerUnlessTableHeader } from '../commands';
6
6
  import { addRowAroundSelection, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
7
- import { addColumnAfter, addColumnBefore } from '../commands/insert';
7
+ import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
8
8
  import { withEditorAnalyticsAPI } from '../utils/analytics';
9
9
  const createTableWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsAPI({
10
10
  action: ACTION.INSERTED,
@@ -17,17 +17,17 @@ const createTableWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsAPI({
17
17
  })(editorAnalyticsAPI)(createTable());
18
18
  export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI) {
19
19
  const list = {};
20
- keymaps.bindKeymapWithCommand(keymaps.nextCell.common, goToNextCell(editorAnalyticsAPI)(1), list);
21
- keymaps.bindKeymapWithCommand(keymaps.previousCell.common, goToNextCell(editorAnalyticsAPI)(-1), list);
22
- keymaps.bindKeymapWithCommand(keymaps.toggleTable.common, createTableWithAnalytics(editorAnalyticsAPI), list);
23
- keymaps.bindKeymapWithCommand(keymaps.backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
24
- keymaps.bindKeymapWithCommand(keymaps.backspace.common, moveCursorBackward, list);
20
+ bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI)(1), list);
21
+ bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI)(-1), list);
22
+ bindKeymapWithCommand(toggleTable.common, createTableWithAnalytics(editorAnalyticsAPI), list);
23
+ bindKeymapWithCommand(backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
24
+ bindKeymapWithCommand(backspace.common, moveCursorBackward, list);
25
25
 
26
26
  // Add row/column shortcuts
27
- keymaps.bindKeymapWithCommand(keymaps.addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
28
- keymaps.bindKeymapWithCommand(keymaps.addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
29
- keymaps.bindKeymapWithCommand(keymaps.addColumnBefore.common, triggerUnlessTableHeader(addColumnBefore(getEditorContainerWidth)), list);
30
- keymaps.bindKeymapWithCommand(keymaps.addColumnAfter.common, addColumnAfter(getEditorContainerWidth), list);
27
+ bindKeymapWithCommand(addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
28
+ bindKeymapWithCommand(addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
29
+ bindKeymapWithCommand(addColumnBefore.common, triggerUnlessTableHeader(addColumnBeforeCommand(getEditorContainerWidth)), list);
30
+ bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(getEditorContainerWidth), list);
31
31
  return keymap(list);
32
32
  }
33
33
  export default keymapPlugin;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { injectIntl } from 'react-intl-next';
3
- import * as keymaps from '@atlaskit/editor-common/keymaps';
3
+ import { addColumnAfter, addRowAfter, ToolTipContent } from '@atlaskit/editor-common/keymaps';
4
4
  import { tableMarginTop } from '@atlaskit/editor-common/styles';
5
5
  import { closestElement } from '@atlaskit/editor-common/utils';
6
6
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
@@ -53,9 +53,9 @@ const InsertButton = ({
53
53
  hasStickyHeaders
54
54
  }) => {
55
55
  const content = /*#__PURE__*/React.createElement(Tooltip, {
56
- content: /*#__PURE__*/React.createElement(keymaps.ToolTipContent, {
56
+ content: /*#__PURE__*/React.createElement(ToolTipContent, {
57
57
  description: formatMessage(tooltipMessageByType(type)),
58
- keymap: type === 'row' ? keymaps.addRowAfter : keymaps.addColumnAfter
58
+ keymap: type === 'row' ? addRowAfter : addColumnAfter
59
59
  }),
60
60
  position: "top"
61
61
  }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.8.4",
3
+ "version": "2.8.6",
4
4
  "sideEffects": false
5
5
  }
@@ -18,6 +18,7 @@ var handles = {
18
18
  right: true
19
19
  };
20
20
  var tableHandleMarginTop = 12;
21
+ var tableHandlePosition = 14;
21
22
  var getResizerHandleHeight = function getResizerHandleHeight(tableRef) {
22
23
  var tableHeight = tableRef === null || tableRef === void 0 ? void 0 : tableRef.clientHeight;
23
24
  var handleHeightSize = 'small';
@@ -183,6 +184,7 @@ export var TableResizer = function TableResizer(_ref) {
183
184
  snapGap: TABLE_SNAP_GAP,
184
185
  snap: guidelineSnaps,
185
186
  handlePositioning: "adjacent",
187
+ innerPadding: tableHandlePosition,
186
188
  isHandleVisible: ((_findTable = findTable((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos(),
187
189
  handleComponent: handleComponent
188
190
  }, children);
@@ -1,10 +1,10 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import * as keymaps from '@atlaskit/editor-common/keymaps';
2
+ import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, nextCell, previousCell, 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 { createTable, goToNextCell, moveCursorBackward, triggerUnlessTableHeader } from '../commands';
6
6
  import { addRowAroundSelection, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
7
- import { addColumnAfter, addColumnBefore } from '../commands/insert';
7
+ import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
8
8
  import { withEditorAnalyticsAPI } from '../utils/analytics';
9
9
  var createTableWithAnalytics = function createTableWithAnalytics(editorAnalyticsAPI) {
10
10
  return withEditorAnalyticsAPI({
@@ -19,17 +19,17 @@ var createTableWithAnalytics = function createTableWithAnalytics(editorAnalytics
19
19
  };
20
20
  export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI) {
21
21
  var list = {};
22
- keymaps.bindKeymapWithCommand(keymaps.nextCell.common, goToNextCell(editorAnalyticsAPI)(1), list);
23
- keymaps.bindKeymapWithCommand(keymaps.previousCell.common, goToNextCell(editorAnalyticsAPI)(-1), list);
24
- keymaps.bindKeymapWithCommand(keymaps.toggleTable.common, createTableWithAnalytics(editorAnalyticsAPI), list);
25
- keymaps.bindKeymapWithCommand(keymaps.backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
26
- keymaps.bindKeymapWithCommand(keymaps.backspace.common, moveCursorBackward, list);
22
+ bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI)(1), list);
23
+ bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI)(-1), list);
24
+ bindKeymapWithCommand(toggleTable.common, createTableWithAnalytics(editorAnalyticsAPI), list);
25
+ bindKeymapWithCommand(backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
26
+ bindKeymapWithCommand(backspace.common, moveCursorBackward, list);
27
27
 
28
28
  // Add row/column shortcuts
29
- keymaps.bindKeymapWithCommand(keymaps.addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
30
- keymaps.bindKeymapWithCommand(keymaps.addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
31
- keymaps.bindKeymapWithCommand(keymaps.addColumnBefore.common, triggerUnlessTableHeader(addColumnBefore(getEditorContainerWidth)), list);
32
- keymaps.bindKeymapWithCommand(keymaps.addColumnAfter.common, addColumnAfter(getEditorContainerWidth), list);
29
+ bindKeymapWithCommand(addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
30
+ bindKeymapWithCommand(addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
31
+ bindKeymapWithCommand(addColumnBefore.common, triggerUnlessTableHeader(addColumnBeforeCommand(getEditorContainerWidth)), list);
32
+ bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(getEditorContainerWidth), list);
33
33
  return keymap(list);
34
34
  }
35
35
  export default keymapPlugin;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { injectIntl } from 'react-intl-next';
3
- import * as keymaps from '@atlaskit/editor-common/keymaps';
3
+ import { addColumnAfter, addRowAfter, ToolTipContent } from '@atlaskit/editor-common/keymaps';
4
4
  import { tableMarginTop } from '@atlaskit/editor-common/styles';
5
5
  import { closestElement } from '@atlaskit/editor-common/utils';
6
6
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
@@ -47,9 +47,9 @@ var InsertButton = function InsertButton(_ref2) {
47
47
  formatMessage = _ref2.intl.formatMessage,
48
48
  hasStickyHeaders = _ref2.hasStickyHeaders;
49
49
  var content = /*#__PURE__*/React.createElement(Tooltip, {
50
- content: /*#__PURE__*/React.createElement(keymaps.ToolTipContent, {
50
+ content: /*#__PURE__*/React.createElement(ToolTipContent, {
51
51
  description: formatMessage(tooltipMessageByType(type)),
52
- keymap: type === 'row' ? keymaps.addRowAfter : keymaps.addColumnAfter
52
+ keymap: type === 'row' ? addRowAfter : addColumnAfter
53
53
  }),
54
54
  position: "top"
55
55
  }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.8.4",
3
+ "version": "2.8.6",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
- import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
4
4
  export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null): SafePlugin;
5
5
  export default keymapPlugin;
@@ -1,5 +1,6 @@
1
- import React, { SyntheticEvent } from 'react';
2
- import { WrappedComponentProps } from 'react-intl-next';
1
+ import type { SyntheticEvent } from 'react';
2
+ import React from 'react';
3
+ import type { WrappedComponentProps } from 'react-intl-next';
3
4
  export interface ButtonProps {
4
5
  type: 'row' | 'column';
5
6
  tableRef: HTMLElement;
@@ -1,5 +1,5 @@
1
- import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
4
4
  export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null): SafePlugin;
5
5
  export default keymapPlugin;
@@ -1,5 +1,6 @@
1
- import React, { SyntheticEvent } from 'react';
2
- import { WrappedComponentProps } from 'react-intl-next';
1
+ import type { SyntheticEvent } from 'react';
2
+ import React from 'react';
3
+ import type { WrappedComponentProps } from 'react-intl-next';
3
4
  export interface ButtonProps {
4
5
  type: 'row' | 'column';
5
6
  tableRef: HTMLElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.8.4",
3
+ "version": "2.8.6",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -53,6 +53,7 @@ interface TableResizerProps {
53
53
 
54
54
  const handles = { right: true };
55
55
  const tableHandleMarginTop = 12;
56
+ const tableHandlePosition = 14;
56
57
 
57
58
  const getResizerHandleHeight = (tableRef: HTMLTableElement) => {
58
59
  const tableHeight = tableRef?.clientHeight;
@@ -296,6 +297,7 @@ export const TableResizer = ({
296
297
  snapGap={TABLE_SNAP_GAP}
297
298
  snap={guidelineSnaps}
298
299
  handlePositioning="adjacent"
300
+ innerPadding={tableHandlePosition}
299
301
  isHandleVisible={findTable(editorView.state?.selection)?.pos === getPos()}
300
302
  handleComponent={handleComponent}
301
303
  >
@@ -1,13 +1,23 @@
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
1
2
  import {
2
3
  ACTION,
3
4
  ACTION_SUBJECT,
4
5
  ACTION_SUBJECT_ID,
5
- EditorAnalyticsAPI,
6
6
  EVENT_TYPE,
7
7
  INPUT_METHOD,
8
8
  } from '@atlaskit/editor-common/analytics';
9
- import * as keymaps from '@atlaskit/editor-common/keymaps';
10
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
9
+ import {
10
+ addColumnAfter,
11
+ addColumnBefore,
12
+ addRowAfter,
13
+ addRowBefore,
14
+ backspace,
15
+ bindKeymapWithCommand,
16
+ nextCell,
17
+ previousCell,
18
+ toggleTable,
19
+ } from '@atlaskit/editor-common/keymaps';
20
+ import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
11
21
  import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
12
22
  import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
13
23
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
@@ -23,7 +33,10 @@ import {
23
33
  deleteTableIfSelectedWithAnalytics,
24
34
  emptyMultipleCellsWithAnalytics,
25
35
  } from '../commands-with-analytics';
26
- import { addColumnAfter, addColumnBefore } from '../commands/insert';
36
+ import {
37
+ addColumnAfter as addColumnAfterCommand,
38
+ addColumnBefore as addColumnBeforeCommand,
39
+ } from '../commands/insert';
27
40
  import { withEditorAnalyticsAPI } from '../utils/analytics';
28
41
 
29
42
  const createTableWithAnalytics = (
@@ -43,23 +56,23 @@ export function keymapPlugin(
43
56
  ): SafePlugin {
44
57
  const list = {};
45
58
 
46
- keymaps.bindKeymapWithCommand(
47
- keymaps.nextCell.common!,
59
+ bindKeymapWithCommand(
60
+ nextCell.common!,
48
61
  goToNextCell(editorAnalyticsAPI)(1),
49
62
  list,
50
63
  );
51
- keymaps.bindKeymapWithCommand(
52
- keymaps.previousCell.common!,
64
+ bindKeymapWithCommand(
65
+ previousCell.common!,
53
66
  goToNextCell(editorAnalyticsAPI)(-1),
54
67
  list,
55
68
  );
56
- keymaps.bindKeymapWithCommand(
57
- keymaps.toggleTable.common!,
69
+ bindKeymapWithCommand(
70
+ toggleTable.common!,
58
71
  createTableWithAnalytics(editorAnalyticsAPI),
59
72
  list,
60
73
  );
61
- keymaps.bindKeymapWithCommand(
62
- keymaps.backspace.common!,
74
+ bindKeymapWithCommand(
75
+ backspace.common!,
63
76
  chainCommands(
64
77
  deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(
65
78
  INPUT_METHOD.KEYBOARD,
@@ -70,34 +83,30 @@ export function keymapPlugin(
70
83
  ),
71
84
  list,
72
85
  );
73
- keymaps.bindKeymapWithCommand(
74
- keymaps.backspace.common!,
75
- moveCursorBackward,
76
- list,
77
- );
86
+ bindKeymapWithCommand(backspace.common!, moveCursorBackward, list);
78
87
 
79
88
  // Add row/column shortcuts
80
- keymaps.bindKeymapWithCommand(
81
- keymaps.addRowBefore.common!,
89
+ bindKeymapWithCommand(
90
+ addRowBefore.common!,
82
91
  addRowAroundSelection(editorAnalyticsAPI)('TOP'),
83
92
  list,
84
93
  );
85
94
 
86
- keymaps.bindKeymapWithCommand(
87
- keymaps.addRowAfter.common!,
95
+ bindKeymapWithCommand(
96
+ addRowAfter.common!,
88
97
  addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'),
89
98
  list,
90
99
  );
91
100
 
92
- keymaps.bindKeymapWithCommand(
93
- keymaps.addColumnBefore.common!,
94
- triggerUnlessTableHeader(addColumnBefore(getEditorContainerWidth)),
101
+ bindKeymapWithCommand(
102
+ addColumnBefore.common!,
103
+ triggerUnlessTableHeader(addColumnBeforeCommand(getEditorContainerWidth)),
95
104
  list,
96
105
  );
97
106
 
98
- keymaps.bindKeymapWithCommand(
99
- keymaps.addColumnAfter.common!,
100
- addColumnAfter(getEditorContainerWidth),
107
+ bindKeymapWithCommand(
108
+ addColumnAfter.common!,
109
+ addColumnAfterCommand(getEditorContainerWidth),
101
110
  list,
102
111
  );
103
112
 
@@ -1,8 +1,14 @@
1
- import React, { SyntheticEvent } from 'react';
1
+ import type { SyntheticEvent } from 'react';
2
+ import React from 'react';
2
3
 
3
- import { injectIntl, WrappedComponentProps } from 'react-intl-next';
4
+ import type { WrappedComponentProps } from 'react-intl-next';
5
+ import { injectIntl } from 'react-intl-next';
4
6
 
5
- import * as keymaps from '@atlaskit/editor-common/keymaps';
7
+ import {
8
+ addColumnAfter,
9
+ addRowAfter,
10
+ ToolTipContent,
11
+ } from '@atlaskit/editor-common/keymaps';
6
12
  import { tableMarginTop } from '@atlaskit/editor-common/styles';
7
13
  import { closestElement } from '@atlaskit/editor-common/utils';
8
14
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
@@ -77,9 +83,9 @@ const InsertButton = ({
77
83
  const content = (
78
84
  <Tooltip
79
85
  content={
80
- <keymaps.ToolTipContent
86
+ <ToolTipContent
81
87
  description={formatMessage(tooltipMessageByType(type))}
82
- keymap={type === 'row' ? keymaps.addRowAfter : keymaps.addColumnAfter}
88
+ keymap={type === 'row' ? addRowAfter : addColumnAfter}
83
89
  />
84
90
  }
85
91
  position="top"