@atlaskit/editor-plugin-media 14.2.13 → 14.2.15
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/toolbar/utils.js +20 -7
- package/dist/es2019/ui/toolbar/utils.js +7 -1
- package/dist/esm/ui/toolbar/utils.js +20 -7
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 14.2.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`bea4da79c297d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bea4da79c297d) -
|
|
8
|
+
[ux] EDITOR-7679 use fallback media name for filename in download
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 14.2.14
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 14.2.13
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -18,6 +18,7 @@ var _imageInline = _interopRequireDefault(require("@atlaskit/icon/core/image-inl
|
|
|
18
18
|
var _maximize = _interopRequireDefault(require("@atlaskit/icon/core/maximize"));
|
|
19
19
|
var _mediaClientReact = require("@atlaskit/media-client-react");
|
|
20
20
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
21
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
21
22
|
var _mediaSingle2 = require("../../pm-plugins/utils/media-single");
|
|
22
23
|
var _commands = require("./commands");
|
|
23
24
|
var isExternalMedia = exports.isExternalMedia = function isExternalMedia(attrs) {
|
|
@@ -56,14 +57,14 @@ var getIsDownloadDisabledByDataSecurityPolicy = exports.getIsDownloadDisabledByD
|
|
|
56
57
|
};
|
|
57
58
|
var downloadMedia = exports.downloadMedia = /*#__PURE__*/function () {
|
|
58
59
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(mediaPluginState, isViewMode) {
|
|
59
|
-
var selectedNodeAttrs, id, _selectedNodeAttrs$co, collection, mediaClient, fileState, fileName, _t;
|
|
60
|
+
var selectedNodeAttrs, _mediaPluginState$med2, id, _selectedNodeAttrs$co, collection, mediaClient, fileState, fileName, fetched, _t;
|
|
60
61
|
return _regenerator.default.wrap(function (_context) {
|
|
61
62
|
while (1) switch (_context.prev = _context.next) {
|
|
62
63
|
case 0:
|
|
63
64
|
_context.prev = 0;
|
|
64
65
|
selectedNodeAttrs = isViewMode ? getSelectedNearestMediaContainerNodeAttrs(mediaPluginState) : getSelectedMediaContainerNodeAttrs(mediaPluginState);
|
|
65
66
|
if (!(selectedNodeAttrs && mediaPluginState.mediaClientConfig && !isExternalMedia(selectedNodeAttrs))) {
|
|
66
|
-
_context.next =
|
|
67
|
+
_context.next = 4;
|
|
67
68
|
break;
|
|
68
69
|
}
|
|
69
70
|
id = selectedNodeAttrs.id, _selectedNodeAttrs$co = selectedNodeAttrs.collection, collection = _selectedNodeAttrs$co === void 0 ? '' : _selectedNodeAttrs$co;
|
|
@@ -75,18 +76,30 @@ var downloadMedia = exports.downloadMedia = /*#__PURE__*/function () {
|
|
|
75
76
|
case 1:
|
|
76
77
|
fileState = _context.sent;
|
|
77
78
|
fileName = fileState.status === 'error' ? undefined : fileState.name;
|
|
78
|
-
|
|
79
|
+
if (!(!fileName && (0, _expValEquals.expValEquals)('platform_editor_media_download_fallback_name', 'isEnabled', true) && (_mediaPluginState$med2 = mediaPluginState.mediaOptions) !== null && _mediaPluginState$med2 !== void 0 && _mediaPluginState$med2.fallbackMediaNameFetcher)) {
|
|
80
|
+
_context.next = 3;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
_context.next = 2;
|
|
84
|
+
return mediaPluginState.mediaOptions.fallbackMediaNameFetcher(id).catch(function () {
|
|
85
|
+
return undefined;
|
|
86
|
+
});
|
|
79
87
|
case 2:
|
|
80
|
-
|
|
88
|
+
fetched = _context.sent;
|
|
89
|
+
fileName = fetched !== null && fetched !== void 0 ? fetched : undefined;
|
|
81
90
|
case 3:
|
|
82
|
-
|
|
91
|
+
mediaClient.file.downloadBinary(id, fileName, collection);
|
|
92
|
+
case 4:
|
|
93
|
+
return _context.abrupt("return", true);
|
|
94
|
+
case 5:
|
|
95
|
+
_context.prev = 5;
|
|
83
96
|
_t = _context["catch"](0);
|
|
84
97
|
return _context.abrupt("return", false);
|
|
85
|
-
case
|
|
98
|
+
case 6:
|
|
86
99
|
case "end":
|
|
87
100
|
return _context.stop();
|
|
88
101
|
}
|
|
89
|
-
}, _callee, null, [[0,
|
|
102
|
+
}, _callee, null, [[0, 5]]);
|
|
90
103
|
}));
|
|
91
104
|
return function downloadMedia(_x, _x2) {
|
|
92
105
|
return _ref.apply(this, arguments);
|
|
@@ -9,6 +9,7 @@ import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
|
|
|
9
9
|
import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
10
10
|
import { getMediaClient } from '@atlaskit/media-client-react';
|
|
11
11
|
import { messages } from '@atlaskit/media-ui';
|
|
12
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
13
|
import { isVideo } from '../../pm-plugins/utils/media-single';
|
|
13
14
|
import { changeMediaInlineToMediaSingle, changeMediaSingleToMediaInline } from './commands';
|
|
14
15
|
export const isExternalMedia = attrs => {
|
|
@@ -49,6 +50,7 @@ export const downloadMedia = async (mediaPluginState, isViewMode) => {
|
|
|
49
50
|
try {
|
|
50
51
|
const selectedNodeAttrs = isViewMode ? getSelectedNearestMediaContainerNodeAttrs(mediaPluginState) : getSelectedMediaContainerNodeAttrs(mediaPluginState);
|
|
51
52
|
if (selectedNodeAttrs && mediaPluginState.mediaClientConfig && !isExternalMedia(selectedNodeAttrs)) {
|
|
53
|
+
var _mediaPluginState$med2;
|
|
52
54
|
const {
|
|
53
55
|
id,
|
|
54
56
|
collection = ''
|
|
@@ -57,7 +59,11 @@ export const downloadMedia = async (mediaPluginState, isViewMode) => {
|
|
|
57
59
|
const fileState = await mediaClient.file.getCurrentState(id, {
|
|
58
60
|
collectionName: collection
|
|
59
61
|
});
|
|
60
|
-
|
|
62
|
+
let fileName = fileState.status === 'error' ? undefined : fileState.name;
|
|
63
|
+
if (!fileName && expValEquals('platform_editor_media_download_fallback_name', 'isEnabled', true) && (_mediaPluginState$med2 = mediaPluginState.mediaOptions) !== null && _mediaPluginState$med2 !== void 0 && _mediaPluginState$med2.fallbackMediaNameFetcher) {
|
|
64
|
+
const fetched = await mediaPluginState.mediaOptions.fallbackMediaNameFetcher(id).catch(() => undefined);
|
|
65
|
+
fileName = fetched !== null && fetched !== void 0 ? fetched : undefined;
|
|
66
|
+
}
|
|
61
67
|
mediaClient.file.downloadBinary(id, fileName, collection);
|
|
62
68
|
}
|
|
63
69
|
return true;
|
|
@@ -11,6 +11,7 @@ import ImageInlineIcon from '@atlaskit/icon/core/image-inline';
|
|
|
11
11
|
import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
12
12
|
import { getMediaClient } from '@atlaskit/media-client-react';
|
|
13
13
|
import { messages } from '@atlaskit/media-ui';
|
|
14
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
15
|
import { isVideo } from '../../pm-plugins/utils/media-single';
|
|
15
16
|
import { changeMediaInlineToMediaSingle, changeMediaSingleToMediaInline } from './commands';
|
|
16
17
|
export var isExternalMedia = function isExternalMedia(attrs) {
|
|
@@ -49,14 +50,14 @@ export var getIsDownloadDisabledByDataSecurityPolicy = function getIsDownloadDis
|
|
|
49
50
|
};
|
|
50
51
|
export var downloadMedia = /*#__PURE__*/function () {
|
|
51
52
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mediaPluginState, isViewMode) {
|
|
52
|
-
var selectedNodeAttrs, id, _selectedNodeAttrs$co, collection, mediaClient, fileState, fileName, _t;
|
|
53
|
+
var selectedNodeAttrs, _mediaPluginState$med2, id, _selectedNodeAttrs$co, collection, mediaClient, fileState, fileName, fetched, _t;
|
|
53
54
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
54
55
|
while (1) switch (_context.prev = _context.next) {
|
|
55
56
|
case 0:
|
|
56
57
|
_context.prev = 0;
|
|
57
58
|
selectedNodeAttrs = isViewMode ? getSelectedNearestMediaContainerNodeAttrs(mediaPluginState) : getSelectedMediaContainerNodeAttrs(mediaPluginState);
|
|
58
59
|
if (!(selectedNodeAttrs && mediaPluginState.mediaClientConfig && !isExternalMedia(selectedNodeAttrs))) {
|
|
59
|
-
_context.next =
|
|
60
|
+
_context.next = 4;
|
|
60
61
|
break;
|
|
61
62
|
}
|
|
62
63
|
id = selectedNodeAttrs.id, _selectedNodeAttrs$co = selectedNodeAttrs.collection, collection = _selectedNodeAttrs$co === void 0 ? '' : _selectedNodeAttrs$co;
|
|
@@ -68,18 +69,30 @@ export var downloadMedia = /*#__PURE__*/function () {
|
|
|
68
69
|
case 1:
|
|
69
70
|
fileState = _context.sent;
|
|
70
71
|
fileName = fileState.status === 'error' ? undefined : fileState.name;
|
|
71
|
-
|
|
72
|
+
if (!(!fileName && expValEquals('platform_editor_media_download_fallback_name', 'isEnabled', true) && (_mediaPluginState$med2 = mediaPluginState.mediaOptions) !== null && _mediaPluginState$med2 !== void 0 && _mediaPluginState$med2.fallbackMediaNameFetcher)) {
|
|
73
|
+
_context.next = 3;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
_context.next = 2;
|
|
77
|
+
return mediaPluginState.mediaOptions.fallbackMediaNameFetcher(id).catch(function () {
|
|
78
|
+
return undefined;
|
|
79
|
+
});
|
|
72
80
|
case 2:
|
|
73
|
-
|
|
81
|
+
fetched = _context.sent;
|
|
82
|
+
fileName = fetched !== null && fetched !== void 0 ? fetched : undefined;
|
|
74
83
|
case 3:
|
|
75
|
-
|
|
84
|
+
mediaClient.file.downloadBinary(id, fileName, collection);
|
|
85
|
+
case 4:
|
|
86
|
+
return _context.abrupt("return", true);
|
|
87
|
+
case 5:
|
|
88
|
+
_context.prev = 5;
|
|
76
89
|
_t = _context["catch"](0);
|
|
77
90
|
return _context.abrupt("return", false);
|
|
78
|
-
case
|
|
91
|
+
case 6:
|
|
79
92
|
case "end":
|
|
80
93
|
return _context.stop();
|
|
81
94
|
}
|
|
82
|
-
}, _callee, null, [[0,
|
|
95
|
+
}, _callee, null, [[0, 5]]);
|
|
83
96
|
}));
|
|
84
97
|
return function downloadMedia(_x, _x2) {
|
|
85
98
|
return _ref.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "14.2.
|
|
3
|
+
"version": "14.2.15",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
],
|
|
22
22
|
"atlaskit:src": "src/index.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@atlaskit/adf-schema": "^56.
|
|
24
|
+
"@atlaskit/adf-schema": "^56.1.0",
|
|
25
25
|
"@atlaskit/analytics-namespaced-context": "^8.1.0",
|
|
26
|
-
"@atlaskit/analytics-next": "^12.
|
|
26
|
+
"@atlaskit/analytics-next": "^12.2.0",
|
|
27
27
|
"@atlaskit/button": "^24.3.0",
|
|
28
28
|
"@atlaskit/editor-palette": "^3.1.0",
|
|
29
29
|
"@atlaskit/editor-plugin-analytics": "^12.0.0",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^4.0.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^3.0.0",
|
|
46
46
|
"@atlaskit/form": "^16.1.0",
|
|
47
|
-
"@atlaskit/icon": "^36.
|
|
48
|
-
"@atlaskit/icon-lab": "^7.
|
|
49
|
-
"@atlaskit/media-card": "^81.
|
|
50
|
-
"@atlaskit/media-client": "^37.
|
|
47
|
+
"@atlaskit/icon": "^36.2.0",
|
|
48
|
+
"@atlaskit/icon-lab": "^7.3.0",
|
|
49
|
+
"@atlaskit/media-card": "^81.3.0",
|
|
50
|
+
"@atlaskit/media-client": "^37.2.0",
|
|
51
51
|
"@atlaskit/media-client-react": "^6.1.0",
|
|
52
52
|
"@atlaskit/media-common": "^14.2.0",
|
|
53
53
|
"@atlaskit/media-filmstrip": "^52.2.0",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
58
58
|
"@atlaskit/primitives": "^20.3.0",
|
|
59
59
|
"@atlaskit/textfield": "^9.1.0",
|
|
60
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
61
|
-
"@atlaskit/tokens": "^15.
|
|
60
|
+
"@atlaskit/tmp-editor-statsig": "^121.1.0",
|
|
61
|
+
"@atlaskit/tokens": "^15.4.0",
|
|
62
62
|
"@atlaskit/tooltip": "^23.1.0",
|
|
63
63
|
"@babel/runtime": "^7.0.0",
|
|
64
64
|
"@emotion/react": "^11.7.1",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"uuid": "^3.1.0"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@atlaskit/editor-common": "^116.
|
|
72
|
+
"@atlaskit/editor-common": "^116.22.0",
|
|
73
73
|
"@atlaskit/media-core": "^38.0.0",
|
|
74
74
|
"react": "^18.2.0",
|
|
75
75
|
"react-dom": "^18.2.0",
|