@atlaskit/editor-plugin-media 2.3.10 → 2.3.12
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 +19 -0
- package/dist/cjs/mediaPlugin.js +1 -1
- 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/nodeviews/mediaSingle.js +6 -27
- package/dist/cjs/nodeviews/mediaSingleNext.js +7 -30
- package/dist/cjs/pm-plugins/main.js +0 -4
- package/dist/cjs/pm-plugins/utils/media-single.js +1 -2
- package/dist/cjs/ui/CommentBadge/index.js +3 -5
- package/dist/cjs/ui/MediaViewer/MediaViewerContainer.js +2 -1
- package/dist/cjs/ui/MediaViewer/PortalWrapper.js +2 -2
- package/dist/cjs/ui/toolbar/index.js +117 -64
- package/dist/cjs/ui/toolbar/mediaInline.js +121 -63
- package/dist/es2019/mediaPlugin.js +1 -1
- 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/nodeviews/mediaSingle.js +4 -26
- package/dist/es2019/nodeviews/mediaSingleNext.js +6 -29
- package/dist/es2019/pm-plugins/main.js +0 -4
- package/dist/es2019/pm-plugins/utils/media-single.js +1 -2
- package/dist/es2019/ui/CommentBadge/index.js +3 -5
- package/dist/es2019/ui/MediaViewer/MediaViewerContainer.js +2 -1
- package/dist/es2019/ui/MediaViewer/PortalWrapper.js +2 -2
- package/dist/es2019/ui/toolbar/index.js +114 -64
- package/dist/es2019/ui/toolbar/mediaInline.js +114 -61
- package/dist/esm/mediaPlugin.js +1 -1
- 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/nodeviews/mediaSingle.js +6 -27
- package/dist/esm/nodeviews/mediaSingleNext.js +7 -30
- package/dist/esm/pm-plugins/main.js +0 -4
- package/dist/esm/pm-plugins/utils/media-single.js +1 -2
- package/dist/esm/ui/CommentBadge/index.js +3 -5
- package/dist/esm/ui/MediaViewer/MediaViewerContainer.js +2 -1
- package/dist/esm/ui/MediaViewer/PortalWrapper.js +2 -2
- 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/ui/CommentBadge/index.d.ts +2 -3
- package/dist/types-ts4.5/pm-plugins/pixel-resizing/reducer.d.ts +2 -2
- package/dist/types-ts4.5/ui/CommentBadge/index.d.ts +2 -3
- package/package.json +10 -7
|
@@ -11,7 +11,6 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
11
11
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
12
|
import { safeInsert as pmSafeInsert, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
14
|
import { copyOptionalAttrsFromMediaState, isInsidePotentialEmptyParagraph } from '../utils/media-common';
|
|
16
15
|
import { findChangeFromLocation, getChangeMediaAnalytics } from './analytics';
|
|
17
16
|
import { isImage } from './is-type';
|
|
@@ -100,7 +99,7 @@ export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, no
|
|
|
100
99
|
return false;
|
|
101
100
|
}
|
|
102
101
|
var resizeExperience = fg('platform_editor_media_extended_resize_experience');
|
|
103
|
-
var insertMediaPopup =
|
|
102
|
+
var insertMediaPopup = fg('platform_editor_add_media_from_url_rollout');
|
|
104
103
|
var mediaSingleAttrs = resizeExperience && insertMediaPopup ? {
|
|
105
104
|
widthType: 'pixel',
|
|
106
105
|
width: getMediaSingleInitialWidth((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : DEFAULT_IMAGE_WIDTH),
|
|
@@ -75,7 +75,7 @@ export var CommentBadge = injectIntl(CommentBadgeWrapper);
|
|
|
75
75
|
/**
|
|
76
76
|
* Remove CommentBadgeWrapper component above
|
|
77
77
|
* and rename CommentBadgeNextWrapper to CommentBadgeWrapper
|
|
78
|
-
* when clean up
|
|
78
|
+
* when clean up platform_editor_add_media_from_url_rollout feature flag
|
|
79
79
|
*/
|
|
80
80
|
|
|
81
81
|
export var CommentBadgeNextWrapper = function CommentBadgeNextWrapper(_ref2) {
|
|
@@ -83,8 +83,7 @@ export var CommentBadgeNextWrapper = function CommentBadgeNextWrapper(_ref2) {
|
|
|
83
83
|
mediaNode = _ref2.mediaNode,
|
|
84
84
|
view = _ref2.view,
|
|
85
85
|
getPos = _ref2.getPos,
|
|
86
|
-
isDrafting = _ref2.isDrafting
|
|
87
|
-
badgeSize = _ref2.badgeSize;
|
|
86
|
+
isDrafting = _ref2.isDrafting;
|
|
88
87
|
var _useState3 = useState(false),
|
|
89
88
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
90
89
|
entered = _useState4[0],
|
|
@@ -130,7 +129,6 @@ export var CommentBadgeNextWrapper = function CommentBadgeNextWrapper(_ref2) {
|
|
|
130
129
|
},
|
|
131
130
|
onMouseLeave: function onMouseLeave() {
|
|
132
131
|
return setEntered(false);
|
|
133
|
-
}
|
|
134
|
-
badgeSize: badgeSize
|
|
132
|
+
}
|
|
135
133
|
});
|
|
136
134
|
};
|
|
@@ -7,6 +7,7 @@ import React, { Fragment, useEffect, useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
import { isVideo } from '../../pm-plugins/utils/is-type';
|
|
11
12
|
import { getSelectedNearestMediaContainerNodeAttrs } from '../../ui/toolbar/utils';
|
|
12
13
|
import { RenderMediaViewer } from './PortalWrapper';
|
|
@@ -41,7 +42,7 @@ export var MediaViewerContainer = function MediaViewerContainer(_ref) {
|
|
|
41
42
|
setShowMediaViewer(false);
|
|
42
43
|
};
|
|
43
44
|
var isVideoMedia = isVideo((_mediaNode$firstChild = mediaNode.firstChild) === null || _mediaNode$firstChild === void 0 ? void 0 : _mediaNode$firstChild.attrs.__fileMimeType);
|
|
44
|
-
var shouldShowViewer = isEditorViewMode && showViewer && selectedNodeAttrs && mediaClientConfig && !isVideoMedia;
|
|
45
|
+
var shouldShowViewer = isEditorViewMode && showViewer && selectedNodeAttrs && mediaClientConfig && !isVideoMedia && editorExperiment('platform_editor_controls', 'control');
|
|
45
46
|
return jsx(Fragment, null, isEditorViewMode ? jsx(Fragment, null, isInline ?
|
|
46
47
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
47
48
|
jsx("span", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
3
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
4
|
-
import {
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { isExternalMedia } from '../../ui/toolbar/utils';
|
|
6
6
|
var getIdentifier = function getIdentifier(attrs) {
|
|
7
7
|
if (isExternalMedia(attrs)) {
|
|
@@ -26,7 +26,7 @@ export var RenderMediaViewer = function RenderMediaViewer(_ref) {
|
|
|
26
26
|
selectedNodeAttrs = _ref.selectedNodeAttrs,
|
|
27
27
|
_ref$items = _ref.items,
|
|
28
28
|
items = _ref$items === void 0 ? [] : _ref$items;
|
|
29
|
-
if (
|
|
29
|
+
if (fg('platform_editor_add_media_from_url_rollout')) {
|
|
30
30
|
var _identifier = getIdentifier(selectedNodeAttrs);
|
|
31
31
|
var collectionName = isExternalMedia(selectedNodeAttrs) ? '' : selectedNodeAttrs.collection;
|
|
32
32
|
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(MediaViewer, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
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; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import React from 'react';
|
|
@@ -81,41 +81,10 @@ export var handleShowMediaViewer = function handleShowMediaViewer(_ref) {
|
|
|
81
81
|
};
|
|
82
82
|
var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, editorAnalyticsAPI, forceFocusSelector, isViewOnly) {
|
|
83
83
|
var _mediaPluginState$med, _pluginInjectionApi$c;
|
|
84
|
-
if (isViewOnly) {
|
|
85
|
-
return [];
|
|
86
|
-
}
|
|
87
84
|
var enforceMediaDataSecurityPolicy = mediaPluginState === null || mediaPluginState === void 0 || (_mediaPluginState$med = mediaPluginState.mediaClientConfig) === null || _mediaPluginState$med === void 0 ? void 0 : _mediaPluginState$med.enforceDataSecurityPolicy;
|
|
88
85
|
var disableDownloadButton = typeof enforceMediaDataSecurityPolicy === 'boolean' ? enforceMediaDataSecurityPolicy : false;
|
|
89
|
-
var
|
|
90
|
-
var
|
|
91
|
-
id: 'editor.media.view.switcher.inline',
|
|
92
|
-
type: 'button',
|
|
93
|
-
icon: ImageInlineIcon,
|
|
94
|
-
iconFallback: IconInline,
|
|
95
|
-
selected: false,
|
|
96
|
-
focusEditoronEnter: true,
|
|
97
|
-
disabled: false,
|
|
98
|
-
onClick: changeMediaCardToInline(editorAnalyticsAPI, forceFocusSelector),
|
|
99
|
-
title: intl.formatMessage(cardMessages.inlineTitle),
|
|
100
|
-
testId: 'inline-appearance',
|
|
101
|
-
className: 'inline-appearance' // a11y. uses to force focus on item
|
|
102
|
-
}, {
|
|
103
|
-
id: 'editor.media.view.switcher.thumbnail',
|
|
104
|
-
type: 'button',
|
|
105
|
-
icon: SmartLinkCardIcon,
|
|
106
|
-
iconFallback: IconCard,
|
|
107
|
-
selected: true,
|
|
108
|
-
disabled: false,
|
|
109
|
-
focusEditoronEnter: true,
|
|
110
|
-
onClick: function onClick() {
|
|
111
|
-
return true;
|
|
112
|
-
},
|
|
113
|
-
title: intl.formatMessage(cardMessages.blockTitle),
|
|
114
|
-
testId: 'thumbnail-appearance',
|
|
115
|
-
className: 'thumbnail-appearance' // a11y. uses to force focus on item
|
|
116
|
-
}, {
|
|
117
|
-
type: 'separator'
|
|
118
|
-
}, {
|
|
86
|
+
var isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
|
|
87
|
+
var preview = {
|
|
119
88
|
id: 'editor.media.viewer',
|
|
120
89
|
testId: 'file-preview-toolbar-button',
|
|
121
90
|
type: 'button',
|
|
@@ -131,9 +100,8 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
131
100
|
},
|
|
132
101
|
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',
|
|
133
102
|
supportsViewMode: true
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
}, {
|
|
103
|
+
};
|
|
104
|
+
var download = _objectSpread({
|
|
137
105
|
id: 'editor.media.card.download',
|
|
138
106
|
type: 'button',
|
|
139
107
|
icon: DownloadIcon,
|
|
@@ -143,33 +111,118 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
143
111
|
},
|
|
144
112
|
title: intl.formatMessage(messages.download),
|
|
145
113
|
disabled: disableDownloadButton
|
|
146
|
-
}, {
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
114
|
+
}, isEditorControlsEnabled && {
|
|
115
|
+
supportsViewMode: true
|
|
116
|
+
});
|
|
117
|
+
if (isViewOnly && !isEditorControlsEnabled) {
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
var mediaGroup = state.schema.nodes.mediaGroup;
|
|
121
|
+
var items = [];
|
|
122
|
+
if (!isEditorControlsEnabled) {
|
|
123
|
+
items.push({
|
|
124
|
+
id: 'editor.media.view.switcher.inline',
|
|
125
|
+
type: 'button',
|
|
126
|
+
icon: ImageInlineIcon,
|
|
127
|
+
iconFallback: IconInline,
|
|
128
|
+
selected: false,
|
|
129
|
+
focusEditoronEnter: true,
|
|
130
|
+
disabled: false,
|
|
131
|
+
onClick: changeMediaCardToInline(editorAnalyticsAPI, forceFocusSelector),
|
|
132
|
+
title: intl.formatMessage(cardMessages.inlineTitle),
|
|
133
|
+
testId: 'inline-appearance',
|
|
134
|
+
className: 'inline-appearance' // a11y. uses to force focus on item
|
|
135
|
+
}, {
|
|
136
|
+
id: 'editor.media.view.switcher.thumbnail',
|
|
137
|
+
type: 'button',
|
|
138
|
+
icon: SmartLinkCardIcon,
|
|
139
|
+
iconFallback: IconCard,
|
|
140
|
+
selected: true,
|
|
141
|
+
disabled: false,
|
|
142
|
+
focusEditoronEnter: true,
|
|
143
|
+
onClick: function onClick() {
|
|
144
|
+
return true;
|
|
145
|
+
},
|
|
146
|
+
title: intl.formatMessage(cardMessages.blockTitle),
|
|
147
|
+
testId: 'thumbnail-appearance',
|
|
148
|
+
className: 'thumbnail-appearance' // a11y. uses to force focus on item
|
|
149
|
+
}, {
|
|
150
|
+
type: 'separator'
|
|
151
|
+
}, preview, {
|
|
152
|
+
type: 'separator'
|
|
153
|
+
}, download, {
|
|
154
|
+
type: 'separator'
|
|
155
|
+
}, {
|
|
156
|
+
type: 'copy-button',
|
|
157
|
+
supportsViewMode: true,
|
|
158
|
+
items: [{
|
|
159
|
+
state: state,
|
|
160
|
+
formatMessage: intl.formatMessage,
|
|
161
|
+
nodeType: mediaGroup
|
|
162
|
+
}]
|
|
163
|
+
}, {
|
|
164
|
+
type: 'separator'
|
|
165
|
+
}, {
|
|
166
|
+
id: 'editor.media.delete',
|
|
167
|
+
type: 'button',
|
|
168
|
+
appearance: 'danger',
|
|
169
|
+
focusEditoronEnter: true,
|
|
170
|
+
icon: DeleteIcon,
|
|
171
|
+
iconFallback: RemoveIcon,
|
|
172
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
|
|
173
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
|
|
174
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
|
|
175
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
|
|
176
|
+
title: intl.formatMessage(commonMessages.remove),
|
|
177
|
+
onClick: handleRemoveMediaGroup,
|
|
178
|
+
testId: 'media-toolbar-remove-button'
|
|
179
|
+
});
|
|
180
|
+
} else {
|
|
181
|
+
var options = [{
|
|
182
|
+
id: 'editor.media.view.switcher.inline',
|
|
183
|
+
title: intl.formatMessage(cardMessages.inlineTitle),
|
|
184
|
+
onClick: changeMediaCardToInline(editorAnalyticsAPI, forceFocusSelector),
|
|
185
|
+
icon: /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
186
|
+
label: "",
|
|
187
|
+
spacing: "spacious"
|
|
188
|
+
})
|
|
189
|
+
}, {
|
|
190
|
+
id: 'editor.media.view.switcher.thumbnail',
|
|
191
|
+
title: intl.formatMessage(cardMessages.blockTitle),
|
|
192
|
+
selected: true,
|
|
193
|
+
onClick: function onClick() {
|
|
194
|
+
return true;
|
|
195
|
+
},
|
|
196
|
+
icon: /*#__PURE__*/React.createElement(SmartLinkCardIcon, {
|
|
197
|
+
label: "",
|
|
198
|
+
spacing: "spacious"
|
|
199
|
+
})
|
|
200
|
+
}];
|
|
201
|
+
var switcherDropdown = {
|
|
202
|
+
title: intl.formatMessage(messages.fileDisplayOptions),
|
|
203
|
+
id: 'media-group-inline-switcher-toolbar-item',
|
|
204
|
+
testId: 'media-group-inline-switcher-dropdown',
|
|
205
|
+
type: 'dropdown',
|
|
206
|
+
options: options,
|
|
207
|
+
icon: function icon() {
|
|
208
|
+
return /*#__PURE__*/React.createElement(SmartLinkCardIcon, {
|
|
209
|
+
label: "",
|
|
210
|
+
spacing: "spacious"
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
items.push(switcherDropdown, {
|
|
215
|
+
type: 'separator',
|
|
216
|
+
fullHeight: true
|
|
217
|
+
}, download, {
|
|
218
|
+
type: 'separator',
|
|
219
|
+
fullHeight: true,
|
|
220
|
+
supportsViewMode: true
|
|
221
|
+
}, preview, {
|
|
222
|
+
type: 'separator',
|
|
223
|
+
fullHeight: true
|
|
224
|
+
});
|
|
225
|
+
}
|
|
173
226
|
return items;
|
|
174
227
|
};
|
|
175
228
|
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi) {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import React from 'react';
|
|
2
5
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
6
|
import { IconCard, IconEmbed, IconInline } from '@atlaskit/editor-common/card';
|
|
4
7
|
import commonMessages, { cardMessages, mediaAndEmbedToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
5
8
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
9
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
10
|
+
import GrowDiagonalIcon from '@atlaskit/icon/core/grow-diagonal';
|
|
7
11
|
import ImageFullscreenIcon from '@atlaskit/icon/core/image-fullscreen';
|
|
8
12
|
import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
|
|
9
13
|
import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
@@ -36,39 +40,13 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
|
|
|
36
40
|
if (mediaPluginState.allowInlineImages && isImage(mediaType)) {
|
|
37
41
|
return getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState, options);
|
|
38
42
|
}
|
|
39
|
-
var items = [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
icon: ImageInlineIcon,
|
|
43
|
-
iconFallback: IconInline,
|
|
44
|
-
selected: true,
|
|
45
|
-
disabled: false,
|
|
46
|
-
focusEditoronEnter: true,
|
|
47
|
-
onClick: function onClick() {
|
|
48
|
-
return true;
|
|
49
|
-
},
|
|
50
|
-
title: intl.formatMessage(cardMessages.inlineTitle),
|
|
51
|
-
testId: 'inline-appearance',
|
|
52
|
-
className: 'inline-appearance' // a11y. uses to force focus on item
|
|
53
|
-
}, {
|
|
54
|
-
id: 'editor.media.view.switcher.thumbnail',
|
|
55
|
-
type: 'button',
|
|
56
|
-
icon: SmartLinkCardIcon,
|
|
57
|
-
iconFallback: IconCard,
|
|
58
|
-
selected: false,
|
|
59
|
-
disabled: false,
|
|
60
|
-
focusEditoronEnter: true,
|
|
61
|
-
onClick: changeInlineToMediaCard(editorAnalyticsAPI, forceFocusSelector),
|
|
62
|
-
title: intl.formatMessage(cardMessages.blockTitle),
|
|
63
|
-
testId: 'thumbnail-appearance',
|
|
64
|
-
className: 'thumbnail-appearance' // a11y. uses to force focus on item
|
|
65
|
-
}, {
|
|
66
|
-
type: 'separator'
|
|
67
|
-
}, {
|
|
43
|
+
var items = [];
|
|
44
|
+
var isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
|
|
45
|
+
var preview = _objectSpread({
|
|
68
46
|
id: 'editor.media.viewer',
|
|
69
47
|
testId: 'file-preview-toolbar-button',
|
|
70
48
|
type: 'button',
|
|
71
|
-
icon: MaximizeIcon,
|
|
49
|
+
icon: editorExperiment('platform_editor_controls', 'variant1') ? GrowDiagonalIcon : MaximizeIcon,
|
|
72
50
|
iconFallback: FilePreviewIcon,
|
|
73
51
|
title: intl.formatMessage(messages.preview),
|
|
74
52
|
onClick: function onClick() {
|
|
@@ -78,10 +56,10 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
|
|
|
78
56
|
api: pluginInjectionApi
|
|
79
57
|
})) !== null && _handleShowMediaViewe !== void 0 ? _handleShowMediaViewe : false;
|
|
80
58
|
}
|
|
81
|
-
}, {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
59
|
+
}, isEditorControlsEnabled && {
|
|
60
|
+
supportsViewMode: true
|
|
61
|
+
});
|
|
62
|
+
var download = _objectSpread({
|
|
85
63
|
id: 'editor.media.card.download',
|
|
86
64
|
type: 'button',
|
|
87
65
|
icon: DownloadIcon,
|
|
@@ -90,33 +68,113 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
|
|
|
90
68
|
return true;
|
|
91
69
|
},
|
|
92
70
|
title: intl.formatMessage(messages.download)
|
|
93
|
-
}, {
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
71
|
+
}, isEditorControlsEnabled && {
|
|
72
|
+
supportsViewMode: true
|
|
73
|
+
});
|
|
74
|
+
if (!isEditorControlsEnabled) {
|
|
75
|
+
items.push({
|
|
76
|
+
id: 'editor.media.view.switcher.inline',
|
|
77
|
+
type: 'button',
|
|
78
|
+
icon: ImageInlineIcon,
|
|
79
|
+
iconFallback: IconInline,
|
|
80
|
+
selected: true,
|
|
81
|
+
disabled: false,
|
|
82
|
+
focusEditoronEnter: true,
|
|
83
|
+
onClick: function onClick() {
|
|
84
|
+
return true;
|
|
85
|
+
},
|
|
86
|
+
title: intl.formatMessage(cardMessages.inlineTitle),
|
|
87
|
+
testId: 'inline-appearance',
|
|
88
|
+
className: 'inline-appearance' // a11y. uses to force focus on item
|
|
89
|
+
}, {
|
|
90
|
+
id: 'editor.media.view.switcher.thumbnail',
|
|
91
|
+
type: 'button',
|
|
92
|
+
icon: SmartLinkCardIcon,
|
|
93
|
+
iconFallback: IconCard,
|
|
94
|
+
selected: false,
|
|
95
|
+
disabled: false,
|
|
96
|
+
focusEditoronEnter: true,
|
|
97
|
+
onClick: changeInlineToMediaCard(editorAnalyticsAPI, forceFocusSelector),
|
|
98
|
+
title: intl.formatMessage(cardMessages.blockTitle),
|
|
99
|
+
testId: 'thumbnail-appearance',
|
|
100
|
+
className: 'thumbnail-appearance' // a11y. uses to force focus on item
|
|
101
|
+
}, {
|
|
102
|
+
type: 'separator'
|
|
103
|
+
}, preview, {
|
|
104
|
+
type: 'separator'
|
|
105
|
+
}, download, {
|
|
106
|
+
type: 'separator'
|
|
107
|
+
}, {
|
|
108
|
+
type: 'copy-button',
|
|
109
|
+
supportsViewMode: true,
|
|
110
|
+
items: [{
|
|
111
|
+
state: state,
|
|
112
|
+
formatMessage: intl.formatMessage,
|
|
113
|
+
nodeType: mediaInline
|
|
114
|
+
}]
|
|
115
|
+
}, {
|
|
116
|
+
type: 'separator'
|
|
117
|
+
}, {
|
|
118
|
+
id: 'editor.media.delete',
|
|
119
|
+
type: 'button',
|
|
120
|
+
appearance: 'danger',
|
|
121
|
+
focusEditoronEnter: true,
|
|
122
|
+
icon: DeleteIcon,
|
|
123
|
+
iconFallback: RemoveIcon,
|
|
124
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
125
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
126
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
127
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
128
|
+
title: intl.formatMessage(commonMessages.remove),
|
|
129
|
+
onClick: removeInlineCard,
|
|
130
|
+
testId: 'media-toolbar-remove-button'
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
133
|
+
var _options = [{
|
|
134
|
+
id: 'editor.media.view.switcher.inline',
|
|
135
|
+
title: intl.formatMessage(cardMessages.inlineTitle),
|
|
136
|
+
onClick: function onClick() {
|
|
137
|
+
return true;
|
|
138
|
+
},
|
|
139
|
+
selected: true,
|
|
140
|
+
icon: /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
141
|
+
label: "",
|
|
142
|
+
spacing: "spacious"
|
|
143
|
+
})
|
|
144
|
+
}, {
|
|
145
|
+
id: 'editor.media.view.switcher.thumbnail',
|
|
146
|
+
title: intl.formatMessage(cardMessages.blockTitle),
|
|
147
|
+
onClick: changeInlineToMediaCard(editorAnalyticsAPI, forceFocusSelector),
|
|
148
|
+
icon: /*#__PURE__*/React.createElement(SmartLinkCardIcon, {
|
|
149
|
+
label: "",
|
|
150
|
+
spacing: "spacious"
|
|
151
|
+
})
|
|
152
|
+
}];
|
|
153
|
+
var switcherDropdown = {
|
|
154
|
+
title: intl.formatMessage(messages.fileDisplayOptions),
|
|
155
|
+
id: 'media-group-inline-switcher-toolbar-item',
|
|
156
|
+
testId: 'media-group-inline-switcher-dropdown',
|
|
157
|
+
type: 'dropdown',
|
|
158
|
+
options: _options,
|
|
159
|
+
icon: function icon() {
|
|
160
|
+
return /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
161
|
+
label: "",
|
|
162
|
+
spacing: "spacious"
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
items.push(switcherDropdown, {
|
|
167
|
+
type: 'separator',
|
|
168
|
+
fullHeight: true
|
|
169
|
+
}, download, {
|
|
170
|
+
type: 'separator',
|
|
171
|
+
fullHeight: true,
|
|
172
|
+
supportsViewMode: true
|
|
173
|
+
}, preview, {
|
|
174
|
+
type: 'separator',
|
|
175
|
+
fullHeight: true
|
|
176
|
+
});
|
|
177
|
+
}
|
|
120
178
|
return items;
|
|
121
179
|
};
|
|
122
180
|
var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState) {
|
|
@@ -194,7 +252,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
194
252
|
type: 'separator'
|
|
195
253
|
});
|
|
196
254
|
} else {
|
|
197
|
-
var
|
|
255
|
+
var _options2 = [{
|
|
198
256
|
id: 'editor.media.convert.mediainline',
|
|
199
257
|
title: mediaInlineImageTitle,
|
|
200
258
|
onClick: function onClick() {
|
|
@@ -225,7 +283,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
225
283
|
id: 'media-inline-to-block-toolbar-item',
|
|
226
284
|
testId: 'media-inline-to-block-dropdown',
|
|
227
285
|
type: 'dropdown',
|
|
228
|
-
options:
|
|
286
|
+
options: _options2,
|
|
229
287
|
title: intl.formatMessage(messages.sizeOptions),
|
|
230
288
|
icon: function icon() {
|
|
231
289
|
return /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type MediaPixelResizingState = {
|
|
2
2
|
isPixelEditorOpen: boolean;
|
|
3
3
|
};
|
|
4
4
|
type OpenPixelEditor = {
|
|
@@ -8,5 +8,5 @@ type ClosePixelEditor = {
|
|
|
8
8
|
type: 'closePixelEditor';
|
|
9
9
|
};
|
|
10
10
|
type MediaPixelResizingAction = OpenPixelEditor | ClosePixelEditor;
|
|
11
|
-
declare const _default: (state:
|
|
11
|
+
declare const _default: (state: MediaPixelResizingState, action: MediaPixelResizingAction) => MediaPixelResizingState;
|
|
12
12
|
export default _default;
|
|
@@ -21,7 +21,7 @@ export declare const CommentBadge: React.FC<import("react-intl-next").WithIntlPr
|
|
|
21
21
|
/**
|
|
22
22
|
* Remove CommentBadgeWrapper component above
|
|
23
23
|
* and rename CommentBadgeNextWrapper to CommentBadgeWrapper
|
|
24
|
-
* when clean up
|
|
24
|
+
* when clean up platform_editor_add_media_from_url_rollout feature flag
|
|
25
25
|
*/
|
|
26
26
|
type CommentBadgeNextWrapperProps = {
|
|
27
27
|
mediaSingleElement?: HTMLElement | null;
|
|
@@ -31,7 +31,6 @@ type CommentBadgeNextWrapperProps = {
|
|
|
31
31
|
mediaNode: PMNode | null;
|
|
32
32
|
view: EditorView;
|
|
33
33
|
getPos: getPosHandler;
|
|
34
|
-
badgeSize: 'small' | 'medium';
|
|
35
34
|
};
|
|
36
|
-
export declare const CommentBadgeNextWrapper: ({ api, mediaNode, view, getPos, isDrafting,
|
|
35
|
+
export declare const CommentBadgeNextWrapper: ({ api, mediaNode, view, getPos, isDrafting, }: CommentBadgeNextWrapperProps) => React.JSX.Element | null;
|
|
37
36
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type MediaPixelResizingState = {
|
|
2
2
|
isPixelEditorOpen: boolean;
|
|
3
3
|
};
|
|
4
4
|
type OpenPixelEditor = {
|
|
@@ -8,5 +8,5 @@ type ClosePixelEditor = {
|
|
|
8
8
|
type: 'closePixelEditor';
|
|
9
9
|
};
|
|
10
10
|
type MediaPixelResizingAction = OpenPixelEditor | ClosePixelEditor;
|
|
11
|
-
declare const _default: (state:
|
|
11
|
+
declare const _default: (state: MediaPixelResizingState, action: MediaPixelResizingAction) => MediaPixelResizingState;
|
|
12
12
|
export default _default;
|
|
@@ -21,7 +21,7 @@ export declare const CommentBadge: React.FC<import("react-intl-next").WithIntlPr
|
|
|
21
21
|
/**
|
|
22
22
|
* Remove CommentBadgeWrapper component above
|
|
23
23
|
* and rename CommentBadgeNextWrapper to CommentBadgeWrapper
|
|
24
|
-
* when clean up
|
|
24
|
+
* when clean up platform_editor_add_media_from_url_rollout feature flag
|
|
25
25
|
*/
|
|
26
26
|
type CommentBadgeNextWrapperProps = {
|
|
27
27
|
mediaSingleElement?: HTMLElement | null;
|
|
@@ -31,7 +31,6 @@ type CommentBadgeNextWrapperProps = {
|
|
|
31
31
|
mediaNode: PMNode | null;
|
|
32
32
|
view: EditorView;
|
|
33
33
|
getPos: getPosHandler;
|
|
34
|
-
badgeSize: 'small' | 'medium';
|
|
35
34
|
};
|
|
36
|
-
export declare const CommentBadgeNextWrapper: ({ api, mediaNode, view, getPos, isDrafting,
|
|
35
|
+
export declare const CommentBadgeNextWrapper: ({ api, mediaNode, view, getPos, isDrafting, }: CommentBadgeNextWrapperProps) => React.JSX.Element | null;
|
|
37
36
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.12",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/analytics-namespaced-context": "^7.0.0",
|
|
39
39
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
40
40
|
"@atlaskit/button": "^21.1.0",
|
|
41
|
-
"@atlaskit/editor-common": "^102.
|
|
41
|
+
"@atlaskit/editor-common": "^102.13.0",
|
|
42
42
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
43
43
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
44
44
|
"@atlaskit/editor-plugin-annotation": "^2.1.0",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"@atlaskit/media-common": "^12.0.0",
|
|
64
64
|
"@atlaskit/media-filmstrip": "^49.0.0",
|
|
65
65
|
"@atlaskit/media-picker": "^68.0.0",
|
|
66
|
-
"@atlaskit/media-ui": "^28.
|
|
66
|
+
"@atlaskit/media-ui": "^28.1.0",
|
|
67
67
|
"@atlaskit/media-viewer": "^52.0.0",
|
|
68
68
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
69
69
|
"@atlaskit/primitives": "^14.2.0",
|
|
70
70
|
"@atlaskit/textfield": "^8.0.0",
|
|
71
71
|
"@atlaskit/theme": "^18.0.0",
|
|
72
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
72
|
+
"@atlaskit/tmp-editor-statsig": "^4.3.0",
|
|
73
73
|
"@atlaskit/tokens": "^4.5.0",
|
|
74
74
|
"@atlaskit/tooltip": "^20.0.0",
|
|
75
75
|
"@babel/runtime": "^7.0.0",
|
|
@@ -150,9 +150,6 @@
|
|
|
150
150
|
"confluence_frontend_media_scroll_fix": {
|
|
151
151
|
"type": "boolean"
|
|
152
152
|
},
|
|
153
|
-
"platform_editor_hide_external_media_badge": {
|
|
154
|
-
"type": "boolean"
|
|
155
|
-
},
|
|
156
153
|
"platform_editor_media_block_default": {
|
|
157
154
|
"type": "boolean"
|
|
158
155
|
},
|
|
@@ -164,6 +161,12 @@
|
|
|
164
161
|
},
|
|
165
162
|
"platform_editor_safari_media_clipboard_fix": {
|
|
166
163
|
"type": "boolean"
|
|
164
|
+
},
|
|
165
|
+
"platform_editor_add_media_from_url_rollout": {
|
|
166
|
+
"type": "boolean"
|
|
167
|
+
},
|
|
168
|
+
"platform_editor_render_media_viewer_as_inline": {
|
|
169
|
+
"type": "boolean"
|
|
167
170
|
}
|
|
168
171
|
},
|
|
169
172
|
"stricter": {
|