@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
|
@@ -78,41 +78,10 @@ export const handleShowMediaViewer = ({
|
|
|
78
78
|
};
|
|
79
79
|
const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, editorAnalyticsAPI, forceFocusSelector, isViewOnly) => {
|
|
80
80
|
var _mediaPluginState$med, _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$c3;
|
|
81
|
-
if (isViewOnly) {
|
|
82
|
-
return [];
|
|
83
|
-
}
|
|
84
81
|
const enforceMediaDataSecurityPolicy = mediaPluginState === null || mediaPluginState === void 0 ? void 0 : (_mediaPluginState$med = mediaPluginState.mediaClientConfig) === null || _mediaPluginState$med === void 0 ? void 0 : _mediaPluginState$med.enforceDataSecurityPolicy;
|
|
85
82
|
const disableDownloadButton = typeof enforceMediaDataSecurityPolicy === 'boolean' ? enforceMediaDataSecurityPolicy : false;
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
} = state.schema.nodes;
|
|
89
|
-
const items = [{
|
|
90
|
-
id: 'editor.media.view.switcher.inline',
|
|
91
|
-
type: 'button',
|
|
92
|
-
icon: ImageInlineIcon,
|
|
93
|
-
iconFallback: IconInline,
|
|
94
|
-
selected: false,
|
|
95
|
-
focusEditoronEnter: true,
|
|
96
|
-
disabled: false,
|
|
97
|
-
onClick: changeMediaCardToInline(editorAnalyticsAPI, forceFocusSelector),
|
|
98
|
-
title: intl.formatMessage(cardMessages.inlineTitle),
|
|
99
|
-
testId: 'inline-appearance',
|
|
100
|
-
className: 'inline-appearance' // a11y. uses to force focus on item
|
|
101
|
-
}, {
|
|
102
|
-
id: 'editor.media.view.switcher.thumbnail',
|
|
103
|
-
type: 'button',
|
|
104
|
-
icon: SmartLinkCardIcon,
|
|
105
|
-
iconFallback: IconCard,
|
|
106
|
-
selected: true,
|
|
107
|
-
disabled: false,
|
|
108
|
-
focusEditoronEnter: true,
|
|
109
|
-
onClick: () => true,
|
|
110
|
-
title: intl.formatMessage(cardMessages.blockTitle),
|
|
111
|
-
testId: 'thumbnail-appearance',
|
|
112
|
-
className: 'thumbnail-appearance' // a11y. uses to force focus on item
|
|
113
|
-
}, {
|
|
114
|
-
type: 'separator'
|
|
115
|
-
}, {
|
|
83
|
+
const isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
|
|
84
|
+
const preview = {
|
|
116
85
|
id: 'editor.media.viewer',
|
|
117
86
|
testId: 'file-preview-toolbar-button',
|
|
118
87
|
type: 'button',
|
|
@@ -128,9 +97,8 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState, hoverDe
|
|
|
128
97
|
},
|
|
129
98
|
disabled: (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.sharedState) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : (_pluginInjectionApi$c3 = _pluginInjectionApi$c2.currentState()) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.mode) === 'offline',
|
|
130
99
|
supportsViewMode: true
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
}, {
|
|
100
|
+
};
|
|
101
|
+
const download = {
|
|
134
102
|
id: 'editor.media.card.download',
|
|
135
103
|
type: 'button',
|
|
136
104
|
icon: DownloadIcon,
|
|
@@ -139,34 +107,116 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState, hoverDe
|
|
|
139
107
|
return true;
|
|
140
108
|
},
|
|
141
109
|
title: intl.formatMessage(messages.download),
|
|
142
|
-
disabled: disableDownloadButton
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
110
|
+
disabled: disableDownloadButton,
|
|
111
|
+
...(isEditorControlsEnabled && {
|
|
112
|
+
supportsViewMode: true
|
|
113
|
+
})
|
|
114
|
+
};
|
|
115
|
+
if (isViewOnly && !isEditorControlsEnabled) {
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
const {
|
|
119
|
+
mediaGroup
|
|
120
|
+
} = state.schema.nodes;
|
|
121
|
+
const 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: () => true,
|
|
144
|
+
title: intl.formatMessage(cardMessages.blockTitle),
|
|
145
|
+
testId: 'thumbnail-appearance',
|
|
146
|
+
className: 'thumbnail-appearance' // a11y. uses to force focus on item
|
|
147
|
+
}, {
|
|
148
|
+
type: 'separator'
|
|
149
|
+
}, preview, {
|
|
150
|
+
type: 'separator'
|
|
151
|
+
}, download, {
|
|
152
|
+
type: 'separator'
|
|
153
|
+
}, {
|
|
154
|
+
type: 'copy-button',
|
|
155
|
+
supportsViewMode: true,
|
|
156
|
+
items: [{
|
|
157
|
+
state,
|
|
158
|
+
formatMessage: intl.formatMessage,
|
|
159
|
+
nodeType: mediaGroup
|
|
160
|
+
}]
|
|
161
|
+
}, {
|
|
162
|
+
type: 'separator'
|
|
163
|
+
}, {
|
|
164
|
+
id: 'editor.media.delete',
|
|
165
|
+
type: 'button',
|
|
166
|
+
appearance: 'danger',
|
|
167
|
+
focusEditoronEnter: true,
|
|
168
|
+
icon: DeleteIcon,
|
|
169
|
+
iconFallback: RemoveIcon,
|
|
170
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
|
|
171
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
|
|
172
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
|
|
173
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
|
|
174
|
+
title: intl.formatMessage(commonMessages.remove),
|
|
175
|
+
onClick: handleRemoveMediaGroup,
|
|
176
|
+
testId: 'media-toolbar-remove-button'
|
|
177
|
+
});
|
|
178
|
+
} else {
|
|
179
|
+
const options = [{
|
|
180
|
+
id: 'editor.media.view.switcher.inline',
|
|
181
|
+
title: intl.formatMessage(cardMessages.inlineTitle),
|
|
182
|
+
onClick: changeMediaCardToInline(editorAnalyticsAPI, forceFocusSelector),
|
|
183
|
+
icon: /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
184
|
+
label: "",
|
|
185
|
+
spacing: "spacious"
|
|
186
|
+
})
|
|
187
|
+
}, {
|
|
188
|
+
id: 'editor.media.view.switcher.thumbnail',
|
|
189
|
+
title: intl.formatMessage(cardMessages.blockTitle),
|
|
190
|
+
selected: true,
|
|
191
|
+
onClick: () => true,
|
|
192
|
+
icon: /*#__PURE__*/React.createElement(SmartLinkCardIcon, {
|
|
193
|
+
label: "",
|
|
194
|
+
spacing: "spacious"
|
|
195
|
+
})
|
|
196
|
+
}];
|
|
197
|
+
const switcherDropdown = {
|
|
198
|
+
title: intl.formatMessage(messages.fileDisplayOptions),
|
|
199
|
+
id: 'media-group-inline-switcher-toolbar-item',
|
|
200
|
+
testId: 'media-group-inline-switcher-dropdown',
|
|
201
|
+
type: 'dropdown',
|
|
202
|
+
options,
|
|
203
|
+
icon: () => /*#__PURE__*/React.createElement(SmartLinkCardIcon, {
|
|
204
|
+
label: "",
|
|
205
|
+
spacing: "spacious"
|
|
206
|
+
})
|
|
207
|
+
};
|
|
208
|
+
items.push(switcherDropdown, {
|
|
209
|
+
type: 'separator',
|
|
210
|
+
fullHeight: true
|
|
211
|
+
}, download, {
|
|
212
|
+
type: 'separator',
|
|
213
|
+
fullHeight: true,
|
|
214
|
+
supportsViewMode: true
|
|
215
|
+
}, preview, {
|
|
216
|
+
type: 'separator',
|
|
217
|
+
fullHeight: true
|
|
218
|
+
});
|
|
219
|
+
}
|
|
170
220
|
return items;
|
|
171
221
|
};
|
|
172
222
|
const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi) => {
|
|
@@ -4,6 +4,7 @@ import { IconCard, IconEmbed, IconInline } from '@atlaskit/editor-common/card';
|
|
|
4
4
|
import commonMessages, { cardMessages, mediaAndEmbedToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
7
|
+
import GrowDiagonalIcon from '@atlaskit/icon/core/grow-diagonal';
|
|
7
8
|
import ImageFullscreenIcon from '@atlaskit/icon/core/image-fullscreen';
|
|
8
9
|
import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
|
|
9
10
|
import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
@@ -37,37 +38,13 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
|
|
|
37
38
|
if (mediaPluginState.allowInlineImages && isImage(mediaType)) {
|
|
38
39
|
return getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState, options);
|
|
39
40
|
}
|
|
40
|
-
const items = [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
icon: ImageInlineIcon,
|
|
44
|
-
iconFallback: IconInline,
|
|
45
|
-
selected: true,
|
|
46
|
-
disabled: false,
|
|
47
|
-
focusEditoronEnter: true,
|
|
48
|
-
onClick: () => true,
|
|
49
|
-
title: intl.formatMessage(cardMessages.inlineTitle),
|
|
50
|
-
testId: 'inline-appearance',
|
|
51
|
-
className: 'inline-appearance' // a11y. uses to force focus on item
|
|
52
|
-
}, {
|
|
53
|
-
id: 'editor.media.view.switcher.thumbnail',
|
|
54
|
-
type: 'button',
|
|
55
|
-
icon: SmartLinkCardIcon,
|
|
56
|
-
iconFallback: IconCard,
|
|
57
|
-
selected: false,
|
|
58
|
-
disabled: false,
|
|
59
|
-
focusEditoronEnter: true,
|
|
60
|
-
onClick: changeInlineToMediaCard(editorAnalyticsAPI, forceFocusSelector),
|
|
61
|
-
title: intl.formatMessage(cardMessages.blockTitle),
|
|
62
|
-
testId: 'thumbnail-appearance',
|
|
63
|
-
className: 'thumbnail-appearance' // a11y. uses to force focus on item
|
|
64
|
-
}, {
|
|
65
|
-
type: 'separator'
|
|
66
|
-
}, {
|
|
41
|
+
const items = [];
|
|
42
|
+
const isEditorControlsEnabled = editorExperiment('platform_editor_controls', 'variant1');
|
|
43
|
+
const preview = {
|
|
67
44
|
id: 'editor.media.viewer',
|
|
68
45
|
testId: 'file-preview-toolbar-button',
|
|
69
46
|
type: 'button',
|
|
70
|
-
icon: MaximizeIcon,
|
|
47
|
+
icon: editorExperiment('platform_editor_controls', 'variant1') ? GrowDiagonalIcon : MaximizeIcon,
|
|
71
48
|
iconFallback: FilePreviewIcon,
|
|
72
49
|
title: intl.formatMessage(messages.preview),
|
|
73
50
|
onClick: () => {
|
|
@@ -76,11 +53,12 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
|
|
|
76
53
|
mediaPluginState,
|
|
77
54
|
api: pluginInjectionApi
|
|
78
55
|
})) !== null && _handleShowMediaViewe !== void 0 ? _handleShowMediaViewe : false;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
56
|
+
},
|
|
57
|
+
...(isEditorControlsEnabled && {
|
|
58
|
+
supportsViewMode: true
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
const download = {
|
|
84
62
|
id: 'editor.media.card.download',
|
|
85
63
|
type: 'button',
|
|
86
64
|
icon: DownloadIcon,
|
|
@@ -88,34 +66,109 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
|
|
|
88
66
|
downloadMedia(mediaPluginState);
|
|
89
67
|
return true;
|
|
90
68
|
},
|
|
91
|
-
title: intl.formatMessage(messages.download)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
items
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
69
|
+
title: intl.formatMessage(messages.download),
|
|
70
|
+
...(isEditorControlsEnabled && {
|
|
71
|
+
supportsViewMode: true
|
|
72
|
+
})
|
|
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: () => true,
|
|
84
|
+
title: intl.formatMessage(cardMessages.inlineTitle),
|
|
85
|
+
testId: 'inline-appearance',
|
|
86
|
+
className: 'inline-appearance' // a11y. uses to force focus on item
|
|
87
|
+
}, {
|
|
88
|
+
id: 'editor.media.view.switcher.thumbnail',
|
|
89
|
+
type: 'button',
|
|
90
|
+
icon: SmartLinkCardIcon,
|
|
91
|
+
iconFallback: IconCard,
|
|
92
|
+
selected: false,
|
|
93
|
+
disabled: false,
|
|
94
|
+
focusEditoronEnter: true,
|
|
95
|
+
onClick: changeInlineToMediaCard(editorAnalyticsAPI, forceFocusSelector),
|
|
96
|
+
title: intl.formatMessage(cardMessages.blockTitle),
|
|
97
|
+
testId: 'thumbnail-appearance',
|
|
98
|
+
className: 'thumbnail-appearance' // a11y. uses to force focus on item
|
|
99
|
+
}, {
|
|
100
|
+
type: 'separator'
|
|
101
|
+
}, preview, {
|
|
102
|
+
type: 'separator'
|
|
103
|
+
}, download, {
|
|
104
|
+
type: 'separator'
|
|
105
|
+
}, {
|
|
106
|
+
type: 'copy-button',
|
|
107
|
+
supportsViewMode: true,
|
|
108
|
+
items: [{
|
|
109
|
+
state,
|
|
110
|
+
formatMessage: intl.formatMessage,
|
|
111
|
+
nodeType: mediaInline
|
|
112
|
+
}]
|
|
113
|
+
}, {
|
|
114
|
+
type: 'separator'
|
|
115
|
+
}, {
|
|
116
|
+
id: 'editor.media.delete',
|
|
117
|
+
type: 'button',
|
|
118
|
+
appearance: 'danger',
|
|
119
|
+
focusEditoronEnter: true,
|
|
120
|
+
icon: DeleteIcon,
|
|
121
|
+
iconFallback: RemoveIcon,
|
|
122
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
123
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
124
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
125
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
126
|
+
title: intl.formatMessage(commonMessages.remove),
|
|
127
|
+
onClick: removeInlineCard,
|
|
128
|
+
testId: 'media-toolbar-remove-button'
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
const options = [{
|
|
132
|
+
id: 'editor.media.view.switcher.inline',
|
|
133
|
+
title: intl.formatMessage(cardMessages.inlineTitle),
|
|
134
|
+
onClick: () => true,
|
|
135
|
+
selected: true,
|
|
136
|
+
icon: /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
137
|
+
label: "",
|
|
138
|
+
spacing: "spacious"
|
|
139
|
+
})
|
|
140
|
+
}, {
|
|
141
|
+
id: 'editor.media.view.switcher.thumbnail',
|
|
142
|
+
title: intl.formatMessage(cardMessages.blockTitle),
|
|
143
|
+
onClick: changeInlineToMediaCard(editorAnalyticsAPI, forceFocusSelector),
|
|
144
|
+
icon: /*#__PURE__*/React.createElement(SmartLinkCardIcon, {
|
|
145
|
+
label: "",
|
|
146
|
+
spacing: "spacious"
|
|
147
|
+
})
|
|
148
|
+
}];
|
|
149
|
+
const switcherDropdown = {
|
|
150
|
+
title: intl.formatMessage(messages.fileDisplayOptions),
|
|
151
|
+
id: 'media-group-inline-switcher-toolbar-item',
|
|
152
|
+
testId: 'media-group-inline-switcher-dropdown',
|
|
153
|
+
type: 'dropdown',
|
|
154
|
+
options,
|
|
155
|
+
icon: () => /*#__PURE__*/React.createElement(ImageInlineIcon, {
|
|
156
|
+
label: "",
|
|
157
|
+
spacing: "spacious"
|
|
158
|
+
})
|
|
159
|
+
};
|
|
160
|
+
items.push(switcherDropdown, {
|
|
161
|
+
type: 'separator',
|
|
162
|
+
fullHeight: true
|
|
163
|
+
}, download, {
|
|
164
|
+
type: 'separator',
|
|
165
|
+
fullHeight: true,
|
|
166
|
+
supportsViewMode: true
|
|
167
|
+
}, preview, {
|
|
168
|
+
type: 'separator',
|
|
169
|
+
fullHeight: true
|
|
170
|
+
});
|
|
171
|
+
}
|
|
119
172
|
return items;
|
|
120
173
|
};
|
|
121
174
|
const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState, options = {}) => {
|
package/dist/esm/mediaPlugin.js
CHANGED
|
@@ -297,7 +297,7 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
297
297
|
pluginsOptions: {
|
|
298
298
|
quickInsert: function quickInsert(_ref14) {
|
|
299
299
|
var formatMessage = _ref14.formatMessage;
|
|
300
|
-
return
|
|
300
|
+
return fg('platform_editor_add_media_from_url_rollout') ? [] : [{
|
|
301
301
|
id: 'media',
|
|
302
302
|
title: formatMessage(messages.mediaFiles),
|
|
303
303
|
description: formatMessage(messages.mediaFilesDescription),
|
|
@@ -21,6 +21,7 @@ import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
|
|
|
21
21
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
22
22
|
import { Filmstrip } from '@atlaskit/media-filmstrip';
|
|
23
23
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
24
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
24
25
|
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
25
26
|
import { useMediaProvider } from '../ui/hooks/useMediaProvider';
|
|
26
27
|
import { MediaGroupNext } from './mediaGroupNext';
|
|
@@ -174,7 +175,7 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
|
|
|
174
175
|
items: items,
|
|
175
176
|
mediaClientConfig: viewMediaClientConfig,
|
|
176
177
|
featureFlags: mediaOptions.featureFlags,
|
|
177
|
-
shouldOpenMediaViewer: editorViewMode
|
|
178
|
+
shouldOpenMediaViewer: editorViewMode && editorExperiment('platform_editor_controls', 'control')
|
|
178
179
|
});
|
|
179
180
|
});
|
|
180
181
|
_this.mediaNodes = [];
|
|
@@ -12,6 +12,7 @@ import { isNodeSelectedOrInRange, SelectedState, setNodeSelection } from '@atlas
|
|
|
12
12
|
import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
|
|
13
13
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
14
14
|
import { Filmstrip } from '@atlaskit/media-filmstrip';
|
|
15
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
16
|
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
16
17
|
import { createMediaNodeUpdater } from './mediaNodeUpdater';
|
|
17
18
|
var getIdentifier = function getIdentifier(item) {
|
|
@@ -279,7 +280,7 @@ export var MediaGroupNext = injectIntl( /*#__PURE__*/React.memo(function (props)
|
|
|
279
280
|
items: items,
|
|
280
281
|
mediaClientConfig: viewMediaClientConfig,
|
|
281
282
|
featureFlags: featureFlags,
|
|
282
|
-
shouldOpenMediaViewer: editorViewMode
|
|
283
|
+
shouldOpenMediaViewer: editorViewMode && editorExperiment('platform_editor_controls', 'control')
|
|
283
284
|
});
|
|
284
285
|
}));
|
|
285
286
|
MediaGroupNext.displayName = 'MediaGroup';
|
|
@@ -28,6 +28,7 @@ import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-
|
|
|
28
28
|
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
29
29
|
import { getMediaClient } from '@atlaskit/media-client-react';
|
|
30
30
|
import { MediaInlineCardLoadingView } from '@atlaskit/media-ui';
|
|
31
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
31
32
|
import { isImage } from '../pm-plugins/utils/is-type';
|
|
32
33
|
import { MediaViewerContainer } from '../ui/MediaViewer/MediaViewerContainer';
|
|
33
34
|
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
@@ -207,7 +208,8 @@ export var MediaInline = function MediaInline(props) {
|
|
|
207
208
|
mediaNode: props.node,
|
|
208
209
|
mediaPluginState: props.mediaPluginState,
|
|
209
210
|
isEditorViewMode: props.editorViewMode,
|
|
210
|
-
isSelected: props.isSelected
|
|
211
|
+
isSelected: props.isSelected,
|
|
212
|
+
isInline: fg('platform_editor_render_media_viewer_as_inline')
|
|
211
213
|
}, jsx(MediaInlineCard, {
|
|
212
214
|
isSelected: props.isSelected,
|
|
213
215
|
identifier: identifier,
|
|
@@ -35,7 +35,6 @@ import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/u
|
|
|
35
35
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
36
36
|
import { getAttrsFromUrl } from '@atlaskit/media-client';
|
|
37
37
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
38
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
39
38
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../pm-plugins/commands/captions';
|
|
40
39
|
import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
|
|
41
40
|
import { isMediaBlobUrlFromAttrs } from '../pm-plugins/utils/media-common';
|
|
@@ -309,7 +308,6 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
309
308
|
key: "componentDidMount",
|
|
310
309
|
value: function () {
|
|
311
310
|
var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
312
|
-
var _this$props$node$firs2;
|
|
313
311
|
var contextIdentifierProvider;
|
|
314
312
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
315
313
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -328,20 +326,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
328
326
|
contextIdentifierProvider: _context3.t1
|
|
329
327
|
};
|
|
330
328
|
_context3.t0.setState.call(_context3.t0, _context3.t2);
|
|
331
|
-
|
|
332
|
-
// Remove this block when cleaning up platform_editor_add_media_from_url
|
|
333
|
-
if (((_this$props$node$firs2 = this.props.node.firstChild) === null || _this$props$node$firs2 === void 0 ? void 0 : _this$props$node$firs2.attrs.type) === 'external') {
|
|
334
|
-
if (editorExperiment('add-media-from-url', true)) {
|
|
335
|
-
editorExperiment('add-media-from-url', true, {
|
|
336
|
-
exposure: true
|
|
337
|
-
});
|
|
338
|
-
} else {
|
|
339
|
-
editorExperiment('add-media-from-url', false, {
|
|
340
|
-
exposure: true
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
case 11:
|
|
329
|
+
case 10:
|
|
345
330
|
case "end":
|
|
346
331
|
return _context3.stop();
|
|
347
332
|
}
|
|
@@ -468,7 +453,6 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
468
453
|
var shouldShowPlaceholder = mediaOptions.allowCaptions && node.childCount !== 2 && isSelected && state.selection instanceof NodeSelection;
|
|
469
454
|
shouldShowPlaceholder = !editorDisabled && shouldShowPlaceholder;
|
|
470
455
|
var isCurrentNodeDrafting = (annotationPluginState === null || annotationPluginState === void 0 ? void 0 : annotationPluginState.isDrafting) && (annotationPluginState === null || annotationPluginState === void 0 ? void 0 : annotationPluginState.targetNodeId) === (node === null || node === void 0 || (_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.attrs.id);
|
|
471
|
-
var shouldShowExternalMediaBadge = attrs.type === 'external';
|
|
472
456
|
var pos = getPos();
|
|
473
457
|
var isInsideTable = pos !== undefined && findParentNodeOfTypeClosestToPos(state.doc.resolve(pos), [state.schema.nodes.table]);
|
|
474
458
|
var currentMediaElement = function currentMediaElement() {
|
|
@@ -487,29 +471,24 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
487
471
|
,
|
|
488
472
|
className: MediaSingleNodeSelector,
|
|
489
473
|
onClick: this.onMediaSingleClicked
|
|
490
|
-
},
|
|
474
|
+
}, fg('platform_editor_add_media_from_url_rollout') && jsx(MediaBadges, {
|
|
491
475
|
mediaElement: currentMediaElement(),
|
|
492
476
|
mediaHeight: height,
|
|
493
477
|
mediaWidth: width,
|
|
494
478
|
extendedResizeOffset: fg('platform_editor_media_extended_resize_experience') && !isInsideTable
|
|
495
479
|
}, function (_ref5) {
|
|
496
|
-
var
|
|
497
|
-
|
|
498
|
-
return jsx(React.Fragment, null, fg('platform_editor_hide_external_media_badge') ? visible && jsx(ExternalImageBadge, {
|
|
499
|
-
badgeSize: badgeSize,
|
|
480
|
+
var visible = _ref5.visible;
|
|
481
|
+
return jsx(React.Fragment, null, visible && jsx(ExternalImageBadge, {
|
|
500
482
|
type: attrs.type,
|
|
501
483
|
url: attrs.type === 'external' ? attrs.url : undefined
|
|
502
|
-
}) : shouldShowExternalMediaBadge && visible && jsx(ExternalImageBadge, {
|
|
503
|
-
badgeSize: badgeSize
|
|
504
484
|
}), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeNextWrapper, {
|
|
505
485
|
view: view,
|
|
506
486
|
api: pluginInjectionApi,
|
|
507
487
|
mediaNode: node === null || node === void 0 ? void 0 : node.firstChild,
|
|
508
488
|
getPos: getPos,
|
|
509
|
-
isDrafting: isCurrentNodeDrafting
|
|
510
|
-
badgeSize: badgeSize
|
|
489
|
+
isDrafting: isCurrentNodeDrafting
|
|
511
490
|
}));
|
|
512
|
-
}), !
|
|
491
|
+
}), !fg('platform_editor_add_media_from_url_rollout') && mediaOptions.allowCommentsOnMedia && jsx(CommentBadge, {
|
|
513
492
|
view: view,
|
|
514
493
|
api: pluginInjectionApi,
|
|
515
494
|
mediaNode: node === null || node === void 0 ? void 0 : node.firstChild,
|
|
@@ -22,7 +22,6 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
22
22
|
import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
23
23
|
import { getAttrsFromUrl } from '@atlaskit/media-client';
|
|
24
24
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
26
25
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../pm-plugins/commands/captions';
|
|
27
26
|
import { isMediaBlobUrlFromAttrs } from '../pm-plugins/utils/media-common';
|
|
28
27
|
import { CaptionPlaceholder, CaptionPlaceholderButton } from '../ui/CaptionPlaceholder';
|
|
@@ -281,7 +280,7 @@ var useUpdateSizeCallback = function useUpdateSizeCallback(_ref5) {
|
|
|
281
280
|
*/
|
|
282
281
|
var FALLBACK_MOST_COMMON_WIDTH = 760;
|
|
283
282
|
export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNextProps) {
|
|
284
|
-
var _pluginInjectionApi$m, _mediaNode$
|
|
283
|
+
var _pluginInjectionApi$m, _mediaNode$firstChild;
|
|
285
284
|
var selected = mediaSingleNodeNextProps.selected,
|
|
286
285
|
getPos = mediaSingleNodeNextProps.getPos,
|
|
287
286
|
nextMediaNode = mediaSingleNodeNextProps.node,
|
|
@@ -357,22 +356,6 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
|
|
|
357
356
|
}
|
|
358
357
|
});
|
|
359
358
|
}, [contextIdentifierProviderPromise]);
|
|
360
|
-
React.useEffect(function () {
|
|
361
|
-
var _mediaNode$firstChild;
|
|
362
|
-
// No-op but logging an exposure when an external image is rendered
|
|
363
|
-
// Remove this block when cleaning up platform_editor_add_media_from_url
|
|
364
|
-
if (((_mediaNode$firstChild = mediaNode.firstChild) === null || _mediaNode$firstChild === void 0 ? void 0 : _mediaNode$firstChild.attrs.type) === 'external') {
|
|
365
|
-
if (editorExperiment('add-media-from-url', true)) {
|
|
366
|
-
editorExperiment('add-media-from-url', true, {
|
|
367
|
-
exposure: true
|
|
368
|
-
});
|
|
369
|
-
} else {
|
|
370
|
-
editorExperiment('add-media-from-url', false, {
|
|
371
|
-
exposure: true
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}, [mediaNode]);
|
|
376
359
|
var _ref6 = mediaNode.attrs,
|
|
377
360
|
layout = _ref6.layout,
|
|
378
361
|
widthType = _ref6.widthType,
|
|
@@ -447,8 +430,7 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
|
|
|
447
430
|
}, [mediaSingleWidthAttribute, widthType, width, layout, contentWidthForLegacyExperience, containerWidth]);
|
|
448
431
|
var currentMaxWidth = isSelected ? pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.media) === null || _pluginInjectionApi$m === void 0 || (_pluginInjectionApi$m = _pluginInjectionApi$m.sharedState.currentState()) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.currentMaxWidth : undefined;
|
|
449
432
|
var contentWidth = currentMaxWidth || lineLength;
|
|
450
|
-
var isCurrentNodeDrafting = Boolean((annotationPluginState === null || annotationPluginState === void 0 ? void 0 : annotationPluginState.isDrafting) && (annotationPluginState === null || annotationPluginState === void 0 ? void 0 : annotationPluginState.targetNodeId) === (mediaNode === null || mediaNode === void 0 || (_mediaNode$
|
|
451
|
-
var shouldShowExternalMediaBadge = childMediaNodeAttrs.type === 'external';
|
|
433
|
+
var isCurrentNodeDrafting = Boolean((annotationPluginState === null || annotationPluginState === void 0 ? void 0 : annotationPluginState.isDrafting) && (annotationPluginState === null || annotationPluginState === void 0 ? void 0 : annotationPluginState.targetNodeId) === (mediaNode === null || mediaNode === void 0 || (_mediaNode$firstChild = mediaNode.firstChild) === null || _mediaNode$firstChild === void 0 ? void 0 : _mediaNode$firstChild.attrs.id));
|
|
452
434
|
var mediaSingleWrapperRef = /*#__PURE__*/React.createRef();
|
|
453
435
|
var captionPlaceHolderRef = /*#__PURE__*/React.createRef();
|
|
454
436
|
var onMediaSingleClicked = React.useCallback(function (event) {
|
|
@@ -485,29 +467,24 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
|
|
|
485
467
|
,
|
|
486
468
|
className: MediaSingleNodeSelector,
|
|
487
469
|
onClick: onMediaSingleClicked
|
|
488
|
-
},
|
|
470
|
+
}, fg('platform_editor_add_media_from_url_rollout') && jsx(MediaBadges, {
|
|
489
471
|
mediaElement: currentMediaElement(),
|
|
490
472
|
mediaHeight: height,
|
|
491
473
|
mediaWidth: width,
|
|
492
474
|
extendedResizeOffset: fg('platform_editor_media_extended_resize_experience') && !isInsideTable
|
|
493
475
|
}, function (_ref7) {
|
|
494
|
-
var
|
|
495
|
-
|
|
496
|
-
return jsx(React.Fragment, null, fg('platform_editor_hide_external_media_badge') ? visible && jsx(ExternalImageBadge, {
|
|
497
|
-
badgeSize: badgeSize,
|
|
476
|
+
var visible = _ref7.visible;
|
|
477
|
+
return jsx(React.Fragment, null, visible && jsx(ExternalImageBadge, {
|
|
498
478
|
type: childMediaNodeAttrs.type,
|
|
499
479
|
url: childMediaNodeAttrs.type === 'external' ? childMediaNodeAttrs.url : undefined
|
|
500
|
-
}) : shouldShowExternalMediaBadge && visible && jsx(ExternalImageBadge, {
|
|
501
|
-
badgeSize: badgeSize
|
|
502
480
|
}), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeNextWrapper, {
|
|
503
481
|
view: view,
|
|
504
482
|
api: pluginInjectionApi,
|
|
505
483
|
mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
|
|
506
484
|
getPos: getPos,
|
|
507
|
-
isDrafting: isCurrentNodeDrafting
|
|
508
|
-
badgeSize: badgeSize
|
|
485
|
+
isDrafting: isCurrentNodeDrafting
|
|
509
486
|
}));
|
|
510
|
-
}), !
|
|
487
|
+
}), !fg('platform_editor_add_media_from_url_rollout') && mediaOptions.allowCommentsOnMedia && jsx(CommentBadge, {
|
|
511
488
|
view: view,
|
|
512
489
|
api: pluginInjectionApi,
|
|
513
490
|
mediaNode: mediaNode === null || mediaNode === void 0 ? void 0 : mediaNode.firstChild,
|
|
@@ -24,7 +24,6 @@ import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
|
24
24
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
25
25
|
import { isFileIdentifier } from '@atlaskit/media-client';
|
|
26
26
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
27
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
28
27
|
import { updateMediaNodeAttrs } from '../pm-plugins/commands/helpers';
|
|
29
28
|
// Ignored via go/ees005
|
|
30
29
|
// eslint-disable-next-line import/no-namespace
|
|
@@ -209,9 +208,6 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
209
208
|
});
|
|
210
209
|
_defineProperty(this, "showMediaPicker", function () {
|
|
211
210
|
if (_this.openMediaPickerBrowser) {
|
|
212
|
-
editorExperiment('add-media-from-url', false, {
|
|
213
|
-
exposure: true
|
|
214
|
-
});
|
|
215
211
|
return _this.openMediaPickerBrowser();
|
|
216
212
|
}
|
|
217
213
|
_this.onPopupToggleCallback(true);
|