@atlaskit/editor-plugin-media 5.4.2 → 5.4.3

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/mediaPlugin.js +7 -28
  3. package/dist/cjs/nodeviews/mediaGroup.js +3 -14
  4. package/dist/cjs/nodeviews/mediaInline.js +9 -26
  5. package/dist/cjs/nodeviews/mediaNodeView/index.js +3 -18
  6. package/dist/cjs/nodeviews/mediaSingle.js +9 -29
  7. package/dist/cjs/ui/CommentBadge/index.js +8 -19
  8. package/dist/cjs/ui/MediaPicker/DropzoneWrapper.js +3 -13
  9. package/dist/cjs/ui/MediaPicker/PickerFacadeProvider.js +5 -20
  10. package/dist/cjs/ui/MediaPicker/index.js +4 -17
  11. package/dist/cjs/ui/ToolbarMedia/index.js +3 -13
  12. package/dist/cjs/ui/hooks/useMediaProvider.js +2 -11
  13. package/dist/es2019/mediaPlugin.js +3 -26
  14. package/dist/es2019/nodeviews/mediaGroup.js +2 -14
  15. package/dist/es2019/nodeviews/mediaInline.js +2 -20
  16. package/dist/es2019/nodeviews/mediaNodeView/index.js +4 -20
  17. package/dist/es2019/nodeviews/mediaSingle.js +2 -23
  18. package/dist/es2019/ui/CommentBadge/index.js +3 -15
  19. package/dist/es2019/ui/MediaPicker/DropzoneWrapper.js +2 -13
  20. package/dist/es2019/ui/MediaPicker/PickerFacadeProvider.js +3 -17
  21. package/dist/es2019/ui/MediaPicker/index.js +2 -16
  22. package/dist/es2019/ui/ToolbarMedia/index.js +2 -13
  23. package/dist/es2019/ui/hooks/useMediaProvider.js +2 -12
  24. package/dist/esm/mediaPlugin.js +8 -29
  25. package/dist/esm/nodeviews/mediaGroup.js +4 -15
  26. package/dist/esm/nodeviews/mediaInline.js +10 -27
  27. package/dist/esm/nodeviews/mediaNodeView/index.js +4 -19
  28. package/dist/esm/nodeviews/mediaSingle.js +10 -30
  29. package/dist/esm/ui/CommentBadge/index.js +9 -20
  30. package/dist/esm/ui/MediaPicker/DropzoneWrapper.js +4 -14
  31. package/dist/esm/ui/MediaPicker/PickerFacadeProvider.js +7 -22
  32. package/dist/esm/ui/MediaPicker/index.js +5 -18
  33. package/dist/esm/ui/ToolbarMedia/index.js +4 -14
  34. package/dist/esm/ui/hooks/useMediaProvider.js +3 -12
  35. package/package.json +3 -3
@@ -8,7 +8,7 @@ import { useCallback, useMemo } from 'react';
8
8
 
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
10
  import { jsx } from '@emotion/react';
11
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
11
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
12
12
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
13
13
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
14
14
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
@@ -29,27 +29,6 @@ const selector = states => {
29
29
  viewMode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
30
30
  };
31
31
  };
32
- const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
33
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['width', 'media', 'annotation', 'editorDisabled', 'editorViewMode'], selector);
34
- }, pluginInjectionApi => {
35
- const {
36
- widthState,
37
- mediaState,
38
- annotationState,
39
- editorDisabledState,
40
- editorViewModeState
41
- } = useSharedPluginState(pluginInjectionApi, ['width', 'media', 'annotation', 'editorDisabled', 'editorViewMode']);
42
- return {
43
- mediaProviderPromise: mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider,
44
- addPendingTask: mediaState === null || mediaState === void 0 ? void 0 : mediaState.addPendingTask,
45
- isDrafting: annotationState === null || annotationState === void 0 ? void 0 : annotationState.isDrafting,
46
- targetNodeId: annotationState === null || annotationState === void 0 ? void 0 : annotationState.targetNodeId,
47
- width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
48
- lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength,
49
- editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled,
50
- viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
51
- };
52
- });
53
32
  const MediaSingleNodeWrapper = ({
54
33
  pluginInjectionApi,
55
34
  contextIdentifierProvider,
@@ -73,7 +52,7 @@ const MediaSingleNodeWrapper = ({
73
52
  lineLength,
74
53
  editorDisabled,
75
54
  viewMode
76
- } = useSharedState(pluginInjectionApi);
55
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['width', 'media', 'annotation', 'editorDisabled', 'editorViewMode'], selector);
77
56
  const interactionState = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.interactionState');
78
57
  const mediaProvider = useMemo(() => mediaProviderPromise ? Promise.resolve(mediaProviderPromise) : undefined, [mediaProviderPromise]);
79
58
  const isSelectedAndInteracted = useCallback(() => Boolean(selected() && interactionState !== 'hasNotHadInteraction'), [interactionState, selected]);
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback, useMemo, useState } from 'react';
2
2
  import { injectIntl } from 'react-intl-next';
3
3
  import { VIEW_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
5
  import { CommentBadge as CommentBadgeComponent, CommentBadgeNext } from '@atlaskit/editor-common/media-single';
6
6
  const selector = states => {
7
7
  var _states$annotationSta, _states$annotationSta2, _states$annotationSta3;
@@ -11,18 +11,6 @@ const selector = states => {
11
11
  annotations: (_states$annotationSta3 = states.annotationState) === null || _states$annotationSta3 === void 0 ? void 0 : _states$annotationSta3.annotations
12
12
  };
13
13
  };
14
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
15
- return useSharedPluginStateWithSelector(api, ['annotation'], selector);
16
- }, api => {
17
- const {
18
- annotationState
19
- } = useSharedPluginState(api, ['annotation']);
20
- return {
21
- selectedAnnotations: annotationState === null || annotationState === void 0 ? void 0 : annotationState.selectedAnnotations,
22
- isInlineCommentViewClosed: annotationState === null || annotationState === void 0 ? void 0 : annotationState.isInlineCommentViewClosed,
23
- annotations: annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations
24
- };
25
- });
26
14
  const CommentBadgeWrapper = ({
27
15
  api,
28
16
  mediaNode,
@@ -36,7 +24,7 @@ const CommentBadgeWrapper = ({
36
24
  selectedAnnotations,
37
25
  isInlineCommentViewClosed,
38
26
  annotations
39
- } = useSharedState(api);
27
+ } = useSharedPluginStateWithSelector(api, ['annotation'], selector);
40
28
  const [entered, setEntered] = useState(false);
41
29
  const {
42
30
  state: {
@@ -111,7 +99,7 @@ export const CommentBadgeNextWrapper = ({
111
99
  selectedAnnotations,
112
100
  isInlineCommentViewClosed,
113
101
  annotations
114
- } = useSharedState(api);
102
+ } = useSharedPluginStateWithSelector(api, ['annotation'], selector);
115
103
  const {
116
104
  state: {
117
105
  schema: {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
2
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
4
4
  import { Dropzone } from '@atlaskit/media-picker';
5
5
  import PickerFacadeProvider from './PickerFacadeProvider';
@@ -10,17 +10,6 @@ const selector = states => {
10
10
  handleDrag: (_states$mediaState2 = states.mediaState) === null || _states$mediaState2 === void 0 ? void 0 : _states$mediaState2.handleDrag
11
11
  };
12
12
  };
13
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
14
- return useSharedPluginStateWithSelector(api, ['media'], selector);
15
- }, api => {
16
- const {
17
- mediaState
18
- } = useSharedPluginState(api, ['media']);
19
- return {
20
- options: mediaState === null || mediaState === void 0 ? void 0 : mediaState.options,
21
- handleDrag: mediaState === null || mediaState === void 0 ? void 0 : mediaState.handleDrag
22
- };
23
- });
24
13
  const DropzoneWrapperInternal = ({
25
14
  api,
26
15
  isActive,
@@ -34,7 +23,7 @@ const DropzoneWrapperInternal = ({
34
23
  const {
35
24
  options,
36
25
  handleDrag
37
- } = useSharedState(api);
26
+ } = useSharedPluginStateWithSelector(api, ['media'], selector);
38
27
  const {
39
28
  customDropzoneContainer
40
29
  } = options || {};
@@ -1,6 +1,6 @@
1
- import { useCallback, useEffect, useMemo, useState } from 'react';
1
+ import { useCallback, useEffect, useState } from 'react';
2
2
  import { flushSync } from 'react-dom';
3
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { ErrorReporter } from '@atlaskit/editor-common/utils';
5
5
  import PickerFacade from '../../pm-plugins/picker-facade';
6
6
  const dummyMediaPickerObject = {
@@ -19,20 +19,6 @@ const selector = states => {
19
19
  options: (_states$mediaState4 = states.mediaState) === null || _states$mediaState4 === void 0 ? void 0 : _states$mediaState4.options
20
20
  };
21
21
  };
22
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
23
- return useSharedPluginStateWithSelector(api, ['media'], selector);
24
- }, api => {
25
- const {
26
- mediaState
27
- } = useSharedPluginState(api, ['media']);
28
- const mediaProvider = useMemo(() => mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider, [mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider]);
29
- return {
30
- mediaProvider,
31
- mediaOptions: mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaOptions,
32
- insertFile: mediaState === null || mediaState === void 0 ? void 0 : mediaState.insertFile,
33
- options: mediaState === null || mediaState === void 0 ? void 0 : mediaState.options
34
- };
35
- });
36
22
  export default function PickerFacadeProvider({
37
23
  api,
38
24
  analyticsName,
@@ -48,7 +34,7 @@ export default function PickerFacadeProvider({
48
34
  mediaOptions,
49
35
  insertFile,
50
36
  options
51
- } = useSharedState(api);
37
+ } = useSharedPluginStateWithSelector(api, ['media'], selector);
52
38
  const handleMediaProvider = useCallback(async (_name, provider) => {
53
39
  const mediaProvider = await provider;
54
40
  if (!mediaProvider || !mediaProvider.uploadParams || !insertFile) {
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { BrowserWrapper } from './BrowserWrapper';
5
5
  import { ClipboardWrapper } from './ClipboardWrapper';
6
6
  import { DropzoneWrapper } from './DropzoneWrapper';
@@ -12,20 +12,6 @@ const selector = states => {
12
12
  mediaOptions: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.mediaOptions
13
13
  };
14
14
  };
15
- const useMediaPickerState = sharedPluginStateHookMigratorFactory(api => {
16
- return useSharedPluginStateWithSelector(api, ['focus', 'connectivity', 'media'], selector);
17
- }, api => {
18
- const {
19
- focusState,
20
- connectivityState,
21
- mediaState
22
- } = useSharedPluginState(api, ['focus', 'connectivity', 'media']);
23
- return {
24
- hasFocus: focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus,
25
- connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode,
26
- mediaOptions: mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaOptions
27
- };
28
- });
29
15
  const MediaPicker = ({
30
16
  api,
31
17
  isPopupOpened,
@@ -38,7 +24,7 @@ const MediaPicker = ({
38
24
  hasFocus,
39
25
  connectivityMode,
40
26
  mediaOptions
41
- } = useMediaPickerState(api);
27
+ } = useSharedPluginStateWithSelector(api, ['focus', 'connectivity', 'media'], selector);
42
28
  const featureFlags = mediaOptions && mediaOptions.featureFlags;
43
29
 
44
30
  // Ignored via go/ees005
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { injectIntl } from 'react-intl-next';
3
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
+ import { useSharedPluginStateWithSelector } 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
6
  import AttachmentIcon from '@atlaskit/icon/core/migration/attachment--editor-attachment';
@@ -15,17 +15,6 @@ const selector = states => {
15
15
  showMediaPicker: (_states$mediaState2 = states.mediaState) === null || _states$mediaState2 === void 0 ? void 0 : _states$mediaState2.showMediaPicker
16
16
  };
17
17
  };
18
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
19
- return useSharedPluginStateWithSelector(api, ['media'], selector);
20
- }, api => {
21
- const {
22
- mediaState
23
- } = useSharedPluginState(api, ['media']);
24
- return {
25
- allowsUploads: mediaState === null || mediaState === void 0 ? void 0 : mediaState.allowsUploads,
26
- showMediaPicker: mediaState === null || mediaState === void 0 ? void 0 : mediaState.showMediaPicker
27
- };
28
- });
29
18
  const ToolbarMedia = ({
30
19
  isDisabled,
31
20
  isReducedSpacing,
@@ -35,7 +24,7 @@ const ToolbarMedia = ({
35
24
  const {
36
25
  allowsUploads,
37
26
  showMediaPicker
38
- } = useSharedState(api);
27
+ } = useSharedPluginStateWithSelector(api, ['media'], selector);
39
28
  if (!allowsUploads || !showMediaPicker) {
40
29
  return null;
41
30
  }
@@ -1,25 +1,15 @@
1
1
  import { useMemo } from 'react';
2
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
2
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  const selector = states => {
4
4
  var _states$mediaState;
5
5
  return {
6
6
  mediaProvider: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.mediaProvider
7
7
  };
8
8
  };
9
- const useSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
10
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['media'], selector);
11
- }, pluginInjectionApi => {
12
- const {
13
- mediaState
14
- } = useSharedPluginState(pluginInjectionApi, ['media']);
15
- return {
16
- mediaProvider: mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider
17
- };
18
- });
19
9
  export const useMediaProvider = pluginInjectionApi => {
20
10
  const {
21
11
  mediaProvider
22
- } = useSharedState(pluginInjectionApi);
12
+ } = useSharedPluginStateWithSelector(pluginInjectionApi, ['media'], selector);
23
13
  const provider = useMemo(() => {
24
14
  return mediaProvider;
25
15
  }, [mediaProvider]);
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
5
  import { IconImages } from '@atlaskit/editor-common/quick-insert';
6
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
@@ -39,23 +39,13 @@ var selector = function selector(states) {
39
39
  setBrowseFn: (_states$mediaState2 = states.mediaState) === null || _states$mediaState2 === void 0 ? void 0 : _states$mediaState2.setBrowseFn
40
40
  };
41
41
  };
42
- var useMediaPickerSharedState = sharedPluginStateHookMigratorFactory(function (api) {
43
- return useSharedPluginStateWithSelector(api, ['media'], selector);
44
- }, function (api) {
45
- var _useSharedPluginState = useSharedPluginState(api, ['media']),
46
- mediaState = _useSharedPluginState.mediaState;
47
- return {
48
- onPopupToggle: mediaState === null || mediaState === void 0 ? void 0 : mediaState.onPopupToggle,
49
- setBrowseFn: mediaState === null || mediaState === void 0 ? void 0 : mediaState.setBrowseFn
50
- };
51
- });
52
42
  var MediaPickerFunctionalComponent = function MediaPickerFunctionalComponent(_ref) {
53
43
  var api = _ref.api,
54
44
  editorDomElement = _ref.editorDomElement,
55
45
  appearance = _ref.appearance;
56
- var _useMediaPickerShared = useMediaPickerSharedState(api),
57
- onPopupToggle = _useMediaPickerShared.onPopupToggle,
58
- setBrowseFn = _useMediaPickerShared.setBrowseFn;
46
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['media'], selector),
47
+ onPopupToggle = _useSharedPluginState.onPopupToggle,
48
+ setBrowseFn = _useSharedPluginState.setBrowseFn;
59
49
  if (!onPopupToggle || !setBrowseFn) {
60
50
  return null;
61
51
  }
@@ -75,26 +65,15 @@ var mediaViewerStateSelector = function mediaViewerStateSelector(states) {
75
65
  mediaClientConfig: (_states$mediaState5 = states.mediaState) === null || _states$mediaState5 === void 0 ? void 0 : _states$mediaState5.mediaClientConfig
76
66
  };
77
67
  };
78
- var useMediaViewerSharedState = sharedPluginStateHookMigratorFactory(function (api) {
79
- return useSharedPluginStateWithSelector(api, ['media'], mediaViewerStateSelector);
80
- }, function (api) {
81
- var _useSharedPluginState2 = useSharedPluginState(api, ['media']),
82
- mediaState = _useSharedPluginState2.mediaState;
83
- return {
84
- isMediaViewerVisible: mediaState === null || mediaState === void 0 ? void 0 : mediaState.isMediaViewerVisible,
85
- mediaViewerSelectedMedia: mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaViewerSelectedMedia,
86
- mediaClientConfig: mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaClientConfig
87
- };
88
- });
89
68
  var MediaViewerFunctionalComponent = function MediaViewerFunctionalComponent(_ref2) {
90
69
  var api = _ref2.api,
91
70
  editorView = _ref2.editorView;
92
71
  // Only traverse document once when media viewer is visible, media viewer items will not update
93
72
  // when document changes are made while media viewer is open
94
- var _useMediaViewerShared = useMediaViewerSharedState(api),
95
- isMediaViewerVisible = _useMediaViewerShared.isMediaViewerVisible,
96
- mediaViewerSelectedMedia = _useMediaViewerShared.mediaViewerSelectedMedia,
97
- mediaClientConfig = _useMediaViewerShared.mediaClientConfig;
73
+ var _useSharedPluginState2 = useSharedPluginStateWithSelector(api, ['media'], mediaViewerStateSelector),
74
+ isMediaViewerVisible = _useSharedPluginState2.isMediaViewerVisible,
75
+ mediaViewerSelectedMedia = _useSharedPluginState2.mediaViewerSelectedMedia,
76
+ mediaClientConfig = _useSharedPluginState2.mediaClientConfig;
98
77
  var mediaItems = useMemo(function () {
99
78
  if (isMediaViewerVisible) {
100
79
  var mediaNodes = extractMediaNodes(editorView.state.doc);
@@ -6,7 +6,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
6
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
7
7
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
8
8
  import React from 'react';
9
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
9
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
10
10
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
11
11
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
12
12
  import { useMediaProvider } from '../ui/hooks/useMediaProvider';
@@ -18,23 +18,12 @@ var selector = function selector(states) {
18
18
  editorViewMode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
19
19
  };
20
20
  };
21
- var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
22
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['editorDisabled', 'editorViewMode'], selector);
23
- }, function (pluginInjectionApi) {
24
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['editorDisabled', 'editorViewMode']),
25
- editorDisabledPlugin = _useSharedPluginState.editorDisabledState,
26
- editorViewModePlugin = _useSharedPluginState.editorViewModeState;
27
- return {
28
- editorDisabled: editorDisabledPlugin === null || editorDisabledPlugin === void 0 ? void 0 : editorDisabledPlugin.editorDisabled,
29
- editorViewMode: editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode
30
- };
31
- });
32
21
  function MediaGroupNodeViewInternal(_ref) {
33
22
  var renderFn = _ref.renderFn,
34
23
  pluginInjectionApi = _ref.pluginInjectionApi;
35
- var _useSharedState = useSharedState(pluginInjectionApi),
36
- editorDisabled = _useSharedState.editorDisabled,
37
- editorViewMode = _useSharedState.editorViewMode;
24
+ var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['editorDisabled', 'editorViewMode'], selector),
25
+ editorDisabled = _useSharedPluginState.editorDisabled,
26
+ editorViewMode = _useSharedPluginState.editorViewMode;
38
27
  var mediaProvider = useMediaProvider(pluginInjectionApi);
39
28
  return renderFn({
40
29
  editorDisabled: editorDisabled,
@@ -21,7 +21,7 @@ import { useEffect, useMemo, useState } from 'react';
21
21
 
22
22
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
23
23
  import { jsx } from '@emotion/react';
24
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
24
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
25
25
  import { MediaInlineImageCard } from '@atlaskit/editor-common/media-inline';
26
26
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
27
27
  import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
@@ -230,23 +230,6 @@ var selector = function selector(states) {
230
230
  mediaClientConfig: (_states$mediaState7 = states.mediaState) === null || _states$mediaState7 === void 0 ? void 0 : _states$mediaState7.mediaClientConfig
231
231
  };
232
232
  };
233
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
234
- return useSharedPluginStateWithSelector(api, ['editorViewMode', 'media'], selector);
235
- }, function (api) {
236
- var _useSharedPluginState = useSharedPluginState(api, ['editorViewMode', 'media']),
237
- editorViewModeState = _useSharedPluginState.editorViewModeState,
238
- mediaState = _useSharedPluginState.mediaState;
239
- return {
240
- viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
241
- mediaProvider: mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider,
242
- handleMediaNodeMount: mediaState === null || mediaState === void 0 ? void 0 : mediaState.handleMediaNodeMount,
243
- handleMediaNodeUnmount: mediaState === null || mediaState === void 0 ? void 0 : mediaState.handleMediaNodeUnmount,
244
- allowInlineImages: mediaState === null || mediaState === void 0 ? void 0 : mediaState.allowInlineImages,
245
- addPendingTask: mediaState === null || mediaState === void 0 ? void 0 : mediaState.addPendingTask,
246
- selectedMediaContainerNode: mediaState === null || mediaState === void 0 ? void 0 : mediaState.selectedMediaContainerNode,
247
- mediaClientConfig: mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaClientConfig
248
- };
249
- });
250
233
  var MediaInlineSharedState = function MediaInlineSharedState(_ref3) {
251
234
  var identifier = _ref3.identifier,
252
235
  node = _ref3.node,
@@ -255,15 +238,15 @@ var MediaInlineSharedState = function MediaInlineSharedState(_ref3) {
255
238
  contextIdentifierProvider = _ref3.contextIdentifierProvider,
256
239
  api = _ref3.api,
257
240
  view = _ref3.view;
258
- var _useSharedState = useSharedState(api),
259
- mediaProvider = _useSharedState.mediaProvider,
260
- allowInlineImages = _useSharedState.allowInlineImages,
261
- handleMediaNodeMount = _useSharedState.handleMediaNodeMount,
262
- handleMediaNodeUnmount = _useSharedState.handleMediaNodeUnmount,
263
- addPendingTask = _useSharedState.addPendingTask,
264
- selectedMediaContainerNode = _useSharedState.selectedMediaContainerNode,
265
- mediaClientConfig = _useSharedState.mediaClientConfig,
266
- viewMode = _useSharedState.viewMode;
241
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['editorViewMode', 'media'], selector),
242
+ mediaProvider = _useSharedPluginState.mediaProvider,
243
+ allowInlineImages = _useSharedPluginState.allowInlineImages,
244
+ handleMediaNodeMount = _useSharedPluginState.handleMediaNodeMount,
245
+ handleMediaNodeUnmount = _useSharedPluginState.handleMediaNodeUnmount,
246
+ addPendingTask = _useSharedPluginState.addPendingTask,
247
+ selectedMediaContainerNode = _useSharedPluginState.selectedMediaContainerNode,
248
+ mediaClientConfig = _useSharedPluginState.mediaClientConfig,
249
+ viewMode = _useSharedPluginState.viewMode;
267
250
  var newMediaProvider = useMemo(function () {
268
251
  return mediaProvider ? Promise.resolve(mediaProvider) : undefined;
269
252
  }, [mediaProvider]);
@@ -13,7 +13,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
13
13
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
14
14
  function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
15
15
  import React from 'react';
16
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
16
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
17
17
  import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
18
18
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
19
19
  import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
@@ -27,31 +27,16 @@ import MediaNode from './media';
27
27
  var selector = function selector(states) {
28
28
  var _states$mediaState;
29
29
  return {
30
- mediaProvider: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.mediaProvider,
31
- widthState: undefined
30
+ mediaProvider: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.mediaProvider
32
31
  };
33
32
  };
34
- var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
35
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['media'], selector);
36
- }, function (pluginInjectionApi) {
37
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width', 'media']),
38
- widthState = _useSharedPluginState.widthState,
39
- mediaState = _useSharedPluginState.mediaState;
40
- return {
41
- mediaProvider: mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider,
42
- widthState: widthState
43
- };
44
- });
45
33
  var MediaNodeWithProviders = function MediaNodeWithProviders(_ref) {
46
34
  var pluginInjectionApi = _ref.pluginInjectionApi,
47
35
  innerComponent = _ref.innerComponent;
48
- var _useSharedState = useSharedState(pluginInjectionApi),
49
- mediaProvider = _useSharedState.mediaProvider,
50
- widthState = _useSharedState.widthState;
36
+ var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['media'], selector),
37
+ mediaProvider = _useSharedPluginState.mediaProvider;
51
38
  var interactionState = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.interactionState');
52
39
  return innerComponent({
53
- width: widthState,
54
- // Remove when platform_editor_usesharedpluginstatewithselector is cleaned up
55
40
  mediaProvider: mediaProvider ? Promise.resolve(mediaProvider) : undefined,
56
41
  interactionState: interactionState
57
42
  });
@@ -17,7 +17,7 @@ import { useCallback, useMemo } from 'react';
17
17
 
18
18
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
19
19
  import { jsx } from '@emotion/react';
20
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
20
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
21
21
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
22
22
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
23
23
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
@@ -38,26 +38,6 @@ var selector = function selector(states) {
38
38
  viewMode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
39
39
  };
40
40
  };
41
- var useSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
42
- return useSharedPluginStateWithSelector(pluginInjectionApi, ['width', 'media', 'annotation', 'editorDisabled', 'editorViewMode'], selector);
43
- }, function (pluginInjectionApi) {
44
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width', 'media', 'annotation', 'editorDisabled', 'editorViewMode']),
45
- widthState = _useSharedPluginState.widthState,
46
- mediaState = _useSharedPluginState.mediaState,
47
- annotationState = _useSharedPluginState.annotationState,
48
- editorDisabledState = _useSharedPluginState.editorDisabledState,
49
- editorViewModeState = _useSharedPluginState.editorViewModeState;
50
- return {
51
- mediaProviderPromise: mediaState === null || mediaState === void 0 ? void 0 : mediaState.mediaProvider,
52
- addPendingTask: mediaState === null || mediaState === void 0 ? void 0 : mediaState.addPendingTask,
53
- isDrafting: annotationState === null || annotationState === void 0 ? void 0 : annotationState.isDrafting,
54
- targetNodeId: annotationState === null || annotationState === void 0 ? void 0 : annotationState.targetNodeId,
55
- width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
56
- lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength,
57
- editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled,
58
- viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
59
- };
60
- });
61
41
  var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref) {
62
42
  var pluginInjectionApi = _ref.pluginInjectionApi,
63
43
  contextIdentifierProvider = _ref.contextIdentifierProvider,
@@ -71,15 +51,15 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref) {
71
51
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
72
52
  forwardRef = _ref.forwardRef,
73
53
  editorAppearance = _ref.editorAppearance;
74
- var _useSharedState = useSharedState(pluginInjectionApi),
75
- mediaProviderPromise = _useSharedState.mediaProviderPromise,
76
- addPendingTask = _useSharedState.addPendingTask,
77
- isDrafting = _useSharedState.isDrafting,
78
- targetNodeId = _useSharedState.targetNodeId,
79
- width = _useSharedState.width,
80
- lineLength = _useSharedState.lineLength,
81
- editorDisabled = _useSharedState.editorDisabled,
82
- viewMode = _useSharedState.viewMode;
54
+ var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['width', 'media', 'annotation', 'editorDisabled', 'editorViewMode'], selector),
55
+ mediaProviderPromise = _useSharedPluginState.mediaProviderPromise,
56
+ addPendingTask = _useSharedPluginState.addPendingTask,
57
+ isDrafting = _useSharedPluginState.isDrafting,
58
+ targetNodeId = _useSharedPluginState.targetNodeId,
59
+ width = _useSharedPluginState.width,
60
+ lineLength = _useSharedPluginState.lineLength,
61
+ editorDisabled = _useSharedPluginState.editorDisabled,
62
+ viewMode = _useSharedPluginState.viewMode;
83
63
  var interactionState = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.interactionState');
84
64
  var mediaProvider = useMemo(function () {
85
65
  return mediaProviderPromise ? Promise.resolve(mediaProviderPromise) : undefined;
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { useCallback, useMemo, useState } from 'react';
3
3
  import { injectIntl } from 'react-intl-next';
4
4
  import { VIEW_METHOD } from '@atlaskit/editor-common/analytics';
5
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
6
6
  import { CommentBadge as CommentBadgeComponent, CommentBadgeNext } from '@atlaskit/editor-common/media-single';
7
7
  var selector = function selector(states) {
8
8
  var _states$annotationSta, _states$annotationSta2, _states$annotationSta3;
@@ -12,17 +12,6 @@ var selector = function selector(states) {
12
12
  annotations: (_states$annotationSta3 = states.annotationState) === null || _states$annotationSta3 === void 0 ? void 0 : _states$annotationSta3.annotations
13
13
  };
14
14
  };
15
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
16
- return useSharedPluginStateWithSelector(api, ['annotation'], selector);
17
- }, function (api) {
18
- var _useSharedPluginState = useSharedPluginState(api, ['annotation']),
19
- annotationState = _useSharedPluginState.annotationState;
20
- return {
21
- selectedAnnotations: annotationState === null || annotationState === void 0 ? void 0 : annotationState.selectedAnnotations,
22
- isInlineCommentViewClosed: annotationState === null || annotationState === void 0 ? void 0 : annotationState.isInlineCommentViewClosed,
23
- annotations: annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations
24
- };
25
- });
26
15
  var CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
27
16
  var api = _ref.api,
28
17
  mediaNode = _ref.mediaNode,
@@ -31,10 +20,10 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
31
20
  intl = _ref.intl,
32
21
  isDrafting = _ref.isDrafting,
33
22
  badgeOffsetRight = _ref.badgeOffsetRight;
34
- var _useSharedState = useSharedState(api),
35
- selectedAnnotations = _useSharedState.selectedAnnotations,
36
- isInlineCommentViewClosed = _useSharedState.isInlineCommentViewClosed,
37
- annotations = _useSharedState.annotations;
23
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['annotation'], selector),
24
+ selectedAnnotations = _useSharedPluginState.selectedAnnotations,
25
+ isInlineCommentViewClosed = _useSharedPluginState.isInlineCommentViewClosed,
26
+ annotations = _useSharedPluginState.annotations;
38
27
  var _useState = useState(false),
39
28
  _useState2 = _slicedToArray(_useState, 2),
40
29
  entered = _useState2[0],
@@ -109,10 +98,10 @@ export var CommentBadgeNextWrapper = function CommentBadgeNextWrapper(_ref2) {
109
98
  _useState4 = _slicedToArray(_useState3, 2),
110
99
  entered = _useState4[0],
111
100
  setEntered = _useState4[1];
112
- var _useSharedState2 = useSharedState(api),
113
- selectedAnnotations = _useSharedState2.selectedAnnotations,
114
- isInlineCommentViewClosed = _useSharedState2.isInlineCommentViewClosed,
115
- annotations = _useSharedState2.annotations;
101
+ var _useSharedPluginState2 = useSharedPluginStateWithSelector(api, ['annotation'], selector),
102
+ selectedAnnotations = _useSharedPluginState2.selectedAnnotations,
103
+ isInlineCommentViewClosed = _useSharedPluginState2.isInlineCommentViewClosed,
104
+ annotations = _useSharedPluginState2.annotations;
116
105
  var _view$state$schema2 = view.state.schema,
117
106
  media = _view$state$schema2.nodes.media,
118
107
  annotation = _view$state$schema2.marks.annotation,
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import React from 'react';
5
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
6
6
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
7
7
  import { Dropzone } from '@atlaskit/media-picker';
8
8
  import PickerFacadeProvider from './PickerFacadeProvider';
@@ -13,16 +13,6 @@ var selector = function selector(states) {
13
13
  handleDrag: (_states$mediaState2 = states.mediaState) === null || _states$mediaState2 === void 0 ? void 0 : _states$mediaState2.handleDrag
14
14
  };
15
15
  };
16
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
17
- return useSharedPluginStateWithSelector(api, ['media'], selector);
18
- }, function (api) {
19
- var _useSharedPluginState = useSharedPluginState(api, ['media']),
20
- mediaState = _useSharedPluginState.mediaState;
21
- return {
22
- options: mediaState === null || mediaState === void 0 ? void 0 : mediaState.options,
23
- handleDrag: mediaState === null || mediaState === void 0 ? void 0 : mediaState.handleDrag
24
- };
25
- });
26
16
  var DropzoneWrapperInternal = function DropzoneWrapperInternal(_ref) {
27
17
  var api = _ref.api,
28
18
  isActive = _ref.isActive,
@@ -32,9 +22,9 @@ var DropzoneWrapperInternal = function DropzoneWrapperInternal(_ref) {
32
22
  mediaClientConfig = _ref.mediaClientConfig,
33
23
  config = _ref.config,
34
24
  pickerFacadeInstance = _ref.pickerFacadeInstance;
35
- var _useSharedState = useSharedState(api),
36
- options = _useSharedState.options,
37
- handleDrag = _useSharedState.handleDrag;
25
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['media'], selector),
26
+ options = _useSharedPluginState.options,
27
+ handleDrag = _useSharedPluginState.handleDrag;
38
28
  var _ref2 = options || {},
39
29
  customDropzoneContainer = _ref2.customDropzoneContainer;
40
30