@atlaskit/editor-plugin-table 5.4.22 → 5.4.24

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
+ ## 5.4.24
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 5.4.23
10
+
11
+ ### Patch Changes
12
+
13
+ - [#59370](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/59370) [`eb7463620368`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/eb7463620368) - [ux] ED-21355:When table drag and drop enable not show cell options on table toolbar.
14
+
3
15
  ## 5.4.22
4
16
 
5
17
  ### Patch Changes
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.getToolbarMenuConfig = exports.getToolbarConfig = exports.getToolbarCellOptionsConfig = exports.getClosestSelectionRect = void 0;
9
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
10
  var _react = require("@emotion/react");
10
11
  var _customSteps = require("@atlaskit/custom-steps");
11
12
  var _analytics = require("@atlaskit/editor-common/analytics");
@@ -281,7 +282,8 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
281
282
  if (tableObject && pluginState.editorHasFocus && !isWidthResizing) {
282
283
  var nodeType = state.schema.nodes.table;
283
284
  var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
284
- var cellItems = getCellItems(config, state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI);
285
+ var cellItems;
286
+ cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(config, state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI);
285
287
  var colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI);
286
288
 
287
289
  // Check if we need to show confirm dialog for delete button
@@ -332,7 +334,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
332
334
  },
333
335
  zIndex: _editorSharedStyles.akEditorFloatingPanelZIndex + 1,
334
336
  // Place the context menu slightly above the others
335
- items: [menu, separator(menu.hidden)].concat(cellItems, colorPicker, [{
337
+ items: [menu, separator(menu.hidden)].concat((0, _toConsumableArray2.default)(cellItems), colorPicker, [{
336
338
  type: 'extensions-placeholder',
337
339
  separator: 'end'
338
340
  }, {
@@ -271,7 +271,8 @@ export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, ge
271
271
  if (tableObject && pluginState.editorHasFocus && !isWidthResizing) {
272
272
  const nodeType = state.schema.nodes.table;
273
273
  const menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
274
- const cellItems = getCellItems(config, state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI);
274
+ let cellItems;
275
+ cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(config, state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI);
275
276
  const colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI);
276
277
 
277
278
  // Check if we need to show confirm dialog for delete button
@@ -1,3 +1,4 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  /** @jsx jsx */
2
3
  import { jsx } from '@emotion/react';
3
4
  import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
@@ -270,7 +271,8 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
270
271
  if (tableObject && pluginState.editorHasFocus && !isWidthResizing) {
271
272
  var nodeType = state.schema.nodes.table;
272
273
  var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
273
- var cellItems = getCellItems(config, state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI);
274
+ var cellItems;
275
+ cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(config, state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI);
274
276
  var colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI);
275
277
 
276
278
  // Check if we need to show confirm dialog for delete button
@@ -321,7 +323,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
321
323
  },
322
324
  zIndex: akEditorFloatingPanelZIndex + 1,
323
325
  // Place the context menu slightly above the others
324
- items: [menu, separator(menu.hidden)].concat(cellItems, colorPicker, [{
326
+ items: [menu, separator(menu.hidden)].concat(_toConsumableArray(cellItems), colorPicker, [{
325
327
  type: 'extensions-placeholder',
326
328
  separator: 'end'
327
329
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "5.4.22",
3
+ "version": "5.4.24",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,9 +29,9 @@
29
29
  "dependencies": {
30
30
  "@atlaskit/adf-schema": "^35.0.0",
31
31
  "@atlaskit/custom-steps": "^0.0.7",
32
- "@atlaskit/editor-common": "^76.25.0",
32
+ "@atlaskit/editor-common": "^76.26.0",
33
33
  "@atlaskit/editor-palette": "1.5.2",
34
- "@atlaskit/editor-plugin-analytics": "^0.3.0",
34
+ "@atlaskit/editor-plugin-analytics": "^0.4.0",
35
35
  "@atlaskit/editor-plugin-content-insertion": "^0.1.0",
36
36
  "@atlaskit/editor-plugin-guideline": "^0.5.0",
37
37
  "@atlaskit/editor-plugin-selection": "^0.1.0",
@@ -1,5 +1,5 @@
1
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import type { DocBuilder } from '@atlaskit/editor-common/types';
4
4
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
5
5
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
@@ -71,6 +71,7 @@ const analyticsPluginFake = () => ({
71
71
  name: 'analytics',
72
72
  actions: {
73
73
  attachAnalyticsEvent: mockAttachPayload.mockImplementation(() => () => {}),
74
+ fireAnalyticsEvent: jest.fn(),
74
75
  },
75
76
  });
76
77
 
@@ -81,6 +82,7 @@ describe('Table analytic events', () => {
81
82
  beforeEach(() => {
82
83
  editorAnalyticsAPIFake = {
83
84
  attachAnalyticsEvent: analyticFireMock,
85
+ fireAnalyticsEvent: jest.fn(),
84
86
  };
85
87
  });
86
88
 
@@ -38,6 +38,7 @@ const tdNextFocus = td()(p('{nextFocus}'));
38
38
  describe('table plugin: goToNextCell', () => {
39
39
  const editorAnalyticsAPIFake: EditorAnalyticsAPI = {
40
40
  attachAnalyticsEvent: jest.fn().mockReturnValue(() => jest.fn()),
41
+ fireAnalyticsEvent: jest.fn(),
41
42
  };
42
43
  const createEditor = createProsemirrorEditorFactory();
43
44
  const preset = new Preset<LightEditorPlugin>()
@@ -327,6 +327,7 @@ describe('table plugin: actions', () => {
327
327
  describe('#handleCut', () => {
328
328
  const editorAnalyticsAPIFake: EditorAnalyticsAPI = {
329
329
  attachAnalyticsEvent: jest.fn().mockReturnValue(() => jest.fn()),
330
+ fireAnalyticsEvent: jest.fn(),
330
331
  };
331
332
 
332
333
  describe('when the entire table is selected', () => {
@@ -42,6 +42,7 @@ describe('getToolbarConfig', () => {
42
42
  const getEditorContainerWidth = () => ({ width: 500 });
43
43
  const editorAnalyticsAPIFake: EditorAnalyticsAPI = {
44
44
  attachAnalyticsEvent: jest.fn().mockReturnValue(() => jest.fn()),
45
+ fireAnalyticsEvent: jest.fn(),
45
46
  };
46
47
  const getEditorFeatureFlags: GetEditorFeatureFlags = jest
47
48
  .fn()
@@ -376,6 +376,7 @@ describe('table local id plugin', () => {
376
376
 
377
377
  const editorAnalyticsAPIFake: EditorAnalyticsAPI = {
378
378
  attachAnalyticsEvent: jest.fn().mockReturnValue(() => jest.fn()),
379
+ fireAnalyticsEvent: jest.fn(),
379
380
  };
380
381
 
381
382
  const {
@@ -426,14 +426,17 @@ export const getToolbarConfig =
426
426
  editorAnalyticsAPI,
427
427
  );
428
428
 
429
- const cellItems = getCellItems(
430
- config,
431
- state,
432
- getEditorView(),
433
- intl,
434
- getEditorContainerWidth,
435
- editorAnalyticsAPI,
436
- );
429
+ let cellItems: Array<FloatingToolbarItem<Command>>;
430
+ cellItems = pluginState.isDragAndDropEnabled
431
+ ? []
432
+ : getCellItems(
433
+ config,
434
+ state,
435
+ getEditorView(),
436
+ intl,
437
+ getEditorContainerWidth,
438
+ editorAnalyticsAPI,
439
+ );
437
440
  const colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI);
438
441
 
439
442
  // Check if we need to show confirm dialog for delete button
@@ -486,7 +489,6 @@ export const getToolbarConfig =
486
489
 
487
490
  return element;
488
491
  };
489
-
490
492
  return {
491
493
  title: 'Table floating controls',
492
494
  getDomRef,