@atlaskit/editor-plugin-media 3.0.9 → 3.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 +10 -0
- package/dist/cjs/ui/toolbar/comments.js +0 -2
- package/dist/cjs/ui/toolbar/index.js +27 -40
- package/dist/cjs/ui/toolbar/linking-toolbar-appearance.js +1 -3
- package/dist/cjs/ui/toolbar/mediaInline.js +23 -37
- package/dist/cjs/ui/toolbar/utils.js +68 -1
- package/dist/es2019/ui/toolbar/comments.js +0 -2
- package/dist/es2019/ui/toolbar/index.js +27 -40
- package/dist/es2019/ui/toolbar/linking-toolbar-appearance.js +1 -3
- package/dist/es2019/ui/toolbar/mediaInline.js +22 -36
- package/dist/es2019/ui/toolbar/utils.js +62 -0
- package/dist/esm/ui/toolbar/comments.js +0 -2
- package/dist/esm/ui/toolbar/index.js +29 -42
- package/dist/esm/ui/toolbar/linking-toolbar-appearance.js +1 -3
- package/dist/esm/ui/toolbar/mediaInline.js +24 -38
- package/dist/esm/ui/toolbar/utils.js +67 -0
- package/dist/types/ui/toolbar/commands.d.ts +1 -1
- package/dist/types/ui/toolbar/utils.d.ts +4 -1
- package/dist/types-ts4.5/ui/toolbar/commands.d.ts +1 -1
- package/dist/types-ts4.5/ui/toolbar/utils.d.ts +4 -1
- package/package.json +5 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { IconCard, IconEmbed, IconInline } from '@atlaskit/editor-common/card';
|
|
4
3
|
import commonMessages, { cardMessages, mediaAndEmbedToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
5
4
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
5
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
@@ -8,7 +7,6 @@ import GrowDiagonalIcon from '@atlaskit/icon/core/grow-diagonal';
|
|
|
8
7
|
import ImageFullscreenIcon from '@atlaskit/icon/core/image-fullscreen';
|
|
9
8
|
import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
|
|
10
9
|
import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
11
|
-
import RemoveIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
|
|
12
10
|
import DownloadIcon from '@atlaskit/icon/core/migration/download';
|
|
13
11
|
import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
14
12
|
import { messages } from '@atlaskit/media-ui';
|
|
@@ -24,7 +22,7 @@ import { changeInlineToMediaCard, changeMediaInlineToMediaSingle, removeInlineCa
|
|
|
24
22
|
import { shouldShowImageBorder } from './imageBorder';
|
|
25
23
|
import { getOpenLinkToolbarButtonOption, shouldShowMediaLinkToolbar } from './linking';
|
|
26
24
|
import { LinkToolbarAppearance } from './linking-toolbar-appearance';
|
|
27
|
-
import { downloadMedia } from './utils';
|
|
25
|
+
import { downloadMedia, getMediaSingleAndMediaInlineSwitcherDropdown } from './utils';
|
|
28
26
|
import { handleShowMediaViewer } from './index';
|
|
29
27
|
export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, options = {}) => {
|
|
30
28
|
var _pluginInjectionApi$a, _pluginInjectionApi$f, _pluginInjectionApi$f2;
|
|
@@ -45,8 +43,6 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
|
|
|
45
43
|
testId: 'file-preview-toolbar-button',
|
|
46
44
|
type: 'button',
|
|
47
45
|
icon: editorExperiment('platform_editor_controls', 'variant1') ? GrowDiagonalIcon : MaximizeIcon,
|
|
48
|
-
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
|
|
49
|
-
iconFallback: MaximizeIcon,
|
|
50
46
|
title: intl.formatMessage(messages.preview),
|
|
51
47
|
onClick: () => {
|
|
52
48
|
var _handleShowMediaViewe;
|
|
@@ -77,7 +73,6 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
|
|
|
77
73
|
id: 'editor.media.view.switcher.inline',
|
|
78
74
|
type: 'button',
|
|
79
75
|
icon: ImageInlineIcon,
|
|
80
|
-
iconFallback: IconInline,
|
|
81
76
|
selected: true,
|
|
82
77
|
disabled: false,
|
|
83
78
|
focusEditoronEnter: true,
|
|
@@ -89,7 +84,6 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
|
|
|
89
84
|
id: 'editor.media.view.switcher.thumbnail',
|
|
90
85
|
type: 'button',
|
|
91
86
|
icon: SmartLinkCardIcon,
|
|
92
|
-
iconFallback: IconCard,
|
|
93
87
|
selected: false,
|
|
94
88
|
disabled: false,
|
|
95
89
|
focusEditoronEnter: true,
|
|
@@ -119,7 +113,6 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
|
|
|
119
113
|
appearance: 'danger',
|
|
120
114
|
focusEditoronEnter: true,
|
|
121
115
|
icon: DeleteIcon,
|
|
122
|
-
iconFallback: RemoveIcon,
|
|
123
116
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
124
117
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
125
118
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
@@ -241,9 +234,7 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
|
|
|
241
234
|
icon: () => /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
242
235
|
color: "currentColor",
|
|
243
236
|
spacing: "spacious",
|
|
244
|
-
label: mediaInlineImageTitle
|
|
245
|
-
LEGACY_size: "medium",
|
|
246
|
-
LEGACY_fallbackIcon: IconInline
|
|
237
|
+
label: mediaInlineImageTitle
|
|
247
238
|
}),
|
|
248
239
|
onClick: () => {
|
|
249
240
|
return true;
|
|
@@ -256,9 +247,7 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
|
|
|
256
247
|
icon: () => /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
|
|
257
248
|
color: "currentColor",
|
|
258
249
|
spacing: "spacious",
|
|
259
|
-
label: mediaSingleTitle
|
|
260
|
-
LEGACY_size: "medium",
|
|
261
|
-
LEGACY_fallbackIcon: IconEmbed
|
|
250
|
+
label: mediaSingleTitle
|
|
262
251
|
}),
|
|
263
252
|
onClick: changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState, options === null || options === void 0 ? void 0 : options.allowPixelResizing)
|
|
264
253
|
}, {
|
|
@@ -324,9 +313,7 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
|
|
|
324
313
|
icon: /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
325
314
|
color: "currentColor",
|
|
326
315
|
spacing: "spacious",
|
|
327
|
-
label: fg('platform_editor_controls_patch_7') ? '' : mediaInlineImageTitle
|
|
328
|
-
LEGACY_size: "medium",
|
|
329
|
-
LEGACY_fallbackIcon: IconInline
|
|
316
|
+
label: fg('platform_editor_controls_patch_7') ? '' : mediaInlineImageTitle
|
|
330
317
|
})
|
|
331
318
|
}, {
|
|
332
319
|
id: 'editor.media.convert.mediasingle',
|
|
@@ -339,25 +326,26 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
|
|
|
339
326
|
}) : /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
|
|
340
327
|
color: "currentColor",
|
|
341
328
|
spacing: "spacious",
|
|
342
|
-
label: fg('platform_editor_controls_patch_7') ? '' : mediaSingleTitle
|
|
343
|
-
LEGACY_size: "medium",
|
|
344
|
-
LEGACY_fallbackIcon: IconEmbed
|
|
329
|
+
label: fg('platform_editor_controls_patch_7') ? '' : mediaSingleTitle
|
|
345
330
|
})
|
|
346
331
|
}];
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
332
|
+
let switchFromInlineToBlock;
|
|
333
|
+
if (fg('platform_editor_controls_patch_11')) {
|
|
334
|
+
switchFromInlineToBlock = getMediaSingleAndMediaInlineSwitcherDropdown('inline', intl, pluginInjectionApi);
|
|
335
|
+
} else {
|
|
336
|
+
switchFromInlineToBlock = {
|
|
337
|
+
id: 'media-inline-to-block-toolbar-item',
|
|
338
|
+
testId: 'media-inline-to-block-dropdown',
|
|
339
|
+
type: 'dropdown',
|
|
340
|
+
options: options,
|
|
341
|
+
title: intl.formatMessage(messages.sizeOptions),
|
|
342
|
+
icon: () => /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
343
|
+
color: "currentColor",
|
|
344
|
+
spacing: "spacious",
|
|
345
|
+
label: mediaInlineImageTitle
|
|
346
|
+
})
|
|
347
|
+
};
|
|
348
|
+
}
|
|
361
349
|
inlineImageItems.push(switchFromInlineToBlock, {
|
|
362
350
|
type: 'separator',
|
|
363
351
|
fullHeight: true
|
|
@@ -377,7 +365,6 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
|
|
|
377
365
|
testId: 'file-preview-toolbar-button',
|
|
378
366
|
type: 'button',
|
|
379
367
|
icon: isEditorControlsEnabled ? GrowDiagonalIcon : MaximizeIcon,
|
|
380
|
-
iconFallback: MaximizeIcon,
|
|
381
368
|
title: intl.formatMessage(messages.preview),
|
|
382
369
|
onClick: () => {
|
|
383
370
|
var _handleShowMediaViewe2;
|
|
@@ -433,7 +420,6 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
|
|
|
433
420
|
appearance: 'danger',
|
|
434
421
|
focusEditoronEnter: true,
|
|
435
422
|
icon: DeleteIcon,
|
|
436
|
-
iconFallback: RemoveIcon,
|
|
437
423
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
438
424
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
439
425
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import memoizeOne from 'memoize-one';
|
|
2
3
|
import { wrappedLayouts } from '@atlaskit/editor-common/media-single';
|
|
4
|
+
import { mediaAndEmbedToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
3
5
|
import { nonWrappedLayouts } from '@atlaskit/editor-common/utils';
|
|
4
6
|
import { findParentNodeOfType, findSelectedNodeOfType, removeParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
5
7
|
import { akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
|
|
9
|
+
import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
6
10
|
import { getMediaClient } from '@atlaskit/media-client-react';
|
|
11
|
+
import { messages } from '@atlaskit/media-ui';
|
|
7
12
|
import { isVideo } from '../../pm-plugins/utils/media-single';
|
|
13
|
+
import { changeMediaInlineToMediaSingle, changeMediaSingleToMediaInline } from './commands';
|
|
8
14
|
export const isExternalMedia = attrs => {
|
|
9
15
|
return attrs.type === 'external';
|
|
10
16
|
};
|
|
@@ -139,4 +145,60 @@ export const updateToFullHeightSeparator = items => {
|
|
|
139
145
|
fullHeight: true
|
|
140
146
|
});
|
|
141
147
|
}
|
|
148
|
+
};
|
|
149
|
+
export const getMediaSingleAndMediaInlineSwitcherDropdown = (nodeType, intl, pluginInjectionApi, hasCaption = false) => {
|
|
150
|
+
var _pluginInjectionApi$a, _pluginInjectionApi$a2;
|
|
151
|
+
const mediaInlineImageTitle = intl.formatMessage(mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
|
|
152
|
+
const mediaSingleTitle = intl.formatMessage(mediaAndEmbedToolbarMessages.changeToMediaSingle);
|
|
153
|
+
const inlineSwitcherTitle = intl.formatMessage(hasCaption ? mediaAndEmbedToolbarMessages.changeToMediaInlineImageCaptionWarning : mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
|
|
154
|
+
const InlineIcon = () => /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
155
|
+
color: "currentColor",
|
|
156
|
+
spacing: "spacious",
|
|
157
|
+
label: ""
|
|
158
|
+
});
|
|
159
|
+
const BlockIcon = () => /*#__PURE__*/React.createElement(MaximizeIcon, {
|
|
160
|
+
color: "currentColor",
|
|
161
|
+
spacing: "spacious",
|
|
162
|
+
label: ""
|
|
163
|
+
});
|
|
164
|
+
const dropdownConfig = {
|
|
165
|
+
inline: {
|
|
166
|
+
handleInlineButtonClick: () => {
|
|
167
|
+
return true;
|
|
168
|
+
},
|
|
169
|
+
handleBlockButtonClick: changeMediaInlineToMediaSingle(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width.sharedState.currentState()),
|
|
170
|
+
id: 'media-inline-to-block-toolbar-item',
|
|
171
|
+
icon: InlineIcon
|
|
172
|
+
},
|
|
173
|
+
block: {
|
|
174
|
+
handleInlineButtonClick: changeMediaSingleToMediaInline(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions),
|
|
175
|
+
handleBlockButtonClick: () => {
|
|
176
|
+
return true;
|
|
177
|
+
},
|
|
178
|
+
id: 'media-block-to-inline-toolbar-item',
|
|
179
|
+
icon: BlockIcon
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
const options = [{
|
|
183
|
+
id: 'editor.media.convert.mediainline',
|
|
184
|
+
title: mediaInlineImageTitle,
|
|
185
|
+
onClick: dropdownConfig[nodeType].handleInlineButtonClick,
|
|
186
|
+
selected: nodeType === 'inline',
|
|
187
|
+
icon: /*#__PURE__*/React.createElement(InlineIcon, null),
|
|
188
|
+
tooltip: hasCaption ? inlineSwitcherTitle : undefined
|
|
189
|
+
}, {
|
|
190
|
+
id: 'editor.media.convert.mediasingle',
|
|
191
|
+
title: mediaSingleTitle,
|
|
192
|
+
onClick: dropdownConfig[nodeType].handleBlockButtonClick,
|
|
193
|
+
selected: nodeType === 'block',
|
|
194
|
+
icon: /*#__PURE__*/React.createElement(BlockIcon, null)
|
|
195
|
+
}];
|
|
196
|
+
return {
|
|
197
|
+
id: dropdownConfig[nodeType].id,
|
|
198
|
+
testId: 'media-inline-to-block-dropdown',
|
|
199
|
+
title: intl.formatMessage(messages.sizeOptions),
|
|
200
|
+
type: 'dropdown',
|
|
201
|
+
options,
|
|
202
|
+
icon: dropdownConfig[nodeType].icon
|
|
203
|
+
};
|
|
142
204
|
};
|
|
@@ -6,7 +6,6 @@ import { annotationMessages } from '@atlaskit/editor-common/messages';
|
|
|
6
6
|
import CommentIcon from '@atlaskit/icon/core/comment';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
|
-
import { CommentWithDotIcon } from './assets/commentWithDotIcon';
|
|
10
9
|
import { getSelectedMediaSingle } from './utils';
|
|
11
10
|
export var commentButton = function commentButton(intl, state, api, onCommentButtonMount) {
|
|
12
11
|
var _getSelectedMediaSing, _api$annotation, _api$connectivity;
|
|
@@ -39,7 +38,6 @@ export var commentButton = function commentButton(intl, state, api, onCommentBut
|
|
|
39
38
|
type: 'button',
|
|
40
39
|
testId: 'add-comment-media-button',
|
|
41
40
|
icon: CommentIcon,
|
|
42
|
-
iconFallback: hasActiveComments ? CommentWithDotIcon : CommentIcon,
|
|
43
41
|
title: editorExperiment('platform_editor_controls', 'control') ? title : buttonLabel,
|
|
44
42
|
showTitle: editorExperiment('platform_editor_controls', 'control') ? undefined : true,
|
|
45
43
|
onClick: onClickHandler,
|
|
@@ -5,7 +5,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
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';
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
8
|
-
import { alignmentIcons, buildLayoutButtons, buildLayoutDropdown,
|
|
8
|
+
import { alignmentIcons, buildLayoutButtons, buildLayoutDropdown, layoutToMessages, wrappingIcons } from '@atlaskit/editor-common/card';
|
|
9
9
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
10
10
|
import { mediaInlineImagesEnabled } from '@atlaskit/editor-common/media-inline';
|
|
11
11
|
import commonMessages, { cardMessages, mediaAndEmbedToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
@@ -18,7 +18,6 @@ import GrowDiagonalIcon from '@atlaskit/icon/core/grow-diagonal';
|
|
|
18
18
|
import ImageFullscreenIcon from '@atlaskit/icon/core/image-fullscreen';
|
|
19
19
|
import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
|
|
20
20
|
import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
21
|
-
import RemoveIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
|
|
22
21
|
import DownloadIcon from '@atlaskit/icon/core/migration/download';
|
|
23
22
|
import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
24
23
|
import { mediaFilmstripItemDOMSelector } from '@atlaskit/media-filmstrip';
|
|
@@ -44,7 +43,7 @@ import { getLinkingDropdownOptions, getLinkingToolbar, getOpenLinkToolbarButtonO
|
|
|
44
43
|
import { LinkToolbarAppearance } from './linking-toolbar-appearance';
|
|
45
44
|
import { generateMediaInlineFloatingToolbar } from './mediaInline';
|
|
46
45
|
import { getPixelResizingToolbar, getResizeDropdownOption } from './pixel-resizing';
|
|
47
|
-
import { canShowSwitchButtons, downloadMedia, getMaxToolbarWidth, getSelectedLayoutIcon, getSelectedMediaSingle, getSelectedNearestMediaContainerNodeAttrs, removeMediaGroupNode, updateToFullHeightSeparator } from './utils';
|
|
46
|
+
import { canShowSwitchButtons, downloadMedia, getMaxToolbarWidth, getMediaSingleAndMediaInlineSwitcherDropdown, getSelectedLayoutIcon, getSelectedMediaSingle, getSelectedNearestMediaContainerNodeAttrs, removeMediaGroupNode, updateToFullHeightSeparator } from './utils';
|
|
48
47
|
var mediaTypeMessages = {
|
|
49
48
|
image: messages.file_image_is_selected,
|
|
50
49
|
video: messages.file_video_is_selected,
|
|
@@ -121,7 +120,6 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
121
120
|
testId: 'file-preview-toolbar-button',
|
|
122
121
|
type: 'button',
|
|
123
122
|
icon: editorExperiment('platform_editor_controls', 'variant1') ? GrowDiagonalIcon : MaximizeIcon,
|
|
124
|
-
iconFallback: MaximizeIcon,
|
|
125
123
|
title: intl.formatMessage(messages.preview),
|
|
126
124
|
onClick: function onClick() {
|
|
127
125
|
var _handleShowMediaViewe;
|
|
@@ -156,7 +154,6 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
156
154
|
id: 'editor.media.view.switcher.inline',
|
|
157
155
|
type: 'button',
|
|
158
156
|
icon: ImageInlineIcon,
|
|
159
|
-
iconFallback: IconInline,
|
|
160
157
|
selected: false,
|
|
161
158
|
focusEditoronEnter: true,
|
|
162
159
|
disabled: false,
|
|
@@ -168,7 +165,6 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
168
165
|
id: 'editor.media.view.switcher.thumbnail',
|
|
169
166
|
type: 'button',
|
|
170
167
|
icon: SmartLinkCardIcon,
|
|
171
|
-
iconFallback: IconCard,
|
|
172
168
|
selected: true,
|
|
173
169
|
disabled: false,
|
|
174
170
|
focusEditoronEnter: true,
|
|
@@ -200,7 +196,6 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
200
196
|
appearance: 'danger',
|
|
201
197
|
focusEditoronEnter: true,
|
|
202
198
|
icon: DeleteIcon,
|
|
203
|
-
iconFallback: RemoveIcon,
|
|
204
199
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
|
|
205
200
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
|
|
206
201
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
|
|
@@ -397,9 +392,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
397
392
|
return /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
398
393
|
color: "currentColor",
|
|
399
394
|
spacing: "spacious",
|
|
400
|
-
label: inlineSwitcherTitle
|
|
401
|
-
LEGACY_size: "medium",
|
|
402
|
-
LEGACY_fallbackIcon: IconInline
|
|
395
|
+
label: inlineSwitcherTitle
|
|
403
396
|
});
|
|
404
397
|
},
|
|
405
398
|
onClick: changeMediaSingleToMediaInline(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions),
|
|
@@ -412,9 +405,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
412
405
|
return /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
|
|
413
406
|
color: "currentColor",
|
|
414
407
|
spacing: "spacious",
|
|
415
|
-
label: floatingSwitcherTitle
|
|
416
|
-
LEGACY_size: "medium",
|
|
417
|
-
LEGACY_fallbackIcon: IconEmbed
|
|
408
|
+
label: floatingSwitcherTitle
|
|
418
409
|
});
|
|
419
410
|
},
|
|
420
411
|
onClick: function onClick() {
|
|
@@ -435,9 +426,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
435
426
|
icon: /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
436
427
|
color: "currentColor",
|
|
437
428
|
spacing: "spacious",
|
|
438
|
-
label: fg('platform_editor_controls_patch_7') ? '' : inlineTitle
|
|
439
|
-
LEGACY_size: "medium",
|
|
440
|
-
LEGACY_fallbackIcon: IconInline
|
|
429
|
+
label: fg('platform_editor_controls_patch_7') ? '' : inlineTitle
|
|
441
430
|
}),
|
|
442
431
|
tooltip: hasCaption ? inlineSwitcherTitle : undefined
|
|
443
432
|
}, {
|
|
@@ -454,31 +443,32 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
454
443
|
}) : /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
|
|
455
444
|
color: "currentColor",
|
|
456
445
|
spacing: "spacious",
|
|
457
|
-
label: fg('platform_editor_controls_patch_7') ? '' : floatingSwitcherTitle
|
|
458
|
-
LEGACY_size: "medium",
|
|
459
|
-
LEGACY_fallbackIcon: IconEmbed
|
|
446
|
+
label: fg('platform_editor_controls_patch_7') ? '' : floatingSwitcherTitle
|
|
460
447
|
})
|
|
461
448
|
}];
|
|
462
|
-
var switchFromBlockToInline
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
449
|
+
var switchFromBlockToInline;
|
|
450
|
+
if (fg('platform_editor_controls_patch_11')) {
|
|
451
|
+
switchFromBlockToInline = getMediaSingleAndMediaInlineSwitcherDropdown('block', intl, pluginInjectionApi, hasCaption);
|
|
452
|
+
} else {
|
|
453
|
+
switchFromBlockToInline = {
|
|
454
|
+
id: 'media-block-to-inline-toolbar-item',
|
|
455
|
+
testId: 'media-inline-to-block-dropdown',
|
|
456
|
+
type: 'dropdown',
|
|
457
|
+
options: _options2,
|
|
458
|
+
title: intl.formatMessage(messages.sizeOptions),
|
|
459
|
+
icon: function icon() {
|
|
460
|
+
return fg('platform_editor_controls_patch_7') ? /*#__PURE__*/React.createElement(MaximizeIcon, {
|
|
461
|
+
color: "currentColor",
|
|
462
|
+
spacing: "spacious",
|
|
463
|
+
label: intl.formatMessage(messages.sizeOptions)
|
|
464
|
+
}) : /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
|
|
465
|
+
color: "currentColor",
|
|
466
|
+
spacing: "spacious",
|
|
467
|
+
label: intl.formatMessage(messages.sizeOptions)
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
}
|
|
482
472
|
toolbarButtons.push(switchFromBlockToInline, {
|
|
483
473
|
type: 'separator',
|
|
484
474
|
fullHeight: true
|
|
@@ -601,7 +591,6 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
601
591
|
testId: 'file-preview-toolbar-button',
|
|
602
592
|
type: 'button',
|
|
603
593
|
icon: editorExperiment('platform_editor_controls', 'variant1') ? GrowDiagonalIcon : MaximizeIcon,
|
|
604
|
-
iconFallback: MaximizeIcon,
|
|
605
594
|
title: intl.formatMessage(messages.preview),
|
|
606
595
|
onClick: function onClick() {
|
|
607
596
|
var _handleShowMediaViewe2;
|
|
@@ -650,7 +639,6 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
650
639
|
appearance: 'danger',
|
|
651
640
|
focusEditoronEnter: true,
|
|
652
641
|
icon: DeleteIcon,
|
|
653
|
-
iconFallback: RemoveIcon,
|
|
654
642
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
|
|
655
643
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
|
|
656
644
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
|
|
@@ -688,7 +676,6 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
688
676
|
testId: 'file-preview-toolbar-button',
|
|
689
677
|
type: 'button',
|
|
690
678
|
icon: editorExperiment('platform_editor_controls', 'variant1') ? GrowDiagonalIcon : MaximizeIcon,
|
|
691
|
-
iconFallback: MaximizeIcon,
|
|
692
679
|
title: intl.formatMessage(messages.preview),
|
|
693
680
|
onClick: function onClick() {
|
|
694
681
|
var _handleShowMediaViewe3;
|
|
@@ -13,7 +13,6 @@ import { linkMessages, linkToolbarMessages } from '@atlaskit/editor-common/messa
|
|
|
13
13
|
import { FloatingToolbarSeparator as Separator, FloatingToolbarButton as ToolbarButton } from '@atlaskit/editor-common/ui';
|
|
14
14
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
15
15
|
import LinkIcon from '@atlaskit/icon/core/migration/link';
|
|
16
|
-
import OpenIcon from '@atlaskit/icon/glyph/shortcut';
|
|
17
16
|
import { currentMediaInlineNode, currentMediaNode } from '../../pm-plugins//utils/current-media-node';
|
|
18
17
|
import { stateKey } from '../../pm-plugins/plugin-key';
|
|
19
18
|
import { checkMediaType } from '../../pm-plugins/utils/check-media-type';
|
|
@@ -76,8 +75,7 @@ export var LinkToolbarAppearance = function LinkToolbarAppearance(_ref) {
|
|
|
76
75
|
icon: jsx(LinkExternalIcon, {
|
|
77
76
|
color: "currentColor",
|
|
78
77
|
spacing: "spacious",
|
|
79
|
-
label: linkTitle
|
|
80
|
-
LEGACY_fallbackIcon: OpenIcon
|
|
78
|
+
label: linkTitle
|
|
81
79
|
})
|
|
82
80
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
83
81
|
,
|
|
@@ -3,7 +3,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
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; }
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
6
|
-
import { IconCard, IconEmbed, IconInline } from '@atlaskit/editor-common/card';
|
|
7
6
|
import commonMessages, { cardMessages, mediaAndEmbedToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
8
7
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
8
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
@@ -11,7 +10,6 @@ import GrowDiagonalIcon from '@atlaskit/icon/core/grow-diagonal';
|
|
|
11
10
|
import ImageFullscreenIcon from '@atlaskit/icon/core/image-fullscreen';
|
|
12
11
|
import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
|
|
13
12
|
import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
14
|
-
import RemoveIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
|
|
15
13
|
import DownloadIcon from '@atlaskit/icon/core/migration/download';
|
|
16
14
|
import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
17
15
|
import { messages } from '@atlaskit/media-ui';
|
|
@@ -27,7 +25,7 @@ import { changeInlineToMediaCard, changeMediaInlineToMediaSingle, removeInlineCa
|
|
|
27
25
|
import { shouldShowImageBorder } from './imageBorder';
|
|
28
26
|
import { getOpenLinkToolbarButtonOption, shouldShowMediaLinkToolbar } from './linking';
|
|
29
27
|
import { LinkToolbarAppearance } from './linking-toolbar-appearance';
|
|
30
|
-
import { downloadMedia } from './utils';
|
|
28
|
+
import { downloadMedia, getMediaSingleAndMediaInlineSwitcherDropdown } from './utils';
|
|
31
29
|
import { handleShowMediaViewer } from './index';
|
|
32
30
|
export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi) {
|
|
33
31
|
var _pluginInjectionApi$a, _pluginInjectionApi$f;
|
|
@@ -47,8 +45,6 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
|
|
|
47
45
|
testId: 'file-preview-toolbar-button',
|
|
48
46
|
type: 'button',
|
|
49
47
|
icon: editorExperiment('platform_editor_controls', 'variant1') ? GrowDiagonalIcon : MaximizeIcon,
|
|
50
|
-
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
|
|
51
|
-
iconFallback: MaximizeIcon,
|
|
52
48
|
title: intl.formatMessage(messages.preview),
|
|
53
49
|
onClick: function onClick() {
|
|
54
50
|
var _handleShowMediaViewe;
|
|
@@ -77,7 +73,6 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
|
|
|
77
73
|
id: 'editor.media.view.switcher.inline',
|
|
78
74
|
type: 'button',
|
|
79
75
|
icon: ImageInlineIcon,
|
|
80
|
-
iconFallback: IconInline,
|
|
81
76
|
selected: true,
|
|
82
77
|
disabled: false,
|
|
83
78
|
focusEditoronEnter: true,
|
|
@@ -91,7 +86,6 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
|
|
|
91
86
|
id: 'editor.media.view.switcher.thumbnail',
|
|
92
87
|
type: 'button',
|
|
93
88
|
icon: SmartLinkCardIcon,
|
|
94
|
-
iconFallback: IconCard,
|
|
95
89
|
selected: false,
|
|
96
90
|
disabled: false,
|
|
97
91
|
focusEditoronEnter: true,
|
|
@@ -121,7 +115,6 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
|
|
|
121
115
|
appearance: 'danger',
|
|
122
116
|
focusEditoronEnter: true,
|
|
123
117
|
icon: DeleteIcon,
|
|
124
|
-
iconFallback: RemoveIcon,
|
|
125
118
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
126
119
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
127
120
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
@@ -243,9 +236,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
243
236
|
return /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
244
237
|
color: "currentColor",
|
|
245
238
|
spacing: "spacious",
|
|
246
|
-
label: mediaInlineImageTitle
|
|
247
|
-
LEGACY_size: "medium",
|
|
248
|
-
LEGACY_fallbackIcon: IconInline
|
|
239
|
+
label: mediaInlineImageTitle
|
|
249
240
|
});
|
|
250
241
|
},
|
|
251
242
|
onClick: function onClick() {
|
|
@@ -260,9 +251,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
260
251
|
return /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
|
|
261
252
|
color: "currentColor",
|
|
262
253
|
spacing: "spacious",
|
|
263
|
-
label: mediaSingleTitle
|
|
264
|
-
LEGACY_size: "medium",
|
|
265
|
-
LEGACY_fallbackIcon: IconEmbed
|
|
254
|
+
label: mediaSingleTitle
|
|
266
255
|
});
|
|
267
256
|
},
|
|
268
257
|
onClick: changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState, options === null || options === void 0 ? void 0 : options.allowPixelResizing)
|
|
@@ -323,9 +312,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
323
312
|
icon: /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
324
313
|
color: "currentColor",
|
|
325
314
|
spacing: "spacious",
|
|
326
|
-
label: fg('platform_editor_controls_patch_7') ? '' : mediaInlineImageTitle
|
|
327
|
-
LEGACY_size: "medium",
|
|
328
|
-
LEGACY_fallbackIcon: IconInline
|
|
315
|
+
label: fg('platform_editor_controls_patch_7') ? '' : mediaInlineImageTitle
|
|
329
316
|
})
|
|
330
317
|
}, {
|
|
331
318
|
id: 'editor.media.convert.mediasingle',
|
|
@@ -338,27 +325,28 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
338
325
|
}) : /*#__PURE__*/React.createElement(ImageFullscreenIcon, {
|
|
339
326
|
color: "currentColor",
|
|
340
327
|
spacing: "spacious",
|
|
341
|
-
label: fg('platform_editor_controls_patch_7') ? '' : mediaSingleTitle
|
|
342
|
-
LEGACY_size: "medium",
|
|
343
|
-
LEGACY_fallbackIcon: IconEmbed
|
|
328
|
+
label: fg('platform_editor_controls_patch_7') ? '' : mediaSingleTitle
|
|
344
329
|
})
|
|
345
330
|
}];
|
|
346
|
-
var switchFromInlineToBlock
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
331
|
+
var switchFromInlineToBlock;
|
|
332
|
+
if (fg('platform_editor_controls_patch_11')) {
|
|
333
|
+
switchFromInlineToBlock = getMediaSingleAndMediaInlineSwitcherDropdown('inline', intl, pluginInjectionApi);
|
|
334
|
+
} else {
|
|
335
|
+
switchFromInlineToBlock = {
|
|
336
|
+
id: 'media-inline-to-block-toolbar-item',
|
|
337
|
+
testId: 'media-inline-to-block-dropdown',
|
|
338
|
+
type: 'dropdown',
|
|
339
|
+
options: _options2,
|
|
340
|
+
title: intl.formatMessage(messages.sizeOptions),
|
|
341
|
+
icon: function icon() {
|
|
342
|
+
return /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
343
|
+
color: "currentColor",
|
|
344
|
+
spacing: "spacious",
|
|
345
|
+
label: mediaInlineImageTitle
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
}
|
|
362
350
|
inlineImageItems.push(switchFromInlineToBlock, {
|
|
363
351
|
type: 'separator',
|
|
364
352
|
fullHeight: true
|
|
@@ -378,7 +366,6 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
378
366
|
testId: 'file-preview-toolbar-button',
|
|
379
367
|
type: 'button',
|
|
380
368
|
icon: isEditorControlsEnabled ? GrowDiagonalIcon : MaximizeIcon,
|
|
381
|
-
iconFallback: MaximizeIcon,
|
|
382
369
|
title: intl.formatMessage(messages.preview),
|
|
383
370
|
onClick: function onClick() {
|
|
384
371
|
var _handleShowMediaViewe2;
|
|
@@ -434,7 +421,6 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
434
421
|
appearance: 'danger',
|
|
435
422
|
focusEditoronEnter: true,
|
|
436
423
|
icon: DeleteIcon,
|
|
437
|
-
iconFallback: RemoveIcon,
|
|
438
424
|
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
439
425
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
440
426
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|