@atlaskit/editor-plugin-media 2.6.7 → 2.7.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 +23 -0
- package/dist/cjs/mediaPlugin.js +21 -6
- package/dist/cjs/nodeviews/mediaGroup.js +21 -6
- package/dist/cjs/nodeviews/mediaInline.js +55 -13
- package/dist/cjs/nodeviews/mediaNodeUpdater.js +24 -18
- package/dist/cjs/nodeviews/mediaNodeView/index.js +11 -3
- package/dist/cjs/nodeviews/mediaSingle.js +88 -49
- package/dist/cjs/nodeviews/mediaSingleNext.js +5 -4
- package/dist/cjs/pm-plugins/utils/media-files.js +64 -6
- package/dist/cjs/ui/CommentBadge/index.js +44 -14
- package/dist/cjs/ui/MediaPicker/index.js +15 -3
- package/dist/cjs/ui/MediaViewer/MediaViewerContainer.js +3 -3
- package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +2 -1
- package/dist/cjs/ui/ToolbarMedia/index.js +17 -5
- package/dist/cjs/ui/hooks/useMediaProvider.js +11 -3
- package/dist/cjs/ui/toolbar/utils.js +6 -4
- package/dist/es2019/mediaPlugin.js +21 -6
- package/dist/es2019/nodeviews/mediaGroup.js +21 -6
- package/dist/es2019/nodeviews/mediaInline.js +54 -12
- package/dist/es2019/nodeviews/mediaNodeUpdater.js +5 -1
- package/dist/es2019/nodeviews/mediaNodeView/index.js +11 -3
- package/dist/es2019/nodeviews/mediaSingle.js +60 -25
- package/dist/es2019/nodeviews/mediaSingleNext.js +5 -4
- package/dist/es2019/pm-plugins/utils/media-files.js +63 -5
- package/dist/es2019/ui/CommentBadge/index.js +40 -10
- package/dist/es2019/ui/MediaPicker/index.js +15 -3
- package/dist/es2019/ui/MediaViewer/MediaViewerContainer.js +4 -4
- package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +2 -1
- package/dist/es2019/ui/ToolbarMedia/index.js +17 -5
- package/dist/es2019/ui/hooks/useMediaProvider.js +11 -3
- package/dist/es2019/ui/toolbar/utils.js +5 -3
- package/dist/esm/mediaPlugin.js +21 -6
- package/dist/esm/nodeviews/mediaGroup.js +21 -6
- package/dist/esm/nodeviews/mediaInline.js +55 -13
- package/dist/esm/nodeviews/mediaNodeUpdater.js +24 -18
- package/dist/esm/nodeviews/mediaNodeView/index.js +11 -3
- package/dist/esm/nodeviews/mediaSingle.js +88 -49
- package/dist/esm/nodeviews/mediaSingleNext.js +5 -4
- package/dist/esm/pm-plugins/utils/media-files.js +63 -5
- package/dist/esm/ui/CommentBadge/index.js +44 -14
- package/dist/esm/ui/MediaPicker/index.js +15 -3
- package/dist/esm/ui/MediaViewer/MediaViewerContainer.js +4 -4
- package/dist/esm/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +2 -1
- package/dist/esm/ui/ToolbarMedia/index.js +17 -5
- package/dist/esm/ui/hooks/useMediaProvider.js +11 -3
- package/dist/esm/ui/toolbar/utils.js +5 -3
- package/dist/types/nodeviews/mediaInline.d.ts +7 -2
- package/dist/types/nodeviews/mediaSingleNext.d.ts +3 -4
- package/dist/types/nodeviews/types.d.ts +3 -4
- package/dist/types/pm-plugins/utils/media-files.d.ts +3 -2
- package/dist/types/types/index.d.ts +17 -0
- package/dist/types/ui/MediaViewer/MediaViewerContainer.d.ts +4 -3
- package/dist/types/ui/toolbar/utils.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/mediaInline.d.ts +7 -2
- package/dist/types-ts4.5/nodeviews/mediaSingleNext.d.ts +3 -4
- package/dist/types-ts4.5/nodeviews/types.d.ts +3 -4
- package/dist/types-ts4.5/pm-plugins/utils/media-files.d.ts +3 -2
- package/dist/types-ts4.5/types/index.d.ts +17 -0
- package/dist/types-ts4.5/ui/MediaViewer/MediaViewerContainer.d.ts +4 -3
- package/dist/types-ts4.5/ui/toolbar/utils.d.ts +1 -0
- package/package.json +9 -3
|
@@ -4,6 +4,8 @@ import { injectIntl } from 'react-intl-next';
|
|
|
4
4
|
import { VIEW_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
6
6
|
import { CommentBadge as CommentBadgeComponent, CommentBadgeNext } from '@atlaskit/editor-common/media-single';
|
|
7
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
8
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
9
|
var CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
|
|
8
10
|
var api = _ref.api,
|
|
9
11
|
mediaNode = _ref.mediaNode,
|
|
@@ -16,23 +18,37 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
|
|
|
16
18
|
_useState2 = _slicedToArray(_useState, 2),
|
|
17
19
|
entered = _useState2[0],
|
|
18
20
|
setEntered = _useState2[1];
|
|
19
|
-
var _useSharedPluginState = useSharedPluginState(api, ['annotation']
|
|
21
|
+
var _useSharedPluginState = useSharedPluginState(api, ['annotation'], {
|
|
22
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
23
|
+
}),
|
|
20
24
|
annotationState = _useSharedPluginState.annotationState;
|
|
25
|
+
var selectedAnnotationsSelector = useSharedPluginStateSelector(api, 'annotation.selectedAnnotations', {
|
|
26
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
27
|
+
});
|
|
28
|
+
var isInlineCommentViewClosedSelector = useSharedPluginStateSelector(api, 'annotation.isInlineCommentViewClosed', {
|
|
29
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
30
|
+
});
|
|
31
|
+
var annotationsSelector = useSharedPluginStateSelector(api, 'annotation.annotations', {
|
|
32
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
33
|
+
});
|
|
34
|
+
var selectedAnnotations = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? selectedAnnotationsSelector : annotationState === null || annotationState === void 0 ? void 0 : annotationState.selectedAnnotations;
|
|
35
|
+
var isInlineCommentViewClosed = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isInlineCommentViewClosedSelector : annotationState === null || annotationState === void 0 ? void 0 : annotationState.isInlineCommentViewClosed;
|
|
36
|
+
var annotations = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? annotationsSelector : annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations;
|
|
21
37
|
var _view$state$schema = view.state.schema,
|
|
22
38
|
media = _view$state$schema.nodes.media,
|
|
23
39
|
annotation = _view$state$schema.marks.annotation,
|
|
24
40
|
state = view.state,
|
|
25
41
|
dispatch = view.dispatch;
|
|
26
42
|
var status = useMemo(function () {
|
|
27
|
-
if (!
|
|
43
|
+
if (!selectedAnnotations || !mediaNode) {
|
|
28
44
|
return 'default';
|
|
29
45
|
}
|
|
30
|
-
return
|
|
46
|
+
return selectedAnnotations.some(function (annotation) {
|
|
31
47
|
return !!mediaNode.marks.find(function (mark) {
|
|
32
48
|
return mark.attrs.id === annotation.id;
|
|
33
49
|
});
|
|
34
|
-
}) && !
|
|
35
|
-
}, [
|
|
50
|
+
}) && !isInlineCommentViewClosed ? 'active' : 'default';
|
|
51
|
+
}, [selectedAnnotations, isInlineCommentViewClosed, mediaNode]);
|
|
36
52
|
var onClick = useCallback(function () {
|
|
37
53
|
if (api.annotation && mediaNode) {
|
|
38
54
|
var showCommentForBlockNode = api.annotation.actions.showCommentForBlockNode;
|
|
@@ -40,8 +56,8 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
|
|
|
40
56
|
}
|
|
41
57
|
}, [api.annotation, dispatch, mediaNode, state]);
|
|
42
58
|
var pos = getPos();
|
|
43
|
-
var hasNoComments = !Number.isFinite(pos) || !
|
|
44
|
-
return maybeAnnotation.type !== annotation || !(maybeAnnotation.attrs.id in
|
|
59
|
+
var hasNoComments = !Number.isFinite(pos) || !annotations || !mediaNode || mediaNode.type !== media || mediaNode.marks.every(function (maybeAnnotation) {
|
|
60
|
+
return maybeAnnotation.type !== annotation || !(maybeAnnotation.attrs.id in annotations) || annotations[maybeAnnotation.attrs.id];
|
|
45
61
|
});
|
|
46
62
|
if (!isDrafting && hasNoComments || !mediaNode) {
|
|
47
63
|
return null;
|
|
@@ -88,23 +104,37 @@ export var CommentBadgeNextWrapper = function CommentBadgeNextWrapper(_ref2) {
|
|
|
88
104
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
89
105
|
entered = _useState4[0],
|
|
90
106
|
setEntered = _useState4[1];
|
|
91
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['annotation']
|
|
107
|
+
var _useSharedPluginState2 = useSharedPluginState(api, ['annotation'], {
|
|
108
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
109
|
+
}),
|
|
92
110
|
annotationState = _useSharedPluginState2.annotationState;
|
|
111
|
+
var selectedAnnotationsSelector = useSharedPluginStateSelector(api, 'annotation.selectedAnnotations', {
|
|
112
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
113
|
+
});
|
|
114
|
+
var isInlineCommentViewClosedSelector = useSharedPluginStateSelector(api, 'annotation.isInlineCommentViewClosed', {
|
|
115
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
116
|
+
});
|
|
117
|
+
var annotationsSelector = useSharedPluginStateSelector(api, 'annotation.annotations', {
|
|
118
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
119
|
+
});
|
|
120
|
+
var selectedAnnotations = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? selectedAnnotationsSelector : annotationState === null || annotationState === void 0 ? void 0 : annotationState.selectedAnnotations;
|
|
121
|
+
var isInlineCommentViewClosed = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isInlineCommentViewClosedSelector : annotationState === null || annotationState === void 0 ? void 0 : annotationState.isInlineCommentViewClosed;
|
|
122
|
+
var annotations = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? annotationsSelector : annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations;
|
|
93
123
|
var _view$state$schema2 = view.state.schema,
|
|
94
124
|
media = _view$state$schema2.nodes.media,
|
|
95
125
|
annotation = _view$state$schema2.marks.annotation,
|
|
96
126
|
state = view.state,
|
|
97
127
|
dispatch = view.dispatch;
|
|
98
128
|
var status = useMemo(function () {
|
|
99
|
-
if (!
|
|
129
|
+
if (!selectedAnnotations || !mediaNode) {
|
|
100
130
|
return 'default';
|
|
101
131
|
}
|
|
102
|
-
return
|
|
132
|
+
return selectedAnnotations.some(function (annotation) {
|
|
103
133
|
return !!mediaNode.marks.find(function (mark) {
|
|
104
134
|
return mark.attrs.id === annotation.id;
|
|
105
135
|
});
|
|
106
|
-
}) && !
|
|
107
|
-
}, [
|
|
136
|
+
}) && !isInlineCommentViewClosed ? 'active' : 'default';
|
|
137
|
+
}, [selectedAnnotations, isInlineCommentViewClosed, mediaNode]);
|
|
108
138
|
var onClick = useCallback(function () {
|
|
109
139
|
if (api.annotation && mediaNode) {
|
|
110
140
|
var showCommentForBlockNode = api.annotation.actions.showCommentForBlockNode;
|
|
@@ -112,8 +142,8 @@ export var CommentBadgeNextWrapper = function CommentBadgeNextWrapper(_ref2) {
|
|
|
112
142
|
}
|
|
113
143
|
}, [api.annotation, dispatch, mediaNode, state]);
|
|
114
144
|
var pos = getPos();
|
|
115
|
-
var hasNoComments = !Number.isFinite(pos) || !
|
|
116
|
-
return maybeAnnotation.type !== annotation || !(maybeAnnotation.attrs.id in
|
|
145
|
+
var hasNoComments = !Number.isFinite(pos) || !annotations || !mediaNode || mediaNode.type !== media || mediaNode.marks.every(function (maybeAnnotation) {
|
|
146
|
+
return maybeAnnotation.type !== annotation || !(maybeAnnotation.attrs.id in annotations) || annotations[maybeAnnotation.attrs.id];
|
|
117
147
|
});
|
|
118
148
|
if (!isDrafting && hasNoComments || !mediaNode) {
|
|
119
149
|
return null;
|
|
@@ -8,6 +8,8 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
11
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
12
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
13
|
import { BrowserWrapper } from './BrowserWrapper';
|
|
12
14
|
import { ClipboardWrapper } from './ClipboardWrapper';
|
|
13
15
|
import { DropzoneWrapper } from './DropzoneWrapper';
|
|
@@ -19,9 +21,19 @@ var MediaPicker = function MediaPicker(_ref) {
|
|
|
19
21
|
mediaState = _ref.mediaState,
|
|
20
22
|
onBrowseFn = _ref.onBrowseFn,
|
|
21
23
|
editorDomElement = _ref.editorDomElement;
|
|
22
|
-
var _useSharedPluginState = useSharedPluginState(api, ['focus', 'connectivity']
|
|
24
|
+
var _useSharedPluginState = useSharedPluginState(api, ['focus', 'connectivity'], {
|
|
25
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
26
|
+
}),
|
|
23
27
|
focusState = _useSharedPluginState.focusState,
|
|
24
28
|
connectivityState = _useSharedPluginState.connectivityState;
|
|
29
|
+
var hasFocusSelector = useSharedPluginStateSelector(api, 'focus.hasFocus', {
|
|
30
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
31
|
+
});
|
|
32
|
+
var connectivityModeSelector = useSharedPluginStateSelector(api, 'connectivity.mode', {
|
|
33
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
34
|
+
});
|
|
35
|
+
var hasFocus = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? hasFocusSelector : focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus;
|
|
36
|
+
var connectivityMode = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? connectivityModeSelector : connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode;
|
|
25
37
|
var featureFlags = mediaState.mediaOptions && mediaState.mediaOptions.featureFlags;
|
|
26
38
|
|
|
27
39
|
// Ignored via go/ees005
|
|
@@ -36,7 +48,7 @@ var MediaPicker = function MediaPicker(_ref) {
|
|
|
36
48
|
* as stopImmediatePropagation could cause race condition issues
|
|
37
49
|
*/
|
|
38
50
|
var container = editorParent;
|
|
39
|
-
var clipboard =
|
|
51
|
+
var clipboard = hasFocus ? /*#__PURE__*/React.createElement(ClipboardWrapper, {
|
|
40
52
|
mediaState: mediaState,
|
|
41
53
|
featureFlags: featureFlags,
|
|
42
54
|
container: container
|
|
@@ -45,7 +57,7 @@ var MediaPicker = function MediaPicker(_ref) {
|
|
|
45
57
|
mediaState: mediaState,
|
|
46
58
|
isActive: !isPopupOpened &&
|
|
47
59
|
// If we're offline don't show the dropzone
|
|
48
|
-
|
|
60
|
+
connectivityMode !== 'offline',
|
|
49
61
|
featureFlags: featureFlags,
|
|
50
62
|
editorDomElement: editorDomElement,
|
|
51
63
|
appearance: appearance
|
|
@@ -9,7 +9,7 @@ import React, { Fragment, useEffect, useState } from 'react';
|
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
11
|
import { isVideo } from '../../pm-plugins/utils/is-type';
|
|
12
|
-
import {
|
|
12
|
+
import { getSelectedNearestMediaContainerNodeAttrsFunction } from '../../ui/toolbar/utils';
|
|
13
13
|
import { RenderMediaViewer } from './PortalWrapper';
|
|
14
14
|
var interactiveStyles = css({
|
|
15
15
|
cursor: 'pointer'
|
|
@@ -18,7 +18,8 @@ var mediaViewerContainerTestID = 'media-viewer-container-test';
|
|
|
18
18
|
export var MediaViewerContainer = function MediaViewerContainer(_ref) {
|
|
19
19
|
var _mediaNode$firstChild;
|
|
20
20
|
var mediaNode = _ref.mediaNode,
|
|
21
|
-
|
|
21
|
+
selectedMediaContainerNode = _ref.selectedMediaContainerNode,
|
|
22
|
+
mediaClientConfig = _ref.mediaClientConfig,
|
|
22
23
|
_ref$isEditorViewMode = _ref.isEditorViewMode,
|
|
23
24
|
isEditorViewMode = _ref$isEditorViewMode === void 0 ? false : _ref$isEditorViewMode,
|
|
24
25
|
_ref$isSelected = _ref.isSelected,
|
|
@@ -33,8 +34,7 @@ export var MediaViewerContainer = function MediaViewerContainer(_ref) {
|
|
|
33
34
|
useEffect(function () {
|
|
34
35
|
setShowMediaViewer(isSelected);
|
|
35
36
|
}, [isSelected]);
|
|
36
|
-
var selectedNodeAttrs =
|
|
37
|
-
var mediaClientConfig = mediaPluginState.mediaClientConfig;
|
|
37
|
+
var selectedNodeAttrs = getSelectedNearestMediaContainerNodeAttrsFunction(selectedMediaContainerNode);
|
|
38
38
|
var showMediaViewer = function showMediaViewer() {
|
|
39
39
|
setShowMediaViewer(true);
|
|
40
40
|
};
|
|
@@ -21,6 +21,7 @@ import { jsx } from '@emotion/react';
|
|
|
21
21
|
import classnames from 'classnames';
|
|
22
22
|
import throttle from 'lodash/throttle';
|
|
23
23
|
import memoizeOne from 'memoize-one';
|
|
24
|
+
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
24
25
|
import { findClosestSnap, generateDefaultGuidelines, generateDynamicGuidelines, getGuidelineSnaps, getGuidelinesWithHighlights, getGuidelineTypeFromKey, getRelativeGuidelines, getRelativeGuideSnaps } from '@atlaskit/editor-common/guideline';
|
|
25
26
|
import { calcMediaSingleMaxWidth, DEFAULT_IMAGE_WIDTH, MEDIA_SINGLE_ADJACENT_HANDLE_MARGIN, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
26
27
|
import { ResizerNext } from '@atlaskit/editor-common/resizer';
|
|
@@ -536,7 +537,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
536
537
|
var resizerNextClassName = classnames(className, resizerStyles);
|
|
537
538
|
var isNestedNode = this.isAdjacentMode();
|
|
538
539
|
var handlePositioning = this.getHandlePositioning();
|
|
539
|
-
var maxWidth = this.getMaxWidth();
|
|
540
|
+
var maxWidth = isSSR() && size.width && fg('platform_editor_fix_image_size_diff_during_ssr') ? undefined : this.getMaxWidth();
|
|
540
541
|
var minWidth = this.calcMinWidth(isVideoFile, lineLength);
|
|
541
542
|
|
|
542
543
|
// while is not resizing, we take 100% as min-width if the container width is less than the min-width
|
|
@@ -3,10 +3,12 @@ import { injectIntl } from 'react-intl-next';
|
|
|
3
3
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { toolbarMediaMessages } from '@atlaskit/editor-common/media';
|
|
5
5
|
import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
6
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
7
|
import AttachmentIcon from '@atlaskit/icon/core/migration/attachment--editor-attachment';
|
|
7
|
-
|
|
8
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
|
+
var onClickMediaButton = function onClickMediaButton(showMediaPicker) {
|
|
8
10
|
return function () {
|
|
9
|
-
|
|
11
|
+
showMediaPicker();
|
|
10
12
|
return true;
|
|
11
13
|
};
|
|
12
14
|
};
|
|
@@ -15,15 +17,25 @@ var ToolbarMedia = function ToolbarMedia(_ref) {
|
|
|
15
17
|
isReducedSpacing = _ref.isReducedSpacing,
|
|
16
18
|
intl = _ref.intl,
|
|
17
19
|
api = _ref.api;
|
|
18
|
-
var _useSharedPluginState = useSharedPluginState(api, ['media']
|
|
20
|
+
var _useSharedPluginState = useSharedPluginState(api, ['media'], {
|
|
21
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
22
|
+
}),
|
|
19
23
|
mediaState = _useSharedPluginState.mediaState;
|
|
20
|
-
|
|
24
|
+
var allowsUploadsSelector = useSharedPluginStateSelector(api, 'media.allowsUploads', {
|
|
25
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
26
|
+
});
|
|
27
|
+
var showMediaPickerSelector = useSharedPluginStateSelector(api, 'media.showMediaPicker', {
|
|
28
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
29
|
+
});
|
|
30
|
+
var allowsUploads = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? allowsUploadsSelector : mediaState === null || mediaState === void 0 ? void 0 : mediaState.allowsUploads;
|
|
31
|
+
var showMediaPicker = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? showMediaPickerSelector : mediaState === null || mediaState === void 0 ? void 0 : mediaState.showMediaPicker;
|
|
32
|
+
if (!allowsUploads || !showMediaPicker) {
|
|
21
33
|
return null;
|
|
22
34
|
}
|
|
23
35
|
var toolbarMediaTitle = toolbarMediaMessages.toolbarMediaTitle;
|
|
24
36
|
return /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
25
37
|
buttonId: TOOLBAR_BUTTON.MEDIA,
|
|
26
|
-
onClick: onClickMediaButton(
|
|
38
|
+
onClick: onClickMediaButton(showMediaPicker),
|
|
27
39
|
disabled: isDisabled,
|
|
28
40
|
title: intl.formatMessage(toolbarMediaTitle),
|
|
29
41
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
4
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
5
|
export var useMediaProvider = function useMediaProvider(pluginInjectionApi) {
|
|
4
|
-
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['media']
|
|
6
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['media'], {
|
|
7
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
8
|
+
}),
|
|
5
9
|
mediaState = _useSharedPluginState.mediaState;
|
|
10
|
+
var mediaProviderSelector = useSharedPluginStateSelector(pluginInjectionApi, 'media.mediaProvider', {
|
|
11
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
12
|
+
});
|
|
13
|
+
var mediaProvider = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? mediaProviderSelector : mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider;
|
|
6
14
|
var provider = useMemo(function () {
|
|
7
|
-
return
|
|
8
|
-
}, [
|
|
15
|
+
return mediaProvider;
|
|
16
|
+
}, [mediaProvider]);
|
|
9
17
|
return provider;
|
|
10
18
|
};
|
|
@@ -18,9 +18,8 @@ var getSelectedMediaContainerNodeAttrs = function getSelectedMediaContainerNodeA
|
|
|
18
18
|
}
|
|
19
19
|
return null;
|
|
20
20
|
};
|
|
21
|
-
export var
|
|
22
|
-
var
|
|
23
|
-
var selectedNode = (_mediaPluginState$sel2 = mediaPluginState.selectedMediaContainerNode) === null || _mediaPluginState$sel2 === void 0 ? void 0 : _mediaPluginState$sel2.call(mediaPluginState);
|
|
21
|
+
export var getSelectedNearestMediaContainerNodeAttrsFunction = function getSelectedNearestMediaContainerNodeAttrsFunction(selectedMediaContainerNode) {
|
|
22
|
+
var selectedNode = selectedMediaContainerNode === null || selectedMediaContainerNode === void 0 ? void 0 : selectedMediaContainerNode();
|
|
24
23
|
if (selectedNode) {
|
|
25
24
|
switch (selectedNode.type.name) {
|
|
26
25
|
case 'mediaSingle':
|
|
@@ -34,6 +33,9 @@ export var getSelectedNearestMediaContainerNodeAttrs = function getSelectedNeare
|
|
|
34
33
|
}
|
|
35
34
|
return null;
|
|
36
35
|
};
|
|
36
|
+
export var getSelectedNearestMediaContainerNodeAttrs = function getSelectedNearestMediaContainerNodeAttrs(mediaPluginState) {
|
|
37
|
+
return getSelectedNearestMediaContainerNodeAttrsFunction(mediaPluginState.selectedMediaContainerNode);
|
|
38
|
+
};
|
|
37
39
|
export var downloadMedia = /*#__PURE__*/function () {
|
|
38
40
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mediaPluginState, isViewMode) {
|
|
39
41
|
var selectedNodeAttrs, id, _selectedNodeAttrs$co, collection, mediaClient, fileState, fileName;
|
|
@@ -8,8 +8,8 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
|
8
8
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
9
9
|
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import type { FileIdentifier } from '@atlaskit/media-client';
|
|
11
|
+
import type { MediaClientConfig } from '@atlaskit/media-core/auth';
|
|
11
12
|
import type { MediaNextEditorPluginType } from '../mediaPluginType';
|
|
12
|
-
import type { MediaPluginState } from '../pm-plugins/types';
|
|
13
13
|
import type { getPosHandler, getPosHandler as ProsemirrorGetPosHandler } from '../types';
|
|
14
14
|
export interface MediaInlineProps {
|
|
15
15
|
mediaProvider: Promise<MediaProvider>;
|
|
@@ -20,7 +20,12 @@ export interface MediaInlineProps {
|
|
|
20
20
|
getPos: ProsemirrorGetPosHandler;
|
|
21
21
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
22
22
|
contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
|
|
23
|
-
|
|
23
|
+
handleMediaNodeMount: (node: PMNode, getPos: ProsemirrorGetPosHandler) => void;
|
|
24
|
+
handleMediaNodeUnmount: (node: PMNode) => void;
|
|
25
|
+
allowInlineImages?: boolean;
|
|
26
|
+
addPendingTask: (promise: Promise<any>) => void;
|
|
27
|
+
selectedMediaContainerNode: () => PMNode | undefined;
|
|
28
|
+
mediaClientConfig: MediaClientConfig;
|
|
24
29
|
editorViewMode?: boolean;
|
|
25
30
|
}
|
|
26
31
|
export declare const handleNewNode: (props: MediaInlineProps) => void;
|
|
@@ -3,11 +3,9 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
4
|
import type { ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
5
5
|
import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
|
-
import type { InlineCommentPluginState } from '@atlaskit/editor-plugin-annotation';
|
|
7
6
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
8
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
8
|
import type { MediaNextEditorPluginType } from '../mediaPluginType';
|
|
10
|
-
import type { MediaPluginState } from '../pm-plugins/types';
|
|
11
9
|
import type { ForwardRef, MediaOptions } from '../types';
|
|
12
10
|
type MediaSingleNodeNextProps = {
|
|
13
11
|
view: EditorView;
|
|
@@ -21,8 +19,9 @@ type MediaSingleNodeNextProps = {
|
|
|
21
19
|
mediaProvider?: Promise<MediaProvider>;
|
|
22
20
|
contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
|
|
23
21
|
fullWidthMode?: boolean;
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
addPendingTask?: (promise: Promise<any>) => void;
|
|
23
|
+
isDrafting?: boolean;
|
|
24
|
+
targetNodeId?: string;
|
|
26
25
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
27
26
|
isCopyPasteEnabled?: boolean;
|
|
28
27
|
forwardRef: ForwardRef;
|
|
@@ -2,11 +2,9 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { ContextIdentifierProvider, MediaProvider, ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
4
|
import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
5
|
-
import type { InlineCommentPluginState } from '@atlaskit/editor-plugin-annotation';
|
|
6
5
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
7
|
import type { MediaNextEditorPluginType } from '../mediaPluginType';
|
|
9
|
-
import type { MediaPluginState } from '../pm-plugins/types';
|
|
10
8
|
import type { ForwardRef, MediaOptions, getPosHandler as ProsemirrorGetPosHandler } from '../types';
|
|
11
9
|
export interface MediaSingleNodeProps {
|
|
12
10
|
view: EditorView;
|
|
@@ -20,8 +18,9 @@ export interface MediaSingleNodeProps {
|
|
|
20
18
|
mediaProvider?: Promise<MediaProvider>;
|
|
21
19
|
contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
|
|
22
20
|
fullWidthMode?: boolean;
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
addPendingTask?: (promise: Promise<any>) => void;
|
|
22
|
+
isDrafting?: boolean;
|
|
23
|
+
targetNodeId?: string;
|
|
25
24
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
26
25
|
isCopyPasteEnabled?: boolean;
|
|
27
26
|
forwardRef: ForwardRef;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI, InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import type { EditorAnalyticsAPI, InputMethodInsertMedia, InsertEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { ACTION_SUBJECT_ID, type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { MediaState } from '../../types';
|
|
6
6
|
export declare const canInsertMediaInline: (state: EditorState) => boolean;
|
|
7
|
+
export declare const getFailToInsertAnalytics: (mediaState: MediaState, actionSubjectId: ACTION_SUBJECT_ID.MEDIA_INLINE | ACTION_SUBJECT_ID.MEDIA_GROUP | ACTION_SUBJECT_ID.MEDIA_SINGLE, inputMethod?: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia, reason?: string) => InsertEventPayload;
|
|
7
8
|
/**
|
|
8
9
|
* Create a new media inline to insert the new media.
|
|
9
10
|
* @param view Editor view
|
|
@@ -57,6 +57,23 @@ export interface MediaPluginOptions {
|
|
|
57
57
|
forceHandlePositioning?: HandlePositioning;
|
|
58
58
|
mediaShallowCopyScope?: MediaCopyScope;
|
|
59
59
|
allowPixelResizing?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Enabling this will prevent this plugin from automatically trying to upload external images to the Media service.
|
|
62
|
+
* This can be used in conjunction with the `isOnlyExternalLinks` config for `media-insert-plugin` to limit images
|
|
63
|
+
* to external URLs in the UI as well.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* createDefaultPreset({ featureFlags: {}, paste: {} })
|
|
68
|
+
* .add(listPlugin)
|
|
69
|
+
* .add(gridPlugin)
|
|
70
|
+
* .add([mediaPlugin, { provider, allowMediaSingle: true, isExternalMediaUploadDisabled: true }])
|
|
71
|
+
* .add(insertBlockPlugin)
|
|
72
|
+
* .add(contentInsertionPlugin)
|
|
73
|
+
* .add([mediaInsertPlugin, { isOnlyExternalLinks: true }])
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
isExternalMediaUploadDisabled?: boolean;
|
|
60
77
|
}
|
|
61
78
|
/**
|
|
62
79
|
* @private
|
|
@@ -5,14 +5,15 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
-
import {
|
|
8
|
+
import type { MediaClientConfig } from '@atlaskit/media-core/auth';
|
|
9
9
|
type MediaViewerContainerProps = {
|
|
10
10
|
mediaNode: PMNode;
|
|
11
|
-
|
|
11
|
+
selectedMediaContainerNode: () => PMNode | undefined;
|
|
12
|
+
mediaClientConfig: MediaClientConfig;
|
|
12
13
|
isEditorViewMode?: boolean;
|
|
13
14
|
isSelected?: boolean;
|
|
14
15
|
isInline?: boolean;
|
|
15
16
|
children?: React.ReactNode;
|
|
16
17
|
};
|
|
17
|
-
export declare const MediaViewerContainer: ({ mediaNode,
|
|
18
|
+
export declare const MediaViewerContainer: ({ mediaNode, selectedMediaContainerNode, mediaClientConfig, isEditorViewMode, isSelected, isInline, children, }: MediaViewerContainerProps) => jsx.JSX.Element;
|
|
18
19
|
export {};
|
|
@@ -7,6 +7,7 @@ import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-p
|
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
9
9
|
export declare const isExternalMedia: (attrs: MediaADFAttrs) => attrs is ExternalMediaAttributes;
|
|
10
|
+
export declare const getSelectedNearestMediaContainerNodeAttrsFunction: (selectedMediaContainerNode: () => ProseMirrorNode | undefined) => MediaADFAttrs | null;
|
|
10
11
|
export declare const getSelectedNearestMediaContainerNodeAttrs: (mediaPluginState: MediaPluginState) => MediaADFAttrs | null;
|
|
11
12
|
export declare const downloadMedia: (mediaPluginState: MediaPluginState, isViewMode?: boolean) => Promise<boolean>;
|
|
12
13
|
export declare const removeMediaGroupNode: (state: EditorState) => import("prosemirror-state").Transaction;
|
|
@@ -8,8 +8,8 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
|
8
8
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
9
9
|
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import type { FileIdentifier } from '@atlaskit/media-client';
|
|
11
|
+
import type { MediaClientConfig } from '@atlaskit/media-core/auth';
|
|
11
12
|
import type { MediaNextEditorPluginType } from '../mediaPluginType';
|
|
12
|
-
import type { MediaPluginState } from '../pm-plugins/types';
|
|
13
13
|
import type { getPosHandler, getPosHandler as ProsemirrorGetPosHandler } from '../types';
|
|
14
14
|
export interface MediaInlineProps {
|
|
15
15
|
mediaProvider: Promise<MediaProvider>;
|
|
@@ -20,7 +20,12 @@ export interface MediaInlineProps {
|
|
|
20
20
|
getPos: ProsemirrorGetPosHandler;
|
|
21
21
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
22
22
|
contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
|
|
23
|
-
|
|
23
|
+
handleMediaNodeMount: (node: PMNode, getPos: ProsemirrorGetPosHandler) => void;
|
|
24
|
+
handleMediaNodeUnmount: (node: PMNode) => void;
|
|
25
|
+
allowInlineImages?: boolean;
|
|
26
|
+
addPendingTask: (promise: Promise<any>) => void;
|
|
27
|
+
selectedMediaContainerNode: () => PMNode | undefined;
|
|
28
|
+
mediaClientConfig: MediaClientConfig;
|
|
24
29
|
editorViewMode?: boolean;
|
|
25
30
|
}
|
|
26
31
|
export declare const handleNewNode: (props: MediaInlineProps) => void;
|
|
@@ -3,11 +3,9 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
4
|
import type { ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
5
5
|
import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
|
-
import type { InlineCommentPluginState } from '@atlaskit/editor-plugin-annotation';
|
|
7
6
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
8
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
8
|
import type { MediaNextEditorPluginType } from '../mediaPluginType';
|
|
10
|
-
import type { MediaPluginState } from '../pm-plugins/types';
|
|
11
9
|
import type { ForwardRef, MediaOptions } from '../types';
|
|
12
10
|
type MediaSingleNodeNextProps = {
|
|
13
11
|
view: EditorView;
|
|
@@ -21,8 +19,9 @@ type MediaSingleNodeNextProps = {
|
|
|
21
19
|
mediaProvider?: Promise<MediaProvider>;
|
|
22
20
|
contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
|
|
23
21
|
fullWidthMode?: boolean;
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
addPendingTask?: (promise: Promise<any>) => void;
|
|
23
|
+
isDrafting?: boolean;
|
|
24
|
+
targetNodeId?: string;
|
|
26
25
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
27
26
|
isCopyPasteEnabled?: boolean;
|
|
28
27
|
forwardRef: ForwardRef;
|
|
@@ -2,11 +2,9 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { ContextIdentifierProvider, MediaProvider, ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
4
|
import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
5
|
-
import type { InlineCommentPluginState } from '@atlaskit/editor-plugin-annotation';
|
|
6
5
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
7
|
import type { MediaNextEditorPluginType } from '../mediaPluginType';
|
|
9
|
-
import type { MediaPluginState } from '../pm-plugins/types';
|
|
10
8
|
import type { ForwardRef, MediaOptions, getPosHandler as ProsemirrorGetPosHandler } from '../types';
|
|
11
9
|
export interface MediaSingleNodeProps {
|
|
12
10
|
view: EditorView;
|
|
@@ -20,8 +18,9 @@ export interface MediaSingleNodeProps {
|
|
|
20
18
|
mediaProvider?: Promise<MediaProvider>;
|
|
21
19
|
contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
|
|
22
20
|
fullWidthMode?: boolean;
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
addPendingTask?: (promise: Promise<any>) => void;
|
|
22
|
+
isDrafting?: boolean;
|
|
23
|
+
targetNodeId?: string;
|
|
25
24
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
26
25
|
isCopyPasteEnabled?: boolean;
|
|
27
26
|
forwardRef: ForwardRef;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI, InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import type { EditorAnalyticsAPI, InputMethodInsertMedia, InsertEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { ACTION_SUBJECT_ID, type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { MediaState } from '../../types';
|
|
6
6
|
export declare const canInsertMediaInline: (state: EditorState) => boolean;
|
|
7
|
+
export declare const getFailToInsertAnalytics: (mediaState: MediaState, actionSubjectId: ACTION_SUBJECT_ID.MEDIA_INLINE | ACTION_SUBJECT_ID.MEDIA_GROUP | ACTION_SUBJECT_ID.MEDIA_SINGLE, inputMethod?: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia, reason?: string) => InsertEventPayload;
|
|
7
8
|
/**
|
|
8
9
|
* Create a new media inline to insert the new media.
|
|
9
10
|
* @param view Editor view
|
|
@@ -57,6 +57,23 @@ export interface MediaPluginOptions {
|
|
|
57
57
|
forceHandlePositioning?: HandlePositioning;
|
|
58
58
|
mediaShallowCopyScope?: MediaCopyScope;
|
|
59
59
|
allowPixelResizing?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Enabling this will prevent this plugin from automatically trying to upload external images to the Media service.
|
|
62
|
+
* This can be used in conjunction with the `isOnlyExternalLinks` config for `media-insert-plugin` to limit images
|
|
63
|
+
* to external URLs in the UI as well.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* createDefaultPreset({ featureFlags: {}, paste: {} })
|
|
68
|
+
* .add(listPlugin)
|
|
69
|
+
* .add(gridPlugin)
|
|
70
|
+
* .add([mediaPlugin, { provider, allowMediaSingle: true, isExternalMediaUploadDisabled: true }])
|
|
71
|
+
* .add(insertBlockPlugin)
|
|
72
|
+
* .add(contentInsertionPlugin)
|
|
73
|
+
* .add([mediaInsertPlugin, { isOnlyExternalLinks: true }])
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
isExternalMediaUploadDisabled?: boolean;
|
|
60
77
|
}
|
|
61
78
|
/**
|
|
62
79
|
* @private
|
|
@@ -5,14 +5,15 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
-
import {
|
|
8
|
+
import type { MediaClientConfig } from '@atlaskit/media-core/auth';
|
|
9
9
|
type MediaViewerContainerProps = {
|
|
10
10
|
mediaNode: PMNode;
|
|
11
|
-
|
|
11
|
+
selectedMediaContainerNode: () => PMNode | undefined;
|
|
12
|
+
mediaClientConfig: MediaClientConfig;
|
|
12
13
|
isEditorViewMode?: boolean;
|
|
13
14
|
isSelected?: boolean;
|
|
14
15
|
isInline?: boolean;
|
|
15
16
|
children?: React.ReactNode;
|
|
16
17
|
};
|
|
17
|
-
export declare const MediaViewerContainer: ({ mediaNode,
|
|
18
|
+
export declare const MediaViewerContainer: ({ mediaNode, selectedMediaContainerNode, mediaClientConfig, isEditorViewMode, isSelected, isInline, children, }: MediaViewerContainerProps) => jsx.JSX.Element;
|
|
18
19
|
export {};
|
|
@@ -7,6 +7,7 @@ import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-p
|
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
9
9
|
export declare const isExternalMedia: (attrs: MediaADFAttrs) => attrs is ExternalMediaAttributes;
|
|
10
|
+
export declare const getSelectedNearestMediaContainerNodeAttrsFunction: (selectedMediaContainerNode: () => ProseMirrorNode | undefined) => MediaADFAttrs | null;
|
|
10
11
|
export declare const getSelectedNearestMediaContainerNodeAttrs: (mediaPluginState: MediaPluginState) => MediaADFAttrs | null;
|
|
11
12
|
export declare const downloadMedia: (mediaPluginState: MediaPluginState, isViewMode?: boolean) => Promise<boolean>;
|
|
12
13
|
export declare const removeMediaGroupNode: (state: EditorState) => import("prosemirror-state").Transaction;
|