@atlaskit/editor-plugin-table 8.2.0 → 8.2.2

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,23 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 8.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#170442](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/170442)
8
+ [`14b1ff1b28958`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/14b1ff1b28958) -
9
+ ED-25803 Update to not pass mountPoint into dropdown menu popup so that dropdown menu will be
10
+ nested inside DragMenu pop up
11
+
12
+ ## 8.2.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [#169304](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/169304)
17
+ [`305b55f6ac586`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/305b55f6ac586) -
18
+ Set alignment to center for tables during resizing, this fixes issues with tables in comment
19
+ editor where the width attribute defaults to inherit even if a table has been resized
20
+
3
21
  ## 8.2.0
4
22
 
5
23
  ### Minor Changes
@@ -22,6 +22,7 @@ var _resizer = require("@atlaskit/editor-common/resizer");
22
22
  var _commands = require("@atlaskit/editor-prosemirror/commands");
23
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
24
24
  var _utils = require("@atlaskit/editor-tables/utils");
25
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
25
26
  var _commandsWithAnalytics = require("../commands-with-analytics");
26
27
  var _misc = require("../commands/misc");
27
28
  var _tableAnalytics = require("../pm-plugins/table-analytics");
@@ -322,9 +323,16 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
322
323
  }
323
324
  if (typeof pos === 'number') {
324
325
  var _attachAnalyticsEvent2;
325
- tr = tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node.attrs), {}, {
326
- width: newWidth
327
- }));
326
+ if ((0, _platformFeatureFlags.fg)('platform_editor_set_alignment_when_resized')) {
327
+ tr = tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node.attrs), {}, {
328
+ width: newWidth,
329
+ layout: node.attrs.layout !== _alignment.ALIGN_START && node.attrs.layout !== _alignment.ALIGN_CENTER ? _alignment.ALIGN_CENTER : node.attrs.layout
330
+ }));
331
+ } else {
332
+ tr = tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node.attrs), {}, {
333
+ width: newWidth
334
+ }));
335
+ }
328
336
  var newNode = tr.doc.nodeAt(pos);
329
337
  tr = (0, _utils2.scaleTable)(tableRef, {
330
338
  node: newNode,
@@ -363,7 +371,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
363
371
  onResizeStop();
364
372
  }
365
373
  return newWidth;
366
- }, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, isTableScalingEnabled, shouldUseIncreasedScalingPercent, widthToWidest, formatMessage, pluginInjectionApi, isCommentEditor]);
374
+ }, [editorView, getPos, node, isCommentEditor, widthToWidest, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, attachAnalyticsEvent, tableRef, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage]);
367
375
  var handleTableSizeChangeOnKeypress = (0, _react.useCallback)(function (step) {
368
376
  var newWidth = width + step;
369
377
  if (newWidth > maxWidth || newWidth < resizerMinWidth) {
@@ -23,6 +23,7 @@ var _tableMap = require("@atlaskit/editor-tables/table-map");
23
23
  var _utils2 = require("@atlaskit/editor-tables/utils");
24
24
  var _paintBucketEditorBackgroundColor = _interopRequireDefault(require("@atlaskit/icon/core/migration/paint-bucket--editor-background-color"));
25
25
  var _paintBucket = _interopRequireDefault(require("@atlaskit/icon/core/paint-bucket"));
26
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
27
  var _primitives = require("@atlaskit/primitives");
27
28
  var _toggle = _interopRequireDefault(require("@atlaskit/toggle"));
28
29
  var _commands = require("../../commands");
@@ -506,7 +507,7 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
506
507
  fitHeight: fitHeight,
507
508
  fitWidth: fitWidth,
508
509
  direction: direction,
509
- mountPoint: mountPoint,
510
+ mountPoint: (0, _platformFeatureFlags.fg)('platform_editor_table_drag_menu_mount_point_fix') ? undefined : mountPoint,
510
511
  boundariesElement: boundariesElement,
511
512
  scrollableElement: scrollableElement
512
513
  });
@@ -12,6 +12,7 @@ import { ResizerNext } from '@atlaskit/editor-common/resizer';
12
12
  import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
13
13
  import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
14
14
  import { findTable } from '@atlaskit/editor-tables/utils';
15
+ import { fg } from '@atlaskit/platform-feature-flags';
15
16
  import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../commands-with-analytics';
16
17
  import { updateWidthToWidest } from '../commands/misc';
17
18
  import { META_KEYS } from '../pm-plugins/table-analytics';
@@ -317,10 +318,18 @@ export const TableResizer = ({
317
318
  }
318
319
  if (typeof pos === 'number') {
319
320
  var _attachAnalyticsEvent2;
320
- tr = tr.setNodeMarkup(pos, undefined, {
321
- ...node.attrs,
322
- width: newWidth
323
- });
321
+ if (fg('platform_editor_set_alignment_when_resized')) {
322
+ tr = tr.setNodeMarkup(pos, undefined, {
323
+ ...node.attrs,
324
+ width: newWidth,
325
+ layout: node.attrs.layout !== ALIGN_START && node.attrs.layout !== ALIGN_CENTER ? ALIGN_CENTER : node.attrs.layout
326
+ });
327
+ } else {
328
+ tr = tr.setNodeMarkup(pos, undefined, {
329
+ ...node.attrs,
330
+ width: newWidth
331
+ });
332
+ }
324
333
  const newNode = tr.doc.nodeAt(pos);
325
334
  tr = scaleTable(tableRef, {
326
335
  node: newNode,
@@ -359,7 +368,7 @@ export const TableResizer = ({
359
368
  onResizeStop();
360
369
  }
361
370
  return newWidth;
362
- }, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, isTableScalingEnabled, shouldUseIncreasedScalingPercent, widthToWidest, formatMessage, pluginInjectionApi, isCommentEditor]);
371
+ }, [editorView, getPos, node, isCommentEditor, widthToWidest, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, attachAnalyticsEvent, tableRef, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage]);
363
372
  const handleTableSizeChangeOnKeypress = useCallback(step => {
364
373
  const newWidth = width + step;
365
374
  if (newWidth > maxWidth || newWidth < resizerMinWidth) {
@@ -21,6 +21,7 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
21
21
  import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
22
22
  import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
23
23
  import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
24
+ import { fg } from '@atlaskit/platform-feature-flags';
24
25
  import { Box, xcss } from '@atlaskit/primitives';
25
26
  import Toggle from '@atlaskit/toggle';
26
27
  import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
@@ -505,7 +506,7 @@ const DragMenu = /*#__PURE__*/React.memo(({
505
506
  fitHeight: fitHeight,
506
507
  fitWidth: fitWidth,
507
508
  direction: direction,
508
- mountPoint: mountPoint,
509
+ mountPoint: fg('platform_editor_table_drag_menu_mount_point_fix') ? undefined : mountPoint,
509
510
  boundariesElement: boundariesElement,
510
511
  scrollableElement: scrollableElement
511
512
  });
@@ -16,6 +16,7 @@ import { ResizerNext } from '@atlaskit/editor-common/resizer';
16
16
  import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
17
17
  import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
18
18
  import { findTable } from '@atlaskit/editor-tables/utils';
19
+ import { fg } from '@atlaskit/platform-feature-flags';
19
20
  import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../commands-with-analytics';
20
21
  import { updateWidthToWidest } from '../commands/misc';
21
22
  import { META_KEYS } from '../pm-plugins/table-analytics';
@@ -312,9 +313,16 @@ export var TableResizer = function TableResizer(_ref) {
312
313
  }
313
314
  if (typeof pos === 'number') {
314
315
  var _attachAnalyticsEvent2;
315
- tr = tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node.attrs), {}, {
316
- width: newWidth
317
- }));
316
+ if (fg('platform_editor_set_alignment_when_resized')) {
317
+ tr = tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node.attrs), {}, {
318
+ width: newWidth,
319
+ layout: node.attrs.layout !== ALIGN_START && node.attrs.layout !== ALIGN_CENTER ? ALIGN_CENTER : node.attrs.layout
320
+ }));
321
+ } else {
322
+ tr = tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, node.attrs), {}, {
323
+ width: newWidth
324
+ }));
325
+ }
318
326
  var newNode = tr.doc.nodeAt(pos);
319
327
  tr = scaleTable(tableRef, {
320
328
  node: newNode,
@@ -353,7 +361,7 @@ export var TableResizer = function TableResizer(_ref) {
353
361
  onResizeStop();
354
362
  }
355
363
  return newWidth;
356
- }, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, isTableScalingEnabled, shouldUseIncreasedScalingPercent, widthToWidest, formatMessage, pluginInjectionApi, isCommentEditor]);
364
+ }, [editorView, getPos, node, isCommentEditor, widthToWidest, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, attachAnalyticsEvent, tableRef, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage]);
357
365
  var handleTableSizeChangeOnKeypress = useCallback(function (step) {
358
366
  var newWidth = width + step;
359
367
  if (newWidth > maxWidth || newWidth < resizerMinWidth) {
@@ -23,6 +23,7 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
23
23
  import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
24
24
  import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
25
25
  import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
26
+ import { fg } from '@atlaskit/platform-feature-flags';
26
27
  import { Box, xcss } from '@atlaskit/primitives';
27
28
  import Toggle from '@atlaskit/toggle';
28
29
  import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
@@ -495,7 +496,7 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
495
496
  fitHeight: fitHeight,
496
497
  fitWidth: fitWidth,
497
498
  direction: direction,
498
- mountPoint: mountPoint,
499
+ mountPoint: fg('platform_editor_table_drag_menu_mount_point_fix') ? undefined : mountPoint,
499
500
  boundariesElement: boundariesElement,
500
501
  scrollableElement: scrollableElement
501
502
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "8.2.0",
3
+ "version": "8.2.2",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,7 +30,7 @@
30
30
  "@atlaskit/adf-schema": "^46.1.0",
31
31
  "@atlaskit/button": "^20.3.0",
32
32
  "@atlaskit/custom-steps": "^0.9.0",
33
- "@atlaskit/editor-common": "^95.8.0",
33
+ "@atlaskit/editor-common": "^95.10.0",
34
34
  "@atlaskit/editor-palette": "1.6.3",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
@@ -40,10 +40,10 @@
40
40
  "@atlaskit/editor-plugin-guideline": "^1.2.0",
41
41
  "@atlaskit/editor-plugin-selection": "^1.5.0",
42
42
  "@atlaskit/editor-plugin-width": "^1.3.0",
43
- "@atlaskit/editor-prosemirror": "6.0.0",
43
+ "@atlaskit/editor-prosemirror": "6.2.1",
44
44
  "@atlaskit/editor-shared-styles": "^3.2.0",
45
45
  "@atlaskit/editor-tables": "^2.8.0",
46
- "@atlaskit/icon": "^22.26.0",
46
+ "@atlaskit/icon": "^22.28.0",
47
47
  "@atlaskit/menu": "^2.13.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
49
  "@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/theme": "^14.0.0",
54
54
  "@atlaskit/tmp-editor-statsig": "^2.21.0",
55
55
  "@atlaskit/toggle": "^13.4.0",
56
- "@atlaskit/tokens": "^2.3.0",
56
+ "@atlaskit/tokens": "^2.4.0",
57
57
  "@atlaskit/tooltip": "^18.9.0",
58
58
  "@babel/runtime": "^7.0.0",
59
59
  "@emotion/react": "^11.7.1",
@@ -124,6 +124,12 @@
124
124
  },
125
125
  "platform_editor_use_nested_table_pm_nodes": {
126
126
  "type": "boolean"
127
+ },
128
+ "platform_editor_set_alignment_when_resized": {
129
+ "type": "boolean"
130
+ },
131
+ "platform_editor_table_drag_menu_mount_point_fix": {
132
+ "type": "boolean"
127
133
  }
128
134
  }
129
135
  }
@@ -25,6 +25,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
25
25
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
26
26
  import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
27
27
  import { findTable } from '@atlaskit/editor-tables/utils';
28
+ import { fg } from '@atlaskit/platform-feature-flags';
28
29
  import { token } from '@atlaskit/tokens';
29
30
 
30
31
  import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../commands-with-analytics';
@@ -574,10 +575,21 @@ export const TableResizer = ({
574
575
  }
575
576
 
576
577
  if (typeof pos === 'number') {
577
- tr = tr.setNodeMarkup(pos, undefined, {
578
- ...node.attrs,
579
- width: newWidth,
580
- });
578
+ if (fg('platform_editor_set_alignment_when_resized')) {
579
+ tr = tr.setNodeMarkup(pos, undefined, {
580
+ ...node.attrs,
581
+ width: newWidth,
582
+ layout:
583
+ node.attrs.layout !== ALIGN_START && node.attrs.layout !== ALIGN_CENTER
584
+ ? ALIGN_CENTER
585
+ : node.attrs.layout,
586
+ });
587
+ } else {
588
+ tr = tr.setNodeMarkup(pos, undefined, {
589
+ ...node.attrs,
590
+ width: newWidth,
591
+ });
592
+ }
581
593
 
582
594
  const newNode = tr.doc.nodeAt(pos)!;
583
595
  tr = scaleTable(
@@ -636,23 +648,23 @@ export const TableResizer = ({
636
648
  return newWidth;
637
649
  },
638
650
  [
639
- displayGapCursor,
640
- updateWidth,
641
651
  editorView,
642
652
  getPos,
643
653
  node,
644
- tableRef,
645
- scheduleResize,
646
- displayGuideline,
647
- attachAnalyticsEvent,
654
+ isCommentEditor,
655
+ widthToWidest,
648
656
  endMeasure,
657
+ displayGapCursor,
658
+ displayGuideline,
659
+ updateWidth,
660
+ scheduleResize,
649
661
  onResizeStop,
662
+ attachAnalyticsEvent,
663
+ tableRef,
664
+ pluginInjectionApi,
650
665
  isTableScalingEnabled,
651
666
  shouldUseIncreasedScalingPercent,
652
- widthToWidest,
653
667
  formatMessage,
654
- pluginInjectionApi,
655
- isCommentEditor,
656
668
  ],
657
669
  );
658
670
 
@@ -43,6 +43,7 @@ import {
43
43
  } from '@atlaskit/editor-tables/utils';
44
44
  import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
45
45
  import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
46
+ import { fg } from '@atlaskit/platform-feature-flags';
46
47
  import { Box, xcss } from '@atlaskit/primitives';
47
48
  import Toggle from '@atlaskit/toggle';
48
49
 
@@ -628,7 +629,7 @@ const DragMenu = React.memo(
628
629
  fitHeight={fitHeight}
629
630
  fitWidth={fitWidth}
630
631
  direction={direction}
631
- mountPoint={mountPoint}
632
+ mountPoint={fg('platform_editor_table_drag_menu_mount_point_fix') ? undefined : mountPoint}
632
633
  boundariesElement={boundariesElement}
633
634
  scrollableElement={scrollableElement}
634
635
  />