@atlaskit/editor-plugin-media-insert 23.3.2 → 24.0.1
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 +14 -0
- package/dist/cjs/ui/LocalMedia.js +4 -1
- package/dist/cjs/ui/MediaFromURL.js +18 -18
- package/dist/cjs/ui/MediaInsertPicker.js +3 -1
- package/dist/es2019/ui/LocalMedia.js +4 -1
- package/dist/es2019/ui/MediaInsertPicker.js +3 -1
- package/dist/esm/ui/LocalMedia.js +4 -1
- package/dist/esm/ui/MediaFromURL.js +17 -17
- package/dist/esm/ui/MediaInsertPicker.js +3 -1
- package/package.json +14 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media-insert
|
|
2
2
|
|
|
3
|
+
## 24.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`883d14f6d3052`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/883d14f6d3052) -
|
|
8
|
+
[EDITOR-7439] [M0] Update `upload` tab copy
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 24.0.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 23.3.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -18,6 +18,7 @@ var _upload = _interopRequireDefault(require("@atlaskit/icon/core/upload"));
|
|
|
18
18
|
var _mediaPicker = require("@atlaskit/media-picker");
|
|
19
19
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
20
|
var _sectionMessage = _interopRequireDefault(require("@atlaskit/section-message"));
|
|
21
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
21
22
|
var _useAnalyticsEvents2 = require("./useAnalyticsEvents");
|
|
22
23
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
23
24
|
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; }
|
|
@@ -58,6 +59,7 @@ var LocalMedia = exports.LocalMedia = /*#__PURE__*/_react.default.forwardRef(fun
|
|
|
58
59
|
var intl = (0, _reactIntl.useIntl)();
|
|
59
60
|
var strings = {
|
|
60
61
|
upload: intl.formatMessage(_messages.mediaInsertMessages.upload),
|
|
62
|
+
chooseFile: intl.formatMessage(_messages.mediaInsertMessages.chooseFile),
|
|
61
63
|
networkError: intl.formatMessage(_messages.mediaInsertMessages.localFileNetworkErrorMessage),
|
|
62
64
|
genericError: intl.formatMessage(_messages.mediaInsertMessages.localFileErrorMessage)
|
|
63
65
|
};
|
|
@@ -154,6 +156,7 @@ var LocalMedia = exports.LocalMedia = /*#__PURE__*/_react.default.forwardRef(fun
|
|
|
154
156
|
});
|
|
155
157
|
(_eventSubscribers$cur6 = eventSubscribers.current) === null || _eventSubscribers$cur6 === void 0 || delete _eventSubscribers$cur6[fileId];
|
|
156
158
|
}, [erroredFileIds, onUploadFailureAnalytics]);
|
|
159
|
+
var buttonText = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc_page_experiences_editor_image_generation', 'isEnabled', true) ? strings.chooseFile : strings.upload;
|
|
157
160
|
return /*#__PURE__*/_react.default.createElement(_compiled.Stack, {
|
|
158
161
|
grow: "fill",
|
|
159
162
|
space: "space.200"
|
|
@@ -179,7 +182,7 @@ var LocalMedia = exports.LocalMedia = /*#__PURE__*/_react.default.forwardRef(fun
|
|
|
179
182
|
type: 'open'
|
|
180
183
|
});
|
|
181
184
|
}
|
|
182
|
-
},
|
|
185
|
+
}, buttonText), uploadMediaClientConfig && uploadParams && /*#__PURE__*/_react.default.createElement(_mediaPicker.Browser, {
|
|
183
186
|
isOpen: uploadState.isOpen
|
|
184
187
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
185
188
|
,
|
|
@@ -30,7 +30,7 @@ var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
|
30
30
|
var _MediaCard = require("./MediaCard");
|
|
31
31
|
var _useAnalyticsEvents2 = require("./useAnalyticsEvents");
|
|
32
32
|
var _excluded = ["value", "onChange"];
|
|
33
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
33
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
34
34
|
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; }
|
|
35
35
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
36
36
|
var PreviewBoxStyles = (0, _primitives.xcss)({
|
|
@@ -132,8 +132,8 @@ function MediaFromURL(_ref) {
|
|
|
132
132
|
onUploadFailureAnalytics = _useAnalyticsEvents.onUploadFailureAnalytics;
|
|
133
133
|
var uploadExternalMedia = _react.default.useCallback( /*#__PURE__*/function () {
|
|
134
134
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url) {
|
|
135
|
-
var uploadMediaClientConfig, uploadParams, mediaClient, collection, _yield$mediaClient$fi, uploadableFileUpfrontIds, dimensions, mimeType, message;
|
|
136
|
-
return _regenerator.default.wrap(function
|
|
135
|
+
var uploadMediaClientConfig, uploadParams, mediaClient, collection, _yield$mediaClient$fi, uploadableFileUpfrontIds, dimensions, mimeType, message, _t;
|
|
136
|
+
return _regenerator.default.wrap(function (_context) {
|
|
137
137
|
while (1) switch (_context.prev = _context.next) {
|
|
138
138
|
case 0:
|
|
139
139
|
onUploadButtonClickedAnalytics();
|
|
@@ -142,18 +142,18 @@ function MediaFromURL(_ref) {
|
|
|
142
142
|
});
|
|
143
143
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig, uploadParams = mediaProvider.uploadParams;
|
|
144
144
|
if (uploadMediaClientConfig) {
|
|
145
|
-
_context.next =
|
|
145
|
+
_context.next = 1;
|
|
146
146
|
break;
|
|
147
147
|
}
|
|
148
148
|
return _context.abrupt("return");
|
|
149
|
-
case
|
|
149
|
+
case 1:
|
|
150
150
|
mediaClient = (0, _mediaClientReact.getMediaClient)(uploadMediaClientConfig);
|
|
151
151
|
collection = uploadParams === null || uploadParams === void 0 ? void 0 : uploadParams.collection;
|
|
152
152
|
onUploadCommencedAnalytics('url');
|
|
153
|
-
_context.prev =
|
|
154
|
-
_context.next =
|
|
153
|
+
_context.prev = 2;
|
|
154
|
+
_context.next = 3;
|
|
155
155
|
return mediaClient.file.uploadExternal(url, collection);
|
|
156
|
-
case
|
|
156
|
+
case 3:
|
|
157
157
|
_yield$mediaClient$fi = _context.sent;
|
|
158
158
|
uploadableFileUpfrontIds = _yield$mediaClient$fi.uploadableFileUpfrontIds;
|
|
159
159
|
dimensions = _yield$mediaClient$fi.dimensions;
|
|
@@ -170,23 +170,23 @@ function MediaFromURL(_ref) {
|
|
|
170
170
|
}
|
|
171
171
|
// eslint-disable-next-line no-unused-vars
|
|
172
172
|
});
|
|
173
|
-
_context.next =
|
|
173
|
+
_context.next = 5;
|
|
174
174
|
break;
|
|
175
|
-
case
|
|
176
|
-
_context.prev =
|
|
177
|
-
|
|
175
|
+
case 4:
|
|
176
|
+
_context.prev = 4;
|
|
177
|
+
_t = _context["catch"](2);
|
|
178
178
|
// eslint-disable-line no-unused-vars
|
|
179
|
-
if (typeof
|
|
179
|
+
if (typeof _t === 'string' && _t === 'Could not download remote file') {
|
|
180
180
|
// TODO: ED-26962 - Make sure this gets good unit test coverage with the actual media plugin.
|
|
181
181
|
// This hard coded error message could be changed at any
|
|
182
182
|
// point and we need a unit test to break to stop people changing it.
|
|
183
|
-
onUploadFailureAnalytics(
|
|
183
|
+
onUploadFailureAnalytics(_t, 'url');
|
|
184
184
|
dispatch({
|
|
185
185
|
type: 'warning',
|
|
186
|
-
warning:
|
|
186
|
+
warning: _t,
|
|
187
187
|
url: url
|
|
188
188
|
});
|
|
189
|
-
} else if (
|
|
189
|
+
} else if (_t instanceof Error) {
|
|
190
190
|
message = 'Image preview fetch failed';
|
|
191
191
|
onUploadFailureAnalytics(message, 'url');
|
|
192
192
|
dispatch({
|
|
@@ -200,11 +200,11 @@ function MediaFromURL(_ref) {
|
|
|
200
200
|
error: 'Unknown error'
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
|
-
case
|
|
203
|
+
case 5:
|
|
204
204
|
case "end":
|
|
205
205
|
return _context.stop();
|
|
206
206
|
}
|
|
207
|
-
}, _callee, null, [[
|
|
207
|
+
}, _callee, null, [[2, 4]]);
|
|
208
208
|
}));
|
|
209
209
|
return function (_x) {
|
|
210
210
|
return _ref2.apply(this, arguments);
|
|
@@ -17,6 +17,7 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
17
17
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
18
18
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
19
19
|
var _tabs = _interopRequireWildcard(require("@atlaskit/tabs"));
|
|
20
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
20
21
|
var _useFocusEditor = require("./hooks/use-focus-editor");
|
|
21
22
|
var _useUnholyAutofocus2 = require("./hooks/use-unholy-autofocus");
|
|
22
23
|
var _LocalMedia = require("./LocalMedia");
|
|
@@ -117,6 +118,7 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
117
118
|
focusEditor();
|
|
118
119
|
};
|
|
119
120
|
};
|
|
121
|
+
var fileTabTitle = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc_page_experiences_editor_image_generation', 'isEnabled', true) ? intl.formatMessage(_messages.mediaInsertMessages.uploadTabTitle) : intl.formatMessage(_messages.mediaInsertMessages.fileTabTitle);
|
|
120
122
|
return /*#__PURE__*/_react.default.createElement(PopupWithListeners, {
|
|
121
123
|
ariaLabel: intl.formatMessage(_messages.mediaInsertMessages.mediaPickerPopupAriaLabel)
|
|
122
124
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
@@ -145,7 +147,7 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
145
147
|
return /*#__PURE__*/_react.default.createElement(_tabs.Tab, {
|
|
146
148
|
key: tab.key
|
|
147
149
|
}, tab.label);
|
|
148
|
-
}), !isOnlyExternalLinks && /*#__PURE__*/_react.default.createElement(_tabs.Tab, null,
|
|
150
|
+
}), !isOnlyExternalLinks && /*#__PURE__*/_react.default.createElement(_tabs.Tab, null, fileTabTitle), /*#__PURE__*/_react.default.createElement(_tabs.Tab, null, intl.formatMessage(_messages.mediaInsertMessages.linkTabTitle)))), registeredTabs.map(function (_ref3) {
|
|
149
151
|
var key = _ref3.key,
|
|
150
152
|
TabComponent = _ref3.component;
|
|
151
153
|
return /*#__PURE__*/_react.default.createElement(CustomTabPanel, {
|
|
@@ -7,6 +7,7 @@ import UploadIcon from '@atlaskit/icon/core/upload';
|
|
|
7
7
|
import { Browser } from '@atlaskit/media-picker';
|
|
8
8
|
import { Stack } from '@atlaskit/primitives/compiled';
|
|
9
9
|
import SectionMessage from '@atlaskit/section-message';
|
|
10
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
10
11
|
import { useAnalyticsEvents } from './useAnalyticsEvents';
|
|
11
12
|
const INITIAL_UPLOAD_STATE = Object.freeze({
|
|
12
13
|
isOpen: false,
|
|
@@ -48,6 +49,7 @@ export const LocalMedia = /*#__PURE__*/React.forwardRef(({
|
|
|
48
49
|
const intl = useIntl();
|
|
49
50
|
const strings = {
|
|
50
51
|
upload: intl.formatMessage(mediaInsertMessages.upload),
|
|
52
|
+
chooseFile: intl.formatMessage(mediaInsertMessages.chooseFile),
|
|
51
53
|
networkError: intl.formatMessage(mediaInsertMessages.localFileNetworkErrorMessage),
|
|
52
54
|
genericError: intl.formatMessage(mediaInsertMessages.localFileErrorMessage)
|
|
53
55
|
};
|
|
@@ -144,6 +146,7 @@ export const LocalMedia = /*#__PURE__*/React.forwardRef(({
|
|
|
144
146
|
}));
|
|
145
147
|
(_eventSubscribers$cur8 = eventSubscribers.current) === null || _eventSubscribers$cur8 === void 0 ? true : delete _eventSubscribers$cur8[fileId];
|
|
146
148
|
}, [erroredFileIds, onUploadFailureAnalytics]);
|
|
149
|
+
const buttonText = expValEqualsNoExposure('cc_page_experiences_editor_image_generation', 'isEnabled', true) ? strings.chooseFile : strings.upload;
|
|
147
150
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
148
151
|
grow: "fill",
|
|
149
152
|
space: "space.200"
|
|
@@ -167,7 +170,7 @@ export const LocalMedia = /*#__PURE__*/React.forwardRef(({
|
|
|
167
170
|
type: 'open'
|
|
168
171
|
});
|
|
169
172
|
}
|
|
170
|
-
},
|
|
173
|
+
}, buttonText), uploadMediaClientConfig && uploadParams && /*#__PURE__*/React.createElement(Browser, {
|
|
171
174
|
isOpen: uploadState.isOpen
|
|
172
175
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
173
176
|
,
|
|
@@ -9,6 +9,7 @@ import { PlainOutsideClickTargetRefContext, Popup, withOuterListeners } from '@a
|
|
|
9
9
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
11
11
|
import Tabs, { Tab, TabList, useTabPanel } from '@atlaskit/tabs';
|
|
12
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
12
13
|
import { useFocusEditor } from './hooks/use-focus-editor';
|
|
13
14
|
import { useUnholyAutofocus } from './hooks/use-unholy-autofocus';
|
|
14
15
|
import { LocalMedia } from './LocalMedia';
|
|
@@ -108,6 +109,7 @@ export const MediaInsertPicker = ({
|
|
|
108
109
|
closeMediaInsertPicker();
|
|
109
110
|
focusEditor();
|
|
110
111
|
};
|
|
112
|
+
const fileTabTitle = expValEqualsNoExposure('cc_page_experiences_editor_image_generation', 'isEnabled', true) ? intl.formatMessage(mediaInsertMessages.uploadTabTitle) : intl.formatMessage(mediaInsertMessages.fileTabTitle);
|
|
111
113
|
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
112
114
|
ariaLabel: intl.formatMessage(mediaInsertMessages.mediaPickerPopupAriaLabel)
|
|
113
115
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
@@ -133,7 +135,7 @@ export const MediaInsertPicker = ({
|
|
|
133
135
|
paddingBlockEnd: "space.150"
|
|
134
136
|
}, /*#__PURE__*/React.createElement(TabList, null, registeredTabs.map(tab => /*#__PURE__*/React.createElement(Tab, {
|
|
135
137
|
key: tab.key
|
|
136
|
-
}, tab.label)), !isOnlyExternalLinks && /*#__PURE__*/React.createElement(Tab, null,
|
|
138
|
+
}, tab.label)), !isOnlyExternalLinks && /*#__PURE__*/React.createElement(Tab, null, fileTabTitle), /*#__PURE__*/React.createElement(Tab, null, intl.formatMessage(mediaInsertMessages.linkTabTitle)))), registeredTabs.map(({
|
|
137
139
|
key,
|
|
138
140
|
component: TabComponent
|
|
139
141
|
}) => /*#__PURE__*/React.createElement(CustomTabPanel, {
|
|
@@ -12,6 +12,7 @@ import UploadIcon from '@atlaskit/icon/core/upload';
|
|
|
12
12
|
import { Browser } from '@atlaskit/media-picker';
|
|
13
13
|
import { Stack } from '@atlaskit/primitives/compiled';
|
|
14
14
|
import SectionMessage from '@atlaskit/section-message';
|
|
15
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
15
16
|
import { useAnalyticsEvents } from './useAnalyticsEvents';
|
|
16
17
|
var INITIAL_UPLOAD_STATE = Object.freeze({
|
|
17
18
|
isOpen: false,
|
|
@@ -49,6 +50,7 @@ export var LocalMedia = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
49
50
|
var intl = useIntl();
|
|
50
51
|
var strings = {
|
|
51
52
|
upload: intl.formatMessage(mediaInsertMessages.upload),
|
|
53
|
+
chooseFile: intl.formatMessage(mediaInsertMessages.chooseFile),
|
|
52
54
|
networkError: intl.formatMessage(mediaInsertMessages.localFileNetworkErrorMessage),
|
|
53
55
|
genericError: intl.formatMessage(mediaInsertMessages.localFileErrorMessage)
|
|
54
56
|
};
|
|
@@ -145,6 +147,7 @@ export var LocalMedia = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
145
147
|
});
|
|
146
148
|
(_eventSubscribers$cur6 = eventSubscribers.current) === null || _eventSubscribers$cur6 === void 0 || delete _eventSubscribers$cur6[fileId];
|
|
147
149
|
}, [erroredFileIds, onUploadFailureAnalytics]);
|
|
150
|
+
var buttonText = expValEqualsNoExposure('cc_page_experiences_editor_image_generation', 'isEnabled', true) ? strings.chooseFile : strings.upload;
|
|
148
151
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
149
152
|
grow: "fill",
|
|
150
153
|
space: "space.200"
|
|
@@ -170,7 +173,7 @@ export var LocalMedia = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
170
173
|
type: 'open'
|
|
171
174
|
});
|
|
172
175
|
}
|
|
173
|
-
},
|
|
176
|
+
}, buttonText), uploadMediaClientConfig && uploadParams && /*#__PURE__*/React.createElement(Browser, {
|
|
174
177
|
isOpen: uploadState.isOpen
|
|
175
178
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
176
179
|
,
|
|
@@ -123,8 +123,8 @@ export function MediaFromURL(_ref) {
|
|
|
123
123
|
onUploadFailureAnalytics = _useAnalyticsEvents.onUploadFailureAnalytics;
|
|
124
124
|
var uploadExternalMedia = React.useCallback( /*#__PURE__*/function () {
|
|
125
125
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(url) {
|
|
126
|
-
var uploadMediaClientConfig, uploadParams, mediaClient, collection, _yield$mediaClient$fi, uploadableFileUpfrontIds, dimensions, mimeType, message;
|
|
127
|
-
return _regeneratorRuntime.wrap(function
|
|
126
|
+
var uploadMediaClientConfig, uploadParams, mediaClient, collection, _yield$mediaClient$fi, uploadableFileUpfrontIds, dimensions, mimeType, message, _t;
|
|
127
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
128
128
|
while (1) switch (_context.prev = _context.next) {
|
|
129
129
|
case 0:
|
|
130
130
|
onUploadButtonClickedAnalytics();
|
|
@@ -133,18 +133,18 @@ export function MediaFromURL(_ref) {
|
|
|
133
133
|
});
|
|
134
134
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig, uploadParams = mediaProvider.uploadParams;
|
|
135
135
|
if (uploadMediaClientConfig) {
|
|
136
|
-
_context.next =
|
|
136
|
+
_context.next = 1;
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
139
|
return _context.abrupt("return");
|
|
140
|
-
case
|
|
140
|
+
case 1:
|
|
141
141
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
142
142
|
collection = uploadParams === null || uploadParams === void 0 ? void 0 : uploadParams.collection;
|
|
143
143
|
onUploadCommencedAnalytics('url');
|
|
144
|
-
_context.prev =
|
|
145
|
-
_context.next =
|
|
144
|
+
_context.prev = 2;
|
|
145
|
+
_context.next = 3;
|
|
146
146
|
return mediaClient.file.uploadExternal(url, collection);
|
|
147
|
-
case
|
|
147
|
+
case 3:
|
|
148
148
|
_yield$mediaClient$fi = _context.sent;
|
|
149
149
|
uploadableFileUpfrontIds = _yield$mediaClient$fi.uploadableFileUpfrontIds;
|
|
150
150
|
dimensions = _yield$mediaClient$fi.dimensions;
|
|
@@ -161,23 +161,23 @@ export function MediaFromURL(_ref) {
|
|
|
161
161
|
}
|
|
162
162
|
// eslint-disable-next-line no-unused-vars
|
|
163
163
|
});
|
|
164
|
-
_context.next =
|
|
164
|
+
_context.next = 5;
|
|
165
165
|
break;
|
|
166
|
-
case
|
|
167
|
-
_context.prev =
|
|
168
|
-
|
|
166
|
+
case 4:
|
|
167
|
+
_context.prev = 4;
|
|
168
|
+
_t = _context["catch"](2);
|
|
169
169
|
// eslint-disable-line no-unused-vars
|
|
170
|
-
if (typeof
|
|
170
|
+
if (typeof _t === 'string' && _t === 'Could not download remote file') {
|
|
171
171
|
// TODO: ED-26962 - Make sure this gets good unit test coverage with the actual media plugin.
|
|
172
172
|
// This hard coded error message could be changed at any
|
|
173
173
|
// point and we need a unit test to break to stop people changing it.
|
|
174
|
-
onUploadFailureAnalytics(
|
|
174
|
+
onUploadFailureAnalytics(_t, 'url');
|
|
175
175
|
dispatch({
|
|
176
176
|
type: 'warning',
|
|
177
|
-
warning:
|
|
177
|
+
warning: _t,
|
|
178
178
|
url: url
|
|
179
179
|
});
|
|
180
|
-
} else if (
|
|
180
|
+
} else if (_t instanceof Error) {
|
|
181
181
|
message = 'Image preview fetch failed';
|
|
182
182
|
onUploadFailureAnalytics(message, 'url');
|
|
183
183
|
dispatch({
|
|
@@ -191,11 +191,11 @@ export function MediaFromURL(_ref) {
|
|
|
191
191
|
error: 'Unknown error'
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
|
-
case
|
|
194
|
+
case 5:
|
|
195
195
|
case "end":
|
|
196
196
|
return _context.stop();
|
|
197
197
|
}
|
|
198
|
-
}, _callee, null, [[
|
|
198
|
+
}, _callee, null, [[2, 4]]);
|
|
199
199
|
}));
|
|
200
200
|
return function (_x) {
|
|
201
201
|
return _ref2.apply(this, arguments);
|
|
@@ -9,6 +9,7 @@ import { PlainOutsideClickTargetRefContext, Popup, withOuterListeners } from '@a
|
|
|
9
9
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
11
11
|
import Tabs, { Tab, TabList, useTabPanel } from '@atlaskit/tabs';
|
|
12
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
12
13
|
import { useFocusEditor } from './hooks/use-focus-editor';
|
|
13
14
|
import { useUnholyAutofocus } from './hooks/use-unholy-autofocus';
|
|
14
15
|
import { LocalMedia } from './LocalMedia';
|
|
@@ -108,6 +109,7 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref2) {
|
|
|
108
109
|
focusEditor();
|
|
109
110
|
};
|
|
110
111
|
};
|
|
112
|
+
var fileTabTitle = expValEqualsNoExposure('cc_page_experiences_editor_image_generation', 'isEnabled', true) ? intl.formatMessage(mediaInsertMessages.uploadTabTitle) : intl.formatMessage(mediaInsertMessages.fileTabTitle);
|
|
111
113
|
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
112
114
|
ariaLabel: intl.formatMessage(mediaInsertMessages.mediaPickerPopupAriaLabel)
|
|
113
115
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
@@ -136,7 +138,7 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref2) {
|
|
|
136
138
|
return /*#__PURE__*/React.createElement(Tab, {
|
|
137
139
|
key: tab.key
|
|
138
140
|
}, tab.label);
|
|
139
|
-
}), !isOnlyExternalLinks && /*#__PURE__*/React.createElement(Tab, null,
|
|
141
|
+
}), !isOnlyExternalLinks && /*#__PURE__*/React.createElement(Tab, null, fileTabTitle), /*#__PURE__*/React.createElement(Tab, null, intl.formatMessage(mediaInsertMessages.linkTabTitle)))), registeredTabs.map(function (_ref3) {
|
|
140
142
|
var key = _ref3.key,
|
|
141
143
|
TabComponent = _ref3.component;
|
|
142
144
|
return /*#__PURE__*/React.createElement(CustomTabPanel, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media-insert",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.0.1",
|
|
4
4
|
"description": "Media Insert plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,28 +21,29 @@
|
|
|
21
21
|
],
|
|
22
22
|
"atlaskit:src": "src/index.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@atlaskit/adf-schema": "^52.
|
|
24
|
+
"@atlaskit/adf-schema": "^52.16.0",
|
|
25
25
|
"@atlaskit/button": "^23.11.0",
|
|
26
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
27
|
-
"@atlaskit/editor-plugin-media": "^
|
|
26
|
+
"@atlaskit/editor-plugin-analytics": "^11.0.0",
|
|
27
|
+
"@atlaskit/editor-plugin-media": "^13.0.0",
|
|
28
28
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
29
29
|
"@atlaskit/editor-shared-styles": "^3.11.0",
|
|
30
30
|
"@atlaskit/form": "^15.5.0",
|
|
31
|
-
"@atlaskit/icon": "^35.
|
|
32
|
-
"@atlaskit/media-card": "^80.
|
|
31
|
+
"@atlaskit/icon": "^35.4.0",
|
|
32
|
+
"@atlaskit/media-card": "^80.7.0",
|
|
33
33
|
"@atlaskit/media-client": "^36.3.0",
|
|
34
|
-
"@atlaskit/media-client-react": "^5.
|
|
35
|
-
"@atlaskit/media-picker": "^71.
|
|
34
|
+
"@atlaskit/media-client-react": "^5.2.0",
|
|
35
|
+
"@atlaskit/media-picker": "^71.4.0",
|
|
36
36
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
37
37
|
"@atlaskit/primitives": "^19.0.0",
|
|
38
|
-
"@atlaskit/section-message": "^8.
|
|
38
|
+
"@atlaskit/section-message": "^8.13.0",
|
|
39
39
|
"@atlaskit/tabs": "^19.1.0",
|
|
40
40
|
"@atlaskit/textfield": "^8.3.0",
|
|
41
|
+
"@atlaskit/tmp-editor-statsig": "^88.4.0",
|
|
41
42
|
"@babel/runtime": "^7.0.0"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
|
-
"@atlaskit/editor-common": "^
|
|
45
|
-
"@atlaskit/tokens": "^13.
|
|
45
|
+
"@atlaskit/editor-common": "^115.0.0",
|
|
46
|
+
"@atlaskit/tokens": "^13.1.0",
|
|
46
47
|
"react": "^18.2.0",
|
|
47
48
|
"react-dom": "^18.2.0",
|
|
48
49
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -94,6 +95,8 @@
|
|
|
94
95
|
}
|
|
95
96
|
},
|
|
96
97
|
"devDependencies": {
|
|
98
|
+
"react": "^18.2.0",
|
|
99
|
+
"react-dom": "^18.2.0",
|
|
97
100
|
"react-intl": "^6.6.2"
|
|
98
101
|
}
|
|
99
102
|
}
|