@atlaskit/editor-core 178.0.2 → 178.1.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 +40 -0
- package/dist/cjs/create-editor/create-plugins-list.js +3 -1
- package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +26 -13
- package/dist/cjs/plugins/annotation/index.js +4 -2
- package/dist/cjs/plugins/annotation/ui/InlineCommentView.js +6 -2
- package/dist/cjs/plugins/base/pm-plugins/react-nodeview.js +8 -1
- package/dist/cjs/plugins/block-type/commands/delete-block-content.js +53 -0
- package/dist/cjs/plugins/block-type/commands/index.js +9 -1
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +8 -4
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -3
- package/dist/cjs/plugins/card/pm-plugins/doc.js +21 -4
- package/dist/cjs/plugins/card/toolbar.js +4 -2
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +4 -1
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +16 -9
- package/dist/cjs/plugins/collab-edit/actions.js +1 -1
- package/dist/cjs/plugins/collab-edit/index.js +1 -1
- package/dist/cjs/plugins/collab-edit/provider/channel.js +1 -1
- package/dist/cjs/plugins/expand/pm-plugins/keymap.js +5 -0
- package/dist/cjs/plugins/floating-toolbar/ui/Select.js +2 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +18 -9
- package/dist/cjs/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -0
- package/dist/cjs/plugins/hyperlink/index.js +2 -1
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +15 -2
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +27 -22
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +6 -2
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +2 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
- package/dist/cjs/plugins/media/commands/helpers.js +24 -2
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +14 -16
- package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +232 -183
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +1 -3
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/cjs/plugins/media/pm-plugins/keymap.js +46 -0
- package/dist/cjs/plugins/rank.js +3 -2
- package/dist/cjs/plugins/selection/pm-plugins/events/create-selection-between.js +86 -0
- package/dist/cjs/plugins/selection/pm-plugins/events/keydown.js +84 -0
- package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +6 -56
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +1 -1
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +7 -2
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +4 -2
- package/dist/cjs/ui/Addon/ClickAreaBlock/index.js +22 -61
- package/dist/cjs/ui/Addon/ClickAreaInline/index.js +22 -56
- package/dist/cjs/ui/Addon/click-area-helper.js +28 -6
- package/dist/cjs/ui/Alignment/AlignmentButton/index.js +4 -2
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +2 -1
- package/dist/cjs/ui/ToolbarArrowKeyNavigationProvider/index.js +22 -9
- package/dist/cjs/utils/document.js +11 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +3 -1
- package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +28 -13
- package/dist/es2019/plugins/annotation/index.js +4 -2
- package/dist/es2019/plugins/annotation/ui/InlineCommentView.js +6 -2
- package/dist/es2019/plugins/base/pm-plugins/react-nodeview.js +8 -1
- package/dist/es2019/plugins/block-type/commands/delete-block-content.js +49 -0
- package/dist/es2019/plugins/block-type/commands/index.js +2 -1
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +3 -3
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +8 -4
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/es2019/plugins/card/pm-plugins/doc.js +19 -3
- package/dist/es2019/plugins/card/toolbar.js +4 -2
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +5 -2
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +15 -9
- package/dist/es2019/plugins/collab-edit/actions.js +1 -1
- package/dist/es2019/plugins/collab-edit/index.js +1 -1
- package/dist/es2019/plugins/collab-edit/provider/channel.js +1 -1
- package/dist/es2019/plugins/expand/pm-plugins/keymap.js +5 -0
- package/dist/es2019/plugins/floating-toolbar/ui/Select.js +2 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +18 -9
- package/dist/es2019/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -0
- package/dist/es2019/plugins/hyperlink/index.js +2 -1
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +11 -2
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -5
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +6 -2
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +2 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
- package/dist/es2019/plugins/media/commands/helpers.js +18 -1
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +14 -16
- package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +37 -13
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +1 -2
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/keymap.js +45 -0
- package/dist/es2019/plugins/rank.js +3 -2
- package/dist/es2019/plugins/selection/pm-plugins/events/create-selection-between.js +79 -0
- package/dist/es2019/plugins/selection/pm-plugins/events/keydown.js +77 -0
- package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +5 -55
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +1 -1
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +6 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +3 -2
- package/dist/es2019/ui/Addon/ClickAreaBlock/index.js +20 -31
- package/dist/es2019/ui/Addon/ClickAreaInline/index.js +20 -27
- package/dist/es2019/ui/Addon/click-area-helper.js +28 -6
- package/dist/es2019/ui/Alignment/AlignmentButton/index.js +4 -2
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +2 -1
- package/dist/es2019/ui/ToolbarArrowKeyNavigationProvider/index.js +22 -9
- package/dist/es2019/utils/document.js +9 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +3 -1
- package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +26 -13
- package/dist/esm/plugins/annotation/index.js +4 -2
- package/dist/esm/plugins/annotation/ui/InlineCommentView.js +6 -2
- package/dist/esm/plugins/base/pm-plugins/react-nodeview.js +8 -1
- package/dist/esm/plugins/block-type/commands/delete-block-content.js +46 -0
- package/dist/esm/plugins/block-type/commands/index.js +2 -1
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +3 -3
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +8 -4
- package/dist/esm/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/esm/plugins/card/pm-plugins/doc.js +20 -3
- package/dist/esm/plugins/card/toolbar.js +4 -2
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +5 -2
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +16 -9
- package/dist/esm/plugins/collab-edit/actions.js +1 -1
- package/dist/esm/plugins/collab-edit/index.js +1 -1
- package/dist/esm/plugins/collab-edit/provider/channel.js +1 -1
- package/dist/esm/plugins/expand/pm-plugins/keymap.js +5 -0
- package/dist/esm/plugins/floating-toolbar/ui/Select.js +2 -1
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +18 -9
- package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -0
- package/dist/esm/plugins/hyperlink/index.js +2 -1
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +15 -3
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +27 -22
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +6 -2
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +2 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
- package/dist/esm/plugins/media/commands/helpers.js +20 -1
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +14 -16
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +235 -184
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +1 -2
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/keymap.js +45 -0
- package/dist/esm/plugins/rank.js +3 -2
- package/dist/esm/plugins/selection/pm-plugins/events/create-selection-between.js +76 -0
- package/dist/esm/plugins/selection/pm-plugins/events/keydown.js +74 -0
- package/dist/esm/plugins/selection/pm-plugins/selection-main.js +4 -57
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +1 -1
- package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +7 -2
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +4 -2
- package/dist/esm/ui/Addon/ClickAreaBlock/index.js +17 -58
- package/dist/esm/ui/Addon/ClickAreaInline/index.js +17 -53
- package/dist/esm/ui/Addon/click-area-helper.js +28 -6
- package/dist/esm/ui/Alignment/AlignmentButton/index.js +4 -2
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +2 -1
- package/dist/esm/ui/ToolbarArrowKeyNavigationProvider/index.js +22 -9
- package/dist/esm/utils/document.js +11 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/alignment/ui/ToolbarAlignment/index.d.ts +1 -1
- package/dist/types/plugins/block-type/commands/delete-block-content.d.ts +10 -0
- package/dist/types/plugins/block-type/commands/index.d.ts +1 -0
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -1
- package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +1 -0
- package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -0
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +6 -1
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -0
- package/dist/types/plugins/media/commands/helpers.d.ts +1 -0
- package/dist/types/plugins/media/nodeviews/__mocks__/mediaNodeUpdater.d.ts +1 -0
- package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +3 -1
- package/dist/types/plugins/media/types.d.ts +2 -0
- package/dist/types/plugins/selection/pm-plugins/events/create-selection-between.d.ts +4 -0
- package/dist/types/plugins/selection/pm-plugins/events/keydown.d.ts +2 -0
- package/dist/types/ui/Addon/ClickAreaBlock/index.d.ts +2 -5
- package/dist/types/ui/Addon/ClickAreaInline/index.d.ts +2 -5
- package/dist/types/ui/Addon/click-area-helper.d.ts +1 -1
- package/dist/types/ui/Alignment/AlignmentButton/index.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/types.d.ts +1 -0
- package/docs/0-intro.tsx +9 -0
- package/package.json +14 -16
- package/report.api.md +4 -1
|
@@ -7,7 +7,7 @@ import uuidV4 from 'uuid/v4';
|
|
|
7
7
|
import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
|
|
8
8
|
import { getMediaClient, isMediaBlobUrl as _isMediaBlobUrl, getAttrsFromUrl, isImageRepresentationReady } from '@atlaskit/media-client';
|
|
9
9
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
|
|
10
|
-
import { replaceExternalMedia, updateAllMediaNodesAttrs, updateMediaNodeAttrs } from '../commands/helpers';
|
|
10
|
+
import { replaceExternalMedia, updateAllMediaNodesAttrs, updateCurrentMediaNodeAttrs, updateMediaNodeAttrs } from '../commands/helpers';
|
|
11
11
|
export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
12
12
|
function MediaNodeUpdater(props) {
|
|
13
13
|
var _this = this;
|
|
@@ -48,92 +48,75 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
48
48
|
}, _callee);
|
|
49
49
|
})));
|
|
50
50
|
|
|
51
|
-
_defineProperty(this, "hasFileAttributesDefined", function () {
|
|
52
|
-
var attrs = _this.getAttrs();
|
|
53
|
-
|
|
51
|
+
_defineProperty(this, "hasFileAttributesDefined", function (attrs) {
|
|
54
52
|
return attrs && attrs.type === 'file' && attrs.__fileName && attrs.__fileMimeType && attrs.__fileSize && attrs.__contextId;
|
|
55
53
|
});
|
|
56
54
|
|
|
57
|
-
_defineProperty(this, "
|
|
58
|
-
var
|
|
59
|
-
attrs,
|
|
60
|
-
mediaProvider,
|
|
61
|
-
mediaClientConfig,
|
|
62
|
-
mediaClient,
|
|
63
|
-
options,
|
|
64
|
-
fileState,
|
|
65
|
-
contextId,
|
|
66
|
-
_fileState,
|
|
67
|
-
name,
|
|
68
|
-
mimeType,
|
|
69
|
-
size,
|
|
70
|
-
newAttrs,
|
|
71
|
-
attrsChanged,
|
|
72
|
-
_args2 = arguments;
|
|
55
|
+
_defineProperty(this, "getNewFileAttrsForNode", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
56
|
+
var attrs, mediaProvider, mediaClientConfig, mediaClient, fileState, id, collectionName, contextId, _fileState, name, mimeType, size, newAttrs;
|
|
73
57
|
|
|
74
58
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
75
59
|
while (1) {
|
|
76
60
|
switch (_context2.prev = _context2.next) {
|
|
77
61
|
case 0:
|
|
78
|
-
isMediaSingle = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : true;
|
|
79
62
|
attrs = _this.getAttrs();
|
|
80
|
-
_context2.next =
|
|
63
|
+
_context2.next = 3;
|
|
81
64
|
return _this.props.mediaProvider;
|
|
82
65
|
|
|
83
|
-
case
|
|
66
|
+
case 3:
|
|
84
67
|
mediaProvider = _context2.sent;
|
|
85
68
|
|
|
86
|
-
if (!(!mediaProvider || !mediaProvider.uploadParams || !attrs || attrs.type !== 'file' || _this.hasFileAttributesDefined())) {
|
|
87
|
-
_context2.next =
|
|
69
|
+
if (!(!mediaProvider || !mediaProvider.uploadParams || !attrs || attrs.type !== 'file' || _this.hasFileAttributesDefined(attrs))) {
|
|
70
|
+
_context2.next = 6;
|
|
88
71
|
break;
|
|
89
72
|
}
|
|
90
73
|
|
|
91
74
|
return _context2.abrupt("return");
|
|
92
75
|
|
|
93
|
-
case
|
|
76
|
+
case 6:
|
|
94
77
|
mediaClientConfig = mediaProvider.viewMediaClientConfig;
|
|
95
78
|
mediaClient = getMediaClient(mediaClientConfig);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
case
|
|
79
|
+
id = attrs.id, collectionName = attrs.collection;
|
|
80
|
+
_context2.prev = 9;
|
|
81
|
+
_context2.next = 12;
|
|
82
|
+
return mediaClient.file.getCurrentState(id, {
|
|
83
|
+
collectionName: collectionName
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
case 12:
|
|
104
87
|
fileState = _context2.sent;
|
|
105
88
|
|
|
106
89
|
if (!(fileState.status === 'error')) {
|
|
107
|
-
_context2.next =
|
|
90
|
+
_context2.next = 15;
|
|
108
91
|
break;
|
|
109
92
|
}
|
|
110
93
|
|
|
111
94
|
return _context2.abrupt("return");
|
|
112
95
|
|
|
113
|
-
case
|
|
114
|
-
_context2.next =
|
|
96
|
+
case 15:
|
|
97
|
+
_context2.next = 20;
|
|
115
98
|
break;
|
|
116
99
|
|
|
117
|
-
case
|
|
118
|
-
_context2.prev =
|
|
119
|
-
_context2.t0 = _context2["catch"](
|
|
100
|
+
case 17:
|
|
101
|
+
_context2.prev = 17;
|
|
102
|
+
_context2.t0 = _context2["catch"](9);
|
|
120
103
|
return _context2.abrupt("return");
|
|
121
104
|
|
|
122
|
-
case
|
|
105
|
+
case 20:
|
|
123
106
|
_context2.t1 = _this.getNodeContextId();
|
|
124
107
|
|
|
125
108
|
if (_context2.t1) {
|
|
126
|
-
_context2.next =
|
|
109
|
+
_context2.next = 25;
|
|
127
110
|
break;
|
|
128
111
|
}
|
|
129
112
|
|
|
130
|
-
_context2.next =
|
|
113
|
+
_context2.next = 24;
|
|
131
114
|
return _this.getObjectId();
|
|
132
115
|
|
|
133
|
-
case
|
|
116
|
+
case 24:
|
|
134
117
|
_context2.t1 = _context2.sent;
|
|
135
118
|
|
|
136
|
-
case
|
|
119
|
+
case 25:
|
|
137
120
|
contextId = _context2.t1;
|
|
138
121
|
_fileState = fileState, name = _fileState.name, mimeType = _fileState.mimeType, size = _fileState.size;
|
|
139
122
|
newAttrs = {
|
|
@@ -142,21 +125,89 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
142
125
|
__fileSize: size,
|
|
143
126
|
__contextId: contextId
|
|
144
127
|
};
|
|
145
|
-
attrsChanged = hasPrivateAttrsChanged(attrs, newAttrs);
|
|
146
128
|
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
|
|
129
|
+
if (hasPrivateAttrsChanged(attrs, newAttrs)) {
|
|
130
|
+
_context2.next = 30;
|
|
131
|
+
break;
|
|
150
132
|
}
|
|
151
133
|
|
|
134
|
+
return _context2.abrupt("return");
|
|
135
|
+
|
|
136
|
+
case 30:
|
|
137
|
+
return _context2.abrupt("return", newAttrs);
|
|
138
|
+
|
|
152
139
|
case 31:
|
|
153
140
|
case "end":
|
|
154
141
|
return _context2.stop();
|
|
155
142
|
}
|
|
156
143
|
}
|
|
157
|
-
}, _callee2, null, [[
|
|
144
|
+
}, _callee2, null, [[9, 17]]);
|
|
145
|
+
})));
|
|
146
|
+
|
|
147
|
+
_defineProperty(this, "updateFileAttrs", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
148
|
+
var isMediaSingle,
|
|
149
|
+
newAttrs,
|
|
150
|
+
_ref4,
|
|
151
|
+
id,
|
|
152
|
+
_args3 = arguments;
|
|
153
|
+
|
|
154
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
155
|
+
while (1) {
|
|
156
|
+
switch (_context3.prev = _context3.next) {
|
|
157
|
+
case 0:
|
|
158
|
+
isMediaSingle = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : true;
|
|
159
|
+
_context3.next = 3;
|
|
160
|
+
return _this.getNewFileAttrsForNode();
|
|
161
|
+
|
|
162
|
+
case 3:
|
|
163
|
+
newAttrs = _context3.sent;
|
|
164
|
+
_ref4 = _this.getAttrs(), id = _ref4.id;
|
|
165
|
+
|
|
166
|
+
if (id && newAttrs) {
|
|
167
|
+
updateAllMediaNodesAttrs(id, newAttrs, isMediaSingle)(_this.props.view.state, _this.props.view.dispatch);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
case 6:
|
|
171
|
+
case "end":
|
|
172
|
+
return _context3.stop();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}, _callee3);
|
|
158
176
|
})));
|
|
159
177
|
|
|
178
|
+
_defineProperty(this, "updateNodeAttrs", /*#__PURE__*/function () {
|
|
179
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(getPos) {
|
|
180
|
+
var newAttrs;
|
|
181
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
182
|
+
while (1) {
|
|
183
|
+
switch (_context4.prev = _context4.next) {
|
|
184
|
+
case 0:
|
|
185
|
+
_context4.next = 2;
|
|
186
|
+
return _this.getNewFileAttrsForNode();
|
|
187
|
+
|
|
188
|
+
case 2:
|
|
189
|
+
newAttrs = _context4.sent;
|
|
190
|
+
|
|
191
|
+
if (newAttrs) {
|
|
192
|
+
updateCurrentMediaNodeAttrs(newAttrs, {
|
|
193
|
+
node: _this.props.node,
|
|
194
|
+
getPos: getPos
|
|
195
|
+
})(_this.props.view.state, _this.props.view.dispatch);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
case 4:
|
|
199
|
+
case "end":
|
|
200
|
+
return _context4.stop();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}, _callee4);
|
|
204
|
+
}));
|
|
205
|
+
|
|
206
|
+
return function (_x) {
|
|
207
|
+
return _ref5.apply(this, arguments);
|
|
208
|
+
};
|
|
209
|
+
}());
|
|
210
|
+
|
|
160
211
|
_defineProperty(this, "getAttrs", function () {
|
|
161
212
|
var attrs = _this.props.node.attrs;
|
|
162
213
|
|
|
@@ -167,64 +218,64 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
167
218
|
return undefined;
|
|
168
219
|
});
|
|
169
220
|
|
|
170
|
-
_defineProperty(this, "getObjectId", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
221
|
+
_defineProperty(this, "getObjectId", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
171
222
|
var contextIdentifierProvider;
|
|
172
|
-
return _regeneratorRuntime.wrap(function
|
|
223
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
173
224
|
while (1) {
|
|
174
|
-
switch (
|
|
225
|
+
switch (_context5.prev = _context5.next) {
|
|
175
226
|
case 0:
|
|
176
|
-
|
|
227
|
+
_context5.next = 2;
|
|
177
228
|
return _this.props.contextIdentifierProvider;
|
|
178
229
|
|
|
179
230
|
case 2:
|
|
180
|
-
contextIdentifierProvider =
|
|
181
|
-
return
|
|
231
|
+
contextIdentifierProvider = _context5.sent;
|
|
232
|
+
return _context5.abrupt("return", (contextIdentifierProvider === null || contextIdentifierProvider === void 0 ? void 0 : contextIdentifierProvider.objectId) || null);
|
|
182
233
|
|
|
183
234
|
case 4:
|
|
184
235
|
case "end":
|
|
185
|
-
return
|
|
236
|
+
return _context5.stop();
|
|
186
237
|
}
|
|
187
238
|
}
|
|
188
|
-
},
|
|
239
|
+
}, _callee5);
|
|
189
240
|
})));
|
|
190
241
|
|
|
191
242
|
_defineProperty(this, "uploadExternalMedia", /*#__PURE__*/function () {
|
|
192
|
-
var
|
|
243
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(getPos) {
|
|
193
244
|
var node, mediaProvider, uploadMediaClientConfig, mediaClient, collection, uploader, uploadableFileUpfrontIds, dimensions;
|
|
194
|
-
return _regeneratorRuntime.wrap(function
|
|
245
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
195
246
|
while (1) {
|
|
196
|
-
switch (
|
|
247
|
+
switch (_context6.prev = _context6.next) {
|
|
197
248
|
case 0:
|
|
198
249
|
node = _this.props.node;
|
|
199
|
-
|
|
250
|
+
_context6.next = 3;
|
|
200
251
|
return _this.props.mediaProvider;
|
|
201
252
|
|
|
202
253
|
case 3:
|
|
203
|
-
mediaProvider =
|
|
254
|
+
mediaProvider = _context6.sent;
|
|
204
255
|
|
|
205
256
|
if (!(node && mediaProvider)) {
|
|
206
|
-
|
|
257
|
+
_context6.next = 21;
|
|
207
258
|
break;
|
|
208
259
|
}
|
|
209
260
|
|
|
210
261
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
211
262
|
|
|
212
263
|
if (!(!uploadMediaClientConfig || !node.attrs.url)) {
|
|
213
|
-
|
|
264
|
+
_context6.next = 8;
|
|
214
265
|
break;
|
|
215
266
|
}
|
|
216
267
|
|
|
217
|
-
return
|
|
268
|
+
return _context6.abrupt("return");
|
|
218
269
|
|
|
219
270
|
case 8:
|
|
220
271
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
221
272
|
collection = mediaProvider.uploadParams && mediaProvider.uploadParams.collection;
|
|
222
|
-
|
|
223
|
-
|
|
273
|
+
_context6.prev = 10;
|
|
274
|
+
_context6.next = 13;
|
|
224
275
|
return mediaClient.file.uploadExternal(node.attrs.url, collection);
|
|
225
276
|
|
|
226
277
|
case 13:
|
|
227
|
-
uploader =
|
|
278
|
+
uploader = _context6.sent;
|
|
228
279
|
uploadableFileUpfrontIds = uploader.uploadableFileUpfrontIds, dimensions = uploader.dimensions;
|
|
229
280
|
replaceExternalMedia(getPos() + 1, {
|
|
230
281
|
id: uploadableFileUpfrontIds.id,
|
|
@@ -233,12 +284,12 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
233
284
|
width: dimensions.width,
|
|
234
285
|
occurrenceKey: uploadableFileUpfrontIds.occurrenceKey
|
|
235
286
|
})(_this.props.view.state, _this.props.view.dispatch);
|
|
236
|
-
|
|
287
|
+
_context6.next = 21;
|
|
237
288
|
break;
|
|
238
289
|
|
|
239
290
|
case 18:
|
|
240
|
-
|
|
241
|
-
|
|
291
|
+
_context6.prev = 18;
|
|
292
|
+
_context6.t0 = _context6["catch"](10);
|
|
242
293
|
|
|
243
294
|
//keep it as external media
|
|
244
295
|
if (_this.props.dispatchAnalyticsEvent) {
|
|
@@ -251,14 +302,14 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
251
302
|
|
|
252
303
|
case 21:
|
|
253
304
|
case "end":
|
|
254
|
-
return
|
|
305
|
+
return _context6.stop();
|
|
255
306
|
}
|
|
256
307
|
}
|
|
257
|
-
},
|
|
308
|
+
}, _callee6, null, [[10, 18]]);
|
|
258
309
|
}));
|
|
259
310
|
|
|
260
|
-
return function (
|
|
261
|
-
return
|
|
311
|
+
return function (_x2) {
|
|
312
|
+
return _ref7.apply(this, arguments);
|
|
262
313
|
};
|
|
263
314
|
}());
|
|
264
315
|
|
|
@@ -279,144 +330,144 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
279
330
|
}, true)(_this.props.view.state, _this.props.view.dispatch);
|
|
280
331
|
});
|
|
281
332
|
|
|
282
|
-
_defineProperty(this, "hasDifferentContextId", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
333
|
+
_defineProperty(this, "hasDifferentContextId", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
283
334
|
var nodeContextId, currentContextId;
|
|
284
|
-
return _regeneratorRuntime.wrap(function
|
|
335
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
285
336
|
while (1) {
|
|
286
|
-
switch (
|
|
337
|
+
switch (_context7.prev = _context7.next) {
|
|
287
338
|
case 0:
|
|
288
339
|
nodeContextId = _this.getNodeContextId();
|
|
289
|
-
|
|
340
|
+
_context7.next = 3;
|
|
290
341
|
return _this.getObjectId();
|
|
291
342
|
|
|
292
343
|
case 3:
|
|
293
|
-
currentContextId =
|
|
344
|
+
currentContextId = _context7.sent;
|
|
294
345
|
|
|
295
346
|
if (!(nodeContextId && currentContextId && nodeContextId !== currentContextId)) {
|
|
296
|
-
|
|
347
|
+
_context7.next = 6;
|
|
297
348
|
break;
|
|
298
349
|
}
|
|
299
350
|
|
|
300
|
-
return
|
|
351
|
+
return _context7.abrupt("return", true);
|
|
301
352
|
|
|
302
353
|
case 6:
|
|
303
|
-
return
|
|
354
|
+
return _context7.abrupt("return", false);
|
|
304
355
|
|
|
305
356
|
case 7:
|
|
306
357
|
case "end":
|
|
307
|
-
return
|
|
358
|
+
return _context7.stop();
|
|
308
359
|
}
|
|
309
360
|
}
|
|
310
|
-
},
|
|
361
|
+
}, _callee7);
|
|
311
362
|
})));
|
|
312
363
|
|
|
313
|
-
_defineProperty(this, "isNodeFromDifferentCollection", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
364
|
+
_defineProperty(this, "isNodeFromDifferentCollection", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
314
365
|
var mediaProvider, currentCollectionName, attrs, nodeCollection, __contextId, contextId;
|
|
315
366
|
|
|
316
|
-
return _regeneratorRuntime.wrap(function
|
|
367
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
317
368
|
while (1) {
|
|
318
|
-
switch (
|
|
369
|
+
switch (_context8.prev = _context8.next) {
|
|
319
370
|
case 0:
|
|
320
|
-
|
|
371
|
+
_context8.next = 2;
|
|
321
372
|
return _this.props.mediaProvider;
|
|
322
373
|
|
|
323
374
|
case 2:
|
|
324
|
-
mediaProvider =
|
|
375
|
+
mediaProvider = _context8.sent;
|
|
325
376
|
|
|
326
377
|
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
327
|
-
|
|
378
|
+
_context8.next = 5;
|
|
328
379
|
break;
|
|
329
380
|
}
|
|
330
381
|
|
|
331
|
-
return
|
|
382
|
+
return _context8.abrupt("return", false);
|
|
332
383
|
|
|
333
384
|
case 5:
|
|
334
385
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
335
386
|
attrs = _this.getAttrs();
|
|
336
387
|
|
|
337
388
|
if (!(!attrs || attrs.type !== 'file')) {
|
|
338
|
-
|
|
389
|
+
_context8.next = 9;
|
|
339
390
|
break;
|
|
340
391
|
}
|
|
341
392
|
|
|
342
|
-
return
|
|
393
|
+
return _context8.abrupt("return", false);
|
|
343
394
|
|
|
344
395
|
case 9:
|
|
345
396
|
nodeCollection = attrs.collection, __contextId = attrs.__contextId;
|
|
346
|
-
|
|
397
|
+
_context8.t0 = __contextId;
|
|
347
398
|
|
|
348
|
-
if (
|
|
349
|
-
|
|
399
|
+
if (_context8.t0) {
|
|
400
|
+
_context8.next = 15;
|
|
350
401
|
break;
|
|
351
402
|
}
|
|
352
403
|
|
|
353
|
-
|
|
404
|
+
_context8.next = 14;
|
|
354
405
|
return _this.getObjectId();
|
|
355
406
|
|
|
356
407
|
case 14:
|
|
357
|
-
|
|
408
|
+
_context8.t0 = _context8.sent;
|
|
358
409
|
|
|
359
410
|
case 15:
|
|
360
|
-
contextId =
|
|
411
|
+
contextId = _context8.t0;
|
|
361
412
|
|
|
362
413
|
if (!(contextId && currentCollectionName !== nodeCollection)) {
|
|
363
|
-
|
|
414
|
+
_context8.next = 18;
|
|
364
415
|
break;
|
|
365
416
|
}
|
|
366
417
|
|
|
367
|
-
return
|
|
418
|
+
return _context8.abrupt("return", true);
|
|
368
419
|
|
|
369
420
|
case 18:
|
|
370
|
-
return
|
|
421
|
+
return _context8.abrupt("return", false);
|
|
371
422
|
|
|
372
423
|
case 19:
|
|
373
424
|
case "end":
|
|
374
|
-
return
|
|
425
|
+
return _context8.stop();
|
|
375
426
|
}
|
|
376
427
|
}
|
|
377
|
-
},
|
|
428
|
+
}, _callee8);
|
|
378
429
|
})));
|
|
379
430
|
|
|
380
431
|
_defineProperty(this, "copyNodeFromBlobUrl", /*#__PURE__*/function () {
|
|
381
|
-
var
|
|
432
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(getPos) {
|
|
382
433
|
var attrs, url, mediaAttrs, mediaProvider, currentCollectionName, contextId, id, collection, height, width, mimeType, name, size, uploadMediaClientConfig, mediaClient, auth, source, destination, mediaFile;
|
|
383
|
-
return _regeneratorRuntime.wrap(function
|
|
434
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
384
435
|
while (1) {
|
|
385
|
-
switch (
|
|
436
|
+
switch (_context9.prev = _context9.next) {
|
|
386
437
|
case 0:
|
|
387
438
|
attrs = _this.getAttrs();
|
|
388
439
|
|
|
389
440
|
if (!(!attrs || attrs.type !== 'external')) {
|
|
390
|
-
|
|
441
|
+
_context9.next = 3;
|
|
391
442
|
break;
|
|
392
443
|
}
|
|
393
444
|
|
|
394
|
-
return
|
|
445
|
+
return _context9.abrupt("return");
|
|
395
446
|
|
|
396
447
|
case 3:
|
|
397
448
|
url = attrs.url;
|
|
398
449
|
mediaAttrs = getAttrsFromUrl(url);
|
|
399
450
|
|
|
400
451
|
if (mediaAttrs) {
|
|
401
|
-
|
|
452
|
+
_context9.next = 7;
|
|
402
453
|
break;
|
|
403
454
|
}
|
|
404
455
|
|
|
405
|
-
return
|
|
456
|
+
return _context9.abrupt("return");
|
|
406
457
|
|
|
407
458
|
case 7:
|
|
408
|
-
|
|
459
|
+
_context9.next = 9;
|
|
409
460
|
return _this.props.mediaProvider;
|
|
410
461
|
|
|
411
462
|
case 9:
|
|
412
|
-
mediaProvider =
|
|
463
|
+
mediaProvider = _context9.sent;
|
|
413
464
|
|
|
414
465
|
if (!(!mediaProvider || !mediaProvider.uploadParams)) {
|
|
415
|
-
|
|
466
|
+
_context9.next = 12;
|
|
416
467
|
break;
|
|
417
468
|
}
|
|
418
469
|
|
|
419
|
-
return
|
|
470
|
+
return _context9.abrupt("return");
|
|
420
471
|
|
|
421
472
|
case 12:
|
|
422
473
|
currentCollectionName = mediaProvider.uploadParams.collection;
|
|
@@ -424,19 +475,19 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
424
475
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
425
476
|
|
|
426
477
|
if (!(!uploadMediaClientConfig || !uploadMediaClientConfig.getAuthFromContext)) {
|
|
427
|
-
|
|
478
|
+
_context9.next = 17;
|
|
428
479
|
break;
|
|
429
480
|
}
|
|
430
481
|
|
|
431
|
-
return
|
|
482
|
+
return _context9.abrupt("return");
|
|
432
483
|
|
|
433
484
|
case 17:
|
|
434
485
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
435
|
-
|
|
486
|
+
_context9.next = 20;
|
|
436
487
|
return uploadMediaClientConfig.getAuthFromContext(contextId);
|
|
437
488
|
|
|
438
489
|
case 20:
|
|
439
|
-
auth =
|
|
490
|
+
auth = _context9.sent;
|
|
440
491
|
source = {
|
|
441
492
|
id: id,
|
|
442
493
|
collection: collection,
|
|
@@ -449,11 +500,11 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
449
500
|
authProvider: uploadMediaClientConfig.authProvider,
|
|
450
501
|
occurrenceKey: uuidV4()
|
|
451
502
|
};
|
|
452
|
-
|
|
503
|
+
_context9.next = 25;
|
|
453
504
|
return mediaClient.file.copyFile(source, destination);
|
|
454
505
|
|
|
455
506
|
case 25:
|
|
456
|
-
mediaFile =
|
|
507
|
+
mediaFile = _context9.sent;
|
|
457
508
|
replaceExternalMedia(getPos() + 1, {
|
|
458
509
|
id: mediaFile.id,
|
|
459
510
|
collection: currentCollectionName,
|
|
@@ -466,60 +517,60 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
466
517
|
|
|
467
518
|
case 27:
|
|
468
519
|
case "end":
|
|
469
|
-
return
|
|
520
|
+
return _context9.stop();
|
|
470
521
|
}
|
|
471
522
|
}
|
|
472
|
-
},
|
|
523
|
+
}, _callee9);
|
|
473
524
|
}));
|
|
474
525
|
|
|
475
|
-
return function (
|
|
476
|
-
return
|
|
526
|
+
return function (_x3) {
|
|
527
|
+
return _ref10.apply(this, arguments);
|
|
477
528
|
};
|
|
478
529
|
}());
|
|
479
530
|
|
|
480
531
|
_defineProperty(this, "copyNode", /*#__PURE__*/function () {
|
|
481
|
-
var
|
|
532
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(traceContext) {
|
|
482
533
|
var mediaProvider, _this$props, isMediaSingle, view, attrs, nodeContextId, uploadMediaClientConfig, mediaClient, auth, objectId, id, collection, source, currentCollectionName, destination, mediaFile;
|
|
483
534
|
|
|
484
|
-
return _regeneratorRuntime.wrap(function
|
|
535
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
485
536
|
while (1) {
|
|
486
|
-
switch (
|
|
537
|
+
switch (_context10.prev = _context10.next) {
|
|
487
538
|
case 0:
|
|
488
|
-
|
|
539
|
+
_context10.next = 2;
|
|
489
540
|
return _this.props.mediaProvider;
|
|
490
541
|
|
|
491
542
|
case 2:
|
|
492
|
-
mediaProvider =
|
|
543
|
+
mediaProvider = _context10.sent;
|
|
493
544
|
_this$props = _this.props, isMediaSingle = _this$props.isMediaSingle, view = _this$props.view;
|
|
494
545
|
attrs = _this.getAttrs();
|
|
495
546
|
|
|
496
547
|
if (!(!mediaProvider || !mediaProvider.uploadParams || !attrs || attrs.type !== 'file')) {
|
|
497
|
-
|
|
548
|
+
_context10.next = 7;
|
|
498
549
|
break;
|
|
499
550
|
}
|
|
500
551
|
|
|
501
|
-
return
|
|
552
|
+
return _context10.abrupt("return");
|
|
502
553
|
|
|
503
554
|
case 7:
|
|
504
555
|
nodeContextId = _this.getNodeContextId();
|
|
505
556
|
uploadMediaClientConfig = mediaProvider.uploadMediaClientConfig;
|
|
506
557
|
|
|
507
558
|
if (!(uploadMediaClientConfig && uploadMediaClientConfig.getAuthFromContext && nodeContextId)) {
|
|
508
|
-
|
|
559
|
+
_context10.next = 25;
|
|
509
560
|
break;
|
|
510
561
|
}
|
|
511
562
|
|
|
512
563
|
mediaClient = getMediaClient(uploadMediaClientConfig);
|
|
513
|
-
|
|
564
|
+
_context10.next = 13;
|
|
514
565
|
return uploadMediaClientConfig.getAuthFromContext(nodeContextId);
|
|
515
566
|
|
|
516
567
|
case 13:
|
|
517
|
-
auth =
|
|
518
|
-
|
|
568
|
+
auth = _context10.sent;
|
|
569
|
+
_context10.next = 16;
|
|
519
570
|
return _this.getObjectId();
|
|
520
571
|
|
|
521
572
|
case 16:
|
|
522
|
-
objectId =
|
|
573
|
+
objectId = _context10.sent;
|
|
523
574
|
id = attrs.id, collection = attrs.collection;
|
|
524
575
|
source = {
|
|
525
576
|
id: id,
|
|
@@ -534,11 +585,11 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
534
585
|
authProvider: uploadMediaClientConfig.authProvider,
|
|
535
586
|
occurrenceKey: uuidV4()
|
|
536
587
|
};
|
|
537
|
-
|
|
588
|
+
_context10.next = 23;
|
|
538
589
|
return mediaClient.file.copyFile(source, destination, undefined, traceContext);
|
|
539
590
|
|
|
540
591
|
case 23:
|
|
541
|
-
mediaFile =
|
|
592
|
+
mediaFile = _context10.sent;
|
|
542
593
|
updateMediaNodeAttrs(source.id, {
|
|
543
594
|
id: mediaFile.id,
|
|
544
595
|
collection: currentCollectionName,
|
|
@@ -547,14 +598,14 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
547
598
|
|
|
548
599
|
case 25:
|
|
549
600
|
case "end":
|
|
550
|
-
return
|
|
601
|
+
return _context10.stop();
|
|
551
602
|
}
|
|
552
603
|
}
|
|
553
|
-
},
|
|
604
|
+
}, _callee10);
|
|
554
605
|
}));
|
|
555
606
|
|
|
556
|
-
return function (
|
|
557
|
-
return
|
|
607
|
+
return function (_x4) {
|
|
608
|
+
return _ref11.apply(this, arguments);
|
|
558
609
|
};
|
|
559
610
|
}());
|
|
560
611
|
|
|
@@ -572,54 +623,54 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
572
623
|
}, {
|
|
573
624
|
key: "getRemoteDimensions",
|
|
574
625
|
value: function () {
|
|
575
|
-
var _getRemoteDimensions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
626
|
+
var _getRemoteDimensions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
576
627
|
var mediaProvider, mediaOptions, attrs, height, width, id, collection, viewMediaClientConfig, mediaClient, currentState, imageMetadata;
|
|
577
|
-
return _regeneratorRuntime.wrap(function
|
|
628
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
578
629
|
while (1) {
|
|
579
|
-
switch (
|
|
630
|
+
switch (_context11.prev = _context11.next) {
|
|
580
631
|
case 0:
|
|
581
|
-
|
|
632
|
+
_context11.next = 2;
|
|
582
633
|
return this.props.mediaProvider;
|
|
583
634
|
|
|
584
635
|
case 2:
|
|
585
|
-
mediaProvider =
|
|
636
|
+
mediaProvider = _context11.sent;
|
|
586
637
|
mediaOptions = this.props.mediaOptions;
|
|
587
638
|
attrs = this.getAttrs();
|
|
588
639
|
|
|
589
640
|
if (!(!mediaProvider || !attrs)) {
|
|
590
|
-
|
|
641
|
+
_context11.next = 7;
|
|
591
642
|
break;
|
|
592
643
|
}
|
|
593
644
|
|
|
594
|
-
return
|
|
645
|
+
return _context11.abrupt("return", false);
|
|
595
646
|
|
|
596
647
|
case 7:
|
|
597
648
|
height = attrs.height, width = attrs.width;
|
|
598
649
|
|
|
599
650
|
if (!(attrs.type === 'external' || !attrs.id)) {
|
|
600
|
-
|
|
651
|
+
_context11.next = 10;
|
|
601
652
|
break;
|
|
602
653
|
}
|
|
603
654
|
|
|
604
|
-
return
|
|
655
|
+
return _context11.abrupt("return", false);
|
|
605
656
|
|
|
606
657
|
case 10:
|
|
607
658
|
id = attrs.id, collection = attrs.collection;
|
|
608
659
|
|
|
609
660
|
if (!(height && width)) {
|
|
610
|
-
|
|
661
|
+
_context11.next = 13;
|
|
611
662
|
break;
|
|
612
663
|
}
|
|
613
664
|
|
|
614
|
-
return
|
|
665
|
+
return _context11.abrupt("return", false);
|
|
615
666
|
|
|
616
667
|
case 13:
|
|
617
668
|
if (!(mediaOptions && !mediaOptions.allowRemoteDimensionsFetch)) {
|
|
618
|
-
|
|
669
|
+
_context11.next = 15;
|
|
619
670
|
break;
|
|
620
671
|
}
|
|
621
672
|
|
|
622
|
-
return
|
|
673
|
+
return _context11.abrupt("return", {
|
|
623
674
|
id: id,
|
|
624
675
|
height: DEFAULT_IMAGE_HEIGHT,
|
|
625
676
|
width: DEFAULT_IMAGE_WIDTH
|
|
@@ -628,39 +679,39 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
628
679
|
case 15:
|
|
629
680
|
viewMediaClientConfig = mediaProvider.viewMediaClientConfig;
|
|
630
681
|
mediaClient = getMediaClient(viewMediaClientConfig);
|
|
631
|
-
|
|
682
|
+
_context11.next = 19;
|
|
632
683
|
return mediaClient.file.getCurrentState(id, {
|
|
633
684
|
collectionName: collection
|
|
634
685
|
});
|
|
635
686
|
|
|
636
687
|
case 19:
|
|
637
|
-
currentState =
|
|
688
|
+
currentState = _context11.sent;
|
|
638
689
|
|
|
639
690
|
if (isImageRepresentationReady(currentState)) {
|
|
640
|
-
|
|
691
|
+
_context11.next = 22;
|
|
641
692
|
break;
|
|
642
693
|
}
|
|
643
694
|
|
|
644
|
-
return
|
|
695
|
+
return _context11.abrupt("return", false);
|
|
645
696
|
|
|
646
697
|
case 22:
|
|
647
|
-
|
|
698
|
+
_context11.next = 24;
|
|
648
699
|
return mediaClient.getImageMetadata(id, {
|
|
649
700
|
collection: collection
|
|
650
701
|
});
|
|
651
702
|
|
|
652
703
|
case 24:
|
|
653
|
-
imageMetadata =
|
|
704
|
+
imageMetadata = _context11.sent;
|
|
654
705
|
|
|
655
706
|
if (!(!imageMetadata || !imageMetadata.original)) {
|
|
656
|
-
|
|
707
|
+
_context11.next = 27;
|
|
657
708
|
break;
|
|
658
709
|
}
|
|
659
710
|
|
|
660
|
-
return
|
|
711
|
+
return _context11.abrupt("return", false);
|
|
661
712
|
|
|
662
713
|
case 27:
|
|
663
|
-
return
|
|
714
|
+
return _context11.abrupt("return", {
|
|
664
715
|
id: id,
|
|
665
716
|
height: imageMetadata.original.height || DEFAULT_IMAGE_HEIGHT,
|
|
666
717
|
width: imageMetadata.original.width || DEFAULT_IMAGE_WIDTH
|
|
@@ -668,10 +719,10 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
668
719
|
|
|
669
720
|
case 28:
|
|
670
721
|
case "end":
|
|
671
|
-
return
|
|
722
|
+
return _context11.stop();
|
|
672
723
|
}
|
|
673
724
|
}
|
|
674
|
-
},
|
|
725
|
+
}, _callee11, this);
|
|
675
726
|
}));
|
|
676
727
|
|
|
677
728
|
function getRemoteDimensions() {
|
|
@@ -683,47 +734,47 @@ export var MediaNodeUpdater = /*#__PURE__*/function () {
|
|
|
683
734
|
}, {
|
|
684
735
|
key: "handleExternalMedia",
|
|
685
736
|
value: function () {
|
|
686
|
-
var _handleExternalMedia = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
687
|
-
return _regeneratorRuntime.wrap(function
|
|
737
|
+
var _handleExternalMedia = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(getPos) {
|
|
738
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
688
739
|
while (1) {
|
|
689
|
-
switch (
|
|
740
|
+
switch (_context12.prev = _context12.next) {
|
|
690
741
|
case 0:
|
|
691
742
|
if (!this.isMediaBlobUrl()) {
|
|
692
|
-
|
|
743
|
+
_context12.next = 12;
|
|
693
744
|
break;
|
|
694
745
|
}
|
|
695
746
|
|
|
696
|
-
|
|
697
|
-
|
|
747
|
+
_context12.prev = 1;
|
|
748
|
+
_context12.next = 4;
|
|
698
749
|
return this.copyNodeFromBlobUrl(getPos);
|
|
699
750
|
|
|
700
751
|
case 4:
|
|
701
|
-
|
|
752
|
+
_context12.next = 10;
|
|
702
753
|
break;
|
|
703
754
|
|
|
704
755
|
case 6:
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
756
|
+
_context12.prev = 6;
|
|
757
|
+
_context12.t0 = _context12["catch"](1);
|
|
758
|
+
_context12.next = 10;
|
|
708
759
|
return this.uploadExternalMedia(getPos);
|
|
709
760
|
|
|
710
761
|
case 10:
|
|
711
|
-
|
|
762
|
+
_context12.next = 14;
|
|
712
763
|
break;
|
|
713
764
|
|
|
714
765
|
case 12:
|
|
715
|
-
|
|
766
|
+
_context12.next = 14;
|
|
716
767
|
return this.uploadExternalMedia(getPos);
|
|
717
768
|
|
|
718
769
|
case 14:
|
|
719
770
|
case "end":
|
|
720
|
-
return
|
|
771
|
+
return _context12.stop();
|
|
721
772
|
}
|
|
722
773
|
}
|
|
723
|
-
},
|
|
774
|
+
}, _callee12, this, [[1, 6]]);
|
|
724
775
|
}));
|
|
725
776
|
|
|
726
|
-
function handleExternalMedia(
|
|
777
|
+
function handleExternalMedia(_x5) {
|
|
727
778
|
return _handleExternalMedia.apply(this, arguments);
|
|
728
779
|
}
|
|
729
780
|
|