@atlaskit/editor-core 187.41.0 → 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.
@@ -1,45 +1,37 @@
1
1
  import React from 'react';
2
2
  import AttachmentIcon from '@atlaskit/icon/glyph/editor/attachment';
3
- import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/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
- }) => /*#__PURE__*/React.createElement(WithPluginState, {
19
- editorView: editorView,
20
- eventDispatcher: eventDispatcher,
21
- plugins: {
22
- mediaPlugin: pluginKey
23
- },
24
- render: ({
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);
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.41.0";
2
+ export const version = "187.41.1";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -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 '../insert-block/ui/ToolbarInsertBlock/messages';
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 mediaPlugin = function mediaPlugin(_ref) {
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 _ref$config = _ref.config,
30
- options = _ref$config === void 0 ? {} : _ref$config,
31
- api = _ref.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 _ref2 = options || {},
43
- _ref2$allowMediaGroup = _ref2.allowMediaGroup,
44
- allowMediaGroup = _ref2$allowMediaGroup === void 0 ? true : _ref2$allowMediaGroup,
45
- _ref2$allowMediaSingl = _ref2.allowMediaSingle,
46
- allowMediaSingle = _ref2$allowMediaSingl === void 0 ? false : _ref2$allowMediaSingl,
47
- mediaFeatureFlags = _ref2.featureFlags;
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(_ref3) {
87
- var schema = _ref3.schema,
88
- dispatch = _ref3.dispatch,
89
- getIntl = _ref3.getIntl,
90
- eventDispatcher = _ref3.eventDispatcher,
91
- providerFactory = _ref3.providerFactory,
92
- errorReporter = _ref3.errorReporter,
93
- portalProviderAPI = _ref3.portalProviderAPI,
94
- reactContext = _ref3.reactContext,
95
- dispatchAnalyticsEvent = _ref3.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(_ref4) {
123
- var schema = _ref4.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(_ref5) {
152
+ plugin: function plugin(_ref6) {
136
153
  var _api$analytics2;
137
- var schema = _ref5.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(_ref6) {
146
- var dispatch = _ref6.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(_ref7) {
153
- var schema = _ref7.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(_ref8) {
190
- var editorView = _ref8.editorView,
191
- appearance = _ref8.appearance;
192
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(WithPluginState, {
193
- editorView: editorView,
194
- plugins: {
195
- mediaState: pluginKey
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: {
@@ -14,11 +14,10 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
14
14
  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; }
15
15
  import React, { useEffect, useState } from 'react';
16
16
  import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
17
- import WithPluginState from '../../../ui/WithPluginState';
17
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
18
18
  import { MediaInlineCard } from '@atlaskit/media-card';
19
19
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
20
20
  import { MediaInlineNodeSelector } from './styles';
21
- import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
22
21
  import { MediaNodeUpdater } from './mediaNodeUpdater';
23
22
  import { MediaInlineCardLoadingView } from '@atlaskit/media-ui';
24
23
  export var createMediaNodeUpdater = function createMediaNodeUpdater(props) {
@@ -174,6 +173,31 @@ export var MediaInline = function MediaInline(props) {
174
173
  mediaClientConfig: viewMediaClientConfig
175
174
  });
176
175
  };
176
+ var MediaInlineSharedState = function MediaInlineSharedState(_ref3) {
177
+ var identifier = _ref3.identifier,
178
+ mediaProvider = _ref3.mediaProvider,
179
+ node = _ref3.node,
180
+ isSelected = _ref3.isSelected,
181
+ getPos = _ref3.getPos,
182
+ contextIdentifierProvider = _ref3.contextIdentifierProvider,
183
+ api = _ref3.api,
184
+ view = _ref3.view;
185
+ var _useSharedPluginState = useSharedPluginState(api, ['media']),
186
+ mediaState = _useSharedPluginState.mediaState;
187
+ if (!mediaState) {
188
+ return null;
189
+ }
190
+ return /*#__PURE__*/React.createElement(MediaInline, {
191
+ identifier: identifier,
192
+ mediaProvider: mediaProvider,
193
+ mediaPluginState: mediaState,
194
+ node: node,
195
+ isSelected: isSelected,
196
+ view: view,
197
+ getPos: getPos,
198
+ contextIdentifierProvider: contextIdentifierProvider
199
+ });
200
+ };
177
201
  export var MediaInlineNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
178
202
  _inherits(MediaInlineNodeView, _SelectionBasedNodeVi);
179
203
  var _super = _createSuper(MediaInlineNodeView);
@@ -214,38 +238,28 @@ export var MediaInlineNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
214
238
  key: "render",
215
239
  value: function render(props) {
216
240
  var _this = this;
217
- var providerFactory = props.providerFactory;
241
+ var providerFactory = props.providerFactory,
242
+ api = props.api;
243
+ var view = this.view;
218
244
  var getPos = this.getPos;
219
245
  return /*#__PURE__*/React.createElement(WithProviders, {
220
246
  providers: ['mediaProvider', 'contextIdentifierProvider'],
221
247
  providerFactory: providerFactory,
222
- renderNode: function renderNode(_ref3) {
223
- var mediaProvider = _ref3.mediaProvider,
224
- contextIdentifierProvider = _ref3.contextIdentifierProvider;
248
+ renderNode: function renderNode(_ref4) {
249
+ var mediaProvider = _ref4.mediaProvider,
250
+ contextIdentifierProvider = _ref4.contextIdentifierProvider;
225
251
  if (!mediaProvider) {
226
252
  return null;
227
253
  }
228
- return /*#__PURE__*/React.createElement(WithPluginState, {
229
- editorView: _this.view,
230
- plugins: {
231
- mediaPluginState: mediaStateKey
232
- },
233
- render: function render(_ref4) {
234
- var mediaPluginState = _ref4.mediaPluginState;
235
- if (!mediaPluginState) {
236
- return null;
237
- }
238
- return /*#__PURE__*/React.createElement(MediaInline, {
239
- identifier: _this.node.attrs.id,
240
- mediaProvider: mediaProvider,
241
- mediaPluginState: mediaPluginState,
242
- node: _this.node,
243
- isSelected: _this.nodeInsideSelection(),
244
- view: _this.view,
245
- getPos: getPos,
246
- contextIdentifierProvider: contextIdentifierProvider
247
- });
248
- }
254
+ return /*#__PURE__*/React.createElement(MediaInlineSharedState, {
255
+ identifier: _this.node.attrs.id,
256
+ mediaProvider: mediaProvider,
257
+ node: _this.node,
258
+ isSelected: _this.nodeInsideSelection(),
259
+ view: view,
260
+ getPos: getPos,
261
+ contextIdentifierProvider: contextIdentifierProvider,
262
+ api: api
249
263
  });
250
264
  }
251
265
  });
@@ -253,11 +267,12 @@ export var MediaInlineNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
253
267
  }]);
254
268
  return MediaInlineNodeView;
255
269
  }(SelectionBasedNodeView);
256
- export var ReactMediaInlineNode = function ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory, pluginInjectionApi, dispatchAnalyticsEvent) {
270
+ export var ReactMediaInlineNode = function ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory, api, dispatchAnalyticsEvent) {
257
271
  return function (node, view, getPos) {
258
272
  return new MediaInlineNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
259
273
  providerFactory: providerFactory,
260
- dispatchAnalyticsEvent: dispatchAnalyticsEvent
274
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
275
+ api: api
261
276
  }).init();
262
277
  };
263
278
  };
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import AttachmentIcon from '@atlaskit/icon/glyph/editor/attachment';
3
- import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/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
  var onClickMediaButton = function onClickMediaButton(pluginState) {
8
8
  return function () {
@@ -11,35 +11,25 @@ var onClickMediaButton = function onClickMediaButton(pluginState) {
11
11
  };
12
12
  };
13
13
  var ToolbarMedia = function ToolbarMedia(_ref) {
14
- var editorView = _ref.editorView,
15
- eventDispatcher = _ref.eventDispatcher,
16
- pluginKey = _ref.pluginKey,
17
- isDisabled = _ref.isDisabled,
14
+ var isDisabled = _ref.isDisabled,
18
15
  isReducedSpacing = _ref.isReducedSpacing,
19
- intl = _ref.intl;
20
- return /*#__PURE__*/React.createElement(WithPluginState, {
21
- editorView: editorView,
22
- eventDispatcher: eventDispatcher,
23
- plugins: {
24
- mediaPlugin: pluginKey
25
- },
26
- render: function render(_ref2) {
27
- var mediaPlugin = _ref2.mediaPlugin;
28
- if (!(mediaPlugin !== null && mediaPlugin !== void 0 && mediaPlugin.allowsUploads)) {
29
- return null;
30
- }
31
- var toolbarMediaTitle = toolbarMediaMessages.toolbarMediaTitle;
32
- return /*#__PURE__*/React.createElement(ToolbarButton, {
33
- buttonId: TOOLBAR_BUTTON.MEDIA,
34
- onClick: onClickMediaButton(mediaPlugin),
35
- disabled: isDisabled,
36
- title: intl.formatMessage(toolbarMediaTitle),
37
- spacing: isReducedSpacing ? 'none' : 'default',
38
- iconBefore: /*#__PURE__*/React.createElement(AttachmentIcon, {
39
- label: intl.formatMessage(toolbarMediaTitle)
40
- })
41
- });
42
- }
16
+ intl = _ref.intl,
17
+ api = _ref.api;
18
+ var _useSharedPluginState = useSharedPluginState(api, ['media']),
19
+ mediaState = _useSharedPluginState.mediaState;
20
+ if (!(mediaState !== null && mediaState !== void 0 && mediaState.allowsUploads)) {
21
+ return null;
22
+ }
23
+ var toolbarMediaTitle = toolbarMediaMessages.toolbarMediaTitle;
24
+ return /*#__PURE__*/React.createElement(ToolbarButton, {
25
+ buttonId: TOOLBAR_BUTTON.MEDIA,
26
+ onClick: onClickMediaButton(mediaState),
27
+ disabled: isDisabled,
28
+ title: intl.formatMessage(toolbarMediaTitle),
29
+ spacing: isReducedSpacing ? 'none' : 'default',
30
+ iconBefore: /*#__PURE__*/React.createElement(AttachmentIcon, {
31
+ label: intl.formatMessage(toolbarMediaTitle)
32
+ })
43
33
  });
44
34
  };
45
35
  export default injectIntl(ToolbarMedia);
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.41.0";
2
+ export var version = "187.41.1";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,8 +1,8 @@
1
1
  import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
2
2
  import type { MediaState } from './pm-plugins/main';
3
3
  import type { CustomMediaPicker } from './types';
4
- import type { MediaNextEditorPluginType } from './next-plugin-type';
5
4
  export type { MediaState, MediaProvider, CustomMediaPicker };
6
5
  export { insertMediaSingleNode } from './utils/media-single';
6
+ import type { MediaNextEditorPluginType } from './next-plugin-type';
7
7
  declare const mediaPlugin: MediaNextEditorPluginType;
8
8
  export default mediaPlugin;
@@ -1,8 +1,8 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
3
3
  import React from 'react';
4
- import type { EventDispatcher } from '../../../event-dispatcher';
5
- import type { getPosHandler, ProsemirrorGetPosHandler } from '../../../nodeviews/';
4
+ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
5
+ import type { getPosHandler as ProsemirrorGetPosHandler, getPosHandler } from '../types';
6
6
  import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
7
7
  import type { FileIdentifier } from '@atlaskit/media-client';
8
8
  import type { MediaProvider, ProviderFactory, ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
@@ -11,7 +11,7 @@ import type { MediaPluginState } from '../pm-plugins/types';
11
11
  import { MediaNodeUpdater } from './mediaNodeUpdater';
12
12
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
13
13
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
14
- import type mediaPlugin from '../index';
14
+ import type { MediaNextEditorPluginType } from '../next-plugin-type';
15
15
  export interface MediaInlineProps {
16
16
  mediaProvider: Promise<MediaProvider>;
17
17
  identifier: FileIdentifier;
@@ -35,6 +35,7 @@ export declare const handleNewNode: (props: MediaInlineProps) => void;
35
35
  export declare const MediaInline: React.FC<MediaInlineProps>;
36
36
  export interface MediaInlineNodeViewProps {
37
37
  providerFactory: ProviderFactory;
38
+ api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
38
39
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
39
40
  }
40
41
  export declare class MediaInlineNodeView extends SelectionBasedNodeView<MediaInlineNodeViewProps> {
@@ -46,4 +47,4 @@ export declare class MediaInlineNodeView extends SelectionBasedNodeView<MediaInl
46
47
  viewShouldUpdate(nextNode: PMNode): boolean;
47
48
  render(props: MediaInlineNodeViewProps): JSX.Element;
48
49
  }
49
- export declare const ReactMediaInlineNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, pluginInjectionApi: ExtractInjectionAPI<typeof mediaPlugin> | undefined, dispatchAnalyticsEvent?: DispatchAnalyticsEvent) => (node: PMNode, view: EditorView, getPos: getPosHandler) => NodeView;
50
+ export declare const ReactMediaInlineNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, dispatchAnalyticsEvent?: DispatchAnalyticsEvent) => (node: PMNode, view: EditorView, getPos: getPosHandler) => NodeView;
@@ -8,7 +8,9 @@ import type { MediaFeatureFlags } from '@atlaskit/media-common';
8
8
  import type { UploadParams, MediaFile } from '@atlaskit/media-picker/types';
9
9
  import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
10
10
  import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
11
- import type { PlaceholderTextOptions } from '../../plugins/placeholder-text/types';
11
+ interface PlaceholderTextOptions {
12
+ allowInserting?: boolean;
13
+ }
12
14
  export type MediaStateStatus = 'unknown' | 'ready' | 'cancelled' | 'preview' | 'error' | 'mobile-upload-end';
13
15
  export type MediaSingleWithType = 'pixel' | 'percentage';
14
16
  export interface MediaOptions {
@@ -106,3 +108,10 @@ export type MediaDecorationSpec = {
106
108
  type: 'media';
107
109
  selected: boolean;
108
110
  };
111
+ export type getPosHandler = getPosHandlerNode;
112
+ export type getPosHandlerNode = () => number | undefined;
113
+ export interface ReactNodeProps {
114
+ selected: boolean;
115
+ }
116
+ export type ForwardRef = (node: HTMLElement | null) => void;
117
+ export {};
@@ -1,17 +1,13 @@
1
1
  import React from 'react';
2
- import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { EventDispatcher } from '../../../../event-dispatcher';
5
- import type { MediaPluginState } from '../../pm-plugins/types';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { MediaNextEditorPluginType } from '../../next-plugin-type';
6
4
  import type { WrappedComponentProps } from 'react-intl-next';
7
- export interface Props<T extends MediaPluginState> {
8
- editorView: EditorView;
9
- pluginKey: PluginKey<T>;
10
- eventDispatcher: EventDispatcher;
5
+ export interface Props {
11
6
  isDisabled?: boolean;
12
7
  isReducedSpacing?: boolean;
8
+ api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
13
9
  }
14
- declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props<MediaPluginState> & WrappedComponentProps<"intl">>> & {
15
- WrappedComponent: React.ComponentType<Props<MediaPluginState> & WrappedComponentProps<"intl">>;
10
+ declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
11
+ WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
16
12
  };
17
13
  export default _default;
@@ -1,8 +1,8 @@
1
1
  import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
2
2
  import type { MediaState } from './pm-plugins/main';
3
3
  import type { CustomMediaPicker } from './types';
4
- import type { MediaNextEditorPluginType } from './next-plugin-type';
5
4
  export type { MediaState, MediaProvider, CustomMediaPicker };
6
5
  export { insertMediaSingleNode } from './utils/media-single';
6
+ import type { MediaNextEditorPluginType } from './next-plugin-type';
7
7
  declare const mediaPlugin: MediaNextEditorPluginType;
8
8
  export default mediaPlugin;
@@ -1,8 +1,8 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
3
3
  import React from 'react';
4
- import type { EventDispatcher } from '../../../event-dispatcher';
5
- import type { getPosHandler, ProsemirrorGetPosHandler } from '../../../nodeviews/';
4
+ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
5
+ import type { getPosHandler as ProsemirrorGetPosHandler, getPosHandler } from '../types';
6
6
  import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
7
7
  import type { FileIdentifier } from '@atlaskit/media-client';
8
8
  import type { MediaProvider, ProviderFactory, ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
@@ -11,7 +11,7 @@ import type { MediaPluginState } from '../pm-plugins/types';
11
11
  import { MediaNodeUpdater } from './mediaNodeUpdater';
12
12
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
13
13
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
14
- import type mediaPlugin from '../index';
14
+ import type { MediaNextEditorPluginType } from '../next-plugin-type';
15
15
  export interface MediaInlineProps {
16
16
  mediaProvider: Promise<MediaProvider>;
17
17
  identifier: FileIdentifier;
@@ -35,6 +35,7 @@ export declare const handleNewNode: (props: MediaInlineProps) => void;
35
35
  export declare const MediaInline: React.FC<MediaInlineProps>;
36
36
  export interface MediaInlineNodeViewProps {
37
37
  providerFactory: ProviderFactory;
38
+ api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
38
39
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
39
40
  }
40
41
  export declare class MediaInlineNodeView extends SelectionBasedNodeView<MediaInlineNodeViewProps> {
@@ -46,4 +47,4 @@ export declare class MediaInlineNodeView extends SelectionBasedNodeView<MediaInl
46
47
  viewShouldUpdate(nextNode: PMNode): boolean;
47
48
  render(props: MediaInlineNodeViewProps): JSX.Element;
48
49
  }
49
- export declare const ReactMediaInlineNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, pluginInjectionApi: ExtractInjectionAPI<typeof mediaPlugin> | undefined, dispatchAnalyticsEvent?: DispatchAnalyticsEvent) => (node: PMNode, view: EditorView, getPos: getPosHandler) => NodeView;
50
+ export declare const ReactMediaInlineNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, dispatchAnalyticsEvent?: DispatchAnalyticsEvent) => (node: PMNode, view: EditorView, getPos: getPosHandler) => NodeView;
@@ -8,7 +8,9 @@ import type { MediaFeatureFlags } from '@atlaskit/media-common';
8
8
  import type { UploadParams, MediaFile } from '@atlaskit/media-picker/types';
9
9
  import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
10
10
  import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
11
- import type { PlaceholderTextOptions } from '../../plugins/placeholder-text/types';
11
+ interface PlaceholderTextOptions {
12
+ allowInserting?: boolean;
13
+ }
12
14
  export type MediaStateStatus = 'unknown' | 'ready' | 'cancelled' | 'preview' | 'error' | 'mobile-upload-end';
13
15
  export type MediaSingleWithType = 'pixel' | 'percentage';
14
16
  export interface MediaOptions {
@@ -106,3 +108,10 @@ export type MediaDecorationSpec = {
106
108
  type: 'media';
107
109
  selected: boolean;
108
110
  };
111
+ export type getPosHandler = getPosHandlerNode;
112
+ export type getPosHandlerNode = () => number | undefined;
113
+ export interface ReactNodeProps {
114
+ selected: boolean;
115
+ }
116
+ export type ForwardRef = (node: HTMLElement | null) => void;
117
+ export {};
@@ -1,17 +1,13 @@
1
1
  import React from 'react';
2
- import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { EventDispatcher } from '../../../../event-dispatcher';
5
- import type { MediaPluginState } from '../../pm-plugins/types';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { MediaNextEditorPluginType } from '../../next-plugin-type';
6
4
  import type { WrappedComponentProps } from 'react-intl-next';
7
- export interface Props<T extends MediaPluginState> {
8
- editorView: EditorView;
9
- pluginKey: PluginKey<T>;
10
- eventDispatcher: EventDispatcher;
5
+ export interface Props {
11
6
  isDisabled?: boolean;
12
7
  isReducedSpacing?: boolean;
8
+ api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
13
9
  }
14
- declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props<MediaPluginState> & WrappedComponentProps<"intl">>> & {
15
- WrappedComponent: React.ComponentType<Props<MediaPluginState> & WrappedComponentProps<"intl">>;
10
+ declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
11
+ WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
16
12
  };
17
13
  export default _default;