@atlaskit/editor-plugin-media 1.29.3 → 1.29.5
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 +18 -0
- package/dist/cjs/nodeviews/mediaGroup.js +4 -29
- package/dist/cjs/nodeviews/mediaInline.js +7 -32
- package/dist/cjs/nodeviews/mediaNodeView/index.js +8 -13
- package/dist/cjs/nodeviews/mediaSingle.js +5 -11
- package/dist/cjs/plugin.js +0 -6
- package/dist/cjs/pm-plugins/alt-text/commands.js +2 -2
- package/dist/cjs/pm-plugins/alt-text/index.js +2 -2
- package/dist/cjs/pm-plugins/keymap.js +0 -1
- package/dist/cjs/pm-plugins/main.js +3 -10
- package/dist/cjs/toolbar/alt-text.js +2 -2
- package/dist/cjs/toolbar/mediaInline.js +2 -2
- package/dist/cjs/toolbar/utils.js +2 -2
- package/dist/cjs/ui/MediaLinkingToolbar.js +2 -2
- package/dist/cjs/ui/MediaPicker/PickerFacadeProvider.js +2 -148
- package/dist/cjs/ui/MediaViewer/MediaViewerContainer.js +3 -3
- package/dist/cjs/utils/media-common.js +3 -3
- package/dist/cjs/utils/media-single.js +2 -12
- package/dist/es2019/nodeviews/mediaGroup.js +3 -28
- package/dist/es2019/nodeviews/mediaInline.js +6 -31
- package/dist/es2019/nodeviews/mediaNodeView/index.js +7 -12
- package/dist/es2019/nodeviews/mediaSingle.js +4 -10
- package/dist/es2019/plugin.js +0 -1
- package/dist/es2019/pm-plugins/alt-text/commands.js +1 -1
- package/dist/es2019/pm-plugins/alt-text/index.js +1 -1
- package/dist/es2019/pm-plugins/keymap.js +1 -1
- package/dist/es2019/pm-plugins/main.js +3 -8
- package/dist/es2019/toolbar/alt-text.js +1 -1
- package/dist/es2019/toolbar/mediaInline.js +1 -1
- package/dist/es2019/toolbar/utils.js +1 -1
- package/dist/es2019/ui/MediaLinkingToolbar.js +1 -1
- package/dist/es2019/ui/MediaPicker/PickerFacadeProvider.js +2 -88
- package/dist/es2019/ui/MediaViewer/MediaViewerContainer.js +3 -3
- package/dist/es2019/utils/media-common.js +2 -2
- package/dist/es2019/utils/media-single.js +1 -11
- package/dist/esm/nodeviews/mediaGroup.js +4 -29
- package/dist/esm/nodeviews/mediaInline.js +6 -31
- package/dist/esm/nodeviews/mediaNodeView/index.js +8 -13
- package/dist/esm/nodeviews/mediaSingle.js +5 -11
- package/dist/esm/plugin.js +0 -1
- package/dist/esm/pm-plugins/alt-text/commands.js +1 -1
- package/dist/esm/pm-plugins/alt-text/index.js +1 -1
- package/dist/esm/pm-plugins/keymap.js +1 -1
- package/dist/esm/pm-plugins/main.js +3 -10
- package/dist/esm/toolbar/alt-text.js +1 -1
- package/dist/esm/toolbar/mediaInline.js +1 -1
- package/dist/esm/toolbar/utils.js +1 -1
- package/dist/esm/ui/MediaLinkingToolbar.js +1 -1
- package/dist/esm/ui/MediaPicker/PickerFacadeProvider.js +2 -145
- package/dist/esm/ui/MediaViewer/MediaViewerContainer.js +3 -3
- package/dist/esm/utils/media-common.js +2 -2
- package/dist/esm/utils/media-single.js +1 -9
- package/dist/types/nodeviews/mediaGroup.d.ts +1 -5
- package/dist/types/nodeviews/mediaInline.d.ts +2 -10
- package/dist/types/nodeviews/mediaNodeUpdater.d.ts +2 -1
- package/dist/types/nodeviews/mediaNodeView/index.d.ts +3 -3
- package/dist/types/nodeviews/mediaSingle.d.ts +1 -1
- package/dist/types/picker-facade.d.ts +4 -8
- package/dist/types/plugin.d.ts +0 -5
- package/dist/types/pm-plugins/alt-text/commands.d.ts +0 -2
- package/dist/types/pm-plugins/alt-text/index.d.ts +0 -2
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/pm-plugins/linking/actions.d.ts +5 -4
- package/dist/types/pm-plugins/main.d.ts +2 -2
- package/dist/types/toolbar/alt-text.d.ts +3 -3
- package/dist/types/toolbar/mediaInline.d.ts +0 -3
- package/dist/types/toolbar/utils.d.ts +0 -1
- package/dist/types/ui/Media/DropPlaceholder.d.ts +1 -1
- package/dist/types/ui/MediaLinkingToolbar.d.ts +2 -2
- package/dist/types/ui/MediaPicker/PickerFacadeProvider.d.ts +4 -3
- package/dist/types/ui/MediaViewer/MediaViewerContainer.d.ts +0 -1
- package/dist/types/ui/PixelEntry/types.d.ts +2 -1
- package/dist/types/ui/ToolbarMedia/index.d.ts +1 -1
- package/dist/types/utils/media-common.d.ts +0 -2
- package/dist/types/utils/media-files.d.ts +0 -4
- package/dist/types/utils/media-inline.d.ts +2 -1
- package/dist/types/utils/media-single.d.ts +0 -10
- package/dist/types-ts4.5/nodeviews/mediaGroup.d.ts +1 -5
- package/dist/types-ts4.5/nodeviews/mediaInline.d.ts +2 -10
- package/dist/types-ts4.5/nodeviews/mediaNodeUpdater.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/mediaNodeView/index.d.ts +3 -3
- package/dist/types-ts4.5/nodeviews/mediaSingle.d.ts +1 -1
- package/dist/types-ts4.5/picker-facade.d.ts +4 -8
- package/dist/types-ts4.5/plugin.d.ts +0 -5
- package/dist/types-ts4.5/pm-plugins/alt-text/commands.d.ts +0 -2
- package/dist/types-ts4.5/pm-plugins/alt-text/index.d.ts +0 -2
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/linking/actions.d.ts +5 -4
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -2
- package/dist/types-ts4.5/toolbar/alt-text.d.ts +3 -3
- package/dist/types-ts4.5/toolbar/mediaInline.d.ts +0 -3
- package/dist/types-ts4.5/toolbar/utils.d.ts +0 -1
- package/dist/types-ts4.5/ui/Media/DropPlaceholder.d.ts +1 -1
- package/dist/types-ts4.5/ui/MediaLinkingToolbar.d.ts +2 -2
- package/dist/types-ts4.5/ui/MediaPicker/PickerFacadeProvider.d.ts +4 -3
- package/dist/types-ts4.5/ui/MediaViewer/MediaViewerContainer.d.ts +0 -1
- package/dist/types-ts4.5/ui/PixelEntry/types.d.ts +2 -1
- package/dist/types-ts4.5/ui/ToolbarMedia/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/media-common.d.ts +0 -2
- package/dist/types-ts4.5/utils/media-files.d.ts +0 -4
- package/dist/types-ts4.5/utils/media-inline.d.ts +2 -1
- package/dist/types-ts4.5/utils/media-single.d.ts +0 -10
- package/package.json +2 -5
- package/dist/cjs/commands/index.js +0 -24
- package/dist/es2019/commands/index.js +0 -1
- package/dist/esm/commands/index.js +0 -1
- package/dist/types/commands/index.d.ts +0 -1
- package/dist/types-ts4.5/commands/index.d.ts +0 -1
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.MediaViewerContainer = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
@@ -25,7 +25,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
25
25
|
var interactiveStyles = (0, _react2.css)({
|
|
26
26
|
cursor: 'pointer'
|
|
27
27
|
});
|
|
28
|
-
var mediaViewerContainerTestID =
|
|
28
|
+
var mediaViewerContainerTestID = 'media-viewer-container-test';
|
|
29
29
|
var MediaViewerContainer = exports.MediaViewerContainer = function MediaViewerContainer(_ref) {
|
|
30
30
|
var _mediaNode$firstChild;
|
|
31
31
|
var mediaNode = _ref.mediaNode,
|
|
@@ -53,7 +53,7 @@ var MediaViewerContainer = exports.MediaViewerContainer = function MediaViewerCo
|
|
|
53
53
|
setShowMediaViewer(false);
|
|
54
54
|
};
|
|
55
55
|
var isVideoMedia = (0, _isType.isVideo)((_mediaNode$firstChild = mediaNode.firstChild) === null || _mediaNode$firstChild === void 0 ? void 0 : _mediaNode$firstChild.attrs.__fileMimeType);
|
|
56
|
-
var enableMediaViewer = (0, _platformFeatureFlags.
|
|
56
|
+
var enableMediaViewer = (0, _platformFeatureFlags.fg)('platform.editor.media.preview-in-full-page') && isEditorViewMode;
|
|
57
57
|
var shouldShowViewer = enableMediaViewer && showViewer && selectedNodeAttrs && mediaClientConfig && !isVideoMedia;
|
|
58
58
|
return (0, _react2.jsx)(_react.Fragment, null, enableMediaViewer ? (0, _react2.jsx)(_react.Fragment, null, isInline ? (0, _react2.jsx)("span", {
|
|
59
59
|
onClick: showMediaViewer,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.splitMediaGroup = exports.removeMediaNode = exports.posOfPrecedingMediaGroup = exports.posOfParentMediaGroup = exports.posOfMediaGroupNearby = exports.isSelectionNonMediaBlockNode = exports.isSelectionMediaSingleNode = exports.
|
|
6
|
+
exports.splitMediaGroup = exports.removeMediaNode = exports.posOfPrecedingMediaGroup = exports.posOfParentMediaGroup = exports.posOfMediaGroupNearby = exports.isSelectionNonMediaBlockNode = exports.isSelectionMediaSingleNode = exports.isMediaSingleOrInlineNodeSelected = exports.isMediaBlobUrlFromAttrs = exports.isInsidePotentialEmptyParagraph = exports.getMediaSingleOrInlineNodeFromSelection = exports.getMediaNodeFromSelection = exports.copyOptionalAttrsFromMediaState = void 0;
|
|
7
7
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
8
8
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
9
|
var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
@@ -30,7 +30,7 @@ var isSelectionMediaSingleNode = exports.isSelectionMediaSingleNode = function i
|
|
|
30
30
|
node = _ref2.node;
|
|
31
31
|
return node && node.type === state.schema.nodes.mediaSingle;
|
|
32
32
|
};
|
|
33
|
-
var isSelectionMediaInlineNode =
|
|
33
|
+
var isSelectionMediaInlineNode = function isSelectionMediaInlineNode(state) {
|
|
34
34
|
var _ref3 = state.selection,
|
|
35
35
|
node = _ref3.node;
|
|
36
36
|
return node && node.type === state.schema.nodes.mediaInline;
|
|
@@ -185,7 +185,7 @@ var getMediaNodeFromSelection = exports.getMediaNodeFromSelection = function get
|
|
|
185
185
|
}
|
|
186
186
|
return null;
|
|
187
187
|
};
|
|
188
|
-
var getMediaInlineNodeFromSelection =
|
|
188
|
+
var getMediaInlineNodeFromSelection = function getMediaInlineNodeFromSelection(state) {
|
|
189
189
|
if (!isSelectionMediaInlineNode(state)) {
|
|
190
190
|
return null;
|
|
191
191
|
}
|
|
@@ -4,9 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
8
|
-
exports.isCaptionNode = isCaptionNode;
|
|
9
|
-
exports.isVideo = exports.isMediaSingle = void 0;
|
|
7
|
+
exports.isVideo = exports.isMediaSingle = exports.insertMediaSingleNode = exports.insertMediaAsMediaSingle = exports.changeFromMediaInlineToMediaSingleNode = void 0;
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
9
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
12
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
@@ -198,7 +196,7 @@ var changeFromMediaInlineToMediaSingleNode = exports.changeFromMediaInlineToMedi
|
|
|
198
196
|
}
|
|
199
197
|
return true;
|
|
200
198
|
};
|
|
201
|
-
var createMediaSingleNode =
|
|
199
|
+
var createMediaSingleNode = function createMediaSingleNode(schema, collection, maxWidth, minWidth, alignLeftOnInsert) {
|
|
202
200
|
return function (mediaState) {
|
|
203
201
|
var id = mediaState.id,
|
|
204
202
|
dimensions = mediaState.dimensions,
|
|
@@ -254,14 +252,6 @@ var replaceWithMediaSingleNode = function replaceWithMediaSingleNode(schema, max
|
|
|
254
252
|
return mediaSingle.createChecked(extendedMediaSingleAttrs, copiedMediaNode);
|
|
255
253
|
};
|
|
256
254
|
};
|
|
257
|
-
function isCaptionNode(editorView) {
|
|
258
|
-
var $from = editorView.state.selection.$from;
|
|
259
|
-
var immediateWrapperParentNode = editorView.state.doc.nodeAt($from.before(Math.max($from.depth, 1)));
|
|
260
|
-
if (immediateWrapperParentNode && immediateWrapperParentNode.type.name === 'caption') {
|
|
261
|
-
return true;
|
|
262
|
-
}
|
|
263
|
-
return false;
|
|
264
|
-
}
|
|
265
255
|
var isVideo = exports.isVideo = (0, _memoizeOne.default)(function (fileType) {
|
|
266
256
|
return !!fileType && fileType.includes('video');
|
|
267
257
|
});
|
|
@@ -9,7 +9,6 @@ import { isNodeSelectedOrInRange, SelectedState, setNodeSelection } from '@atlas
|
|
|
9
9
|
import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
|
|
10
10
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
11
11
|
import { Filmstrip } from '@atlaskit/media-filmstrip';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { useMediaProvider } from '../hooks/useMediaProvider';
|
|
14
13
|
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
15
14
|
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
@@ -276,14 +275,10 @@ class MediaGroupNodeView extends ReactNodeView {
|
|
|
276
275
|
pluginInjectionApi
|
|
277
276
|
} = props;
|
|
278
277
|
const getPos = this.getPos;
|
|
279
|
-
return /*#__PURE__*/React.createElement(WithProviders
|
|
280
|
-
|
|
281
|
-
// Remove `mediaProvider`
|
|
282
|
-
, {
|
|
283
|
-
providers: ['mediaProvider', 'contextIdentifierProvider'],
|
|
278
|
+
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
279
|
+
providers: ['contextIdentifierProvider'],
|
|
284
280
|
providerFactory: providerFactory,
|
|
285
281
|
renderNode: ({
|
|
286
|
-
mediaProvider,
|
|
287
282
|
contextIdentifierProvider
|
|
288
283
|
}) => {
|
|
289
284
|
const renderFn = ({
|
|
@@ -291,27 +286,7 @@ class MediaGroupNodeView extends ReactNodeView {
|
|
|
291
286
|
editorViewModePlugin,
|
|
292
287
|
mediaProvider: mediaProviderFromState
|
|
293
288
|
}) => {
|
|
294
|
-
|
|
295
|
-
const newMediaProvider = mediaProviderFromState ? Promise.resolve(mediaProviderFromState) : undefined;
|
|
296
|
-
if (!newMediaProvider) {
|
|
297
|
-
return null;
|
|
298
|
-
}
|
|
299
|
-
return /*#__PURE__*/React.createElement(IntlMediaGroup, {
|
|
300
|
-
node: this.node,
|
|
301
|
-
getPos: getPos,
|
|
302
|
-
view: this.view,
|
|
303
|
-
forwardRef: forwardRef,
|
|
304
|
-
disabled: (editorDisabledPlugin || {}).editorDisabled,
|
|
305
|
-
allowLazyLoading: mediaOptions.allowLazyLoading,
|
|
306
|
-
mediaProvider: newMediaProvider,
|
|
307
|
-
contextIdentifierProvider: contextIdentifierProvider,
|
|
308
|
-
isCopyPasteEnabled: mediaOptions.isCopyPasteEnabled,
|
|
309
|
-
anchorPos: this.view.state.selection.$anchor.pos,
|
|
310
|
-
headPos: this.view.state.selection.$head.pos,
|
|
311
|
-
mediaOptions: mediaOptions,
|
|
312
|
-
editorViewMode: (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view'
|
|
313
|
-
});
|
|
314
|
-
}
|
|
289
|
+
const mediaProvider = mediaProviderFromState ? Promise.resolve(mediaProviderFromState) : undefined;
|
|
315
290
|
if (!mediaProvider) {
|
|
316
291
|
return null;
|
|
317
292
|
}
|
|
@@ -13,11 +13,10 @@ import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-
|
|
|
13
13
|
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
14
14
|
import { getMediaClient } from '@atlaskit/media-client-react';
|
|
15
15
|
import { MediaInlineCardLoadingView } from '@atlaskit/media-ui';
|
|
16
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
16
|
import { MediaViewerContainer } from '../ui/MediaViewer/MediaViewerContainer';
|
|
18
17
|
import { isImage } from '../utils/is-type';
|
|
19
18
|
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
20
|
-
|
|
19
|
+
const createMediaNodeUpdater = props => {
|
|
21
20
|
const node = props.node;
|
|
22
21
|
return new MediaNodeUpdater({
|
|
23
22
|
...props,
|
|
@@ -34,7 +33,7 @@ export const createMediaNodeUpdater = props => {
|
|
|
34
33
|
* using the contextid
|
|
35
34
|
*
|
|
36
35
|
*/
|
|
37
|
-
|
|
36
|
+
const updateMediaNodeAttributes = async (props, mediaNodeUpdater) => {
|
|
38
37
|
const {
|
|
39
38
|
addPendingTask
|
|
40
39
|
} = props.mediaPluginState;
|
|
@@ -151,7 +150,6 @@ export const MediaInline = props => {
|
|
|
151
150
|
};
|
|
152
151
|
const MediaInlineSharedState = ({
|
|
153
152
|
identifier,
|
|
154
|
-
mediaProvider,
|
|
155
153
|
node,
|
|
156
154
|
isSelected,
|
|
157
155
|
getPos,
|
|
@@ -164,28 +162,12 @@ const MediaInlineSharedState = ({
|
|
|
164
162
|
mediaState
|
|
165
163
|
} = useSharedPluginState(api, ['editorViewMode', 'media']);
|
|
166
164
|
const newMediaProvider = useMemo(() => mediaState !== null && mediaState !== void 0 && mediaState.mediaProvider ? Promise.resolve(mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider) : undefined, [mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider]);
|
|
167
|
-
if (
|
|
168
|
-
if (!mediaState || !newMediaProvider) {
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
171
|
-
return jsx(MediaInline, {
|
|
172
|
-
identifier: identifier,
|
|
173
|
-
mediaProvider: newMediaProvider,
|
|
174
|
-
mediaPluginState: mediaState,
|
|
175
|
-
node: node,
|
|
176
|
-
isSelected: isSelected,
|
|
177
|
-
view: view,
|
|
178
|
-
getPos: getPos,
|
|
179
|
-
contextIdentifierProvider: contextIdentifierProvider,
|
|
180
|
-
editorViewMode: (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view'
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
if (!mediaState || !mediaProvider) {
|
|
165
|
+
if (!mediaState || !newMediaProvider) {
|
|
184
166
|
return null;
|
|
185
167
|
}
|
|
186
168
|
return jsx(MediaInline, {
|
|
187
169
|
identifier: identifier,
|
|
188
|
-
mediaProvider:
|
|
170
|
+
mediaProvider: newMediaProvider,
|
|
189
171
|
mediaPluginState: mediaState,
|
|
190
172
|
node: node,
|
|
191
173
|
isSelected: isSelected,
|
|
@@ -219,22 +201,15 @@ export class MediaInlineNodeView extends SelectionBasedNodeView {
|
|
|
219
201
|
view
|
|
220
202
|
} = this;
|
|
221
203
|
const getPos = this.getPos;
|
|
222
|
-
return jsx(WithProviders
|
|
223
|
-
|
|
224
|
-
// Remove `mediaProvider`
|
|
225
|
-
, {
|
|
226
|
-
providers: ['mediaProvider', 'contextIdentifierProvider'],
|
|
204
|
+
return jsx(WithProviders, {
|
|
205
|
+
providers: ['contextIdentifierProvider'],
|
|
227
206
|
providerFactory: providerFactory,
|
|
228
207
|
renderNode: ({
|
|
229
208
|
mediaProvider,
|
|
230
209
|
contextIdentifierProvider
|
|
231
210
|
}) => {
|
|
232
|
-
if (!mediaProvider && !fg('platform_editor_media_provider_from_plugin_config')) {
|
|
233
|
-
return null;
|
|
234
|
-
}
|
|
235
211
|
return jsx(MediaInlineSharedState, {
|
|
236
212
|
identifier: this.node.attrs.id,
|
|
237
|
-
mediaProvider: mediaProvider,
|
|
238
213
|
node: this.node,
|
|
239
214
|
isSelected: this.nodeInsideSelection(),
|
|
240
215
|
view: view,
|
|
@@ -5,7 +5,6 @@ import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-comm
|
|
|
5
5
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
7
7
|
import { getAttrsFromUrl } from '@atlaskit/media-client';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { updateCurrentMediaNodeAttrs } from '../../commands/helpers';
|
|
10
9
|
import { isMediaBlobUrlFromAttrs } from '../../utils/media-common';
|
|
11
10
|
import MediaNode from './media';
|
|
@@ -19,7 +18,7 @@ const MediaNodeWithProviders = ({
|
|
|
19
18
|
} = useSharedPluginState(pluginInjectionApi, ['width', 'media']);
|
|
20
19
|
return innerComponent({
|
|
21
20
|
width: widthState,
|
|
22
|
-
|
|
21
|
+
mediaProvider: mediaState !== null && mediaState !== void 0 && mediaState.mediaProvider ? Promise.resolve(mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider) : undefined
|
|
23
22
|
});
|
|
24
23
|
};
|
|
25
24
|
function isMediaDecorationSpec(decoration) {
|
|
@@ -47,10 +46,10 @@ class MediaNodeView extends SelectionBasedNodeView {
|
|
|
47
46
|
})(this.view.state, this.view.dispatch);
|
|
48
47
|
}
|
|
49
48
|
});
|
|
50
|
-
_defineProperty(this, "renderMediaNodeWithState",
|
|
49
|
+
_defineProperty(this, "renderMediaNodeWithState", contextIdentifierProvider => {
|
|
51
50
|
return ({
|
|
52
51
|
width: editorWidth,
|
|
53
|
-
|
|
52
|
+
mediaProvider
|
|
54
53
|
}) => {
|
|
55
54
|
const getPos = this.getPos;
|
|
56
55
|
const {
|
|
@@ -93,7 +92,7 @@ class MediaNodeView extends SelectionBasedNodeView {
|
|
|
93
92
|
originalDimensions: originalDimensions,
|
|
94
93
|
maxDimensions: maxDimensions,
|
|
95
94
|
url: url,
|
|
96
|
-
mediaProvider:
|
|
95
|
+
mediaProvider: mediaProvider,
|
|
97
96
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
98
97
|
mediaOptions: mediaOptions,
|
|
99
98
|
onExternalImageLoaded: this.onExternalImageLoaded
|
|
@@ -101,7 +100,6 @@ class MediaNodeView extends SelectionBasedNodeView {
|
|
|
101
100
|
};
|
|
102
101
|
});
|
|
103
102
|
_defineProperty(this, "renderMediaNodeWithProviders", ({
|
|
104
|
-
mediaProvider,
|
|
105
103
|
contextIdentifierProvider
|
|
106
104
|
}) => {
|
|
107
105
|
const {
|
|
@@ -109,7 +107,7 @@ class MediaNodeView extends SelectionBasedNodeView {
|
|
|
109
107
|
} = this.reactComponentProps;
|
|
110
108
|
return /*#__PURE__*/React.createElement(MediaNodeWithProviders, {
|
|
111
109
|
pluginInjectionApi: pluginInjectionApi,
|
|
112
|
-
innerComponent: this.renderMediaNodeWithState(
|
|
110
|
+
innerComponent: this.renderMediaNodeWithState(contextIdentifierProvider)
|
|
113
111
|
});
|
|
114
112
|
});
|
|
115
113
|
}
|
|
@@ -157,11 +155,8 @@ class MediaNodeView extends SelectionBasedNodeView {
|
|
|
157
155
|
const {
|
|
158
156
|
providerFactory
|
|
159
157
|
} = this.reactComponentProps;
|
|
160
|
-
return /*#__PURE__*/React.createElement(WithProviders
|
|
161
|
-
|
|
162
|
-
// Remove `mediaProvider`
|
|
163
|
-
, {
|
|
164
|
-
providers: ['mediaProvider', 'contextIdentifierProvider'],
|
|
158
|
+
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
159
|
+
providers: ['contextIdentifierProvider'],
|
|
165
160
|
providerFactory: providerFactory,
|
|
166
161
|
renderNode: this.renderMediaNodeWithProviders
|
|
167
162
|
});
|
|
@@ -452,7 +452,6 @@ _defineProperty(MediaSingleNode, "defaultProps", {
|
|
|
452
452
|
_defineProperty(MediaSingleNode, "displayName", 'MediaSingleNode');
|
|
453
453
|
const MediaSingleNodeWrapper = ({
|
|
454
454
|
pluginInjectionApi,
|
|
455
|
-
mediaProvider,
|
|
456
455
|
contextIdentifierProvider,
|
|
457
456
|
node,
|
|
458
457
|
getPos,
|
|
@@ -472,13 +471,13 @@ const MediaSingleNodeWrapper = ({
|
|
|
472
471
|
editorDisabledState,
|
|
473
472
|
editorViewModeState
|
|
474
473
|
} = useSharedPluginState(pluginInjectionApi, ['width', 'media', 'annotation', 'editorDisabled', 'editorViewMode']);
|
|
475
|
-
const
|
|
474
|
+
const mediaProvider = useMemo(() => mediaState !== null && mediaState !== void 0 && mediaState.mediaProvider ? Promise.resolve(mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider) : undefined, [mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider]);
|
|
476
475
|
return jsx(MediaSingleNode, {
|
|
477
476
|
width: widthState.width,
|
|
478
477
|
lineLength: widthState.lineLength,
|
|
479
478
|
node: node,
|
|
480
479
|
getPos: getPos,
|
|
481
|
-
mediaProvider:
|
|
480
|
+
mediaProvider: mediaProvider,
|
|
482
481
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
483
482
|
mediaOptions: mediaOptions,
|
|
484
483
|
view: view,
|
|
@@ -596,19 +595,14 @@ class MediaSingleNodeView extends ReactNodeView {
|
|
|
596
595
|
|
|
597
596
|
// getPos is a boolean for marks, since this is a node we know it must be a function
|
|
598
597
|
const getPos = this.getPos;
|
|
599
|
-
return jsx(WithProviders
|
|
600
|
-
|
|
601
|
-
// Remove `mediaProvider`
|
|
602
|
-
, {
|
|
603
|
-
providers: ['mediaProvider', 'contextIdentifierProvider'],
|
|
598
|
+
return jsx(WithProviders, {
|
|
599
|
+
providers: ['contextIdentifierProvider'],
|
|
604
600
|
providerFactory: providerFactory,
|
|
605
601
|
renderNode: ({
|
|
606
|
-
mediaProvider,
|
|
607
602
|
contextIdentifierProvider
|
|
608
603
|
}) => {
|
|
609
604
|
return jsx(MediaSingleNodeWrapper, {
|
|
610
605
|
pluginInjectionApi: pluginInjectionApi,
|
|
611
|
-
mediaProvider: mediaProvider,
|
|
612
606
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
613
607
|
node: this.node,
|
|
614
608
|
getPos: getPos,
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -26,7 +26,6 @@ import { floatingToolbar } from './toolbar';
|
|
|
26
26
|
import { MediaPickerComponents } from './ui/MediaPicker';
|
|
27
27
|
import ToolbarMedia from './ui/ToolbarMedia';
|
|
28
28
|
import { insertMediaAsMediaSingle } from './utils/media-single';
|
|
29
|
-
export { insertMediaSingleNode } from './utils/media-single';
|
|
30
29
|
const MediaPickerFunctionalComponent = ({
|
|
31
30
|
api,
|
|
32
31
|
editorDomElement,
|
|
@@ -44,7 +44,7 @@ export const openMediaAltTextMenu = createCommandWithAnalytics(ACTION.OPENED, st
|
|
|
44
44
|
}
|
|
45
45
|
return false;
|
|
46
46
|
}, tr => tr.setMeta('scrollIntoView', false));
|
|
47
|
-
|
|
47
|
+
const updateAltTextTransform = newAltText => (tr, state) => {
|
|
48
48
|
const mediaNode = getMediaSingleOrInlineNodeFromSelection(state);
|
|
49
49
|
if (mediaNode) {
|
|
50
50
|
// mediaSingle or mediaInline
|
|
@@ -3,7 +3,7 @@ import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
|
3
3
|
import { pmHistoryPluginKey } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import reducer from './reducer';
|
|
6
|
-
|
|
6
|
+
const pluginKey = new PluginKey('mediaAltTextPlugin');
|
|
7
7
|
const {
|
|
8
8
|
createPluginState,
|
|
9
9
|
createCommand,
|
|
@@ -10,7 +10,7 @@ import { insertAndSelectCaptionFromMediaSinglePos, selectCaptionFromMediaSingleP
|
|
|
10
10
|
import { stateKey } from '../pm-plugins/plugin-key';
|
|
11
11
|
import { updateMediaSingleWidth } from '../toolbar/commands';
|
|
12
12
|
import { calcNewLayout, getSelectedMediaSingle } from '../toolbar/utils';
|
|
13
|
-
|
|
13
|
+
function keymapPlugin(options, editorAnalyticsAPI, editorSelectionAPI, widthPlugin, getIntl) {
|
|
14
14
|
const list = {};
|
|
15
15
|
bindKeymapWithCommand(undo.common, ignoreLinksInSteps, list);
|
|
16
16
|
if (options !== null && options !== void 0 && options.allowCaptions) {
|
|
@@ -14,7 +14,6 @@ import { findDomRefAtPos, findParentNodeOfType, findSelectedNodeOfType, isNodeSe
|
|
|
14
14
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
15
15
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
16
16
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
17
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
17
|
import * as helpers from '../commands/helpers';
|
|
19
18
|
import { updateMediaNodeAttrs } from '../commands/helpers';
|
|
20
19
|
import PickerFacade from '../picker-facade';
|
|
@@ -383,12 +382,8 @@ export class MediaPluginStateImplementation {
|
|
|
383
382
|
nodes
|
|
384
383
|
} = _state.schema;
|
|
385
384
|
assert(nodes.media && (nodes.mediaGroup || nodes.mediaSingle), 'Editor: unable to init media plugin - media or mediaGroup/mediaSingle node absent in schema');
|
|
386
|
-
if (
|
|
387
|
-
|
|
388
|
-
this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
|
|
389
|
-
}
|
|
390
|
-
} else {
|
|
391
|
-
options.providerFactory.subscribe('mediaProvider', (_name, provider) => this.setMediaProvider(provider));
|
|
385
|
+
if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.provider) {
|
|
386
|
+
this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
|
|
392
387
|
}
|
|
393
388
|
if (mediaInlineImagesEnabled(getMediaFeatureFlag('mediaInline', (_this$mediaOptions2 = this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags), (_this$mediaOptions3 = this.mediaOptions) === null || _this$mediaOptions3 === void 0 ? void 0 : _this$mediaOptions3.allowMediaInlineImages)) {
|
|
394
389
|
this.allowInlineImages = true;
|
|
@@ -637,7 +632,7 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, disp
|
|
|
637
632
|
pluginState.setIsResizing(isResizing);
|
|
638
633
|
nextPluginState = nextPluginState.clone();
|
|
639
634
|
}
|
|
640
|
-
if (mediaProvider
|
|
635
|
+
if (mediaProvider) {
|
|
641
636
|
pluginState.setMediaProvider(mediaProvider);
|
|
642
637
|
}
|
|
643
638
|
if (resizingWidth) {
|
|
@@ -103,7 +103,7 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
|
|
|
103
103
|
}];
|
|
104
104
|
return items;
|
|
105
105
|
};
|
|
106
|
-
|
|
106
|
+
const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState, options = {}) => {
|
|
107
107
|
var _pluginInjectionApi$w;
|
|
108
108
|
const {
|
|
109
109
|
mediaInline
|
|
@@ -5,7 +5,7 @@ import { findParentNodeOfType, findSelectedNodeOfType, removeParentNodeOfType, r
|
|
|
5
5
|
import { akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { getMediaClient } from '@atlaskit/media-client-react';
|
|
7
7
|
import { isVideo } from '../utils/media-single';
|
|
8
|
-
|
|
8
|
+
const getSelectedMediaContainerNodeAttrs = mediaPluginState => {
|
|
9
9
|
var _mediaPluginState$sel;
|
|
10
10
|
const selectedNode = (_mediaPluginState$sel = mediaPluginState.selectedMediaContainerNode) === null || _mediaPluginState$sel === void 0 ? void 0 : _mediaPluginState$sel.call(mediaPluginState);
|
|
11
11
|
if (selectedNode && selectedNode.attrs) {
|
|
@@ -33,7 +33,7 @@ const buttonWrapper = css({
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
36
|
-
|
|
36
|
+
class LinkAddToolbar extends React.PureComponent {
|
|
37
37
|
constructor(...args) {
|
|
38
38
|
super(...args);
|
|
39
39
|
_defineProperty(this, "state", {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
2
|
import { flushSync } from 'react-dom';
|
|
4
3
|
import { ErrorReporter } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
4
|
import PickerFacade from '../../picker-facade';
|
|
7
5
|
const dummyMediaPickerObject = {
|
|
8
6
|
on: () => {},
|
|
@@ -11,7 +9,7 @@ const dummyMediaPickerObject = {
|
|
|
11
9
|
destroy: () => {},
|
|
12
10
|
setUploadParams: () => {}
|
|
13
11
|
};
|
|
14
|
-
function
|
|
12
|
+
export default function PickerFacadeProvider({
|
|
15
13
|
mediaState,
|
|
16
14
|
analyticsName,
|
|
17
15
|
children
|
|
@@ -68,88 +66,4 @@ function PickerFacadeProviderNew({
|
|
|
68
66
|
config,
|
|
69
67
|
pickerFacadeInstance
|
|
70
68
|
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
74
|
-
class PickerFacadeProviderOld extends React.Component {
|
|
75
|
-
constructor(...args) {
|
|
76
|
-
super(...args);
|
|
77
|
-
_defineProperty(this, "state", {});
|
|
78
|
-
_defineProperty(this, "handleMediaProvider", async (_name, provider) => {
|
|
79
|
-
const {
|
|
80
|
-
mediaState,
|
|
81
|
-
analyticsName
|
|
82
|
-
} = this.props;
|
|
83
|
-
const mediaProvider = await provider;
|
|
84
|
-
if (!mediaProvider || !mediaProvider.uploadParams) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const resolvedMediaClientConfig = (await mediaProvider.uploadMediaClientConfig) || (await mediaProvider.viewMediaClientConfig);
|
|
88
|
-
if (!resolvedMediaClientConfig) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const pickerFacadeConfig = {
|
|
92
|
-
mediaClientConfig: resolvedMediaClientConfig,
|
|
93
|
-
errorReporter: mediaState.options.errorReporter || new ErrorReporter(),
|
|
94
|
-
featureFlags: mediaState.mediaOptions && mediaState.mediaOptions.featureFlags
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* As the first MediaPicker component to be migrated to React, we want to scope the amount of changes logic changed/moved on Editor side.
|
|
99
|
-
* To achieve this we agreed on using `PickerFacade` 'customMediaPicker' type, since we only need this instance to reuse the logic when we subscribe
|
|
100
|
-
* for all the different events in MediaPicker (onPreviewUpdate, onError, onProcessing, etc).
|
|
101
|
-
* The `dummyMediaPickerObject` provided here serves as a workaround for the old picker api that `PickerFacade` will try to use.
|
|
102
|
-
* But we don't want this to do anything since it's all part of the new React component (`Clipboard` component in this case).
|
|
103
|
-
* Eventually PickerFacade will be removed and replaced with a new abstraction explained here https://product-fabric.atlassian.net/browse/MS-1937
|
|
104
|
-
*/
|
|
105
|
-
const pickerFacadeInstance = await new PickerFacade('customMediaPicker', pickerFacadeConfig, dummyMediaPickerObject, analyticsName).init();
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Based on the `initPickers` method in `MediaPluginState` we need these 2 `onNewMedia` subscriptions.
|
|
109
|
-
* First one in order to trigger the entire process of uploading a file for when `onPreviewUpdate` is called
|
|
110
|
-
* Second one in order to track all analytics as before.
|
|
111
|
-
*/
|
|
112
|
-
pickerFacadeInstance.onNewMedia(mediaState.insertFile);
|
|
113
|
-
pickerFacadeInstance.setUploadParams(mediaProvider.uploadParams);
|
|
114
|
-
const config = {
|
|
115
|
-
uploadParams: mediaProvider.uploadParams
|
|
116
|
-
};
|
|
117
|
-
flushSync(() => this.setState({
|
|
118
|
-
pickerFacadeInstance,
|
|
119
|
-
config,
|
|
120
|
-
mediaClientConfig: resolvedMediaClientConfig
|
|
121
|
-
}));
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
componentDidMount() {
|
|
125
|
-
const {
|
|
126
|
-
mediaProvider
|
|
127
|
-
} = this.props.mediaState;
|
|
128
|
-
if (mediaProvider && fg('platform_editor_media_provider_from_plugin_config')) {
|
|
129
|
-
this.handleMediaProvider('mediaProvider', Promise.resolve(mediaProvider));
|
|
130
|
-
} else {
|
|
131
|
-
this.props.mediaState.options.providerFactory.subscribe('mediaProvider', this.handleMediaProvider);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
componentWillUnmount() {
|
|
135
|
-
this.props.mediaState.options.providerFactory.unsubscribe('mediaProvider', this.handleMediaProvider);
|
|
136
|
-
}
|
|
137
|
-
render() {
|
|
138
|
-
const {
|
|
139
|
-
mediaClientConfig,
|
|
140
|
-
config,
|
|
141
|
-
pickerFacadeInstance
|
|
142
|
-
} = this.state;
|
|
143
|
-
if (!mediaClientConfig || !config || !pickerFacadeInstance) {
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
return this.props.children({
|
|
147
|
-
mediaClientConfig,
|
|
148
|
-
config,
|
|
149
|
-
pickerFacadeInstance
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
export default function PickerFacadeProvider(props) {
|
|
154
|
-
return fg('platform_editor_media_provider_from_plugin_config') ? /*#__PURE__*/React.createElement(PickerFacadeProviderNew, props) : /*#__PURE__*/React.createElement(PickerFacadeProviderOld, props);
|
|
155
69
|
}
|
|
@@ -6,14 +6,14 @@ import React, { Fragment, useEffect, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
|
-
import {
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { getSelectedNearestMediaContainerNodeAttrs } from '../../toolbar/utils';
|
|
11
11
|
import { isVideo } from '../../utils/is-type';
|
|
12
12
|
import { RenderMediaViewer } from './PortalWrapper';
|
|
13
13
|
const interactiveStyles = css({
|
|
14
14
|
cursor: 'pointer'
|
|
15
15
|
});
|
|
16
|
-
|
|
16
|
+
const mediaViewerContainerTestID = 'media-viewer-container-test';
|
|
17
17
|
export const MediaViewerContainer = ({
|
|
18
18
|
mediaNode,
|
|
19
19
|
mediaPluginState,
|
|
@@ -36,7 +36,7 @@ export const MediaViewerContainer = ({
|
|
|
36
36
|
setShowMediaViewer(false);
|
|
37
37
|
};
|
|
38
38
|
const isVideoMedia = isVideo((_mediaNode$firstChild = mediaNode.firstChild) === null || _mediaNode$firstChild === void 0 ? void 0 : _mediaNode$firstChild.attrs.__fileMimeType);
|
|
39
|
-
const enableMediaViewer =
|
|
39
|
+
const enableMediaViewer = fg('platform.editor.media.preview-in-full-page') && isEditorViewMode;
|
|
40
40
|
const shouldShowViewer = enableMediaViewer && showViewer && selectedNodeAttrs && mediaClientConfig && !isVideoMedia;
|
|
41
41
|
return jsx(Fragment, null, enableMediaViewer ? jsx(Fragment, null, isInline ? jsx("span", {
|
|
42
42
|
onClick: showMediaViewer,
|
|
@@ -26,7 +26,7 @@ export const isSelectionMediaSingleNode = state => {
|
|
|
26
26
|
} = state.selection;
|
|
27
27
|
return node && node.type === state.schema.nodes.mediaSingle;
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
const isSelectionMediaInlineNode = state => {
|
|
30
30
|
const {
|
|
31
31
|
node
|
|
32
32
|
} = state.selection;
|
|
@@ -194,7 +194,7 @@ export const getMediaNodeFromSelection = state => {
|
|
|
194
194
|
}
|
|
195
195
|
return null;
|
|
196
196
|
};
|
|
197
|
-
|
|
197
|
+
const getMediaInlineNodeFromSelection = state => {
|
|
198
198
|
if (!isSelectionMediaInlineNode(state)) {
|
|
199
199
|
return null;
|
|
200
200
|
}
|
|
@@ -193,7 +193,7 @@ export const changeFromMediaInlineToMediaSingleNode = (view, fromNode, widthPlug
|
|
|
193
193
|
}
|
|
194
194
|
return true;
|
|
195
195
|
};
|
|
196
|
-
|
|
196
|
+
const createMediaSingleNode = (schema, collection, maxWidth, minWidth, alignLeftOnInsert) => mediaState => {
|
|
197
197
|
const {
|
|
198
198
|
id,
|
|
199
199
|
dimensions,
|
|
@@ -254,16 +254,6 @@ const replaceWithMediaSingleNode = (schema, maxWidth, minWidth) => mediaNode =>
|
|
|
254
254
|
} : {};
|
|
255
255
|
return mediaSingle.createChecked(extendedMediaSingleAttrs, copiedMediaNode);
|
|
256
256
|
};
|
|
257
|
-
export function isCaptionNode(editorView) {
|
|
258
|
-
const {
|
|
259
|
-
$from
|
|
260
|
-
} = editorView.state.selection;
|
|
261
|
-
const immediateWrapperParentNode = editorView.state.doc.nodeAt($from.before(Math.max($from.depth, 1)));
|
|
262
|
-
if (immediateWrapperParentNode && immediateWrapperParentNode.type.name === 'caption') {
|
|
263
|
-
return true;
|
|
264
|
-
}
|
|
265
|
-
return false;
|
|
266
|
-
}
|
|
267
257
|
export const isVideo = memoizeOne(fileType => {
|
|
268
258
|
return !!fileType && fileType.includes('video');
|
|
269
259
|
});
|