@atlaskit/editor-plugin-insert-block 3.2.6 → 3.2.8
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 +18 -0
- package/dist/cjs/insertBlockPlugin.js +96 -31
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +18 -5
- package/dist/cjs/ui/ElementRail/useInsertMenuRailItems.js +70 -18
- package/dist/cjs/ui/ToolbarInsertBlock/index.js +1 -1
- package/dist/es2019/insertBlockPlugin.js +98 -32
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +20 -6
- package/dist/es2019/ui/ElementRail/useInsertMenuRailItems.js +73 -20
- package/dist/es2019/ui/ToolbarInsertBlock/index.js +1 -1
- package/dist/esm/insertBlockPlugin.js +97 -32
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +19 -6
- package/dist/esm/ui/ElementRail/useInsertMenuRailItems.js +71 -19
- package/dist/esm/ui/ToolbarInsertBlock/index.js +1 -1
- package/package.json +10 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 3.2.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#154313](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154313)
|
|
8
|
+
[`36c5067417688`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/36c5067417688) -
|
|
9
|
+
Clean up platform_editor_insert_button_on_primary_toolbar feature gate
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 3.2.7
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#152768](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/152768)
|
|
17
|
+
[`2e80bc703b181`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2e80bc703b181) -
|
|
18
|
+
[ED-27555] Migrate to useSharedPluginStateSelector for insert-block, layout, loom plugins
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 3.2.6
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -12,6 +12,7 @@ var _elementBrowser = require("@atlaskit/editor-common/element-browser");
|
|
|
12
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
13
|
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
14
14
|
var _types = require("@atlaskit/editor-common/types");
|
|
15
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
15
16
|
var _consts = require("@atlaskit/editor-plugin-block-type/consts");
|
|
16
17
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
18
|
var _toggleInsertBlock = require("./pm-plugins/toggleInsertBlock");
|
|
@@ -196,8 +197,69 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
|
|
|
196
197
|
};
|
|
197
198
|
return plugin;
|
|
198
199
|
};
|
|
200
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
201
|
+
var emojiProviderSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'emoji.emojiProvider');
|
|
202
|
+
var showMediaPicker = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'media.showMediaPicker');
|
|
203
|
+
var mediaAllowsUploads = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'media.allowsUploads');
|
|
204
|
+
var showElementBrowser = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'insertBlock.showElementBrowser');
|
|
205
|
+
var isTypeAheadAllowed = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'typeAhead.isAllowed');
|
|
206
|
+
var mentionProvider = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'mention.mentionProvider');
|
|
207
|
+
var canInsertMention = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'mention.canInsertMention');
|
|
208
|
+
var dateEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'date.isInitialised');
|
|
209
|
+
var placeholderTextAllowInserting = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'placeholderText.allowInserting');
|
|
210
|
+
var connectivityMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'connectivity.mode');
|
|
211
|
+
var imageUploadEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'imageUpload.enabled');
|
|
212
|
+
var availableWrapperBlockTypes = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockType.availableWrapperBlockTypes');
|
|
213
|
+
var canInsertLink = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'hyperlink.canInsertLink');
|
|
214
|
+
var activeLinkMark = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'hyperlink.activeLinkMark');
|
|
215
|
+
return {
|
|
216
|
+
emojiProviderSelector: emojiProviderSelector,
|
|
217
|
+
showMediaPicker: showMediaPicker,
|
|
218
|
+
mediaAllowsUploads: mediaAllowsUploads,
|
|
219
|
+
showElementBrowser: showElementBrowser,
|
|
220
|
+
isTypeAheadAllowed: isTypeAheadAllowed,
|
|
221
|
+
mentionProvider: mentionProvider,
|
|
222
|
+
canInsertMention: canInsertMention,
|
|
223
|
+
dateEnabled: dateEnabled,
|
|
224
|
+
placeholderTextAllowInserting: placeholderTextAllowInserting,
|
|
225
|
+
connectivityMode: connectivityMode,
|
|
226
|
+
imageUploadEnabled: imageUploadEnabled,
|
|
227
|
+
availableWrapperBlockTypes: availableWrapperBlockTypes,
|
|
228
|
+
canInsertLink: canInsertLink,
|
|
229
|
+
activeLinkMark: activeLinkMark
|
|
230
|
+
};
|
|
231
|
+
}, function (api) {
|
|
232
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity']),
|
|
233
|
+
dateState = _useSharedPluginState.dateState,
|
|
234
|
+
hyperlinkState = _useSharedPluginState.hyperlinkState,
|
|
235
|
+
imageUploadState = _useSharedPluginState.imageUploadState,
|
|
236
|
+
mentionState = _useSharedPluginState.mentionState,
|
|
237
|
+
emojiState = _useSharedPluginState.emojiState,
|
|
238
|
+
blockTypeState = _useSharedPluginState.blockTypeState,
|
|
239
|
+
mediaState = _useSharedPluginState.mediaState,
|
|
240
|
+
typeAheadState = _useSharedPluginState.typeAheadState,
|
|
241
|
+
placeholderTextState = _useSharedPluginState.placeholderTextState,
|
|
242
|
+
insertBlockState = _useSharedPluginState.insertBlockState,
|
|
243
|
+
connectivityState = _useSharedPluginState.connectivityState;
|
|
244
|
+
return {
|
|
245
|
+
emojiProviderSelector: emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider,
|
|
246
|
+
showMediaPicker: mediaState === null || mediaState === void 0 ? void 0 : mediaState.showMediaPicker,
|
|
247
|
+
mediaAllowsUploads: mediaState === null || mediaState === void 0 ? void 0 : mediaState.allowsUploads,
|
|
248
|
+
showElementBrowser: insertBlockState === null || insertBlockState === void 0 ? void 0 : insertBlockState.showElementBrowser,
|
|
249
|
+
isTypeAheadAllowed: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isAllowed,
|
|
250
|
+
mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider,
|
|
251
|
+
canInsertMention: mentionState === null || mentionState === void 0 ? void 0 : mentionState.canInsertMention,
|
|
252
|
+
dateEnabled: dateState === null || dateState === void 0 ? void 0 : dateState.isInitialised,
|
|
253
|
+
placeholderTextAllowInserting: placeholderTextState === null || placeholderTextState === void 0 ? void 0 : placeholderTextState.allowInserting,
|
|
254
|
+
connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode,
|
|
255
|
+
imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
|
|
256
|
+
availableWrapperBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableWrapperBlockTypes,
|
|
257
|
+
canInsertLink: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.canInsertLink,
|
|
258
|
+
activeLinkMark: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.activeLinkMark
|
|
259
|
+
};
|
|
260
|
+
});
|
|
199
261
|
function ToolbarInsertBlockWithInjectionApi(_ref4) {
|
|
200
|
-
var
|
|
262
|
+
var _pluginInjectionApi$i, _pluginInjectionApi$c2, _pluginInjectionApi$p, _pluginInjectionApi$b, _pluginInjectionApi$e;
|
|
201
263
|
var editorView = _ref4.editorView,
|
|
202
264
|
editorActions = _ref4.editorActions,
|
|
203
265
|
dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent,
|
|
@@ -213,64 +275,67 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
|
|
|
213
275
|
options = _ref4.options,
|
|
214
276
|
appearance = _ref4.appearance;
|
|
215
277
|
var buttons = toolbarSizeToButtons(toolbarSize, appearance);
|
|
216
|
-
var
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
278
|
+
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
279
|
+
emojiProviderSelector = _useSharedState.emojiProviderSelector,
|
|
280
|
+
showMediaPicker = _useSharedState.showMediaPicker,
|
|
281
|
+
mediaAllowsUploads = _useSharedState.mediaAllowsUploads,
|
|
282
|
+
showElementBrowser = _useSharedState.showElementBrowser,
|
|
283
|
+
isTypeAheadAllowed = _useSharedState.isTypeAheadAllowed,
|
|
284
|
+
mentionProvider = _useSharedState.mentionProvider,
|
|
285
|
+
canInsertMention = _useSharedState.canInsertMention,
|
|
286
|
+
dateEnabled = _useSharedState.dateEnabled,
|
|
287
|
+
placeholderTextAllowInserting = _useSharedState.placeholderTextAllowInserting,
|
|
288
|
+
connectivityMode = _useSharedState.connectivityMode,
|
|
289
|
+
imageUploadEnabled = _useSharedState.imageUploadEnabled,
|
|
290
|
+
availableWrapperBlockTypes = _useSharedState.availableWrapperBlockTypes,
|
|
291
|
+
canInsertLink = _useSharedState.canInsertLink,
|
|
292
|
+
activeLinkMark = _useSharedState.activeLinkMark;
|
|
228
293
|
var getEmojiProvider = function getEmojiProvider() {
|
|
229
|
-
if (
|
|
230
|
-
return Promise.resolve(
|
|
294
|
+
if (emojiProviderSelector) {
|
|
295
|
+
return Promise.resolve(emojiProviderSelector);
|
|
231
296
|
}
|
|
232
297
|
};
|
|
233
298
|
var emojiProvider = getEmojiProvider();
|
|
234
299
|
var onShowMediaPicker = function onShowMediaPicker(mountInfo) {
|
|
235
|
-
if (!
|
|
300
|
+
if (!showMediaPicker) {
|
|
236
301
|
return;
|
|
237
302
|
}
|
|
238
303
|
if ((0, _platformFeatureFlags.fg)('platform_editor_add_media_from_url_rollout')) {
|
|
239
304
|
var _pluginInjectionApi$c, _pluginInjectionApi$m;
|
|
240
305
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(mountInfo));
|
|
241
306
|
} else {
|
|
242
|
-
|
|
307
|
+
showMediaPicker();
|
|
243
308
|
}
|
|
244
309
|
};
|
|
245
310
|
return /*#__PURE__*/_react.default.createElement(_ToolbarInsertBlock.default, {
|
|
246
|
-
showElementBrowser:
|
|
311
|
+
showElementBrowser: showElementBrowser || false,
|
|
247
312
|
pluginInjectionApi: pluginInjectionApi,
|
|
248
313
|
buttons: buttons,
|
|
249
314
|
isReducedSpacing: isToolbarReducedSpacing,
|
|
250
315
|
isDisabled: disabled,
|
|
251
|
-
isTypeAheadAllowed: Boolean(
|
|
316
|
+
isTypeAheadAllowed: Boolean(isTypeAheadAllowed),
|
|
252
317
|
editorView: editorView,
|
|
253
318
|
tableSupported: !!editorView.state.schema.nodes.table,
|
|
254
319
|
tableSelectorSupported: options.tableSelectorSupported && !!editorView.state.schema.nodes.table,
|
|
255
320
|
actionSupported: !!editorView.state.schema.nodes.taskItem,
|
|
256
|
-
mentionsSupported: !!
|
|
257
|
-
mentionsDisabled:
|
|
321
|
+
mentionsSupported: !!mentionProvider,
|
|
322
|
+
mentionsDisabled: !canInsertMention,
|
|
258
323
|
decisionSupported: !!editorView.state.schema.nodes.decisionItem,
|
|
259
|
-
dateEnabled: !!
|
|
260
|
-
placeholderTextEnabled:
|
|
324
|
+
dateEnabled: !!dateEnabled,
|
|
325
|
+
placeholderTextEnabled: !!placeholderTextAllowInserting,
|
|
261
326
|
layoutSectionEnabled: Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.layout),
|
|
262
327
|
expandEnabled: !!options.allowExpand,
|
|
263
|
-
mediaUploadsEnabled:
|
|
328
|
+
mediaUploadsEnabled: mediaAllowsUploads !== null && mediaAllowsUploads !== void 0 ? mediaAllowsUploads : undefined,
|
|
264
329
|
onShowMediaPicker: onShowMediaPicker,
|
|
265
|
-
mediaSupported:
|
|
266
|
-
isEditorOffline:
|
|
330
|
+
mediaSupported: mediaAllowsUploads !== undefined,
|
|
331
|
+
isEditorOffline: connectivityMode === 'offline',
|
|
267
332
|
imageUploadSupported: !!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.imageUpload),
|
|
268
|
-
imageUploadEnabled:
|
|
333
|
+
imageUploadEnabled: imageUploadEnabled,
|
|
269
334
|
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.imageUpload) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.actions.startUpload,
|
|
270
|
-
availableWrapperBlockTypes:
|
|
271
|
-
linkSupported:
|
|
272
|
-
linkDisabled: !
|
|
273
|
-
emojiDisabled: !
|
|
335
|
+
availableWrapperBlockTypes: availableWrapperBlockTypes,
|
|
336
|
+
linkSupported: canInsertLink !== undefined,
|
|
337
|
+
linkDisabled: !canInsertLink || !!activeLinkMark,
|
|
338
|
+
emojiDisabled: !emojiProvider,
|
|
274
339
|
emojiProvider: emojiProvider,
|
|
275
340
|
nativeStatusSupported: options.nativeStatusSupported,
|
|
276
341
|
horizontalRuleEnabled: options.horizontalRuleEnabled,
|
|
@@ -18,6 +18,7 @@ var _elementBrowser = require("@atlaskit/editor-common/element-browser");
|
|
|
18
18
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
19
19
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
20
20
|
var _uiReact = require("@atlaskit/editor-common/ui-react");
|
|
21
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
21
22
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
23
|
var _theme = require("@atlaskit/theme");
|
|
23
24
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -28,6 +29,18 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
28
29
|
* @jsx jsx
|
|
29
30
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
30
31
|
var DEFAULT_HEIGHT = exports.DEFAULT_HEIGHT = 560;
|
|
32
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
33
|
+
var connectivityMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'connectivity.mode');
|
|
34
|
+
return {
|
|
35
|
+
connectivityMode: connectivityMode
|
|
36
|
+
};
|
|
37
|
+
}, function (api) {
|
|
38
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['connectivity']),
|
|
39
|
+
connectivityState = _useSharedPluginState.connectivityState;
|
|
40
|
+
return {
|
|
41
|
+
connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode
|
|
42
|
+
};
|
|
43
|
+
});
|
|
31
44
|
var InsertMenu = function InsertMenu(_ref) {
|
|
32
45
|
var _pluginInjectionApi$q6, _pluginInjectionApi$q7;
|
|
33
46
|
var editorView = _ref.editorView,
|
|
@@ -102,8 +115,8 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
102
115
|
}
|
|
103
116
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 || _pluginInjectionApi$q.actions.insertItem(item, _analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
104
117
|
}, [editorView, toggleVisiblity, pluginInjectionApi]);
|
|
105
|
-
var
|
|
106
|
-
|
|
118
|
+
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
119
|
+
connectivityMode = _useSharedState.connectivityMode;
|
|
107
120
|
var getItems = (0, _react.useCallback)(function (query, category) {
|
|
108
121
|
var result;
|
|
109
122
|
/**
|
|
@@ -118,7 +131,7 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
118
131
|
query: query,
|
|
119
132
|
category: category
|
|
120
133
|
})) === null || _pluginInjectionApi$q3 === void 0 ? void 0 : _pluginInjectionApi$q3.map(function (item) {
|
|
121
|
-
return
|
|
134
|
+
return connectivityMode === 'offline' && item.isDisabledOffline ? _objectSpread(_objectSpread({}, item), {}, {
|
|
122
135
|
isDisabled: true
|
|
123
136
|
}) : item;
|
|
124
137
|
})) !== null && _pluginInjectionApi$q2 !== void 0 ? _pluginInjectionApi$q2 : [];
|
|
@@ -128,7 +141,7 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
128
141
|
category: category,
|
|
129
142
|
featuredItems: true
|
|
130
143
|
})) === null || _pluginInjectionApi$q5 === void 0 ? void 0 : _pluginInjectionApi$q5.map(function (item) {
|
|
131
|
-
return
|
|
144
|
+
return connectivityMode === 'offline' && item.isDisabledOffline ? _objectSpread(_objectSpread({}, item), {}, {
|
|
132
145
|
isDisabled: true
|
|
133
146
|
}) : item;
|
|
134
147
|
})) !== null && _pluginInjectionApi$q4 !== void 0 ? _pluginInjectionApi$q4 : [];
|
|
@@ -136,7 +149,7 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
136
149
|
}
|
|
137
150
|
setItemCount(result.length);
|
|
138
151
|
return result;
|
|
139
|
-
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q6 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q6 === void 0 ? void 0 : _pluginInjectionApi$q6.actions, quickInsertDropdownItems,
|
|
152
|
+
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q6 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q6 === void 0 ? void 0 : _pluginInjectionApi$q6.actions, quickInsertDropdownItems, connectivityMode]);
|
|
140
153
|
var emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q7 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q7 === void 0 || (_pluginInjectionApi$q7 = _pluginInjectionApi$q7.sharedState.currentState()) === null || _pluginInjectionApi$q7 === void 0 ? void 0 : _pluginInjectionApi$q7.emptyStateHandler;
|
|
141
154
|
var onViewMore = (0, _react.useCallback)(function () {
|
|
142
155
|
var _pluginInjectionApi$c, _pluginInjectionApi$q8;
|
|
@@ -9,10 +9,34 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _reactIntlNext = require("react-intl-next");
|
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
12
13
|
var _createItems = require("../ToolbarInsertBlock/create-items");
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
|
|
14
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
15
|
+
var dateEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'date.isInitialised');
|
|
16
|
+
var canInsertLink = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'hyperlink.canInsertLink');
|
|
17
|
+
var activeLinkMark = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'hyperlink.activeLinkMark');
|
|
18
|
+
var isTypeAheadAllowed = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'typeAhead.isAllowed');
|
|
19
|
+
var availableWrapperBlockTypes = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockType.availableWrapperBlockTypes');
|
|
20
|
+
var imageUploadEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'imageUpload.enabled');
|
|
21
|
+
var placeholderTextAllowInserting = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'placeholderText.allowInserting');
|
|
22
|
+
var emojiProvider = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'emoji.emojiProvider');
|
|
23
|
+
var mentionProvider = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'mention.mentionProvider');
|
|
24
|
+
var canInsertMention = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'mention.canInsertMention');
|
|
25
|
+
var mediaAllowsUploads = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'media.allowsUploads');
|
|
26
|
+
return {
|
|
27
|
+
dateEnabled: dateEnabled,
|
|
28
|
+
canInsertLink: canInsertLink,
|
|
29
|
+
activeLinkMark: activeLinkMark,
|
|
30
|
+
isTypeAheadAllowed: isTypeAheadAllowed,
|
|
31
|
+
availableWrapperBlockTypes: availableWrapperBlockTypes,
|
|
32
|
+
imageUploadEnabled: imageUploadEnabled,
|
|
33
|
+
placeholderTextAllowInserting: placeholderTextAllowInserting,
|
|
34
|
+
emojiProvider: emojiProvider,
|
|
35
|
+
mentionProvider: mentionProvider,
|
|
36
|
+
canInsertMention: canInsertMention,
|
|
37
|
+
mediaAllowsUploads: mediaAllowsUploads
|
|
38
|
+
};
|
|
39
|
+
}, function (api) {
|
|
16
40
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText']),
|
|
17
41
|
dateState = _useSharedPluginState.dateState,
|
|
18
42
|
hyperlinkState = _useSharedPluginState.hyperlinkState,
|
|
@@ -23,32 +47,60 @@ var useInsertMenuRailItems = exports.useInsertMenuRailItems = function useInsert
|
|
|
23
47
|
mediaState = _useSharedPluginState.mediaState,
|
|
24
48
|
typeAheadState = _useSharedPluginState.typeAheadState,
|
|
25
49
|
placeholderTextState = _useSharedPluginState.placeholderTextState;
|
|
50
|
+
return {
|
|
51
|
+
dateEnabled: dateState === null || dateState === void 0 ? void 0 : dateState.isInitialised,
|
|
52
|
+
canInsertLink: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.canInsertLink,
|
|
53
|
+
activeLinkMark: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.activeLinkMark,
|
|
54
|
+
isTypeAheadAllowed: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isAllowed,
|
|
55
|
+
availableWrapperBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableWrapperBlockTypes,
|
|
56
|
+
imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
|
|
57
|
+
placeholderTextAllowInserting: placeholderTextState === null || placeholderTextState === void 0 ? void 0 : placeholderTextState.allowInserting,
|
|
58
|
+
emojiProvider: emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider,
|
|
59
|
+
mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider,
|
|
60
|
+
canInsertMention: mentionState === null || mentionState === void 0 ? void 0 : mentionState.canInsertMention,
|
|
61
|
+
mediaAllowsUploads: mediaState === null || mediaState === void 0 ? void 0 : mediaState.allowsUploads
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
var useInsertMenuRailItems = exports.useInsertMenuRailItems = function useInsertMenuRailItems(editorView, options, api) {
|
|
65
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
66
|
+
formatMessage = _useIntl.formatMessage;
|
|
67
|
+
var _useSharedState = useSharedState(api),
|
|
68
|
+
dateEnabled = _useSharedState.dateEnabled,
|
|
69
|
+
canInsertLink = _useSharedState.canInsertLink,
|
|
70
|
+
activeLinkMark = _useSharedState.activeLinkMark,
|
|
71
|
+
isTypeAheadAllowed = _useSharedState.isTypeAheadAllowed,
|
|
72
|
+
availableWrapperBlockTypes = _useSharedState.availableWrapperBlockTypes,
|
|
73
|
+
imageUploadEnabled = _useSharedState.imageUploadEnabled,
|
|
74
|
+
placeholderTextAllowInserting = _useSharedState.placeholderTextAllowInserting,
|
|
75
|
+
emojiProvider = _useSharedState.emojiProvider,
|
|
76
|
+
mentionProvider = _useSharedState.mentionProvider,
|
|
77
|
+
canInsertMention = _useSharedState.canInsertMention,
|
|
78
|
+
mediaAllowsUploads = _useSharedState.mediaAllowsUploads;
|
|
26
79
|
var _useMemo = (0, _react.useMemo)(function () {
|
|
27
|
-
var _ref;
|
|
28
80
|
return (0, _createItems.createItems)({
|
|
29
|
-
isTypeAheadAllowed: Boolean(
|
|
81
|
+
isTypeAheadAllowed: Boolean(isTypeAheadAllowed),
|
|
30
82
|
tableSupported: !!editorView.state.schema.nodes.table,
|
|
31
83
|
tableSelectorSupported: options.tableSelectorSupported && !!editorView.state.schema.nodes.table,
|
|
32
|
-
mediaUploadsEnabled:
|
|
33
|
-
mediaSupported:
|
|
84
|
+
mediaUploadsEnabled: mediaAllowsUploads !== null && mediaAllowsUploads !== void 0 ? mediaAllowsUploads : undefined,
|
|
85
|
+
mediaSupported: mediaAllowsUploads !== undefined,
|
|
34
86
|
imageUploadSupported: !!(api !== null && api !== void 0 && api.imageUpload),
|
|
35
|
-
imageUploadEnabled:
|
|
36
|
-
mentionsSupported: !!
|
|
37
|
-
mentionsDisabled:
|
|
87
|
+
imageUploadEnabled: imageUploadEnabled,
|
|
88
|
+
mentionsSupported: !!mentionProvider,
|
|
89
|
+
mentionsDisabled: !canInsertMention,
|
|
38
90
|
actionSupported: !!editorView.state.schema.nodes.taskItem,
|
|
39
91
|
decisionSupported: !!editorView.state.schema.nodes.decisionItem,
|
|
40
|
-
linkSupported:
|
|
41
|
-
linkDisabled: !
|
|
42
|
-
emojiDisabled: !
|
|
92
|
+
linkSupported: canInsertLink !== undefined,
|
|
93
|
+
linkDisabled: !canInsertLink || !!activeLinkMark,
|
|
94
|
+
emojiDisabled: !emojiProvider,
|
|
43
95
|
nativeStatusSupported: options.nativeStatusSupported,
|
|
44
|
-
dateEnabled: !!
|
|
45
|
-
placeholderTextEnabled:
|
|
96
|
+
dateEnabled: !!dateEnabled,
|
|
97
|
+
placeholderTextEnabled: placeholderTextAllowInserting,
|
|
46
98
|
horizontalRuleEnabled: options.horizontalRuleEnabled,
|
|
47
99
|
layoutSectionEnabled: Boolean(api === null || api === void 0 ? void 0 : api.layout),
|
|
48
100
|
expandEnabled: !!options.allowExpand,
|
|
49
101
|
showElementBrowserLink: options.showElementBrowserLink,
|
|
50
|
-
emojiProvider:
|
|
51
|
-
availableWrapperBlockTypes:
|
|
102
|
+
emojiProvider: emojiProvider,
|
|
103
|
+
availableWrapperBlockTypes: availableWrapperBlockTypes,
|
|
52
104
|
insertMenuItems: options.insertMenuItems,
|
|
53
105
|
schema: editorView.state.schema,
|
|
54
106
|
// numberOfButtons controls what items are returned and eventually display in the insert menu - but it relies on the main toolbar width which
|
|
@@ -57,7 +109,7 @@ var useInsertMenuRailItems = exports.useInsertMenuRailItems = function useInsert
|
|
|
57
109
|
formatMessage: formatMessage,
|
|
58
110
|
isNewMenuEnabled: true
|
|
59
111
|
});
|
|
60
|
-
}, [api === null || api === void 0 ? void 0 : api.imageUpload, api === null || api === void 0 ? void 0 : api.layout,
|
|
112
|
+
}, [activeLinkMark, api === null || api === void 0 ? void 0 : api.imageUpload, api === null || api === void 0 ? void 0 : api.layout, availableWrapperBlockTypes, canInsertLink, canInsertMention, dateEnabled, editorView.state.schema, emojiProvider, formatMessage, imageUploadEnabled, isTypeAheadAllowed, mediaAllowsUploads, mentionProvider, options.allowExpand, options.horizontalRuleEnabled, options.insertMenuItems, options.nativeStatusSupported, options.showElementBrowserLink, options.tableSelectorSupported, placeholderTextAllowInserting]),
|
|
61
113
|
_useMemo2 = (0, _slicedToArray2.default)(_useMemo, 2),
|
|
62
114
|
_ = _useMemo2[0],
|
|
63
115
|
dropdownItems = _useMemo2[1];
|
|
@@ -805,7 +805,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
805
805
|
showElementBrowserLink: this.props.showElementBrowserLink || false,
|
|
806
806
|
pluginInjectionApi: this.props.pluginInjectionApi,
|
|
807
807
|
isFullPageAppearance: isFullPageAppearance
|
|
808
|
-
})), (!((_this$props$pluginInj = this.props.pluginInjectionApi) !== null && _this$props$pluginInj !== void 0 && _this$props$pluginInj.primaryToolbar) && this.props.showSeparator || isFullPageAppearance && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
808
|
+
})), (!((_this$props$pluginInj = this.props.pluginInjectionApi) !== null && _this$props$pluginInj !== void 0 && _this$props$pluginInj.primaryToolbar) && this.props.showSeparator || isFullPageAppearance && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
809
809
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
810
810
|
(0, _react2.jsx)("span", {
|
|
811
811
|
css: _styles.separatorStyles
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { ElementBrowser } from '@atlaskit/editor-common/element-browser';
|
|
4
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
7
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
7
8
|
import { BLOCK_QUOTE, CODE_BLOCK, PANEL } from '@atlaskit/editor-plugin-block-type/consts';
|
|
8
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { toggleInsertBlockPmKey, toggleInsertBlockPmPlugin } from './pm-plugins/toggleInsertBlock';
|
|
@@ -179,6 +180,68 @@ export const insertBlockPlugin = ({
|
|
|
179
180
|
};
|
|
180
181
|
return plugin;
|
|
181
182
|
};
|
|
183
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
184
|
+
const emojiProviderSelector = useSharedPluginStateSelector(api, 'emoji.emojiProvider');
|
|
185
|
+
const showMediaPicker = useSharedPluginStateSelector(api, 'media.showMediaPicker');
|
|
186
|
+
const mediaAllowsUploads = useSharedPluginStateSelector(api, 'media.allowsUploads');
|
|
187
|
+
const showElementBrowser = useSharedPluginStateSelector(api, 'insertBlock.showElementBrowser');
|
|
188
|
+
const isTypeAheadAllowed = useSharedPluginStateSelector(api, 'typeAhead.isAllowed');
|
|
189
|
+
const mentionProvider = useSharedPluginStateSelector(api, 'mention.mentionProvider');
|
|
190
|
+
const canInsertMention = useSharedPluginStateSelector(api, 'mention.canInsertMention');
|
|
191
|
+
const dateEnabled = useSharedPluginStateSelector(api, 'date.isInitialised');
|
|
192
|
+
const placeholderTextAllowInserting = useSharedPluginStateSelector(api, 'placeholderText.allowInserting');
|
|
193
|
+
const connectivityMode = useSharedPluginStateSelector(api, 'connectivity.mode');
|
|
194
|
+
const imageUploadEnabled = useSharedPluginStateSelector(api, 'imageUpload.enabled');
|
|
195
|
+
const availableWrapperBlockTypes = useSharedPluginStateSelector(api, 'blockType.availableWrapperBlockTypes');
|
|
196
|
+
const canInsertLink = useSharedPluginStateSelector(api, 'hyperlink.canInsertLink');
|
|
197
|
+
const activeLinkMark = useSharedPluginStateSelector(api, 'hyperlink.activeLinkMark');
|
|
198
|
+
return {
|
|
199
|
+
emojiProviderSelector,
|
|
200
|
+
showMediaPicker,
|
|
201
|
+
mediaAllowsUploads,
|
|
202
|
+
showElementBrowser,
|
|
203
|
+
isTypeAheadAllowed,
|
|
204
|
+
mentionProvider,
|
|
205
|
+
canInsertMention,
|
|
206
|
+
dateEnabled,
|
|
207
|
+
placeholderTextAllowInserting,
|
|
208
|
+
connectivityMode,
|
|
209
|
+
imageUploadEnabled,
|
|
210
|
+
availableWrapperBlockTypes,
|
|
211
|
+
canInsertLink,
|
|
212
|
+
activeLinkMark
|
|
213
|
+
};
|
|
214
|
+
}, api => {
|
|
215
|
+
const {
|
|
216
|
+
dateState,
|
|
217
|
+
hyperlinkState,
|
|
218
|
+
imageUploadState,
|
|
219
|
+
mentionState,
|
|
220
|
+
emojiState,
|
|
221
|
+
blockTypeState,
|
|
222
|
+
mediaState,
|
|
223
|
+
typeAheadState,
|
|
224
|
+
placeholderTextState,
|
|
225
|
+
insertBlockState,
|
|
226
|
+
connectivityState
|
|
227
|
+
} = useSharedPluginState(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity']);
|
|
228
|
+
return {
|
|
229
|
+
emojiProviderSelector: emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider,
|
|
230
|
+
showMediaPicker: mediaState === null || mediaState === void 0 ? void 0 : mediaState.showMediaPicker,
|
|
231
|
+
mediaAllowsUploads: mediaState === null || mediaState === void 0 ? void 0 : mediaState.allowsUploads,
|
|
232
|
+
showElementBrowser: insertBlockState === null || insertBlockState === void 0 ? void 0 : insertBlockState.showElementBrowser,
|
|
233
|
+
isTypeAheadAllowed: typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isAllowed,
|
|
234
|
+
mentionProvider: mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider,
|
|
235
|
+
canInsertMention: mentionState === null || mentionState === void 0 ? void 0 : mentionState.canInsertMention,
|
|
236
|
+
dateEnabled: dateState === null || dateState === void 0 ? void 0 : dateState.isInitialised,
|
|
237
|
+
placeholderTextAllowInserting: placeholderTextState === null || placeholderTextState === void 0 ? void 0 : placeholderTextState.allowInserting,
|
|
238
|
+
connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode,
|
|
239
|
+
imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
|
|
240
|
+
availableWrapperBlockTypes: blockTypeState === null || blockTypeState === void 0 ? void 0 : blockTypeState.availableWrapperBlockTypes,
|
|
241
|
+
canInsertLink: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.canInsertLink,
|
|
242
|
+
activeLinkMark: hyperlinkState === null || hyperlinkState === void 0 ? void 0 : hyperlinkState.activeLinkMark
|
|
243
|
+
};
|
|
244
|
+
});
|
|
182
245
|
function ToolbarInsertBlockWithInjectionApi({
|
|
183
246
|
editorView,
|
|
184
247
|
editorActions,
|
|
@@ -195,67 +258,70 @@ function ToolbarInsertBlockWithInjectionApi({
|
|
|
195
258
|
options,
|
|
196
259
|
appearance
|
|
197
260
|
}) {
|
|
198
|
-
var
|
|
261
|
+
var _pluginInjectionApi$i, _pluginInjectionApi$c2, _pluginInjectionApi$p, _pluginInjectionApi$b, _pluginInjectionApi$e;
|
|
199
262
|
const buttons = toolbarSizeToButtons(toolbarSize, appearance);
|
|
200
263
|
const {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
264
|
+
emojiProviderSelector,
|
|
265
|
+
showMediaPicker,
|
|
266
|
+
mediaAllowsUploads,
|
|
267
|
+
showElementBrowser,
|
|
268
|
+
isTypeAheadAllowed,
|
|
269
|
+
mentionProvider,
|
|
270
|
+
canInsertMention,
|
|
271
|
+
dateEnabled,
|
|
272
|
+
placeholderTextAllowInserting,
|
|
273
|
+
connectivityMode,
|
|
274
|
+
imageUploadEnabled,
|
|
275
|
+
availableWrapperBlockTypes,
|
|
276
|
+
canInsertLink,
|
|
277
|
+
activeLinkMark
|
|
278
|
+
} = useSharedState(pluginInjectionApi);
|
|
213
279
|
const getEmojiProvider = () => {
|
|
214
|
-
if (
|
|
215
|
-
return Promise.resolve(
|
|
280
|
+
if (emojiProviderSelector) {
|
|
281
|
+
return Promise.resolve(emojiProviderSelector);
|
|
216
282
|
}
|
|
217
283
|
};
|
|
218
284
|
const emojiProvider = getEmojiProvider();
|
|
219
285
|
const onShowMediaPicker = mountInfo => {
|
|
220
|
-
if (!
|
|
286
|
+
if (!showMediaPicker) {
|
|
221
287
|
return;
|
|
222
288
|
}
|
|
223
289
|
if (fg('platform_editor_add_media_from_url_rollout')) {
|
|
224
290
|
var _pluginInjectionApi$c, _pluginInjectionApi$m;
|
|
225
291
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m = pluginInjectionApi.mediaInsert) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.commands.showMediaInsertPopup(mountInfo));
|
|
226
292
|
} else {
|
|
227
|
-
|
|
293
|
+
showMediaPicker();
|
|
228
294
|
}
|
|
229
295
|
};
|
|
230
296
|
return /*#__PURE__*/React.createElement(ToolbarInsertBlock, {
|
|
231
|
-
showElementBrowser:
|
|
297
|
+
showElementBrowser: showElementBrowser || false,
|
|
232
298
|
pluginInjectionApi: pluginInjectionApi,
|
|
233
299
|
buttons: buttons,
|
|
234
300
|
isReducedSpacing: isToolbarReducedSpacing,
|
|
235
301
|
isDisabled: disabled,
|
|
236
|
-
isTypeAheadAllowed: Boolean(
|
|
302
|
+
isTypeAheadAllowed: Boolean(isTypeAheadAllowed),
|
|
237
303
|
editorView: editorView,
|
|
238
304
|
tableSupported: !!editorView.state.schema.nodes.table,
|
|
239
305
|
tableSelectorSupported: options.tableSelectorSupported && !!editorView.state.schema.nodes.table,
|
|
240
306
|
actionSupported: !!editorView.state.schema.nodes.taskItem,
|
|
241
|
-
mentionsSupported: !!
|
|
242
|
-
mentionsDisabled:
|
|
307
|
+
mentionsSupported: !!mentionProvider,
|
|
308
|
+
mentionsDisabled: !canInsertMention,
|
|
243
309
|
decisionSupported: !!editorView.state.schema.nodes.decisionItem,
|
|
244
|
-
dateEnabled: !!
|
|
245
|
-
placeholderTextEnabled:
|
|
310
|
+
dateEnabled: !!dateEnabled,
|
|
311
|
+
placeholderTextEnabled: !!placeholderTextAllowInserting,
|
|
246
312
|
layoutSectionEnabled: Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.layout),
|
|
247
313
|
expandEnabled: !!options.allowExpand,
|
|
248
|
-
mediaUploadsEnabled:
|
|
314
|
+
mediaUploadsEnabled: mediaAllowsUploads !== null && mediaAllowsUploads !== void 0 ? mediaAllowsUploads : undefined,
|
|
249
315
|
onShowMediaPicker: onShowMediaPicker,
|
|
250
|
-
mediaSupported:
|
|
251
|
-
isEditorOffline:
|
|
316
|
+
mediaSupported: mediaAllowsUploads !== undefined,
|
|
317
|
+
isEditorOffline: connectivityMode === 'offline',
|
|
252
318
|
imageUploadSupported: !!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.imageUpload),
|
|
253
|
-
imageUploadEnabled:
|
|
319
|
+
imageUploadEnabled: imageUploadEnabled,
|
|
254
320
|
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$i = pluginInjectionApi.imageUpload) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.actions.startUpload,
|
|
255
|
-
availableWrapperBlockTypes:
|
|
256
|
-
linkSupported:
|
|
257
|
-
linkDisabled: !
|
|
258
|
-
emojiDisabled: !
|
|
321
|
+
availableWrapperBlockTypes: availableWrapperBlockTypes,
|
|
322
|
+
linkSupported: canInsertLink !== undefined,
|
|
323
|
+
linkDisabled: !canInsertLink || !!activeLinkMark,
|
|
324
|
+
emojiDisabled: !emojiProvider,
|
|
259
325
|
emojiProvider: emojiProvider,
|
|
260
326
|
nativeStatusSupported: options.nativeStatusSupported,
|
|
261
327
|
horizontalRuleEnabled: options.horizontalRuleEnabled,
|