@atlaskit/editor-plugin-table 2.8.5 → 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,11 @@
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
+
3
9
  ## 2.8.5
4
10
 
5
11
  ### Patch Changes
@@ -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.5",
3
+ "version": "2.8.6",
4
4
  "sideEffects": false
5
5
  }
@@ -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.5",
3
+ "version": "2.8.6",
4
4
  "sideEffects": false
5
5
  }
@@ -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.5",
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.5",
3
+ "version": "2.8.6",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -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"