@atlaskit/editor-plugin-card 18.0.8 → 18.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 18.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`615699cf079c8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/615699cf079c8) -
8
+ [ux] Disables left resize handle on embed nodes except for when embed is aligned or wrapped right.
9
+
3
10
  ## 18.0.8
4
11
 
5
12
  ### Patch Changes
@@ -19,6 +19,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
19
19
  var _utils = require("@atlaskit/editor-prosemirror/utils");
20
20
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
21
21
  var _smartCard = require("@atlaskit/smart-card");
22
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
22
23
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
23
24
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
24
25
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -27,6 +28,10 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
27
28
  * @jsxRuntime classic
28
29
  * @jsx jsx
29
30
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
31
+ // Layouts where the left handle is the only resize handle today.
32
+ // These must keep the left handle.
33
+ // Remove during 'platform_editor_lovability_resize_dividers_panels' cleanup
34
+ var leftHandleOnlyLayouts = ['wrap-right', 'align-end'];
30
35
  // eslint-disable-next-line @repo/internal/react/no-class-components
31
36
  var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Component) {
32
37
  function ResizableEmbedCard() {
@@ -354,12 +359,20 @@ var ResizableEmbedCard = exports.default = /*#__PURE__*/function (_React$Compone
354
359
  width: this.calcPxWidth(),
355
360
  innerPadding: _editorSharedStyles.akEditorMediaResizeHandlerPadding
356
361
  };
362
+ var isLeftResizeHandleDisabled = (0, _expValEquals.expValEquals)('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true);
357
363
  var enable = {};
358
364
  _ui.handleSides.forEach(function (side) {
359
365
  if (isResizeDisabled) {
360
366
  enable[side] = false;
361
367
  return;
362
368
  }
369
+
370
+ // Disable the left handle up-front (except for layouts where it is the
371
+ // only handle) before computing whether it would otherwise be enabled.
372
+ if (side === 'left' && isLeftResizeHandleDisabled && !leftHandleOnlyLayouts.includes(layout)) {
373
+ enable[side] = false;
374
+ return;
375
+ }
363
376
  var oppositeSide = side === 'left' ? 'right' : 'left';
364
377
  enable[side] = ['full-width', 'wide', 'center'].concat("wrap-".concat(oppositeSide)).concat("align-".concat(_ui.imageAlignmentMap[oppositeSide])).indexOf(layout) > -1;
365
378
  if (side === 'left' && _this2.insideInlineLike) {
@@ -13,7 +13,12 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
13
13
  import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
14
14
  import { akEditorBreakoutPadding, akEditorMediaResizeHandlerPadding, akEditorWideLayoutWidth, breakoutWideScaleRatio, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
15
15
  import { embedHeaderHeight } from '@atlaskit/smart-card';
16
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
16
17
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
18
+ // Layouts where the left handle is the only resize handle today.
19
+ // These must keep the left handle.
20
+ // Remove during 'platform_editor_lovability_resize_dividers_panels' cleanup
21
+ const leftHandleOnlyLayouts = ['wrap-right', 'align-end'];
17
22
  // eslint-disable-next-line @repo/internal/react/no-class-components
18
23
  export default class ResizableEmbedCard extends React.Component {
19
24
  constructor(...args) {
@@ -336,12 +341,20 @@ export default class ResizableEmbedCard extends React.Component {
336
341
  width: this.calcPxWidth(),
337
342
  innerPadding: akEditorMediaResizeHandlerPadding
338
343
  };
344
+ const isLeftResizeHandleDisabled = expValEquals('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true);
339
345
  const enable = {};
340
346
  handleSides.forEach(side => {
341
347
  if (isResizeDisabled) {
342
348
  enable[side] = false;
343
349
  return;
344
350
  }
351
+
352
+ // Disable the left handle up-front (except for layouts where it is the
353
+ // only handle) before computing whether it would otherwise be enabled.
354
+ if (side === 'left' && isLeftResizeHandleDisabled && !leftHandleOnlyLayouts.includes(layout)) {
355
+ enable[side] = false;
356
+ return;
357
+ }
345
358
  const oppositeSide = side === 'left' ? 'right' : 'left';
346
359
  enable[side] = ['full-width', 'wide', 'center'].concat(`wrap-${oppositeSide}`).concat(`align-${imageAlignmentMap[oppositeSide]}`).indexOf(layout) > -1;
347
360
  if (side === 'left' && this.insideInlineLike) {
@@ -22,7 +22,12 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
22
22
  import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
23
23
  import { akEditorBreakoutPadding, akEditorMediaResizeHandlerPadding, akEditorWideLayoutWidth, breakoutWideScaleRatio, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
24
24
  import { embedHeaderHeight } from '@atlaskit/smart-card';
25
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
25
26
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
27
+ // Layouts where the left handle is the only resize handle today.
28
+ // These must keep the left handle.
29
+ // Remove during 'platform_editor_lovability_resize_dividers_panels' cleanup
30
+ var leftHandleOnlyLayouts = ['wrap-right', 'align-end'];
26
31
  // eslint-disable-next-line @repo/internal/react/no-class-components
27
32
  var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
28
33
  function ResizableEmbedCard() {
@@ -350,12 +355,20 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
350
355
  width: this.calcPxWidth(),
351
356
  innerPadding: akEditorMediaResizeHandlerPadding
352
357
  };
358
+ var isLeftResizeHandleDisabled = expValEquals('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true);
353
359
  var enable = {};
354
360
  handleSides.forEach(function (side) {
355
361
  if (isResizeDisabled) {
356
362
  enable[side] = false;
357
363
  return;
358
364
  }
365
+
366
+ // Disable the left handle up-front (except for layouts where it is the
367
+ // only handle) before computing whether it would otherwise be enabled.
368
+ if (side === 'left' && isLeftResizeHandleDisabled && !leftHandleOnlyLayouts.includes(layout)) {
369
+ enable[side] = false;
370
+ return;
371
+ }
359
372
  var oppositeSide = side === 'left' ? 'right' : 'left';
360
373
  enable[side] = ['full-width', 'wide', 'center'].concat("wrap-".concat(oppositeSide)).concat("align-".concat(imageAlignmentMap[oppositeSide])).indexOf(layout) > -1;
361
374
  if (side === 'left' && _this2.insideInlineLike) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "18.0.8",
3
+ "version": "18.0.9",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",