@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.
- package/CHANGELOG.md +6 -0
- 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/version-wrapper.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/version-wrapper.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/version-wrapper.js +1 -1
- 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-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/package.json +1 -1
- package/report.api.md +7 -1
- package/tmp/api-report-tmp.d.ts +7 -1
|
@@ -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);
|
|
@@ -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: {
|
|
@@ -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
|
|
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(
|
|
223
|
-
var mediaProvider =
|
|
224
|
-
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(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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,
|
|
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,
|
|
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
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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,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 '
|
|
5
|
-
import type { getPosHandler
|
|
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
|
|
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,
|
|
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
|
-
|
|
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 {
|
|
3
|
-
import type {
|
|
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
|
|
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
|
|
15
|
-
WrappedComponent: React.ComponentType<Props
|
|
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 '
|
|
5
|
-
import type { getPosHandler
|
|
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
|
|
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,
|
|
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
|
-
|
|
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 {
|
|
3
|
-
import type {
|
|
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
|
|
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
|
|
15
|
-
WrappedComponent: React.ComponentType<Props
|
|
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;
|