@atlaskit/editor-plugin-media 2.3.10 → 2.3.11
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 +9 -0
- package/dist/cjs/nodeviews/mediaGroup.js +2 -1
- package/dist/cjs/nodeviews/mediaGroupNext.js +2 -1
- package/dist/cjs/nodeviews/mediaInline.js +3 -1
- package/dist/cjs/ui/MediaViewer/MediaViewerContainer.js +2 -1
- package/dist/cjs/ui/toolbar/index.js +117 -64
- package/dist/cjs/ui/toolbar/mediaInline.js +121 -63
- package/dist/es2019/nodeviews/mediaGroup.js +2 -1
- package/dist/es2019/nodeviews/mediaGroupNext.js +2 -1
- package/dist/es2019/nodeviews/mediaInline.js +3 -1
- package/dist/es2019/ui/MediaViewer/MediaViewerContainer.js +2 -1
- package/dist/es2019/ui/toolbar/index.js +114 -64
- package/dist/es2019/ui/toolbar/mediaInline.js +114 -61
- package/dist/esm/nodeviews/mediaGroup.js +2 -1
- package/dist/esm/nodeviews/mediaGroupNext.js +2 -1
- package/dist/esm/nodeviews/mediaInline.js +3 -1
- package/dist/esm/ui/MediaViewer/MediaViewerContainer.js +2 -1
- package/dist/esm/ui/toolbar/index.js +117 -64
- package/dist/esm/ui/toolbar/mediaInline.js +121 -63
- package/dist/types/pm-plugins/pixel-resizing/reducer.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/pixel-resizing/reducer.d.ts +2 -2
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 2.3.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#128574](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128574)
|
|
8
|
+
[`cba34b8397ba2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cba34b8397ba2) -
|
|
9
|
+
[ux] [ED-26973] Update floating toolbar for inline and thumbnail file
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 2.3.10
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -24,6 +24,7 @@ var _close = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/close")
|
|
|
24
24
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
25
25
|
var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
|
|
26
26
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
27
28
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
28
29
|
var _useMediaProvider = require("../ui/hooks/useMediaProvider");
|
|
29
30
|
var _mediaGroupNext = require("./mediaGroupNext");
|
|
@@ -181,7 +182,7 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
|
|
|
181
182
|
items: items,
|
|
182
183
|
mediaClientConfig: viewMediaClientConfig,
|
|
183
184
|
featureFlags: mediaOptions.featureFlags,
|
|
184
|
-
shouldOpenMediaViewer: editorViewMode
|
|
185
|
+
shouldOpenMediaViewer: editorViewMode && (0, _experiments.editorExperiment)('platform_editor_controls', 'control')
|
|
185
186
|
});
|
|
186
187
|
});
|
|
187
188
|
_this.mediaNodes = [];
|
|
@@ -18,6 +18,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
18
18
|
var _close = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/close"));
|
|
19
19
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
20
20
|
var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
|
|
21
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
21
22
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
22
23
|
var _mediaNodeUpdater = require("./mediaNodeUpdater");
|
|
23
24
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -289,7 +290,7 @@ var MediaGroupNext = exports.MediaGroupNext = (0, _reactIntlNext.injectIntl)( /*
|
|
|
289
290
|
items: items,
|
|
290
291
|
mediaClientConfig: viewMediaClientConfig,
|
|
291
292
|
featureFlags: featureFlags,
|
|
292
|
-
shouldOpenMediaViewer: editorViewMode
|
|
293
|
+
shouldOpenMediaViewer: editorViewMode && (0, _experiments.editorExperiment)('platform_editor_controls', 'control')
|
|
293
294
|
});
|
|
294
295
|
}));
|
|
295
296
|
MediaGroupNext.displayName = 'MediaGroup';
|
|
@@ -24,6 +24,7 @@ var _selectionBasedNodeView = require("@atlaskit/editor-common/selection-based-n
|
|
|
24
24
|
var _mediaCard = require("@atlaskit/media-card");
|
|
25
25
|
var _mediaClientReact = require("@atlaskit/media-client-react");
|
|
26
26
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
27
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
28
|
var _isType = require("../pm-plugins/utils/is-type");
|
|
28
29
|
var _MediaViewerContainer = require("../ui/MediaViewer/MediaViewerContainer");
|
|
29
30
|
var _mediaNodeUpdater = require("./mediaNodeUpdater");
|
|
@@ -211,7 +212,8 @@ var MediaInline = exports.MediaInline = function MediaInline(props) {
|
|
|
211
212
|
mediaNode: props.node,
|
|
212
213
|
mediaPluginState: props.mediaPluginState,
|
|
213
214
|
isEditorViewMode: props.editorViewMode,
|
|
214
|
-
isSelected: props.isSelected
|
|
215
|
+
isSelected: props.isSelected,
|
|
216
|
+
isInline: (0, _platformFeatureFlags.fg)('platform_editor_render_media_viewer_as_inline')
|
|
215
217
|
}, (0, _react2.jsx)(_mediaCard.MediaInlineCard, {
|
|
216
218
|
isSelected: props.isSelected,
|
|
217
219
|
identifier: identifier,
|
|
@@ -9,6 +9,7 @@ exports.MediaViewerContainer = void 0;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
13
|
var _isType = require("../../pm-plugins/utils/is-type");
|
|
13
14
|
var _utils = require("../../ui/toolbar/utils");
|
|
14
15
|
var _PortalWrapper = require("./PortalWrapper");
|
|
@@ -52,7 +53,7 @@ var MediaViewerContainer = exports.MediaViewerContainer = function MediaViewerCo
|
|
|
52
53
|
setShowMediaViewer(false);
|
|
53
54
|
};
|
|
54
55
|
var isVideoMedia = (0, _isType.isVideo)((_mediaNode$firstChild = mediaNode.firstChild) === null || _mediaNode$firstChild === void 0 ? void 0 : _mediaNode$firstChild.attrs.__fileMimeType);
|
|
55
|
-
var shouldShowViewer = isEditorViewMode && showViewer && selectedNodeAttrs && mediaClientConfig && !isVideoMedia;
|
|
56
|
+
var shouldShowViewer = isEditorViewMode && showViewer && selectedNodeAttrs && mediaClientConfig && !isVideoMedia && (0, _experiments.editorExperiment)('platform_editor_controls', 'control');
|
|
56
57
|
return (0, _react2.jsx)(_react.Fragment, null, isEditorViewMode ? (0, _react2.jsx)(_react.Fragment, null, isInline ?
|
|
57
58
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
58
59
|
(0, _react2.jsx)("span", {
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.handleShowMediaViewer = exports.floatingToolbar = void 0;
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
14
14
|
var _card = require("@atlaskit/editor-common/card");
|
|
@@ -91,41 +91,10 @@ var handleShowMediaViewer = exports.handleShowMediaViewer = function handleShowM
|
|
|
91
91
|
};
|
|
92
92
|
var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, editorAnalyticsAPI, forceFocusSelector, isViewOnly) {
|
|
93
93
|
var _mediaPluginState$med, _pluginInjectionApi$c;
|
|
94
|
-
if (isViewOnly) {
|
|
95
|
-
return [];
|
|
96
|
-
}
|
|
97
94
|
var enforceMediaDataSecurityPolicy = mediaPluginState === null || mediaPluginState === void 0 || (_mediaPluginState$med = mediaPluginState.mediaClientConfig) === null || _mediaPluginState$med === void 0 ? void 0 : _mediaPluginState$med.enforceDataSecurityPolicy;
|
|
98
95
|
var disableDownloadButton = typeof enforceMediaDataSecurityPolicy === 'boolean' ? enforceMediaDataSecurityPolicy : false;
|
|
99
|
-
var
|
|
100
|
-
var
|
|
101
|
-
id: 'editor.media.view.switcher.inline',
|
|
102
|
-
type: 'button',
|
|
103
|
-
icon: _imageInline.default,
|
|
104
|
-
iconFallback: _card.IconInline,
|
|
105
|
-
selected: false,
|
|
106
|
-
focusEditoronEnter: true,
|
|
107
|
-
disabled: false,
|
|
108
|
-
onClick: (0, _commands3.changeMediaCardToInline)(editorAnalyticsAPI, forceFocusSelector),
|
|
109
|
-
title: intl.formatMessage(_messages.cardMessages.inlineTitle),
|
|
110
|
-
testId: 'inline-appearance',
|
|
111
|
-
className: 'inline-appearance' // a11y. uses to force focus on item
|
|
112
|
-
}, {
|
|
113
|
-
id: 'editor.media.view.switcher.thumbnail',
|
|
114
|
-
type: 'button',
|
|
115
|
-
icon: _smartLinkCard.default,
|
|
116
|
-
iconFallback: _card.IconCard,
|
|
117
|
-
selected: true,
|
|
118
|
-
disabled: false,
|
|
119
|
-
focusEditoronEnter: true,
|
|
120
|
-
onClick: function onClick() {
|
|
121
|
-
return true;
|
|
122
|
-
},
|
|
123
|
-
title: intl.formatMessage(_messages.cardMessages.blockTitle),
|
|
124
|
-
testId: 'thumbnail-appearance',
|
|
125
|
-
className: 'thumbnail-appearance' // a11y. uses to force focus on item
|
|
126
|
-
}, {
|
|
127
|
-
type: 'separator'
|
|
128
|
-
}, {
|
|
96
|
+
var isEditorControlsEnabled = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
|
|
97
|
+
var preview = {
|
|
129
98
|
id: 'editor.media.viewer',
|
|
130
99
|
testId: 'file-preview-toolbar-button',
|
|
131
100
|
type: 'button',
|
|
@@ -141,9 +110,8 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
141
110
|
},
|
|
142
111
|
disabled: (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.currentState()) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.mode) === 'offline',
|
|
143
112
|
supportsViewMode: true
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
}, {
|
|
113
|
+
};
|
|
114
|
+
var download = _objectSpread({
|
|
147
115
|
id: 'editor.media.card.download',
|
|
148
116
|
type: 'button',
|
|
149
117
|
icon: _download.default,
|
|
@@ -153,33 +121,118 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
153
121
|
},
|
|
154
122
|
title: intl.formatMessage(_mediaUi.messages.download),
|
|
155
123
|
disabled: disableDownloadButton
|
|
156
|
-
}, {
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
124
|
+
}, isEditorControlsEnabled && {
|
|
125
|
+
supportsViewMode: true
|
|
126
|
+
});
|
|
127
|
+
if (isViewOnly && !isEditorControlsEnabled) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
var mediaGroup = state.schema.nodes.mediaGroup;
|
|
131
|
+
var items = [];
|
|
132
|
+
if (!isEditorControlsEnabled) {
|
|
133
|
+
items.push({
|
|
134
|
+
id: 'editor.media.view.switcher.inline',
|
|
135
|
+
type: 'button',
|
|
136
|
+
icon: _imageInline.default,
|
|
137
|
+
iconFallback: _card.IconInline,
|
|
138
|
+
selected: false,
|
|
139
|
+
focusEditoronEnter: true,
|
|
140
|
+
disabled: false,
|
|
141
|
+
onClick: (0, _commands3.changeMediaCardToInline)(editorAnalyticsAPI, forceFocusSelector),
|
|
142
|
+
title: intl.formatMessage(_messages.cardMessages.inlineTitle),
|
|
143
|
+
testId: 'inline-appearance',
|
|
144
|
+
className: 'inline-appearance' // a11y. uses to force focus on item
|
|
145
|
+
}, {
|
|
146
|
+
id: 'editor.media.view.switcher.thumbnail',
|
|
147
|
+
type: 'button',
|
|
148
|
+
icon: _smartLinkCard.default,
|
|
149
|
+
iconFallback: _card.IconCard,
|
|
150
|
+
selected: true,
|
|
151
|
+
disabled: false,
|
|
152
|
+
focusEditoronEnter: true,
|
|
153
|
+
onClick: function onClick() {
|
|
154
|
+
return true;
|
|
155
|
+
},
|
|
156
|
+
title: intl.formatMessage(_messages.cardMessages.blockTitle),
|
|
157
|
+
testId: 'thumbnail-appearance',
|
|
158
|
+
className: 'thumbnail-appearance' // a11y. uses to force focus on item
|
|
159
|
+
}, {
|
|
160
|
+
type: 'separator'
|
|
161
|
+
}, preview, {
|
|
162
|
+
type: 'separator'
|
|
163
|
+
}, download, {
|
|
164
|
+
type: 'separator'
|
|
165
|
+
}, {
|
|
166
|
+
type: 'copy-button',
|
|
167
|
+
supportsViewMode: true,
|
|
168
|
+
items: [{
|
|
169
|
+
state: state,
|
|
170
|
+
formatMessage: intl.formatMessage,
|
|
171
|
+
nodeType: mediaGroup
|
|
172
|
+
}]
|
|
173
|
+
}, {
|
|
174
|
+
type: 'separator'
|
|
175
|
+
}, {
|
|
176
|
+
id: 'editor.media.delete',
|
|
177
|
+
type: 'button',
|
|
178
|
+
appearance: 'danger',
|
|
179
|
+
focusEditoronEnter: true,
|
|
180
|
+
icon: _delete.default,
|
|
181
|
+
iconFallback: _remove.default,
|
|
182
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
|
|
183
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
|
|
184
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
|
|
185
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
|
|
186
|
+
title: intl.formatMessage(_messages.default.remove),
|
|
187
|
+
onClick: handleRemoveMediaGroup,
|
|
188
|
+
testId: 'media-toolbar-remove-button'
|
|
189
|
+
});
|
|
190
|
+
} else {
|
|
191
|
+
var options = [{
|
|
192
|
+
id: 'editor.media.view.switcher.inline',
|
|
193
|
+
title: intl.formatMessage(_messages.cardMessages.inlineTitle),
|
|
194
|
+
onClick: (0, _commands3.changeMediaCardToInline)(editorAnalyticsAPI, forceFocusSelector),
|
|
195
|
+
icon: /*#__PURE__*/_react.default.createElement(_imageInline.default, {
|
|
196
|
+
label: "",
|
|
197
|
+
spacing: "spacious"
|
|
198
|
+
})
|
|
199
|
+
}, {
|
|
200
|
+
id: 'editor.media.view.switcher.thumbnail',
|
|
201
|
+
title: intl.formatMessage(_messages.cardMessages.blockTitle),
|
|
202
|
+
selected: true,
|
|
203
|
+
onClick: function onClick() {
|
|
204
|
+
return true;
|
|
205
|
+
},
|
|
206
|
+
icon: /*#__PURE__*/_react.default.createElement(_smartLinkCard.default, {
|
|
207
|
+
label: "",
|
|
208
|
+
spacing: "spacious"
|
|
209
|
+
})
|
|
210
|
+
}];
|
|
211
|
+
var switcherDropdown = {
|
|
212
|
+
title: intl.formatMessage(_mediaUi.messages.fileDisplayOptions),
|
|
213
|
+
id: 'media-group-inline-switcher-toolbar-item',
|
|
214
|
+
testId: 'media-group-inline-switcher-dropdown',
|
|
215
|
+
type: 'dropdown',
|
|
216
|
+
options: options,
|
|
217
|
+
icon: function icon() {
|
|
218
|
+
return /*#__PURE__*/_react.default.createElement(_smartLinkCard.default, {
|
|
219
|
+
label: "",
|
|
220
|
+
spacing: "spacious"
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
items.push(switcherDropdown, {
|
|
225
|
+
type: 'separator',
|
|
226
|
+
fullHeight: true
|
|
227
|
+
}, download, {
|
|
228
|
+
type: 'separator',
|
|
229
|
+
fullHeight: true,
|
|
230
|
+
supportsViewMode: true
|
|
231
|
+
}, preview, {
|
|
232
|
+
type: 'separator',
|
|
233
|
+
fullHeight: true
|
|
234
|
+
});
|
|
235
|
+
}
|
|
183
236
|
return items;
|
|
184
237
|
};
|
|
185
238
|
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi) {
|
|
@@ -6,12 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.generateMediaInlineFloatingToolbar = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _react = _interopRequireDefault(require("react"));
|
|
10
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
12
|
var _card = require("@atlaskit/editor-common/card");
|
|
12
13
|
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
13
14
|
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
14
15
|
var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
16
|
+
var _growDiagonal = _interopRequireDefault(require("@atlaskit/icon/core/grow-diagonal"));
|
|
15
17
|
var _imageFullscreen = _interopRequireDefault(require("@atlaskit/icon/core/image-fullscreen"));
|
|
16
18
|
var _imageInline = _interopRequireDefault(require("@atlaskit/icon/core/image-inline"));
|
|
17
19
|
var _maximize = _interopRequireDefault(require("@atlaskit/icon/core/maximize"));
|
|
@@ -35,6 +37,8 @@ var _utils = require("./utils");
|
|
|
35
37
|
var _index = require("./index");
|
|
36
38
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
37
39
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
40
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
41
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
38
42
|
var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi) {
|
|
39
43
|
var _pluginInjectionApi$a, _pluginInjectionApi$f;
|
|
40
44
|
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
@@ -46,39 +50,13 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
|
|
|
46
50
|
if (mediaPluginState.allowInlineImages && (0, _isType.isImage)(mediaType)) {
|
|
47
51
|
return getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState, options);
|
|
48
52
|
}
|
|
49
|
-
var items = [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
icon: _imageInline.default,
|
|
53
|
-
iconFallback: _card.IconInline,
|
|
54
|
-
selected: true,
|
|
55
|
-
disabled: false,
|
|
56
|
-
focusEditoronEnter: true,
|
|
57
|
-
onClick: function onClick() {
|
|
58
|
-
return true;
|
|
59
|
-
},
|
|
60
|
-
title: intl.formatMessage(_messages.cardMessages.inlineTitle),
|
|
61
|
-
testId: 'inline-appearance',
|
|
62
|
-
className: 'inline-appearance' // a11y. uses to force focus on item
|
|
63
|
-
}, {
|
|
64
|
-
id: 'editor.media.view.switcher.thumbnail',
|
|
65
|
-
type: 'button',
|
|
66
|
-
icon: _smartLinkCard.default,
|
|
67
|
-
iconFallback: _card.IconCard,
|
|
68
|
-
selected: false,
|
|
69
|
-
disabled: false,
|
|
70
|
-
focusEditoronEnter: true,
|
|
71
|
-
onClick: (0, _commands.changeInlineToMediaCard)(editorAnalyticsAPI, forceFocusSelector),
|
|
72
|
-
title: intl.formatMessage(_messages.cardMessages.blockTitle),
|
|
73
|
-
testId: 'thumbnail-appearance',
|
|
74
|
-
className: 'thumbnail-appearance' // a11y. uses to force focus on item
|
|
75
|
-
}, {
|
|
76
|
-
type: 'separator'
|
|
77
|
-
}, {
|
|
53
|
+
var items = [];
|
|
54
|
+
var isEditorControlsEnabled = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
|
|
55
|
+
var preview = _objectSpread({
|
|
78
56
|
id: 'editor.media.viewer',
|
|
79
57
|
testId: 'file-preview-toolbar-button',
|
|
80
58
|
type: 'button',
|
|
81
|
-
icon: _maximize.default,
|
|
59
|
+
icon: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? _growDiagonal.default : _maximize.default,
|
|
82
60
|
iconFallback: _filePreview.default,
|
|
83
61
|
title: intl.formatMessage(_mediaUi.messages.preview),
|
|
84
62
|
onClick: function onClick() {
|
|
@@ -88,10 +66,10 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
|
|
|
88
66
|
api: pluginInjectionApi
|
|
89
67
|
})) !== null && _handleShowMediaViewe !== void 0 ? _handleShowMediaViewe : false;
|
|
90
68
|
}
|
|
91
|
-
}, {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
69
|
+
}, isEditorControlsEnabled && {
|
|
70
|
+
supportsViewMode: true
|
|
71
|
+
});
|
|
72
|
+
var download = _objectSpread({
|
|
95
73
|
id: 'editor.media.card.download',
|
|
96
74
|
type: 'button',
|
|
97
75
|
icon: _download.default,
|
|
@@ -100,33 +78,113 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
|
|
|
100
78
|
return true;
|
|
101
79
|
},
|
|
102
80
|
title: intl.formatMessage(_mediaUi.messages.download)
|
|
103
|
-
}, {
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
81
|
+
}, isEditorControlsEnabled && {
|
|
82
|
+
supportsViewMode: true
|
|
83
|
+
});
|
|
84
|
+
if (!isEditorControlsEnabled) {
|
|
85
|
+
items.push({
|
|
86
|
+
id: 'editor.media.view.switcher.inline',
|
|
87
|
+
type: 'button',
|
|
88
|
+
icon: _imageInline.default,
|
|
89
|
+
iconFallback: _card.IconInline,
|
|
90
|
+
selected: true,
|
|
91
|
+
disabled: false,
|
|
92
|
+
focusEditoronEnter: true,
|
|
93
|
+
onClick: function onClick() {
|
|
94
|
+
return true;
|
|
95
|
+
},
|
|
96
|
+
title: intl.formatMessage(_messages.cardMessages.inlineTitle),
|
|
97
|
+
testId: 'inline-appearance',
|
|
98
|
+
className: 'inline-appearance' // a11y. uses to force focus on item
|
|
99
|
+
}, {
|
|
100
|
+
id: 'editor.media.view.switcher.thumbnail',
|
|
101
|
+
type: 'button',
|
|
102
|
+
icon: _smartLinkCard.default,
|
|
103
|
+
iconFallback: _card.IconCard,
|
|
104
|
+
selected: false,
|
|
105
|
+
disabled: false,
|
|
106
|
+
focusEditoronEnter: true,
|
|
107
|
+
onClick: (0, _commands.changeInlineToMediaCard)(editorAnalyticsAPI, forceFocusSelector),
|
|
108
|
+
title: intl.formatMessage(_messages.cardMessages.blockTitle),
|
|
109
|
+
testId: 'thumbnail-appearance',
|
|
110
|
+
className: 'thumbnail-appearance' // a11y. uses to force focus on item
|
|
111
|
+
}, {
|
|
112
|
+
type: 'separator'
|
|
113
|
+
}, preview, {
|
|
114
|
+
type: 'separator'
|
|
115
|
+
}, download, {
|
|
116
|
+
type: 'separator'
|
|
117
|
+
}, {
|
|
118
|
+
type: 'copy-button',
|
|
119
|
+
supportsViewMode: true,
|
|
120
|
+
items: [{
|
|
121
|
+
state: state,
|
|
122
|
+
formatMessage: intl.formatMessage,
|
|
123
|
+
nodeType: mediaInline
|
|
124
|
+
}]
|
|
125
|
+
}, {
|
|
126
|
+
type: 'separator'
|
|
127
|
+
}, {
|
|
128
|
+
id: 'editor.media.delete',
|
|
129
|
+
type: 'button',
|
|
130
|
+
appearance: 'danger',
|
|
131
|
+
focusEditoronEnter: true,
|
|
132
|
+
icon: _delete.default,
|
|
133
|
+
iconFallback: _remove.default,
|
|
134
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
135
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
136
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
137
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
138
|
+
title: intl.formatMessage(_messages.default.remove),
|
|
139
|
+
onClick: _commands.removeInlineCard,
|
|
140
|
+
testId: 'media-toolbar-remove-button'
|
|
141
|
+
});
|
|
142
|
+
} else {
|
|
143
|
+
var _options = [{
|
|
144
|
+
id: 'editor.media.view.switcher.inline',
|
|
145
|
+
title: intl.formatMessage(_messages.cardMessages.inlineTitle),
|
|
146
|
+
onClick: function onClick() {
|
|
147
|
+
return true;
|
|
148
|
+
},
|
|
149
|
+
selected: true,
|
|
150
|
+
icon: /*#__PURE__*/_react.default.createElement(_imageInline.default, {
|
|
151
|
+
label: "",
|
|
152
|
+
spacing: "spacious"
|
|
153
|
+
})
|
|
154
|
+
}, {
|
|
155
|
+
id: 'editor.media.view.switcher.thumbnail',
|
|
156
|
+
title: intl.formatMessage(_messages.cardMessages.blockTitle),
|
|
157
|
+
onClick: (0, _commands.changeInlineToMediaCard)(editorAnalyticsAPI, forceFocusSelector),
|
|
158
|
+
icon: /*#__PURE__*/_react.default.createElement(_smartLinkCard.default, {
|
|
159
|
+
label: "",
|
|
160
|
+
spacing: "spacious"
|
|
161
|
+
})
|
|
162
|
+
}];
|
|
163
|
+
var switcherDropdown = {
|
|
164
|
+
title: intl.formatMessage(_mediaUi.messages.fileDisplayOptions),
|
|
165
|
+
id: 'media-group-inline-switcher-toolbar-item',
|
|
166
|
+
testId: 'media-group-inline-switcher-dropdown',
|
|
167
|
+
type: 'dropdown',
|
|
168
|
+
options: _options,
|
|
169
|
+
icon: function icon() {
|
|
170
|
+
return /*#__PURE__*/_react.default.createElement(_imageInline.default, {
|
|
171
|
+
label: "",
|
|
172
|
+
spacing: "spacious"
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
items.push(switcherDropdown, {
|
|
177
|
+
type: 'separator',
|
|
178
|
+
fullHeight: true
|
|
179
|
+
}, download, {
|
|
180
|
+
type: 'separator',
|
|
181
|
+
fullHeight: true,
|
|
182
|
+
supportsViewMode: true
|
|
183
|
+
}, preview, {
|
|
184
|
+
type: 'separator',
|
|
185
|
+
fullHeight: true
|
|
186
|
+
});
|
|
187
|
+
}
|
|
130
188
|
return items;
|
|
131
189
|
};
|
|
132
190
|
var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState) {
|
|
@@ -204,7 +262,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
204
262
|
type: 'separator'
|
|
205
263
|
});
|
|
206
264
|
} else {
|
|
207
|
-
var
|
|
265
|
+
var _options2 = [{
|
|
208
266
|
id: 'editor.media.convert.mediainline',
|
|
209
267
|
title: mediaInlineImageTitle,
|
|
210
268
|
onClick: function onClick() {
|
|
@@ -235,7 +293,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
235
293
|
id: 'media-inline-to-block-toolbar-item',
|
|
236
294
|
testId: 'media-inline-to-block-dropdown',
|
|
237
295
|
type: 'dropdown',
|
|
238
|
-
options:
|
|
296
|
+
options: _options2,
|
|
239
297
|
title: intl.formatMessage(_mediaUi.messages.sizeOptions),
|
|
240
298
|
icon: function icon() {
|
|
241
299
|
return /*#__PURE__*/_react.default.createElement(_imageInline.default, {
|
|
@@ -10,6 +10,7 @@ import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
|
|
|
10
10
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
11
11
|
import { Filmstrip } from '@atlaskit/media-filmstrip';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
14
|
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
14
15
|
import { useMediaProvider } from '../ui/hooks/useMediaProvider';
|
|
15
16
|
import { MediaGroupNext } from './mediaGroupNext';
|
|
@@ -167,7 +168,7 @@ class MediaGroup extends React.Component {
|
|
|
167
168
|
items: items,
|
|
168
169
|
mediaClientConfig: viewMediaClientConfig,
|
|
169
170
|
featureFlags: mediaOptions.featureFlags,
|
|
170
|
-
shouldOpenMediaViewer: editorViewMode
|
|
171
|
+
shouldOpenMediaViewer: editorViewMode && editorExperiment('platform_editor_controls', 'control')
|
|
171
172
|
});
|
|
172
173
|
});
|
|
173
174
|
this.mediaNodes = [];
|
|
@@ -6,6 +6,7 @@ import { isNodeSelectedOrInRange, SelectedState, setNodeSelection } from '@atlas
|
|
|
6
6
|
import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
|
|
7
7
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
8
8
|
import { Filmstrip } from '@atlaskit/media-filmstrip';
|
|
9
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
10
|
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
10
11
|
import { createMediaNodeUpdater } from './mediaNodeUpdater';
|
|
11
12
|
const getIdentifier = item => {
|
|
@@ -243,7 +244,7 @@ export const MediaGroupNext = injectIntl( /*#__PURE__*/React.memo(props => {
|
|
|
243
244
|
items: items,
|
|
244
245
|
mediaClientConfig: viewMediaClientConfig,
|
|
245
246
|
featureFlags: featureFlags,
|
|
246
|
-
shouldOpenMediaViewer: editorViewMode
|
|
247
|
+
shouldOpenMediaViewer: editorViewMode && editorExperiment('platform_editor_controls', 'control')
|
|
247
248
|
});
|
|
248
249
|
}));
|
|
249
250
|
MediaGroupNext.displayName = 'MediaGroup';
|
|
@@ -13,6 +13,7 @@ import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-
|
|
|
13
13
|
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
14
14
|
import { getMediaClient } from '@atlaskit/media-client-react';
|
|
15
15
|
import { MediaInlineCardLoadingView } from '@atlaskit/media-ui';
|
|
16
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
17
|
import { isImage } from '../pm-plugins/utils/is-type';
|
|
17
18
|
import { MediaViewerContainer } from '../ui/MediaViewer/MediaViewerContainer';
|
|
18
19
|
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
@@ -143,7 +144,8 @@ export const MediaInline = props => {
|
|
|
143
144
|
mediaNode: props.node,
|
|
144
145
|
mediaPluginState: props.mediaPluginState,
|
|
145
146
|
isEditorViewMode: props.editorViewMode,
|
|
146
|
-
isSelected: props.isSelected
|
|
147
|
+
isSelected: props.isSelected,
|
|
148
|
+
isInline: fg('platform_editor_render_media_viewer_as_inline')
|
|
147
149
|
}, jsx(MediaInlineCard, {
|
|
148
150
|
isSelected: props.isSelected,
|
|
149
151
|
identifier: identifier,
|
|
@@ -6,6 +6,7 @@ import React, { Fragment, useEffect, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
10
|
import { isVideo } from '../../pm-plugins/utils/is-type';
|
|
10
11
|
import { getSelectedNearestMediaContainerNodeAttrs } from '../../ui/toolbar/utils';
|
|
11
12
|
import { RenderMediaViewer } from './PortalWrapper';
|
|
@@ -35,7 +36,7 @@ export const MediaViewerContainer = ({
|
|
|
35
36
|
setShowMediaViewer(false);
|
|
36
37
|
};
|
|
37
38
|
const isVideoMedia = isVideo((_mediaNode$firstChild = mediaNode.firstChild) === null || _mediaNode$firstChild === void 0 ? void 0 : _mediaNode$firstChild.attrs.__fileMimeType);
|
|
38
|
-
const shouldShowViewer = isEditorViewMode && showViewer && selectedNodeAttrs && mediaClientConfig && !isVideoMedia;
|
|
39
|
+
const shouldShowViewer = isEditorViewMode && showViewer && selectedNodeAttrs && mediaClientConfig && !isVideoMedia && editorExperiment('platform_editor_controls', 'control');
|
|
39
40
|
return jsx(Fragment, null, isEditorViewMode ? jsx(Fragment, null, isInline ?
|
|
40
41
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
41
42
|
jsx("span", {
|