@atlaskit/editor-plugin-media 24.0.9 → 24.0.10
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 +7 -0
- package/dist/cjs/mediaPlugin.js +5 -9
- package/dist/cjs/nodeviews/mediaGroupNext.js +4 -8
- package/dist/cjs/pm-plugins/main.js +8 -17
- package/dist/cjs/pm-plugins/utils/media-inline.js +3 -12
- package/dist/cjs/ui/toolbar/index.js +10 -26
- package/dist/es2019/mediaPlugin.js +2 -6
- package/dist/es2019/nodeviews/mediaGroupNext.js +4 -8
- package/dist/es2019/pm-plugins/main.js +5 -14
- package/dist/es2019/pm-plugins/utils/media-inline.js +3 -12
- package/dist/es2019/ui/toolbar/index.js +8 -26
- package/dist/esm/mediaPlugin.js +2 -6
- package/dist/esm/nodeviews/mediaGroupNext.js +4 -8
- package/dist/esm/pm-plugins/main.js +6 -15
- package/dist/esm/pm-plugins/utils/media-inline.js +3 -12
- package/dist/esm/ui/toolbar/index.js +8 -24
- package/package.json +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 24.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b67e12494653e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b67e12494653e) -
|
|
8
|
+
Clean up feature gate `platform_editor_remove_media_inline_feature_flag`
|
|
9
|
+
|
|
3
10
|
## 24.0.9
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/cjs/mediaPlugin.js
CHANGED
|
@@ -15,9 +15,7 @@ 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");
|
|
19
18
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
20
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
21
19
|
var _lazyMediaGroup = require("./nodeviews/lazy-media-group");
|
|
22
20
|
var _lazyMediaInline = require("./nodeviews/lazy-media-inline");
|
|
23
21
|
var _mediaNodeView = require("./nodeviews/mediaNodeView");
|
|
@@ -37,7 +35,7 @@ var _keymap3 = _interopRequireDefault(require("./pm-plugins/linking/keymap"));
|
|
|
37
35
|
var _main = require("./pm-plugins/main");
|
|
38
36
|
var _pixelResizing = require("./pm-plugins/pixel-resizing");
|
|
39
37
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
40
|
-
var
|
|
38
|
+
var _mediaCommon = require("./pm-plugins/utils/media-common");
|
|
41
39
|
var _mediaSingle3 = require("./pm-plugins/utils/media-single");
|
|
42
40
|
var _MediaPicker = require("./ui/MediaPicker");
|
|
43
41
|
var _PortalWrapper = require("./ui/MediaViewer/PortalWrapper");
|
|
@@ -92,8 +90,8 @@ var MediaViewerFunctionalComponent = function MediaViewerFunctionalComponent(_re
|
|
|
92
90
|
mediaClientConfig = _useSharedPluginState2.mediaClientConfig;
|
|
93
91
|
var mediaItems = (0, _react.useMemo)(function () {
|
|
94
92
|
if (isMediaViewerVisible) {
|
|
95
|
-
var mediaNodes = (0,
|
|
96
|
-
return (0,
|
|
93
|
+
var mediaNodes = (0, _mediaCommon.extractMediaNodes)(editorView.state.doc);
|
|
94
|
+
return (0, _mediaCommon.createMediaIdentifierArray)(mediaNodes);
|
|
97
95
|
}
|
|
98
96
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- only update mediaItems once when media viewer is visible
|
|
99
97
|
}, [isMediaViewerVisible]);
|
|
@@ -195,9 +193,8 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
195
193
|
_ref5$allowPixelResiz = _ref5.allowPixelResizing,
|
|
196
194
|
allowPixelResizing = _ref5$allowPixelResiz === void 0 ? false : _ref5$allowPixelResiz,
|
|
197
195
|
allowCaptions = _ref5.allowCaptions,
|
|
198
|
-
allowMediaInlineImages = _ref5.allowMediaInlineImages
|
|
199
|
-
|
|
200
|
-
var allowMediaInline = (0, _fg.fg)('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaFeatureFlags);
|
|
196
|
+
allowMediaInlineImages = _ref5.allowMediaInlineImages;
|
|
197
|
+
var allowMediaInline = allowMediaInlineImages;
|
|
201
198
|
var mediaSingleOption = {
|
|
202
199
|
withCaption: allowCaptions,
|
|
203
200
|
withExtendedWidthTypes: allowPixelResizing
|
|
@@ -407,7 +404,6 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
407
404
|
var _api$editorViewMode;
|
|
408
405
|
return (0, _toolbar.floatingToolbar)(state, intl, {
|
|
409
406
|
providerFactory: providerFactory,
|
|
410
|
-
allowMediaInline: options && (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', options.featureFlags),
|
|
411
407
|
allowResizing: options && options.allowResizing,
|
|
412
408
|
allowResizingInTables: options && options.allowResizingInTables,
|
|
413
409
|
allowCommentsOnMedia: options && options.allowCommentsOnMedia,
|
|
@@ -16,9 +16,7 @@ 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");
|
|
20
19
|
var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
|
|
21
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
22
20
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
23
21
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
24
22
|
var _mediaNodeUpdater = require("./mediaNodeUpdater");
|
|
@@ -58,8 +56,7 @@ var prepareFilmstripItem = function prepareFilmstripItem(_ref) {
|
|
|
58
56
|
getPos = _ref.getPos,
|
|
59
57
|
intl = _ref.intl,
|
|
60
58
|
isMediaItemSelected = _ref.isMediaItemSelected,
|
|
61
|
-
setMediaGroupNodeSelection = _ref.setMediaGroupNodeSelection
|
|
62
|
-
featureFlags = _ref.featureFlags;
|
|
59
|
+
setMediaGroupNodeSelection = _ref.setMediaGroupNodeSelection;
|
|
63
60
|
return function (item, idx) {
|
|
64
61
|
// We declared this to get a fresh position every time
|
|
65
62
|
var getNodePos = function getNodePos() {
|
|
@@ -98,7 +95,7 @@ var prepareFilmstripItem = function prepareFilmstripItem(_ref) {
|
|
|
98
95
|
onClick: function onClick() {
|
|
99
96
|
setMediaGroupNodeSelection(getNodePos());
|
|
100
97
|
}
|
|
101
|
-
}, mediaInlineOptions(
|
|
98
|
+
}, mediaInlineOptions(allowMediaInlineImages));
|
|
102
99
|
};
|
|
103
100
|
};
|
|
104
101
|
|
|
@@ -234,10 +231,9 @@ var MediaGroupNext = exports.MediaGroupNext = (0, _reactIntl.injectIntl)( /*#__P
|
|
|
234
231
|
getPos: _getPos,
|
|
235
232
|
intl: intl,
|
|
236
233
|
isMediaItemSelected: isMediaItemSelected,
|
|
237
|
-
setMediaGroupNodeSelection: setMediaGroupNodeSelection
|
|
238
|
-
featureFlags: featureFlags
|
|
234
|
+
setMediaGroupNodeSelection: setMediaGroupNodeSelection
|
|
239
235
|
});
|
|
240
|
-
}, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, _getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection
|
|
236
|
+
}, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, _getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection]);
|
|
241
237
|
var items = (0, _react.useMemo)(function () {
|
|
242
238
|
return mediaNodesWithOffsets.map(function (_ref4) {
|
|
243
239
|
var node = _ref4.node,
|
|
@@ -18,7 +18,6 @@ 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");
|
|
22
21
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
23
22
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
24
23
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -29,13 +28,12 @@ var _view3 = require("@atlaskit/editor-prosemirror/view");
|
|
|
29
28
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
30
29
|
var _mediaClient = require("@atlaskit/media-client");
|
|
31
30
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
32
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
33
31
|
var _mediaNodeUpdater = require("../nodeviews/mediaNodeUpdater");
|
|
34
32
|
var _helpers = _interopRequireWildcard(require("../pm-plugins/commands/helpers"));
|
|
35
33
|
var helpers = _helpers;
|
|
36
34
|
var _mediaCommon2 = require("../pm-plugins/utils/media-common");
|
|
37
35
|
var _mediaFiles = require("../pm-plugins/utils/media-files");
|
|
38
|
-
var
|
|
36
|
+
var _mediaInline = require("../pm-plugins/utils/media-inline");
|
|
39
37
|
var _mediaSingle2 = require("../pm-plugins/utils/media-single");
|
|
40
38
|
var _DropPlaceholder = _interopRequireDefault(require("../ui/Media/DropPlaceholder"));
|
|
41
39
|
var _actions = require("./actions");
|
|
@@ -77,7 +75,8 @@ var createDropPlaceholder = function createDropPlaceholder(intl, nodeViewPortalP
|
|
|
77
75
|
var MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
|
|
78
76
|
var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
79
77
|
function MediaPluginStateImplementation(_state, options, mediaOptions, _dispatch, pluginInjectionApi) {
|
|
80
|
-
var _this = this
|
|
78
|
+
var _this = this,
|
|
79
|
+
_this$mediaOptions2;
|
|
81
80
|
(0, _classCallCheck2.default)(this, MediaPluginStateImplementation);
|
|
82
81
|
(0, _defineProperty2.default)(this, "allowsUploads", false);
|
|
83
82
|
(0, _defineProperty2.default)(this, "ignoreLinks", false);
|
|
@@ -289,7 +288,7 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
289
288
|
}
|
|
290
289
|
return;
|
|
291
290
|
}
|
|
292
|
-
switch ((0,
|
|
291
|
+
switch ((0, _mediaInline.getMediaNodeInsertionType)(state, _this.mediaOptions, mediaStateWithContext.fileMimeType)) {
|
|
293
292
|
case 'inline':
|
|
294
293
|
(0, _mediaFiles.insertMediaInlineNode)(editorAnalyticsAPI)(_this.view, mediaStateWithContext, collection, _this.allowInlineImages, _this.getInputMethod(pickerType), insertMediaVia);
|
|
295
294
|
break;
|
|
@@ -663,16 +662,8 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
663
662
|
} else if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.provider) {
|
|
664
663
|
this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
|
|
665
664
|
}
|
|
666
|
-
if ((0
|
|
667
|
-
|
|
668
|
-
if ((_this$mediaOptions2 = this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInlineImages) {
|
|
669
|
-
this.allowInlineImages = true;
|
|
670
|
-
}
|
|
671
|
-
} else {
|
|
672
|
-
var _this$mediaOptions3, _this$mediaOptions4;
|
|
673
|
-
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)) {
|
|
674
|
-
this.allowInlineImages = true;
|
|
675
|
-
}
|
|
665
|
+
if ((_this$mediaOptions2 = this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInlineImages) {
|
|
666
|
+
this.allowInlineImages = true;
|
|
676
667
|
}
|
|
677
668
|
this.errorReporter = options.errorReporter || new _utils.ErrorReporter();
|
|
678
669
|
this.singletonCreatedAt = (performance || Date).now();
|
|
@@ -877,10 +868,10 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
877
868
|
}, {
|
|
878
869
|
key: "selectLastAddedMediaNode",
|
|
879
870
|
value: function selectLastAddedMediaNode() {
|
|
880
|
-
var _this$
|
|
871
|
+
var _this$mediaOptions3,
|
|
881
872
|
_this2 = this;
|
|
882
873
|
// if preventAutoFocusOnUpload is enabled, skip auto-selection and just clear the tracking array
|
|
883
|
-
if ((_this$
|
|
874
|
+
if ((_this$mediaOptions3 = this.mediaOptions) !== null && _this$mediaOptions3 !== void 0 && _this$mediaOptions3.preventAutoFocusOnUpload) {
|
|
884
875
|
this.lastAddedMediaSingleFileIds = [];
|
|
885
876
|
return;
|
|
886
877
|
}
|
|
@@ -4,7 +4,6 @@ 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");
|
|
8
7
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
8
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
10
9
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
@@ -24,17 +23,9 @@ var getMediaNodeInsertionType = exports.getMediaNodeInsertionType = function get
|
|
|
24
23
|
return 'group';
|
|
25
24
|
}
|
|
26
25
|
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 (
|
|
28
|
-
if (
|
|
29
|
-
|
|
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
|
-
}
|
|
26
|
+
if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.allowMediaInlineImages) {
|
|
27
|
+
if (canInsertInlineNode && !(0, _isType.isVideo)(fileMimeType)) {
|
|
28
|
+
return 'inline';
|
|
38
29
|
}
|
|
39
30
|
}
|
|
40
31
|
if ((0, _mediaSingle.isMediaSingle)(state.schema, fileMimeType)) {
|
|
@@ -13,7 +13,6 @@ 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");
|
|
17
16
|
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
18
17
|
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
19
18
|
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
@@ -51,7 +50,7 @@ var _imageBorder = require("./imageBorder");
|
|
|
51
50
|
var _layoutGroup = require("./layout-group");
|
|
52
51
|
var _linking3 = require("./linking");
|
|
53
52
|
var _linkingToolbarAppearance = require("./linking-toolbar-appearance");
|
|
54
|
-
var
|
|
53
|
+
var _mediaInline = require("./mediaInline");
|
|
55
54
|
var _pixelResizing2 = require("./pixel-resizing");
|
|
56
55
|
var _utils2 = require("./utils");
|
|
57
56
|
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); }
|
|
@@ -282,7 +281,6 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
282
281
|
allowCommentsOnMedia = options.allowCommentsOnMedia,
|
|
283
282
|
allowResizingInTables = options.allowResizingInTables,
|
|
284
283
|
allowAltTextOnImages = options.allowAltTextOnImages,
|
|
285
|
-
allowMediaInline = options.allowMediaInline,
|
|
286
284
|
allowMediaInlineImages = options.allowMediaInlineImages,
|
|
287
285
|
allowImageEditing = options.allowImageEditing,
|
|
288
286
|
allowImagePreview = options.allowImagePreview,
|
|
@@ -382,27 +380,14 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
382
380
|
}
|
|
383
381
|
}
|
|
384
382
|
};
|
|
385
|
-
if (
|
|
386
|
-
|
|
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
|
-
}
|
|
383
|
+
if (allowMediaInlineImages && selectedNode) {
|
|
384
|
+
addLayoutDropdownToToolbar();
|
|
396
385
|
} else {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
toolbarButtons.push({
|
|
403
|
-
type: 'separator'
|
|
404
|
-
});
|
|
405
|
-
}
|
|
386
|
+
toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)(layoutButtons));
|
|
387
|
+
if (layoutButtons.length && !mauiToolbarSeparatorsUpdateEnabled) {
|
|
388
|
+
toolbarButtons.push({
|
|
389
|
+
type: 'separator'
|
|
390
|
+
});
|
|
406
391
|
}
|
|
407
392
|
}
|
|
408
393
|
|
|
@@ -809,8 +794,7 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
809
794
|
allowResizingInTables = options.allowResizingInTables,
|
|
810
795
|
allowAdvancedToolBarOptions = options.allowAdvancedToolBarOptions,
|
|
811
796
|
allowPixelResizing = options.allowPixelResizing;
|
|
812
|
-
var allowMediaInline =
|
|
813
|
-
allowMediaInline = (0, _fg.fg)('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : allowMediaInline;
|
|
797
|
+
var allowMediaInline = allowMediaInlineImages;
|
|
814
798
|
var mediaPluginState = _pluginKey.stateKey.getState(state);
|
|
815
799
|
var mediaLinkingState = (0, _linking2.getMediaLinkingState)(state);
|
|
816
800
|
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 : {},
|
|
@@ -887,7 +871,7 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
887
871
|
};
|
|
888
872
|
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);
|
|
889
873
|
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
890
|
-
items = (0,
|
|
874
|
+
items = (0, _mediaInline.generateMediaInlineFloatingToolbar)(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, options);
|
|
891
875
|
} else {
|
|
892
876
|
baseToolbar.getDomRef = function () {
|
|
893
877
|
var _mediaPluginState$ele3;
|
|
@@ -6,9 +6,7 @@ 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';
|
|
10
9
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
12
10
|
import { lazyMediaGroupView } from './nodeviews/lazy-media-group';
|
|
13
11
|
import { lazyMediaInlineView } from './nodeviews/lazy-media-inline';
|
|
14
12
|
import { ReactMediaNode } from './nodeviews/mediaNodeView';
|
|
@@ -183,10 +181,9 @@ export const mediaPlugin = ({
|
|
|
183
181
|
allowMediaSingle = false,
|
|
184
182
|
allowPixelResizing = false,
|
|
185
183
|
allowCaptions,
|
|
186
|
-
allowMediaInlineImages
|
|
187
|
-
featureFlags: mediaFeatureFlags
|
|
184
|
+
allowMediaInlineImages
|
|
188
185
|
} = options || {};
|
|
189
|
-
const allowMediaInline =
|
|
186
|
+
const allowMediaInline = allowMediaInlineImages;
|
|
190
187
|
const mediaSingleOption = {
|
|
191
188
|
withCaption: allowCaptions,
|
|
192
189
|
withExtendedWidthTypes: allowPixelResizing
|
|
@@ -398,7 +395,6 @@ export const mediaPlugin = ({
|
|
|
398
395
|
var _api$editorViewMode, _api$editorViewMode$s;
|
|
399
396
|
return floatingToolbar(state, intl, {
|
|
400
397
|
providerFactory,
|
|
401
|
-
allowMediaInline: options && getMediaFeatureFlag('mediaInline', options.featureFlags),
|
|
402
398
|
allowResizing: options && options.allowResizing,
|
|
403
399
|
allowResizingInTables: options && options.allowResizingInTables,
|
|
404
400
|
allowCommentsOnMedia: options && options.allowCommentsOnMedia,
|
|
@@ -4,9 +4,7 @@ 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';
|
|
8
7
|
import { Filmstrip } from '@atlaskit/media-filmstrip';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
11
9
|
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
12
10
|
import { createMediaNodeUpdater } from './mediaNodeUpdater';
|
|
@@ -41,8 +39,7 @@ const prepareFilmstripItem = ({
|
|
|
41
39
|
getPos,
|
|
42
40
|
intl,
|
|
43
41
|
isMediaItemSelected,
|
|
44
|
-
setMediaGroupNodeSelection
|
|
45
|
-
featureFlags
|
|
42
|
+
setMediaGroupNodeSelection
|
|
46
43
|
}) => (item, idx) => {
|
|
47
44
|
// We declared this to get a fresh position every time
|
|
48
45
|
const getNodePos = () => {
|
|
@@ -80,7 +77,7 @@ const prepareFilmstripItem = ({
|
|
|
80
77
|
onClick: () => {
|
|
81
78
|
setMediaGroupNodeSelection(getNodePos());
|
|
82
79
|
},
|
|
83
|
-
...mediaInlineOptions(
|
|
80
|
+
...mediaInlineOptions(allowMediaInlineImages)
|
|
84
81
|
};
|
|
85
82
|
};
|
|
86
83
|
|
|
@@ -189,10 +186,9 @@ export const MediaGroupNext = injectIntl( /*#__PURE__*/React.memo(props => {
|
|
|
189
186
|
getPos,
|
|
190
187
|
intl,
|
|
191
188
|
isMediaItemSelected,
|
|
192
|
-
setMediaGroupNodeSelection
|
|
193
|
-
featureFlags
|
|
189
|
+
setMediaGroupNodeSelection
|
|
194
190
|
});
|
|
195
|
-
}, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection
|
|
191
|
+
}, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection]);
|
|
196
192
|
const items = useMemo(() => {
|
|
197
193
|
return mediaNodesWithOffsets.map(({
|
|
198
194
|
node,
|
|
@@ -7,7 +7,6 @@ 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';
|
|
11
10
|
import { CAPTION_PLACEHOLDER_ID, getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
|
|
12
11
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
13
12
|
import { ErrorReporter } from '@atlaskit/editor-common/utils';
|
|
@@ -18,7 +17,6 @@ import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
|
18
17
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
19
18
|
import { isFileIdentifier } from '@atlaskit/media-client';
|
|
20
19
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
21
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
22
20
|
import { createMediaNodeUpdater } from '../nodeviews/mediaNodeUpdater';
|
|
23
21
|
// Ignored via go/ees005
|
|
24
22
|
// eslint-disable-next-line import/no-namespace
|
|
@@ -56,6 +54,7 @@ const createDropPlaceholder = (intl, nodeViewPortalProviderAPI, dropPlaceholderK
|
|
|
56
54
|
const MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
|
|
57
55
|
export class MediaPluginStateImplementation {
|
|
58
56
|
constructor(_state, options, mediaOptions, _dispatch, pluginInjectionApi) {
|
|
57
|
+
var _this$mediaOptions2;
|
|
59
58
|
_defineProperty(this, "allowsUploads", false);
|
|
60
59
|
_defineProperty(this, "ignoreLinks", false);
|
|
61
60
|
_defineProperty(this, "waitForMediaUpload", true);
|
|
@@ -654,16 +653,8 @@ export class MediaPluginStateImplementation {
|
|
|
654
653
|
} else if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.provider) {
|
|
655
654
|
this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
|
|
656
655
|
}
|
|
657
|
-
if (
|
|
658
|
-
|
|
659
|
-
if ((_this$mediaOptions2 = this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInlineImages) {
|
|
660
|
-
this.allowInlineImages = true;
|
|
661
|
-
}
|
|
662
|
-
} else {
|
|
663
|
-
var _this$mediaOptions3, _this$mediaOptions4;
|
|
664
|
-
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)) {
|
|
665
|
-
this.allowInlineImages = true;
|
|
666
|
-
}
|
|
656
|
+
if ((_this$mediaOptions2 = this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInlineImages) {
|
|
657
|
+
this.allowInlineImages = true;
|
|
667
658
|
}
|
|
668
659
|
this.errorReporter = options.errorReporter || new ErrorReporter();
|
|
669
660
|
this.singletonCreatedAt = (performance || Date).now();
|
|
@@ -814,9 +805,9 @@ export class MediaPluginStateImplementation {
|
|
|
814
805
|
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;
|
|
815
806
|
}
|
|
816
807
|
selectLastAddedMediaNode() {
|
|
817
|
-
var _this$
|
|
808
|
+
var _this$mediaOptions3;
|
|
818
809
|
// if preventAutoFocusOnUpload is enabled, skip auto-selection and just clear the tracking array
|
|
819
|
-
if ((_this$
|
|
810
|
+
if ((_this$mediaOptions3 = this.mediaOptions) !== null && _this$mediaOptions3 !== void 0 && _this$mediaOptions3.preventAutoFocusOnUpload) {
|
|
820
811
|
this.lastAddedMediaSingleFileIds = [];
|
|
821
812
|
return;
|
|
822
813
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { mediaInlineImagesEnabled } from '@atlaskit/editor-common/media-inline';
|
|
2
1
|
import { isInEmptyLine } from '@atlaskit/editor-common/utils';
|
|
3
2
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
3
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
@@ -18,17 +17,9 @@ export const getMediaNodeInsertionType = (state, mediaOptions, fileMimeType) =>
|
|
|
18
17
|
return 'group';
|
|
19
18
|
}
|
|
20
19
|
const canInsertInlineNode = getMediaFeatureFlag('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInSupportedInlineImageParent(state)) && canInsertMediaInline(state);
|
|
21
|
-
if (
|
|
22
|
-
if (
|
|
23
|
-
|
|
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
|
-
}
|
|
20
|
+
if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.allowMediaInlineImages) {
|
|
21
|
+
if (canInsertInlineNode && !isVideo(fileMimeType)) {
|
|
22
|
+
return 'inline';
|
|
32
23
|
}
|
|
33
24
|
}
|
|
34
25
|
if (isMediaSingle(state.schema, fileMimeType)) {
|
|
@@ -3,7 +3,6 @@ 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';
|
|
7
6
|
import commonMessages, { cardMessages, mediaAndEmbedToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
8
7
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
9
8
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
@@ -271,7 +270,6 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
271
270
|
allowCommentsOnMedia,
|
|
272
271
|
allowResizingInTables,
|
|
273
272
|
allowAltTextOnImages,
|
|
274
|
-
allowMediaInline,
|
|
275
273
|
allowMediaInlineImages,
|
|
276
274
|
allowImageEditing,
|
|
277
275
|
allowImagePreview,
|
|
@@ -375,27 +373,14 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
375
373
|
}
|
|
376
374
|
}
|
|
377
375
|
};
|
|
378
|
-
if (
|
|
379
|
-
|
|
380
|
-
addLayoutDropdownToToolbar();
|
|
381
|
-
} else {
|
|
382
|
-
toolbarButtons = [...toolbarButtons, ...layoutButtons];
|
|
383
|
-
if (layoutButtons.length && !mauiToolbarSeparatorsUpdateEnabled) {
|
|
384
|
-
toolbarButtons.push({
|
|
385
|
-
type: 'separator'
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
}
|
|
376
|
+
if (allowMediaInlineImages && selectedNode) {
|
|
377
|
+
addLayoutDropdownToToolbar();
|
|
389
378
|
} else {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
toolbarButtons.push({
|
|
396
|
-
type: 'separator'
|
|
397
|
-
});
|
|
398
|
-
}
|
|
379
|
+
toolbarButtons = [...toolbarButtons, ...layoutButtons];
|
|
380
|
+
if (layoutButtons.length && !mauiToolbarSeparatorsUpdateEnabled) {
|
|
381
|
+
toolbarButtons.push({
|
|
382
|
+
type: 'separator'
|
|
383
|
+
});
|
|
399
384
|
}
|
|
400
385
|
}
|
|
401
386
|
|
|
@@ -802,10 +787,7 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
802
787
|
allowAdvancedToolBarOptions,
|
|
803
788
|
allowPixelResizing
|
|
804
789
|
} = options;
|
|
805
|
-
|
|
806
|
-
allowMediaInline
|
|
807
|
-
} = options;
|
|
808
|
-
allowMediaInline = fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : allowMediaInline;
|
|
790
|
+
const allowMediaInline = allowMediaInlineImages;
|
|
809
791
|
const mediaPluginState = stateKey.getState(state);
|
|
810
792
|
const mediaLinkingState = getMediaLinkingState(state);
|
|
811
793
|
const {
|
package/dist/esm/mediaPlugin.js
CHANGED
|
@@ -9,9 +9,7 @@ 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';
|
|
13
12
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
14
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
15
13
|
import { lazyMediaGroupView } from './nodeviews/lazy-media-group';
|
|
16
14
|
import { lazyMediaInlineView } from './nodeviews/lazy-media-inline';
|
|
17
15
|
import { ReactMediaNode } from './nodeviews/mediaNodeView';
|
|
@@ -186,9 +184,8 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
186
184
|
_ref5$allowPixelResiz = _ref5.allowPixelResizing,
|
|
187
185
|
allowPixelResizing = _ref5$allowPixelResiz === void 0 ? false : _ref5$allowPixelResiz,
|
|
188
186
|
allowCaptions = _ref5.allowCaptions,
|
|
189
|
-
allowMediaInlineImages = _ref5.allowMediaInlineImages
|
|
190
|
-
|
|
191
|
-
var allowMediaInline = fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : getMediaFeatureFlag('mediaInline', mediaFeatureFlags);
|
|
187
|
+
allowMediaInlineImages = _ref5.allowMediaInlineImages;
|
|
188
|
+
var allowMediaInline = allowMediaInlineImages;
|
|
192
189
|
var mediaSingleOption = {
|
|
193
190
|
withCaption: allowCaptions,
|
|
194
191
|
withExtendedWidthTypes: allowPixelResizing
|
|
@@ -398,7 +395,6 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
398
395
|
var _api$editorViewMode;
|
|
399
396
|
return _floatingToolbar(state, intl, {
|
|
400
397
|
providerFactory: providerFactory,
|
|
401
|
-
allowMediaInline: options && getMediaFeatureFlag('mediaInline', options.featureFlags),
|
|
402
398
|
allowResizing: options && options.allowResizing,
|
|
403
399
|
allowResizingInTables: options && options.allowResizingInTables,
|
|
404
400
|
allowCommentsOnMedia: options && options.allowCommentsOnMedia,
|
|
@@ -10,9 +10,7 @@ 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';
|
|
14
13
|
import { Filmstrip } from '@atlaskit/media-filmstrip';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
16
14
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
17
15
|
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
18
16
|
import { createMediaNodeUpdater } from './mediaNodeUpdater';
|
|
@@ -49,8 +47,7 @@ var prepareFilmstripItem = function prepareFilmstripItem(_ref) {
|
|
|
49
47
|
getPos = _ref.getPos,
|
|
50
48
|
intl = _ref.intl,
|
|
51
49
|
isMediaItemSelected = _ref.isMediaItemSelected,
|
|
52
|
-
setMediaGroupNodeSelection = _ref.setMediaGroupNodeSelection
|
|
53
|
-
featureFlags = _ref.featureFlags;
|
|
50
|
+
setMediaGroupNodeSelection = _ref.setMediaGroupNodeSelection;
|
|
54
51
|
return function (item, idx) {
|
|
55
52
|
// We declared this to get a fresh position every time
|
|
56
53
|
var getNodePos = function getNodePos() {
|
|
@@ -89,7 +86,7 @@ var prepareFilmstripItem = function prepareFilmstripItem(_ref) {
|
|
|
89
86
|
onClick: function onClick() {
|
|
90
87
|
setMediaGroupNodeSelection(getNodePos());
|
|
91
88
|
}
|
|
92
|
-
}, mediaInlineOptions(
|
|
89
|
+
}, mediaInlineOptions(allowMediaInlineImages));
|
|
93
90
|
};
|
|
94
91
|
};
|
|
95
92
|
|
|
@@ -225,10 +222,9 @@ export var MediaGroupNext = injectIntl( /*#__PURE__*/React.memo(function (props)
|
|
|
225
222
|
getPos: _getPos,
|
|
226
223
|
intl: intl,
|
|
227
224
|
isMediaItemSelected: isMediaItemSelected,
|
|
228
|
-
setMediaGroupNodeSelection: setMediaGroupNodeSelection
|
|
229
|
-
featureFlags: featureFlags
|
|
225
|
+
setMediaGroupNodeSelection: setMediaGroupNodeSelection
|
|
230
226
|
});
|
|
231
|
-
}, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, _getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection
|
|
227
|
+
}, [allowLazyLoading, allowMediaInlineImages, enableDownloadButton, handleMediaNodeRemoval, _getPos, intl, isMediaItemSelected, setMediaGroupNodeSelection]);
|
|
232
228
|
var items = useMemo(function () {
|
|
233
229
|
return mediaNodesWithOffsets.map(function (_ref4) {
|
|
234
230
|
var node = _ref4.node,
|
|
@@ -16,7 +16,6 @@ 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';
|
|
20
19
|
import { CAPTION_PLACEHOLDER_ID, getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
|
|
21
20
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
22
21
|
import { ErrorReporter } from '@atlaskit/editor-common/utils';
|
|
@@ -27,7 +26,6 @@ import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
|
27
26
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
28
27
|
import { isFileIdentifier } from '@atlaskit/media-client';
|
|
29
28
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
30
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
31
29
|
import { createMediaNodeUpdater } from '../nodeviews/mediaNodeUpdater';
|
|
32
30
|
// Ignored via go/ees005
|
|
33
31
|
// eslint-disable-next-line import/no-namespace
|
|
@@ -69,7 +67,8 @@ var createDropPlaceholder = function createDropPlaceholder(intl, nodeViewPortalP
|
|
|
69
67
|
var MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
|
|
70
68
|
export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
71
69
|
function MediaPluginStateImplementation(_state, options, mediaOptions, _dispatch, pluginInjectionApi) {
|
|
72
|
-
var _this = this
|
|
70
|
+
var _this = this,
|
|
71
|
+
_this$mediaOptions2;
|
|
73
72
|
_classCallCheck(this, MediaPluginStateImplementation);
|
|
74
73
|
_defineProperty(this, "allowsUploads", false);
|
|
75
74
|
_defineProperty(this, "ignoreLinks", false);
|
|
@@ -655,16 +654,8 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
655
654
|
} else if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.provider) {
|
|
656
655
|
this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
|
|
657
656
|
}
|
|
658
|
-
if (
|
|
659
|
-
|
|
660
|
-
if ((_this$mediaOptions2 = this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInlineImages) {
|
|
661
|
-
this.allowInlineImages = true;
|
|
662
|
-
}
|
|
663
|
-
} else {
|
|
664
|
-
var _this$mediaOptions3, _this$mediaOptions4;
|
|
665
|
-
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)) {
|
|
666
|
-
this.allowInlineImages = true;
|
|
667
|
-
}
|
|
657
|
+
if ((_this$mediaOptions2 = this.mediaOptions) !== null && _this$mediaOptions2 !== void 0 && _this$mediaOptions2.allowMediaInlineImages) {
|
|
658
|
+
this.allowInlineImages = true;
|
|
668
659
|
}
|
|
669
660
|
this.errorReporter = options.errorReporter || new ErrorReporter();
|
|
670
661
|
this.singletonCreatedAt = (performance || Date).now();
|
|
@@ -869,10 +860,10 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
869
860
|
}, {
|
|
870
861
|
key: "selectLastAddedMediaNode",
|
|
871
862
|
value: function selectLastAddedMediaNode() {
|
|
872
|
-
var _this$
|
|
863
|
+
var _this$mediaOptions3,
|
|
873
864
|
_this2 = this;
|
|
874
865
|
// if preventAutoFocusOnUpload is enabled, skip auto-selection and just clear the tracking array
|
|
875
|
-
if ((_this$
|
|
866
|
+
if ((_this$mediaOptions3 = this.mediaOptions) !== null && _this$mediaOptions3 !== void 0 && _this$mediaOptions3.preventAutoFocusOnUpload) {
|
|
876
867
|
this.lastAddedMediaSingleFileIds = [];
|
|
877
868
|
return;
|
|
878
869
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { mediaInlineImagesEnabled } from '@atlaskit/editor-common/media-inline';
|
|
2
1
|
import { isInEmptyLine } from '@atlaskit/editor-common/utils';
|
|
3
2
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
3
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
@@ -18,17 +17,9 @@ export var getMediaNodeInsertionType = function getMediaNodeInsertionType(state,
|
|
|
18
17
|
return 'group';
|
|
19
18
|
}
|
|
20
19
|
var canInsertInlineNode = getMediaFeatureFlag('mediaInline', mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.featureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInSupportedInlineImageParent(state)) && canInsertMediaInline(state);
|
|
21
|
-
if (
|
|
22
|
-
if (
|
|
23
|
-
|
|
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
|
-
}
|
|
20
|
+
if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.allowMediaInlineImages) {
|
|
21
|
+
if (canInsertInlineNode && !isVideo(fileMimeType)) {
|
|
22
|
+
return 'inline';
|
|
32
23
|
}
|
|
33
24
|
}
|
|
34
25
|
if (isMediaSingle(state.schema, fileMimeType)) {
|
|
@@ -7,7 +7,6 @@ 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';
|
|
11
10
|
import commonMessages, { cardMessages, mediaAndEmbedToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
12
11
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
13
12
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
@@ -273,7 +272,6 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
273
272
|
allowCommentsOnMedia = options.allowCommentsOnMedia,
|
|
274
273
|
allowResizingInTables = options.allowResizingInTables,
|
|
275
274
|
allowAltTextOnImages = options.allowAltTextOnImages,
|
|
276
|
-
allowMediaInline = options.allowMediaInline,
|
|
277
275
|
allowMediaInlineImages = options.allowMediaInlineImages,
|
|
278
276
|
allowImageEditing = options.allowImageEditing,
|
|
279
277
|
allowImagePreview = options.allowImagePreview,
|
|
@@ -373,27 +371,14 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
373
371
|
}
|
|
374
372
|
}
|
|
375
373
|
};
|
|
376
|
-
if (
|
|
377
|
-
|
|
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
|
-
}
|
|
374
|
+
if (allowMediaInlineImages && selectedNode) {
|
|
375
|
+
addLayoutDropdownToToolbar();
|
|
387
376
|
} else {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
toolbarButtons.push({
|
|
394
|
-
type: 'separator'
|
|
395
|
-
});
|
|
396
|
-
}
|
|
377
|
+
toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(layoutButtons));
|
|
378
|
+
if (layoutButtons.length && !mauiToolbarSeparatorsUpdateEnabled) {
|
|
379
|
+
toolbarButtons.push({
|
|
380
|
+
type: 'separator'
|
|
381
|
+
});
|
|
397
382
|
}
|
|
398
383
|
}
|
|
399
384
|
|
|
@@ -800,8 +785,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
800
785
|
allowResizingInTables = options.allowResizingInTables,
|
|
801
786
|
allowAdvancedToolBarOptions = options.allowAdvancedToolBarOptions,
|
|
802
787
|
allowPixelResizing = options.allowPixelResizing;
|
|
803
|
-
var allowMediaInline =
|
|
804
|
-
allowMediaInline = fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : allowMediaInline;
|
|
788
|
+
var allowMediaInline = allowMediaInlineImages;
|
|
805
789
|
var mediaPluginState = stateKey.getState(state);
|
|
806
790
|
var mediaLinkingState = getMediaLinkingState(state);
|
|
807
791
|
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": "24.0.
|
|
3
|
+
"version": "24.0.10",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -102,9 +102,6 @@
|
|
|
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
|
-
},
|
|
108
105
|
"platform_editor_content_mode_button_mvp": {
|
|
109
106
|
"type": "boolean"
|
|
110
107
|
},
|