@atlaskit/editor-plugin-media 12.2.6 → 12.4.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 (34) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/nodeviews/lazy-media-group.js +1 -24
  3. package/dist/cjs/nodeviews/mediaGroup.js +0 -4
  4. package/dist/cjs/nodeviews/mediaNodeView/index.js +31 -39
  5. package/dist/cjs/nodeviews/mediaNodeView/media.js +7 -22
  6. package/dist/cjs/nodeviews/mediaSingle.js +1 -2
  7. package/dist/cjs/nodeviews/mediaSingleNext.js +2 -2
  8. package/dist/cjs/nodeviews/toDOM-fixes/mediaSingle.js +2 -11
  9. package/dist/cjs/pm-plugins/ai-generating-decoration.js +5 -2
  10. package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +6 -11
  11. package/dist/cjs/ui/ResizableMediaSingle/index.js +4 -7
  12. package/dist/es2019/nodeviews/lazy-media-group.js +1 -20
  13. package/dist/es2019/nodeviews/mediaGroup.js +0 -4
  14. package/dist/es2019/nodeviews/mediaNodeView/index.js +31 -39
  15. package/dist/es2019/nodeviews/mediaNodeView/media.js +7 -21
  16. package/dist/es2019/nodeviews/mediaSingle.js +1 -2
  17. package/dist/es2019/nodeviews/mediaSingleNext.js +2 -2
  18. package/dist/es2019/nodeviews/toDOM-fixes/mediaSingle.js +2 -11
  19. package/dist/es2019/pm-plugins/ai-generating-decoration.js +5 -2
  20. package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +6 -9
  21. package/dist/es2019/ui/ResizableMediaSingle/index.js +4 -7
  22. package/dist/esm/nodeviews/lazy-media-group.js +1 -19
  23. package/dist/esm/nodeviews/mediaGroup.js +0 -4
  24. package/dist/esm/nodeviews/mediaNodeView/index.js +31 -39
  25. package/dist/esm/nodeviews/mediaNodeView/media.js +7 -22
  26. package/dist/esm/nodeviews/mediaSingle.js +1 -2
  27. package/dist/esm/nodeviews/mediaSingleNext.js +2 -2
  28. package/dist/esm/nodeviews/toDOM-fixes/mediaSingle.js +2 -11
  29. package/dist/esm/pm-plugins/ai-generating-decoration.js +5 -2
  30. package/dist/esm/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +6 -11
  31. package/dist/esm/ui/ResizableMediaSingle/index.js +4 -7
  32. package/dist/types/nodeviews/lazy-media-group.d.ts +1 -1
  33. package/dist/types-ts4.5/nodeviews/lazy-media-group.d.ts +1 -1
  34. package/package.json +6 -3
@@ -14,7 +14,6 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
14
14
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
15
15
  // eslint-disable-next-line @typescript-eslint/consistent-type-imports
16
16
  import { isNodeSelectedOrInRange } from '@atlaskit/editor-common/utils';
17
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
18
17
  import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
19
18
  import { MediaSingleNodeNext } from './mediaSingleNext';
20
19
  const selector = states => {
@@ -192,7 +191,7 @@ class MediaSingleNodeView extends ReactNodeView {
192
191
  isValidUpdate = (currentNode, newNode) => this.getNodeMediaId(currentNode) === this.getNodeMediaId(newNode);
193
192
  }
194
193
  // Detect mediaSingle width attribute changes and signal child media node to update
195
- if (!this.hasResized && this.node.attrs.width !== node.attrs.width && expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
194
+ if (!this.hasResized && this.node.attrs.width !== node.attrs.width) {
196
195
  const target = this.dom.querySelector('div[data-prosemirror-node-name="media"]');
197
196
  target === null || target === void 0 ? void 0 : target.dispatchEvent(new CustomEvent('resized'));
198
197
  }
@@ -468,7 +468,7 @@ export const MediaSingleNodeNext = mediaSingleNodeNextProps => {
468
468
  onClick: clickPlaceholder,
469
469
  placeholderMessage: mediaOptions.allowImagePreview ? captionMessages.placeholderWithDoubleClickPrompt : captionMessages.placeholder
470
470
  })));
471
- if (!expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true) || widthType !== 'pixel' && expValEquals('platform_editor_media_vc_fixes_patch1', 'isEnabled', true)) {
471
+ if (widthType !== 'pixel' && expValEquals('platform_editor_media_vc_fixes_patch1', 'isEnabled', true)) {
472
472
  return jsx(Fragment, null, canResize ? mediaOptions.allowPixelResizing ? jsx(ResizableMediaSingleNext, {
473
473
  view: view,
474
474
  getPos: getPos,
@@ -488,7 +488,7 @@ export const MediaSingleNodeNext = mediaSingleNodeNextProps => {
488
488
  hasFallbackContainer: false,
489
489
  mediaSingleWidth: mediaSingleWidth,
490
490
  editorAppearance: editorAppearance,
491
- showLegacyNotification: widthType !== 'pixel',
491
+ showLegacyNotification: true,
492
492
  forceHandlePositioning: mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.forceHandlePositioning
493
493
  }, MediaChildren) : jsx(ResizableMediaSingle, {
494
494
  view: view,
@@ -1,6 +1,5 @@
1
1
  import { mediaSingleSpec } from '@atlaskit/adf-schema';
2
2
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
3
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
3
  import { getAttrsFromNodeMediaSingle } from './toDOMAttrs';
5
4
  const WRAPPED_LAYOUTS = ['wrap-left', 'wrap-right'];
6
5
  const ALIGNED_LAYOUTS = ['align-end', 'align-start'];
@@ -45,17 +44,9 @@ export const mediaWidthCSSCalc = ({
45
44
  } else if (shouldHardCodePixelWidth) {
46
45
  cssCalc = `min(${mediaSingleDimensionWidth}px, ${fullContainerWidth})`;
47
46
  } else if (shouldUseBreakoutWideLogic) {
48
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
49
- cssCalc = `max(var(--ak-editor--line-length), min(var(--ak-editor--breakout-wide-layout-width), var(--ak-editor-max-container-width)))`;
50
- } else {
51
- cssCalc = `max(var(--ak-editor--line-length), min(var(--ak-editor--breakout-wide-layout-width), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))`;
52
- }
47
+ cssCalc = `max(var(--ak-editor--line-length), min(var(--ak-editor--breakout-wide-layout-width), var(--ak-editor-max-container-width)))`;
53
48
  } else if (shouldUseBreakoutFullWidthLogic) {
54
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
55
- cssCalc = `max(var(--ak-editor--line-length), min(var(--ak-editor--full-width-layout-width), var(--ak-editor-max-container-width)))`;
56
- } else {
57
- cssCalc = `max(var(--ak-editor--line-length), min(var(--ak-editor--full-width-layout-width), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))`;
58
- }
49
+ cssCalc = `max(var(--ak-editor--line-length), min(var(--ak-editor--full-width-layout-width), var(--ak-editor-max-container-width)))`;
59
50
  } else {
60
51
  cssCalc = `max(min(${baseWidth}px, min(100cqw, 100%)), ${GUTTER_SIZE})`;
61
52
  }
@@ -2,6 +2,8 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import FeatureGates from '@atlaskit/feature-gate-js-client';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
7
 
6
8
  /**
7
9
  * ProseMirror plugin that manages AI-generating decorations on media nodes.
@@ -98,9 +100,10 @@ export function createAIGeneratingDecorationPlugin() {
98
100
  };
99
101
  },
100
102
  apply(tr, pluginState, _oldState, newState) {
101
- // Killswitch if active, clear any existing decorations and stop
103
+ // Disabled when killswitch is on or gate/experiment off drop decorations.
104
+ if (
102
105
  // eslint-disable-next-line @atlaskit/platform/use-recommended-utils -- dynamic config killswitch, not a standard feature gate
103
- if (FeatureGates.getExperimentValue('maui_ai_border_killswitch', 'value', false)) {
106
+ FeatureGates.getExperimentValue('maui_ai_border_killswitch', 'value', false) || !fg('cc-maui-phase-2-loading') || !expValEquals('cc-maui-experiment', 'isEnabled', true)) {
104
107
  if (pluginState.generatingMediaIds.size > 0) {
105
108
  return {
106
109
  generatingMediaIds: new Set(),
@@ -17,7 +17,6 @@ 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';
21
20
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
22
21
  import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
23
22
  import { getMediaResizeAnalyticsEvent } from '../../pm-plugins/utils/analytics';
@@ -190,9 +189,7 @@ export const ResizableMediaSingleNextFunctional = props => {
190
189
  const [isResizing, setIsResizing] = useState(false);
191
190
  const [isVideoFile, setIsVideoFile] = useState(false);
192
191
  const [hasResized, setHasResized] = useState(false);
193
- const nodePosition = expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true) ? getNodePosition(getPos) :
194
- // eslint-disable-next-line react-hooks/rules-of-hooks
195
- useMemo(() => getNodePosition(getPos), [getPos]);
192
+ const nodePosition = getNodePosition(getPos);
196
193
  const isNestedNode = useMemo(() => {
197
194
  if (nodePosition === null) {
198
195
  return false;
@@ -227,7 +224,7 @@ export const ResizableMediaSingleNextFunctional = props => {
227
224
  if (isAdjacentMode || fullWidthMode) {
228
225
  return lineLength;
229
226
  }
230
- if (!isResizing && expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
227
+ if (!isResizing) {
231
228
  return `var(--ak-editor-max-container-width)`;
232
229
  }
233
230
  return calcMaxWidth({
@@ -244,7 +241,7 @@ export const ResizableMediaSingleNextFunctional = props => {
244
241
  const minViewWidth = isResizing ? minWidth : `min(${minWidth}px, 100%)`;
245
242
  const resizerNextClassName = useMemo(() => {
246
243
  const classNameNext = classnames(richMediaClassName, `image-${layout}`, isResizing ? 'is-resizing' : 'not-resizing', className, resizerItemClassName, {
247
- 'display-handle': expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true) ? selected && !disableHandles : selected,
244
+ 'display-handle': selected && !disableHandles,
248
245
  'richMedia-selected': selected,
249
246
  'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
250
247
  });
@@ -261,7 +258,7 @@ export const ResizableMediaSingleNextFunctional = props => {
261
258
  return !!findParentNodeOfTypeClosestToPos($pos, [listItem]);
262
259
  }, [nodePosition, view]);
263
260
  const enable = useMemo(() => {
264
- if (disableHandles && expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
261
+ if (disableHandles) {
265
262
  return {
266
263
  left: false,
267
264
  right: false
@@ -367,7 +364,7 @@ export const ResizableMediaSingleNextFunctional = props => {
367
364
  isNestedNode: isAdjacentMode
368
365
  })(size, delta, false, aspectRatioRef.current);
369
366
  const resizerDomEl = resizerContainerRef.current;
370
- if (resizerDomEl && !hasResized && expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
367
+ if (resizerDomEl && !hasResized) {
371
368
  // dispatch resize event to media node DOM element inside resizerDom
372
369
  const mediaDomEl = resizerDomEl.querySelector('div[data-prosemirror-node-name="media"]');
373
370
  const event = new CustomEvent('resized');
@@ -503,7 +500,7 @@ export const ResizableMediaSingleNextFunctional = props => {
503
500
  snap: snaps,
504
501
  resizeRatio: nonWrappedLayouts.includes(layout) ? 2 : 1,
505
502
  "data-testid": resizerNextTestId,
506
- isHandleVisible: expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true) ? selected && !disableHandles : selected,
503
+ isHandleVisible: selected && !disableHandles,
507
504
  handlePositioning: handlePositioning,
508
505
  handleHighlight: "full-height"
509
506
  }, children, showLegacyNotification && jsx(ResizableMediaMigrationNotification, null)));
@@ -13,7 +13,6 @@ import { calcColumnsFromPx, calcMediaPxWidth, calcPctFromPx, handleSides, imageA
13
13
  import { calculateSnapPoints } from '@atlaskit/editor-common/utils';
14
14
  import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
15
15
  import { akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
16
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
17
16
  import { checkMediaType } from '../../pm-plugins/utils/check-media-type';
18
17
  import { wrapperStyle } from './styled';
19
18
  // eslint-disable-next-line @repo/internal/react/no-class-components
@@ -44,7 +43,7 @@ export default class ResizableMediaSingle extends React.Component {
44
43
  state
45
44
  }
46
45
  } = this.props;
47
- if (!this.hasResized && expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
46
+ if (!this.hasResized) {
48
47
  var _this$wrapper;
49
48
  const mediaDomEl = (_this$wrapper = this.wrapper) === null || _this$wrapper === void 0 ? void 0 : _this$wrapper.querySelector('div[data-prosemirror-node-name="media"]');
50
49
  if (mediaDomEl) {
@@ -295,11 +294,9 @@ export default class ResizableMediaSingle extends React.Component {
295
294
  const enable = {};
296
295
  handleSides.forEach(side => {
297
296
  const oppositeSide = side === 'left' ? 'right' : 'left';
298
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
299
- if (this.props.disableHandles) {
300
- enable[side] = false;
301
- return;
302
- }
297
+ if (this.props.disableHandles) {
298
+ enable[side] = false;
299
+ return;
303
300
  }
304
301
  enable[side] = ['full-width', 'wide', 'center'].concat(`wrap-${oppositeSide}`).concat(`align-${imageAlignmentMap[oppositeSide]}`).indexOf(layout) > -1;
305
302
  if (side === 'left' && this.insideInlineLike) {
@@ -1,24 +1,6 @@
1
- import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
2
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
1
  import { ReactMediaGroupNode } from './mediaGroup';
4
2
  export var lazyMediaGroupView = function lazyMediaGroupView(portalProviderAPI, eventDispatcher, providerFactory) {
5
3
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
6
4
  var api = arguments.length > 4 ? arguments[4] : undefined;
7
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
8
- return ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options, api);
9
- }
10
- return withLazyLoading({
11
- nodeName: 'mediaGroup',
12
- getNodeViewOptions: function getNodeViewOptions() {},
13
- loader: function loader() {
14
- var result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-media-group-lazy-node-view" */
15
- './mediaGroup').then(function (_ref) {
16
- var ReactMediaGroupNode = _ref.ReactMediaGroupNode;
17
- return function (node, view, getPos) {
18
- return ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options, api)(node, view, getPos);
19
- };
20
- });
21
- return result;
22
- }
23
- });
5
+ return ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options, api);
24
6
  };
@@ -9,7 +9,6 @@ import React from 'react';
9
9
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
10
10
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
11
11
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
12
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
12
  import { useMediaProvider } from '../ui/hooks/useMediaProvider';
14
13
  import { MediaGroupNext } from './mediaGroupNext';
15
14
  var selector = function selector(states) {
@@ -60,9 +59,6 @@ var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
60
59
  editorDisabled = _ref3.editorDisabled,
61
60
  editorViewMode = _ref3.editorViewMode;
62
61
  var mediaProvider = mediaProviderFromState ? Promise.resolve(mediaProviderFromState) : undefined;
63
- if (!mediaProvider && !expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
64
- return null;
65
- }
66
62
  return /*#__PURE__*/React.createElement(MediaGroupNext, {
67
63
  node: _this.node,
68
64
  getPos: getPos,
@@ -86,47 +86,41 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
86
86
  width: '100%',
87
87
  height: '100%'
88
88
  };
89
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
90
- var pos = _this.getPos();
91
- if (typeof pos !== 'number') {
92
- return flexibleDimensions;
93
- }
94
- if (_this.hasBeenResized) {
95
- return flexibleDimensions;
96
- }
97
- var mediaSingleNodeParent = _this.getMediaSingleNode(_this.getPos);
89
+ var pos = _this.getPos();
90
+ if (typeof pos !== 'number') {
91
+ return flexibleDimensions;
92
+ }
93
+ if (_this.hasBeenResized) {
94
+ return flexibleDimensions;
95
+ }
96
+ var mediaSingleNodeParent = _this.getMediaSingleNode(_this.getPos);
98
97
 
99
- // If media parent not found, return default
100
- if (!mediaSingleNodeParent) {
101
- return flexibleDimensions;
102
- }
103
- if (expValEquals('platform_editor_media_vc_fixes_patch1', 'isEnabled', true)) {
104
- if (_this.hasPxWidthType(mediaSingleNodeParent)) {
105
- return {
106
- width: "".concat(mediaSingleNodeParent.attrs.width, "px"),
107
- height: '100%'
108
- };
109
- }
110
- return flexibleDimensions;
98
+ // If media parent not found, return default
99
+ if (!mediaSingleNodeParent) {
100
+ return flexibleDimensions;
101
+ }
102
+ if (expValEquals('platform_editor_media_vc_fixes_patch1', 'isEnabled', true)) {
103
+ if (_this.hasPxWidthType(mediaSingleNodeParent)) {
104
+ return {
105
+ width: "".concat(mediaSingleNodeParent.attrs.width, "px"),
106
+ height: '100%'
107
+ };
111
108
  }
112
-
113
- // Compute normal dimensions
114
- var maxWidth = _this.getMaxWidthFromMediaSingleNode(mediaSingleNodeParent);
115
- return {
116
- width: "".concat(maxWidth, "px"),
117
- height: '100%'
118
- };
109
+ return flexibleDimensions;
119
110
  }
120
- return flexibleDimensions;
111
+
112
+ // Compute normal dimensions
113
+ var maxWidth = _this.getMaxWidthFromMediaSingleNode(mediaSingleNodeParent);
114
+ return {
115
+ width: "".concat(maxWidth, "px"),
116
+ height: '100%'
117
+ };
121
118
  });
122
119
  _defineProperty(_this, "getMediaProviderToUse", function (mediaOptions, mediaProvider) {
123
120
  if (mediaProvider) {
124
121
  return mediaProvider;
125
122
  }
126
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
127
- return mediaOptions.provider;
128
- }
129
- return mediaOptions.syncProvider ? Promise.resolve(mediaOptions.syncProvider) : mediaOptions.provider;
123
+ return mediaOptions.provider;
130
124
  });
131
125
  _defineProperty(_this, "renderMediaNodeWithState", function (contextIdentifierProvider) {
132
126
  return function (_ref2) {
@@ -247,12 +241,10 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
247
241
  // see also: https://github.com/ProseMirror/prosemirror/issues/884
248
242
  domRef.contentEditable = 'true';
249
243
  }
250
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
251
- this.resizeListenerBinding = bind(domRef, {
252
- type: 'resized',
253
- listener: this.hasResizedListener
254
- });
255
- }
244
+ this.resizeListenerBinding = bind(domRef, {
245
+ type: 'resized',
246
+ listener: this.hasResizedListener
247
+ });
256
248
  return domRef;
257
249
  }
258
250
  }, {
@@ -47,16 +47,8 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
47
47
  mediaProvider = _context.sent;
48
48
  if (mediaProvider) {
49
49
  viewMediaClientConfig = mediaProvider.viewMediaClientConfig;
50
- viewAndUploadMediaClientConfig = mediaProvider.viewAndUploadMediaClientConfig;
51
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
52
- // Only update state if new configs are available and different from current state
53
- if (viewMediaClientConfig && _this.state.viewMediaClientConfig !== viewMediaClientConfig || viewAndUploadMediaClientConfig && _this.state.viewAndUploadMediaClientConfig !== viewAndUploadMediaClientConfig) {
54
- _this.setState({
55
- viewMediaClientConfig: viewMediaClientConfig,
56
- viewAndUploadMediaClientConfig: viewAndUploadMediaClientConfig
57
- });
58
- }
59
- } else {
50
+ viewAndUploadMediaClientConfig = mediaProvider.viewAndUploadMediaClientConfig; // Only update state if new configs are available and different from current state
51
+ if (viewMediaClientConfig && _this.state.viewMediaClientConfig !== viewMediaClientConfig || viewAndUploadMediaClientConfig && _this.state.viewAndUploadMediaClientConfig !== viewAndUploadMediaClientConfig) {
60
52
  _this.setState({
61
53
  viewMediaClientConfig: viewMediaClientConfig,
62
54
  viewAndUploadMediaClientConfig: viewAndUploadMediaClientConfig
@@ -159,7 +151,7 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
159
151
  _this.mediaPluginState = mediaStateKey.getState(view.state);
160
152
 
161
153
  // Initialize state from syncProvider (available on both server and client for SSR)
162
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true) && syncProvider) {
154
+ if (syncProvider) {
163
155
  _this.state = {
164
156
  viewMediaClientConfig: syncProvider.viewMediaClientConfig,
165
157
  viewAndUploadMediaClientConfig: syncProvider.viewAndUploadMediaClientConfig
@@ -173,7 +165,7 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
173
165
  value: function shouldComponentUpdate(nextProps, nextState) {
174
166
  var hasNewViewMediaClientConfig = !this.state.viewMediaClientConfig && nextState.viewMediaClientConfig;
175
167
  var hasNewViewAndUploadMediaClientConfig = !this.state.viewAndUploadMediaClientConfig && nextState.viewAndUploadMediaClientConfig;
176
- if (this.props.selected !== nextProps.selected || this.props.node.attrs.id !== nextProps.node.attrs.id || this.props.node.attrs.collection !== nextProps.node.attrs.collection || this.props.isAIGenerating !== nextProps.isAIGenerating || this.props.maxDimensions.height !== nextProps.maxDimensions.height || this.props.maxDimensions.width !== nextProps.maxDimensions.width || this.props.contextIdentifierProvider !== nextProps.contextIdentifierProvider || this.props.isLoading !== nextProps.isLoading || this.props.mediaProvider !== nextProps.mediaProvider || expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true) && this.props.syncProvider !== nextProps.syncProvider || hasNewViewMediaClientConfig || hasNewViewAndUploadMediaClientConfig) {
168
+ if (this.props.selected !== nextProps.selected || this.props.node.attrs.id !== nextProps.node.attrs.id || this.props.node.attrs.collection !== nextProps.node.attrs.collection || this.props.isAIGenerating !== nextProps.isAIGenerating || this.props.maxDimensions.height !== nextProps.maxDimensions.height || this.props.maxDimensions.width !== nextProps.maxDimensions.width || this.props.contextIdentifierProvider !== nextProps.contextIdentifierProvider || this.props.isLoading !== nextProps.isLoading || this.props.mediaProvider !== nextProps.mediaProvider || this.props.syncProvider !== nextProps.syncProvider || hasNewViewMediaClientConfig || hasNewViewAndUploadMediaClientConfig) {
177
169
  return true;
178
170
  }
179
171
  return false;
@@ -311,17 +303,10 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
311
303
  // Check if we have any media client config available (syncProvider, state, or upload config)
312
304
  var hasNoMediaClientConfig = !viewMediaClientConfig && (fg('platform_media_video_captions') ? !viewAndUploadMediaClientConfig : true);
313
305
  if (isLoading || type !== 'external' && hasNoMediaClientConfig) {
314
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
315
- return /*#__PURE__*/React.createElement(MediaCardWrapper, {
316
- dimensions: originalDimensions,
317
- borderWidth: borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.size,
318
- selected: selected
319
- }, /*#__PURE__*/React.createElement(CardLoading, {
320
- interactionName: "editor-media-card-loading"
321
- }));
322
- }
323
306
  return /*#__PURE__*/React.createElement(MediaCardWrapper, {
324
- dimensions: originalDimensions
307
+ dimensions: originalDimensions,
308
+ borderWidth: borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.size,
309
+ selected: selected
325
310
  }, /*#__PURE__*/React.createElement(CardLoading, {
326
311
  interactionName: "editor-media-card-loading"
327
312
  }));
@@ -23,7 +23,6 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
23
23
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
24
24
  // eslint-disable-next-line @typescript-eslint/consistent-type-imports
25
25
  import { isNodeSelectedOrInRange } from '@atlaskit/editor-common/utils';
26
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
27
26
  import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
28
27
  import { MediaSingleNodeNext } from './mediaSingleNext';
29
28
  var selector = function selector(states) {
@@ -228,7 +227,7 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
228
227
  };
229
228
  }
230
229
  // Detect mediaSingle width attribute changes and signal child media node to update
231
- if (!this.hasResized && this.node.attrs.width !== node.attrs.width && expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
230
+ if (!this.hasResized && this.node.attrs.width !== node.attrs.width) {
232
231
  var target = this.dom.querySelector('div[data-prosemirror-node-name="media"]');
233
232
  target === null || target === void 0 || target.dispatchEvent(new CustomEvent('resized'));
234
233
  }
@@ -503,7 +503,7 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
503
503
  onClick: clickPlaceholder,
504
504
  placeholderMessage: mediaOptions.allowImagePreview ? captionMessages.placeholderWithDoubleClickPrompt : captionMessages.placeholder
505
505
  })));
506
- if (!expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true) || widthType !== 'pixel' && expValEquals('platform_editor_media_vc_fixes_patch1', 'isEnabled', true)) {
506
+ if (widthType !== 'pixel' && expValEquals('platform_editor_media_vc_fixes_patch1', 'isEnabled', true)) {
507
507
  return jsx(Fragment, null, canResize ? mediaOptions.allowPixelResizing ? jsx(ResizableMediaSingleNext, {
508
508
  view: view,
509
509
  getPos: getPos,
@@ -523,7 +523,7 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
523
523
  hasFallbackContainer: false,
524
524
  mediaSingleWidth: mediaSingleWidth,
525
525
  editorAppearance: editorAppearance,
526
- showLegacyNotification: widthType !== 'pixel',
526
+ showLegacyNotification: true,
527
527
  forceHandlePositioning: mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.forceHandlePositioning
528
528
  }, MediaChildren) : jsx(ResizableMediaSingle, {
529
529
  view: view,
@@ -3,7 +3,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  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) { _defineProperty(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; }
4
4
  import { mediaSingleSpec } from '@atlaskit/adf-schema';
5
5
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
6
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
6
  import { getAttrsFromNodeMediaSingle } from './toDOMAttrs';
8
7
  var WRAPPED_LAYOUTS = ['wrap-left', 'wrap-right'];
9
8
  var ALIGNED_LAYOUTS = ['align-end', 'align-start'];
@@ -47,17 +46,9 @@ export var mediaWidthCSSCalc = function mediaWidthCSSCalc(_ref) {
47
46
  } else if (shouldHardCodePixelWidth) {
48
47
  cssCalc = "min(".concat(mediaSingleDimensionWidth, "px, ").concat(fullContainerWidth, ")");
49
48
  } else if (shouldUseBreakoutWideLogic) {
50
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
51
- cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--breakout-wide-layout-width), var(--ak-editor-max-container-width)))";
52
- } else {
53
- cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--breakout-wide-layout-width), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))";
54
- }
49
+ cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--breakout-wide-layout-width), var(--ak-editor-max-container-width)))";
55
50
  } else if (shouldUseBreakoutFullWidthLogic) {
56
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
57
- cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--full-width-layout-width), var(--ak-editor-max-container-width)))";
58
- } else {
59
- cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--full-width-layout-width), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))";
60
- }
51
+ cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--full-width-layout-width), var(--ak-editor-max-container-width)))";
61
52
  } else {
62
53
  cssCalc = "max(min(".concat(baseWidth, "px, min(100cqw, 100%)), ").concat(GUTTER_SIZE, ")");
63
54
  }
@@ -5,6 +5,8 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
7
  import FeatureGates from '@atlaskit/feature-gate-js-client';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
9
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
10
 
9
11
  /**
10
12
  * ProseMirror plugin that manages AI-generating decorations on media nodes.
@@ -103,9 +105,10 @@ export function createAIGeneratingDecorationPlugin() {
103
105
  };
104
106
  },
105
107
  apply: function apply(tr, pluginState, _oldState, newState) {
106
- // Killswitch if active, clear any existing decorations and stop
108
+ // Disabled when killswitch is on or gate/experiment off drop decorations.
109
+ if (
107
110
  // eslint-disable-next-line @atlaskit/platform/use-recommended-utils -- dynamic config killswitch, not a standard feature gate
108
- if (FeatureGates.getExperimentValue('maui_ai_border_killswitch', 'value', false)) {
111
+ FeatureGates.getExperimentValue('maui_ai_border_killswitch', 'value', false) || !fg('cc-maui-phase-2-loading') || !expValEquals('cc-maui-experiment', 'isEnabled', true)) {
109
112
  if (pluginState.generatingMediaIds.size > 0) {
110
113
  return {
111
114
  generatingMediaIds: new Set(),
@@ -19,7 +19,6 @@ 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';
23
22
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
24
23
  import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
25
24
  import { getMediaResizeAnalyticsEvent } from '../../pm-plugins/utils/analytics';
@@ -203,11 +202,7 @@ export var ResizableMediaSingleNextFunctional = function ResizableMediaSingleNex
203
202
  _useState0 = _slicedToArray(_useState9, 2),
204
203
  hasResized = _useState0[0],
205
204
  setHasResized = _useState0[1];
206
- var nodePosition = expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true) ? getNodePosition(getPos) :
207
- // eslint-disable-next-line react-hooks/rules-of-hooks
208
- useMemo(function () {
209
- return getNodePosition(getPos);
210
- }, [getPos]);
205
+ var nodePosition = getNodePosition(getPos);
211
206
  var isNestedNode = useMemo(function () {
212
207
  if (nodePosition === null) {
213
208
  return false;
@@ -242,7 +237,7 @@ export var ResizableMediaSingleNextFunctional = function ResizableMediaSingleNex
242
237
  if (isAdjacentMode || fullWidthMode) {
243
238
  return lineLength;
244
239
  }
245
- if (!isResizing && expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
240
+ if (!isResizing) {
246
241
  return "var(--ak-editor-max-container-width)";
247
242
  }
248
243
  return calcMaxWidth({
@@ -259,7 +254,7 @@ export var ResizableMediaSingleNextFunctional = function ResizableMediaSingleNex
259
254
  var minViewWidth = isResizing ? minWidth : "min(".concat(minWidth, "px, 100%)");
260
255
  var resizerNextClassName = useMemo(function () {
261
256
  var classNameNext = classnames(richMediaClassName, "image-".concat(layout), isResizing ? 'is-resizing' : 'not-resizing', className, resizerItemClassName, {
262
- 'display-handle': expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true) ? selected && !disableHandles : selected,
257
+ 'display-handle': selected && !disableHandles,
263
258
  'richMedia-selected': selected,
264
259
  'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
265
260
  });
@@ -274,7 +269,7 @@ export var ResizableMediaSingleNextFunctional = function ResizableMediaSingleNex
274
269
  return !!findParentNodeOfTypeClosestToPos($pos, [listItem]);
275
270
  }, [nodePosition, view]);
276
271
  var enable = useMemo(function () {
277
- if (disableHandles && expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
272
+ if (disableHandles) {
278
273
  return {
279
274
  left: false,
280
275
  right: false
@@ -381,7 +376,7 @@ export var ResizableMediaSingleNextFunctional = function ResizableMediaSingleNex
381
376
  height = _calculateSizeState.height,
382
377
  newLayout = _calculateSizeState.layout;
383
378
  var resizerDomEl = resizerContainerRef.current;
384
- if (resizerDomEl && !hasResized && expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
379
+ if (resizerDomEl && !hasResized) {
385
380
  // dispatch resize event to media node DOM element inside resizerDom
386
381
  var mediaDomEl = resizerDomEl.querySelector('div[data-prosemirror-node-name="media"]');
387
382
  var event = new CustomEvent('resized');
@@ -516,7 +511,7 @@ export var ResizableMediaSingleNextFunctional = function ResizableMediaSingleNex
516
511
  snap: snaps,
517
512
  resizeRatio: nonWrappedLayouts.includes(layout) ? 2 : 1,
518
513
  "data-testid": resizerNextTestId,
519
- isHandleVisible: expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true) ? selected && !disableHandles : selected,
514
+ isHandleVisible: selected && !disableHandles,
520
515
  handlePositioning: handlePositioning,
521
516
  handleHighlight: "full-height"
522
517
  }, children, showLegacyNotification && jsx(ResizableMediaMigrationNotification, null)));
@@ -22,7 +22,6 @@ import { calcColumnsFromPx, calcMediaPxWidth, calcPctFromPx, handleSides, imageA
22
22
  import { calculateSnapPoints } from '@atlaskit/editor-common/utils';
23
23
  import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
24
24
  import { akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
25
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
26
25
  import { checkMediaType } from '../../pm-plugins/utils/check-media-type';
27
26
  import { wrapperStyle } from './styled';
28
27
  // eslint-disable-next-line @repo/internal/react/no-class-components
@@ -54,7 +53,7 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
54
53
  var _this$props2 = _this.props,
55
54
  layout = _this$props2.layout,
56
55
  state = _this$props2.view.state;
57
- if (!_this.hasResized && expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
56
+ if (!_this.hasResized) {
58
57
  var _this$wrapper;
59
58
  var mediaDomEl = (_this$wrapper = _this.wrapper) === null || _this$wrapper === void 0 ? void 0 : _this$wrapper.querySelector('div[data-prosemirror-node-name="media"]');
60
59
  if (mediaDomEl) {
@@ -361,11 +360,9 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
361
360
  var enable = {};
362
361
  handleSides.forEach(function (side) {
363
362
  var oppositeSide = side === 'left' ? 'right' : 'left';
364
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
365
- if (_this2.props.disableHandles) {
366
- enable[side] = false;
367
- return;
368
- }
363
+ if (_this2.props.disableHandles) {
364
+ enable[side] = false;
365
+ return;
369
366
  }
370
367
  enable[side] = ['full-width', 'wide', 'center'].concat("wrap-".concat(oppositeSide)).concat("align-".concat(imageAlignmentMap[oppositeSide])).indexOf(layout) > -1;
371
368
  if (side === 'left' && _this2.insideInlineLike) {
@@ -1,5 +1,5 @@
1
1
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
2
- import { type NodeViewConstructor } from '@atlaskit/editor-common/lazy-node-view';
2
+ import type { NodeViewConstructor } from '@atlaskit/editor-common/lazy-node-view';
3
3
  import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
4
4
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
5
5
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
@@ -1,5 +1,5 @@
1
1
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
2
- import { type NodeViewConstructor } from '@atlaskit/editor-common/lazy-node-view';
2
+ import type { NodeViewConstructor } from '@atlaskit/editor-common/lazy-node-view';
3
3
  import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
4
4
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
5
5
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "12.2.6",
3
+ "version": "12.4.0",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -66,7 +66,7 @@
66
66
  "@atlaskit/platform-feature-flags": "^1.1.0",
67
67
  "@atlaskit/primitives": "^19.0.0",
68
68
  "@atlaskit/textfield": "^8.3.0",
69
- "@atlaskit/tmp-editor-statsig": "^74.0.0",
69
+ "@atlaskit/tmp-editor-statsig": "^74.1.0",
70
70
  "@atlaskit/tokens": "^13.0.0",
71
71
  "@atlaskit/tooltip": "^21.2.0",
72
72
  "@babel/runtime": "^7.0.0",
@@ -78,7 +78,7 @@
78
78
  "uuid": "^3.1.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@atlaskit/editor-common": "^114.15.0",
81
+ "@atlaskit/editor-common": "^114.18.0",
82
82
  "@atlaskit/media-core": "^37.0.0",
83
83
  "react": "^18.2.0",
84
84
  "react-dom": "^18.2.0",
@@ -162,6 +162,9 @@
162
162
  },
163
163
  "platform_editor_media_disable_save_during_upload": {
164
164
  "type": "boolean"
165
+ },
166
+ "cc-maui-phase-2-loading": {
167
+ "type": "boolean"
165
168
  }
166
169
  },
167
170
  "stricter": {