@atlaskit/editor-plugin-media 14.2.1 → 14.2.3

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-plugin-media
2
2
 
3
+ ## 14.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1586e012495ed`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1586e012495ed) -
8
+ [ux] Disables left resize handle on media nodes except for when media is aligned or wrapped right.
9
+
10
+ ## 14.2.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 14.2.1
4
17
 
5
18
  ### Patch Changes
@@ -21,10 +21,12 @@ var _utils = require("@atlaskit/editor-common/utils");
21
21
  var _state = require("@atlaskit/editor-prosemirror/state");
22
22
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
23
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
24
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
24
25
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
25
26
  var _main = require("../../pm-plugins/main");
26
27
  var _analytics = require("../../pm-plugins/utils/analytics");
27
28
  var _checkMediaType = require("../../pm-plugins/utils/check-media-type");
29
+ var _constants = require("./constants");
28
30
  var _ResizableMediaMigrationNotification = require("./ResizableMediaMigrationNotification");
29
31
  var _styled = require("./styled");
30
32
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -285,8 +287,16 @@ var ResizableMediaSingleNextFunctional = exports.ResizableMediaSingleNextFunctio
285
287
  right: false
286
288
  };
287
289
  }
290
+ var isLeftResizeHandleDisabled = (0, _expValEquals.expValEquals)('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true);
288
291
  return _ui.handleSides.reduce(function (acc, side) {
289
292
  var oppositeSide = side === 'left' ? 'right' : 'left';
293
+
294
+ // Disable the left handle up-front (except for layouts where it is the
295
+ // only handle) before computing whether it would otherwise be enabled.
296
+ if (side === 'left' && isLeftResizeHandleDisabled && _constants.leftHandleOnlyLayouts.indexOf(layout) === -1) {
297
+ acc[side] = false;
298
+ return acc;
299
+ }
290
300
  acc[side] = _utils.nonWrappedLayouts.concat("wrap-".concat(oppositeSide)).concat("align-".concat(_ui.imageAlignmentMap[oppositeSide])).indexOf(layout) > -1;
291
301
  if (side === 'left' && isInsideInlineLike) {
292
302
  acc[side] = false;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.leftHandleOnlyLayouts = void 0;
7
+ // Layouts where the left handle is the only resize handle today.
8
+ // These must keep the left handle.
9
+ var leftHandleOnlyLayouts = exports.leftHandleOnlyLayouts = ['wrap-right', 'align-end'];
@@ -23,6 +23,7 @@ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
23
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
24
24
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
25
25
  var _checkMediaType = require("../../pm-plugins/utils/check-media-type");
26
+ var _constants = require("./constants");
26
27
  var _styled = require("./styled");
27
28
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
28
29
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
@@ -364,6 +365,7 @@ var ResizableMediaSingle = exports.default = /*#__PURE__*/function (_React$Compo
364
365
  if (origWidth) {
365
366
  ratio = (origHeight / origWidth * 100).toFixed(3);
366
367
  }
368
+ var isLeftResizeHandleDisabled = (0, _expValEquals.expValEquals)('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true);
367
369
  var enable = {};
368
370
  _ui.handleSides.forEach(function (side) {
369
371
  var oppositeSide = side === 'left' ? 'right' : 'left';
@@ -371,6 +373,13 @@ var ResizableMediaSingle = exports.default = /*#__PURE__*/function (_React$Compo
371
373
  enable[side] = false;
372
374
  return;
373
375
  }
376
+
377
+ // Disable the left handle up-front (except for layouts where it is the
378
+ // only handle) before computing whether it would otherwise be enabled.
379
+ if (side === 'left' && isLeftResizeHandleDisabled && _constants.leftHandleOnlyLayouts.indexOf(layout) === -1) {
380
+ enable[side] = false;
381
+ return;
382
+ }
374
383
  enable[side] = ['full-width', 'wide', 'center'].concat("wrap-".concat(oppositeSide)).concat("align-".concat(_ui.imageAlignmentMap[oppositeSide])).indexOf(layout) > -1;
375
384
  if (side === 'left' && _this2.insideInlineLike) {
376
385
  enable[side] = false;
@@ -17,10 +17,12 @@ import { nonWrappedLayouts } from '@atlaskit/editor-common/utils';
17
17
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
18
18
  import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
19
19
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
20
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
20
21
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
21
22
  import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
22
23
  import { getMediaResizeAnalyticsEvent } from '../../pm-plugins/utils/analytics';
23
24
  import { checkMediaType } from '../../pm-plugins/utils/check-media-type';
25
+ import { leftHandleOnlyLayouts } from './constants';
24
26
  import { ResizableMediaMigrationNotification } from './ResizableMediaMigrationNotification';
25
27
  import { wrapperStyle } from './styled';
26
28
  export const resizerNextTestId = 'mediaSingle.resizerNext.testid';
@@ -264,8 +266,16 @@ export const ResizableMediaSingleNextFunctional = props => {
264
266
  right: false
265
267
  };
266
268
  }
269
+ const isLeftResizeHandleDisabled = expValEquals('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true);
267
270
  return handleSides.reduce((acc, side) => {
268
271
  const oppositeSide = side === 'left' ? 'right' : 'left';
272
+
273
+ // Disable the left handle up-front (except for layouts where it is the
274
+ // only handle) before computing whether it would otherwise be enabled.
275
+ if (side === 'left' && isLeftResizeHandleDisabled && leftHandleOnlyLayouts.indexOf(layout) === -1) {
276
+ acc[side] = false;
277
+ return acc;
278
+ }
269
279
  acc[side] = nonWrappedLayouts.concat(`wrap-${oppositeSide}`).concat(`align-${imageAlignmentMap[oppositeSide]}`).indexOf(layout) > -1;
270
280
  if (side === 'left' && isInsideInlineLike) {
271
281
  acc[side] = false;
@@ -0,0 +1,3 @@
1
+ // Layouts where the left handle is the only resize handle today.
2
+ // These must keep the left handle.
3
+ export const leftHandleOnlyLayouts = ['wrap-right', 'align-end'];
@@ -15,6 +15,7 @@ import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit
15
15
  import { akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
16
16
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
17
17
  import { checkMediaType } from '../../pm-plugins/utils/check-media-type';
18
+ import { leftHandleOnlyLayouts } from './constants';
18
19
  import { wrapperStyle } from './styled';
19
20
  // eslint-disable-next-line @repo/internal/react/no-class-components
20
21
  export default class ResizableMediaSingle extends React.Component {
@@ -294,6 +295,7 @@ export default class ResizableMediaSingle extends React.Component {
294
295
  if (origWidth) {
295
296
  ratio = (origHeight / origWidth * 100).toFixed(3);
296
297
  }
298
+ const isLeftResizeHandleDisabled = expValEquals('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true);
297
299
  const enable = {};
298
300
  handleSides.forEach(side => {
299
301
  const oppositeSide = side === 'left' ? 'right' : 'left';
@@ -301,6 +303,13 @@ export default class ResizableMediaSingle extends React.Component {
301
303
  enable[side] = false;
302
304
  return;
303
305
  }
306
+
307
+ // Disable the left handle up-front (except for layouts where it is the
308
+ // only handle) before computing whether it would otherwise be enabled.
309
+ if (side === 'left' && isLeftResizeHandleDisabled && leftHandleOnlyLayouts.indexOf(layout) === -1) {
310
+ enable[side] = false;
311
+ return;
312
+ }
304
313
  enable[side] = ['full-width', 'wide', 'center'].concat(`wrap-${oppositeSide}`).concat(`align-${imageAlignmentMap[oppositeSide]}`).indexOf(layout) > -1;
305
314
  if (side === 'left' && this.insideInlineLike) {
306
315
  enable[side] = false;
@@ -19,10 +19,12 @@ import { nonWrappedLayouts } from '@atlaskit/editor-common/utils';
19
19
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
20
20
  import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
21
21
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
22
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
22
23
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
23
24
  import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
24
25
  import { getMediaResizeAnalyticsEvent } from '../../pm-plugins/utils/analytics';
25
26
  import { checkMediaType } from '../../pm-plugins/utils/check-media-type';
27
+ import { leftHandleOnlyLayouts } from './constants';
26
28
  import { ResizableMediaMigrationNotification } from './ResizableMediaMigrationNotification';
27
29
  import { wrapperStyle } from './styled';
28
30
  export var resizerNextTestId = 'mediaSingle.resizerNext.testid';
@@ -275,8 +277,16 @@ export var ResizableMediaSingleNextFunctional = function ResizableMediaSingleNex
275
277
  right: false
276
278
  };
277
279
  }
280
+ var isLeftResizeHandleDisabled = expValEquals('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true);
278
281
  return handleSides.reduce(function (acc, side) {
279
282
  var oppositeSide = side === 'left' ? 'right' : 'left';
283
+
284
+ // Disable the left handle up-front (except for layouts where it is the
285
+ // only handle) before computing whether it would otherwise be enabled.
286
+ if (side === 'left' && isLeftResizeHandleDisabled && leftHandleOnlyLayouts.indexOf(layout) === -1) {
287
+ acc[side] = false;
288
+ return acc;
289
+ }
280
290
  acc[side] = nonWrappedLayouts.concat("wrap-".concat(oppositeSide)).concat("align-".concat(imageAlignmentMap[oppositeSide])).indexOf(layout) > -1;
281
291
  if (side === 'left' && isInsideInlineLike) {
282
292
  acc[side] = false;
@@ -0,0 +1,3 @@
1
+ // Layouts where the left handle is the only resize handle today.
2
+ // These must keep the left handle.
3
+ export var leftHandleOnlyLayouts = ['wrap-right', 'align-end'];
@@ -24,6 +24,7 @@ import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit
24
24
  import { akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
25
25
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
26
26
  import { checkMediaType } from '../../pm-plugins/utils/check-media-type';
27
+ import { leftHandleOnlyLayouts } from './constants';
27
28
  import { wrapperStyle } from './styled';
28
29
  // eslint-disable-next-line @repo/internal/react/no-class-components
29
30
  var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
@@ -360,6 +361,7 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
360
361
  if (origWidth) {
361
362
  ratio = (origHeight / origWidth * 100).toFixed(3);
362
363
  }
364
+ var isLeftResizeHandleDisabled = expValEquals('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true);
363
365
  var enable = {};
364
366
  handleSides.forEach(function (side) {
365
367
  var oppositeSide = side === 'left' ? 'right' : 'left';
@@ -367,6 +369,13 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
367
369
  enable[side] = false;
368
370
  return;
369
371
  }
372
+
373
+ // Disable the left handle up-front (except for layouts where it is the
374
+ // only handle) before computing whether it would otherwise be enabled.
375
+ if (side === 'left' && isLeftResizeHandleDisabled && leftHandleOnlyLayouts.indexOf(layout) === -1) {
376
+ enable[side] = false;
377
+ return;
378
+ }
370
379
  enable[side] = ['full-width', 'wide', 'center'].concat("wrap-".concat(oppositeSide)).concat("align-".concat(imageAlignmentMap[oppositeSide])).indexOf(layout) > -1;
371
380
  if (side === 'left' && _this2.insideInlineLike) {
372
381
  enable[side] = false;
@@ -0,0 +1,2 @@
1
+ import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
2
+ export declare const leftHandleOnlyLayouts: MediaSingleLayout[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "14.2.1",
3
+ "version": "14.2.3",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/platform-feature-flags": "^2.0.0",
58
58
  "@atlaskit/primitives": "^20.0.0",
59
59
  "@atlaskit/textfield": "^9.0.0",
60
- "@atlaskit/tmp-editor-statsig": "^110.0.0",
60
+ "@atlaskit/tmp-editor-statsig": "^111.0.0",
61
61
  "@atlaskit/tokens": "^15.0.0",
62
62
  "@atlaskit/tooltip": "^23.0.0",
63
63
  "@babel/runtime": "^7.0.0",