@atlaskit/editor-common 96.5.4 → 96.5.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,24 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 96.5.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#180440](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/180440)
8
+ [`054eb933bb538`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/054eb933bb538) -
9
+ Add platform_editor_table_row_span_fix FG, which will scan the entire table to determine how many
10
+ columns it has instead of relying on the first row. This fixes a bug where a table is not
11
+ 'resized' and has merged cells in the first row, and will return the wrong number of columns.
12
+
13
+ ## 96.5.5
14
+
15
+ ### Patch Changes
16
+
17
+ - [#179495](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/179495)
18
+ [`5df4aaaa16713`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5df4aaaa16713) -
19
+ [ux] Fixed resizing issue when layout is stacked on a narrow screen and resizer item gets
20
+ min-width bigger than max-width.
21
+
3
22
  ## 96.5.4
4
23
 
5
24
  ### Patch Changes
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "96.5.4";
20
+ var packageVersion = "96.5.6";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // TODO: Sanitise the URL instead of just removing it
@@ -9,6 +9,7 @@ exports.ignoreResizerMutations = exports.BreakoutResizer = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
13
14
  var _analytics = require("../analytics");
14
15
  var _styles = require("../styles");
@@ -47,7 +48,17 @@ var getHandleStyle = function getHandleStyle(node) {
47
48
  }
48
49
  };
49
50
  var ignoreResizerMutations = exports.ignoreResizerMutations = function ignoreResizerMutations(mutation) {
50
- return mutation.target.classList.contains('resizer-item') || mutation.type === 'attributes' && mutation.attributeName === 'style';
51
+ if ((0, _platformFeatureFlags.fg)('platform_editor_breakoutresizer_remove_assertion')) {
52
+ if (mutation.target instanceof Element) {
53
+ return mutation.target.classList.contains('resizer-item') || mutation.type === 'attributes' && mutation.attributeName === 'style';
54
+ }
55
+ return mutation.type === 'attributes' && mutation.attributeName === 'style';
56
+ } else {
57
+ return (
58
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
59
+ mutation.target.classList.contains('resizer-item') || mutation.type === 'attributes' && mutation.attributeName === 'style'
60
+ );
61
+ }
51
62
  };
52
63
  var resizingStyles = {
53
64
  left: '50%',
@@ -113,8 +124,12 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
113
124
  state = editorView.state;
114
125
  displayGapCursor(false);
115
126
  if (widthState !== undefined && widthState.lineLength !== undefined && widthState.width !== undefined) {
116
- newMinWidth = Math.min(widthState.lineLength, _editorSharedStyles.akEditorDefaultLayoutWidth);
117
127
  newMaxWidth = Math.min(widthState.width - (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2 - _editorSharedStyles.akEditorGutterPadding, _editorSharedStyles.akEditorFullWidthLayoutWidth);
128
+ if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_2')) {
129
+ newMinWidth = Math.min(widthState.lineLength, _editorSharedStyles.akEditorDefaultLayoutWidth, newMaxWidth);
130
+ } else {
131
+ newMinWidth = Math.min(widthState.lineLength, _editorSharedStyles.akEditorDefaultLayoutWidth);
132
+ }
118
133
  }
119
134
  setResizingState({
120
135
  isResizing: true,
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
23
23
  * @jsx jsx
24
24
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "96.5.4";
26
+ var packageVersion = "96.5.6";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  var DropList = /*#__PURE__*/function (_Component) {
@@ -9,7 +9,30 @@ exports.convertProsemirrorTableNodeToArrayOfRows = convertProsemirrorTableNodeTo
9
9
  exports.hasMergedCell = hasMergedCell;
10
10
  exports.isPositionNearTableRow = isPositionNearTableRow;
11
11
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  function calcTableColumnWidths(node) {
14
+ if ((0, _platformFeatureFlags.fg)('platform_editor_table_row_span_fix')) {
15
+ var _firstRow = node.firstChild;
16
+ var _tableColumnWidths = [];
17
+ if (_firstRow) {
18
+ _firstRow.forEach(function (cell) {
19
+ var _cell$attrs = cell.attrs,
20
+ colspan = _cell$attrs.colspan,
21
+ colwidth = _cell$attrs.colwidth;
22
+ // column has been resized, colWidth will be an array, can safely take values even if cell is merged
23
+ if (Array.isArray(colwidth)) {
24
+ _tableColumnWidths.push.apply(_tableColumnWidths, (0, _toConsumableArray2.default)(colwidth));
25
+ // table has merged cells but no colWidth, so columns haven't been resized, default to 0
26
+ } else if (colspan > 1) {
27
+ _tableColumnWidths.push.apply(_tableColumnWidths, (0, _toConsumableArray2.default)(Array(colspan).fill(0)));
28
+ // no merged cells, no column resized, default to 0
29
+ } else {
30
+ _tableColumnWidths.push(0);
31
+ }
32
+ });
33
+ }
34
+ return _tableColumnWidths;
35
+ }
13
36
  var tableColumnWidths = [];
14
37
  var firstRow = node.firstChild;
15
38
  if (firstRow) {
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "96.5.4";
4
+ const packageVersion = "96.5.6";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // TODO: Sanitise the URL instead of just removing it
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
2
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
5
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
5
6
  import { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN } from '../styles';
@@ -36,7 +37,17 @@ const getHandleStyle = node => {
36
37
  }
37
38
  };
38
39
  export const ignoreResizerMutations = mutation => {
39
- return mutation.target.classList.contains('resizer-item') || mutation.type === 'attributes' && mutation.attributeName === 'style';
40
+ if (fg('platform_editor_breakoutresizer_remove_assertion')) {
41
+ if (mutation.target instanceof Element) {
42
+ return mutation.target.classList.contains('resizer-item') || mutation.type === 'attributes' && mutation.attributeName === 'style';
43
+ }
44
+ return mutation.type === 'attributes' && mutation.attributeName === 'style';
45
+ } else {
46
+ return (
47
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
48
+ mutation.target.classList.contains('resizer-item') || mutation.type === 'attributes' && mutation.attributeName === 'style'
49
+ );
50
+ }
40
51
  };
41
52
  const resizingStyles = {
42
53
  left: '50%',
@@ -104,8 +115,12 @@ const BreakoutResizer = ({
104
115
  } = editorView;
105
116
  displayGapCursor(false);
106
117
  if (widthState !== undefined && widthState.lineLength !== undefined && widthState.width !== undefined) {
107
- newMinWidth = Math.min(widthState.lineLength, akEditorDefaultLayoutWidth);
108
118
  newMaxWidth = Math.min(widthState.width - akEditorGutterPaddingDynamic() * 2 - akEditorGutterPadding, akEditorFullWidthLayoutWidth);
119
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_2')) {
120
+ newMinWidth = Math.min(widthState.lineLength, akEditorDefaultLayoutWidth, newMaxWidth);
121
+ } else {
122
+ newMinWidth = Math.min(widthState.lineLength, akEditorDefaultLayoutWidth);
123
+ }
109
124
  }
110
125
  setResizingState({
111
126
  isResizing: true,
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "96.5.4";
16
+ const packageVersion = "96.5.6";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -1,4 +1,28 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  export function calcTableColumnWidths(node) {
3
+ if (fg('platform_editor_table_row_span_fix')) {
4
+ const firstRow = node.firstChild;
5
+ let tableColumnWidths = [];
6
+ if (firstRow) {
7
+ firstRow.forEach(cell => {
8
+ const {
9
+ colspan,
10
+ colwidth
11
+ } = cell.attrs;
12
+ // column has been resized, colWidth will be an array, can safely take values even if cell is merged
13
+ if (Array.isArray(colwidth)) {
14
+ tableColumnWidths.push(...colwidth);
15
+ // table has merged cells but no colWidth, so columns haven't been resized, default to 0
16
+ } else if (colspan > 1) {
17
+ tableColumnWidths.push(...Array(colspan).fill(0));
18
+ // no merged cells, no column resized, default to 0
19
+ } else {
20
+ tableColumnWidths.push(0);
21
+ }
22
+ });
23
+ }
24
+ return tableColumnWidths;
25
+ }
2
26
  let tableColumnWidths = [];
3
27
  const firstRow = node.firstChild;
4
28
  if (firstRow) {
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "96.5.4";
10
+ var packageVersion = "96.5.6";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // TODO: Sanitise the URL instead of just removing it
@@ -1,6 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
3
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
6
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
6
7
  import { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN } from '../styles';
@@ -37,7 +38,17 @@ var getHandleStyle = function getHandleStyle(node) {
37
38
  }
38
39
  };
39
40
  export var ignoreResizerMutations = function ignoreResizerMutations(mutation) {
40
- return mutation.target.classList.contains('resizer-item') || mutation.type === 'attributes' && mutation.attributeName === 'style';
41
+ if (fg('platform_editor_breakoutresizer_remove_assertion')) {
42
+ if (mutation.target instanceof Element) {
43
+ return mutation.target.classList.contains('resizer-item') || mutation.type === 'attributes' && mutation.attributeName === 'style';
44
+ }
45
+ return mutation.type === 'attributes' && mutation.attributeName === 'style';
46
+ } else {
47
+ return (
48
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
49
+ mutation.target.classList.contains('resizer-item') || mutation.type === 'attributes' && mutation.attributeName === 'style'
50
+ );
51
+ }
41
52
  };
42
53
  var resizingStyles = {
43
54
  left: '50%',
@@ -103,8 +114,12 @@ var BreakoutResizer = function BreakoutResizer(_ref) {
103
114
  state = editorView.state;
104
115
  displayGapCursor(false);
105
116
  if (widthState !== undefined && widthState.lineLength !== undefined && widthState.width !== undefined) {
106
- newMinWidth = Math.min(widthState.lineLength, akEditorDefaultLayoutWidth);
107
117
  newMaxWidth = Math.min(widthState.width - akEditorGutterPaddingDynamic() * 2 - akEditorGutterPadding, akEditorFullWidthLayoutWidth);
118
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_2')) {
119
+ newMinWidth = Math.min(widthState.lineLength, akEditorDefaultLayoutWidth, newMaxWidth);
120
+ } else {
121
+ newMinWidth = Math.min(widthState.lineLength, akEditorDefaultLayoutWidth);
122
+ }
108
123
  }
109
124
  setResizingState({
110
125
  isResizing: true,
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
20
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "96.5.4";
23
+ var packageVersion = "96.5.6";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,5 +1,28 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  export function calcTableColumnWidths(node) {
4
+ if (fg('platform_editor_table_row_span_fix')) {
5
+ var _firstRow = node.firstChild;
6
+ var _tableColumnWidths = [];
7
+ if (_firstRow) {
8
+ _firstRow.forEach(function (cell) {
9
+ var _cell$attrs = cell.attrs,
10
+ colspan = _cell$attrs.colspan,
11
+ colwidth = _cell$attrs.colwidth;
12
+ // column has been resized, colWidth will be an array, can safely take values even if cell is merged
13
+ if (Array.isArray(colwidth)) {
14
+ _tableColumnWidths.push.apply(_tableColumnWidths, _toConsumableArray(colwidth));
15
+ // table has merged cells but no colWidth, so columns haven't been resized, default to 0
16
+ } else if (colspan > 1) {
17
+ _tableColumnWidths.push.apply(_tableColumnWidths, _toConsumableArray(Array(colspan).fill(0)));
18
+ // no merged cells, no column resized, default to 0
19
+ } else {
20
+ _tableColumnWidths.push(0);
21
+ }
22
+ });
23
+ }
24
+ return _tableColumnWidths;
25
+ }
3
26
  var tableColumnWidths = [];
4
27
  var firstRow = node.firstChild;
5
28
  if (firstRow) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "96.5.4",
3
+ "version": "96.5.6",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -306,6 +306,15 @@
306
306
  },
307
307
  "platform_editor_legacy_content_macro": {
308
308
  "type": "boolean"
309
+ },
310
+ "platform_editor_advanced_layouts_post_fix_patch_2": {
311
+ "type": "boolean"
312
+ },
313
+ "platform_editor_breakoutresizer_remove_assertion": {
314
+ "type": "boolean"
315
+ },
316
+ "platform_editor_table_row_span_fix": {
317
+ "type": "boolean"
309
318
  }
310
319
  }
311
320
  }