@atlaskit/editor-plugin-media 24.1.0 → 25.0.1
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 +15 -0
- package/dist/cjs/mediaPlugin.js +9 -5
- package/dist/cjs/nodeviews/mediaGroupNext.js +8 -4
- package/dist/cjs/pm-plugins/main.js +17 -8
- package/dist/cjs/pm-plugins/utils/media-inline.js +12 -3
- package/dist/cjs/ui/toolbar/index.js +26 -10
- package/dist/es2019/mediaPlugin.js +6 -2
- package/dist/es2019/nodeviews/mediaGroupNext.js +8 -4
- package/dist/es2019/pm-plugins/main.js +14 -5
- package/dist/es2019/pm-plugins/utils/media-inline.js +12 -3
- package/dist/es2019/ui/toolbar/index.js +26 -8
- package/dist/esm/mediaPlugin.js +6 -2
- package/dist/esm/nodeviews/mediaGroupNext.js +8 -4
- package/dist/esm/pm-plugins/main.js +15 -6
- package/dist/esm/pm-plugins/utils/media-inline.js +12 -3
- package/dist/esm/ui/toolbar/index.js +24 -8
- package/package.json +23 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 25.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e9abdca4bf1d7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e9abdca4bf1d7) -
|
|
8
|
+
Restore legacy inline media configuration behind platform_editor_remove_media_inline_feature_flag
|
|
9
|
+
to fix inline attachment insertion and upload completion in Jira.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 25.0.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 24.1.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/dist/cjs/mediaPlugin.js
CHANGED
|
@@ -15,7 +15,9 @@ var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
|
15
15
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
16
16
|
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
17
17
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
18
|
+
var _mediaCommon = require("@atlaskit/media-common");
|
|
18
19
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
20
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
19
21
|
var _lazyMediaGroup = require("./nodeviews/lazy-media-group");
|
|
20
22
|
var _lazyMediaInline = require("./nodeviews/lazy-media-inline");
|
|
21
23
|
var _mediaNodeView = require("./nodeviews/mediaNodeView");
|
|
@@ -35,7 +37,7 @@ var _keymap3 = _interopRequireDefault(require("./pm-plugins/linking/keymap"));
|
|
|
35
37
|
var _main = require("./pm-plugins/main");
|
|
36
38
|
var _pixelResizing = require("./pm-plugins/pixel-resizing");
|
|
37
39
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
38
|
-
var
|
|
40
|
+
var _mediaCommon2 = require("./pm-plugins/utils/media-common");
|
|
39
41
|
var _mediaSingle3 = require("./pm-plugins/utils/media-single");
|
|
40
42
|
var _MediaPicker = require("./ui/MediaPicker");
|
|
41
43
|
var _PortalWrapper = require("./ui/MediaViewer/PortalWrapper");
|
|
@@ -90,8 +92,8 @@ var MediaViewerFunctionalComponent = function MediaViewerFunctionalComponent(_re
|
|
|
90
92
|
mediaClientConfig = _useSharedPluginState2.mediaClientConfig;
|
|
91
93
|
var mediaItems = (0, _react.useMemo)(function () {
|
|
92
94
|
if (isMediaViewerVisible) {
|
|
93
|
-
var mediaNodes = (0,
|
|
94
|
-
return (0,
|
|
95
|
+
var mediaNodes = (0, _mediaCommon2.extractMediaNodes)(editorView.state.doc);
|
|
96
|
+
return (0, _mediaCommon2.createMediaIdentifierArray)(mediaNodes);
|
|
95
97
|
}
|
|
96
98
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- only update mediaItems once when media viewer is visible
|
|
97
99
|
}, [isMediaViewerVisible]);
|
|
@@ -193,8 +195,9 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
193
195
|
_ref5$allowPixelResiz = _ref5.allowPixelResizing,
|
|
194
196
|
allowPixelResizing = _ref5$allowPixelResiz === void 0 ? false : _ref5$allowPixelResiz,
|
|
195
197
|
allowCaptions = _ref5.allowCaptions,
|
|
196
|
-
allowMediaInlineImages = _ref5.allowMediaInlineImages
|
|
197
|
-
|
|
198
|
+
allowMediaInlineImages = _ref5.allowMediaInlineImages,
|
|
199
|
+
mediaFeatureFlags = _ref5.featureFlags;
|
|
200
|
+
var allowMediaInline = (0, _fg.fg)('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaFeatureFlags);
|
|
198
201
|
var mediaSingleOption = {
|
|
199
202
|
withCaption: allowCaptions,
|
|
200
203
|
withExtendedWidthTypes: allowPixelResizing
|
|
@@ -404,6 +407,7 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
404
407
|
var _api$editorViewMode;
|
|
405
408
|
return (0, _toolbar.floatingToolbar)(state, intl, {
|
|
406
409
|
providerFactory: providerFactory,
|
|
410
|
+
allowMediaInline: options && (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', options.featureFlags),
|
|
407
411
|
allowResizing: options && options.allowResizing,
|
|
408
412
|
allowResizingInTables: options && options.allowResizingInTables,
|
|
409
413
|
allowCommentsOnMedia: options && options.allowCommentsOnMedia,
|
|
@@ -16,7 +16,9 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
16
16
|
var _media = require("@atlaskit/editor-common/media");
|
|
17
17
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
18
18
|
var _cross = _interopRequireDefault(require("@atlaskit/icon/core/cross"));
|
|
19
|
+
var _mediaCommon = require("@atlaskit/media-common");
|
|
19
20
|
var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
|
|
21
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
20
22
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
21
23
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
22
24
|
var _mediaNodeUpdater = require("./mediaNodeUpdater");
|
|
@@ -56,7 +58,8 @@ var prepareFilmstripItem = function prepareFilmstripItem(_ref) {
|
|
|
56
58
|
getPos = _ref.getPos,
|
|
57
59
|
intl = _ref.intl,
|
|
58
60
|
isMediaItemSelected = _ref.isMediaItemSelected,
|
|
59
|
-
setMediaGroupNodeSelection = _ref.setMediaGroupNodeSelection
|
|
61
|
+
setMediaGroupNodeSelection = _ref.setMediaGroupNodeSelection,
|
|
62
|
+
featureFlags = _ref.featureFlags;
|
|
60
63
|
return function (item, idx) {
|
|
61
64
|
// We declared this to get a fresh position every time
|
|
62
65
|
var getNodePos = function getNodePos() {
|
|
@@ -95,7 +98,7 @@ var prepareFilmstripItem = function prepareFilmstripItem(_ref) {
|
|
|
95
98
|
onClick: function onClick() {
|
|
96
99
|
setMediaGroupNodeSelection(getNodePos());
|
|
97
100
|
}
|
|
98
|
-
}, mediaInlineOptions(allowMediaInlineImages));
|
|
101
|
+
}, mediaInlineOptions((0, _fg.fg)('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', featureFlags)));
|
|
99
102
|
};
|
|
100
103
|
};
|
|
101
104
|
|
|
@@ -231,9 +234,10 @@ var MediaGroupNext = exports.MediaGroupNext = (0, _reactIntl.injectIntl)( /*#__P
|
|
|
231
234
|
getPos: _getPos,
|
|
232
235
|
intl: intl,
|
|
233
236
|
isMediaItemSelected: isMediaItemSelected,
|
|
234
|
-
setMediaGroupNodeSelection: setMediaGroupNodeSelection
|
|
237
|
+
setMediaGroupNodeSelection: setMediaGroupNodeSelection,
|
|
238
|
+
featureFlags: featureFlags
|
|
235
239
|
});
|
|
236
|
-
}, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, _getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection]);
|
|
240
|
+
}, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, _getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection, featureFlags]);
|
|
237
241
|
var items = (0, _react.useMemo)(function () {
|
|
238
242
|
return mediaNodesWithOffsets.map(function (_ref4) {
|
|
239
243
|
var node = _ref4.node,
|
|
@@ -18,6 +18,7 @@ var _uuid = require("uuid");
|
|
|
18
18
|
var _setAttrs = require("@atlaskit/adf-schema/steps/set-attrs");
|
|
19
19
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
20
20
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
21
|
+
var _mediaInline = require("@atlaskit/editor-common/media-inline");
|
|
21
22
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
22
23
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
23
24
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -29,12 +30,13 @@ var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
|
29
30
|
var _mediaClient = require("@atlaskit/media-client");
|
|
30
31
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
31
32
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
33
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
32
34
|
var _mediaNodeUpdater = require("../nodeviews/mediaNodeUpdater");
|
|
33
35
|
var _helpers = _interopRequireWildcard(require("../pm-plugins/commands/helpers"));
|
|
34
36
|
var helpers = _helpers;
|
|
35
37
|
var _mediaCommon2 = require("../pm-plugins/utils/media-common");
|
|
36
38
|
var _mediaFiles = require("../pm-plugins/utils/media-files");
|
|
37
|
-
var
|
|
39
|
+
var _mediaInline2 = require("../pm-plugins/utils/media-inline");
|
|
38
40
|
var _mediaSingle2 = require("../pm-plugins/utils/media-single");
|
|
39
41
|
var _DropPlaceholder = _interopRequireDefault(require("../ui/Media/DropPlaceholder"));
|
|
40
42
|
var _actions = require("./actions");
|
|
@@ -76,8 +78,7 @@ var createDropPlaceholder = function createDropPlaceholder(intl, nodeViewPortalP
|
|
|
76
78
|
var MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
|
|
77
79
|
var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
78
80
|
function MediaPluginStateImplementation(_state, options, mediaOptions, _dispatch, pluginInjectionApi) {
|
|
79
|
-
var _this = this
|
|
80
|
-
_this$mediaOptions2;
|
|
81
|
+
var _this = this;
|
|
81
82
|
(0, _classCallCheck2.default)(this, MediaPluginStateImplementation);
|
|
82
83
|
(0, _defineProperty2.default)(this, "allowsUploads", false);
|
|
83
84
|
(0, _defineProperty2.default)(this, "uploadStatus", 'pending');
|
|
@@ -290,7 +291,7 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
290
291
|
}
|
|
291
292
|
return;
|
|
292
293
|
}
|
|
293
|
-
switch ((0,
|
|
294
|
+
switch ((0, _mediaInline2.getMediaNodeInsertionType)(state, _this.mediaOptions, mediaStateWithContext.fileMimeType)) {
|
|
294
295
|
case 'inline':
|
|
295
296
|
(0, _mediaFiles.insertMediaInlineNode)(editorAnalyticsAPI)(_this.view, mediaStateWithContext, collection, _this.allowInlineImages, _this.getInputMethod(pickerType), insertMediaVia);
|
|
296
297
|
break;
|
|
@@ -672,8 +673,16 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
672
673
|
} else if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.provider) {
|
|
673
674
|
this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
|
|
674
675
|
}
|
|
675
|
-
if ((
|
|
676
|
-
|
|
676
|
+
if ((0, _fg.fg)('platform_editor_remove_media_inline_feature_flag')) {
|
|
677
|
+
var _this$mediaOptions2;
|
|
678
|
+
if ((_this$mediaOptions2 = this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInlineImages) {
|
|
679
|
+
this.allowInlineImages = true;
|
|
680
|
+
}
|
|
681
|
+
} else {
|
|
682
|
+
var _this$mediaOptions3, _this$mediaOptions4;
|
|
683
|
+
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)) {
|
|
684
|
+
this.allowInlineImages = true;
|
|
685
|
+
}
|
|
677
686
|
}
|
|
678
687
|
this.errorReporter = options.errorReporter || new _utils.ErrorReporter();
|
|
679
688
|
this.singletonCreatedAt = (performance || Date).now();
|
|
@@ -896,10 +905,10 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
896
905
|
}, {
|
|
897
906
|
key: "selectLastAddedMediaNode",
|
|
898
907
|
value: function selectLastAddedMediaNode() {
|
|
899
|
-
var _this$
|
|
908
|
+
var _this$mediaOptions5,
|
|
900
909
|
_this2 = this;
|
|
901
910
|
// if preventAutoFocusOnUpload is enabled, skip auto-selection and just clear the tracking array
|
|
902
|
-
if ((_this$
|
|
911
|
+
if ((_this$mediaOptions5 = this.mediaOptions) !== null && _this$mediaOptions5 !== void 0 && _this$mediaOptions5.preventAutoFocusOnUpload) {
|
|
903
912
|
this.lastAddedMediaSingleFileIds = [];
|
|
904
913
|
return;
|
|
905
914
|
}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isInSupportedInlineImageParent = exports.getMediaNodeInsertionType = void 0;
|
|
7
|
+
var _mediaInline = require("@atlaskit/editor-common/media-inline");
|
|
7
8
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
8
9
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
9
10
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
@@ -23,9 +24,17 @@ var getMediaNodeInsertionType = exports.getMediaNodeInsertionType = function get
|
|
|
23
24
|
return 'group';
|
|
24
25
|
}
|
|
25
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);
|
|
26
|
-
if (
|
|
27
|
-
if (
|
|
28
|
-
|
|
27
|
+
if ((0, _fg.fg)('platform_editor_remove_media_inline_feature_flag')) {
|
|
28
|
+
if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.allowMediaInlineImages) {
|
|
29
|
+
if (canInsertInlineNode && !(0, _isType.isVideo)(fileMimeType)) {
|
|
30
|
+
return 'inline';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
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)) {
|
|
35
|
+
if (canInsertInlineNode && !(0, _isType.isVideo)(fileMimeType)) {
|
|
36
|
+
return 'inline';
|
|
37
|
+
}
|
|
29
38
|
}
|
|
30
39
|
}
|
|
31
40
|
if ((0, _mediaSingle.isMediaSingle)(state.schema, fileMimeType)) {
|
|
@@ -13,6 +13,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
13
13
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
14
14
|
var _card = require("@atlaskit/editor-common/card");
|
|
15
15
|
var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
16
|
+
var _mediaInline = require("@atlaskit/editor-common/media-inline");
|
|
16
17
|
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
17
18
|
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
18
19
|
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
@@ -50,7 +51,7 @@ var _imageBorder = require("./imageBorder");
|
|
|
50
51
|
var _layoutGroup = require("./layout-group");
|
|
51
52
|
var _linking3 = require("./linking");
|
|
52
53
|
var _linkingToolbarAppearance = require("./linking-toolbar-appearance");
|
|
53
|
-
var
|
|
54
|
+
var _mediaInline2 = require("./mediaInline");
|
|
54
55
|
var _pixelResizing2 = require("./pixel-resizing");
|
|
55
56
|
var _utils2 = require("./utils");
|
|
56
57
|
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); }
|
|
@@ -281,6 +282,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
281
282
|
allowCommentsOnMedia = options.allowCommentsOnMedia,
|
|
282
283
|
allowResizingInTables = options.allowResizingInTables,
|
|
283
284
|
allowAltTextOnImages = options.allowAltTextOnImages,
|
|
285
|
+
allowMediaInline = options.allowMediaInline,
|
|
284
286
|
allowMediaInlineImages = options.allowMediaInlineImages,
|
|
285
287
|
allowImageEditing = options.allowImageEditing,
|
|
286
288
|
allowImagePreview = options.allowImagePreview,
|
|
@@ -380,14 +382,27 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
380
382
|
}
|
|
381
383
|
}
|
|
382
384
|
};
|
|
383
|
-
if (
|
|
384
|
-
|
|
385
|
+
if ((0, _fg.fg)('platform_editor_remove_media_inline_feature_flag')) {
|
|
386
|
+
if (allowMediaInlineImages && selectedNode) {
|
|
387
|
+
addLayoutDropdownToToolbar();
|
|
388
|
+
} else {
|
|
389
|
+
toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)(layoutButtons));
|
|
390
|
+
if (layoutButtons.length && !mauiToolbarSeparatorsUpdateEnabled) {
|
|
391
|
+
toolbarButtons.push({
|
|
392
|
+
type: 'separator'
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
}
|
|
385
396
|
} else {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
397
|
+
if ((0, _mediaInline.mediaInlineImagesEnabled)(allowMediaInline, allowMediaInlineImages) && selectedNode) {
|
|
398
|
+
addLayoutDropdownToToolbar();
|
|
399
|
+
} else {
|
|
400
|
+
toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)(layoutButtons));
|
|
401
|
+
if (layoutButtons.length && !areAnyNewToolbarFlagsEnabled) {
|
|
402
|
+
toolbarButtons.push({
|
|
403
|
+
type: 'separator'
|
|
404
|
+
});
|
|
405
|
+
}
|
|
391
406
|
}
|
|
392
407
|
}
|
|
393
408
|
|
|
@@ -794,7 +809,8 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
794
809
|
allowResizingInTables = options.allowResizingInTables,
|
|
795
810
|
allowAdvancedToolBarOptions = options.allowAdvancedToolBarOptions,
|
|
796
811
|
allowPixelResizing = options.allowPixelResizing;
|
|
797
|
-
var allowMediaInline =
|
|
812
|
+
var allowMediaInline = options.allowMediaInline;
|
|
813
|
+
allowMediaInline = (0, _fg.fg)('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : allowMediaInline;
|
|
798
814
|
var mediaPluginState = _pluginKey.stateKey.getState(state);
|
|
799
815
|
var mediaLinkingState = (0, _linking2.getMediaLinkingState)(state);
|
|
800
816
|
var _ref4 = (_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 : {},
|
|
@@ -871,7 +887,7 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
871
887
|
};
|
|
872
888
|
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a9 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a9 === void 0 ? void 0 : _pluginInjectionApi$a9.actions, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 || (_pluginInjectionApi$f2 = _pluginInjectionApi$f2.actions) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.forceFocusSelector, isViewOnly);
|
|
873
889
|
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
874
|
-
items = (0,
|
|
890
|
+
items = (0, _mediaInline2.generateMediaInlineFloatingToolbar)(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, options);
|
|
875
891
|
} else {
|
|
876
892
|
baseToolbar.getDomRef = function () {
|
|
877
893
|
var _mediaPluginState$ele3;
|
|
@@ -6,7 +6,9 @@ import { IconImages } from '@atlaskit/editor-common/quick-insert';
|
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
7
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
8
8
|
import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
9
|
+
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
9
10
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
12
|
import { lazyMediaGroupView } from './nodeviews/lazy-media-group';
|
|
11
13
|
import { lazyMediaInlineView } from './nodeviews/lazy-media-inline';
|
|
12
14
|
import { ReactMediaNode } from './nodeviews/mediaNodeView';
|
|
@@ -181,9 +183,10 @@ export const mediaPlugin = ({
|
|
|
181
183
|
allowMediaSingle = false,
|
|
182
184
|
allowPixelResizing = false,
|
|
183
185
|
allowCaptions,
|
|
184
|
-
allowMediaInlineImages
|
|
186
|
+
allowMediaInlineImages,
|
|
187
|
+
featureFlags: mediaFeatureFlags
|
|
185
188
|
} = options || {};
|
|
186
|
-
const allowMediaInline = allowMediaInlineImages;
|
|
189
|
+
const allowMediaInline = fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : getMediaFeatureFlag('mediaInline', mediaFeatureFlags);
|
|
187
190
|
const mediaSingleOption = {
|
|
188
191
|
withCaption: allowCaptions,
|
|
189
192
|
withExtendedWidthTypes: allowPixelResizing
|
|
@@ -395,6 +398,7 @@ export const mediaPlugin = ({
|
|
|
395
398
|
var _api$editorViewMode, _api$editorViewMode$s;
|
|
396
399
|
return floatingToolbar(state, intl, {
|
|
397
400
|
providerFactory,
|
|
401
|
+
allowMediaInline: options && getMediaFeatureFlag('mediaInline', options.featureFlags),
|
|
398
402
|
allowResizing: options && options.allowResizing,
|
|
399
403
|
allowResizingInTables: options && options.allowResizingInTables,
|
|
400
404
|
allowCommentsOnMedia: options && options.allowCommentsOnMedia,
|
|
@@ -4,7 +4,9 @@ import { usePreviousState } from '@atlaskit/editor-common/hooks';
|
|
|
4
4
|
import { nodeViewsMessages as messages } from '@atlaskit/editor-common/media';
|
|
5
5
|
import { isNodeSelectedOrInRange, SelectedState, setNodeSelection } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import EditorCloseIcon from '@atlaskit/icon/core/cross';
|
|
7
|
+
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
7
8
|
import { Filmstrip } from '@atlaskit/media-filmstrip';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
9
11
|
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
10
12
|
import { createMediaNodeUpdater } from './mediaNodeUpdater';
|
|
@@ -39,7 +41,8 @@ const prepareFilmstripItem = ({
|
|
|
39
41
|
getPos,
|
|
40
42
|
intl,
|
|
41
43
|
isMediaItemSelected,
|
|
42
|
-
setMediaGroupNodeSelection
|
|
44
|
+
setMediaGroupNodeSelection,
|
|
45
|
+
featureFlags
|
|
43
46
|
}) => (item, idx) => {
|
|
44
47
|
// We declared this to get a fresh position every time
|
|
45
48
|
const getNodePos = () => {
|
|
@@ -77,7 +80,7 @@ const prepareFilmstripItem = ({
|
|
|
77
80
|
onClick: () => {
|
|
78
81
|
setMediaGroupNodeSelection(getNodePos());
|
|
79
82
|
},
|
|
80
|
-
...mediaInlineOptions(allowMediaInlineImages)
|
|
83
|
+
...mediaInlineOptions(fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : getMediaFeatureFlag('mediaInline', featureFlags))
|
|
81
84
|
};
|
|
82
85
|
};
|
|
83
86
|
|
|
@@ -186,9 +189,10 @@ export const MediaGroupNext = injectIntl( /*#__PURE__*/React.memo(props => {
|
|
|
186
189
|
getPos,
|
|
187
190
|
intl,
|
|
188
191
|
isMediaItemSelected,
|
|
189
|
-
setMediaGroupNodeSelection
|
|
192
|
+
setMediaGroupNodeSelection,
|
|
193
|
+
featureFlags
|
|
190
194
|
});
|
|
191
|
-
}, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection]);
|
|
195
|
+
}, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection, featureFlags]);
|
|
192
196
|
const items = useMemo(() => {
|
|
193
197
|
return mediaNodesWithOffsets.map(({
|
|
194
198
|
node,
|
|
@@ -7,6 +7,7 @@ import { v4 as uuid } from 'uuid';
|
|
|
7
7
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps/set-attrs';
|
|
8
8
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
10
|
+
import { mediaInlineImagesEnabled } from '@atlaskit/editor-common/media-inline';
|
|
10
11
|
import { CAPTION_PLACEHOLDER_ID, getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
|
|
11
12
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
12
13
|
import { ErrorReporter } from '@atlaskit/editor-common/utils';
|
|
@@ -18,6 +19,7 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
|
18
19
|
import { isFileIdentifier } from '@atlaskit/media-client';
|
|
19
20
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
20
21
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
22
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
21
23
|
import { createMediaNodeUpdater } from '../nodeviews/mediaNodeUpdater';
|
|
22
24
|
// Ignored via go/ees005
|
|
23
25
|
// eslint-disable-next-line import/no-namespace
|
|
@@ -55,7 +57,6 @@ const createDropPlaceholder = (intl, nodeViewPortalProviderAPI, dropPlaceholderK
|
|
|
55
57
|
const MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
|
|
56
58
|
export class MediaPluginStateImplementation {
|
|
57
59
|
constructor(_state, options, mediaOptions, _dispatch, pluginInjectionApi) {
|
|
58
|
-
var _this$mediaOptions2;
|
|
59
60
|
_defineProperty(this, "allowsUploads", false);
|
|
60
61
|
_defineProperty(this, "uploadStatus", 'pending');
|
|
61
62
|
_defineProperty(this, "ignoreLinks", false);
|
|
@@ -663,8 +664,16 @@ export class MediaPluginStateImplementation {
|
|
|
663
664
|
} else if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.provider) {
|
|
664
665
|
this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
|
|
665
666
|
}
|
|
666
|
-
if ((
|
|
667
|
-
|
|
667
|
+
if (fg('platform_editor_remove_media_inline_feature_flag')) {
|
|
668
|
+
var _this$mediaOptions2;
|
|
669
|
+
if ((_this$mediaOptions2 = this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInlineImages) {
|
|
670
|
+
this.allowInlineImages = true;
|
|
671
|
+
}
|
|
672
|
+
} else {
|
|
673
|
+
var _this$mediaOptions3, _this$mediaOptions4;
|
|
674
|
+
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)) {
|
|
675
|
+
this.allowInlineImages = true;
|
|
676
|
+
}
|
|
668
677
|
}
|
|
669
678
|
this.errorReporter = options.errorReporter || new ErrorReporter();
|
|
670
679
|
this.singletonCreatedAt = (performance || Date).now();
|
|
@@ -821,9 +830,9 @@ export class MediaPluginStateImplementation {
|
|
|
821
830
|
return (_this$pluginInjection10 = this.pluginInjectionApi) === null || _this$pluginInjection10 === void 0 ? void 0 : (_this$pluginInjection11 = _this$pluginInjection10.contextIdentifier) === null || _this$pluginInjection11 === void 0 ? void 0 : (_this$pluginInjection12 = _this$pluginInjection11.sharedState.currentState()) === null || _this$pluginInjection12 === void 0 ? void 0 : _this$pluginInjection12.contextIdentifierProvider;
|
|
822
831
|
}
|
|
823
832
|
selectLastAddedMediaNode() {
|
|
824
|
-
var _this$
|
|
833
|
+
var _this$mediaOptions5;
|
|
825
834
|
// if preventAutoFocusOnUpload is enabled, skip auto-selection and just clear the tracking array
|
|
826
|
-
if ((_this$
|
|
835
|
+
if ((_this$mediaOptions5 = this.mediaOptions) !== null && _this$mediaOptions5 !== void 0 && _this$mediaOptions5.preventAutoFocusOnUpload) {
|
|
827
836
|
this.lastAddedMediaSingleFileIds = [];
|
|
828
837
|
return;
|
|
829
838
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { mediaInlineImagesEnabled } from '@atlaskit/editor-common/media-inline';
|
|
1
2
|
import { isInEmptyLine } from '@atlaskit/editor-common/utils';
|
|
2
3
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
4
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
@@ -17,9 +18,17 @@ export const getMediaNodeInsertionType = (state, mediaOptions, fileMimeType) =>
|
|
|
17
18
|
return 'group';
|
|
18
19
|
}
|
|
19
20
|
const canInsertInlineNode = getMediaFeatureFlag('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInSupportedInlineImageParent(state)) && canInsertMediaInline(state);
|
|
20
|
-
if (
|
|
21
|
-
if (
|
|
22
|
-
|
|
21
|
+
if (fg('platform_editor_remove_media_inline_feature_flag')) {
|
|
22
|
+
if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.allowMediaInlineImages) {
|
|
23
|
+
if (canInsertInlineNode && !isVideo(fileMimeType)) {
|
|
24
|
+
return 'inline';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
if (mediaInlineImagesEnabled(getMediaFeatureFlag('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags), mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.allowMediaInlineImages)) {
|
|
29
|
+
if (canInsertInlineNode && !isVideo(fileMimeType)) {
|
|
30
|
+
return 'inline';
|
|
31
|
+
}
|
|
23
32
|
}
|
|
24
33
|
}
|
|
25
34
|
if (isMediaSingle(state.schema, fileMimeType)) {
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { alignmentIcons, buildLayoutButtons, buildLayoutDropdown, layoutToMessages, wrappingIcons } from '@atlaskit/editor-common/card';
|
|
5
5
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
6
|
+
import { mediaInlineImagesEnabled } from '@atlaskit/editor-common/media-inline';
|
|
6
7
|
import commonMessages, { cardMessages, mediaAndEmbedToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
7
8
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
8
9
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
@@ -270,6 +271,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
270
271
|
allowCommentsOnMedia,
|
|
271
272
|
allowResizingInTables,
|
|
272
273
|
allowAltTextOnImages,
|
|
274
|
+
allowMediaInline,
|
|
273
275
|
allowMediaInlineImages,
|
|
274
276
|
allowImageEditing,
|
|
275
277
|
allowImagePreview,
|
|
@@ -373,14 +375,27 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
373
375
|
}
|
|
374
376
|
}
|
|
375
377
|
};
|
|
376
|
-
if (
|
|
377
|
-
|
|
378
|
+
if (fg('platform_editor_remove_media_inline_feature_flag')) {
|
|
379
|
+
if (allowMediaInlineImages && selectedNode) {
|
|
380
|
+
addLayoutDropdownToToolbar();
|
|
381
|
+
} else {
|
|
382
|
+
toolbarButtons = [...toolbarButtons, ...layoutButtons];
|
|
383
|
+
if (layoutButtons.length && !mauiToolbarSeparatorsUpdateEnabled) {
|
|
384
|
+
toolbarButtons.push({
|
|
385
|
+
type: 'separator'
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
}
|
|
378
389
|
} else {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
390
|
+
if (mediaInlineImagesEnabled(allowMediaInline, allowMediaInlineImages) && selectedNode) {
|
|
391
|
+
addLayoutDropdownToToolbar();
|
|
392
|
+
} else {
|
|
393
|
+
toolbarButtons = [...toolbarButtons, ...layoutButtons];
|
|
394
|
+
if (layoutButtons.length && !areAnyNewToolbarFlagsEnabled) {
|
|
395
|
+
toolbarButtons.push({
|
|
396
|
+
type: 'separator'
|
|
397
|
+
});
|
|
398
|
+
}
|
|
384
399
|
}
|
|
385
400
|
}
|
|
386
401
|
|
|
@@ -787,7 +802,10 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
787
802
|
allowAdvancedToolBarOptions,
|
|
788
803
|
allowPixelResizing
|
|
789
804
|
} = options;
|
|
790
|
-
|
|
805
|
+
let {
|
|
806
|
+
allowMediaInline
|
|
807
|
+
} = options;
|
|
808
|
+
allowMediaInline = fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : allowMediaInline;
|
|
791
809
|
const mediaPluginState = stateKey.getState(state);
|
|
792
810
|
const mediaLinkingState = getMediaLinkingState(state);
|
|
793
811
|
const {
|
package/dist/esm/mediaPlugin.js
CHANGED
|
@@ -9,7 +9,9 @@ import { IconImages } from '@atlaskit/editor-common/quick-insert';
|
|
|
9
9
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
10
10
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
11
11
|
import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
12
|
+
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
12
13
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
13
15
|
import { lazyMediaGroupView } from './nodeviews/lazy-media-group';
|
|
14
16
|
import { lazyMediaInlineView } from './nodeviews/lazy-media-inline';
|
|
15
17
|
import { ReactMediaNode } from './nodeviews/mediaNodeView';
|
|
@@ -184,8 +186,9 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
184
186
|
_ref5$allowPixelResiz = _ref5.allowPixelResizing,
|
|
185
187
|
allowPixelResizing = _ref5$allowPixelResiz === void 0 ? false : _ref5$allowPixelResiz,
|
|
186
188
|
allowCaptions = _ref5.allowCaptions,
|
|
187
|
-
allowMediaInlineImages = _ref5.allowMediaInlineImages
|
|
188
|
-
|
|
189
|
+
allowMediaInlineImages = _ref5.allowMediaInlineImages,
|
|
190
|
+
mediaFeatureFlags = _ref5.featureFlags;
|
|
191
|
+
var allowMediaInline = fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : getMediaFeatureFlag('mediaInline', mediaFeatureFlags);
|
|
189
192
|
var mediaSingleOption = {
|
|
190
193
|
withCaption: allowCaptions,
|
|
191
194
|
withExtendedWidthTypes: allowPixelResizing
|
|
@@ -395,6 +398,7 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
395
398
|
var _api$editorViewMode;
|
|
396
399
|
return _floatingToolbar(state, intl, {
|
|
397
400
|
providerFactory: providerFactory,
|
|
401
|
+
allowMediaInline: options && getMediaFeatureFlag('mediaInline', options.featureFlags),
|
|
398
402
|
allowResizing: options && options.allowResizing,
|
|
399
403
|
allowResizingInTables: options && options.allowResizingInTables,
|
|
400
404
|
allowCommentsOnMedia: options && options.allowCommentsOnMedia,
|
|
@@ -10,7 +10,9 @@ import { usePreviousState } from '@atlaskit/editor-common/hooks';
|
|
|
10
10
|
import { nodeViewsMessages as messages } from '@atlaskit/editor-common/media';
|
|
11
11
|
import { isNodeSelectedOrInRange, SelectedState, setNodeSelection } from '@atlaskit/editor-common/utils';
|
|
12
12
|
import EditorCloseIcon from '@atlaskit/icon/core/cross';
|
|
13
|
+
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
13
14
|
import { Filmstrip } from '@atlaskit/media-filmstrip';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
14
16
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
15
17
|
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
16
18
|
import { createMediaNodeUpdater } from './mediaNodeUpdater';
|
|
@@ -47,7 +49,8 @@ var prepareFilmstripItem = function prepareFilmstripItem(_ref) {
|
|
|
47
49
|
getPos = _ref.getPos,
|
|
48
50
|
intl = _ref.intl,
|
|
49
51
|
isMediaItemSelected = _ref.isMediaItemSelected,
|
|
50
|
-
setMediaGroupNodeSelection = _ref.setMediaGroupNodeSelection
|
|
52
|
+
setMediaGroupNodeSelection = _ref.setMediaGroupNodeSelection,
|
|
53
|
+
featureFlags = _ref.featureFlags;
|
|
51
54
|
return function (item, idx) {
|
|
52
55
|
// We declared this to get a fresh position every time
|
|
53
56
|
var getNodePos = function getNodePos() {
|
|
@@ -86,7 +89,7 @@ var prepareFilmstripItem = function prepareFilmstripItem(_ref) {
|
|
|
86
89
|
onClick: function onClick() {
|
|
87
90
|
setMediaGroupNodeSelection(getNodePos());
|
|
88
91
|
}
|
|
89
|
-
}, mediaInlineOptions(allowMediaInlineImages));
|
|
92
|
+
}, mediaInlineOptions(fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : getMediaFeatureFlag('mediaInline', featureFlags)));
|
|
90
93
|
};
|
|
91
94
|
};
|
|
92
95
|
|
|
@@ -222,9 +225,10 @@ export var MediaGroupNext = injectIntl( /*#__PURE__*/React.memo(function (props)
|
|
|
222
225
|
getPos: _getPos,
|
|
223
226
|
intl: intl,
|
|
224
227
|
isMediaItemSelected: isMediaItemSelected,
|
|
225
|
-
setMediaGroupNodeSelection: setMediaGroupNodeSelection
|
|
228
|
+
setMediaGroupNodeSelection: setMediaGroupNodeSelection,
|
|
229
|
+
featureFlags: featureFlags
|
|
226
230
|
});
|
|
227
|
-
}, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, _getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection]);
|
|
231
|
+
}, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, _getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection, featureFlags]);
|
|
228
232
|
var items = useMemo(function () {
|
|
229
233
|
return mediaNodesWithOffsets.map(function (_ref4) {
|
|
230
234
|
var node = _ref4.node,
|
|
@@ -16,6 +16,7 @@ import { v4 as uuid } from 'uuid';
|
|
|
16
16
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps/set-attrs';
|
|
17
17
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
18
18
|
import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
19
|
+
import { mediaInlineImagesEnabled } from '@atlaskit/editor-common/media-inline';
|
|
19
20
|
import { CAPTION_PLACEHOLDER_ID, getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
|
|
20
21
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
21
22
|
import { ErrorReporter } from '@atlaskit/editor-common/utils';
|
|
@@ -27,6 +28,7 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
|
27
28
|
import { isFileIdentifier } from '@atlaskit/media-client';
|
|
28
29
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
29
30
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
31
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
30
32
|
import { createMediaNodeUpdater } from '../nodeviews/mediaNodeUpdater';
|
|
31
33
|
// Ignored via go/ees005
|
|
32
34
|
// eslint-disable-next-line import/no-namespace
|
|
@@ -68,8 +70,7 @@ var createDropPlaceholder = function createDropPlaceholder(intl, nodeViewPortalP
|
|
|
68
70
|
var MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
|
|
69
71
|
export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
70
72
|
function MediaPluginStateImplementation(_state, options, mediaOptions, _dispatch, pluginInjectionApi) {
|
|
71
|
-
var _this = this
|
|
72
|
-
_this$mediaOptions2;
|
|
73
|
+
var _this = this;
|
|
73
74
|
_classCallCheck(this, MediaPluginStateImplementation);
|
|
74
75
|
_defineProperty(this, "allowsUploads", false);
|
|
75
76
|
_defineProperty(this, "uploadStatus", 'pending');
|
|
@@ -664,8 +665,16 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
664
665
|
} else if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.provider) {
|
|
665
666
|
this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
|
|
666
667
|
}
|
|
667
|
-
if ((
|
|
668
|
-
|
|
668
|
+
if (fg('platform_editor_remove_media_inline_feature_flag')) {
|
|
669
|
+
var _this$mediaOptions2;
|
|
670
|
+
if ((_this$mediaOptions2 = this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInlineImages) {
|
|
671
|
+
this.allowInlineImages = true;
|
|
672
|
+
}
|
|
673
|
+
} else {
|
|
674
|
+
var _this$mediaOptions3, _this$mediaOptions4;
|
|
675
|
+
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)) {
|
|
676
|
+
this.allowInlineImages = true;
|
|
677
|
+
}
|
|
669
678
|
}
|
|
670
679
|
this.errorReporter = options.errorReporter || new ErrorReporter();
|
|
671
680
|
this.singletonCreatedAt = (performance || Date).now();
|
|
@@ -888,10 +897,10 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
888
897
|
}, {
|
|
889
898
|
key: "selectLastAddedMediaNode",
|
|
890
899
|
value: function selectLastAddedMediaNode() {
|
|
891
|
-
var _this$
|
|
900
|
+
var _this$mediaOptions5,
|
|
892
901
|
_this2 = this;
|
|
893
902
|
// if preventAutoFocusOnUpload is enabled, skip auto-selection and just clear the tracking array
|
|
894
|
-
if ((_this$
|
|
903
|
+
if ((_this$mediaOptions5 = this.mediaOptions) !== null && _this$mediaOptions5 !== void 0 && _this$mediaOptions5.preventAutoFocusOnUpload) {
|
|
895
904
|
this.lastAddedMediaSingleFileIds = [];
|
|
896
905
|
return;
|
|
897
906
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { mediaInlineImagesEnabled } from '@atlaskit/editor-common/media-inline';
|
|
1
2
|
import { isInEmptyLine } from '@atlaskit/editor-common/utils';
|
|
2
3
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
4
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
@@ -17,9 +18,17 @@ export var getMediaNodeInsertionType = function getMediaNodeInsertionType(state,
|
|
|
17
18
|
return 'group';
|
|
18
19
|
}
|
|
19
20
|
var canInsertInlineNode = getMediaFeatureFlag('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInSupportedInlineImageParent(state)) && canInsertMediaInline(state);
|
|
20
|
-
if (
|
|
21
|
-
if (
|
|
22
|
-
|
|
21
|
+
if (fg('platform_editor_remove_media_inline_feature_flag')) {
|
|
22
|
+
if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.allowMediaInlineImages) {
|
|
23
|
+
if (canInsertInlineNode && !isVideo(fileMimeType)) {
|
|
24
|
+
return 'inline';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
if (mediaInlineImagesEnabled(getMediaFeatureFlag('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags), mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.allowMediaInlineImages)) {
|
|
29
|
+
if (canInsertInlineNode && !isVideo(fileMimeType)) {
|
|
30
|
+
return 'inline';
|
|
31
|
+
}
|
|
23
32
|
}
|
|
24
33
|
}
|
|
25
34
|
if (isMediaSingle(state.schema, fileMimeType)) {
|
|
@@ -7,6 +7,7 @@ import React from 'react';
|
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { alignmentIcons, buildLayoutButtons, buildLayoutDropdown, layoutToMessages, wrappingIcons } from '@atlaskit/editor-common/card';
|
|
9
9
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
10
|
+
import { mediaInlineImagesEnabled } from '@atlaskit/editor-common/media-inline';
|
|
10
11
|
import commonMessages, { cardMessages, mediaAndEmbedToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
11
12
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
12
13
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
@@ -272,6 +273,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
272
273
|
allowCommentsOnMedia = options.allowCommentsOnMedia,
|
|
273
274
|
allowResizingInTables = options.allowResizingInTables,
|
|
274
275
|
allowAltTextOnImages = options.allowAltTextOnImages,
|
|
276
|
+
allowMediaInline = options.allowMediaInline,
|
|
275
277
|
allowMediaInlineImages = options.allowMediaInlineImages,
|
|
276
278
|
allowImageEditing = options.allowImageEditing,
|
|
277
279
|
allowImagePreview = options.allowImagePreview,
|
|
@@ -371,14 +373,27 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
371
373
|
}
|
|
372
374
|
}
|
|
373
375
|
};
|
|
374
|
-
if (
|
|
375
|
-
|
|
376
|
+
if (fg('platform_editor_remove_media_inline_feature_flag')) {
|
|
377
|
+
if (allowMediaInlineImages && selectedNode) {
|
|
378
|
+
addLayoutDropdownToToolbar();
|
|
379
|
+
} else {
|
|
380
|
+
toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(layoutButtons));
|
|
381
|
+
if (layoutButtons.length && !mauiToolbarSeparatorsUpdateEnabled) {
|
|
382
|
+
toolbarButtons.push({
|
|
383
|
+
type: 'separator'
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
}
|
|
376
387
|
} else {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
388
|
+
if (mediaInlineImagesEnabled(allowMediaInline, allowMediaInlineImages) && selectedNode) {
|
|
389
|
+
addLayoutDropdownToToolbar();
|
|
390
|
+
} else {
|
|
391
|
+
toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(layoutButtons));
|
|
392
|
+
if (layoutButtons.length && !areAnyNewToolbarFlagsEnabled) {
|
|
393
|
+
toolbarButtons.push({
|
|
394
|
+
type: 'separator'
|
|
395
|
+
});
|
|
396
|
+
}
|
|
382
397
|
}
|
|
383
398
|
}
|
|
384
399
|
|
|
@@ -785,7 +800,8 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
785
800
|
allowResizingInTables = options.allowResizingInTables,
|
|
786
801
|
allowAdvancedToolBarOptions = options.allowAdvancedToolBarOptions,
|
|
787
802
|
allowPixelResizing = options.allowPixelResizing;
|
|
788
|
-
var allowMediaInline =
|
|
803
|
+
var allowMediaInline = options.allowMediaInline;
|
|
804
|
+
allowMediaInline = fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : allowMediaInline;
|
|
789
805
|
var mediaPluginState = stateKey.getState(state);
|
|
790
806
|
var mediaLinkingState = getMediaLinkingState(state);
|
|
791
807
|
var _ref4 = (_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": "
|
|
3
|
+
"version": "25.0.1",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,22 +27,22 @@
|
|
|
27
27
|
"@atlaskit/button": "^25.4.0",
|
|
28
28
|
"@atlaskit/css": "^1.1.0",
|
|
29
29
|
"@atlaskit/editor-palette": "^3.5.0",
|
|
30
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
31
|
-
"@atlaskit/editor-plugin-annotation": "^
|
|
32
|
-
"@atlaskit/editor-plugin-connectivity": "^
|
|
33
|
-
"@atlaskit/editor-plugin-decorations": "^
|
|
34
|
-
"@atlaskit/editor-plugin-editor-disabled": "^
|
|
35
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
36
|
-
"@atlaskit/editor-plugin-floating-toolbar": "^
|
|
37
|
-
"@atlaskit/editor-plugin-focus": "^
|
|
38
|
-
"@atlaskit/editor-plugin-grid": "^
|
|
39
|
-
"@atlaskit/editor-plugin-guideline": "^
|
|
40
|
-
"@atlaskit/editor-plugin-interaction": "^
|
|
41
|
-
"@atlaskit/editor-plugin-limited-mode": "^
|
|
42
|
-
"@atlaskit/editor-plugin-media-editing": "^
|
|
43
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
44
|
-
"@atlaskit/editor-plugin-toolbar": "^
|
|
45
|
-
"@atlaskit/editor-plugin-width": "^
|
|
30
|
+
"@atlaskit/editor-plugin-analytics": "^23.0.0",
|
|
31
|
+
"@atlaskit/editor-plugin-annotation": "^23.0.0",
|
|
32
|
+
"@atlaskit/editor-plugin-connectivity": "^23.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-decorations": "^23.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-editor-disabled": "^23.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^25.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^25.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-focus": "^22.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-grid": "^23.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-guideline": "^23.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-interaction": "^37.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-limited-mode": "^20.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-media-editing": "^17.0.0",
|
|
43
|
+
"@atlaskit/editor-plugin-selection": "^23.0.0",
|
|
44
|
+
"@atlaskit/editor-plugin-toolbar": "^20.0.0",
|
|
45
|
+
"@atlaskit/editor-plugin-width": "^24.1.0",
|
|
46
46
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
47
47
|
"@atlaskit/editor-shared-styles": "^4.3.0",
|
|
48
48
|
"@atlaskit/editor-tables": "^3.2.0",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
62
62
|
"@atlaskit/primitives": "^22.5.0",
|
|
63
63
|
"@atlaskit/textfield": "^10.2.0",
|
|
64
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
64
|
+
"@atlaskit/tmp-editor-statsig": "^219.0.0",
|
|
65
65
|
"@atlaskit/tokens": "^20.1.0",
|
|
66
|
-
"@atlaskit/tooltip": "^24.
|
|
66
|
+
"@atlaskit/tooltip": "^24.4.0",
|
|
67
67
|
"@babel/runtime": "^7.0.0",
|
|
68
68
|
"@compiled/react": "^1.0.2",
|
|
69
69
|
"@emotion/react": "^11.7.1",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"uuid": "^11.1.1"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@atlaskit/editor-common": "^
|
|
77
|
+
"@atlaskit/editor-common": "^127.1.0",
|
|
78
78
|
"@atlaskit/media-core": "^39.0.0",
|
|
79
79
|
"react": "^18.2.0 || ^19.2.0",
|
|
80
80
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
@@ -102,6 +102,9 @@
|
|
|
102
102
|
"platform_editor_safari_media_clipboard_fix": {
|
|
103
103
|
"type": "boolean"
|
|
104
104
|
},
|
|
105
|
+
"platform_editor_remove_media_inline_feature_flag": {
|
|
106
|
+
"type": "boolean"
|
|
107
|
+
},
|
|
105
108
|
"platform_editor_content_mode_button_mvp": {
|
|
106
109
|
"type": "boolean"
|
|
107
110
|
},
|