@atlaskit/editor-common 74.26.8 → 74.27.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics/types/table-events.js +1 -0
  3. package/dist/cjs/guideline/dynamicGuideline.js +2 -2
  4. package/dist/cjs/media-single/constants.js +6 -2
  5. package/dist/cjs/media-single/index.js +8 -1
  6. package/dist/cjs/media-single/utils.js +26 -0
  7. package/dist/cjs/monitoring/error.js +1 -1
  8. package/dist/cjs/ui/DropList/index.js +1 -1
  9. package/dist/cjs/ui/MediaSingle/grid.js +9 -10
  10. package/dist/cjs/ui/MediaSingle/index.js +7 -4
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/es2019/analytics/types/table-events.js +1 -0
  13. package/dist/es2019/guideline/dynamicGuideline.js +2 -2
  14. package/dist/es2019/media-single/constants.js +3 -1
  15. package/dist/es2019/media-single/index.js +2 -1
  16. package/dist/es2019/media-single/utils.js +18 -0
  17. package/dist/es2019/monitoring/error.js +1 -1
  18. package/dist/es2019/ui/DropList/index.js +1 -1
  19. package/dist/es2019/ui/MediaSingle/grid.js +9 -10
  20. package/dist/es2019/ui/MediaSingle/index.js +8 -5
  21. package/dist/es2019/version.json +1 -1
  22. package/dist/esm/analytics/types/table-events.js +1 -0
  23. package/dist/esm/guideline/dynamicGuideline.js +2 -2
  24. package/dist/esm/media-single/constants.js +3 -1
  25. package/dist/esm/media-single/index.js +2 -1
  26. package/dist/esm/media-single/utils.js +20 -0
  27. package/dist/esm/monitoring/error.js +1 -1
  28. package/dist/esm/ui/DropList/index.js +1 -1
  29. package/dist/esm/ui/MediaSingle/grid.js +9 -10
  30. package/dist/esm/ui/MediaSingle/index.js +8 -5
  31. package/dist/esm/version.json +1 -1
  32. package/dist/types/analytics/types/table-events.d.ts +10 -2
  33. package/dist/types/media-single/constants.d.ts +2 -0
  34. package/dist/types/media-single/index.d.ts +1 -0
  35. package/dist/types/media-single/utils.d.ts +13 -0
  36. package/dist/types/ui/MediaSingle/index.d.ts +1 -1
  37. package/dist/types-ts4.5/analytics/types/table-events.d.ts +10 -2
  38. package/dist/types-ts4.5/media-single/constants.d.ts +2 -0
  39. package/dist/types-ts4.5/media-single/index.d.ts +1 -0
  40. package/dist/types-ts4.5/media-single/utils.d.ts +13 -0
  41. package/dist/types-ts4.5/ui/MediaSingle/index.d.ts +1 -1
  42. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 74.27.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`0ae6f70038a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0ae6f70038a) - [ED-17635] Add analytics event for table width resizing
8
+
9
+ ## 74.26.9
10
+
11
+ ### Patch Changes
12
+
13
+ - [`3b01ce33502`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3b01ce33502) - add getMediaSinglePixelWidth to support legacy and new media resize experience
14
+
3
15
  ## 74.26.8
4
16
 
5
17
  ### Patch Changes
@@ -27,6 +27,7 @@ var TABLE_ACTION = /*#__PURE__*/function (TABLE_ACTION) {
27
27
  TABLE_ACTION["ATTEMPTED_TABLE_WIDTH_CHANGE"] = "attemptedTableWidthChange";
28
28
  TABLE_ACTION["DISTRIBUTED_COLUMNS_WIDTHS"] = "distributedColumnsWidths";
29
29
  TABLE_ACTION["FIXED"] = "fixed";
30
+ TABLE_ACTION["RESIZED"] = "resized";
30
31
  return TABLE_ACTION;
31
32
  }({});
32
33
  exports.TABLE_ACTION = TABLE_ACTION;
@@ -8,8 +8,8 @@ exports.generateDynamicGuidelines = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _prosemirrorState = require("prosemirror-state");
10
10
  var _prosemirrorUtils = require("prosemirror-utils");
11
+ var _mediaSingle = require("../media-single");
11
12
  var _constants = require("./constants");
12
- var _types = require("./types");
13
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
15
  var generateDynamicGuidelines = function generateDynamicGuidelines(state, editorWidth) {
@@ -29,7 +29,7 @@ var generateDynamicGuidelines = function generateDynamicGuidelines(state, editor
29
29
  layout = _node$attrs.layout,
30
30
  width = _node$attrs.width,
31
31
  widthType = _node$attrs.widthType;
32
- var pixelWidth = !widthType || widthType === _types.WidthTypes.PERCENTAGE ? width / 100 * editorWidth : width;
32
+ var pixelWidth = (0, _mediaSingle.getMediaSinglePixelWidth)(width, editorWidth, widthType);
33
33
  var commonStyles = {
34
34
  style: 'dashed',
35
35
  show: true
@@ -3,10 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.MEDIA_SINGLE_SNAP_GAP = exports.MEDIA_SINGLE_MIN_PIXEL_WIDTH = exports.MEDIA_SINGLE_HIGHLIGHT_GAP = void 0;
6
+ exports.MEDIA_SINGLE_SNAP_GAP = exports.MEDIA_SINGLE_MIN_PIXEL_WIDTH = exports.MEDIA_SINGLE_HIGHLIGHT_GAP = exports.MEDIA_SINGLE_HANDLE_MARGIN = exports.MEDIA_SINGLE_GUTTER_SIZE = void 0;
7
7
  var MEDIA_SINGLE_MIN_PIXEL_WIDTH = 24;
8
8
  exports.MEDIA_SINGLE_MIN_PIXEL_WIDTH = MEDIA_SINGLE_MIN_PIXEL_WIDTH;
9
9
  var MEDIA_SINGLE_SNAP_GAP = 3;
10
10
  exports.MEDIA_SINGLE_SNAP_GAP = MEDIA_SINGLE_SNAP_GAP;
11
11
  var MEDIA_SINGLE_HIGHLIGHT_GAP = 10;
12
- exports.MEDIA_SINGLE_HIGHLIGHT_GAP = MEDIA_SINGLE_HIGHLIGHT_GAP;
12
+ exports.MEDIA_SINGLE_HIGHLIGHT_GAP = MEDIA_SINGLE_HIGHLIGHT_GAP;
13
+ var MEDIA_SINGLE_HANDLE_MARGIN = 12;
14
+ exports.MEDIA_SINGLE_HANDLE_MARGIN = MEDIA_SINGLE_HANDLE_MARGIN;
15
+ var MEDIA_SINGLE_GUTTER_SIZE = MEDIA_SINGLE_HANDLE_MARGIN * 2;
16
+ exports.MEDIA_SINGLE_GUTTER_SIZE = MEDIA_SINGLE_GUTTER_SIZE;
@@ -21,4 +21,11 @@ Object.defineProperty(exports, "MEDIA_SINGLE_SNAP_GAP", {
21
21
  return _constants.MEDIA_SINGLE_SNAP_GAP;
22
22
  }
23
23
  });
24
- var _constants = require("./constants");
24
+ Object.defineProperty(exports, "getMediaSinglePixelWidth", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _utils.getMediaSinglePixelWidth;
28
+ }
29
+ });
30
+ var _constants = require("./constants");
31
+ var _utils = require("./utils");
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getMediaSinglePixelWidth = getMediaSinglePixelWidth;
7
+ /**
8
+ * Convert media node width to pixel
9
+ *
10
+ * for legacy experience, image is aligned inside resize handle bar with a gap. So gutterOffset is used to for this use case.
11
+ * for new expereience, image is aligned with resize handle bar, so gutterOffset is 0
12
+ *
13
+ * @param width - media single node width
14
+ * @param editorWidth - width of editor
15
+ * @param widthType - width type is defined in the adf document for mediaSingle node, and it is assoicated with the `width`
16
+ * @param gutterOffset - resize handle bar offset, determines whether align with resize handle bar
17
+ * @returns pixel number for media single node
18
+ */
19
+ function getMediaSinglePixelWidth(width, editorWidth) {
20
+ var widthType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'percentage';
21
+ var gutterOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
22
+ if (widthType === 'pixel') {
23
+ return width;
24
+ }
25
+ return Math.ceil((editorWidth + gutterOffset) * (width / 100) - gutterOffset);
26
+ }
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "74.26.8";
19
+ var packageVersion = "74.27.0";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
24
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
25
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "74.26.8";
27
+ var packageVersion = "74.27.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -10,28 +10,27 @@ exports.calcPxFromColumns = calcPxFromColumns;
10
10
  exports.calcPxFromPct = calcPxFromPct;
11
11
  exports.wrappedLayouts = exports.snapToGrid = exports.layoutSupportsWidth = void 0;
12
12
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
13
- var handleMargin = 12;
14
- var gutterSize = handleMargin * 2;
13
+ var _constants = require("../../media-single/constants");
15
14
  var validWidthModes = ['center', 'wrap-left', 'wrap-right', 'align-start', 'align-end'];
16
15
  var layoutSupportsWidth = function layoutSupportsWidth(layout) {
17
16
  return validWidthModes.indexOf(layout) > -1;
18
17
  };
19
18
  exports.layoutSupportsWidth = layoutSupportsWidth;
20
19
  function calcPxFromColumns(columns, lineLength, gridSize) {
21
- var maxWidth = lineLength + gutterSize;
22
- return maxWidth / gridSize * columns - gutterSize;
20
+ var maxWidth = lineLength + _constants.MEDIA_SINGLE_GUTTER_SIZE;
21
+ return maxWidth / gridSize * columns - _constants.MEDIA_SINGLE_GUTTER_SIZE;
23
22
  }
24
23
  function calcColumnsFromPx(width, lineLength, gridSize) {
25
- var maxWidth = lineLength + gutterSize;
26
- return (width + gutterSize) * gridSize / maxWidth;
24
+ var maxWidth = lineLength + _constants.MEDIA_SINGLE_GUTTER_SIZE;
25
+ return (width + _constants.MEDIA_SINGLE_GUTTER_SIZE) * gridSize / maxWidth;
27
26
  }
28
27
  function calcPxFromPct(pct, lineLength) {
29
- var maxWidth = lineLength + gutterSize;
30
- return maxWidth * pct - gutterSize;
28
+ var maxWidth = lineLength + _constants.MEDIA_SINGLE_GUTTER_SIZE;
29
+ return maxWidth * pct - _constants.MEDIA_SINGLE_GUTTER_SIZE;
31
30
  }
32
31
  function calcPctFromPx(width, lineLength) {
33
- var maxWidth = lineLength + gutterSize;
34
- return (width + gutterSize) / maxWidth;
32
+ var maxWidth = lineLength + _constants.MEDIA_SINGLE_GUTTER_SIZE;
33
+ return (width + _constants.MEDIA_SINGLE_GUTTER_SIZE) / maxWidth;
35
34
  }
36
35
  var wrappedLayouts = ['wrap-left', 'wrap-right', 'align-end', 'align-start'];
37
36
  exports.wrappedLayouts = wrappedLayouts;
@@ -12,6 +12,8 @@ var _react = _interopRequireDefault(require("react"));
12
12
  var _react2 = require("@emotion/react");
13
13
  var _classnames = _interopRequireDefault(require("classnames"));
14
14
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
15
+ var _constants = require("../../media-single/constants");
16
+ var _utils = require("../../media-single/utils");
15
17
  var _grid = require("./grid");
16
18
  var _styled = require("./styled");
17
19
  /** @jsx jsx */
@@ -46,22 +48,23 @@ function MediaSingle(_ref) {
46
48
  _ref$nodeType = _ref.nodeType,
47
49
  nodeType = _ref$nodeType === void 0 ? 'mediaSingle' : _ref$nodeType,
48
50
  fullWidthMode = _ref.fullWidthMode,
49
- lineLength = _ref.lineLength,
51
+ editorWidth = _ref.lineLength,
50
52
  _ref$hasFallbackConta = _ref.hasFallbackContainer,
51
53
  hasFallbackContainer = _ref$hasFallbackConta === void 0 ? true : _ref$hasFallbackConta,
52
54
  handleMediaSingleRef = _ref.handleMediaSingleRef;
53
55
  var isPixelWidth = (size === null || size === void 0 ? void 0 : size.widthType) === 'pixel';
54
56
  var mediaSingleWidth = (size === null || size === void 0 ? void 0 : size.width) || pctWidth;
55
57
  var children = _react.default.Children.toArray(propsChildren);
56
- if (!mediaSingleWidth && shouldAddDefaultWrappedWidth(layout, width, lineLength)) {
57
- mediaSingleWidth = isPixelWidth ? lineLength / 2 : 50;
58
+ if (!mediaSingleWidth && shouldAddDefaultWrappedWidth(layout, width, editorWidth)) {
59
+ // if width is not available, set to half of editor width
60
+ mediaSingleWidth = isPixelWidth ? editorWidth / 2 : 50;
58
61
  }
59
62
  // When width is not set we have an absolute height for a given embed.
60
63
  // When both width and height are set we use them to determine ratio and use that to define
61
64
  // embed height in relation to whatever width of an dom element is in runtime
62
65
  var isHeightOnly = width === undefined;
63
66
  if (mediaSingleWidth) {
64
- var pxWidth = isPixelWidth ? mediaSingleWidth : Math.ceil((0, _grid.calcPxFromPct)(mediaSingleWidth / 100, lineLength || containerWidth || 0));
67
+ var pxWidth = (0, _utils.getMediaSinglePixelWidth)(mediaSingleWidth, editorWidth, size === null || size === void 0 ? void 0 : size.widthType, _constants.MEDIA_SINGLE_GUTTER_SIZE);
65
68
  if (isHeightOnly) {
66
69
  width = pxWidth - _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide;
67
70
  } else if (width !== undefined) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.26.8",
3
+ "version": "74.27.0",
4
4
  "sideEffects": false
5
5
  }
@@ -21,6 +21,7 @@ export let TABLE_ACTION = /*#__PURE__*/function (TABLE_ACTION) {
21
21
  TABLE_ACTION["ATTEMPTED_TABLE_WIDTH_CHANGE"] = "attemptedTableWidthChange";
22
22
  TABLE_ACTION["DISTRIBUTED_COLUMNS_WIDTHS"] = "distributedColumnsWidths";
23
23
  TABLE_ACTION["FIXED"] = "fixed";
24
+ TABLE_ACTION["RESIZED"] = "resized";
24
25
  return TABLE_ACTION;
25
26
  }({});
26
27
  export let TABLE_BREAKOUT = /*#__PURE__*/function (TABLE_BREAKOUT) {
@@ -1,7 +1,7 @@
1
1
  import { NodeSelection } from 'prosemirror-state';
2
2
  import { findChildren } from 'prosemirror-utils';
3
+ import { getMediaSinglePixelWidth } from '../media-single';
3
4
  import { MEDIA_DYNAMIC_GUIDELINE_PREFIX } from './constants';
4
- import { WidthTypes } from './types';
5
5
  export const generateDynamicGuidelines = (state, editorWidth) => {
6
6
  const selectedNode = state.selection instanceof NodeSelection && state.selection.node;
7
7
  const mediaSingleNode = findChildren(state.tr.doc, node => {
@@ -21,7 +21,7 @@ export const generateDynamicGuidelines = (state, editorWidth) => {
21
21
  width,
22
22
  widthType
23
23
  } = node.attrs;
24
- const pixelWidth = !widthType || widthType === WidthTypes.PERCENTAGE ? width / 100 * editorWidth : width;
24
+ const pixelWidth = getMediaSinglePixelWidth(width, editorWidth, widthType);
25
25
  const commonStyles = {
26
26
  style: 'dashed',
27
27
  show: true
@@ -1,3 +1,5 @@
1
1
  export const MEDIA_SINGLE_MIN_PIXEL_WIDTH = 24;
2
2
  export const MEDIA_SINGLE_SNAP_GAP = 3;
3
- export const MEDIA_SINGLE_HIGHLIGHT_GAP = 10;
3
+ export const MEDIA_SINGLE_HIGHLIGHT_GAP = 10;
4
+ export const MEDIA_SINGLE_HANDLE_MARGIN = 12;
5
+ export const MEDIA_SINGLE_GUTTER_SIZE = MEDIA_SINGLE_HANDLE_MARGIN * 2;
@@ -1 +1,2 @@
1
- export { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP } from './constants';
1
+ export { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP } from './constants';
2
+ export { getMediaSinglePixelWidth } from './utils';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Convert media node width to pixel
3
+ *
4
+ * for legacy experience, image is aligned inside resize handle bar with a gap. So gutterOffset is used to for this use case.
5
+ * for new expereience, image is aligned with resize handle bar, so gutterOffset is 0
6
+ *
7
+ * @param width - media single node width
8
+ * @param editorWidth - width of editor
9
+ * @param widthType - width type is defined in the adf document for mediaSingle node, and it is assoicated with the `width`
10
+ * @param gutterOffset - resize handle bar offset, determines whether align with resize handle bar
11
+ * @returns pixel number for media single node
12
+ */
13
+ export function getMediaSinglePixelWidth(width, editorWidth, widthType = 'percentage', gutterOffset = 0) {
14
+ if (widthType === 'pixel') {
15
+ return width;
16
+ }
17
+ return Math.ceil((editorWidth + gutterOffset) * (width / 100) - gutterOffset);
18
+ }
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "74.26.8";
3
+ const packageVersion = "74.27.0";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
8
8
  import { borderRadius } from '@atlaskit/theme/constants';
9
9
  import Layer from '../Layer';
10
10
  const packageName = "@atlaskit/editor-common";
11
- const packageVersion = "74.26.8";
11
+ const packageVersion = "74.27.0";
12
12
  const halfFocusRing = 1;
13
13
  const dropOffset = '0, 8';
14
14
  class DropList extends Component {
@@ -1,23 +1,22 @@
1
1
  import { akEditorBreakoutPadding, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
2
- const handleMargin = 12;
3
- const gutterSize = handleMargin * 2;
2
+ import { MEDIA_SINGLE_GUTTER_SIZE } from '../../media-single/constants';
4
3
  const validWidthModes = ['center', 'wrap-left', 'wrap-right', 'align-start', 'align-end'];
5
4
  export const layoutSupportsWidth = layout => validWidthModes.indexOf(layout) > -1;
6
5
  export function calcPxFromColumns(columns, lineLength, gridSize) {
7
- const maxWidth = lineLength + gutterSize;
8
- return maxWidth / gridSize * columns - gutterSize;
6
+ const maxWidth = lineLength + MEDIA_SINGLE_GUTTER_SIZE;
7
+ return maxWidth / gridSize * columns - MEDIA_SINGLE_GUTTER_SIZE;
9
8
  }
10
9
  export function calcColumnsFromPx(width, lineLength, gridSize) {
11
- const maxWidth = lineLength + gutterSize;
12
- return (width + gutterSize) * gridSize / maxWidth;
10
+ const maxWidth = lineLength + MEDIA_SINGLE_GUTTER_SIZE;
11
+ return (width + MEDIA_SINGLE_GUTTER_SIZE) * gridSize / maxWidth;
13
12
  }
14
13
  export function calcPxFromPct(pct, lineLength) {
15
- const maxWidth = lineLength + gutterSize;
16
- return maxWidth * pct - gutterSize;
14
+ const maxWidth = lineLength + MEDIA_SINGLE_GUTTER_SIZE;
15
+ return maxWidth * pct - MEDIA_SINGLE_GUTTER_SIZE;
17
16
  }
18
17
  export function calcPctFromPx(width, lineLength) {
19
- const maxWidth = lineLength + gutterSize;
20
- return (width + gutterSize) / maxWidth;
18
+ const maxWidth = lineLength + MEDIA_SINGLE_GUTTER_SIZE;
19
+ return (width + MEDIA_SINGLE_GUTTER_SIZE) / maxWidth;
21
20
  }
22
21
  export const wrappedLayouts = ['wrap-left', 'wrap-right', 'align-end', 'align-start'];
23
22
  const calcPctWidth = (containerWidth, pctWidth, origWidth, origHeight) => pctWidth && origWidth && origHeight && Math.ceil(calcPxFromPct(pctWidth / 100, containerWidth.lineLength || containerWidth.width));
@@ -3,7 +3,9 @@ import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  import classnames from 'classnames';
5
5
  import { akEditorMediaResizeHandlerPaddingWide, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
6
- import { calcPxFromPct, wrappedLayouts } from './grid';
6
+ import { MEDIA_SINGLE_GUTTER_SIZE } from '../../media-single/constants';
7
+ import { getMediaSinglePixelWidth } from '../../media-single/utils';
8
+ import { wrappedLayouts } from './grid';
7
9
  import { MediaSingleDimensionHelper, MediaWrapper } from './styled';
8
10
  export const DEFAULT_IMAGE_WIDTH = 250;
9
11
  export const DEFAULT_IMAGE_HEIGHT = 200;
@@ -28,22 +30,23 @@ export default function MediaSingle({
28
30
  children: propsChildren,
29
31
  nodeType = 'mediaSingle',
30
32
  fullWidthMode,
31
- lineLength,
33
+ lineLength: editorWidth,
32
34
  hasFallbackContainer = true,
33
35
  handleMediaSingleRef
34
36
  }) {
35
37
  const isPixelWidth = (size === null || size === void 0 ? void 0 : size.widthType) === 'pixel';
36
38
  let mediaSingleWidth = (size === null || size === void 0 ? void 0 : size.width) || pctWidth;
37
39
  const children = React.Children.toArray(propsChildren);
38
- if (!mediaSingleWidth && shouldAddDefaultWrappedWidth(layout, width, lineLength)) {
39
- mediaSingleWidth = isPixelWidth ? lineLength / 2 : 50;
40
+ if (!mediaSingleWidth && shouldAddDefaultWrappedWidth(layout, width, editorWidth)) {
41
+ // if width is not available, set to half of editor width
42
+ mediaSingleWidth = isPixelWidth ? editorWidth / 2 : 50;
40
43
  }
41
44
  // When width is not set we have an absolute height for a given embed.
42
45
  // When both width and height are set we use them to determine ratio and use that to define
43
46
  // embed height in relation to whatever width of an dom element is in runtime
44
47
  const isHeightOnly = width === undefined;
45
48
  if (mediaSingleWidth) {
46
- const pxWidth = isPixelWidth ? mediaSingleWidth : Math.ceil(calcPxFromPct(mediaSingleWidth / 100, lineLength || containerWidth || 0));
49
+ const pxWidth = getMediaSinglePixelWidth(mediaSingleWidth, editorWidth, size === null || size === void 0 ? void 0 : size.widthType, MEDIA_SINGLE_GUTTER_SIZE);
47
50
  if (isHeightOnly) {
48
51
  width = pxWidth - akEditorMediaResizeHandlerPaddingWide;
49
52
  } else if (width !== undefined) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.26.8",
3
+ "version": "74.27.0",
4
4
  "sideEffects": false
5
5
  }
@@ -21,6 +21,7 @@ export var TABLE_ACTION = /*#__PURE__*/function (TABLE_ACTION) {
21
21
  TABLE_ACTION["ATTEMPTED_TABLE_WIDTH_CHANGE"] = "attemptedTableWidthChange";
22
22
  TABLE_ACTION["DISTRIBUTED_COLUMNS_WIDTHS"] = "distributedColumnsWidths";
23
23
  TABLE_ACTION["FIXED"] = "fixed";
24
+ TABLE_ACTION["RESIZED"] = "resized";
24
25
  return TABLE_ACTION;
25
26
  }({});
26
27
  export var TABLE_BREAKOUT = /*#__PURE__*/function (TABLE_BREAKOUT) {
@@ -3,8 +3,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
4
  import { NodeSelection } from 'prosemirror-state';
5
5
  import { findChildren } from 'prosemirror-utils';
6
+ import { getMediaSinglePixelWidth } from '../media-single';
6
7
  import { MEDIA_DYNAMIC_GUIDELINE_PREFIX } from './constants';
7
- import { WidthTypes } from './types';
8
8
  export var generateDynamicGuidelines = function generateDynamicGuidelines(state, editorWidth) {
9
9
  var selectedNode = state.selection instanceof NodeSelection && state.selection.node;
10
10
  var mediaSingleNode = findChildren(state.tr.doc, function (node) {
@@ -22,7 +22,7 @@ export var generateDynamicGuidelines = function generateDynamicGuidelines(state,
22
22
  layout = _node$attrs.layout,
23
23
  width = _node$attrs.width,
24
24
  widthType = _node$attrs.widthType;
25
- var pixelWidth = !widthType || widthType === WidthTypes.PERCENTAGE ? width / 100 * editorWidth : width;
25
+ var pixelWidth = getMediaSinglePixelWidth(width, editorWidth, widthType);
26
26
  var commonStyles = {
27
27
  style: 'dashed',
28
28
  show: true
@@ -1,3 +1,5 @@
1
1
  export var MEDIA_SINGLE_MIN_PIXEL_WIDTH = 24;
2
2
  export var MEDIA_SINGLE_SNAP_GAP = 3;
3
- export var MEDIA_SINGLE_HIGHLIGHT_GAP = 10;
3
+ export var MEDIA_SINGLE_HIGHLIGHT_GAP = 10;
4
+ export var MEDIA_SINGLE_HANDLE_MARGIN = 12;
5
+ export var MEDIA_SINGLE_GUTTER_SIZE = MEDIA_SINGLE_HANDLE_MARGIN * 2;
@@ -1 +1,2 @@
1
- export { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP } from './constants';
1
+ export { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP } from './constants';
2
+ export { getMediaSinglePixelWidth } from './utils';
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Convert media node width to pixel
3
+ *
4
+ * for legacy experience, image is aligned inside resize handle bar with a gap. So gutterOffset is used to for this use case.
5
+ * for new expereience, image is aligned with resize handle bar, so gutterOffset is 0
6
+ *
7
+ * @param width - media single node width
8
+ * @param editorWidth - width of editor
9
+ * @param widthType - width type is defined in the adf document for mediaSingle node, and it is assoicated with the `width`
10
+ * @param gutterOffset - resize handle bar offset, determines whether align with resize handle bar
11
+ * @returns pixel number for media single node
12
+ */
13
+ export function getMediaSinglePixelWidth(width, editorWidth) {
14
+ var widthType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'percentage';
15
+ var gutterOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
16
+ if (widthType === 'pixel') {
17
+ return width;
18
+ }
19
+ return Math.ceil((editorWidth + gutterOffset) * (width / 100) - gutterOffset);
20
+ }
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "74.26.8";
9
+ var packageVersion = "74.27.0";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
18
18
  import { borderRadius } from '@atlaskit/theme/constants';
19
19
  import Layer from '../Layer';
20
20
  var packageName = "@atlaskit/editor-common";
21
- var packageVersion = "74.26.8";
21
+ var packageVersion = "74.27.0";
22
22
  var halfFocusRing = 1;
23
23
  var dropOffset = '0, 8';
24
24
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,25 +1,24 @@
1
1
  import { akEditorBreakoutPadding, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
2
- var handleMargin = 12;
3
- var gutterSize = handleMargin * 2;
2
+ import { MEDIA_SINGLE_GUTTER_SIZE } from '../../media-single/constants';
4
3
  var validWidthModes = ['center', 'wrap-left', 'wrap-right', 'align-start', 'align-end'];
5
4
  export var layoutSupportsWidth = function layoutSupportsWidth(layout) {
6
5
  return validWidthModes.indexOf(layout) > -1;
7
6
  };
8
7
  export function calcPxFromColumns(columns, lineLength, gridSize) {
9
- var maxWidth = lineLength + gutterSize;
10
- return maxWidth / gridSize * columns - gutterSize;
8
+ var maxWidth = lineLength + MEDIA_SINGLE_GUTTER_SIZE;
9
+ return maxWidth / gridSize * columns - MEDIA_SINGLE_GUTTER_SIZE;
11
10
  }
12
11
  export function calcColumnsFromPx(width, lineLength, gridSize) {
13
- var maxWidth = lineLength + gutterSize;
14
- return (width + gutterSize) * gridSize / maxWidth;
12
+ var maxWidth = lineLength + MEDIA_SINGLE_GUTTER_SIZE;
13
+ return (width + MEDIA_SINGLE_GUTTER_SIZE) * gridSize / maxWidth;
15
14
  }
16
15
  export function calcPxFromPct(pct, lineLength) {
17
- var maxWidth = lineLength + gutterSize;
18
- return maxWidth * pct - gutterSize;
16
+ var maxWidth = lineLength + MEDIA_SINGLE_GUTTER_SIZE;
17
+ return maxWidth * pct - MEDIA_SINGLE_GUTTER_SIZE;
19
18
  }
20
19
  export function calcPctFromPx(width, lineLength) {
21
- var maxWidth = lineLength + gutterSize;
22
- return (width + gutterSize) / maxWidth;
20
+ var maxWidth = lineLength + MEDIA_SINGLE_GUTTER_SIZE;
21
+ return (width + MEDIA_SINGLE_GUTTER_SIZE) / maxWidth;
23
22
  }
24
23
  export var wrappedLayouts = ['wrap-left', 'wrap-right', 'align-end', 'align-start'];
25
24
  var calcPctWidth = function calcPctWidth(containerWidth, pctWidth, origWidth, origHeight) {
@@ -4,7 +4,9 @@ import React from 'react';
4
4
  import { jsx } from '@emotion/react';
5
5
  import classnames from 'classnames';
6
6
  import { akEditorMediaResizeHandlerPaddingWide, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
7
- import { calcPxFromPct, wrappedLayouts } from './grid';
7
+ import { MEDIA_SINGLE_GUTTER_SIZE } from '../../media-single/constants';
8
+ import { getMediaSinglePixelWidth } from '../../media-single/utils';
9
+ import { wrappedLayouts } from './grid';
8
10
  import { MediaSingleDimensionHelper, MediaWrapper } from './styled';
9
11
  export var DEFAULT_IMAGE_WIDTH = 250;
10
12
  export var DEFAULT_IMAGE_HEIGHT = 200;
@@ -32,22 +34,23 @@ export default function MediaSingle(_ref) {
32
34
  _ref$nodeType = _ref.nodeType,
33
35
  nodeType = _ref$nodeType === void 0 ? 'mediaSingle' : _ref$nodeType,
34
36
  fullWidthMode = _ref.fullWidthMode,
35
- lineLength = _ref.lineLength,
37
+ editorWidth = _ref.lineLength,
36
38
  _ref$hasFallbackConta = _ref.hasFallbackContainer,
37
39
  hasFallbackContainer = _ref$hasFallbackConta === void 0 ? true : _ref$hasFallbackConta,
38
40
  handleMediaSingleRef = _ref.handleMediaSingleRef;
39
41
  var isPixelWidth = (size === null || size === void 0 ? void 0 : size.widthType) === 'pixel';
40
42
  var mediaSingleWidth = (size === null || size === void 0 ? void 0 : size.width) || pctWidth;
41
43
  var children = React.Children.toArray(propsChildren);
42
- if (!mediaSingleWidth && shouldAddDefaultWrappedWidth(layout, width, lineLength)) {
43
- mediaSingleWidth = isPixelWidth ? lineLength / 2 : 50;
44
+ if (!mediaSingleWidth && shouldAddDefaultWrappedWidth(layout, width, editorWidth)) {
45
+ // if width is not available, set to half of editor width
46
+ mediaSingleWidth = isPixelWidth ? editorWidth / 2 : 50;
44
47
  }
45
48
  // When width is not set we have an absolute height for a given embed.
46
49
  // When both width and height are set we use them to determine ratio and use that to define
47
50
  // embed height in relation to whatever width of an dom element is in runtime
48
51
  var isHeightOnly = width === undefined;
49
52
  if (mediaSingleWidth) {
50
- var pxWidth = isPixelWidth ? mediaSingleWidth : Math.ceil(calcPxFromPct(mediaSingleWidth / 100, lineLength || containerWidth || 0));
53
+ var pxWidth = getMediaSinglePixelWidth(mediaSingleWidth, editorWidth, size === null || size === void 0 ? void 0 : size.widthType, MEDIA_SINGLE_GUTTER_SIZE);
51
54
  if (isHeightOnly) {
52
55
  width = pxWidth - akEditorMediaResizeHandlerPaddingWide;
53
56
  } else if (width !== undefined) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.26.8",
3
+ "version": "74.27.0",
4
4
  "sideEffects": false
5
5
  }
@@ -22,7 +22,8 @@ export declare enum TABLE_ACTION {
22
22
  REPLACED = "replaced",
23
23
  ATTEMPTED_TABLE_WIDTH_CHANGE = "attemptedTableWidthChange",
24
24
  DISTRIBUTED_COLUMNS_WIDTHS = "distributedColumnsWidths",
25
- FIXED = "fixed"
25
+ FIXED = "fixed",
26
+ RESIZED = "resized"
26
27
  }
27
28
  export declare enum TABLE_BREAKOUT {
28
29
  WIDE = "wide",
@@ -50,6 +51,12 @@ type AttemptedResizeInfo = {
50
51
  duration: number;
51
52
  delta: number;
52
53
  };
54
+ type ResizedInfo = {
55
+ prevWidth: number | null;
56
+ newWidth: number;
57
+ totalTableWidth: number | null;
58
+ nodeSize: number;
59
+ } & TotalRowAndColCount;
53
60
  type TableDeleteAEP = TableAEP<TABLE_ACTION.DELETED, {
54
61
  inputMethod: INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB;
55
62
  } & TotalRowAndColCount, undefined>;
@@ -98,5 +105,6 @@ type TableCollapsedAEP = TableAEP<TABLE_ACTION.COLLAPSED, TotalRowAndColCount, u
98
105
  type TableFixedAEP = TableAEP<TABLE_ACTION.FIXED, {
99
106
  reason: string;
100
107
  }, undefined>;
101
- export type TableEventPayload = TableDeleteAEP | TableClearAEP | TableMergeSplitAEP | TableColorAEP | TableToggleHeaderAEP | TableChangeBreakoutAEP | TableCopyAndCutAEP | TableAddRowOrColumnAEP | TableSortColumnAEP | TableDeleteRowOrColumnAEP | TableReplaceAEP | TableAttemptedResizeAEP | TableDistributeColumnsWidthsAEP | TableCollapsedAEP | TableFixedAEP;
108
+ type TableResizedAEP = TableAEP<TABLE_ACTION.RESIZED, ResizedInfo, undefined>;
109
+ export type TableEventPayload = TableDeleteAEP | TableClearAEP | TableMergeSplitAEP | TableColorAEP | TableToggleHeaderAEP | TableChangeBreakoutAEP | TableCopyAndCutAEP | TableAddRowOrColumnAEP | TableSortColumnAEP | TableDeleteRowOrColumnAEP | TableReplaceAEP | TableAttemptedResizeAEP | TableDistributeColumnsWidthsAEP | TableCollapsedAEP | TableFixedAEP | TableResizedAEP;
102
110
  export {};
@@ -1,3 +1,5 @@
1
1
  export declare const MEDIA_SINGLE_MIN_PIXEL_WIDTH = 24;
2
2
  export declare const MEDIA_SINGLE_SNAP_GAP = 3;
3
3
  export declare const MEDIA_SINGLE_HIGHLIGHT_GAP = 10;
4
+ export declare const MEDIA_SINGLE_HANDLE_MARGIN = 12;
5
+ export declare const MEDIA_SINGLE_GUTTER_SIZE: number;
@@ -1 +1,2 @@
1
1
  export { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, } from './constants';
2
+ export { getMediaSinglePixelWidth } from './utils';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Convert media node width to pixel
3
+ *
4
+ * for legacy experience, image is aligned inside resize handle bar with a gap. So gutterOffset is used to for this use case.
5
+ * for new expereience, image is aligned with resize handle bar, so gutterOffset is 0
6
+ *
7
+ * @param width - media single node width
8
+ * @param editorWidth - width of editor
9
+ * @param widthType - width type is defined in the adf document for mediaSingle node, and it is assoicated with the `width`
10
+ * @param gutterOffset - resize handle bar offset, determines whether align with resize handle bar
11
+ * @returns pixel number for media single node
12
+ */
13
+ export declare function getMediaSinglePixelWidth(width: number, editorWidth: number, widthType?: string, gutterOffset?: number): number;
@@ -29,4 +29,4 @@ export interface Props {
29
29
  }
30
30
  export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
31
31
  export type { MediaSingleWidthType, MediaSingleSize };
32
- export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
32
+ export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength: editorWidth, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
@@ -22,7 +22,8 @@ export declare enum TABLE_ACTION {
22
22
  REPLACED = "replaced",
23
23
  ATTEMPTED_TABLE_WIDTH_CHANGE = "attemptedTableWidthChange",
24
24
  DISTRIBUTED_COLUMNS_WIDTHS = "distributedColumnsWidths",
25
- FIXED = "fixed"
25
+ FIXED = "fixed",
26
+ RESIZED = "resized"
26
27
  }
27
28
  export declare enum TABLE_BREAKOUT {
28
29
  WIDE = "wide",
@@ -50,6 +51,12 @@ type AttemptedResizeInfo = {
50
51
  duration: number;
51
52
  delta: number;
52
53
  };
54
+ type ResizedInfo = {
55
+ prevWidth: number | null;
56
+ newWidth: number;
57
+ totalTableWidth: number | null;
58
+ nodeSize: number;
59
+ } & TotalRowAndColCount;
53
60
  type TableDeleteAEP = TableAEP<TABLE_ACTION.DELETED, {
54
61
  inputMethod: INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB;
55
62
  } & TotalRowAndColCount, undefined>;
@@ -98,5 +105,6 @@ type TableCollapsedAEP = TableAEP<TABLE_ACTION.COLLAPSED, TotalRowAndColCount, u
98
105
  type TableFixedAEP = TableAEP<TABLE_ACTION.FIXED, {
99
106
  reason: string;
100
107
  }, undefined>;
101
- export type TableEventPayload = TableDeleteAEP | TableClearAEP | TableMergeSplitAEP | TableColorAEP | TableToggleHeaderAEP | TableChangeBreakoutAEP | TableCopyAndCutAEP | TableAddRowOrColumnAEP | TableSortColumnAEP | TableDeleteRowOrColumnAEP | TableReplaceAEP | TableAttemptedResizeAEP | TableDistributeColumnsWidthsAEP | TableCollapsedAEP | TableFixedAEP;
108
+ type TableResizedAEP = TableAEP<TABLE_ACTION.RESIZED, ResizedInfo, undefined>;
109
+ export type TableEventPayload = TableDeleteAEP | TableClearAEP | TableMergeSplitAEP | TableColorAEP | TableToggleHeaderAEP | TableChangeBreakoutAEP | TableCopyAndCutAEP | TableAddRowOrColumnAEP | TableSortColumnAEP | TableDeleteRowOrColumnAEP | TableReplaceAEP | TableAttemptedResizeAEP | TableDistributeColumnsWidthsAEP | TableCollapsedAEP | TableFixedAEP | TableResizedAEP;
102
110
  export {};
@@ -1,3 +1,5 @@
1
1
  export declare const MEDIA_SINGLE_MIN_PIXEL_WIDTH = 24;
2
2
  export declare const MEDIA_SINGLE_SNAP_GAP = 3;
3
3
  export declare const MEDIA_SINGLE_HIGHLIGHT_GAP = 10;
4
+ export declare const MEDIA_SINGLE_HANDLE_MARGIN = 12;
5
+ export declare const MEDIA_SINGLE_GUTTER_SIZE: number;
@@ -1 +1,2 @@
1
1
  export { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_HIGHLIGHT_GAP, } from './constants';
2
+ export { getMediaSinglePixelWidth } from './utils';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Convert media node width to pixel
3
+ *
4
+ * for legacy experience, image is aligned inside resize handle bar with a gap. So gutterOffset is used to for this use case.
5
+ * for new expereience, image is aligned with resize handle bar, so gutterOffset is 0
6
+ *
7
+ * @param width - media single node width
8
+ * @param editorWidth - width of editor
9
+ * @param widthType - width type is defined in the adf document for mediaSingle node, and it is assoicated with the `width`
10
+ * @param gutterOffset - resize handle bar offset, determines whether align with resize handle bar
11
+ * @returns pixel number for media single node
12
+ */
13
+ export declare function getMediaSinglePixelWidth(width: number, editorWidth: number, widthType?: string, gutterOffset?: number): number;
@@ -29,4 +29,4 @@ export interface Props {
29
29
  }
30
30
  export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
31
31
  export type { MediaSingleWidthType, MediaSingleSize };
32
- export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
32
+ export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength: editorWidth, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.26.8",
3
+ "version": "74.27.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/"
@@ -78,7 +78,7 @@
78
78
  },
79
79
  "dependencies": {
80
80
  "@atlaskit/activity-provider": "^2.4.0",
81
- "@atlaskit/adf-schema": "^26.2.0",
81
+ "@atlaskit/adf-schema": "^26.3.0",
82
82
  "@atlaskit/adf-utils": "^19.0.0",
83
83
  "@atlaskit/analytics-listeners": "^8.7.0",
84
84
  "@atlaskit/analytics-namespaced-context": "^6.7.0",