@atlaskit/editor-core 187.40.2 → 187.41.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 +17 -0
- package/dist/cjs/editor-next/hooks/useEditorMeasuresConstructor.js +2 -2
- package/dist/cjs/editor-next/utils/editorMeasureTTICallback.js +3 -2
- package/dist/cjs/element-browser.js +2 -3
- package/dist/cjs/plugins/media/index.js +59 -54
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +44 -29
- package/dist/cjs/plugins/media/ui/ToolbarMedia/index.js +20 -33
- package/dist/cjs/plugins/quick-insert/index.js +4 -2
- package/dist/cjs/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/ModalElementBrowser.js +8 -7
- package/dist/cjs/plugins/quick-insert/ui/ModalElementBrowser/index.js +10 -17
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +5 -6
- package/dist/cjs/ui/ElementBrowser/types.js +1 -8
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/editor-next/hooks/useEditorMeasuresConstructor.js +2 -2
- package/dist/es2019/editor-next/utils/editorMeasureTTICallback.js +3 -2
- package/dist/es2019/element-browser.js +1 -1
- package/dist/es2019/plugins/media/index.js +28 -20
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +45 -27
- package/dist/es2019/plugins/media/ui/ToolbarMedia/index.js +24 -32
- package/dist/es2019/plugins/quick-insert/index.js +4 -2
- package/dist/es2019/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/ModalElementBrowser.js +5 -5
- package/dist/es2019/plugins/quick-insert/ui/ModalElementBrowser/index.js +8 -13
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +2 -3
- package/dist/es2019/ui/ElementBrowser/types.js +1 -5
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/editor-next/hooks/useEditorMeasuresConstructor.js +2 -2
- package/dist/esm/editor-next/utils/editorMeasureTTICallback.js +3 -2
- package/dist/esm/element-browser.js +1 -1
- package/dist/esm/plugins/media/index.js +57 -52
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +44 -29
- package/dist/esm/plugins/media/ui/ToolbarMedia/index.js +20 -30
- package/dist/esm/plugins/quick-insert/index.js +4 -2
- package/dist/esm/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/ModalElementBrowser.js +5 -5
- package/dist/esm/plugins/quick-insert/ui/ModalElementBrowser/index.js +10 -17
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +2 -3
- package/dist/esm/ui/ElementBrowser/types.js +1 -5
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/editor-next/hooks/useEditorMeasuresConstructor.d.ts +4 -4
- package/dist/types/editor-next/utils/editorMeasureTTICallback.d.ts +5 -5
- package/dist/types/element-browser.d.ts +1 -1
- package/dist/types/labs/next/presets/default.d.ts +2 -2
- package/dist/types/plugins/media/index.d.ts +1 -1
- package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +5 -4
- package/dist/types/plugins/media/types.d.ts +10 -1
- package/dist/types/plugins/media/ui/ToolbarMedia/index.d.ts +6 -10
- package/dist/types/plugins/quick-insert/index.d.ts +3 -3
- package/dist/types/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/ModalElementBrowser.d.ts +4 -3
- package/dist/types/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/categories.d.ts +1 -1
- package/dist/types/plugins/quick-insert/ui/ModalElementBrowser/index.d.ts +4 -1
- package/dist/types/ui/ElementBrowser/types.d.ts +6 -18
- package/dist/types-ts4.5/editor-next/hooks/useEditorMeasuresConstructor.d.ts +4 -4
- package/dist/types-ts4.5/editor-next/utils/editorMeasureTTICallback.d.ts +5 -5
- package/dist/types-ts4.5/element-browser.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +2 -2
- package/dist/types-ts4.5/plugins/media/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaInline.d.ts +5 -4
- package/dist/types-ts4.5/plugins/media/types.d.ts +10 -1
- package/dist/types-ts4.5/plugins/media/ui/ToolbarMedia/index.d.ts +6 -10
- package/dist/types-ts4.5/plugins/quick-insert/index.d.ts +3 -3
- package/dist/types-ts4.5/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/ModalElementBrowser.d.ts +4 -3
- package/dist/types-ts4.5/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/categories.d.ts +1 -1
- package/dist/types-ts4.5/plugins/quick-insert/ui/ModalElementBrowser/index.d.ts +4 -1
- package/dist/types-ts4.5/ui/ElementBrowser/types.d.ts +6 -18
- package/package.json +2 -2
- package/report.api.md +7 -1
- package/tmp/api-report-tmp.d.ts +7 -1
- package/dist/cjs/ui/ElementBrowser/ElementBrowser.js +0 -152
- package/dist/cjs/ui/ElementBrowser/ViewMore.js +0 -39
- package/dist/cjs/ui/ElementBrowser/components/CategoryList.js +0 -115
- package/dist/cjs/ui/ElementBrowser/components/ElementBrowserLoader.js +0 -36
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +0 -250
- package/dist/cjs/ui/ElementBrowser/components/ElementList/EmptyState.js +0 -47
- package/dist/cjs/ui/ElementBrowser/components/ElementList/NotFoundIllustration.js +0 -69
- package/dist/cjs/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +0 -42
- package/dist/cjs/ui/ElementBrowser/components/ElementList/utils.js +0 -54
- package/dist/cjs/ui/ElementBrowser/components/ElementSearch.js +0 -88
- package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +0 -269
- package/dist/cjs/ui/ElementBrowser/constants.js +0 -43
- package/dist/cjs/ui/ElementBrowser/hooks/use-container-width.js +0 -70
- package/dist/cjs/ui/ElementBrowser/hooks/use-focus.js +0 -51
- package/dist/cjs/ui/ElementBrowser/hooks/use-select-and-focus-on-arrow-navigation.js +0 -286
- package/dist/cjs/ui/ElementBrowser/index.js +0 -10
- package/dist/es2019/ui/ElementBrowser/ElementBrowser.js +0 -117
- package/dist/es2019/ui/ElementBrowser/ViewMore.js +0 -40
- package/dist/es2019/ui/ElementBrowser/components/CategoryList.js +0 -104
- package/dist/es2019/ui/ElementBrowser/components/ElementBrowserLoader.js +0 -21
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +0 -301
- package/dist/es2019/ui/ElementBrowser/components/ElementList/EmptyState.js +0 -58
- package/dist/es2019/ui/ElementBrowser/components/ElementList/NotFoundIllustration.js +0 -64
- package/dist/es2019/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +0 -39
- package/dist/es2019/ui/ElementBrowser/components/ElementList/utils.js +0 -50
- package/dist/es2019/ui/ElementBrowser/components/ElementSearch.js +0 -117
- package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +0 -339
- package/dist/es2019/ui/ElementBrowser/constants.js +0 -24
- package/dist/es2019/ui/ElementBrowser/hooks/use-container-width.js +0 -59
- package/dist/es2019/ui/ElementBrowser/hooks/use-focus.js +0 -48
- package/dist/es2019/ui/ElementBrowser/hooks/use-select-and-focus-on-arrow-navigation.js +0 -284
- package/dist/es2019/ui/ElementBrowser/index.js +0 -2
- package/dist/esm/ui/ElementBrowser/ElementBrowser.js +0 -142
- package/dist/esm/ui/ElementBrowser/ViewMore.js +0 -31
- package/dist/esm/ui/ElementBrowser/components/CategoryList.js +0 -104
- package/dist/esm/ui/ElementBrowser/components/ElementBrowserLoader.js +0 -23
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +0 -238
- package/dist/esm/ui/ElementBrowser/components/ElementList/EmptyState.js +0 -40
- package/dist/esm/ui/ElementBrowser/components/ElementList/NotFoundIllustration.js +0 -62
- package/dist/esm/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +0 -37
- package/dist/esm/ui/ElementBrowser/components/ElementList/utils.js +0 -46
- package/dist/esm/ui/ElementBrowser/components/ElementSearch.js +0 -77
- package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +0 -258
- package/dist/esm/ui/ElementBrowser/constants.js +0 -24
- package/dist/esm/ui/ElementBrowser/hooks/use-container-width.js +0 -61
- package/dist/esm/ui/ElementBrowser/hooks/use-focus.js +0 -46
- package/dist/esm/ui/ElementBrowser/hooks/use-select-and-focus-on-arrow-navigation.js +0 -278
- package/dist/esm/ui/ElementBrowser/index.js +0 -2
- package/dist/types/ui/ElementBrowser/ElementBrowser.d.ts +0 -37
- package/dist/types/ui/ElementBrowser/ViewMore.d.ts +0 -6
- package/dist/types/ui/ElementBrowser/components/CategoryList.d.ts +0 -10
- package/dist/types/ui/ElementBrowser/components/ElementBrowserLoader.d.ts +0 -5
- package/dist/types/ui/ElementBrowser/components/ElementList/ElementList.d.ts +0 -29
- package/dist/types/ui/ElementBrowser/components/ElementList/EmptyState.d.ts +0 -6
- package/dist/types/ui/ElementBrowser/components/ElementList/NotFoundIllustration.d.ts +0 -2
- package/dist/types/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.d.ts +0 -7
- package/dist/types/ui/ElementBrowser/components/ElementList/utils.d.ts +0 -12
- package/dist/types/ui/ElementBrowser/components/ElementSearch.d.ts +0 -18
- package/dist/types/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +0 -23
- package/dist/types/ui/ElementBrowser/constants.d.ts +0 -20
- package/dist/types/ui/ElementBrowser/hooks/use-container-width.d.ts +0 -33
- package/dist/types/ui/ElementBrowser/hooks/use-focus.d.ts +0 -35
- package/dist/types/ui/ElementBrowser/hooks/use-select-and-focus-on-arrow-navigation.d.ts +0 -72
- package/dist/types/ui/ElementBrowser/index.d.ts +0 -2
- package/dist/types-ts4.5/ui/ElementBrowser/ElementBrowser.d.ts +0 -37
- package/dist/types-ts4.5/ui/ElementBrowser/ViewMore.d.ts +0 -6
- package/dist/types-ts4.5/ui/ElementBrowser/components/CategoryList.d.ts +0 -10
- package/dist/types-ts4.5/ui/ElementBrowser/components/ElementBrowserLoader.d.ts +0 -5
- package/dist/types-ts4.5/ui/ElementBrowser/components/ElementList/ElementList.d.ts +0 -29
- package/dist/types-ts4.5/ui/ElementBrowser/components/ElementList/EmptyState.d.ts +0 -6
- package/dist/types-ts4.5/ui/ElementBrowser/components/ElementList/NotFoundIllustration.d.ts +0 -2
- package/dist/types-ts4.5/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.d.ts +0 -7
- package/dist/types-ts4.5/ui/ElementBrowser/components/ElementList/utils.d.ts +0 -12
- package/dist/types-ts4.5/ui/ElementBrowser/components/ElementSearch.d.ts +0 -18
- package/dist/types-ts4.5/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +0 -23
- package/dist/types-ts4.5/ui/ElementBrowser/constants.d.ts +0 -20
- package/dist/types-ts4.5/ui/ElementBrowser/hooks/use-container-width.d.ts +0 -33
- package/dist/types-ts4.5/ui/ElementBrowser/hooks/use-focus.d.ts +0 -35
- package/dist/types-ts4.5/ui/ElementBrowser/hooks/use-select-and-focus-on-arrow-navigation.d.ts +0 -72
- package/dist/types-ts4.5/ui/ElementBrowser/index.d.ts +0 -2
- /package/dist/cjs/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/categories.js +0 -0
- /package/dist/cjs/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/messages.js +0 -0
- /package/dist/es2019/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/categories.js +0 -0
- /package/dist/es2019/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/messages.js +0 -0
- /package/dist/esm/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/categories.js +0 -0
- /package/dist/esm/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/messages.js +0 -0
- /package/dist/types/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/messages.d.ts +0 -0
- /package/dist/types-ts4.5/{ui/ElementBrowser → plugins/quick-insert/ui/ModalElementBrowser}/messages.d.ts +0 -0
|
@@ -22,8 +22,8 @@ export default function useEditorConstructor(performanceTracking, featureFlags,
|
|
|
22
22
|
startMeasure(measurements.EDITOR_MOUNTED);
|
|
23
23
|
if (performanceTracking !== null && performanceTracking !== void 0 && (_performanceTracking$ = performanceTracking.ttiTracking) !== null && _performanceTracking$ !== void 0 && _performanceTracking$.enabled || featureFlags !== null && featureFlags !== void 0 && featureFlags.ufo) {
|
|
24
24
|
var _performanceTracking$2, _performanceTracking$3;
|
|
25
|
-
measureTTI((tti, ttiFromInvocation, canceled) => {
|
|
26
|
-
editorMeasureTTICallback(tti, ttiFromInvocation, canceled, performanceTracking, featureFlags, createAnalyticsEvent, getExperienceStore());
|
|
25
|
+
measureTTI((tti, ttiFromInvocation, canceled, distortedDuration) => {
|
|
26
|
+
editorMeasureTTICallback(tti, ttiFromInvocation, canceled, distortedDuration, performanceTracking, featureFlags, createAnalyticsEvent, getExperienceStore());
|
|
27
27
|
}, performanceTracking === null || performanceTracking === void 0 ? void 0 : (_performanceTracking$2 = performanceTracking.ttiTracking) === null || _performanceTracking$2 === void 0 ? void 0 : _performanceTracking$2.ttiIdleThreshold, performanceTracking === null || performanceTracking === void 0 ? void 0 : (_performanceTracking$3 = performanceTracking.ttiTracking) === null || _performanceTracking$3 === void 0 ? void 0 : _performanceTracking$3.ttiCancelTimeout);
|
|
28
28
|
}
|
|
29
29
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { EditorExperience } from '@atlaskit/editor-common/ufo';
|
|
3
3
|
import { getTTISeverity } from '@atlaskit/editor-common/utils';
|
|
4
|
-
export default function editorMeasureTTICallback(tti, ttiFromInvocation, canceled, performanceTracking, featureFlags, createAnalyticsEvent, experienceStore) {
|
|
4
|
+
export default function editorMeasureTTICallback(tti, ttiFromInvocation, canceled, distortedDuration, performanceTracking, featureFlags, createAnalyticsEvent, experienceStore) {
|
|
5
5
|
var _performanceTracking$;
|
|
6
6
|
if (performanceTracking !== null && performanceTracking !== void 0 && (_performanceTracking$ = performanceTracking.ttiTracking) !== null && _performanceTracking$ !== void 0 && _performanceTracking$.enabled && createAnalyticsEvent) {
|
|
7
7
|
var _ttiTracking;
|
|
@@ -12,7 +12,8 @@ export default function editorMeasureTTICallback(tti, ttiFromInvocation, cancele
|
|
|
12
12
|
attributes: {
|
|
13
13
|
tti,
|
|
14
14
|
ttiFromInvocation,
|
|
15
|
-
canceled
|
|
15
|
+
canceled,
|
|
16
|
+
distortedDuration
|
|
16
17
|
},
|
|
17
18
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
18
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ElementBrowser } from '@atlaskit/editor-common/element-browser';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
2
3
|
import { PluginKey, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
5
|
import { media, mediaGroup, mediaInline, mediaSingleSpec } from '@atlaskit/adf-schema';
|
|
@@ -16,14 +17,31 @@ import { ReactMediaSingleNode } from './nodeviews/mediaSingle';
|
|
|
16
17
|
import { floatingToolbar } from './toolbar';
|
|
17
18
|
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
18
19
|
import { IconImages } from '@atlaskit/editor-common/quick-insert';
|
|
19
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
20
20
|
import { MediaPickerComponents } from './ui/MediaPicker';
|
|
21
|
-
import { messages } from '
|
|
21
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
22
22
|
import { ReactMediaNode } from './nodeviews/mediaNodeView';
|
|
23
23
|
import { ReactMediaInlineNode } from './nodeviews/mediaInline';
|
|
24
24
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
25
25
|
import { stateKey } from './pm-plugins/plugin-key';
|
|
26
26
|
export { insertMediaSingleNode } from './utils/media-single';
|
|
27
|
+
const MediaPickerFunctionalComponent = ({
|
|
28
|
+
api,
|
|
29
|
+
editorDomElement,
|
|
30
|
+
appearance
|
|
31
|
+
}) => {
|
|
32
|
+
const {
|
|
33
|
+
mediaState
|
|
34
|
+
} = useSharedPluginState(api, ['media']);
|
|
35
|
+
if (!mediaState) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return /*#__PURE__*/React.createElement(MediaPickerComponents, {
|
|
39
|
+
editorDomElement: editorDomElement,
|
|
40
|
+
mediaState: mediaState,
|
|
41
|
+
appearance: appearance,
|
|
42
|
+
api: api
|
|
43
|
+
});
|
|
44
|
+
};
|
|
27
45
|
const mediaPlugin = ({
|
|
28
46
|
config: options = {},
|
|
29
47
|
api
|
|
@@ -99,6 +117,7 @@ const mediaPlugin = ({
|
|
|
99
117
|
mediaGroup: ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
100
118
|
mediaSingle: ReactMediaSingleNode(portalProviderAPI, eventDispatcher, providerFactory, api, dispatchAnalyticsEvent, options),
|
|
101
119
|
media: ReactMediaNode(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
120
|
+
// @ts-expect-error
|
|
102
121
|
mediaInline: ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory, api)
|
|
103
122
|
},
|
|
104
123
|
errorReporter,
|
|
@@ -193,20 +212,11 @@ const mediaPlugin = ({
|
|
|
193
212
|
editorView,
|
|
194
213
|
appearance
|
|
195
214
|
}) {
|
|
196
|
-
return /*#__PURE__*/React.createElement(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
render: ({
|
|
202
|
-
mediaState
|
|
203
|
-
}) => /*#__PURE__*/React.createElement(MediaPickerComponents, {
|
|
204
|
-
editorDomElement: editorView.dom,
|
|
205
|
-
mediaState: mediaState,
|
|
206
|
-
appearance: appearance,
|
|
207
|
-
api: api
|
|
208
|
-
})
|
|
209
|
-
}));
|
|
215
|
+
return /*#__PURE__*/React.createElement(MediaPickerFunctionalComponent, {
|
|
216
|
+
editorDomElement: editorView.dom,
|
|
217
|
+
appearance: appearance,
|
|
218
|
+
api: api
|
|
219
|
+
});
|
|
210
220
|
},
|
|
211
221
|
secondaryToolbarComponent({
|
|
212
222
|
editorView,
|
|
@@ -214,11 +224,9 @@ const mediaPlugin = ({
|
|
|
214
224
|
disabled
|
|
215
225
|
}) {
|
|
216
226
|
return /*#__PURE__*/React.createElement(ToolbarMedia, {
|
|
217
|
-
editorView: editorView,
|
|
218
|
-
eventDispatcher: eventDispatcher,
|
|
219
|
-
pluginKey: pluginKey,
|
|
220
227
|
isDisabled: disabled,
|
|
221
|
-
isReducedSpacing: true
|
|
228
|
+
isReducedSpacing: true,
|
|
229
|
+
api: api
|
|
222
230
|
});
|
|
223
231
|
},
|
|
224
232
|
pluginsOptions: {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
3
|
-
import
|
|
3
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
5
5
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import { MediaInlineNodeSelector } from './styles';
|
|
7
|
-
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
8
7
|
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
9
8
|
import { MediaInlineCardLoadingView } from '@atlaskit/media-ui';
|
|
10
9
|
export const createMediaNodeUpdater = props => {
|
|
@@ -111,6 +110,33 @@ export const MediaInline = props => {
|
|
|
111
110
|
mediaClientConfig: viewMediaClientConfig
|
|
112
111
|
});
|
|
113
112
|
};
|
|
113
|
+
const MediaInlineSharedState = ({
|
|
114
|
+
identifier,
|
|
115
|
+
mediaProvider,
|
|
116
|
+
node,
|
|
117
|
+
isSelected,
|
|
118
|
+
getPos,
|
|
119
|
+
contextIdentifierProvider,
|
|
120
|
+
api,
|
|
121
|
+
view
|
|
122
|
+
}) => {
|
|
123
|
+
const {
|
|
124
|
+
mediaState
|
|
125
|
+
} = useSharedPluginState(api, ['media']);
|
|
126
|
+
if (!mediaState) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
return /*#__PURE__*/React.createElement(MediaInline, {
|
|
130
|
+
identifier: identifier,
|
|
131
|
+
mediaProvider: mediaProvider,
|
|
132
|
+
mediaPluginState: mediaState,
|
|
133
|
+
node: node,
|
|
134
|
+
isSelected: isSelected,
|
|
135
|
+
view: view,
|
|
136
|
+
getPos: getPos,
|
|
137
|
+
contextIdentifierProvider: contextIdentifierProvider
|
|
138
|
+
});
|
|
139
|
+
};
|
|
114
140
|
export class MediaInlineNodeView extends SelectionBasedNodeView {
|
|
115
141
|
createDomRef() {
|
|
116
142
|
const domRef = document.createElement('span');
|
|
@@ -135,8 +161,12 @@ export class MediaInlineNodeView extends SelectionBasedNodeView {
|
|
|
135
161
|
}
|
|
136
162
|
render(props) {
|
|
137
163
|
const {
|
|
138
|
-
providerFactory
|
|
164
|
+
providerFactory,
|
|
165
|
+
api
|
|
139
166
|
} = props;
|
|
167
|
+
const {
|
|
168
|
+
view
|
|
169
|
+
} = this;
|
|
140
170
|
const getPos = this.getPos;
|
|
141
171
|
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
142
172
|
providers: ['mediaProvider', 'contextIdentifierProvider'],
|
|
@@ -148,36 +178,24 @@ export class MediaInlineNodeView extends SelectionBasedNodeView {
|
|
|
148
178
|
if (!mediaProvider) {
|
|
149
179
|
return null;
|
|
150
180
|
}
|
|
151
|
-
return /*#__PURE__*/React.createElement(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
return /*#__PURE__*/React.createElement(MediaInline, {
|
|
163
|
-
identifier: this.node.attrs.id,
|
|
164
|
-
mediaProvider: mediaProvider,
|
|
165
|
-
mediaPluginState: mediaPluginState,
|
|
166
|
-
node: this.node,
|
|
167
|
-
isSelected: this.nodeInsideSelection(),
|
|
168
|
-
view: this.view,
|
|
169
|
-
getPos: getPos,
|
|
170
|
-
contextIdentifierProvider: contextIdentifierProvider
|
|
171
|
-
});
|
|
172
|
-
}
|
|
181
|
+
return /*#__PURE__*/React.createElement(MediaInlineSharedState, {
|
|
182
|
+
identifier: this.node.attrs.id,
|
|
183
|
+
mediaProvider: mediaProvider,
|
|
184
|
+
node: this.node,
|
|
185
|
+
isSelected: this.nodeInsideSelection(),
|
|
186
|
+
view: view,
|
|
187
|
+
getPos: getPos,
|
|
188
|
+
contextIdentifierProvider: contextIdentifierProvider,
|
|
189
|
+
api: api
|
|
173
190
|
});
|
|
174
191
|
}
|
|
175
192
|
});
|
|
176
193
|
}
|
|
177
194
|
}
|
|
178
|
-
export const ReactMediaInlineNode = (portalProviderAPI, eventDispatcher, providerFactory,
|
|
195
|
+
export const ReactMediaInlineNode = (portalProviderAPI, eventDispatcher, providerFactory, api, dispatchAnalyticsEvent) => (node, view, getPos) => {
|
|
179
196
|
return new MediaInlineNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
180
197
|
providerFactory,
|
|
181
|
-
dispatchAnalyticsEvent
|
|
198
|
+
dispatchAnalyticsEvent,
|
|
199
|
+
api
|
|
182
200
|
}).init();
|
|
183
201
|
};
|
|
@@ -1,45 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import AttachmentIcon from '@atlaskit/icon/glyph/editor/attachment';
|
|
3
|
-
import ToolbarButton,
|
|
4
|
-
import WithPluginState from '../../../../ui/WithPluginState';
|
|
3
|
+
import { ToolbarButton, TOOLBAR_BUTTON } from '@atlaskit/editor-common/ui-menu';
|
|
5
4
|
import { toolbarMediaMessages } from './toolbar-media-messages';
|
|
5
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
6
6
|
import { injectIntl } from 'react-intl-next';
|
|
7
7
|
const onClickMediaButton = pluginState => () => {
|
|
8
8
|
pluginState.showMediaPicker();
|
|
9
9
|
return true;
|
|
10
10
|
};
|
|
11
11
|
const ToolbarMedia = ({
|
|
12
|
-
editorView,
|
|
13
|
-
eventDispatcher,
|
|
14
|
-
pluginKey,
|
|
15
12
|
isDisabled,
|
|
16
13
|
isReducedSpacing,
|
|
17
|
-
intl
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
mediaPlugin
|
|
26
|
-
}) => {
|
|
27
|
-
if (!(mediaPlugin !== null && mediaPlugin !== void 0 && mediaPlugin.allowsUploads)) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
const {
|
|
31
|
-
toolbarMediaTitle
|
|
32
|
-
} = toolbarMediaMessages;
|
|
33
|
-
return /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
34
|
-
buttonId: TOOLBAR_BUTTON.MEDIA,
|
|
35
|
-
onClick: onClickMediaButton(mediaPlugin),
|
|
36
|
-
disabled: isDisabled,
|
|
37
|
-
title: intl.formatMessage(toolbarMediaTitle),
|
|
38
|
-
spacing: isReducedSpacing ? 'none' : 'default',
|
|
39
|
-
iconBefore: /*#__PURE__*/React.createElement(AttachmentIcon, {
|
|
40
|
-
label: intl.formatMessage(toolbarMediaTitle)
|
|
41
|
-
})
|
|
42
|
-
});
|
|
14
|
+
intl,
|
|
15
|
+
api
|
|
16
|
+
}) => {
|
|
17
|
+
const {
|
|
18
|
+
mediaState
|
|
19
|
+
} = useSharedPluginState(api, ['media']);
|
|
20
|
+
if (!(mediaState !== null && mediaState !== void 0 && mediaState.allowsUploads)) {
|
|
21
|
+
return null;
|
|
43
22
|
}
|
|
44
|
-
|
|
23
|
+
const {
|
|
24
|
+
toolbarMediaTitle
|
|
25
|
+
} = toolbarMediaMessages;
|
|
26
|
+
return /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
27
|
+
buttonId: TOOLBAR_BUTTON.MEDIA,
|
|
28
|
+
onClick: onClickMediaButton(mediaState),
|
|
29
|
+
disabled: isDisabled,
|
|
30
|
+
title: intl.formatMessage(toolbarMediaTitle),
|
|
31
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
32
|
+
iconBefore: /*#__PURE__*/React.createElement(AttachmentIcon, {
|
|
33
|
+
label: intl.formatMessage(toolbarMediaTitle)
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
};
|
|
45
37
|
export default injectIntl(ToolbarMedia);
|
|
@@ -48,7 +48,8 @@ const quickInsertPlugin = ({
|
|
|
48
48
|
if (options !== null && options !== void 0 && options.enableElementBrowser) {
|
|
49
49
|
return /*#__PURE__*/React.createElement(ModalElementBrowser, {
|
|
50
50
|
editorView: editorView,
|
|
51
|
-
helpUrl: options === null || options === void 0 ? void 0 : options.elementBrowserHelpUrl
|
|
51
|
+
helpUrl: options === null || options === void 0 ? void 0 : options.elementBrowserHelpUrl,
|
|
52
|
+
pluginInjectionAPI: api
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
return null;
|
|
@@ -64,7 +65,8 @@ const quickInsertPlugin = ({
|
|
|
64
65
|
return {
|
|
65
66
|
lazyDefaultItems: quickInsertState.lazyDefaultItems,
|
|
66
67
|
emptyStateHandler: quickInsertState.emptyStateHandler,
|
|
67
|
-
providedItems: quickInsertState.providedItems
|
|
68
|
+
providedItems: quickInsertState.providedItems,
|
|
69
|
+
isElementBrowserModalOpen: quickInsertState.isElementBrowserModalOpen
|
|
68
70
|
};
|
|
69
71
|
},
|
|
70
72
|
actions: {
|
|
@@ -8,23 +8,23 @@ import { borderRadius } from '@atlaskit/theme/constants';
|
|
|
8
8
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
9
9
|
import Modal, { ModalTransition, useModal } from '@atlaskit/modal-dialog';
|
|
10
10
|
import QuestionCircleIcon from '@atlaskit/icon/glyph/question-circle';
|
|
11
|
-
import ElementBrowser from '
|
|
11
|
+
import { ElementBrowser } from '@atlaskit/editor-common/element-browser';
|
|
12
12
|
import { getCategories } from './categories';
|
|
13
|
-
import { MODAL_WRAPPER_PADDING } from './constants';
|
|
14
13
|
import { messages } from './messages';
|
|
14
|
+
export const MODAL_WRAPPER_PADDING = 16;
|
|
15
15
|
const actions = css`
|
|
16
16
|
display: inline-flex;
|
|
17
17
|
margin: 0 -4px;
|
|
18
18
|
`;
|
|
19
19
|
const actionItem = css`
|
|
20
20
|
flex: 1 0 auto;
|
|
21
|
-
margin: 0 4px;
|
|
21
|
+
margin: 0 ${"var(--ds-space-050, 4px)"};
|
|
22
22
|
`;
|
|
23
23
|
const wrapper = css`
|
|
24
24
|
display: flex;
|
|
25
25
|
flex: 1 1 auto;
|
|
26
26
|
box-sizing: border-box;
|
|
27
|
-
padding: ${
|
|
27
|
+
padding: ${"var(--ds-space-200, 16px)"} ${"var(--ds-space-200, 16px)"} 0 10px;
|
|
28
28
|
overflow: hidden;
|
|
29
29
|
background-color: ${themed({
|
|
30
30
|
light: `var(--ds-surface-overlay, ${N0})`,
|
|
@@ -34,7 +34,7 @@ const wrapper = css`
|
|
|
34
34
|
`;
|
|
35
35
|
const modalFooter = css`
|
|
36
36
|
display: flex;
|
|
37
|
-
padding: ${
|
|
37
|
+
padding: ${"var(--ds-space-200, 16px)"};
|
|
38
38
|
|
|
39
39
|
position: relative;
|
|
40
40
|
align-items: center;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { pluginKey } from '../../plugin-key';
|
|
4
|
-
import ModalElementBrowser from '../../../../ui/ElementBrowser/ModalElementBrowser';
|
|
2
|
+
import ModalElementBrowser from './ModalElementBrowser';
|
|
5
3
|
import { closeElementBrowserModal, insertItem } from '../../commands';
|
|
6
4
|
import { getQuickInsertSuggestions } from '../../search';
|
|
5
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
6
|
const Modal = ({
|
|
8
7
|
quickInsertState,
|
|
9
8
|
editorView,
|
|
@@ -38,19 +37,15 @@ const Modal = ({
|
|
|
38
37
|
};
|
|
39
38
|
export default (({
|
|
40
39
|
editorView,
|
|
41
|
-
helpUrl
|
|
40
|
+
helpUrl,
|
|
41
|
+
pluginInjectionAPI
|
|
42
42
|
}) => {
|
|
43
|
-
const
|
|
43
|
+
const {
|
|
44
44
|
quickInsertState
|
|
45
|
-
}
|
|
46
|
-
|
|
45
|
+
} = useSharedPluginState(pluginInjectionAPI, ['quickInsert']);
|
|
46
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
47
|
+
quickInsertState: quickInsertState !== null && quickInsertState !== void 0 ? quickInsertState : undefined,
|
|
47
48
|
editorView: editorView,
|
|
48
49
|
helpUrl: helpUrl
|
|
49
|
-
}), [editorView, helpUrl]);
|
|
50
|
-
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
51
|
-
plugins: {
|
|
52
|
-
quickInsertState: pluginKey
|
|
53
|
-
},
|
|
54
|
-
render: render
|
|
55
50
|
});
|
|
56
51
|
});
|
|
@@ -9,9 +9,8 @@ import { borderRadius } from '@atlaskit/theme';
|
|
|
9
9
|
import { themed } from '@atlaskit/theme/components';
|
|
10
10
|
import { DN50, N0, N30A, N60A } from '@atlaskit/theme/colors';
|
|
11
11
|
import { IconCode, IconDate, IconDecision, IconDivider, IconExpand, IconPanel, IconQuote, IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
12
|
-
import withOuterListeners from '
|
|
13
|
-
import ElementBrowser from '
|
|
14
|
-
import { ELEMENT_ITEM_HEIGHT } from './constants';
|
|
12
|
+
import { withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
13
|
+
import { ElementBrowser, ELEMENT_ITEM_HEIGHT } from '@atlaskit/editor-common/element-browser';
|
|
15
14
|
const InsertMenu = ({
|
|
16
15
|
editorView,
|
|
17
16
|
dropdownItems,
|
|
@@ -22,8 +22,8 @@ export default function useEditorConstructor(performanceTracking, featureFlags,
|
|
|
22
22
|
startMeasure(measurements.EDITOR_MOUNTED);
|
|
23
23
|
if (performanceTracking !== null && performanceTracking !== void 0 && (_performanceTracking$ = performanceTracking.ttiTracking) !== null && _performanceTracking$ !== void 0 && _performanceTracking$.enabled || featureFlags !== null && featureFlags !== void 0 && featureFlags.ufo) {
|
|
24
24
|
var _performanceTracking$2, _performanceTracking$3;
|
|
25
|
-
measureTTI(function (tti, ttiFromInvocation, canceled) {
|
|
26
|
-
editorMeasureTTICallback(tti, ttiFromInvocation, canceled, performanceTracking, featureFlags, createAnalyticsEvent, getExperienceStore());
|
|
25
|
+
measureTTI(function (tti, ttiFromInvocation, canceled, distortedDuration) {
|
|
26
|
+
editorMeasureTTICallback(tti, ttiFromInvocation, canceled, distortedDuration, performanceTracking, featureFlags, createAnalyticsEvent, getExperienceStore());
|
|
27
27
|
}, performanceTracking === null || performanceTracking === void 0 ? void 0 : (_performanceTracking$2 = performanceTracking.ttiTracking) === null || _performanceTracking$2 === void 0 ? void 0 : _performanceTracking$2.ttiIdleThreshold, performanceTracking === null || performanceTracking === void 0 ? void 0 : (_performanceTracking$3 = performanceTracking.ttiTracking) === null || _performanceTracking$3 === void 0 ? void 0 : _performanceTracking$3.ttiCancelTimeout);
|
|
28
28
|
}
|
|
29
29
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { EditorExperience } from '@atlaskit/editor-common/ufo';
|
|
3
3
|
import { getTTISeverity } from '@atlaskit/editor-common/utils';
|
|
4
|
-
export default function editorMeasureTTICallback(tti, ttiFromInvocation, canceled, performanceTracking, featureFlags, createAnalyticsEvent, experienceStore) {
|
|
4
|
+
export default function editorMeasureTTICallback(tti, ttiFromInvocation, canceled, distortedDuration, performanceTracking, featureFlags, createAnalyticsEvent, experienceStore) {
|
|
5
5
|
var _performanceTracking$;
|
|
6
6
|
if (performanceTracking !== null && performanceTracking !== void 0 && (_performanceTracking$ = performanceTracking.ttiTracking) !== null && _performanceTracking$ !== void 0 && _performanceTracking$.enabled && createAnalyticsEvent) {
|
|
7
7
|
var _ttiTracking;
|
|
@@ -12,7 +12,8 @@ export default function editorMeasureTTICallback(tti, ttiFromInvocation, cancele
|
|
|
12
12
|
attributes: {
|
|
13
13
|
tti: tti,
|
|
14
14
|
ttiFromInvocation: ttiFromInvocation,
|
|
15
|
-
canceled: canceled
|
|
15
|
+
canceled: canceled,
|
|
16
|
+
distortedDuration: distortedDuration
|
|
16
17
|
},
|
|
17
18
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
18
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ElementBrowser } from '@atlaskit/editor-common/element-browser';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
2
3
|
import { PluginKey, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
5
|
import { media, mediaGroup, mediaInline, mediaSingleSpec } from '@atlaskit/adf-schema';
|
|
@@ -16,19 +17,34 @@ import { ReactMediaSingleNode } from './nodeviews/mediaSingle';
|
|
|
16
17
|
import { floatingToolbar as _floatingToolbar } from './toolbar';
|
|
17
18
|
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
18
19
|
import { IconImages } from '@atlaskit/editor-common/quick-insert';
|
|
19
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
20
20
|
import { MediaPickerComponents } from './ui/MediaPicker';
|
|
21
|
-
import { messages } from '
|
|
21
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
22
22
|
import { ReactMediaNode } from './nodeviews/mediaNodeView';
|
|
23
23
|
import { ReactMediaInlineNode } from './nodeviews/mediaInline';
|
|
24
24
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
25
25
|
import { stateKey } from './pm-plugins/plugin-key';
|
|
26
26
|
export { insertMediaSingleNode } from './utils/media-single';
|
|
27
|
-
var
|
|
27
|
+
var MediaPickerFunctionalComponent = function MediaPickerFunctionalComponent(_ref) {
|
|
28
|
+
var api = _ref.api,
|
|
29
|
+
editorDomElement = _ref.editorDomElement,
|
|
30
|
+
appearance = _ref.appearance;
|
|
31
|
+
var _useSharedPluginState = useSharedPluginState(api, ['media']),
|
|
32
|
+
mediaState = _useSharedPluginState.mediaState;
|
|
33
|
+
if (!mediaState) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return /*#__PURE__*/React.createElement(MediaPickerComponents, {
|
|
37
|
+
editorDomElement: editorDomElement,
|
|
38
|
+
mediaState: mediaState,
|
|
39
|
+
appearance: appearance,
|
|
40
|
+
api: api
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
var mediaPlugin = function mediaPlugin(_ref2) {
|
|
28
44
|
var _api$featureFlags;
|
|
29
|
-
var
|
|
30
|
-
options =
|
|
31
|
-
api =
|
|
45
|
+
var _ref2$config = _ref2.config,
|
|
46
|
+
options = _ref2$config === void 0 ? {} : _ref2$config,
|
|
47
|
+
api = _ref2.api;
|
|
32
48
|
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
33
49
|
return {
|
|
34
50
|
name: 'media',
|
|
@@ -39,12 +55,12 @@ var mediaPlugin = function mediaPlugin(_ref) {
|
|
|
39
55
|
return stateKey.getState(editorState) || null;
|
|
40
56
|
},
|
|
41
57
|
nodes: function nodes() {
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
allowMediaGroup =
|
|
45
|
-
|
|
46
|
-
allowMediaSingle =
|
|
47
|
-
mediaFeatureFlags =
|
|
58
|
+
var _ref3 = options || {},
|
|
59
|
+
_ref3$allowMediaGroup = _ref3.allowMediaGroup,
|
|
60
|
+
allowMediaGroup = _ref3$allowMediaGroup === void 0 ? true : _ref3$allowMediaGroup,
|
|
61
|
+
_ref3$allowMediaSingl = _ref3.allowMediaSingle,
|
|
62
|
+
allowMediaSingle = _ref3$allowMediaSingl === void 0 ? false : _ref3$allowMediaSingl,
|
|
63
|
+
mediaFeatureFlags = _ref3.featureFlags;
|
|
48
64
|
var captions = getMediaFeatureFlag('captions', mediaFeatureFlags);
|
|
49
65
|
var allowMediaInline = getMediaFeatureFlag('mediaInline', mediaFeatureFlags);
|
|
50
66
|
var mediaSingleOption = getBooleanFF('platform.editor.media.extended-resize-experience') ? {
|
|
@@ -83,22 +99,23 @@ var mediaPlugin = function mediaPlugin(_ref) {
|
|
|
83
99
|
pmPlugins: function pmPlugins() {
|
|
84
100
|
var pmPlugins = [{
|
|
85
101
|
name: 'media',
|
|
86
|
-
plugin: function plugin(
|
|
87
|
-
var schema =
|
|
88
|
-
dispatch =
|
|
89
|
-
getIntl =
|
|
90
|
-
eventDispatcher =
|
|
91
|
-
providerFactory =
|
|
92
|
-
errorReporter =
|
|
93
|
-
portalProviderAPI =
|
|
94
|
-
reactContext =
|
|
95
|
-
dispatchAnalyticsEvent =
|
|
102
|
+
plugin: function plugin(_ref4) {
|
|
103
|
+
var schema = _ref4.schema,
|
|
104
|
+
dispatch = _ref4.dispatch,
|
|
105
|
+
getIntl = _ref4.getIntl,
|
|
106
|
+
eventDispatcher = _ref4.eventDispatcher,
|
|
107
|
+
providerFactory = _ref4.providerFactory,
|
|
108
|
+
errorReporter = _ref4.errorReporter,
|
|
109
|
+
portalProviderAPI = _ref4.portalProviderAPI,
|
|
110
|
+
reactContext = _ref4.reactContext,
|
|
111
|
+
dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent;
|
|
96
112
|
return createPlugin(schema, {
|
|
97
113
|
providerFactory: providerFactory,
|
|
98
114
|
nodeViews: {
|
|
99
115
|
mediaGroup: ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
100
116
|
mediaSingle: ReactMediaSingleNode(portalProviderAPI, eventDispatcher, providerFactory, api, dispatchAnalyticsEvent, options),
|
|
101
117
|
media: ReactMediaNode(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
118
|
+
// @ts-expect-error
|
|
102
119
|
mediaInline: ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory, api)
|
|
103
120
|
},
|
|
104
121
|
errorReporter: errorReporter,
|
|
@@ -119,8 +136,8 @@ var mediaPlugin = function mediaPlugin(_ref) {
|
|
|
119
136
|
if (options && options.allowMediaSingle) {
|
|
120
137
|
pmPlugins.push({
|
|
121
138
|
name: 'mediaSingleKeymap',
|
|
122
|
-
plugin: function plugin(
|
|
123
|
-
var schema =
|
|
139
|
+
plugin: function plugin(_ref5) {
|
|
140
|
+
var schema = _ref5.schema;
|
|
124
141
|
return keymapMediaSinglePlugin(schema);
|
|
125
142
|
}
|
|
126
143
|
});
|
|
@@ -132,9 +149,9 @@ var mediaPlugin = function mediaPlugin(_ref) {
|
|
|
132
149
|
});
|
|
133
150
|
pmPlugins.push({
|
|
134
151
|
name: 'mediaAltTextKeymap',
|
|
135
|
-
plugin: function plugin(
|
|
152
|
+
plugin: function plugin(_ref6) {
|
|
136
153
|
var _api$analytics2;
|
|
137
|
-
var schema =
|
|
154
|
+
var schema = _ref6.schema;
|
|
138
155
|
return keymapMediaAltTextPlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
139
156
|
}
|
|
140
157
|
});
|
|
@@ -142,15 +159,15 @@ var mediaPlugin = function mediaPlugin(_ref) {
|
|
|
142
159
|
if (options && options.allowLinking) {
|
|
143
160
|
pmPlugins.push({
|
|
144
161
|
name: 'mediaLinking',
|
|
145
|
-
plugin: function plugin(
|
|
146
|
-
var dispatch =
|
|
162
|
+
plugin: function plugin(_ref7) {
|
|
163
|
+
var dispatch = _ref7.dispatch;
|
|
147
164
|
return linkingPlugin(dispatch);
|
|
148
165
|
}
|
|
149
166
|
});
|
|
150
167
|
pmPlugins.push({
|
|
151
168
|
name: 'mediaLinkingKeymap',
|
|
152
|
-
plugin: function plugin(
|
|
153
|
-
var schema =
|
|
169
|
+
plugin: function plugin(_ref8) {
|
|
170
|
+
var schema = _ref8.schema;
|
|
154
171
|
return keymapLinkingPlugin(schema);
|
|
155
172
|
}
|
|
156
173
|
});
|
|
@@ -186,35 +203,23 @@ var mediaPlugin = function mediaPlugin(_ref) {
|
|
|
186
203
|
});
|
|
187
204
|
return pmPlugins;
|
|
188
205
|
},
|
|
189
|
-
contentComponent: function contentComponent(
|
|
190
|
-
var editorView =
|
|
191
|
-
appearance =
|
|
192
|
-
return /*#__PURE__*/React.createElement(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
render: function render(_ref9) {
|
|
198
|
-
var mediaState = _ref9.mediaState;
|
|
199
|
-
return /*#__PURE__*/React.createElement(MediaPickerComponents, {
|
|
200
|
-
editorDomElement: editorView.dom,
|
|
201
|
-
mediaState: mediaState,
|
|
202
|
-
appearance: appearance,
|
|
203
|
-
api: api
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
}));
|
|
206
|
+
contentComponent: function contentComponent(_ref9) {
|
|
207
|
+
var editorView = _ref9.editorView,
|
|
208
|
+
appearance = _ref9.appearance;
|
|
209
|
+
return /*#__PURE__*/React.createElement(MediaPickerFunctionalComponent, {
|
|
210
|
+
editorDomElement: editorView.dom,
|
|
211
|
+
appearance: appearance,
|
|
212
|
+
api: api
|
|
213
|
+
});
|
|
207
214
|
},
|
|
208
215
|
secondaryToolbarComponent: function secondaryToolbarComponent(_ref10) {
|
|
209
216
|
var editorView = _ref10.editorView,
|
|
210
217
|
eventDispatcher = _ref10.eventDispatcher,
|
|
211
218
|
disabled = _ref10.disabled;
|
|
212
219
|
return /*#__PURE__*/React.createElement(ToolbarMedia, {
|
|
213
|
-
editorView: editorView,
|
|
214
|
-
eventDispatcher: eventDispatcher,
|
|
215
|
-
pluginKey: pluginKey,
|
|
216
220
|
isDisabled: disabled,
|
|
217
|
-
isReducedSpacing: true
|
|
221
|
+
isReducedSpacing: true,
|
|
222
|
+
api: api
|
|
218
223
|
});
|
|
219
224
|
},
|
|
220
225
|
pluginsOptions: {
|