@atlaskit/editor-common 106.0.2 → 106.1.0

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,18 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 106.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#157313](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/157313)
8
+ [`8f3a2416f23fe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8f3a2416f23fe) -
9
+ [ux] Added a reserved height to the extension NodeWrapper in the editor. An array of
10
+ ExtensionViewportSize is sent from Confluence editor through the plugins into the nodeviews and
11
+ used there. Depending on the array values, a minimum height is set.
12
+ - [#162505](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/162505)
13
+ [`2fb5a885dc719`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2fb5a885dc719) -
14
+ clean up platform_editor_table_row_span_fix_all and platform_editor_table_row_span_fix fgs
15
+
3
16
  ## 106.0.2
4
17
 
5
18
  ### Patch Changes
@@ -8,10 +8,12 @@ exports.ExtensionNodeWrapper = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _react2 = require("@emotion/react");
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _whitespace = require("../whitespace");
12
13
  /**
13
14
  * @jsxRuntime classic
14
15
  * @jsx jsx
16
+ * @jsxFrag React.Fragment
15
17
  */
16
18
 
17
19
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -26,6 +28,35 @@ var styles = (0, _react2.css)({
26
28
  position: 'relative'
27
29
  }
28
30
  });
31
+ var viewportSizes = ['small', 'medium', 'default', 'large', 'xlarge'];
32
+ var macroHeights = {
33
+ small: '112px',
34
+ medium: '262px',
35
+ default: '262px',
36
+ large: '524px',
37
+ xlarge: '1048px'
38
+ };
39
+ var getViewportHeight = function getViewportHeight(extensionId, extensionViewportSizes) {
40
+ var _extensionViewportSiz;
41
+ var viewportSize = Array.isArray(extensionViewportSizes) && extensionId ? (_extensionViewportSiz = extensionViewportSizes.find(function (ext) {
42
+ return ext.extensionId === extensionId;
43
+ })) === null || _extensionViewportSiz === void 0 ? void 0 : _extensionViewportSiz.viewportSize : undefined;
44
+ if (!viewportSize) {
45
+ return undefined;
46
+ }
47
+
48
+ // If it's a predefined size, use the macroHeights mapping
49
+ if (viewportSizes.includes(viewportSize)) {
50
+ return macroHeights[viewportSize];
51
+ }
52
+
53
+ // This is added to somewhat prepare to support connect macros which don't have a predefined size
54
+ // If it's a custom pixel value, use it directly
55
+ if (viewportSize.endsWith('px')) {
56
+ return viewportSize;
57
+ }
58
+ return undefined;
59
+ };
29
60
  /**
30
61
  * If inlineExtension, add zero width space to the end of the nodes and wrap with span;
31
62
  * Also if showMacroInteractionDesignUpdates is true, then add the inline-block style to account for the lozenge.
@@ -37,18 +68,28 @@ var styles = (0, _react2.css)({
37
68
  var ExtensionNodeWrapper = exports.ExtensionNodeWrapper = function ExtensionNodeWrapper(_ref) {
38
69
  var children = _ref.children,
39
70
  nodeType = _ref.nodeType,
40
- macroInteractionDesignFeatureFlags = _ref.macroInteractionDesignFeatureFlags;
71
+ macroInteractionDesignFeatureFlags = _ref.macroInteractionDesignFeatureFlags,
72
+ extensionId = _ref.extensionId,
73
+ extensionViewportSizes = _ref.extensionViewportSizes;
41
74
  var _ref2 = macroInteractionDesignFeatureFlags || {},
42
75
  showMacroInteractionDesignUpdates = _ref2.showMacroInteractionDesignUpdates;
43
76
  var wrapperClassNames = (0, _classnames.default)({
44
77
  'inline-extension': nodeType === 'inlineExtension' && showMacroInteractionDesignUpdates,
45
78
  relative: showMacroInteractionDesignUpdates
46
79
  });
47
- return (
48
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
49
- (0, _react2.jsx)("span", {
50
- className: wrapperClassNames,
51
- css: styles
52
- }, children, nodeType === 'inlineExtension' && _whitespace.ZERO_WIDTH_SPACE)
53
- );
80
+ var viewportHeight = getViewportHeight(extensionId, extensionViewportSizes);
81
+ var content =
82
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
83
+ (0, _react2.jsx)("span", {
84
+ className: wrapperClassNames,
85
+ css: styles
86
+ }, children, nodeType === 'inlineExtension' && _whitespace.ZERO_WIDTH_SPACE);
87
+ if (viewportHeight && (0, _platformFeatureFlags.fg)('confluence_preload_forge_viewport_heights_editor')) {
88
+ return (0, _react2.jsx)("div", {
89
+ style: {
90
+ minHeight: viewportHeight
91
+ }
92
+ }, content);
93
+ }
94
+ return content;
54
95
  };
@@ -52,10 +52,12 @@ var ExtensionNode = exports.ExtensionNode = /*#__PURE__*/function (_ReactNodeVie
52
52
  }, {
53
53
  key: "render",
54
54
  value: function render(props, forwardRef) {
55
- var _props$extensionNodeV;
55
+ var _this$node$attrs$para, _props$extensionNodeV, _props$extensionNodeV2;
56
56
  return /*#__PURE__*/_react.default.createElement(_ExtensionNodeWrapper.ExtensionNodeWrapper, {
57
57
  nodeType: this.node.type.name,
58
- macroInteractionDesignFeatureFlags: props.macroInteractionDesignFeatureFlags
58
+ macroInteractionDesignFeatureFlags: props.macroInteractionDesignFeatureFlags,
59
+ extensionId: (_this$node$attrs$para = this.node.attrs.parameters) === null || _this$node$attrs$para === void 0 ? void 0 : _this$node$attrs$para.extensionId,
60
+ extensionViewportSizes: (_props$extensionNodeV = props.extensionNodeViewOptions) === null || _props$extensionNodeV === void 0 ? void 0 : _props$extensionNodeV.extensionViewportSizes
59
61
  }, /*#__PURE__*/_react.default.createElement(_Extension.Extension, {
60
62
  editorView: this.view,
61
63
  node: this.node,
@@ -71,7 +73,7 @@ var ExtensionNode = exports.ExtensionNode = /*#__PURE__*/function (_ReactNodeVie
71
73
  providerFactory: props.providerFactory,
72
74
  handleContentDOMRef: forwardRef,
73
75
  extensionHandlers: props.extensionHandlers,
74
- editorAppearance: (_props$extensionNodeV = props.extensionNodeViewOptions) === null || _props$extensionNodeV === void 0 ? void 0 : _props$extensionNodeV.appearance,
76
+ editorAppearance: (_props$extensionNodeV2 = props.extensionNodeViewOptions) === null || _props$extensionNodeV2 === void 0 ? void 0 : _props$extensionNodeV2.appearance,
75
77
  pluginInjectionApi: props.pluginInjectionApi,
76
78
  macroInteractionDesignFeatureFlags: props.macroInteractionDesignFeatureFlags,
77
79
  showLivePagesBodiedMacrosRendererView: props.showLivePagesBodiedMacrosRendererView,
@@ -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 = "106.0.2";
20
+ var packageVersion = "106.1.0";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // Ignored via go/ees007
@@ -0,0 +1 @@
1
+ "use strict";
@@ -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 = "106.0.2";
26
+ var packageVersion = "106.1.0";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -10,7 +10,6 @@ exports.getColumnWidths = getColumnWidths;
10
10
  exports.hasMergedCell = hasMergedCell;
11
11
  exports.isPositionNearTableRow = isPositionNearTableRow;
12
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
13
  /**
15
14
  * Returns an array of column widths (0 if column width is undefined) of a given table node by scanning the **entire table**.
16
15
  *
@@ -64,42 +63,22 @@ function getColumnWidths(node) {
64
63
  * @returns Array<number>
65
64
  */
66
65
  function calcTableColumnWidths(node) {
67
- // Ignored via go/ees007
68
- // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
69
- // TODO: replaced with getColumnWidths, which correctly scans entire table for column widths
70
- if ((0, _platformFeatureFlags.fg)('platform_editor_table_row_span_fix') || (0, _platformFeatureFlags.fg)('platform_editor_table_row_span_fix_all')) {
71
- var _firstRow = node.firstChild;
72
- var _tableColumnWidths = [];
73
- if (_firstRow) {
74
- _firstRow.forEach(function (cell) {
75
- var _cell$attrs = cell.attrs,
76
- colspan = _cell$attrs.colspan,
77
- colwidth = _cell$attrs.colwidth;
78
- // column has been resized, colWidth will be an array, can safely take values even if cell is merged
79
- if (Array.isArray(colwidth)) {
80
- _tableColumnWidths.push.apply(_tableColumnWidths, (0, _toConsumableArray2.default)(colwidth));
81
- // table has merged cells but no colWidth, so columns haven't been resized, default to 0
82
- } else if (colspan > 1) {
83
- _tableColumnWidths.push.apply(_tableColumnWidths, (0, _toConsumableArray2.default)(Array(colspan).fill(0)));
84
- // no merged cells, no column resized, default to 0
85
- } else {
86
- _tableColumnWidths.push(0);
87
- }
88
- });
89
- }
90
- return _tableColumnWidths;
91
- }
92
- var tableColumnWidths = [];
93
66
  var firstRow = node.firstChild;
67
+ var tableColumnWidths = [];
94
68
  if (firstRow) {
95
- // Sanity validation, but it should always have a first row
96
- // Iterate for the cells in the first row
97
- firstRow.forEach(function (colNode) {
98
- var colwidth = colNode.attrs.colwidth || [0];
99
-
100
- // If we have colwidth, we added it
101
- if (colwidth) {
102
- tableColumnWidths = [].concat((0, _toConsumableArray2.default)(tableColumnWidths), (0, _toConsumableArray2.default)(colwidth));
69
+ firstRow.forEach(function (cell) {
70
+ var _cell$attrs = cell.attrs,
71
+ colspan = _cell$attrs.colspan,
72
+ colwidth = _cell$attrs.colwidth;
73
+ // column has been resized, colWidth will be an array, can safely take values even if cell is merged
74
+ if (Array.isArray(colwidth)) {
75
+ tableColumnWidths.push.apply(tableColumnWidths, (0, _toConsumableArray2.default)(colwidth));
76
+ // table has merged cells but no colWidth, so columns haven't been resized, default to 0
77
+ } else if (colspan > 1) {
78
+ tableColumnWidths.push.apply(tableColumnWidths, (0, _toConsumableArray2.default)(Array(colspan).fill(0)));
79
+ // no merged cells, no column resized, default to 0
80
+ } else {
81
+ tableColumnWidths.push(0);
103
82
  }
104
83
  });
105
84
  }
@@ -1,12 +1,14 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
+ * @jsxFrag React.Fragment
4
5
  */
5
6
  import React from 'react';
6
7
 
7
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
9
  import { css, jsx } from '@emotion/react';
9
10
  import classnames from 'classnames';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
10
12
  import { ZERO_WIDTH_SPACE } from '../whitespace';
11
13
  const styles = css({
12
14
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
@@ -18,6 +20,33 @@ const styles = css({
18
20
  position: 'relative'
19
21
  }
20
22
  });
23
+ const viewportSizes = ['small', 'medium', 'default', 'large', 'xlarge'];
24
+ const macroHeights = {
25
+ small: '112px',
26
+ medium: '262px',
27
+ default: '262px',
28
+ large: '524px',
29
+ xlarge: '1048px'
30
+ };
31
+ const getViewportHeight = (extensionId, extensionViewportSizes) => {
32
+ var _extensionViewportSiz;
33
+ const viewportSize = Array.isArray(extensionViewportSizes) && extensionId ? (_extensionViewportSiz = extensionViewportSizes.find(ext => ext.extensionId === extensionId)) === null || _extensionViewportSiz === void 0 ? void 0 : _extensionViewportSiz.viewportSize : undefined;
34
+ if (!viewportSize) {
35
+ return undefined;
36
+ }
37
+
38
+ // If it's a predefined size, use the macroHeights mapping
39
+ if (viewportSizes.includes(viewportSize)) {
40
+ return macroHeights[viewportSize];
41
+ }
42
+
43
+ // This is added to somewhat prepare to support connect macros which don't have a predefined size
44
+ // If it's a custom pixel value, use it directly
45
+ if (viewportSize.endsWith('px')) {
46
+ return viewportSize;
47
+ }
48
+ return undefined;
49
+ };
21
50
  /**
22
51
  * If inlineExtension, add zero width space to the end of the nodes and wrap with span;
23
52
  * Also if showMacroInteractionDesignUpdates is true, then add the inline-block style to account for the lozenge.
@@ -29,7 +58,9 @@ const styles = css({
29
58
  export const ExtensionNodeWrapper = ({
30
59
  children,
31
60
  nodeType,
32
- macroInteractionDesignFeatureFlags
61
+ macroInteractionDesignFeatureFlags,
62
+ extensionId,
63
+ extensionViewportSizes
33
64
  }) => {
34
65
  const {
35
66
  showMacroInteractionDesignUpdates
@@ -38,11 +69,19 @@ export const ExtensionNodeWrapper = ({
38
69
  'inline-extension': nodeType === 'inlineExtension' && showMacroInteractionDesignUpdates,
39
70
  relative: showMacroInteractionDesignUpdates
40
71
  });
41
- return (
42
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
43
- jsx("span", {
44
- className: wrapperClassNames,
45
- css: styles
46
- }, children, nodeType === 'inlineExtension' && ZERO_WIDTH_SPACE)
47
- );
72
+ const viewportHeight = getViewportHeight(extensionId, extensionViewportSizes);
73
+ const content =
74
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
75
+ jsx("span", {
76
+ className: wrapperClassNames,
77
+ css: styles
78
+ }, children, nodeType === 'inlineExtension' && ZERO_WIDTH_SPACE);
79
+ if (viewportHeight && fg('confluence_preload_forge_viewport_heights_editor')) {
80
+ return jsx("div", {
81
+ style: {
82
+ minHeight: viewportHeight
83
+ }
84
+ }, content);
85
+ }
86
+ return content;
48
87
  };
@@ -26,10 +26,12 @@ export class ExtensionNode extends ReactNodeView {
26
26
  };
27
27
  }
28
28
  render(props, forwardRef) {
29
- var _props$extensionNodeV;
29
+ var _this$node$attrs$para, _props$extensionNodeV, _props$extensionNodeV2;
30
30
  return /*#__PURE__*/React.createElement(ExtensionNodeWrapper, {
31
31
  nodeType: this.node.type.name,
32
- macroInteractionDesignFeatureFlags: props.macroInteractionDesignFeatureFlags
32
+ macroInteractionDesignFeatureFlags: props.macroInteractionDesignFeatureFlags,
33
+ extensionId: (_this$node$attrs$para = this.node.attrs.parameters) === null || _this$node$attrs$para === void 0 ? void 0 : _this$node$attrs$para.extensionId,
34
+ extensionViewportSizes: (_props$extensionNodeV = props.extensionNodeViewOptions) === null || _props$extensionNodeV === void 0 ? void 0 : _props$extensionNodeV.extensionViewportSizes
33
35
  }, /*#__PURE__*/React.createElement(Extension, {
34
36
  editorView: this.view,
35
37
  node: this.node,
@@ -45,7 +47,7 @@ export class ExtensionNode extends ReactNodeView {
45
47
  providerFactory: props.providerFactory,
46
48
  handleContentDOMRef: forwardRef,
47
49
  extensionHandlers: props.extensionHandlers,
48
- editorAppearance: (_props$extensionNodeV = props.extensionNodeViewOptions) === null || _props$extensionNodeV === void 0 ? void 0 : _props$extensionNodeV.appearance,
50
+ editorAppearance: (_props$extensionNodeV2 = props.extensionNodeViewOptions) === null || _props$extensionNodeV2 === void 0 ? void 0 : _props$extensionNodeV2.appearance,
49
51
  pluginInjectionApi: props.pluginInjectionApi,
50
52
  macroInteractionDesignFeatureFlags: props.macroInteractionDesignFeatureFlags,
51
53
  showLivePagesBodiedMacrosRendererView: props.showLivePagesBodiedMacrosRendererView,
@@ -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 = "106.0.2";
4
+ const packageVersion = "106.1.0";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // Ignored via go/ees007
File without changes
@@ -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 = "106.0.2";
16
+ const packageVersion = "106.1.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -1,5 +1,3 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
-
3
1
  /**
4
2
  * Returns an array of column widths (0 if column width is undefined) of a given table node by scanning the **entire table**.
5
3
  *
@@ -54,43 +52,23 @@ export function getColumnWidths(node) {
54
52
  * @returns Array<number>
55
53
  */
56
54
  export function calcTableColumnWidths(node) {
57
- // Ignored via go/ees007
58
- // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
59
- // TODO: replaced with getColumnWidths, which correctly scans entire table for column widths
60
- if (fg('platform_editor_table_row_span_fix') || fg('platform_editor_table_row_span_fix_all')) {
61
- const firstRow = node.firstChild;
62
- const tableColumnWidths = [];
63
- if (firstRow) {
64
- firstRow.forEach(cell => {
65
- const {
66
- colspan,
67
- colwidth
68
- } = cell.attrs;
69
- // column has been resized, colWidth will be an array, can safely take values even if cell is merged
70
- if (Array.isArray(colwidth)) {
71
- tableColumnWidths.push(...colwidth);
72
- // table has merged cells but no colWidth, so columns haven't been resized, default to 0
73
- } else if (colspan > 1) {
74
- tableColumnWidths.push(...Array(colspan).fill(0));
75
- // no merged cells, no column resized, default to 0
76
- } else {
77
- tableColumnWidths.push(0);
78
- }
79
- });
80
- }
81
- return tableColumnWidths;
82
- }
83
- let tableColumnWidths = [];
84
55
  const firstRow = node.firstChild;
56
+ const tableColumnWidths = [];
85
57
  if (firstRow) {
86
- // Sanity validation, but it should always have a first row
87
- // Iterate for the cells in the first row
88
- firstRow.forEach(colNode => {
89
- const colwidth = colNode.attrs.colwidth || [0];
90
-
91
- // If we have colwidth, we added it
92
- if (colwidth) {
93
- tableColumnWidths = [...tableColumnWidths, ...colwidth];
58
+ firstRow.forEach(cell => {
59
+ const {
60
+ colspan,
61
+ colwidth
62
+ } = cell.attrs;
63
+ // column has been resized, colWidth will be an array, can safely take values even if cell is merged
64
+ if (Array.isArray(colwidth)) {
65
+ tableColumnWidths.push(...colwidth);
66
+ // table has merged cells but no colWidth, so columns haven't been resized, default to 0
67
+ } else if (colspan > 1) {
68
+ tableColumnWidths.push(...Array(colspan).fill(0));
69
+ // no merged cells, no column resized, default to 0
70
+ } else {
71
+ tableColumnWidths.push(0);
94
72
  }
95
73
  });
96
74
  }
@@ -1,12 +1,14 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
+ * @jsxFrag React.Fragment
4
5
  */
5
6
  import React from 'react';
6
7
 
7
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
9
  import { css, jsx } from '@emotion/react';
9
10
  import classnames from 'classnames';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
10
12
  import { ZERO_WIDTH_SPACE } from '../whitespace';
11
13
  var styles = css({
12
14
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
@@ -18,6 +20,35 @@ var styles = css({
18
20
  position: 'relative'
19
21
  }
20
22
  });
23
+ var viewportSizes = ['small', 'medium', 'default', 'large', 'xlarge'];
24
+ var macroHeights = {
25
+ small: '112px',
26
+ medium: '262px',
27
+ default: '262px',
28
+ large: '524px',
29
+ xlarge: '1048px'
30
+ };
31
+ var getViewportHeight = function getViewportHeight(extensionId, extensionViewportSizes) {
32
+ var _extensionViewportSiz;
33
+ var viewportSize = Array.isArray(extensionViewportSizes) && extensionId ? (_extensionViewportSiz = extensionViewportSizes.find(function (ext) {
34
+ return ext.extensionId === extensionId;
35
+ })) === null || _extensionViewportSiz === void 0 ? void 0 : _extensionViewportSiz.viewportSize : undefined;
36
+ if (!viewportSize) {
37
+ return undefined;
38
+ }
39
+
40
+ // If it's a predefined size, use the macroHeights mapping
41
+ if (viewportSizes.includes(viewportSize)) {
42
+ return macroHeights[viewportSize];
43
+ }
44
+
45
+ // This is added to somewhat prepare to support connect macros which don't have a predefined size
46
+ // If it's a custom pixel value, use it directly
47
+ if (viewportSize.endsWith('px')) {
48
+ return viewportSize;
49
+ }
50
+ return undefined;
51
+ };
21
52
  /**
22
53
  * If inlineExtension, add zero width space to the end of the nodes and wrap with span;
23
54
  * Also if showMacroInteractionDesignUpdates is true, then add the inline-block style to account for the lozenge.
@@ -29,18 +60,28 @@ var styles = css({
29
60
  export var ExtensionNodeWrapper = function ExtensionNodeWrapper(_ref) {
30
61
  var children = _ref.children,
31
62
  nodeType = _ref.nodeType,
32
- macroInteractionDesignFeatureFlags = _ref.macroInteractionDesignFeatureFlags;
63
+ macroInteractionDesignFeatureFlags = _ref.macroInteractionDesignFeatureFlags,
64
+ extensionId = _ref.extensionId,
65
+ extensionViewportSizes = _ref.extensionViewportSizes;
33
66
  var _ref2 = macroInteractionDesignFeatureFlags || {},
34
67
  showMacroInteractionDesignUpdates = _ref2.showMacroInteractionDesignUpdates;
35
68
  var wrapperClassNames = classnames({
36
69
  'inline-extension': nodeType === 'inlineExtension' && showMacroInteractionDesignUpdates,
37
70
  relative: showMacroInteractionDesignUpdates
38
71
  });
39
- return (
40
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
41
- jsx("span", {
42
- className: wrapperClassNames,
43
- css: styles
44
- }, children, nodeType === 'inlineExtension' && ZERO_WIDTH_SPACE)
45
- );
72
+ var viewportHeight = getViewportHeight(extensionId, extensionViewportSizes);
73
+ var content =
74
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
75
+ jsx("span", {
76
+ className: wrapperClassNames,
77
+ css: styles
78
+ }, children, nodeType === 'inlineExtension' && ZERO_WIDTH_SPACE);
79
+ if (viewportHeight && fg('confluence_preload_forge_viewport_heights_editor')) {
80
+ return jsx("div", {
81
+ style: {
82
+ minHeight: viewportHeight
83
+ }
84
+ }, content);
85
+ }
86
+ return content;
46
87
  };
@@ -44,10 +44,12 @@ export var ExtensionNode = /*#__PURE__*/function (_ReactNodeView) {
44
44
  }, {
45
45
  key: "render",
46
46
  value: function render(props, forwardRef) {
47
- var _props$extensionNodeV;
47
+ var _this$node$attrs$para, _props$extensionNodeV, _props$extensionNodeV2;
48
48
  return /*#__PURE__*/React.createElement(ExtensionNodeWrapper, {
49
49
  nodeType: this.node.type.name,
50
- macroInteractionDesignFeatureFlags: props.macroInteractionDesignFeatureFlags
50
+ macroInteractionDesignFeatureFlags: props.macroInteractionDesignFeatureFlags,
51
+ extensionId: (_this$node$attrs$para = this.node.attrs.parameters) === null || _this$node$attrs$para === void 0 ? void 0 : _this$node$attrs$para.extensionId,
52
+ extensionViewportSizes: (_props$extensionNodeV = props.extensionNodeViewOptions) === null || _props$extensionNodeV === void 0 ? void 0 : _props$extensionNodeV.extensionViewportSizes
51
53
  }, /*#__PURE__*/React.createElement(Extension, {
52
54
  editorView: this.view,
53
55
  node: this.node,
@@ -63,7 +65,7 @@ export var ExtensionNode = /*#__PURE__*/function (_ReactNodeView) {
63
65
  providerFactory: props.providerFactory,
64
66
  handleContentDOMRef: forwardRef,
65
67
  extensionHandlers: props.extensionHandlers,
66
- editorAppearance: (_props$extensionNodeV = props.extensionNodeViewOptions) === null || _props$extensionNodeV === void 0 ? void 0 : _props$extensionNodeV.appearance,
68
+ editorAppearance: (_props$extensionNodeV2 = props.extensionNodeViewOptions) === null || _props$extensionNodeV2 === void 0 ? void 0 : _props$extensionNodeV2.appearance,
67
69
  pluginInjectionApi: props.pluginInjectionApi,
68
70
  macroInteractionDesignFeatureFlags: props.macroInteractionDesignFeatureFlags,
69
71
  showLivePagesBodiedMacrosRendererView: props.showLivePagesBodiedMacrosRendererView,
@@ -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 = "106.0.2";
10
+ var packageVersion = "106.1.0";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // Ignored via go/ees007
File without changes
@@ -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 = "106.0.2";
23
+ var packageVersion = "106.1.0";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -1,6 +1,4 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
-
4
2
  /**
5
3
  * Returns an array of column widths (0 if column width is undefined) of a given table node by scanning the **entire table**.
6
4
  *
@@ -54,42 +52,22 @@ export function getColumnWidths(node) {
54
52
  * @returns Array<number>
55
53
  */
56
54
  export function calcTableColumnWidths(node) {
57
- // Ignored via go/ees007
58
- // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
59
- // TODO: replaced with getColumnWidths, which correctly scans entire table for column widths
60
- if (fg('platform_editor_table_row_span_fix') || fg('platform_editor_table_row_span_fix_all')) {
61
- var _firstRow = node.firstChild;
62
- var _tableColumnWidths = [];
63
- if (_firstRow) {
64
- _firstRow.forEach(function (cell) {
65
- var _cell$attrs = cell.attrs,
66
- colspan = _cell$attrs.colspan,
67
- colwidth = _cell$attrs.colwidth;
68
- // column has been resized, colWidth will be an array, can safely take values even if cell is merged
69
- if (Array.isArray(colwidth)) {
70
- _tableColumnWidths.push.apply(_tableColumnWidths, _toConsumableArray(colwidth));
71
- // table has merged cells but no colWidth, so columns haven't been resized, default to 0
72
- } else if (colspan > 1) {
73
- _tableColumnWidths.push.apply(_tableColumnWidths, _toConsumableArray(Array(colspan).fill(0)));
74
- // no merged cells, no column resized, default to 0
75
- } else {
76
- _tableColumnWidths.push(0);
77
- }
78
- });
79
- }
80
- return _tableColumnWidths;
81
- }
82
- var tableColumnWidths = [];
83
55
  var firstRow = node.firstChild;
56
+ var tableColumnWidths = [];
84
57
  if (firstRow) {
85
- // Sanity validation, but it should always have a first row
86
- // Iterate for the cells in the first row
87
- firstRow.forEach(function (colNode) {
88
- var colwidth = colNode.attrs.colwidth || [0];
89
-
90
- // If we have colwidth, we added it
91
- if (colwidth) {
92
- tableColumnWidths = [].concat(_toConsumableArray(tableColumnWidths), _toConsumableArray(colwidth));
58
+ firstRow.forEach(function (cell) {
59
+ var _cell$attrs = cell.attrs,
60
+ colspan = _cell$attrs.colspan,
61
+ colwidth = _cell$attrs.colwidth;
62
+ // column has been resized, colWidth will be an array, can safely take values even if cell is merged
63
+ if (Array.isArray(colwidth)) {
64
+ tableColumnWidths.push.apply(tableColumnWidths, _toConsumableArray(colwidth));
65
+ // table has merged cells but no colWidth, so columns haven't been resized, default to 0
66
+ } else if (colspan > 1) {
67
+ tableColumnWidths.push.apply(tableColumnWidths, _toConsumableArray(Array(colspan).fill(0)));
68
+ // no merged cells, no column resized, default to 0
69
+ } else {
70
+ tableColumnWidths.push(0);
93
71
  }
94
72
  });
95
73
  }
@@ -1,14 +1,18 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
+ * @jsxFrag React.Fragment
4
5
  */
5
6
  import React from 'react';
6
7
  import { jsx } from '@emotion/react';
8
+ import type { ExtensionViewportSize } from '../types';
7
9
  import type { MacroInteractionDesignFeatureFlags } from './types';
8
10
  type Props = {
9
11
  children: React.ReactNode;
10
12
  nodeType: string;
11
13
  macroInteractionDesignFeatureFlags?: MacroInteractionDesignFeatureFlags;
14
+ extensionId?: string;
15
+ extensionViewportSizes?: ExtensionViewportSize[];
12
16
  };
13
17
  /**
14
18
  * If inlineExtension, add zero width space to the end of the nodes and wrap with span;
@@ -18,5 +22,5 @@ type Props = {
18
22
  * @param param0
19
23
  * @returns
20
24
  */
21
- export declare const ExtensionNodeWrapper: ({ children, nodeType, macroInteractionDesignFeatureFlags, }: Props) => jsx.JSX.Element;
25
+ export declare const ExtensionNodeWrapper: ({ children, nodeType, macroInteractionDesignFeatureFlags, extensionId, extensionViewportSizes, }: Props) => jsx.JSX.Element;
22
26
  export {};
@@ -8,10 +8,11 @@ import type { PortalProviderAPI } from '../portal';
8
8
  import type { ProviderFactory } from '../provider-factory';
9
9
  import type { ForwardRef, getPosHandler } from '../react-node-view';
10
10
  import ReactNodeView from '../react-node-view';
11
- import type { EditorAppearance } from '../types';
11
+ import type { EditorAppearance, ExtensionViewportSize } from '../types';
12
12
  import type { ExtensionsPluginInjectionAPI, MacroInteractionDesignFeatureFlags } from './types';
13
13
  interface ExtensionNodeViewOptions {
14
14
  appearance?: EditorAppearance;
15
+ extensionViewportSizes?: ExtensionViewportSize[];
15
16
  }
16
17
  export declare class ExtensionNode extends ReactNodeView {
17
18
  ignoreMutation(mutation: MutationRecord | {
@@ -0,0 +1,4 @@
1
+ export interface ExtensionViewportSize {
2
+ extensionId?: string;
3
+ viewportSize?: string;
4
+ }
@@ -58,3 +58,4 @@ import type { EditorPresetBuilder, ExtractPresetAPI } from '../preset';
58
58
  */
59
59
  export type ExtractPublicEditorAPI<T extends EditorPresetBuilder<any, any>> = ExtractPresetAPI<T>;
60
60
  export type { UserPreferencesProvider, UserPreferences } from './user-preferences';
61
+ export type { ExtensionViewportSize } from './extensibility';
@@ -1,14 +1,18 @@
1
1
  /**
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
+ * @jsxFrag React.Fragment
4
5
  */
5
6
  import React from 'react';
6
7
  import { jsx } from '@emotion/react';
8
+ import type { ExtensionViewportSize } from '../types';
7
9
  import type { MacroInteractionDesignFeatureFlags } from './types';
8
10
  type Props = {
9
11
  children: React.ReactNode;
10
12
  nodeType: string;
11
13
  macroInteractionDesignFeatureFlags?: MacroInteractionDesignFeatureFlags;
14
+ extensionId?: string;
15
+ extensionViewportSizes?: ExtensionViewportSize[];
12
16
  };
13
17
  /**
14
18
  * If inlineExtension, add zero width space to the end of the nodes and wrap with span;
@@ -18,5 +22,5 @@ type Props = {
18
22
  * @param param0
19
23
  * @returns
20
24
  */
21
- export declare const ExtensionNodeWrapper: ({ children, nodeType, macroInteractionDesignFeatureFlags, }: Props) => jsx.JSX.Element;
25
+ export declare const ExtensionNodeWrapper: ({ children, nodeType, macroInteractionDesignFeatureFlags, extensionId, extensionViewportSizes, }: Props) => jsx.JSX.Element;
22
26
  export {};
@@ -8,10 +8,11 @@ import type { PortalProviderAPI } from '../portal';
8
8
  import type { ProviderFactory } from '../provider-factory';
9
9
  import type { ForwardRef, getPosHandler } from '../react-node-view';
10
10
  import ReactNodeView from '../react-node-view';
11
- import type { EditorAppearance } from '../types';
11
+ import type { EditorAppearance, ExtensionViewportSize } from '../types';
12
12
  import type { ExtensionsPluginInjectionAPI, MacroInteractionDesignFeatureFlags } from './types';
13
13
  interface ExtensionNodeViewOptions {
14
14
  appearance?: EditorAppearance;
15
+ extensionViewportSizes?: ExtensionViewportSize[];
15
16
  }
16
17
  export declare class ExtensionNode extends ReactNodeView {
17
18
  ignoreMutation(mutation: MutationRecord | {
@@ -0,0 +1,4 @@
1
+ export interface ExtensionViewportSize {
2
+ extensionId?: string;
3
+ viewportSize?: string;
4
+ }
@@ -58,3 +58,4 @@ import type { EditorPresetBuilder, ExtractPresetAPI } from '../preset';
58
58
  */
59
59
  export type ExtractPublicEditorAPI<T extends EditorPresetBuilder<any, any>> = ExtractPresetAPI<T>;
60
60
  export type { UserPreferencesProvider, UserPreferences } from './user-preferences';
61
+ export type { ExtensionViewportSize } from './extensibility';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "106.0.2",
3
+ "version": "106.1.0",
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/"
@@ -286,12 +286,6 @@
286
286
  "platform_editor_breakoutresizer_remove_assertion": {
287
287
  "type": "boolean"
288
288
  },
289
- "platform_editor_table_row_span_fix": {
290
- "type": "boolean"
291
- },
292
- "platform_editor_table_row_span_fix_all": {
293
- "type": "boolean"
294
- },
295
289
  "platform-component-visual-refresh": {
296
290
  "type": "boolean"
297
291
  },
@@ -396,6 +390,9 @@
396
390
  },
397
391
  "dst-a11y__replace-anchor-with-link__editor": {
398
392
  "type": "boolean"
393
+ },
394
+ "confluence_preload_forge_viewport_heights_editor": {
395
+ "type": "boolean"
399
396
  }
400
397
  }
401
398
  }