@atlaskit/editor-plugin-table 5.7.0 → 5.7.1

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,12 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 5.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#63516](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63516) [`8fdf2e7a3737`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8fdf2e7a3737) - [ux] Added an adjustment value to the guidelines visible filtering method to exclude guidelines which may be visible but are not snapable.
8
+ - Updated dependencies
9
+
3
10
  ## 5.7.0
4
11
 
5
12
  ### Minor Changes
@@ -79,7 +79,7 @@ var getResizerMinWidth = function getResizerMinWidth(node) {
79
79
  */
80
80
  var getVisibleGuidelines = function getVisibleGuidelines(guidelines, containerWidth) {
81
81
  return guidelines.filter(function (guideline) {
82
- return guideline.position && guideline.position.x !== undefined && typeof guideline.position.x === 'number' && Math.abs(guideline.position.x * 2) < containerWidth;
82
+ return guideline.position && guideline.position.x !== undefined && typeof guideline.position.x === 'number' && Math.abs(guideline.position.x * 2) < containerWidth + _consts.TABLE_GUIDELINE_VISIBLE_ADJUSTMENT;
83
83
  });
84
84
  };
85
85
  var TableResizer = exports.TableResizer = function TableResizer(_ref) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.tableToolbarSize = exports.tableToolbarSelectedColor = exports.tableToolbarDeleteColor = exports.tableToolbarColor = exports.tableTextColor = exports.tableScrollbarOffset = exports.tablePadding = exports.tableOverflowShadowWidthWide = exports.tableOverflowShadowWidth = exports.tableMarginFullWidthMode = exports.tableInsertColumnButtonSize = exports.tableInsertColumnButtonOffset = exports.tableHeaderCellBackgroundColor = exports.tableFloatingControlsColor = exports.tableDeleteButtonSize = exports.tableDeleteButtonOffset = exports.tableControlsSpacing = exports.tableCellSelectedDeleteIconColor = exports.tableCellSelectedDeleteIconBackground = exports.tableCellSelectedColor = exports.tableCellHoverDeleteIconColor = exports.tableCellHoverDeleteIconBackground = exports.tableCellDeleteColor = exports.tableCellBackgroundColor = exports.tableBorderSelectedColor = exports.tableBorderRadiusSize = exports.tableBorderDeleteColor = exports.tableBorderColor = exports.stickyRowZIndex = exports.stickyRowOffsetTop = exports.stickyHeaderBorderBottomWidth = exports.rowControlsZIndex = exports.resizeLineWidth = exports.resizeHandlerZIndex = exports.resizeHandlerAreaWidth = exports.lineMarkerSize = exports.lineMarkerOffsetFromColumnControls = exports.layoutButtonSize = exports.insertLineWidth = exports.dropTargetsZIndex = exports.dropTargetExtendedWidth = exports.dragTableInsertColumnButtonSize = exports.dragMenuDropdownWidth = exports.contextualMenuTriggerSize = exports.contextualMenuDropdownWidth = exports.columnResizeHandleZIndex = exports.columnControlsZIndex = exports.columnControlsSelectedZIndex = exports.columnControlsDecorationHeight = exports.TABLE_SNAP_GAP = exports.TABLE_HIGHLIGHT_TOLERANCE = exports.TABLE_HIGHLIGHT_GAP = exports.STICKY_HEADER_TOGGLE_TOLERANCE_MS = void 0;
6
+ exports.tableToolbarSize = exports.tableToolbarSelectedColor = exports.tableToolbarDeleteColor = exports.tableToolbarColor = exports.tableTextColor = exports.tableScrollbarOffset = exports.tablePadding = exports.tableOverflowShadowWidthWide = exports.tableOverflowShadowWidth = exports.tableMarginFullWidthMode = exports.tableInsertColumnButtonSize = exports.tableInsertColumnButtonOffset = exports.tableHeaderCellBackgroundColor = exports.tableFloatingControlsColor = exports.tableDeleteButtonSize = exports.tableDeleteButtonOffset = exports.tableControlsSpacing = exports.tableCellSelectedDeleteIconColor = exports.tableCellSelectedDeleteIconBackground = exports.tableCellSelectedColor = exports.tableCellHoverDeleteIconColor = exports.tableCellHoverDeleteIconBackground = exports.tableCellDeleteColor = exports.tableCellBackgroundColor = exports.tableBorderSelectedColor = exports.tableBorderRadiusSize = exports.tableBorderDeleteColor = exports.tableBorderColor = exports.stickyRowZIndex = exports.stickyRowOffsetTop = exports.stickyHeaderBorderBottomWidth = exports.rowControlsZIndex = exports.resizeLineWidth = exports.resizeHandlerZIndex = exports.resizeHandlerAreaWidth = exports.lineMarkerSize = exports.lineMarkerOffsetFromColumnControls = exports.layoutButtonSize = exports.insertLineWidth = exports.dropTargetsZIndex = exports.dropTargetExtendedWidth = exports.dragTableInsertColumnButtonSize = exports.dragMenuDropdownWidth = exports.contextualMenuTriggerSize = exports.contextualMenuDropdownWidth = exports.columnResizeHandleZIndex = exports.columnControlsZIndex = exports.columnControlsSelectedZIndex = exports.columnControlsDecorationHeight = exports.TABLE_SNAP_GAP = exports.TABLE_HIGHLIGHT_TOLERANCE = exports.TABLE_HIGHLIGHT_GAP = exports.TABLE_GUIDELINE_VISIBLE_ADJUSTMENT = exports.STICKY_HEADER_TOGGLE_TOLERANCE_MS = void 0;
7
7
  var _styles = require("@atlaskit/editor-common/styles");
8
8
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
9
9
  var _colors = require("@atlaskit/theme/colors");
@@ -65,6 +65,11 @@ var TABLE_SNAP_GAP = exports.TABLE_SNAP_GAP = 9;
65
65
  var TABLE_HIGHLIGHT_GAP = exports.TABLE_HIGHLIGHT_GAP = 10;
66
66
  var TABLE_HIGHLIGHT_TOLERANCE = exports.TABLE_HIGHLIGHT_TOLERANCE = 2;
67
67
  var STICKY_HEADER_TOGGLE_TOLERANCE_MS = exports.STICKY_HEADER_TOGGLE_TOLERANCE_MS = 5;
68
+ // This adjustment value represents a pixel amount by which the container width needs to be adjusted when determining
69
+ // which guidelines are visible and most importantly CAN BE snapped too within the view. This value can be affected by
70
+ // table margins and padding. For example a guideline at 1800px and the view at 1860px wide, means the guidelines is visible
71
+ // BUT it cannot be snapped to during resize due to padding being applied to the resizer wrapper. This accommodates that difference.
72
+ var TABLE_GUIDELINE_VISIBLE_ADJUSTMENT = exports.TABLE_GUIDELINE_VISIBLE_ADJUSTMENT = -68;
68
73
  var dragMenuDropdownWidth = exports.dragMenuDropdownWidth = 240;
69
74
  var dragTableInsertColumnButtonSize = exports.dragTableInsertColumnButtonSize = 16;
70
75
  var dropTargetExtendedWidth = exports.dropTargetExtendedWidth = 150;
@@ -14,7 +14,7 @@ import { getPluginState } from '../pm-plugins/plugin-factory';
14
14
  import { META_KEYS } from '../pm-plugins/table-analytics';
15
15
  import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable } from '../pm-plugins/table-resizing/utils';
16
16
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
17
- import { TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE, TABLE_SNAP_GAP } from '../ui/consts';
17
+ import { TABLE_GUIDELINE_VISIBLE_ADJUSTMENT, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE, TABLE_SNAP_GAP } from '../ui/consts';
18
18
  import { generateResizedPayload, generateResizeFrameRatePayloads, useMeasureFramerate } from '../utils/analytics';
19
19
  import { defaultGuidelines } from '../utils/guidelines';
20
20
  import { defaultSnappingWidths, findClosestSnap } from '../utils/snapping';
@@ -65,7 +65,7 @@ const getResizerMinWidth = node => {
65
65
  */
66
66
  const getVisibleGuidelines = (guidelines, containerWidth) => {
67
67
  return guidelines.filter(guideline => {
68
- return guideline.position && guideline.position.x !== undefined && typeof guideline.position.x === 'number' && Math.abs(guideline.position.x * 2) < containerWidth;
68
+ return guideline.position && guideline.position.x !== undefined && typeof guideline.position.x === 'number' && Math.abs(guideline.position.x * 2) < containerWidth + TABLE_GUIDELINE_VISIBLE_ADJUSTMENT;
69
69
  });
70
70
  };
71
71
  export const TableResizer = ({
@@ -60,6 +60,11 @@ export const TABLE_SNAP_GAP = 9;
60
60
  export const TABLE_HIGHLIGHT_GAP = 10;
61
61
  export const TABLE_HIGHLIGHT_TOLERANCE = 2;
62
62
  export const STICKY_HEADER_TOGGLE_TOLERANCE_MS = 5;
63
+ // This adjustment value represents a pixel amount by which the container width needs to be adjusted when determining
64
+ // which guidelines are visible and most importantly CAN BE snapped too within the view. This value can be affected by
65
+ // table margins and padding. For example a guideline at 1800px and the view at 1860px wide, means the guidelines is visible
66
+ // BUT it cannot be snapped to during resize due to padding being applied to the resizer wrapper. This accommodates that difference.
67
+ export const TABLE_GUIDELINE_VISIBLE_ADJUSTMENT = -68;
63
68
  export const dragMenuDropdownWidth = 240;
64
69
  export const dragTableInsertColumnButtonSize = 16;
65
70
  export const dropTargetExtendedWidth = 150;
@@ -18,7 +18,7 @@ import { getPluginState } from '../pm-plugins/plugin-factory';
18
18
  import { META_KEYS } from '../pm-plugins/table-analytics';
19
19
  import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable } from '../pm-plugins/table-resizing/utils';
20
20
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
21
- import { TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE, TABLE_SNAP_GAP } from '../ui/consts';
21
+ import { TABLE_GUIDELINE_VISIBLE_ADJUSTMENT, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE, TABLE_SNAP_GAP } from '../ui/consts';
22
22
  import { generateResizedPayload, generateResizeFrameRatePayloads, useMeasureFramerate } from '../utils/analytics';
23
23
  import { defaultGuidelines } from '../utils/guidelines';
24
24
  import { defaultSnappingWidths, findClosestSnap } from '../utils/snapping';
@@ -69,7 +69,7 @@ var getResizerMinWidth = function getResizerMinWidth(node) {
69
69
  */
70
70
  var getVisibleGuidelines = function getVisibleGuidelines(guidelines, containerWidth) {
71
71
  return guidelines.filter(function (guideline) {
72
- return guideline.position && guideline.position.x !== undefined && typeof guideline.position.x === 'number' && Math.abs(guideline.position.x * 2) < containerWidth;
72
+ return guideline.position && guideline.position.x !== undefined && typeof guideline.position.x === 'number' && Math.abs(guideline.position.x * 2) < containerWidth + TABLE_GUIDELINE_VISIBLE_ADJUSTMENT;
73
73
  });
74
74
  };
75
75
  export var TableResizer = function TableResizer(_ref) {
@@ -60,6 +60,11 @@ export var TABLE_SNAP_GAP = 9;
60
60
  export var TABLE_HIGHLIGHT_GAP = 10;
61
61
  export var TABLE_HIGHLIGHT_TOLERANCE = 2;
62
62
  export var STICKY_HEADER_TOGGLE_TOLERANCE_MS = 5;
63
+ // This adjustment value represents a pixel amount by which the container width needs to be adjusted when determining
64
+ // which guidelines are visible and most importantly CAN BE snapped too within the view. This value can be affected by
65
+ // table margins and padding. For example a guideline at 1800px and the view at 1860px wide, means the guidelines is visible
66
+ // BUT it cannot be snapped to during resize due to padding being applied to the resizer wrapper. This accommodates that difference.
67
+ export var TABLE_GUIDELINE_VISIBLE_ADJUSTMENT = -68;
63
68
  export var dragMenuDropdownWidth = 240;
64
69
  export var dragTableInsertColumnButtonSize = 16;
65
70
  export var dropTargetExtendedWidth = 150;
@@ -51,6 +51,7 @@ export declare const TABLE_SNAP_GAP = 9;
51
51
  export declare const TABLE_HIGHLIGHT_GAP = 10;
52
52
  export declare const TABLE_HIGHLIGHT_TOLERANCE = 2;
53
53
  export declare const STICKY_HEADER_TOGGLE_TOLERANCE_MS = 5;
54
+ export declare const TABLE_GUIDELINE_VISIBLE_ADJUSTMENT = -68;
54
55
  export declare const dragMenuDropdownWidth = 240;
55
56
  export declare const dragTableInsertColumnButtonSize = 16;
56
57
  export declare const dropTargetExtendedWidth = 150;
@@ -51,6 +51,7 @@ export declare const TABLE_SNAP_GAP = 9;
51
51
  export declare const TABLE_HIGHLIGHT_GAP = 10;
52
52
  export declare const TABLE_HIGHLIGHT_TOLERANCE = 2;
53
53
  export declare const STICKY_HEADER_TOGGLE_TOLERANCE_MS = 5;
54
+ export declare const TABLE_GUIDELINE_VISIBLE_ADJUSTMENT = -68;
54
55
  export declare const dragMenuDropdownWidth = 240;
55
56
  export declare const dragTableInsertColumnButtonSize = 16;
56
57
  export declare const dropTargetExtendedWidth = 150;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "5.7.0",
3
+ "version": "5.7.1",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -47,7 +47,7 @@
47
47
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.12.0",
48
48
  "@atlaskit/primitives": "^1.15.0",
49
49
  "@atlaskit/theme": "^12.6.0",
50
- "@atlaskit/tokens": "^1.31.0",
50
+ "@atlaskit/tokens": "^1.32.0",
51
51
  "@atlaskit/tooltip": "^18.1.0",
52
52
  "@babel/runtime": "^7.0.0",
53
53
  "@emotion/react": "^11.7.1",
@@ -41,6 +41,7 @@ import {
41
41
  } from '../pm-plugins/table-resizing/utils';
42
42
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
43
43
  import {
44
+ TABLE_GUIDELINE_VISIBLE_ADJUSTMENT,
44
45
  TABLE_HIGHLIGHT_GAP,
45
46
  TABLE_HIGHLIGHT_TOLERANCE,
46
47
  TABLE_SNAP_GAP,
@@ -140,7 +141,8 @@ const getVisibleGuidelines = (
140
141
  guideline.position &&
141
142
  guideline.position.x !== undefined &&
142
143
  typeof guideline.position.x === 'number' &&
143
- Math.abs(guideline.position.x * 2) < containerWidth
144
+ Math.abs(guideline.position.x * 2) <
145
+ containerWidth + TABLE_GUIDELINE_VISIBLE_ADJUSTMENT
144
146
  );
145
147
  });
146
148
  };
package/src/ui/consts.ts CHANGED
@@ -131,6 +131,11 @@ export const TABLE_SNAP_GAP = 9;
131
131
  export const TABLE_HIGHLIGHT_GAP = 10;
132
132
  export const TABLE_HIGHLIGHT_TOLERANCE = 2;
133
133
  export const STICKY_HEADER_TOGGLE_TOLERANCE_MS = 5;
134
+ // This adjustment value represents a pixel amount by which the container width needs to be adjusted when determining
135
+ // which guidelines are visible and most importantly CAN BE snapped too within the view. This value can be affected by
136
+ // table margins and padding. For example a guideline at 1800px and the view at 1860px wide, means the guidelines is visible
137
+ // BUT it cannot be snapped to during resize due to padding being applied to the resizer wrapper. This accommodates that difference.
138
+ export const TABLE_GUIDELINE_VISIBLE_ADJUSTMENT = -68;
134
139
 
135
140
  export const dragMenuDropdownWidth = 240;
136
141
  export const dragTableInsertColumnButtonSize = 16;