@atlaskit/editor-plugin-media 2.3.18 → 2.3.19

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,14 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 2.3.19
4
+
5
+ ### Patch Changes
6
+
7
+ - [#134978](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/134978)
8
+ [`e4ea317cdb9ac`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e4ea317cdb9ac) -
9
+ [EDITOR-549] Update mediaInline usage behind fg platform_editor_remove_media_inline_feature_flag
10
+ - Updated dependencies
11
+
3
12
  ## 2.3.18
4
13
 
5
14
  ### Patch Changes
@@ -135,8 +135,9 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
135
135
  _ref5$allowMediaSingl = _ref5.allowMediaSingle,
136
136
  allowMediaSingle = _ref5$allowMediaSingl === void 0 ? false : _ref5$allowMediaSingl,
137
137
  allowCaptions = _ref5.allowCaptions,
138
+ allowMediaInlineImages = _ref5.allowMediaInlineImages,
138
139
  mediaFeatureFlags = _ref5.featureFlags;
139
- var allowMediaInline = (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaFeatureFlags);
140
+ var allowMediaInline = (0, _platformFeatureFlags.fg)('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaFeatureFlags);
140
141
  var mediaSingleOption = (0, _platformFeatureFlags.fg)('platform_editor_media_extended_resize_experience') ? {
141
142
  withCaption: allowCaptions,
142
143
  withExtendedWidthTypes: true
@@ -176,7 +176,7 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
176
176
  onClick: function onClick() {
177
177
  (0, _utils.setNodeSelection)(_this.props.view, getNodePos());
178
178
  }
179
- }, mediaInlineOptions((0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaOptions.featureFlags)));
179
+ }, mediaInlineOptions((0, _platformFeatureFlags.fg)('platform_editor_remove_media_inline_feature_flag') ? mediaOptions.allowMediaInlineImages : (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaOptions.featureFlags)));
180
180
  });
181
181
  return /*#__PURE__*/_react.default.createElement(_mediaFilmstrip.Filmstrip, {
182
182
  items: items,
@@ -18,6 +18,7 @@ var _utils = require("@atlaskit/editor-common/utils");
18
18
  var _closeEditorClose = _interopRequireDefault(require("@atlaskit/icon/core/migration/close--editor-close"));
19
19
  var _mediaCommon = require("@atlaskit/media-common");
20
20
  var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
21
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
22
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
22
23
  var _pluginKey = require("../pm-plugins/plugin-key");
23
24
  var _mediaNodeUpdater = require("./mediaNodeUpdater");
@@ -52,6 +53,7 @@ var isNodeSelected = function isNodeSelected(props) {
52
53
  };
53
54
  var prepareFilmstripItem = function prepareFilmstripItem(_ref) {
54
55
  var allowLazyLoading = _ref.allowLazyLoading,
56
+ allowMediaInlineImages = _ref.allowMediaInlineImages,
55
57
  enableDownloadButton = _ref.enableDownloadButton,
56
58
  handleMediaNodeRemoval = _ref.handleMediaNodeRemoval,
57
59
  getPos = _ref.getPos,
@@ -97,7 +99,7 @@ var prepareFilmstripItem = function prepareFilmstripItem(_ref) {
97
99
  onClick: function onClick() {
98
100
  setMediaGroupNodeSelection(getNodePos());
99
101
  }
100
- }, mediaInlineOptions((0, _mediaCommon.getMediaFeatureFlag)('mediaInline', featureFlags)));
102
+ }, mediaInlineOptions((0, _platformFeatureFlags.fg)('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', featureFlags)));
101
103
  };
102
104
  };
103
105
 
@@ -174,6 +176,7 @@ var noop = function noop() {};
174
176
  var MediaGroupNext = exports.MediaGroupNext = (0, _reactIntlNext.injectIntl)( /*#__PURE__*/_react.default.memo(function (props) {
175
177
  var _props$mediaOptions = props.mediaOptions,
176
178
  allowLazyLoading = _props$mediaOptions.allowLazyLoading,
179
+ allowMediaInlineImages = _props$mediaOptions.allowMediaInlineImages,
177
180
  enableDownloadButton = _props$mediaOptions.enableDownloadButton,
178
181
  featureFlags = _props$mediaOptions.featureFlags,
179
182
  intl = props.intl,
@@ -224,6 +227,7 @@ var MediaGroupNext = exports.MediaGroupNext = (0, _reactIntlNext.injectIntl)( /*
224
227
  var filmstripItem = (0, _react.useMemo)(function () {
225
228
  return prepareFilmstripItem({
226
229
  allowLazyLoading: allowLazyLoading,
230
+ allowMediaInlineImages: allowMediaInlineImages,
227
231
  enableDownloadButton: enableDownloadButton,
228
232
  handleMediaNodeRemoval: handleMediaNodeRemoval,
229
233
  getPos: _getPos,
@@ -232,7 +236,7 @@ var MediaGroupNext = exports.MediaGroupNext = (0, _reactIntlNext.injectIntl)( /*
232
236
  setMediaGroupNodeSelection: setMediaGroupNodeSelection,
233
237
  featureFlags: featureFlags
234
238
  });
235
- }, [allowLazyLoading, enableDownloadButton, handleMediaNodeRemoval, _getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection, featureFlags]);
239
+ }, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, _getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection, featureFlags]);
236
240
  var items = (0, _react.useMemo)(function () {
237
241
  return mediaNodesWithOffsets.map(function (_ref4) {
238
242
  var node = _ref4.node,
@@ -27,6 +27,7 @@ var _view2 = require("@atlaskit/editor-prosemirror/view");
27
27
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
28
28
  var _mediaClient = require("@atlaskit/media-client");
29
29
  var _mediaCommon = require("@atlaskit/media-common");
30
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
30
31
  var _helpers = _interopRequireWildcard(require("../pm-plugins/commands/helpers"));
31
32
  var helpers = _helpers;
32
33
  var _mediaCommon2 = require("../pm-plugins/utils/media-common");
@@ -72,9 +73,7 @@ var createDropPlaceholder = function createDropPlaceholder(intl, nodeViewPortalP
72
73
  var MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
73
74
  var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*#__PURE__*/function () {
74
75
  function MediaPluginStateImplementation(_state, options, mediaOptions, _dispatch, pluginInjectionApi) {
75
- var _this = this,
76
- _this$mediaOptions2,
77
- _this$mediaOptions3;
76
+ var _this = this;
78
77
  (0, _classCallCheck2.default)(this, MediaPluginStateImplementation);
79
78
  (0, _defineProperty2.default)(this, "allowsUploads", false);
80
79
  (0, _defineProperty2.default)(this, "ignoreLinks", false);
@@ -465,8 +464,16 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
465
464
  if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.provider) {
466
465
  this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
467
466
  }
468
- if ((0, _mediaInline.mediaInlineImagesEnabled)((0, _mediaCommon.getMediaFeatureFlag)('mediaInline', (_this$mediaOptions2 = this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags), (_this$mediaOptions3 = this.mediaOptions) === null || _this$mediaOptions3 === void 0 ? void 0 : _this$mediaOptions3.allowMediaInlineImages)) {
469
- this.allowInlineImages = true;
467
+ if ((0, _platformFeatureFlags.fg)('platform_editor_remove_media_inline_feature_flag')) {
468
+ var _this$mediaOptions2;
469
+ if ((_this$mediaOptions2 = this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInlineImages) {
470
+ this.allowInlineImages = true;
471
+ }
472
+ } else {
473
+ var _this$mediaOptions3, _this$mediaOptions4;
474
+ if ((0, _mediaInline.mediaInlineImagesEnabled)((0, _mediaCommon.getMediaFeatureFlag)('mediaInline', (_this$mediaOptions3 = this.mediaOptions) === null || _this$mediaOptions3 === void 0 ? void 0 : _this$mediaOptions3.featureFlags), (_this$mediaOptions4 = this.mediaOptions) === null || _this$mediaOptions4 === void 0 ? void 0 : _this$mediaOptions4.allowMediaInlineImages)) {
475
+ this.allowInlineImages = true;
476
+ }
470
477
  }
471
478
  this.errorReporter = options.errorReporter || new _utils.ErrorReporter();
472
479
  this.singletonCreatedAt = (performance || Date).now();
@@ -24,10 +24,16 @@ var getMediaNodeInsertionType = exports.getMediaNodeInsertionType = function get
24
24
  return 'group';
25
25
  }
26
26
  var canInsertInlineNode = (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags) && !(0, _utils.isInEmptyLine)(state) && (!(0, _mediaCommon2.isInsidePotentialEmptyParagraph)(state) || isInSupportedInlineImageParent(state)) && (0, _mediaFiles.canInsertMediaInline)(state);
27
- if ((0, _mediaInline.mediaInlineImagesEnabled)((0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags), mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.allowMediaInlineImages)) {
28
- if (canInsertInlineNode && !(0, _isType.isVideo)(fileMimeType)) {
27
+ if ((0, _platformFeatureFlags.fg)('platform_editor_remove_media_inline_feature_flag')) {
28
+ if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.allowMediaInlineImages) {
29
29
  return 'inline';
30
30
  }
31
+ } else {
32
+ if ((0, _mediaInline.mediaInlineImagesEnabled)((0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags), mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.allowMediaInlineImages)) {
33
+ if (canInsertInlineNode && !(0, _isType.isVideo)(fileMimeType)) {
34
+ return 'inline';
35
+ }
36
+ }
31
37
  }
32
38
  if ((0, _mediaSingle.isMediaSingle)(state.schema, fileMimeType)) {
33
39
  return 'block';
@@ -289,8 +289,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
289
289
  }
290
290
  }
291
291
  var layoutButtons = (0, _card.buildLayoutButtons)(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled);
292
- if ((0, _mediaInline.mediaInlineImagesEnabled)(allowMediaInline, allowMediaInlineImages) && selectedNode) {
293
- var selectedLayoutIcon = (0, _utils2.getSelectedLayoutIcon)([].concat((0, _toConsumableArray2.default)(_card.alignmentIcons), (0, _toConsumableArray2.default)(_card.wrappingIcons)), selectedNode.node);
292
+ var addLayoutDropdownToToolbar = function addLayoutDropdownToToolbar() {
293
+ var selectedLayoutIcon = (0, _utils2.getSelectedLayoutIcon)([].concat((0, _toConsumableArray2.default)(_card.alignmentIcons), (0, _toConsumableArray2.default)(_card.wrappingIcons)),
294
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
295
+ selectedNode.node);
294
296
  if (selectedLayoutIcon && layoutButtons.length) {
295
297
  var _options = {
296
298
  render: function render(props) {
@@ -315,12 +317,28 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
315
317
  type: 'separator'
316
318
  }]);
317
319
  }
320
+ };
321
+ if ((0, _platformFeatureFlags.fg)('platform_editor_remove_media_inline_feature_flag')) {
322
+ if (allowMediaInlineImages && selectedNode) {
323
+ addLayoutDropdownToToolbar();
324
+ } else {
325
+ toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)(layoutButtons));
326
+ if (layoutButtons.length) {
327
+ toolbarButtons.push({
328
+ type: 'separator'
329
+ });
330
+ }
331
+ }
318
332
  } else {
319
- toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)(layoutButtons));
320
- if (layoutButtons.length) {
321
- toolbarButtons.push({
322
- type: 'separator'
323
- });
333
+ if ((0, _mediaInline.mediaInlineImagesEnabled)(allowMediaInline, allowMediaInlineImages) && selectedNode) {
334
+ addLayoutDropdownToToolbar();
335
+ } else {
336
+ toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)(layoutButtons));
337
+ if (layoutButtons.length) {
338
+ toolbarButtons.push({
339
+ type: 'separator'
340
+ });
341
+ }
324
342
  }
325
343
  }
326
344
 
@@ -687,11 +705,13 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
687
705
  allowLinking = options.allowLinking,
688
706
  allowAltTextOnImages = options.allowAltTextOnImages,
689
707
  providerFactory = options.providerFactory,
690
- allowMediaInline = options.allowMediaInline,
708
+ allowMediaInlineImages = options.allowMediaInlineImages,
691
709
  allowResizing = options.allowResizing,
692
710
  isViewOnly = options.isViewOnly,
693
711
  allowResizingInTables = options.allowResizingInTables,
694
712
  allowAdvancedToolBarOptions = options.allowAdvancedToolBarOptions;
713
+ var allowMediaInline = options.allowMediaInline;
714
+ allowMediaInline = (0, _platformFeatureFlags.fg)('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : allowMediaInline;
695
715
  var mediaPluginState = _pluginKey.stateKey.getState(state);
696
716
  var mediaLinkingState = (0, _linking2.getMediaLinkingState)(state);
697
717
  var _ref3 = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d4 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {},
@@ -126,9 +126,10 @@ export const mediaPlugin = ({
126
126
  allowMediaGroup = true,
127
127
  allowMediaSingle = false,
128
128
  allowCaptions,
129
+ allowMediaInlineImages,
129
130
  featureFlags: mediaFeatureFlags
130
131
  } = options || {};
131
- const allowMediaInline = getMediaFeatureFlag('mediaInline', mediaFeatureFlags);
132
+ const allowMediaInline = fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : getMediaFeatureFlag('mediaInline', mediaFeatureFlags);
132
133
  const mediaSingleOption = fg('platform_editor_media_extended_resize_experience') ? {
133
134
  withCaption: allowCaptions,
134
135
  withExtendedWidthTypes: true
@@ -161,7 +161,7 @@ class MediaGroup extends React.Component {
161
161
  onClick: () => {
162
162
  setNodeSelection(this.props.view, getNodePos());
163
163
  },
164
- ...mediaInlineOptions(getMediaFeatureFlag('mediaInline', mediaOptions.featureFlags))
164
+ ...mediaInlineOptions(fg('platform_editor_remove_media_inline_feature_flag') ? mediaOptions.allowMediaInlineImages : getMediaFeatureFlag('mediaInline', mediaOptions.featureFlags))
165
165
  };
166
166
  });
167
167
  return /*#__PURE__*/React.createElement(Filmstrip, {
@@ -6,6 +6,7 @@ import { isNodeSelectedOrInRange, SelectedState, setNodeSelection } from '@atlas
6
6
  import EditorCloseIcon from '@atlaskit/icon/core/migration/close--editor-close';
7
7
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
8
8
  import { Filmstrip } from '@atlaskit/media-filmstrip';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
11
  import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
11
12
  import { createMediaNodeUpdater } from './mediaNodeUpdater';
@@ -34,6 +35,7 @@ const isNodeSelected = props => (mediaItemPos, mediaGroupPos) => {
34
35
  };
35
36
  const prepareFilmstripItem = ({
36
37
  allowLazyLoading,
38
+ allowMediaInlineImages,
37
39
  enableDownloadButton,
38
40
  handleMediaNodeRemoval,
39
41
  getPos,
@@ -78,7 +80,7 @@ const prepareFilmstripItem = ({
78
80
  onClick: () => {
79
81
  setMediaGroupNodeSelection(getNodePos());
80
82
  },
81
- ...mediaInlineOptions(getMediaFeatureFlag('mediaInline', featureFlags))
83
+ ...mediaInlineOptions(fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : getMediaFeatureFlag('mediaInline', featureFlags))
82
84
  };
83
85
  };
84
86
 
@@ -129,6 +131,7 @@ export const MediaGroupNext = injectIntl( /*#__PURE__*/React.memo(props => {
129
131
  const {
130
132
  mediaOptions: {
131
133
  allowLazyLoading,
134
+ allowMediaInlineImages,
132
135
  enableDownloadButton,
133
136
  featureFlags
134
137
  },
@@ -178,6 +181,7 @@ export const MediaGroupNext = injectIntl( /*#__PURE__*/React.memo(props => {
178
181
  const filmstripItem = useMemo(() => {
179
182
  return prepareFilmstripItem({
180
183
  allowLazyLoading,
184
+ allowMediaInlineImages,
181
185
  enableDownloadButton,
182
186
  handleMediaNodeRemoval,
183
187
  getPos,
@@ -186,7 +190,7 @@ export const MediaGroupNext = injectIntl( /*#__PURE__*/React.memo(props => {
186
190
  setMediaGroupNodeSelection,
187
191
  featureFlags
188
192
  });
189
- }, [allowLazyLoading, enableDownloadButton, handleMediaNodeRemoval, getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection, featureFlags]);
193
+ }, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection, featureFlags]);
190
194
  const items = useMemo(() => {
191
195
  return mediaNodesWithOffsets.map(({
192
196
  node,
@@ -15,6 +15,7 @@ import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
15
15
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
16
16
  import { isFileIdentifier } from '@atlaskit/media-client';
17
17
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
18
+ import { fg } from '@atlaskit/platform-feature-flags';
18
19
  import { updateMediaNodeAttrs } from '../pm-plugins/commands/helpers';
19
20
  // Ignored via go/ees005
20
21
  // eslint-disable-next-line import/no-namespace
@@ -50,7 +51,6 @@ const createDropPlaceholder = (intl, nodeViewPortalProviderAPI, dropPlaceholderK
50
51
  const MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
51
52
  export class MediaPluginStateImplementation {
52
53
  constructor(_state, options, mediaOptions, _dispatch, pluginInjectionApi) {
53
- var _this$mediaOptions2, _this$mediaOptions3;
54
54
  _defineProperty(this, "allowsUploads", false);
55
55
  _defineProperty(this, "ignoreLinks", false);
56
56
  _defineProperty(this, "waitForMediaUpload", true);
@@ -442,8 +442,16 @@ export class MediaPluginStateImplementation {
442
442
  if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.provider) {
443
443
  this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
444
444
  }
445
- if (mediaInlineImagesEnabled(getMediaFeatureFlag('mediaInline', (_this$mediaOptions2 = this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags), (_this$mediaOptions3 = this.mediaOptions) === null || _this$mediaOptions3 === void 0 ? void 0 : _this$mediaOptions3.allowMediaInlineImages)) {
446
- this.allowInlineImages = true;
445
+ if (fg('platform_editor_remove_media_inline_feature_flag')) {
446
+ var _this$mediaOptions2;
447
+ if ((_this$mediaOptions2 = this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInlineImages) {
448
+ this.allowInlineImages = true;
449
+ }
450
+ } else {
451
+ var _this$mediaOptions3, _this$mediaOptions4;
452
+ if (mediaInlineImagesEnabled(getMediaFeatureFlag('mediaInline', (_this$mediaOptions3 = this.mediaOptions) === null || _this$mediaOptions3 === void 0 ? void 0 : _this$mediaOptions3.featureFlags), (_this$mediaOptions4 = this.mediaOptions) === null || _this$mediaOptions4 === void 0 ? void 0 : _this$mediaOptions4.allowMediaInlineImages)) {
453
+ this.allowInlineImages = true;
454
+ }
447
455
  }
448
456
  this.errorReporter = options.errorReporter || new ErrorReporter();
449
457
  this.singletonCreatedAt = (performance || Date).now();
@@ -18,10 +18,16 @@ export const getMediaNodeInsertionType = (state, mediaOptions, fileMimeType) =>
18
18
  return 'group';
19
19
  }
20
20
  const canInsertInlineNode = getMediaFeatureFlag('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInSupportedInlineImageParent(state)) && canInsertMediaInline(state);
21
- if (mediaInlineImagesEnabled(getMediaFeatureFlag('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags), mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.allowMediaInlineImages)) {
22
- if (canInsertInlineNode && !isVideo(fileMimeType)) {
21
+ if (fg('platform_editor_remove_media_inline_feature_flag')) {
22
+ if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.allowMediaInlineImages) {
23
23
  return 'inline';
24
24
  }
25
+ } else {
26
+ if (mediaInlineImagesEnabled(getMediaFeatureFlag('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags), mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.allowMediaInlineImages)) {
27
+ if (canInsertInlineNode && !isVideo(fileMimeType)) {
28
+ return 'inline';
29
+ }
30
+ }
25
31
  }
26
32
  if (isMediaSingle(state.schema, fileMimeType)) {
27
33
  return 'block';
@@ -280,8 +280,10 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
280
280
  }
281
281
  }
282
282
  const layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled);
283
- if (mediaInlineImagesEnabled(allowMediaInline, allowMediaInlineImages) && selectedNode) {
284
- const selectedLayoutIcon = getSelectedLayoutIcon([...alignmentIcons, ...wrappingIcons], selectedNode.node);
283
+ const addLayoutDropdownToToolbar = () => {
284
+ const selectedLayoutIcon = getSelectedLayoutIcon([...alignmentIcons, ...wrappingIcons],
285
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
286
+ selectedNode.node);
285
287
  if (selectedLayoutIcon && layoutButtons.length) {
286
288
  const options = {
287
289
  render: props => {
@@ -306,12 +308,28 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
306
308
  type: 'separator'
307
309
  }];
308
310
  }
311
+ };
312
+ if (fg('platform_editor_remove_media_inline_feature_flag')) {
313
+ if (allowMediaInlineImages && selectedNode) {
314
+ addLayoutDropdownToToolbar();
315
+ } else {
316
+ toolbarButtons = [...toolbarButtons, ...layoutButtons];
317
+ if (layoutButtons.length) {
318
+ toolbarButtons.push({
319
+ type: 'separator'
320
+ });
321
+ }
322
+ }
309
323
  } else {
310
- toolbarButtons = [...toolbarButtons, ...layoutButtons];
311
- if (layoutButtons.length) {
312
- toolbarButtons.push({
313
- type: 'separator'
314
- });
324
+ if (mediaInlineImagesEnabled(allowMediaInline, allowMediaInlineImages) && selectedNode) {
325
+ addLayoutDropdownToToolbar();
326
+ } else {
327
+ toolbarButtons = [...toolbarButtons, ...layoutButtons];
328
+ if (layoutButtons.length) {
329
+ toolbarButtons.push({
330
+ type: 'separator'
331
+ });
332
+ }
315
333
  }
316
334
  }
317
335
 
@@ -680,12 +698,16 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
680
698
  allowLinking,
681
699
  allowAltTextOnImages,
682
700
  providerFactory,
683
- allowMediaInline,
701
+ allowMediaInlineImages,
684
702
  allowResizing,
685
703
  isViewOnly,
686
704
  allowResizingInTables,
687
705
  allowAdvancedToolBarOptions
688
706
  } = options;
707
+ let {
708
+ allowMediaInline
709
+ } = options;
710
+ allowMediaInline = fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : allowMediaInline;
689
711
  const mediaPluginState = stateKey.getState(state);
690
712
  const mediaLinkingState = getMediaLinkingState(state);
691
713
  const {
@@ -125,8 +125,9 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
125
125
  _ref5$allowMediaSingl = _ref5.allowMediaSingle,
126
126
  allowMediaSingle = _ref5$allowMediaSingl === void 0 ? false : _ref5$allowMediaSingl,
127
127
  allowCaptions = _ref5.allowCaptions,
128
+ allowMediaInlineImages = _ref5.allowMediaInlineImages,
128
129
  mediaFeatureFlags = _ref5.featureFlags;
129
- var allowMediaInline = getMediaFeatureFlag('mediaInline', mediaFeatureFlags);
130
+ var allowMediaInline = fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : getMediaFeatureFlag('mediaInline', mediaFeatureFlags);
130
131
  var mediaSingleOption = fg('platform_editor_media_extended_resize_experience') ? {
131
132
  withCaption: allowCaptions,
132
133
  withExtendedWidthTypes: true
@@ -169,7 +169,7 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
169
169
  onClick: function onClick() {
170
170
  setNodeSelection(_this.props.view, getNodePos());
171
171
  }
172
- }, mediaInlineOptions(getMediaFeatureFlag('mediaInline', mediaOptions.featureFlags)));
172
+ }, mediaInlineOptions(fg('platform_editor_remove_media_inline_feature_flag') ? mediaOptions.allowMediaInlineImages : getMediaFeatureFlag('mediaInline', mediaOptions.featureFlags)));
173
173
  });
174
174
  return /*#__PURE__*/React.createElement(Filmstrip, {
175
175
  items: items,
@@ -12,6 +12,7 @@ import { isNodeSelectedOrInRange, SelectedState, setNodeSelection } from '@atlas
12
12
  import EditorCloseIcon from '@atlaskit/icon/core/migration/close--editor-close';
13
13
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
14
14
  import { Filmstrip } from '@atlaskit/media-filmstrip';
15
+ import { fg } from '@atlaskit/platform-feature-flags';
15
16
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
16
17
  import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
17
18
  import { createMediaNodeUpdater } from './mediaNodeUpdater';
@@ -42,6 +43,7 @@ var isNodeSelected = function isNodeSelected(props) {
42
43
  };
43
44
  var prepareFilmstripItem = function prepareFilmstripItem(_ref) {
44
45
  var allowLazyLoading = _ref.allowLazyLoading,
46
+ allowMediaInlineImages = _ref.allowMediaInlineImages,
45
47
  enableDownloadButton = _ref.enableDownloadButton,
46
48
  handleMediaNodeRemoval = _ref.handleMediaNodeRemoval,
47
49
  getPos = _ref.getPos,
@@ -87,7 +89,7 @@ var prepareFilmstripItem = function prepareFilmstripItem(_ref) {
87
89
  onClick: function onClick() {
88
90
  setMediaGroupNodeSelection(getNodePos());
89
91
  }
90
- }, mediaInlineOptions(getMediaFeatureFlag('mediaInline', featureFlags)));
92
+ }, mediaInlineOptions(fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : getMediaFeatureFlag('mediaInline', featureFlags)));
91
93
  };
92
94
  };
93
95
 
@@ -164,6 +166,7 @@ var noop = function noop() {};
164
166
  export var MediaGroupNext = injectIntl( /*#__PURE__*/React.memo(function (props) {
165
167
  var _props$mediaOptions = props.mediaOptions,
166
168
  allowLazyLoading = _props$mediaOptions.allowLazyLoading,
169
+ allowMediaInlineImages = _props$mediaOptions.allowMediaInlineImages,
167
170
  enableDownloadButton = _props$mediaOptions.enableDownloadButton,
168
171
  featureFlags = _props$mediaOptions.featureFlags,
169
172
  intl = props.intl,
@@ -214,6 +217,7 @@ export var MediaGroupNext = injectIntl( /*#__PURE__*/React.memo(function (props)
214
217
  var filmstripItem = useMemo(function () {
215
218
  return prepareFilmstripItem({
216
219
  allowLazyLoading: allowLazyLoading,
220
+ allowMediaInlineImages: allowMediaInlineImages,
217
221
  enableDownloadButton: enableDownloadButton,
218
222
  handleMediaNodeRemoval: handleMediaNodeRemoval,
219
223
  getPos: _getPos,
@@ -222,7 +226,7 @@ export var MediaGroupNext = injectIntl( /*#__PURE__*/React.memo(function (props)
222
226
  setMediaGroupNodeSelection: setMediaGroupNodeSelection,
223
227
  featureFlags: featureFlags
224
228
  });
225
- }, [allowLazyLoading, enableDownloadButton, handleMediaNodeRemoval, _getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection, featureFlags]);
229
+ }, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, _getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection, featureFlags]);
226
230
  var items = useMemo(function () {
227
231
  return mediaNodesWithOffsets.map(function (_ref4) {
228
232
  var node = _ref4.node,
@@ -24,6 +24,7 @@ import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
24
24
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
25
25
  import { isFileIdentifier } from '@atlaskit/media-client';
26
26
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
27
+ import { fg } from '@atlaskit/platform-feature-flags';
27
28
  import { updateMediaNodeAttrs } from '../pm-plugins/commands/helpers';
28
29
  // Ignored via go/ees005
29
30
  // eslint-disable-next-line import/no-namespace
@@ -63,9 +64,7 @@ var createDropPlaceholder = function createDropPlaceholder(intl, nodeViewPortalP
63
64
  var MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
64
65
  export var MediaPluginStateImplementation = /*#__PURE__*/function () {
65
66
  function MediaPluginStateImplementation(_state, options, mediaOptions, _dispatch, pluginInjectionApi) {
66
- var _this = this,
67
- _this$mediaOptions2,
68
- _this$mediaOptions3;
67
+ var _this = this;
69
68
  _classCallCheck(this, MediaPluginStateImplementation);
70
69
  _defineProperty(this, "allowsUploads", false);
71
70
  _defineProperty(this, "ignoreLinks", false);
@@ -456,8 +455,16 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
456
455
  if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.provider) {
457
456
  this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
458
457
  }
459
- if (mediaInlineImagesEnabled(getMediaFeatureFlag('mediaInline', (_this$mediaOptions2 = this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags), (_this$mediaOptions3 = this.mediaOptions) === null || _this$mediaOptions3 === void 0 ? void 0 : _this$mediaOptions3.allowMediaInlineImages)) {
460
- this.allowInlineImages = true;
458
+ if (fg('platform_editor_remove_media_inline_feature_flag')) {
459
+ var _this$mediaOptions2;
460
+ if ((_this$mediaOptions2 = this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInlineImages) {
461
+ this.allowInlineImages = true;
462
+ }
463
+ } else {
464
+ var _this$mediaOptions3, _this$mediaOptions4;
465
+ if (mediaInlineImagesEnabled(getMediaFeatureFlag('mediaInline', (_this$mediaOptions3 = this.mediaOptions) === null || _this$mediaOptions3 === void 0 ? void 0 : _this$mediaOptions3.featureFlags), (_this$mediaOptions4 = this.mediaOptions) === null || _this$mediaOptions4 === void 0 ? void 0 : _this$mediaOptions4.allowMediaInlineImages)) {
466
+ this.allowInlineImages = true;
467
+ }
461
468
  }
462
469
  this.errorReporter = options.errorReporter || new ErrorReporter();
463
470
  this.singletonCreatedAt = (performance || Date).now();
@@ -18,10 +18,16 @@ export var getMediaNodeInsertionType = function getMediaNodeInsertionType(state,
18
18
  return 'group';
19
19
  }
20
20
  var canInsertInlineNode = getMediaFeatureFlag('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInSupportedInlineImageParent(state)) && canInsertMediaInline(state);
21
- if (mediaInlineImagesEnabled(getMediaFeatureFlag('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags), mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.allowMediaInlineImages)) {
22
- if (canInsertInlineNode && !isVideo(fileMimeType)) {
21
+ if (fg('platform_editor_remove_media_inline_feature_flag')) {
22
+ if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.allowMediaInlineImages) {
23
23
  return 'inline';
24
24
  }
25
+ } else {
26
+ if (mediaInlineImagesEnabled(getMediaFeatureFlag('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags), mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.allowMediaInlineImages)) {
27
+ if (canInsertInlineNode && !isVideo(fileMimeType)) {
28
+ return 'inline';
29
+ }
30
+ }
25
31
  }
26
32
  if (isMediaSingle(state.schema, fileMimeType)) {
27
33
  return 'block';
@@ -279,8 +279,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
279
279
  }
280
280
  }
281
281
  var layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled);
282
- if (mediaInlineImagesEnabled(allowMediaInline, allowMediaInlineImages) && selectedNode) {
283
- var selectedLayoutIcon = getSelectedLayoutIcon([].concat(_toConsumableArray(alignmentIcons), _toConsumableArray(wrappingIcons)), selectedNode.node);
282
+ var addLayoutDropdownToToolbar = function addLayoutDropdownToToolbar() {
283
+ var selectedLayoutIcon = getSelectedLayoutIcon([].concat(_toConsumableArray(alignmentIcons), _toConsumableArray(wrappingIcons)),
284
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
285
+ selectedNode.node);
284
286
  if (selectedLayoutIcon && layoutButtons.length) {
285
287
  var _options = {
286
288
  render: function render(props) {
@@ -305,12 +307,28 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
305
307
  type: 'separator'
306
308
  }]);
307
309
  }
310
+ };
311
+ if (fg('platform_editor_remove_media_inline_feature_flag')) {
312
+ if (allowMediaInlineImages && selectedNode) {
313
+ addLayoutDropdownToToolbar();
314
+ } else {
315
+ toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(layoutButtons));
316
+ if (layoutButtons.length) {
317
+ toolbarButtons.push({
318
+ type: 'separator'
319
+ });
320
+ }
321
+ }
308
322
  } else {
309
- toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(layoutButtons));
310
- if (layoutButtons.length) {
311
- toolbarButtons.push({
312
- type: 'separator'
313
- });
323
+ if (mediaInlineImagesEnabled(allowMediaInline, allowMediaInlineImages) && selectedNode) {
324
+ addLayoutDropdownToToolbar();
325
+ } else {
326
+ toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(layoutButtons));
327
+ if (layoutButtons.length) {
328
+ toolbarButtons.push({
329
+ type: 'separator'
330
+ });
331
+ }
314
332
  }
315
333
  }
316
334
 
@@ -677,11 +695,13 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
677
695
  allowLinking = options.allowLinking,
678
696
  allowAltTextOnImages = options.allowAltTextOnImages,
679
697
  providerFactory = options.providerFactory,
680
- allowMediaInline = options.allowMediaInline,
698
+ allowMediaInlineImages = options.allowMediaInlineImages,
681
699
  allowResizing = options.allowResizing,
682
700
  isViewOnly = options.isViewOnly,
683
701
  allowResizingInTables = options.allowResizingInTables,
684
702
  allowAdvancedToolBarOptions = options.allowAdvancedToolBarOptions;
703
+ var allowMediaInline = options.allowMediaInline;
704
+ allowMediaInline = fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : allowMediaInline;
685
705
  var mediaPluginState = stateKey.getState(state);
686
706
  var mediaLinkingState = getMediaLinkingState(state);
687
707
  var _ref3 = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d4 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "2.3.18",
3
+ "version": "2.3.19",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/analytics-namespaced-context": "^7.0.0",
39
39
  "@atlaskit/analytics-next": "^11.0.0",
40
40
  "@atlaskit/button": "^23.0.0",
41
- "@atlaskit/editor-common": "^102.16.0",
41
+ "@atlaskit/editor-common": "^102.17.0",
42
42
  "@atlaskit/editor-palette": "^2.1.0",
43
43
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
44
44
  "@atlaskit/editor-plugin-annotation": "^2.2.0",
@@ -173,6 +173,9 @@
173
173
  },
174
174
  "platform_editor_controls_patch_1": {
175
175
  "type": "boolean"
176
+ },
177
+ "platform_editor_remove_media_inline_feature_flag": {
178
+ "type": "boolean"
176
179
  }
177
180
  },
178
181
  "stricter": {