@atlaskit/editor-plugin-media 4.0.0 → 4.1.0
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 +10 -0
- package/dist/cjs/nodeviews/mediaGroup.js +16 -323
- package/dist/cjs/nodeviews/mediaSingle.js +47 -593
- package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +2 -3
- package/dist/cjs/pm-plugins/pixel-resizing/ui/pixel-entry.js +1 -1
- package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +67 -649
- package/dist/cjs/ui/toolbar/alt-text.js +1 -2
- package/dist/cjs/ui/toolbar/index.js +4 -12
- package/dist/cjs/ui/toolbar/linking.js +3 -4
- package/dist/cjs/ui/toolbar/mediaInline.js +2 -6
- package/dist/cjs/ui/toolbar/pixel-resizing.js +1 -5
- package/dist/es2019/nodeviews/mediaGroup.js +1 -272
- package/dist/es2019/nodeviews/mediaSingle.js +6 -477
- package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +2 -3
- package/dist/es2019/pm-plugins/pixel-resizing/ui/pixel-entry.js +1 -1
- package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +2 -510
- package/dist/es2019/ui/toolbar/alt-text.js +1 -2
- package/dist/es2019/ui/toolbar/index.js +4 -12
- package/dist/es2019/ui/toolbar/linking.js +3 -4
- package/dist/es2019/ui/toolbar/mediaInline.js +2 -6
- package/dist/es2019/ui/toolbar/pixel-resizing.js +1 -5
- package/dist/esm/nodeviews/mediaGroup.js +15 -322
- package/dist/esm/nodeviews/mediaSingle.js +47 -593
- package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +2 -3
- package/dist/esm/pm-plugins/pixel-resizing/ui/pixel-entry.js +1 -1
- package/dist/esm/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +64 -650
- package/dist/esm/ui/toolbar/alt-text.js +1 -2
- package/dist/esm/ui/toolbar/index.js +4 -12
- package/dist/esm/ui/toolbar/linking.js +3 -4
- package/dist/esm/ui/toolbar/mediaInline.js +2 -6
- package/dist/esm/ui/toolbar/pixel-resizing.js +1 -5
- package/dist/types/nodeviews/__mocks__/mediaNodeUpdater.d.ts +1 -0
- package/dist/types/nodeviews/mediaGroup.d.ts +2 -23
- package/dist/types/nodeviews/mediaSingle.d.ts +2 -38
- package/dist/types/nodeviews/mediaSingleNext.d.ts +1 -2
- package/dist/types-ts4.5/nodeviews/__mocks__/mediaNodeUpdater.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/mediaGroup.d.ts +2 -23
- package/dist/types-ts4.5/nodeviews/mediaSingle.d.ts +2 -38
- package/dist/types-ts4.5/nodeviews/mediaSingleNext.d.ts +1 -2
- package/package.json +4 -16
|
@@ -1,307 +1,17 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
4
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
|
-
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; }
|
|
10
|
-
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) { _defineProperty(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; }
|
|
11
6
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
7
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
8
|
import React from 'react';
|
|
14
|
-
import { injectIntl } from 'react-intl-next';
|
|
15
9
|
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
16
|
-
import { nodeViewsMessages as messages } from '@atlaskit/editor-common/media';
|
|
17
10
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
18
11
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
19
12
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
20
|
-
import { isNodeSelectedOrInRange, SelectedState, setNodeSelection } from '@atlaskit/editor-common/utils';
|
|
21
|
-
import EditorCloseIcon from '@atlaskit/icon/core/migration/close--editor-close';
|
|
22
|
-
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
23
|
-
import { Filmstrip } from '@atlaskit/media-filmstrip';
|
|
24
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
26
|
-
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
27
13
|
import { useMediaProvider } from '../ui/hooks/useMediaProvider';
|
|
28
14
|
import { MediaGroupNext } from './mediaGroupNext';
|
|
29
|
-
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
30
|
-
var isMediaGroupSelectedFromProps = function isMediaGroupSelectedFromProps(props) {
|
|
31
|
-
/**
|
|
32
|
-
* ED-19831
|
|
33
|
-
* There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
|
|
34
|
-
* directly to confluence since this bug is now in production.
|
|
35
|
-
*/
|
|
36
|
-
var pos;
|
|
37
|
-
try {
|
|
38
|
-
pos = props.getPos ? props.getPos() : undefined;
|
|
39
|
-
} catch (e) {
|
|
40
|
-
pos = undefined;
|
|
41
|
-
}
|
|
42
|
-
if (typeof pos !== 'number') {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
return isNodeSelectedOrInRange(props.anchorPos, props.headPos, pos, props.node.nodeSize);
|
|
46
|
-
};
|
|
47
|
-
var hasSelectionChanged = function hasSelectionChanged(oldProps, newProps) {
|
|
48
|
-
if (isMediaGroupSelectedFromProps(oldProps) !== isMediaGroupSelectedFromProps(newProps)) {
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
if (isMediaGroupSelectedFromProps(newProps) === SelectedState.selectedInside) {
|
|
52
|
-
return oldProps.anchorPos !== newProps.anchorPos;
|
|
53
|
-
}
|
|
54
|
-
return false;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
58
|
-
var MediaGroup = /*#__PURE__*/function (_React$Component) {
|
|
59
|
-
function MediaGroup(_props) {
|
|
60
|
-
var _this;
|
|
61
|
-
_classCallCheck(this, MediaGroup);
|
|
62
|
-
_this = _callSuper(this, MediaGroup, [_props]);
|
|
63
|
-
_defineProperty(_this, "state", {
|
|
64
|
-
viewMediaClientConfig: undefined
|
|
65
|
-
});
|
|
66
|
-
_defineProperty(_this, "updateNodeAttrs", function (props, node, getPos) {
|
|
67
|
-
var view = props.view,
|
|
68
|
-
mediaProvider = props.mediaProvider,
|
|
69
|
-
contextIdentifierProvider = props.contextIdentifierProvider;
|
|
70
|
-
var mediaNodeUpdater = new MediaNodeUpdater({
|
|
71
|
-
view: view,
|
|
72
|
-
mediaProvider: mediaProvider,
|
|
73
|
-
contextIdentifierProvider: contextIdentifierProvider,
|
|
74
|
-
node: node,
|
|
75
|
-
isMediaSingle: false
|
|
76
|
-
});
|
|
77
|
-
mediaNodeUpdater.updateNodeAttrs(getPos);
|
|
78
|
-
});
|
|
79
|
-
_defineProperty(_this, "setMediaItems", function (props) {
|
|
80
|
-
var _this$mediaPluginStat;
|
|
81
|
-
var updatedAttrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
82
|
-
var node = props.node;
|
|
83
|
-
var oldMediaNodes = _this.mediaNodes;
|
|
84
|
-
_this.mediaNodes = [];
|
|
85
|
-
node.forEach(function (item, childOffset) {
|
|
86
|
-
var getPos = function getPos() {
|
|
87
|
-
var pos = props.getPos();
|
|
88
|
-
if (typeof pos !== 'number') {
|
|
89
|
-
// That may seems weird, but the previous type wasn't match with the real ProseMirror code. And a lot of Media API was built expecting a number
|
|
90
|
-
// Because the original code would return NaN on runtime
|
|
91
|
-
// We are just make it explict now.
|
|
92
|
-
// We may run a deep investagation on Media code to figure out a better fix. But, for now, we want to keep the current behavior.
|
|
93
|
-
// TODO: ED-13910 - prosemirror-bump leftovers
|
|
94
|
-
return NaN;
|
|
95
|
-
}
|
|
96
|
-
return pos + childOffset + 1;
|
|
97
|
-
};
|
|
98
|
-
_this.mediaNodes.push(item);
|
|
99
|
-
if (updatedAttrs) {
|
|
100
|
-
_this.updateNodeAttrs(props, item, getPos);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
(_this$mediaPluginStat = _this.mediaPluginState) === null || _this$mediaPluginStat === void 0 || _this$mediaPluginStat.handleMediaGroupUpdate(oldMediaNodes, _this.mediaNodes);
|
|
104
|
-
});
|
|
105
|
-
_defineProperty(_this, "getIdentifier", function (item) {
|
|
106
|
-
if (item.attrs.type === 'external') {
|
|
107
|
-
return {
|
|
108
|
-
mediaItemType: 'external-image',
|
|
109
|
-
dataURI: item.attrs.url
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
return {
|
|
113
|
-
id: item.attrs.id,
|
|
114
|
-
mediaItemType: 'file',
|
|
115
|
-
collectionName: item.attrs.collection
|
|
116
|
-
};
|
|
117
|
-
});
|
|
118
|
-
_defineProperty(_this, "isNodeSelected", function (nodePos) {
|
|
119
|
-
var selected = isMediaGroupSelectedFromProps(_this.props);
|
|
120
|
-
if (selected === SelectedState.selectedInRange) {
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
if (selected === SelectedState.selectedInside && _this.props.anchorPos === nodePos) {
|
|
124
|
-
return true;
|
|
125
|
-
}
|
|
126
|
-
return false;
|
|
127
|
-
});
|
|
128
|
-
_defineProperty(_this, "renderChildNodes", function () {
|
|
129
|
-
var viewMediaClientConfig = _this.state.viewMediaClientConfig;
|
|
130
|
-
var _this$props = _this.props,
|
|
131
|
-
getPos = _this$props.getPos,
|
|
132
|
-
allowLazyLoading = _this$props.allowLazyLoading,
|
|
133
|
-
disabled = _this$props.disabled,
|
|
134
|
-
mediaOptions = _this$props.mediaOptions,
|
|
135
|
-
editorViewMode = _this$props.editorViewMode;
|
|
136
|
-
var items = _this.mediaNodes.map(function (item, idx) {
|
|
137
|
-
// We declared this to get a fresh position every time
|
|
138
|
-
var getNodePos = function getNodePos() {
|
|
139
|
-
var pos = getPos();
|
|
140
|
-
if (typeof pos !== 'number') {
|
|
141
|
-
// That may seems weird, but the previous type wasn't match with the real ProseMirror code. And a lot of Media API was built expecting a number
|
|
142
|
-
// Because the original code would return NaN on runtime
|
|
143
|
-
// We are just make it explict now.
|
|
144
|
-
// We may run a deep investagation on Media code to figure out a better fix. But, for now, we want to keep the current behavior.
|
|
145
|
-
// TODO: ED-13910 - prosemirror-bump leftovers
|
|
146
|
-
return NaN;
|
|
147
|
-
}
|
|
148
|
-
return pos + idx + 1;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
// Media Inline creates a floating toolbar with the same options, excludes these options if enabled
|
|
152
|
-
var mediaInlineOptions = function mediaInlineOptions() {
|
|
153
|
-
var allowMediaInline = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
154
|
-
if (!allowMediaInline) {
|
|
155
|
-
return {
|
|
156
|
-
shouldEnableDownloadButton: mediaOptions.enableDownloadButton,
|
|
157
|
-
actions: [{
|
|
158
|
-
handler: disabled || !_this.mediaPluginState ? function () {} : _this.mediaPluginState.handleMediaNodeRemoval.bind(null, undefined, getNodePos),
|
|
159
|
-
icon: /*#__PURE__*/React.createElement(EditorCloseIcon, {
|
|
160
|
-
label: _this.props.intl.formatMessage(messages.mediaGroupDeleteLabel)
|
|
161
|
-
})
|
|
162
|
-
}]
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
return _objectSpread({
|
|
167
|
-
identifier: _this.getIdentifier(item),
|
|
168
|
-
isLazy: allowLazyLoading,
|
|
169
|
-
selected: _this.isNodeSelected(getNodePos()),
|
|
170
|
-
onClick: function onClick() {
|
|
171
|
-
setNodeSelection(_this.props.view, getNodePos());
|
|
172
|
-
}
|
|
173
|
-
}, mediaInlineOptions(fg('platform_editor_remove_media_inline_feature_flag') ? mediaOptions.allowMediaInlineImages : getMediaFeatureFlag('mediaInline', mediaOptions.featureFlags)));
|
|
174
|
-
});
|
|
175
|
-
return /*#__PURE__*/React.createElement(Filmstrip, {
|
|
176
|
-
items: items,
|
|
177
|
-
mediaClientConfig: viewMediaClientConfig,
|
|
178
|
-
featureFlags: mediaOptions.featureFlags,
|
|
179
|
-
shouldOpenMediaViewer: editorViewMode && editorExperiment('platform_editor_controls', 'control')
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
_this.mediaNodes = [];
|
|
183
|
-
_this.mediaPluginState = mediaStateKey.getState(_props.view.state);
|
|
184
|
-
_this.setMediaItems(_props);
|
|
185
|
-
_this.state = {
|
|
186
|
-
viewMediaClientConfig: undefined
|
|
187
|
-
};
|
|
188
|
-
return _this;
|
|
189
|
-
}
|
|
190
|
-
_inherits(MediaGroup, _React$Component);
|
|
191
|
-
return _createClass(MediaGroup, [{
|
|
192
|
-
key: "componentDidMount",
|
|
193
|
-
value: function componentDidMount() {
|
|
194
|
-
var _this2 = this;
|
|
195
|
-
this.updateMediaClientConfig();
|
|
196
|
-
this.mediaNodes.forEach( /*#__PURE__*/function () {
|
|
197
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(node) {
|
|
198
|
-
var _this2$props, view, mediaProvider, contextIdentifierProvider, mediaNodeUpdater, getPos, contextId, shouldNodeBeDeepCopied;
|
|
199
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
200
|
-
while (1) switch (_context.prev = _context.next) {
|
|
201
|
-
case 0:
|
|
202
|
-
if (!(node.attrs.type === 'external')) {
|
|
203
|
-
_context.next = 2;
|
|
204
|
-
break;
|
|
205
|
-
}
|
|
206
|
-
return _context.abrupt("return");
|
|
207
|
-
case 2:
|
|
208
|
-
_this2$props = _this2.props, view = _this2$props.view, mediaProvider = _this2$props.mediaProvider, contextIdentifierProvider = _this2$props.contextIdentifierProvider;
|
|
209
|
-
mediaNodeUpdater = new MediaNodeUpdater({
|
|
210
|
-
view: view,
|
|
211
|
-
mediaProvider: mediaProvider,
|
|
212
|
-
contextIdentifierProvider: contextIdentifierProvider,
|
|
213
|
-
node: node,
|
|
214
|
-
isMediaSingle: false
|
|
215
|
-
});
|
|
216
|
-
getPos = function getPos() {
|
|
217
|
-
var pos = _this2.props.getPos();
|
|
218
|
-
if (typeof pos !== 'number') {
|
|
219
|
-
// That may seems weird, but the previous type wasn't match with the real ProseMirror code. And a lot of Media API was built expecting a number
|
|
220
|
-
// Because the original code would return NaN on runtime
|
|
221
|
-
// We are just make it explict now.
|
|
222
|
-
// We may run a deep investagation on Media code to figure out a better fix. But, for now, we want to keep the current behavior.
|
|
223
|
-
// TODO: ED-13910 - prosemirror-bump leftovers
|
|
224
|
-
return NaN;
|
|
225
|
-
}
|
|
226
|
-
return pos + 1;
|
|
227
|
-
};
|
|
228
|
-
contextId = mediaNodeUpdater.getNodeContextId();
|
|
229
|
-
if (contextId) {
|
|
230
|
-
_context.next = 9;
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
_context.next = 9;
|
|
234
|
-
return mediaNodeUpdater.updateNodeContextId(getPos);
|
|
235
|
-
case 9:
|
|
236
|
-
_context.next = 11;
|
|
237
|
-
return mediaNodeUpdater.shouldNodeBeDeepCopied();
|
|
238
|
-
case 11:
|
|
239
|
-
shouldNodeBeDeepCopied = _context.sent;
|
|
240
|
-
if (!shouldNodeBeDeepCopied) {
|
|
241
|
-
_context.next = 15;
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
_context.next = 15;
|
|
245
|
-
return mediaNodeUpdater.copyNodeFromPos(getPos, {
|
|
246
|
-
traceId: node.attrs.__mediaTraceId
|
|
247
|
-
});
|
|
248
|
-
case 15:
|
|
249
|
-
case "end":
|
|
250
|
-
return _context.stop();
|
|
251
|
-
}
|
|
252
|
-
}, _callee);
|
|
253
|
-
}));
|
|
254
|
-
return function (_x) {
|
|
255
|
-
return _ref.apply(this, arguments);
|
|
256
|
-
};
|
|
257
|
-
}());
|
|
258
|
-
}
|
|
259
|
-
}, {
|
|
260
|
-
key: "componentWillUnmount",
|
|
261
|
-
value: function componentWillUnmount() {
|
|
262
|
-
var _this$mediaPluginStat2;
|
|
263
|
-
(_this$mediaPluginStat2 = this.mediaPluginState) === null || _this$mediaPluginStat2 === void 0 || _this$mediaPluginStat2.handleMediaGroupUpdate(this.mediaNodes, []);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// Ignored via go/ees005
|
|
267
|
-
// eslint-disable-next-line react/no-unsafe
|
|
268
|
-
}, {
|
|
269
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
270
|
-
value: function UNSAFE_componentWillReceiveProps(props) {
|
|
271
|
-
this.updateMediaClientConfig();
|
|
272
|
-
this.setMediaItems(props, props.isCopyPasteEnabled || props.isCopyPasteEnabled === undefined);
|
|
273
|
-
}
|
|
274
|
-
}, {
|
|
275
|
-
key: "shouldComponentUpdate",
|
|
276
|
-
value: function shouldComponentUpdate(nextProps) {
|
|
277
|
-
var _this$mediaPluginStat3;
|
|
278
|
-
if (hasSelectionChanged(this.props, nextProps) || this.props.node !== nextProps.node || this.state.viewMediaClientConfig !== ((_this$mediaPluginStat3 = this.mediaPluginState) === null || _this$mediaPluginStat3 === void 0 ? void 0 : _this$mediaPluginStat3.mediaClientConfig)) {
|
|
279
|
-
return true;
|
|
280
|
-
}
|
|
281
|
-
return false;
|
|
282
|
-
}
|
|
283
|
-
}, {
|
|
284
|
-
key: "updateMediaClientConfig",
|
|
285
|
-
value: function updateMediaClientConfig() {
|
|
286
|
-
var viewMediaClientConfig = this.state.viewMediaClientConfig;
|
|
287
|
-
var _ref2 = this.mediaPluginState || {},
|
|
288
|
-
mediaClientConfig = _ref2.mediaClientConfig;
|
|
289
|
-
if (!viewMediaClientConfig && mediaClientConfig) {
|
|
290
|
-
this.setState({
|
|
291
|
-
viewMediaClientConfig: mediaClientConfig
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}, {
|
|
296
|
-
key: "render",
|
|
297
|
-
value: function render() {
|
|
298
|
-
return this.renderChildNodes();
|
|
299
|
-
}
|
|
300
|
-
}]);
|
|
301
|
-
}(React.Component);
|
|
302
|
-
_defineProperty(MediaGroup, "displayName", 'MediaGroup');
|
|
303
|
-
var IntlMediaGroup = injectIntl(MediaGroup);
|
|
304
|
-
export default IntlMediaGroup;
|
|
305
15
|
var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
|
|
306
16
|
var editorDisabled = useSharedPluginStateSelector(pluginInjectionApi, 'editorDisabled.editorDisabled');
|
|
307
17
|
var editorViewMode = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
|
|
@@ -318,9 +28,9 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInject
|
|
|
318
28
|
editorViewMode: editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode
|
|
319
29
|
};
|
|
320
30
|
});
|
|
321
|
-
function MediaGroupNodeViewInternal(
|
|
322
|
-
var renderFn =
|
|
323
|
-
pluginInjectionApi =
|
|
31
|
+
function MediaGroupNodeViewInternal(_ref) {
|
|
32
|
+
var renderFn = _ref.renderFn,
|
|
33
|
+
pluginInjectionApi = _ref.pluginInjectionApi;
|
|
324
34
|
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
325
35
|
editorDisabled = _useSharedState.editorDisabled,
|
|
326
36
|
editorViewMode = _useSharedState.editorViewMode;
|
|
@@ -340,7 +50,7 @@ var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
340
50
|
return _createClass(MediaGroupNodeView, [{
|
|
341
51
|
key: "render",
|
|
342
52
|
value: function render(props, forwardRef) {
|
|
343
|
-
var
|
|
53
|
+
var _this = this;
|
|
344
54
|
var providerFactory = props.providerFactory,
|
|
345
55
|
mediaOptions = props.mediaOptions,
|
|
346
56
|
pluginInjectionApi = props.pluginInjectionApi;
|
|
@@ -348,45 +58,28 @@ var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
348
58
|
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
349
59
|
providers: ['contextIdentifierProvider'],
|
|
350
60
|
providerFactory: providerFactory,
|
|
351
|
-
renderNode: function renderNode(
|
|
352
|
-
var contextIdentifierProvider =
|
|
353
|
-
var renderFn = function renderFn(
|
|
354
|
-
var mediaProviderFromState =
|
|
355
|
-
editorDisabled =
|
|
356
|
-
editorViewMode =
|
|
61
|
+
renderNode: function renderNode(_ref2) {
|
|
62
|
+
var contextIdentifierProvider = _ref2.contextIdentifierProvider;
|
|
63
|
+
var renderFn = function renderFn(_ref3) {
|
|
64
|
+
var mediaProviderFromState = _ref3.mediaProvider,
|
|
65
|
+
editorDisabled = _ref3.editorDisabled,
|
|
66
|
+
editorViewMode = _ref3.editorViewMode;
|
|
357
67
|
var mediaProvider = mediaProviderFromState ? Promise.resolve(mediaProviderFromState) : undefined;
|
|
358
68
|
if (!mediaProvider) {
|
|
359
69
|
return null;
|
|
360
70
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
node: _this3.node,
|
|
364
|
-
getPos: getPos,
|
|
365
|
-
view: _this3.view,
|
|
366
|
-
forwardRef: forwardRef,
|
|
367
|
-
disabled: editorDisabled,
|
|
368
|
-
allowLazyLoading: mediaOptions.allowLazyLoading,
|
|
369
|
-
mediaProvider: mediaProvider,
|
|
370
|
-
contextIdentifierProvider: contextIdentifierProvider,
|
|
371
|
-
isCopyPasteEnabled: mediaOptions.isCopyPasteEnabled,
|
|
372
|
-
anchorPos: _this3.view.state.selection.$anchor.pos,
|
|
373
|
-
headPos: _this3.view.state.selection.$head.pos,
|
|
374
|
-
mediaOptions: mediaOptions,
|
|
375
|
-
editorViewMode: editorViewMode === 'view'
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
return /*#__PURE__*/React.createElement(IntlMediaGroup, {
|
|
379
|
-
node: _this3.node,
|
|
71
|
+
return /*#__PURE__*/React.createElement(MediaGroupNext, {
|
|
72
|
+
node: _this.node,
|
|
380
73
|
getPos: getPos,
|
|
381
|
-
view:
|
|
74
|
+
view: _this.view,
|
|
382
75
|
forwardRef: forwardRef,
|
|
383
76
|
disabled: editorDisabled,
|
|
384
77
|
allowLazyLoading: mediaOptions.allowLazyLoading,
|
|
385
78
|
mediaProvider: mediaProvider,
|
|
386
79
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
387
80
|
isCopyPasteEnabled: mediaOptions.isCopyPasteEnabled,
|
|
388
|
-
anchorPos:
|
|
389
|
-
headPos:
|
|
81
|
+
anchorPos: _this.view.state.selection.$anchor.pos,
|
|
82
|
+
headPos: _this.view.state.selection.$head.pos,
|
|
390
83
|
mediaOptions: mediaOptions,
|
|
391
84
|
editorViewMode: editorViewMode === 'view'
|
|
392
85
|
});
|