@atlaskit/editor-plugin-table 1.5.2 → 1.5.4

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/plugins/table/index.js +5 -12
  3. package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -16
  4. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +1 -9
  5. package/dist/cjs/version.json +1 -1
  6. package/dist/es2019/plugins/table/index.js +5 -16
  7. package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -16
  8. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +3 -15
  9. package/dist/es2019/version.json +1 -1
  10. package/dist/esm/plugins/table/index.js +5 -12
  11. package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -16
  12. package/dist/esm/plugins/table/nodeviews/TableComponent.js +1 -9
  13. package/dist/esm/version.json +1 -1
  14. package/dist/types/plugins/table/index.d.ts +6 -1
  15. package/dist/types/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +0 -1
  16. package/dist/types-ts4.5/plugins/table/index.d.ts +3 -1
  17. package/dist/types-ts4.5/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +0 -1
  18. package/package.json +3 -3
  19. package/report.api.md +6 -1
  20. package/src/__tests__/unit/analytics.ts +2 -1
  21. package/src/__tests__/unit/collab.ts +2 -2
  22. package/src/__tests__/unit/commands/go-to-next-cell.ts +2 -0
  23. package/src/__tests__/unit/commands/insert.ts +2 -2
  24. package/src/__tests__/unit/commands/misc.ts +2 -0
  25. package/src/__tests__/unit/commands/sort.ts +5 -0
  26. package/src/__tests__/unit/copy-paste.ts +2 -0
  27. package/src/__tests__/unit/event-handlers/index.ts +3 -0
  28. package/src/__tests__/unit/event-handlers.ts +1 -0
  29. package/src/__tests__/unit/fix-tables.ts +2 -0
  30. package/src/__tests__/unit/handlers.ts +2 -0
  31. package/src/__tests__/unit/hover-selection.ts +2 -0
  32. package/src/__tests__/unit/nodeviews/cell.ts +2 -0
  33. package/src/__tests__/unit/nodeviews/table.ts +2 -0
  34. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +2 -0
  35. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +2 -0
  36. package/src/__tests__/unit/pm-plugins/main.ts +2 -0
  37. package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +2 -0
  38. package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +3 -0
  39. package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +1 -1
  40. package/src/__tests__/unit/pm-plugins/table-selection-keymap.ts +2 -0
  41. package/src/__tests__/unit/sort-column.ts +2 -0
  42. package/src/__tests__/unit/toolbar.ts +2 -0
  43. package/src/__tests__/unit/transforms/delete-columns.ts +2 -0
  44. package/src/__tests__/unit/transforms/delete-rows.ts +2 -0
  45. package/src/__tests__/unit/transforms/merging.ts +2 -0
  46. package/src/__tests__/unit/ui/ContextualMenu.tsx +2 -0
  47. package/src/__tests__/unit/ui/CornerControls.tsx +2 -0
  48. package/src/__tests__/unit/ui/FloatingContextualButton.tsx +2 -0
  49. package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +2 -0
  50. package/src/__tests__/unit/ui/RowControls.tsx +2 -0
  51. package/src/__tests__/unit/ui/TableFloatingControls.tsx +2 -0
  52. package/src/__tests__/unit/undo-redo.ts +2 -2
  53. package/src/__tests__/unit/utils/collapse.ts +2 -0
  54. package/src/__tests__/unit/utils/nodes.ts +2 -0
  55. package/src/__tests__/unit/utils/row-controls.ts +2 -0
  56. package/src/__tests__/unit/utils.ts +2 -0
  57. package/src/plugins/table/index.tsx +10 -15
  58. package/src/plugins/table/nodeviews/OverflowShadowsObserver.ts +3 -23
  59. package/src/plugins/table/nodeviews/TableComponent.tsx +4 -10
  60. package/tmp/api-report-tmp.d.ts +6 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 1.5.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`00d7488cf36`](https://bitbucket.org/atlassian/atlassian-frontend/commits/00d7488cf36) - [ux] The table shadow sentinels when rendered out of view would sometimes return a 0 root bounds object in the intersection observer. This became an issue because we ignore intersection entities with 0 root bounds. This fixes the right shadow not appear on tablessimply by removing the root bounds check from the observer
8
+
9
+ ## 1.5.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`b38a0fcd924`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b38a0fcd924) - Use NextEditorPlugin API for width plugin in tables.
14
+
3
15
  ## 1.5.2
4
16
 
5
17
  ### Patch Changes
@@ -43,18 +43,11 @@ var tablesPlugin = function tablesPlugin(options, api) {
43
43
  current: null
44
44
  };
45
45
  var defaultGetEditorContainerWidth = function defaultGetEditorContainerWidth() {
46
- if (!editorViewRef.current) {
47
- var _document, _document$body;
48
- return {
49
- width: ((_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) || 500
50
- };
51
- }
52
- var state = editorViewRef.current.state;
53
-
54
- // TODO: ED-15663
55
- // Please, do not copy or use this kind of code below
56
- // @ts-ignore
57
- return state['widthPlugin$'];
46
+ var _document$body$offset, _document, _document$body, _api$dependencies$wid;
47
+ var defaultState = {
48
+ width: (_document$body$offset = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) !== null && _document$body$offset !== void 0 ? _document$body$offset : 500
49
+ };
50
+ return (_api$dependencies$wid = api === null || api === void 0 ? void 0 : api.dependencies.width.sharedState.currentState()) !== null && _api$dependencies$wid !== void 0 ? _api$dependencies$wid : defaultState;
58
51
  };
59
52
  return {
60
53
  name: 'table',
@@ -28,15 +28,11 @@ var OverflowShadowsObserver = /*#__PURE__*/function () {
28
28
  }
29
29
  if (!_this.tableIntersectionObserver) {
30
30
  var intersectonOnbserverCallback = function intersectonOnbserverCallback(entry) {
31
- var _entry$rootBounds, _entry$rootBounds2;
32
- if (!((_entry$rootBounds = entry.rootBounds) !== null && _entry$rootBounds !== void 0 && _entry$rootBounds.height) && !((_entry$rootBounds2 = entry.rootBounds) !== null && _entry$rootBounds2 !== void 0 && _entry$rootBounds2.width)) {
33
- return;
34
- }
35
31
  if (entry.target !== _this.leftShadowSentinel && entry.target !== _this.rightShadowSentinel) {
36
32
  return;
37
33
  }
38
34
  _this.updateStickyShadowsHeightIfChanged();
39
- _this.checkIntersectionEvent(entry, _this.leftShadowSentinel === entry.target ? _types.ShadowEvent.SHOW_BEFORE_SHADOW : _types.ShadowEvent.SHOW_AFTER_SHADOW);
35
+ _this.updateShadowState(_this.leftShadowSentinel === entry.target ? _types.ShadowEvent.SHOW_BEFORE_SHADOW : _types.ShadowEvent.SHOW_AFTER_SHADOW, entry.intersectionRatio !== 1);
40
36
  };
41
37
  _this.tableIntersectionObserver = new IntersectionObserver(function (entries, _) {
42
38
  entries.forEach(function (entry) {
@@ -50,17 +46,6 @@ var OverflowShadowsObserver = /*#__PURE__*/function () {
50
46
  return;
51
47
  }
52
48
  });
53
- (0, _defineProperty2.default)(this, "checkIntersectionEvent", function (entry, shadowKey) {
54
- if (
55
- // If it's in full view, don't show shadow.
56
- entry.isIntersecting && entry.intersectionRatio === 1) {
57
- _this.updateShadowState(shadowKey, false);
58
- } else if (
59
- // If it's in partial view, show a shadow
60
- entry.intersectionRatio < 1) {
61
- _this.updateShadowState(shadowKey, true);
62
- }
63
- });
64
49
  (0, _defineProperty2.default)(this, "observeShadowSentinels", function (isSticky) {
65
50
  var _this$table, _this$table2;
66
51
  _this.isSticky = !!isSticky;
@@ -59,10 +59,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
59
59
  if (_this.state[shadowKey] === value) {
60
60
  return;
61
61
  }
62
- // need this check to satisfy types for the setState argument
63
- if (shadowKey === _types.ShadowEvent.SHOW_BEFORE_SHADOW) {
64
- return _this.setState((0, _defineProperty3.default)({}, shadowKey, value));
65
- }
66
62
  _this.setState((0, _defineProperty3.default)({}, shadowKey, value));
67
63
  });
68
64
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "createShadowSentinels", function (table) {
@@ -123,11 +119,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
123
119
  if (!tableOverflowShadowsOptimization) {
124
120
  _this.updateShadows();
125
121
  }
126
- if (_this.wrapper.scrollLeft === 0) {
127
- _this.setState((0, _defineProperty3.default)({}, _types.ShadowEvent.SHOW_BEFORE_SHADOW, false));
128
- } else {
129
- _this.setState((0, _defineProperty3.default)({}, _types.ShadowEvent.SHOW_BEFORE_SHADOW, true));
130
- }
122
+ _this.setState((0, _defineProperty3.default)({}, _types.ShadowEvent.SHOW_BEFORE_SHADOW, _this.wrapper.scrollLeft !== 0));
131
123
  });
132
124
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleTableResizing", function () {
133
125
  var _this$props = _this.props,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "sideEffects": false
5
5
  }
@@ -34,22 +34,11 @@ const tablesPlugin = (options, api) => {
34
34
  current: null
35
35
  };
36
36
  const defaultGetEditorContainerWidth = () => {
37
- if (!editorViewRef.current) {
38
- var _document, _document$body;
39
- return {
40
- width: ((_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) || 500
41
- };
42
- }
43
- const {
44
- current: {
45
- state
46
- }
47
- } = editorViewRef;
48
-
49
- // TODO: ED-15663
50
- // Please, do not copy or use this kind of code below
51
- // @ts-ignore
52
- return state['widthPlugin$'];
37
+ var _document$body$offset, _document, _document$body, _api$dependencies$wid;
38
+ const defaultState = {
39
+ width: (_document$body$offset = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) !== null && _document$body$offset !== void 0 ? _document$body$offset : 500
40
+ };
41
+ return (_api$dependencies$wid = api === null || api === void 0 ? void 0 : api.dependencies.width.sharedState.currentState()) !== null && _api$dependencies$wid !== void 0 ? _api$dependencies$wid : defaultState;
53
42
  };
54
43
  return {
55
44
  name: 'table',
@@ -17,15 +17,11 @@ export class OverflowShadowsObserver {
17
17
  }
18
18
  if (!this.tableIntersectionObserver) {
19
19
  const intersectonOnbserverCallback = entry => {
20
- var _entry$rootBounds, _entry$rootBounds2;
21
- if (!((_entry$rootBounds = entry.rootBounds) !== null && _entry$rootBounds !== void 0 && _entry$rootBounds.height) && !((_entry$rootBounds2 = entry.rootBounds) !== null && _entry$rootBounds2 !== void 0 && _entry$rootBounds2.width)) {
22
- return;
23
- }
24
20
  if (entry.target !== this.leftShadowSentinel && entry.target !== this.rightShadowSentinel) {
25
21
  return;
26
22
  }
27
23
  this.updateStickyShadowsHeightIfChanged();
28
- this.checkIntersectionEvent(entry, this.leftShadowSentinel === entry.target ? ShadowEvent.SHOW_BEFORE_SHADOW : ShadowEvent.SHOW_AFTER_SHADOW);
24
+ this.updateShadowState(this.leftShadowSentinel === entry.target ? ShadowEvent.SHOW_BEFORE_SHADOW : ShadowEvent.SHOW_AFTER_SHADOW, entry.intersectionRatio !== 1);
29
25
  };
30
26
  this.tableIntersectionObserver = new IntersectionObserver((entries, _) => {
31
27
  entries.forEach(entry => intersectonOnbserverCallback(entry));
@@ -37,17 +33,6 @@ export class OverflowShadowsObserver {
37
33
  return;
38
34
  }
39
35
  });
40
- _defineProperty(this, "checkIntersectionEvent", (entry, shadowKey) => {
41
- if (
42
- // If it's in full view, don't show shadow.
43
- entry.isIntersecting && entry.intersectionRatio === 1) {
44
- this.updateShadowState(shadowKey, false);
45
- } else if (
46
- // If it's in partial view, show a shadow
47
- entry.intersectionRatio < 1) {
48
- this.updateShadowState(shadowKey, true);
49
- }
50
- });
51
36
  _defineProperty(this, "observeShadowSentinels", isSticky => {
52
37
  var _this$table, _this$table2;
53
38
  this.isSticky = !!isSticky;
@@ -39,12 +39,6 @@ class TableComponent extends React.Component {
39
39
  if (this.state[shadowKey] === value) {
40
40
  return;
41
41
  }
42
- // need this check to satisfy types for the setState argument
43
- if (shadowKey === ShadowEvent.SHOW_BEFORE_SHADOW) {
44
- return this.setState({
45
- [shadowKey]: value
46
- });
47
- }
48
42
  this.setState({
49
43
  [shadowKey]: value
50
44
  });
@@ -113,15 +107,9 @@ class TableComponent extends React.Component {
113
107
  if (!tableOverflowShadowsOptimization) {
114
108
  this.updateShadows();
115
109
  }
116
- if (this.wrapper.scrollLeft === 0) {
117
- this.setState({
118
- [ShadowEvent.SHOW_BEFORE_SHADOW]: false
119
- });
120
- } else {
121
- this.setState({
122
- [ShadowEvent.SHOW_BEFORE_SHADOW]: true
123
- });
124
- }
110
+ this.setState({
111
+ [ShadowEvent.SHOW_BEFORE_SHADOW]: this.wrapper.scrollLeft !== 0
112
+ });
125
113
  });
126
114
  _defineProperty(this, "handleTableResizing", () => {
127
115
  const {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "sideEffects": false
5
5
  }
@@ -36,18 +36,11 @@ var tablesPlugin = function tablesPlugin(options, api) {
36
36
  current: null
37
37
  };
38
38
  var defaultGetEditorContainerWidth = function defaultGetEditorContainerWidth() {
39
- if (!editorViewRef.current) {
40
- var _document, _document$body;
41
- return {
42
- width: ((_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) || 500
43
- };
44
- }
45
- var state = editorViewRef.current.state;
46
-
47
- // TODO: ED-15663
48
- // Please, do not copy or use this kind of code below
49
- // @ts-ignore
50
- return state['widthPlugin$'];
39
+ var _document$body$offset, _document, _document$body, _api$dependencies$wid;
40
+ var defaultState = {
41
+ width: (_document$body$offset = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) !== null && _document$body$offset !== void 0 ? _document$body$offset : 500
42
+ };
43
+ return (_api$dependencies$wid = api === null || api === void 0 ? void 0 : api.dependencies.width.sharedState.currentState()) !== null && _api$dependencies$wid !== void 0 ? _api$dependencies$wid : defaultState;
51
44
  };
52
45
  return {
53
46
  name: 'table',
@@ -21,15 +21,11 @@ export var OverflowShadowsObserver = /*#__PURE__*/function () {
21
21
  }
22
22
  if (!_this.tableIntersectionObserver) {
23
23
  var intersectonOnbserverCallback = function intersectonOnbserverCallback(entry) {
24
- var _entry$rootBounds, _entry$rootBounds2;
25
- if (!((_entry$rootBounds = entry.rootBounds) !== null && _entry$rootBounds !== void 0 && _entry$rootBounds.height) && !((_entry$rootBounds2 = entry.rootBounds) !== null && _entry$rootBounds2 !== void 0 && _entry$rootBounds2.width)) {
26
- return;
27
- }
28
24
  if (entry.target !== _this.leftShadowSentinel && entry.target !== _this.rightShadowSentinel) {
29
25
  return;
30
26
  }
31
27
  _this.updateStickyShadowsHeightIfChanged();
32
- _this.checkIntersectionEvent(entry, _this.leftShadowSentinel === entry.target ? ShadowEvent.SHOW_BEFORE_SHADOW : ShadowEvent.SHOW_AFTER_SHADOW);
28
+ _this.updateShadowState(_this.leftShadowSentinel === entry.target ? ShadowEvent.SHOW_BEFORE_SHADOW : ShadowEvent.SHOW_AFTER_SHADOW, entry.intersectionRatio !== 1);
33
29
  };
34
30
  _this.tableIntersectionObserver = new IntersectionObserver(function (entries, _) {
35
31
  entries.forEach(function (entry) {
@@ -43,17 +39,6 @@ export var OverflowShadowsObserver = /*#__PURE__*/function () {
43
39
  return;
44
40
  }
45
41
  });
46
- _defineProperty(this, "checkIntersectionEvent", function (entry, shadowKey) {
47
- if (
48
- // If it's in full view, don't show shadow.
49
- entry.isIntersecting && entry.intersectionRatio === 1) {
50
- _this.updateShadowState(shadowKey, false);
51
- } else if (
52
- // If it's in partial view, show a shadow
53
- entry.intersectionRatio < 1) {
54
- _this.updateShadowState(shadowKey, true);
55
- }
56
- });
57
42
  _defineProperty(this, "observeShadowSentinels", function (isSticky) {
58
43
  var _this$table, _this$table2;
59
44
  _this.isSticky = !!isSticky;
@@ -54,10 +54,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
54
54
  if (_this.state[shadowKey] === value) {
55
55
  return;
56
56
  }
57
- // need this check to satisfy types for the setState argument
58
- if (shadowKey === ShadowEvent.SHOW_BEFORE_SHADOW) {
59
- return _this.setState(_defineProperty({}, shadowKey, value));
60
- }
61
57
  _this.setState(_defineProperty({}, shadowKey, value));
62
58
  });
63
59
  _defineProperty(_assertThisInitialized(_this), "createShadowSentinels", function (table) {
@@ -118,11 +114,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
118
114
  if (!tableOverflowShadowsOptimization) {
119
115
  _this.updateShadows();
120
116
  }
121
- if (_this.wrapper.scrollLeft === 0) {
122
- _this.setState(_defineProperty({}, ShadowEvent.SHOW_BEFORE_SHADOW, false));
123
- } else {
124
- _this.setState(_defineProperty({}, ShadowEvent.SHOW_BEFORE_SHADOW, true));
125
- }
117
+ _this.setState(_defineProperty({}, ShadowEvent.SHOW_BEFORE_SHADOW, _this.wrapper.scrollLeft !== 0));
126
118
  });
127
119
  _defineProperty(_assertThisInitialized(_this), "handleTableResizing", function () {
128
120
  var _this$props = _this.props,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "sideEffects": false
5
5
  }
@@ -6,6 +6,7 @@ import { PluginConfig } from './types';
6
6
  import type { GetEditorFeatureFlags, NextEditorPlugin } from '@atlaskit/editor-common/types';
7
7
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
8
8
  import type { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
9
+ import type { widthPlugin } from '@atlaskit/editor-plugin-width';
9
10
  interface TablePluginOptions {
10
11
  tableOptions: PluginConfig;
11
12
  breakoutEnabled?: boolean;
@@ -22,6 +23,10 @@ declare const tablesPlugin: NextEditorPlugin<'table', {
22
23
  actions: {
23
24
  insertTable: InsertTableAction;
24
25
  };
25
- dependencies: [typeof analyticsPlugin, typeof contentInsertionPlugin];
26
+ dependencies: [
27
+ typeof analyticsPlugin,
28
+ typeof contentInsertionPlugin,
29
+ typeof widthPlugin
30
+ ];
26
31
  }>;
27
32
  export default tablesPlugin;
@@ -11,7 +11,6 @@ export declare class OverflowShadowsObserver {
11
11
  private stickyRowHeight;
12
12
  constructor(updateShadowState: (shadowKey: ShadowEvent, value: boolean) => void, table: HTMLElement, wrapper: HTMLDivElement);
13
13
  private init;
14
- private checkIntersectionEvent;
15
14
  private updateStickyShadowsHeightIfChanged;
16
15
  private getStickyCell;
17
16
  observeShadowSentinels: (isSticky?: boolean) => void;
@@ -6,6 +6,7 @@ import { PluginConfig } from './types';
6
6
  import type { GetEditorFeatureFlags, NextEditorPlugin } from '@atlaskit/editor-common/types';
7
7
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
8
8
  import type { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
9
+ import type { widthPlugin } from '@atlaskit/editor-plugin-width';
9
10
  interface TablePluginOptions {
10
11
  tableOptions: PluginConfig;
11
12
  breakoutEnabled?: boolean;
@@ -24,7 +25,8 @@ declare const tablesPlugin: NextEditorPlugin<'table', {
24
25
  };
25
26
  dependencies: [
26
27
  typeof analyticsPlugin,
27
- typeof contentInsertionPlugin
28
+ typeof contentInsertionPlugin,
29
+ typeof widthPlugin
28
30
  ];
29
31
  }>;
30
32
  export default tablesPlugin;
@@ -11,7 +11,6 @@ export declare class OverflowShadowsObserver {
11
11
  private stickyRowHeight;
12
12
  constructor(updateShadowState: (shadowKey: ShadowEvent, value: boolean) => void, table: HTMLElement, wrapper: HTMLDivElement);
13
13
  private init;
14
- private checkIntersectionEvent;
15
14
  private updateStickyShadowsHeightIfChanged;
16
15
  private getStickyCell;
17
16
  observeShadowSentinels: (isSticky?: boolean) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -63,12 +63,12 @@
63
63
  "devDependencies": {
64
64
  "@atlaskit/analytics-next": "^9.1.0",
65
65
  "@atlaskit/button": "^16.7.0",
66
- "@atlaskit/editor-core": "^185.1.0",
66
+ "@atlaskit/editor-core": "^185.2.0",
67
67
  "@atlaskit/editor-plugin-decorations": "^0.1.0",
68
68
  "@atlaskit/editor-plugin-feature-flags": "^0.1.0",
69
69
  "@atlaskit/editor-plugin-grid": "^0.1.0",
70
70
  "@atlaskit/editor-plugin-width": "^0.1.0",
71
- "@atlaskit/editor-test-helpers": "^18.5.0",
71
+ "@atlaskit/editor-test-helpers": "^18.6.0",
72
72
  "@atlaskit/link-provider": "^1.6.0",
73
73
  "@atlaskit/logo": "^13.14.0",
74
74
  "@atlaskit/media-integration-test-helpers": "^3.0.0",
package/report.api.md CHANGED
@@ -24,6 +24,7 @@ import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
24
24
  import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
25
25
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
26
26
  import { TableLayout } from '@atlaskit/adf-schema';
27
+ import type { widthPlugin } from '@atlaskit/editor-plugin-width';
27
28
 
28
29
  // @public (undocumented)
29
30
  type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
@@ -107,7 +108,11 @@ export const tablesPlugin: NextEditorPlugin<
107
108
  actions: {
108
109
  insertTable: InsertTableAction;
109
110
  };
110
- dependencies: [typeof analyticsPlugin, typeof contentInsertionPlugin];
111
+ dependencies: [
112
+ typeof analyticsPlugin,
113
+ typeof contentInsertionPlugin,
114
+ typeof widthPlugin,
115
+ ];
111
116
  }
112
117
  >;
113
118
 
@@ -46,6 +46,7 @@ import quickInsertPlugin from '@atlaskit/editor-core/src/plugins/quick-insert';
46
46
  import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
47
47
  import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
48
48
  import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
49
+ import { widthPlugin } from '@atlaskit/editor-plugin-width';
49
50
 
50
51
  const defaultTableDoc = doc(
51
52
  table()(
@@ -86,6 +87,7 @@ describe('Table analytic events', () => {
86
87
  .add(typeAheadPlugin)
87
88
  .add(contentInsertionPlugin)
88
89
  .add(quickInsertPlugin)
90
+ .add(widthPlugin)
89
91
  .add([
90
92
  tablePlugin,
91
93
  { tableOptions, editorAnalyticsAPI: editorAnalyticsAPIFake },
@@ -316,7 +318,6 @@ describe('Table analytic events', () => {
316
318
 
317
319
  setColorWithAnalytics(editorAnalyticsAPIFake)(
318
320
  INPUT_METHOD.CONTEXT_MENU,
319
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
320
321
  B50,
321
322
  )(editorView.state, editorView.dispatch);
322
323
  });
@@ -42,8 +42,8 @@ describe('Tables with Collab editing', () => {
42
42
  .add([featureFlagsPlugin, {}])
43
43
  .add([analyticsPlugin, {}])
44
44
  .add(contentInsertionPlugin)
45
- .add([tablePlugin, { tableOptions }])
46
- .add(widthPlugin),
45
+ .add(widthPlugin)
46
+ .add([tablePlugin, { tableOptions }]),
47
47
  pluginKey: tablePluginKey,
48
48
  });
49
49
  };
@@ -23,6 +23,7 @@ import { goToNextCell } from '../../../plugins/table/commands/go-to-next-cell';
23
23
  import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
24
24
  import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
25
25
  import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
26
+ import { widthPlugin } from '@atlaskit/editor-plugin-width';
26
27
 
27
28
  const TABLE_LOCAL_ID = 'test-table-local-id';
28
29
 
@@ -37,6 +38,7 @@ describe('table plugin: goToNextCell', () => {
37
38
  .add([featureFlagsPlugin, {}])
38
39
  .add([analyticsPlugin, {}])
39
40
  .add(contentInsertionPlugin)
41
+ .add(widthPlugin)
40
42
  .add(tablePlugin);
41
43
  const editor = (doc: DocBuilder) =>
42
44
  createEditor<TablePluginState, PluginKey>({
@@ -44,13 +44,13 @@ describe('table plugin: insert', () => {
44
44
  .add([featureFlagsPlugin, {}])
45
45
  .add([analyticsPlugin, {}])
46
46
  .add(contentInsertionPlugin)
47
+ .add(widthPlugin)
47
48
  .add([
48
49
  tablePlugin,
49
50
  {
50
51
  tableOptions: {},
51
52
  },
52
- ])
53
- .add(widthPlugin);
53
+ ]);
54
54
 
55
55
  const editor = (doc: DocBuilder) =>
56
56
  createEditor<TablePluginState, PluginKey>({
@@ -31,6 +31,7 @@ import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
31
31
  import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
32
32
  import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
33
33
  import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
34
+ import { widthPlugin } from '@atlaskit/editor-plugin-width';
34
35
 
35
36
  describe('table plugin: commands', () => {
36
37
  const createEditor = createProsemirrorEditorFactory();
@@ -40,6 +41,7 @@ describe('table plugin: commands', () => {
40
41
  .add(decorationsPlugin)
41
42
  .add(panelPlugin)
42
43
  .add(contentInsertionPlugin)
44
+ .add(widthPlugin)
43
45
  .add([
44
46
  tablePlugin,
45
47
  {
@@ -28,6 +28,7 @@ import datePlugin from '@atlaskit/editor-core/src/plugins/date';
28
28
  import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
29
29
  import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
30
30
  import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
31
+ import { widthPlugin } from '@atlaskit/editor-plugin-width';
31
32
 
32
33
  const TABLE_LOCAL_ID = 'test-table-local-id';
33
34
 
@@ -47,6 +48,7 @@ describe('Sort Table', () => {
47
48
  .add([featureFlagsPlugin, {}])
48
49
  .add([analyticsPlugin, {}])
49
50
  .add(contentInsertionPlugin)
51
+ .add(widthPlugin)
50
52
  .add([tablePlugin, { tableOptions: { allowHeaderRow: true } }]),
51
53
  doc: doc(
52
54
  table()(
@@ -77,6 +79,7 @@ describe('Sort Table', () => {
77
79
  .add([featureFlagsPlugin, {}])
78
80
  .add([analyticsPlugin, {}])
79
81
  .add(contentInsertionPlugin)
82
+ .add(widthPlugin)
80
83
  .add([tablePlugin, { tableOptions: { allowHeaderRow: true } }]),
81
84
  doc: doc(
82
85
  table()(tr(td({})(p('2{<>}'))), tr(td({})(p('5'))), tr(td({})(p('4')))),
@@ -101,6 +104,7 @@ describe('Sort Table', () => {
101
104
  .add([featureFlagsPlugin, {}])
102
105
  .add([analyticsPlugin, {}])
103
106
  .add(contentInsertionPlugin)
107
+ .add(widthPlugin)
104
108
  .add([tablePlugin, { tableOptions: { allowHeaderRow: true } }]),
105
109
  doc: doc(
106
110
  table()(tr(td({})(p('2{<>}'))), tr(td({})(p('5'))), tr(td({})(p('4')))),
@@ -129,6 +133,7 @@ describe('Sort Table', () => {
129
133
  .add([analyticsPlugin, {}])
130
134
  .add(contentInsertionPlugin)
131
135
  .add(editorDisabledPlugin)
136
+ .add(widthPlugin)
132
137
  .add([tablePlugin, { tableOptions: { allowHeaderRow: true } }])
133
138
  .add([statusPlugin, { menuDisabled: false }])
134
139
  .add(mentionsPlugin)
@@ -46,6 +46,7 @@ import undoRedoPlugin from '@atlaskit/editor-core/src/plugins/undo-redo';
46
46
  import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
47
47
  import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
48
48
  import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
49
+ import { widthPlugin } from '@atlaskit/editor-plugin-width';
49
50
 
50
51
  const TABLE_LOCAL_ID = 'test-table-local-id';
51
52
  const array = (...args: any): Node[] => args.map((i: any) => i(defaultSchema));
@@ -107,6 +108,7 @@ describe('table plugin', () => {
107
108
  .add([featureFlagsPlugin, {}])
108
109
  .add([analyticsPlugin, {}])
109
110
  .add(contentInsertionPlugin)
111
+ .add(widthPlugin)
110
112
  .add([tablePlugin, { tableOptions }])
111
113
  .add(undoRedoPlugin);
112
114
 
@@ -20,6 +20,7 @@ import { PluginKey } from 'prosemirror-state';
20
20
  import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
21
21
  import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
22
22
  import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
23
+ import { widthPlugin } from '@atlaskit/editor-plugin-width';
23
24
 
24
25
  describe('event-handlers', () => {
25
26
  let editor: any;
@@ -32,6 +33,7 @@ describe('event-handlers', () => {
32
33
  .add([featureFlagsPlugin, {}])
33
34
  .add([analyticsPlugin, {}])
34
35
  .add(contentInsertionPlugin)
36
+ .add(widthPlugin)
35
37
  .add([tablePlugin, { tableOptions: { allowColumnResizing: false } }]);
36
38
  editor = (doc: DocBuilder) =>
37
39
  createEditor<TablePluginState, PluginKey>({
@@ -63,6 +65,7 @@ describe('event-handlers', () => {
63
65
  .add([featureFlagsPlugin, {}])
64
66
  .add([analyticsPlugin, {}])
65
67
  .add(contentInsertionPlugin)
68
+ .add(widthPlugin)
66
69
  .add([tablePlugin, { tableOptions: { allowColumnResizing: false } }]);
67
70
  editor = (doc: DocBuilder) =>
68
71
  createEditor<TablePluginState, PluginKey>({
@@ -51,6 +51,7 @@ describe('table plugin: decorations', () => {
51
51
  .add([featureFlagsPlugin, {}])
52
52
  .add([analyticsPlugin, {}])
53
53
  .add(contentInsertionPlugin)
54
+ .add(widthPlugin)
54
55
  .add(tablePlugin),
55
56
  pluginKey,
56
57
  });
@@ -19,6 +19,7 @@ import tablePlugin from '../../plugins/table-plugin';
19
19
  import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
20
20
  import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
21
21
  import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
22
+ import { widthPlugin } from '@atlaskit/editor-plugin-width';
22
23
 
23
24
  const TABLE_LOCAL_ID = 'test-table-local-id';
24
25
 
@@ -43,6 +44,7 @@ describe('fix tables', () => {
43
44
  .add([featureFlagsPlugin, {}])
44
45
  .add([analyticsPlugin, {}])
45
46
  .add(contentInsertionPlugin)
47
+ .add(widthPlugin)
46
48
  .add([tablePlugin, { tableOptions }]),
47
49
  pluginKey: tablePluginKey,
48
50
  });
@@ -21,6 +21,7 @@ import tablePlugin from '../../plugins/table-plugin';
21
21
  import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
22
22
  import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
23
23
  import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
24
+ import { widthPlugin } from '@atlaskit/editor-plugin-width';
24
25
 
25
26
  describe('table action handlers', () => {
26
27
  let editor: any;
@@ -32,6 +33,7 @@ describe('table action handlers', () => {
32
33
  .add([featureFlagsPlugin, {}])
33
34
  .add([analyticsPlugin, {}])
34
35
  .add(contentInsertionPlugin)
36
+ .add(widthPlugin)
35
37
  .add(tablePlugin);
36
38
 
37
39
  editor = (doc: DocBuilder) =>
@@ -34,6 +34,7 @@ import { PluginKey } from 'prosemirror-state';
34
34
  import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
35
35
  import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
36
36
  import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
37
+ import { widthPlugin } from '@atlaskit/editor-plugin-width';
37
38
 
38
39
  describe('table hover selection plugin', () => {
39
40
  const createEditor = createProsemirrorEditorFactory();
@@ -41,6 +42,7 @@ describe('table hover selection plugin', () => {
41
42
  .add([featureFlagsPlugin, {}])
42
43
  .add([analyticsPlugin, {}])
43
44
  .add(contentInsertionPlugin)
45
+ .add(widthPlugin)
44
46
  .add(tablePlugin);
45
47
 
46
48
  const editor = (doc: DocBuilder) =>