@atlaskit/editor-core 187.44.1 → 187.44.3
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/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +17 -24
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +17 -24
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +5 -16
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +5 -16
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +17 -24
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +17 -24
- package/dist/esm/version-wrapper.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.44.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`bb3d72ef732`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bb3d72ef732) - ED-20041 added check for external media
|
|
8
|
+
|
|
9
|
+
## 187.44.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`66fc865caaf`](https://bitbucket.org/atlassian/atlassian-frontend/commits/66fc865caaf) - Added handling for case when mediaSingle childNode is null
|
|
14
|
+
- [`f98f51cda72`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f98f51cda72) - Fixed typo in comment
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 187.44.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -226,7 +226,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
226
226
|
tr.setSelection(_state.NodeSelection.create(tr.doc, pos));
|
|
227
227
|
return dispatch(tr);
|
|
228
228
|
});
|
|
229
|
-
//
|
|
229
|
+
// Workaround for iOS 16 Caption selection issue
|
|
230
230
|
// @see https://product-fabric.atlassian.net/browse/MEX-2012
|
|
231
231
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMediaSingleClicked", function (event) {
|
|
232
232
|
var _this$captionPlaceHol;
|
|
@@ -320,7 +320,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
320
320
|
widthType = _ref4.widthType,
|
|
321
321
|
mediaSingleWidthAttribute = _ref4.width;
|
|
322
322
|
var childNode = node.firstChild;
|
|
323
|
-
var attrs = childNode.attrs;
|
|
323
|
+
var attrs = (childNode === null || childNode === void 0 ? void 0 : childNode.attrs) || {};
|
|
324
324
|
|
|
325
325
|
// original width and height of child media node (scaled)
|
|
326
326
|
var width = attrs.width,
|
|
@@ -18,7 +18,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
18
18
|
var _react = _interopRequireDefault(require("react"));
|
|
19
19
|
var _react2 = require("@emotion/react");
|
|
20
20
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
21
|
-
var _mediaClient = require("@atlaskit/media-client");
|
|
22
21
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
23
22
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
24
23
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
@@ -33,6 +32,7 @@ var _analytics = require("../../utils/analytics");
|
|
|
33
32
|
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
34
33
|
var _main = require("../../pm-plugins/main");
|
|
35
34
|
var _ResizableMediaMigrationNotification = require("./ResizableMediaMigrationNotification");
|
|
35
|
+
var _checkMediaType = require("../../utils/check-media-type");
|
|
36
36
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
37
37
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
|
|
38
38
|
var resizerNextTestId = 'mediaSingle.resizerNext.testid';
|
|
@@ -425,7 +425,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
425
425
|
key: "checkVideoFile",
|
|
426
426
|
value: function () {
|
|
427
427
|
var _checkVideoFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(viewMediaClientConfig) {
|
|
428
|
-
var mediaNode,
|
|
428
|
+
var mediaNode, mediaType, isVideoFile;
|
|
429
429
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
430
430
|
while (1) switch (_context2.prev = _context2.next) {
|
|
431
431
|
case 0:
|
|
@@ -436,38 +436,31 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
436
436
|
return _context2.abrupt("return");
|
|
437
437
|
case 2:
|
|
438
438
|
mediaNode = this.props.view.state.doc.nodeAt(this.pos + 1);
|
|
439
|
-
if (!
|
|
440
|
-
_context2.next =
|
|
439
|
+
if (!mediaNode) {
|
|
440
|
+
_context2.next = 9;
|
|
441
441
|
break;
|
|
442
442
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
_context2.
|
|
447
|
-
_context2.next =
|
|
448
|
-
|
|
449
|
-
collectionName: mediaNode.attrs.collection
|
|
450
|
-
});
|
|
443
|
+
_context2.next = 6;
|
|
444
|
+
return (0, _checkMediaType.checkMediaType)(mediaNode, viewMediaClientConfig);
|
|
445
|
+
case 6:
|
|
446
|
+
_context2.t0 = _context2.sent;
|
|
447
|
+
_context2.next = 10;
|
|
448
|
+
break;
|
|
451
449
|
case 9:
|
|
452
|
-
|
|
453
|
-
|
|
450
|
+
_context2.t0 = undefined;
|
|
451
|
+
case 10:
|
|
452
|
+
mediaType = _context2.t0;
|
|
453
|
+
isVideoFile = mediaType !== 'external' && mediaType !== 'image';
|
|
454
|
+
if (this.state.isVideoFile !== isVideoFile) {
|
|
454
455
|
this.setState({
|
|
455
|
-
isVideoFile:
|
|
456
|
+
isVideoFile: isVideoFile
|
|
456
457
|
});
|
|
457
458
|
}
|
|
458
|
-
_context2.next = 16;
|
|
459
|
-
break;
|
|
460
459
|
case 13:
|
|
461
|
-
_context2.prev = 13;
|
|
462
|
-
_context2.t0 = _context2["catch"](6);
|
|
463
|
-
this.setState({
|
|
464
|
-
isVideoFile: false
|
|
465
|
-
});
|
|
466
|
-
case 16:
|
|
467
460
|
case "end":
|
|
468
461
|
return _context2.stop();
|
|
469
462
|
}
|
|
470
|
-
}, _callee2, this
|
|
463
|
+
}, _callee2, this);
|
|
471
464
|
}));
|
|
472
465
|
function checkVideoFile(_x) {
|
|
473
466
|
return _checkVideoFile.apply(this, arguments);
|
|
@@ -18,12 +18,12 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
18
18
|
var _react = _interopRequireDefault(require("react"));
|
|
19
19
|
var _react2 = require("@emotion/react");
|
|
20
20
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
21
|
-
var _mediaClient = require("@atlaskit/media-client");
|
|
22
21
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
23
22
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
24
23
|
var _styled = require("./styled");
|
|
25
24
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
26
25
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
26
|
+
var _checkMediaType = require("../../utils/check-media-type");
|
|
27
27
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
28
28
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
|
|
29
29
|
var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
@@ -229,7 +229,7 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
229
229
|
key: "checkVideoFile",
|
|
230
230
|
value: function () {
|
|
231
231
|
var _checkVideoFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(viewMediaClientConfig) {
|
|
232
|
-
var $pos, mediaNode,
|
|
232
|
+
var $pos, mediaNode, mediaType, isVideoFile;
|
|
233
233
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
234
234
|
while (1) switch (_context2.prev = _context2.next) {
|
|
235
235
|
case 0:
|
|
@@ -241,38 +241,31 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
241
241
|
return _context2.abrupt("return");
|
|
242
242
|
case 3:
|
|
243
243
|
mediaNode = this.props.view.state.doc.nodeAt($pos.pos + 1);
|
|
244
|
-
if (!
|
|
245
|
-
_context2.next =
|
|
244
|
+
if (!mediaNode) {
|
|
245
|
+
_context2.next = 10;
|
|
246
246
|
break;
|
|
247
247
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
_context2.
|
|
252
|
-
_context2.next =
|
|
253
|
-
|
|
254
|
-
collectionName: mediaNode.attrs.collection
|
|
255
|
-
});
|
|
248
|
+
_context2.next = 7;
|
|
249
|
+
return (0, _checkMediaType.checkMediaType)(mediaNode, viewMediaClientConfig);
|
|
250
|
+
case 7:
|
|
251
|
+
_context2.t0 = _context2.sent;
|
|
252
|
+
_context2.next = 11;
|
|
253
|
+
break;
|
|
256
254
|
case 10:
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
_context2.t0 = undefined;
|
|
256
|
+
case 11:
|
|
257
|
+
mediaType = _context2.t0;
|
|
258
|
+
isVideoFile = mediaType !== 'external' && mediaType !== 'image';
|
|
259
|
+
if (this.state.isVideoFile !== isVideoFile) {
|
|
259
260
|
this.setState({
|
|
260
|
-
isVideoFile:
|
|
261
|
+
isVideoFile: isVideoFile
|
|
261
262
|
});
|
|
262
263
|
}
|
|
263
|
-
_context2.next = 17;
|
|
264
|
-
break;
|
|
265
264
|
case 14:
|
|
266
|
-
_context2.prev = 14;
|
|
267
|
-
_context2.t0 = _context2["catch"](7);
|
|
268
|
-
this.setState({
|
|
269
|
-
isVideoFile: false
|
|
270
|
-
});
|
|
271
|
-
case 17:
|
|
272
265
|
case "end":
|
|
273
266
|
return _context2.stop();
|
|
274
267
|
}
|
|
275
|
-
}, _callee2, this
|
|
268
|
+
}, _callee2, this);
|
|
276
269
|
}));
|
|
277
270
|
function checkVideoFile(_x) {
|
|
278
271
|
return _checkVideoFile.apply(this, arguments);
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.44.
|
|
9
|
+
var version = "187.44.3";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
@@ -151,7 +151,7 @@ export default class MediaSingleNode extends Component {
|
|
|
151
151
|
tr.setSelection(NodeSelection.create(tr.doc, pos));
|
|
152
152
|
return dispatch(tr);
|
|
153
153
|
});
|
|
154
|
-
//
|
|
154
|
+
// Workaround for iOS 16 Caption selection issue
|
|
155
155
|
// @see https://product-fabric.atlassian.net/browse/MEX-2012
|
|
156
156
|
_defineProperty(this, "onMediaSingleClicked", event => {
|
|
157
157
|
var _this$captionPlaceHol;
|
|
@@ -222,7 +222,7 @@ export default class MediaSingleNode extends Component {
|
|
|
222
222
|
width: mediaSingleWidthAttribute
|
|
223
223
|
} = node.attrs;
|
|
224
224
|
const childNode = node.firstChild;
|
|
225
|
-
const attrs = childNode.attrs;
|
|
225
|
+
const attrs = (childNode === null || childNode === void 0 ? void 0 : childNode.attrs) || {};
|
|
226
226
|
|
|
227
227
|
// original width and height of child media node (scaled)
|
|
228
228
|
let {
|
|
@@ -3,7 +3,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
import { getMediaClient } from '@atlaskit/media-client';
|
|
7
6
|
import { calcPctFromPx, wrappedLayouts, handleSides, imageAlignmentMap } from '@atlaskit/editor-common/ui';
|
|
8
7
|
import { nonWrappedLayouts, setNodeSelection } from '@atlaskit/editor-common/utils';
|
|
9
8
|
import { akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
@@ -18,6 +17,7 @@ import { getMediaResizeAnalyticsEvent } from '../../utils/analytics';
|
|
|
18
17
|
import throttle from 'lodash/throttle';
|
|
19
18
|
import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
|
|
20
19
|
import { ResizableMediaMigrationNotification } from './ResizableMediaMigrationNotification';
|
|
20
|
+
import { checkMediaType } from '../../utils/check-media-type';
|
|
21
21
|
export const resizerNextTestId = 'mediaSingle.resizerNext.testid';
|
|
22
22
|
class ResizableMediaSingleNext extends React.Component {
|
|
23
23
|
constructor(props) {
|
|
@@ -374,22 +374,11 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
374
374
|
return;
|
|
375
375
|
}
|
|
376
376
|
const mediaNode = this.props.view.state.doc.nodeAt(this.pos + 1);
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const mediaClient = getMediaClient(viewMediaClientConfig);
|
|
381
|
-
try {
|
|
382
|
-
const state = await mediaClient.file.getCurrentState(mediaNode.attrs.id, {
|
|
383
|
-
collectionName: mediaNode.attrs.collection
|
|
384
|
-
});
|
|
385
|
-
if (state && state.status !== 'error' && state.mediaType === 'image') {
|
|
386
|
-
this.setState({
|
|
387
|
-
isVideoFile: false
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
} catch (err) {
|
|
377
|
+
const mediaType = mediaNode ? await checkMediaType(mediaNode, viewMediaClientConfig) : undefined;
|
|
378
|
+
const isVideoFile = mediaType !== 'external' && mediaType !== 'image';
|
|
379
|
+
if (this.state.isVideoFile !== isVideoFile) {
|
|
391
380
|
this.setState({
|
|
392
|
-
isVideoFile
|
|
381
|
+
isVideoFile
|
|
393
382
|
});
|
|
394
383
|
}
|
|
395
384
|
}
|
|
@@ -4,12 +4,12 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
-
import { getMediaClient } from '@atlaskit/media-client';
|
|
8
7
|
import { calcPctFromPx, calcColumnsFromPx, wrappedLayouts, Resizer, calcMediaPxWidth, snapTo, handleSides, imageAlignmentMap } from '@atlaskit/editor-common/ui';
|
|
9
8
|
import { akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
10
9
|
import { wrapperStyle } from './styled';
|
|
11
10
|
import { calculateOffsetLeft } from '@atlaskit/editor-common/media-single';
|
|
12
11
|
import { calculateSnapPoints } from '@atlaskit/editor-common/utils';
|
|
12
|
+
import { checkMediaType } from '../../utils/check-media-type';
|
|
13
13
|
export default class ResizableMediaSingle extends React.Component {
|
|
14
14
|
constructor(...args) {
|
|
15
15
|
super(...args);
|
|
@@ -193,22 +193,11 @@ export default class ResizableMediaSingle extends React.Component {
|
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
195
|
const mediaNode = this.props.view.state.doc.nodeAt($pos.pos + 1);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
const mediaClient = getMediaClient(viewMediaClientConfig);
|
|
200
|
-
try {
|
|
201
|
-
const state = await mediaClient.file.getCurrentState(mediaNode.attrs.id, {
|
|
202
|
-
collectionName: mediaNode.attrs.collection
|
|
203
|
-
});
|
|
204
|
-
if (state && state.status !== 'error' && state.mediaType === 'image') {
|
|
205
|
-
this.setState({
|
|
206
|
-
isVideoFile: false
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
} catch (err) {
|
|
196
|
+
const mediaType = mediaNode ? await checkMediaType(mediaNode, viewMediaClientConfig) : undefined;
|
|
197
|
+
const isVideoFile = mediaType !== 'external' && mediaType !== 'image';
|
|
198
|
+
if (this.state.isVideoFile !== isVideoFile) {
|
|
210
199
|
this.setState({
|
|
211
|
-
isVideoFile
|
|
200
|
+
isVideoFile
|
|
212
201
|
});
|
|
213
202
|
}
|
|
214
203
|
}
|
|
@@ -217,7 +217,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
217
217
|
tr.setSelection(NodeSelection.create(tr.doc, pos));
|
|
218
218
|
return dispatch(tr);
|
|
219
219
|
});
|
|
220
|
-
//
|
|
220
|
+
// Workaround for iOS 16 Caption selection issue
|
|
221
221
|
// @see https://product-fabric.atlassian.net/browse/MEX-2012
|
|
222
222
|
_defineProperty(_assertThisInitialized(_this), "onMediaSingleClicked", function (event) {
|
|
223
223
|
var _this$captionPlaceHol;
|
|
@@ -311,7 +311,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
311
311
|
widthType = _ref4.widthType,
|
|
312
312
|
mediaSingleWidthAttribute = _ref4.width;
|
|
313
313
|
var childNode = node.firstChild;
|
|
314
|
-
var attrs = childNode.attrs;
|
|
314
|
+
var attrs = (childNode === null || childNode === void 0 ? void 0 : childNode.attrs) || {};
|
|
315
315
|
|
|
316
316
|
// original width and height of child media node (scaled)
|
|
317
317
|
var width = attrs.width,
|
|
@@ -14,7 +14,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
14
14
|
import React from 'react';
|
|
15
15
|
import { jsx } from '@emotion/react';
|
|
16
16
|
import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
17
|
-
import { getMediaClient } from '@atlaskit/media-client';
|
|
18
17
|
import { calcPctFromPx, wrappedLayouts, handleSides, imageAlignmentMap } from '@atlaskit/editor-common/ui';
|
|
19
18
|
import { nonWrappedLayouts, setNodeSelection } from '@atlaskit/editor-common/utils';
|
|
20
19
|
import { akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
@@ -29,6 +28,7 @@ import { getMediaResizeAnalyticsEvent } from '../../utils/analytics';
|
|
|
29
28
|
import throttle from 'lodash/throttle';
|
|
30
29
|
import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
|
|
31
30
|
import { ResizableMediaMigrationNotification } from './ResizableMediaMigrationNotification';
|
|
31
|
+
import { checkMediaType } from '../../utils/check-media-type';
|
|
32
32
|
export var resizerNextTestId = 'mediaSingle.resizerNext.testid';
|
|
33
33
|
var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
34
34
|
_inherits(ResizableMediaSingleNext, _React$Component);
|
|
@@ -418,7 +418,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
418
418
|
key: "checkVideoFile",
|
|
419
419
|
value: function () {
|
|
420
420
|
var _checkVideoFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(viewMediaClientConfig) {
|
|
421
|
-
var mediaNode,
|
|
421
|
+
var mediaNode, mediaType, isVideoFile;
|
|
422
422
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
423
423
|
while (1) switch (_context2.prev = _context2.next) {
|
|
424
424
|
case 0:
|
|
@@ -429,38 +429,31 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
429
429
|
return _context2.abrupt("return");
|
|
430
430
|
case 2:
|
|
431
431
|
mediaNode = this.props.view.state.doc.nodeAt(this.pos + 1);
|
|
432
|
-
if (!
|
|
433
|
-
_context2.next =
|
|
432
|
+
if (!mediaNode) {
|
|
433
|
+
_context2.next = 9;
|
|
434
434
|
break;
|
|
435
435
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
_context2.
|
|
440
|
-
_context2.next =
|
|
441
|
-
|
|
442
|
-
collectionName: mediaNode.attrs.collection
|
|
443
|
-
});
|
|
436
|
+
_context2.next = 6;
|
|
437
|
+
return checkMediaType(mediaNode, viewMediaClientConfig);
|
|
438
|
+
case 6:
|
|
439
|
+
_context2.t0 = _context2.sent;
|
|
440
|
+
_context2.next = 10;
|
|
441
|
+
break;
|
|
444
442
|
case 9:
|
|
445
|
-
|
|
446
|
-
|
|
443
|
+
_context2.t0 = undefined;
|
|
444
|
+
case 10:
|
|
445
|
+
mediaType = _context2.t0;
|
|
446
|
+
isVideoFile = mediaType !== 'external' && mediaType !== 'image';
|
|
447
|
+
if (this.state.isVideoFile !== isVideoFile) {
|
|
447
448
|
this.setState({
|
|
448
|
-
isVideoFile:
|
|
449
|
+
isVideoFile: isVideoFile
|
|
449
450
|
});
|
|
450
451
|
}
|
|
451
|
-
_context2.next = 16;
|
|
452
|
-
break;
|
|
453
452
|
case 13:
|
|
454
|
-
_context2.prev = 13;
|
|
455
|
-
_context2.t0 = _context2["catch"](6);
|
|
456
|
-
this.setState({
|
|
457
|
-
isVideoFile: false
|
|
458
|
-
});
|
|
459
|
-
case 16:
|
|
460
453
|
case "end":
|
|
461
454
|
return _context2.stop();
|
|
462
455
|
}
|
|
463
|
-
}, _callee2, this
|
|
456
|
+
}, _callee2, this);
|
|
464
457
|
}));
|
|
465
458
|
function checkVideoFile(_x) {
|
|
466
459
|
return _checkVideoFile.apply(this, arguments);
|
|
@@ -14,12 +14,12 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
14
14
|
import React from 'react';
|
|
15
15
|
import { jsx } from '@emotion/react';
|
|
16
16
|
import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
17
|
-
import { getMediaClient } from '@atlaskit/media-client';
|
|
18
17
|
import { calcPctFromPx, calcColumnsFromPx, wrappedLayouts, Resizer, calcMediaPxWidth, snapTo, handleSides, imageAlignmentMap } from '@atlaskit/editor-common/ui';
|
|
19
18
|
import { akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
20
19
|
import { wrapperStyle } from './styled';
|
|
21
20
|
import { calculateOffsetLeft } from '@atlaskit/editor-common/media-single';
|
|
22
21
|
import { calculateSnapPoints } from '@atlaskit/editor-common/utils';
|
|
22
|
+
import { checkMediaType } from '../../utils/check-media-type';
|
|
23
23
|
var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
24
24
|
_inherits(ResizableMediaSingle, _React$Component);
|
|
25
25
|
var _super = _createSuper(ResizableMediaSingle);
|
|
@@ -223,7 +223,7 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
223
223
|
key: "checkVideoFile",
|
|
224
224
|
value: function () {
|
|
225
225
|
var _checkVideoFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(viewMediaClientConfig) {
|
|
226
|
-
var $pos, mediaNode,
|
|
226
|
+
var $pos, mediaNode, mediaType, isVideoFile;
|
|
227
227
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
228
228
|
while (1) switch (_context2.prev = _context2.next) {
|
|
229
229
|
case 0:
|
|
@@ -235,38 +235,31 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
235
235
|
return _context2.abrupt("return");
|
|
236
236
|
case 3:
|
|
237
237
|
mediaNode = this.props.view.state.doc.nodeAt($pos.pos + 1);
|
|
238
|
-
if (!
|
|
239
|
-
_context2.next =
|
|
238
|
+
if (!mediaNode) {
|
|
239
|
+
_context2.next = 10;
|
|
240
240
|
break;
|
|
241
241
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
_context2.
|
|
246
|
-
_context2.next =
|
|
247
|
-
|
|
248
|
-
collectionName: mediaNode.attrs.collection
|
|
249
|
-
});
|
|
242
|
+
_context2.next = 7;
|
|
243
|
+
return checkMediaType(mediaNode, viewMediaClientConfig);
|
|
244
|
+
case 7:
|
|
245
|
+
_context2.t0 = _context2.sent;
|
|
246
|
+
_context2.next = 11;
|
|
247
|
+
break;
|
|
250
248
|
case 10:
|
|
251
|
-
|
|
252
|
-
|
|
249
|
+
_context2.t0 = undefined;
|
|
250
|
+
case 11:
|
|
251
|
+
mediaType = _context2.t0;
|
|
252
|
+
isVideoFile = mediaType !== 'external' && mediaType !== 'image';
|
|
253
|
+
if (this.state.isVideoFile !== isVideoFile) {
|
|
253
254
|
this.setState({
|
|
254
|
-
isVideoFile:
|
|
255
|
+
isVideoFile: isVideoFile
|
|
255
256
|
});
|
|
256
257
|
}
|
|
257
|
-
_context2.next = 17;
|
|
258
|
-
break;
|
|
259
258
|
case 14:
|
|
260
|
-
_context2.prev = 14;
|
|
261
|
-
_context2.t0 = _context2["catch"](7);
|
|
262
|
-
this.setState({
|
|
263
|
-
isVideoFile: false
|
|
264
|
-
});
|
|
265
|
-
case 17:
|
|
266
259
|
case "end":
|
|
267
260
|
return _context2.stop();
|
|
268
261
|
}
|
|
269
|
-
}, _callee2, this
|
|
262
|
+
}, _callee2, this);
|
|
270
263
|
}));
|
|
271
264
|
function checkVideoFile(_x) {
|
|
272
265
|
return _checkVideoFile.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.44.
|
|
3
|
+
"version": "187.44.3",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
"@atlaskit/media-filmstrip": "^47.0.0",
|
|
102
102
|
"@atlaskit/media-picker": "^66.2.0",
|
|
103
103
|
"@atlaskit/media-ui": "^25.0.0",
|
|
104
|
-
"@atlaskit/media-viewer": "^48.
|
|
104
|
+
"@atlaskit/media-viewer": "^48.1.0",
|
|
105
105
|
"@atlaskit/mention": "^22.1.0",
|
|
106
106
|
"@atlaskit/menu": "^1.10.0",
|
|
107
|
-
"@atlaskit/modal-dialog": "^12.
|
|
107
|
+
"@atlaskit/modal-dialog": "^12.7.0",
|
|
108
108
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
109
109
|
"@atlaskit/prosemirror-collab": "^0.2.0",
|
|
110
110
|
"@atlaskit/prosemirror-input-rules": "^2.4.0",
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"@af/visual-regression": "*",
|
|
155
155
|
"@atlaskit/code": "^14.6.0",
|
|
156
156
|
"@atlaskit/collab-provider": "9.12.3",
|
|
157
|
-
"@atlaskit/dropdown-menu": "^11.
|
|
157
|
+
"@atlaskit/dropdown-menu": "^11.14.0",
|
|
158
158
|
"@atlaskit/editor-extension-dropbox": "^0.4.0",
|
|
159
159
|
"@atlaskit/editor-plugin-table": "^3.0.0",
|
|
160
160
|
"@atlaskit/flag": "^15.2.0",
|