@atlaskit/editor-plugin-insert-block 2.4.15 → 2.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/plugin.js +4 -2
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +2 -2
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-element-browser.js +10 -2
- package/dist/cjs/ui/ToolbarInsertBlock/create-items.js +7 -5
- package/dist/cjs/ui/ToolbarInsertBlock/index.js +3 -3
- package/dist/es2019/plugin.js +4 -2
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +1 -1
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-element-browser.js +7 -2
- package/dist/es2019/ui/ToolbarInsertBlock/create-items.js +7 -5
- package/dist/es2019/ui/ToolbarInsertBlock/index.js +3 -3
- package/dist/esm/plugin.js +4 -2
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +1 -1
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-element-browser.js +7 -2
- package/dist/esm/ui/ToolbarInsertBlock/create-items.js +7 -5
- package/dist/esm/ui/ToolbarInsertBlock/index.js +3 -3
- package/dist/types/types.d.ts +3 -1
- package/dist/types/ui/ElementBrowser/InsertMenu.d.ts +1 -0
- package/dist/types/ui/ToolbarInsertBlock/create-items.d.ts +1 -0
- package/dist/types/ui/ToolbarInsertBlock/types.d.ts +1 -0
- package/dist/types-ts4.5/types.d.ts +3 -1
- package/dist/types-ts4.5/ui/ElementBrowser/InsertMenu.d.ts +1 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/create-items.d.ts +1 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/types.d.ts +1 -0
- package/package.json +14 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 2.4.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#171281](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/171281)
|
|
8
|
+
[`10b213d7981fe`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/10b213d7981fe) -
|
|
9
|
+
Prefer the plus menu button placement on the bottom where there is insufficient room on the top.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.4.16
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#169233](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/169233)
|
|
17
|
+
[`2ca37f881a673`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2ca37f881a673) -
|
|
18
|
+
[ux] Disable media, emoji, and mention toolbar items while the editor is offline.
|
|
19
|
+
|
|
3
20
|
## 2.4.15
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -309,7 +309,7 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
|
|
|
309
309
|
options = _ref4.options,
|
|
310
310
|
appearance = _ref4.appearance;
|
|
311
311
|
var buttons = toolbarSizeToButtons(toolbarSize, appearance);
|
|
312
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock']),
|
|
312
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity']),
|
|
313
313
|
dateState = _useSharedPluginState.dateState,
|
|
314
314
|
hyperlinkState = _useSharedPluginState.hyperlinkState,
|
|
315
315
|
imageUploadState = _useSharedPluginState.imageUploadState,
|
|
@@ -319,7 +319,8 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
|
|
|
319
319
|
mediaState = _useSharedPluginState.mediaState,
|
|
320
320
|
typeAheadState = _useSharedPluginState.typeAheadState,
|
|
321
321
|
placeholderTextState = _useSharedPluginState.placeholderTextState,
|
|
322
|
-
insertBlockState = _useSharedPluginState.insertBlockState
|
|
322
|
+
insertBlockState = _useSharedPluginState.insertBlockState,
|
|
323
|
+
connectivityState = _useSharedPluginState.connectivityState;
|
|
323
324
|
var getEmojiProvider = function getEmojiProvider() {
|
|
324
325
|
if (emojiState !== null && emojiState !== void 0 && emojiState.emojiProvider) {
|
|
325
326
|
return Promise.resolve(emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider);
|
|
@@ -358,6 +359,7 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
|
|
|
358
359
|
mediaUploadsEnabled: (_ref5 = mediaState && mediaState.allowsUploads) !== null && _ref5 !== void 0 ? _ref5 : undefined,
|
|
359
360
|
onShowMediaPicker: onShowMediaPicker,
|
|
360
361
|
mediaSupported: !!mediaState,
|
|
362
|
+
isEditorOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline',
|
|
361
363
|
imageUploadSupported: !!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.imageUpload),
|
|
362
364
|
imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
|
|
363
365
|
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.imageUpload) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.actions.startUpload,
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default = void 0;
|
|
7
|
+
exports.default = exports.DEFAULT_HEIGHT = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
@@ -28,7 +28,7 @@ var _excluded = ["children"];
|
|
|
28
28
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
29
29
|
// AFP-2532 TODO: Fix automatic suppressions below
|
|
30
30
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
31
|
-
var DEFAULT_HEIGHT = 560;
|
|
31
|
+
var DEFAULT_HEIGHT = exports.DEFAULT_HEIGHT = 560;
|
|
32
32
|
var InsertMenu = function InsertMenu(_ref) {
|
|
33
33
|
var _pluginInjectionApi$q7, _pluginInjectionApi$q8;
|
|
34
34
|
var editorView = _ref.editorView,
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.BlockInsertElementBrowser = void 0;
|
|
8
9
|
var _react = _interopRequireDefault(require("react"));
|
|
9
10
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
10
|
-
var
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
|
+
var _InsertMenu = _interopRequireWildcard(require("../ElementBrowser/InsertMenu"));
|
|
11
13
|
var _dropdownButton = require("./dropdown-button");
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
// This determines how the popup should fit. We prefer the insert menu
|
|
17
|
+
// opening on the bottom as we have a search bar and should only open on
|
|
18
|
+
// top if there is more than sufficient room.
|
|
19
|
+
var FIT_HEIGHT_BUFFER = 100;
|
|
12
20
|
var BlockInsertElementBrowser = exports.BlockInsertElementBrowser = function BlockInsertElementBrowser(props) {
|
|
13
21
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.open && /*#__PURE__*/_react.default.createElement(_ui.Popup, {
|
|
14
22
|
target: props.plusButtonRef,
|
|
15
|
-
fitHeight: 500,
|
|
23
|
+
fitHeight: (0, _platformFeatureFlags.fg)('platform_editor_consistent_insert_menu') ? _InsertMenu.DEFAULT_HEIGHT + FIT_HEIGHT_BUFFER : 500,
|
|
16
24
|
fitWidth: 350,
|
|
17
25
|
offset: [0, 3],
|
|
18
26
|
mountTo: props.popupsMountPoint,
|
|
@@ -63,8 +63,10 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
63
63
|
expandEnabled = config.expandEnabled,
|
|
64
64
|
numberOfButtons = config.numberOfButtons,
|
|
65
65
|
schema = config.schema,
|
|
66
|
-
formatMessage = config.formatMessage
|
|
66
|
+
formatMessage = config.formatMessage,
|
|
67
|
+
isEditorOffline = config.isEditorOffline;
|
|
67
68
|
var items = [];
|
|
69
|
+
var isOffline = isEditorOffline === true;
|
|
68
70
|
if (actionSupported) {
|
|
69
71
|
items.push((0, _item.action)({
|
|
70
72
|
content: formatMessage(_messages2.messages.action),
|
|
@@ -84,20 +86,20 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
84
86
|
items.push((0, _item.media)({
|
|
85
87
|
content: formatMessage(_messages2.messages.addMediaFiles),
|
|
86
88
|
tooltipDescription: formatMessage(_messages2.messages.mediaFilesDescription),
|
|
87
|
-
disabled:
|
|
89
|
+
disabled: isOffline
|
|
88
90
|
}));
|
|
89
91
|
}
|
|
90
92
|
if (imageUploadSupported) {
|
|
91
93
|
items.push((0, _item.imageUpload)({
|
|
92
94
|
content: formatMessage(_messages2.messages.image),
|
|
93
|
-
disabled: !imageUploadEnabled
|
|
95
|
+
disabled: !imageUploadEnabled || isOffline
|
|
94
96
|
}));
|
|
95
97
|
}
|
|
96
98
|
if (mentionsSupported) {
|
|
97
99
|
items.push((0, _item.mention)({
|
|
98
100
|
content: formatMessage(_messages2.messages.mention),
|
|
99
101
|
tooltipDescription: formatMessage(_messages2.messages.mentionDescription),
|
|
100
|
-
disabled: !isTypeAheadAllowed || !!mentionsDisabled,
|
|
102
|
+
disabled: !isTypeAheadAllowed || !!mentionsDisabled || isOffline,
|
|
101
103
|
'aria-haspopup': 'listbox'
|
|
102
104
|
}));
|
|
103
105
|
}
|
|
@@ -105,7 +107,7 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
105
107
|
items.push((0, _item.emoji)({
|
|
106
108
|
content: formatMessage(_messages2.messages.emoji),
|
|
107
109
|
tooltipDescription: formatMessage(_messages2.messages.emojiDescription),
|
|
108
|
-
disabled: emojiDisabled || !isTypeAheadAllowed,
|
|
110
|
+
disabled: emojiDisabled || !isTypeAheadAllowed || isOffline,
|
|
109
111
|
'aria-haspopup': 'dialog'
|
|
110
112
|
}));
|
|
111
113
|
}
|
|
@@ -357,9 +357,8 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
357
357
|
var _pluginInjectionApi$l;
|
|
358
358
|
var _this$props4 = _this.props,
|
|
359
359
|
editorView = _this$props4.editorView,
|
|
360
|
-
pluginInjectionApi = _this$props4.pluginInjectionApi
|
|
361
|
-
|
|
362
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.layout) === null || _pluginInjectionApi$l === void 0 || _pluginInjectionApi$l.actions.insertLayoutColumns(inputMethod, intl.formatMessage)(editorView.state, editorView.dispatch);
|
|
360
|
+
pluginInjectionApi = _this$props4.pluginInjectionApi;
|
|
361
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.layout) === null || _pluginInjectionApi$l === void 0 || _pluginInjectionApi$l.actions.insertLayoutColumns(inputMethod)(editorView.state, editorView.dispatch);
|
|
363
362
|
return true;
|
|
364
363
|
});
|
|
365
364
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createStatus", function (inputMethod) {
|
|
@@ -826,6 +825,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
826
825
|
tableSelectorSupported: props.tableSelectorSupported,
|
|
827
826
|
mediaUploadsEnabled: props.mediaUploadsEnabled,
|
|
828
827
|
mediaSupported: props.mediaSupported,
|
|
828
|
+
isEditorOffline: props.isEditorOffline,
|
|
829
829
|
imageUploadSupported: props.imageUploadSupported,
|
|
830
830
|
imageUploadEnabled: props.imageUploadEnabled,
|
|
831
831
|
mentionsSupported: props.mentionsSupported,
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -315,8 +315,9 @@ function ToolbarInsertBlockWithInjectionApi({
|
|
|
315
315
|
mediaState,
|
|
316
316
|
typeAheadState,
|
|
317
317
|
placeholderTextState,
|
|
318
|
-
insertBlockState
|
|
319
|
-
|
|
318
|
+
insertBlockState,
|
|
319
|
+
connectivityState
|
|
320
|
+
} = useSharedPluginState(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity']);
|
|
320
321
|
const getEmojiProvider = () => {
|
|
321
322
|
if (emojiState !== null && emojiState !== void 0 && emojiState.emojiProvider) {
|
|
322
323
|
return Promise.resolve(emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider);
|
|
@@ -355,6 +356,7 @@ function ToolbarInsertBlockWithInjectionApi({
|
|
|
355
356
|
mediaUploadsEnabled: (_ref = mediaState && mediaState.allowsUploads) !== null && _ref !== void 0 ? _ref : undefined,
|
|
356
357
|
onShowMediaPicker: onShowMediaPicker,
|
|
357
358
|
mediaSupported: !!mediaState,
|
|
359
|
+
isEditorOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline',
|
|
358
360
|
imageUploadSupported: !!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.imageUpload),
|
|
359
361
|
imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
|
|
360
362
|
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$i = pluginInjectionApi.imageUpload) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.actions.startUpload,
|
|
@@ -19,7 +19,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
19
19
|
import { borderRadius } from '@atlaskit/theme';
|
|
20
20
|
import { N0, N30A, N60A } from '@atlaskit/theme/colors';
|
|
21
21
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
22
|
-
const DEFAULT_HEIGHT = 560;
|
|
22
|
+
export const DEFAULT_HEIGHT = 560;
|
|
23
23
|
const InsertMenu = ({
|
|
24
24
|
editorView,
|
|
25
25
|
dropdownItems,
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
3
|
-
import
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import InsertMenu, { DEFAULT_HEIGHT } from '../ElementBrowser/InsertMenu';
|
|
4
5
|
import { DropDownButton } from './dropdown-button';
|
|
6
|
+
// This determines how the popup should fit. We prefer the insert menu
|
|
7
|
+
// opening on the bottom as we have a search bar and should only open on
|
|
8
|
+
// top if there is more than sufficient room.
|
|
9
|
+
const FIT_HEIGHT_BUFFER = 100;
|
|
5
10
|
export const BlockInsertElementBrowser = props => {
|
|
6
11
|
return /*#__PURE__*/React.createElement(React.Fragment, null, props.open && /*#__PURE__*/React.createElement(Popup, {
|
|
7
12
|
target: props.plusButtonRef,
|
|
8
|
-
fitHeight: 500,
|
|
13
|
+
fitHeight: fg('platform_editor_consistent_insert_menu') ? DEFAULT_HEIGHT + FIT_HEIGHT_BUFFER : 500,
|
|
9
14
|
fitWidth: 350,
|
|
10
15
|
offset: [0, 3],
|
|
11
16
|
mountTo: props.popupsMountPoint,
|
|
@@ -49,9 +49,11 @@ const createInsertBlockItems = config => {
|
|
|
49
49
|
expandEnabled,
|
|
50
50
|
numberOfButtons,
|
|
51
51
|
schema,
|
|
52
|
-
formatMessage
|
|
52
|
+
formatMessage,
|
|
53
|
+
isEditorOffline
|
|
53
54
|
} = config;
|
|
54
55
|
const items = [];
|
|
56
|
+
const isOffline = isEditorOffline === true;
|
|
55
57
|
if (actionSupported) {
|
|
56
58
|
items.push(action({
|
|
57
59
|
content: formatMessage(messages.action),
|
|
@@ -71,20 +73,20 @@ const createInsertBlockItems = config => {
|
|
|
71
73
|
items.push(media({
|
|
72
74
|
content: formatMessage(messages.addMediaFiles),
|
|
73
75
|
tooltipDescription: formatMessage(messages.mediaFilesDescription),
|
|
74
|
-
disabled:
|
|
76
|
+
disabled: isOffline
|
|
75
77
|
}));
|
|
76
78
|
}
|
|
77
79
|
if (imageUploadSupported) {
|
|
78
80
|
items.push(imageUpload({
|
|
79
81
|
content: formatMessage(messages.image),
|
|
80
|
-
disabled: !imageUploadEnabled
|
|
82
|
+
disabled: !imageUploadEnabled || isOffline
|
|
81
83
|
}));
|
|
82
84
|
}
|
|
83
85
|
if (mentionsSupported) {
|
|
84
86
|
items.push(mention({
|
|
85
87
|
content: formatMessage(messages.mention),
|
|
86
88
|
tooltipDescription: formatMessage(messages.mentionDescription),
|
|
87
|
-
disabled: !isTypeAheadAllowed || !!mentionsDisabled,
|
|
89
|
+
disabled: !isTypeAheadAllowed || !!mentionsDisabled || isOffline,
|
|
88
90
|
'aria-haspopup': 'listbox'
|
|
89
91
|
}));
|
|
90
92
|
}
|
|
@@ -92,7 +94,7 @@ const createInsertBlockItems = config => {
|
|
|
92
94
|
items.push(emoji({
|
|
93
95
|
content: formatMessage(messages.emoji),
|
|
94
96
|
tooltipDescription: formatMessage(messages.emojiDescription),
|
|
95
|
-
disabled: emojiDisabled || !isTypeAheadAllowed,
|
|
97
|
+
disabled: emojiDisabled || !isTypeAheadAllowed || isOffline,
|
|
96
98
|
'aria-haspopup': 'dialog'
|
|
97
99
|
}));
|
|
98
100
|
}
|
|
@@ -367,10 +367,9 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
367
367
|
var _pluginInjectionApi$l;
|
|
368
368
|
const {
|
|
369
369
|
editorView,
|
|
370
|
-
pluginInjectionApi
|
|
371
|
-
intl
|
|
370
|
+
pluginInjectionApi
|
|
372
371
|
} = this.props;
|
|
373
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$l = pluginInjectionApi.layout) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.actions.insertLayoutColumns(inputMethod
|
|
372
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$l = pluginInjectionApi.layout) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.actions.insertLayoutColumns(inputMethod)(editorView.state, editorView.dispatch);
|
|
374
373
|
return true;
|
|
375
374
|
});
|
|
376
375
|
_defineProperty(this, "createStatus", inputMethod => {
|
|
@@ -577,6 +576,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
577
576
|
tableSelectorSupported: props.tableSelectorSupported,
|
|
578
577
|
mediaUploadsEnabled: props.mediaUploadsEnabled,
|
|
579
578
|
mediaSupported: props.mediaSupported,
|
|
579
|
+
isEditorOffline: props.isEditorOffline,
|
|
580
580
|
imageUploadSupported: props.imageUploadSupported,
|
|
581
581
|
imageUploadEnabled: props.imageUploadEnabled,
|
|
582
582
|
mentionsSupported: props.mentionsSupported,
|
package/dist/esm/plugin.js
CHANGED
|
@@ -302,7 +302,7 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
|
|
|
302
302
|
options = _ref4.options,
|
|
303
303
|
appearance = _ref4.appearance;
|
|
304
304
|
var buttons = toolbarSizeToButtons(toolbarSize, appearance);
|
|
305
|
-
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock']),
|
|
305
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText', 'insertBlock', 'connectivity']),
|
|
306
306
|
dateState = _useSharedPluginState.dateState,
|
|
307
307
|
hyperlinkState = _useSharedPluginState.hyperlinkState,
|
|
308
308
|
imageUploadState = _useSharedPluginState.imageUploadState,
|
|
@@ -312,7 +312,8 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
|
|
|
312
312
|
mediaState = _useSharedPluginState.mediaState,
|
|
313
313
|
typeAheadState = _useSharedPluginState.typeAheadState,
|
|
314
314
|
placeholderTextState = _useSharedPluginState.placeholderTextState,
|
|
315
|
-
insertBlockState = _useSharedPluginState.insertBlockState
|
|
315
|
+
insertBlockState = _useSharedPluginState.insertBlockState,
|
|
316
|
+
connectivityState = _useSharedPluginState.connectivityState;
|
|
316
317
|
var getEmojiProvider = function getEmojiProvider() {
|
|
317
318
|
if (emojiState !== null && emojiState !== void 0 && emojiState.emojiProvider) {
|
|
318
319
|
return Promise.resolve(emojiState === null || emojiState === void 0 ? void 0 : emojiState.emojiProvider);
|
|
@@ -351,6 +352,7 @@ function ToolbarInsertBlockWithInjectionApi(_ref4) {
|
|
|
351
352
|
mediaUploadsEnabled: (_ref5 = mediaState && mediaState.allowsUploads) !== null && _ref5 !== void 0 ? _ref5 : undefined,
|
|
352
353
|
onShowMediaPicker: onShowMediaPicker,
|
|
353
354
|
mediaSupported: !!mediaState,
|
|
355
|
+
isEditorOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline',
|
|
354
356
|
imageUploadSupported: !!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.imageUpload),
|
|
355
357
|
imageUploadEnabled: imageUploadState === null || imageUploadState === void 0 ? void 0 : imageUploadState.enabled,
|
|
356
358
|
handleImageUpload: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.imageUpload) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.actions.startUpload,
|
|
@@ -23,7 +23,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
23
23
|
import { borderRadius } from '@atlaskit/theme';
|
|
24
24
|
import { N0, N30A, N60A } from '@atlaskit/theme/colors';
|
|
25
25
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
26
|
-
var DEFAULT_HEIGHT = 560;
|
|
26
|
+
export var DEFAULT_HEIGHT = 560;
|
|
27
27
|
var InsertMenu = function InsertMenu(_ref) {
|
|
28
28
|
var _pluginInjectionApi$q7, _pluginInjectionApi$q8;
|
|
29
29
|
var editorView = _ref.editorView,
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
3
|
-
import
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import InsertMenu, { DEFAULT_HEIGHT } from '../ElementBrowser/InsertMenu';
|
|
4
5
|
import { DropDownButton } from './dropdown-button';
|
|
6
|
+
// This determines how the popup should fit. We prefer the insert menu
|
|
7
|
+
// opening on the bottom as we have a search bar and should only open on
|
|
8
|
+
// top if there is more than sufficient room.
|
|
9
|
+
var FIT_HEIGHT_BUFFER = 100;
|
|
5
10
|
export var BlockInsertElementBrowser = function BlockInsertElementBrowser(props) {
|
|
6
11
|
return /*#__PURE__*/React.createElement(React.Fragment, null, props.open && /*#__PURE__*/React.createElement(Popup, {
|
|
7
12
|
target: props.plusButtonRef,
|
|
8
|
-
fitHeight: 500,
|
|
13
|
+
fitHeight: fg('platform_editor_consistent_insert_menu') ? DEFAULT_HEIGHT + FIT_HEIGHT_BUFFER : 500,
|
|
9
14
|
fitWidth: 350,
|
|
10
15
|
offset: [0, 3],
|
|
11
16
|
mountTo: props.popupsMountPoint,
|
|
@@ -56,8 +56,10 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
56
56
|
expandEnabled = config.expandEnabled,
|
|
57
57
|
numberOfButtons = config.numberOfButtons,
|
|
58
58
|
schema = config.schema,
|
|
59
|
-
formatMessage = config.formatMessage
|
|
59
|
+
formatMessage = config.formatMessage,
|
|
60
|
+
isEditorOffline = config.isEditorOffline;
|
|
60
61
|
var items = [];
|
|
62
|
+
var isOffline = isEditorOffline === true;
|
|
61
63
|
if (actionSupported) {
|
|
62
64
|
items.push(action({
|
|
63
65
|
content: formatMessage(messages.action),
|
|
@@ -77,20 +79,20 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
77
79
|
items.push(media({
|
|
78
80
|
content: formatMessage(messages.addMediaFiles),
|
|
79
81
|
tooltipDescription: formatMessage(messages.mediaFilesDescription),
|
|
80
|
-
disabled:
|
|
82
|
+
disabled: isOffline
|
|
81
83
|
}));
|
|
82
84
|
}
|
|
83
85
|
if (imageUploadSupported) {
|
|
84
86
|
items.push(imageUpload({
|
|
85
87
|
content: formatMessage(messages.image),
|
|
86
|
-
disabled: !imageUploadEnabled
|
|
88
|
+
disabled: !imageUploadEnabled || isOffline
|
|
87
89
|
}));
|
|
88
90
|
}
|
|
89
91
|
if (mentionsSupported) {
|
|
90
92
|
items.push(mention({
|
|
91
93
|
content: formatMessage(messages.mention),
|
|
92
94
|
tooltipDescription: formatMessage(messages.mentionDescription),
|
|
93
|
-
disabled: !isTypeAheadAllowed || !!mentionsDisabled,
|
|
95
|
+
disabled: !isTypeAheadAllowed || !!mentionsDisabled || isOffline,
|
|
94
96
|
'aria-haspopup': 'listbox'
|
|
95
97
|
}));
|
|
96
98
|
}
|
|
@@ -98,7 +100,7 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
98
100
|
items.push(emoji({
|
|
99
101
|
content: formatMessage(messages.emoji),
|
|
100
102
|
tooltipDescription: formatMessage(messages.emojiDescription),
|
|
101
|
-
disabled: emojiDisabled || !isTypeAheadAllowed,
|
|
103
|
+
disabled: emojiDisabled || !isTypeAheadAllowed || isOffline,
|
|
102
104
|
'aria-haspopup': 'dialog'
|
|
103
105
|
}));
|
|
104
106
|
}
|
|
@@ -348,9 +348,8 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
348
348
|
var _pluginInjectionApi$l;
|
|
349
349
|
var _this$props4 = _this.props,
|
|
350
350
|
editorView = _this$props4.editorView,
|
|
351
|
-
pluginInjectionApi = _this$props4.pluginInjectionApi
|
|
352
|
-
|
|
353
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.layout) === null || _pluginInjectionApi$l === void 0 || _pluginInjectionApi$l.actions.insertLayoutColumns(inputMethod, intl.formatMessage)(editorView.state, editorView.dispatch);
|
|
351
|
+
pluginInjectionApi = _this$props4.pluginInjectionApi;
|
|
352
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.layout) === null || _pluginInjectionApi$l === void 0 || _pluginInjectionApi$l.actions.insertLayoutColumns(inputMethod)(editorView.state, editorView.dispatch);
|
|
354
353
|
return true;
|
|
355
354
|
});
|
|
356
355
|
_defineProperty(_assertThisInitialized(_this), "createStatus", function (inputMethod) {
|
|
@@ -817,6 +816,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
817
816
|
tableSelectorSupported: props.tableSelectorSupported,
|
|
818
817
|
mediaUploadsEnabled: props.mediaUploadsEnabled,
|
|
819
818
|
mediaSupported: props.mediaSupported,
|
|
819
|
+
isEditorOffline: props.isEditorOffline,
|
|
820
820
|
imageUploadSupported: props.imageUploadSupported,
|
|
821
821
|
imageUploadEnabled: props.imageUploadEnabled,
|
|
822
822
|
mentionsSupported: props.mentionsSupported,
|
package/dist/types/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { BlockTypePlugin } from '@atlaskit/editor-plugin-block-type';
|
|
4
4
|
import type { CodeBlockPlugin } from '@atlaskit/editor-plugin-code-block';
|
|
5
|
+
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
5
6
|
import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
6
7
|
import type { DatePlugin } from '@atlaskit/editor-plugin-date';
|
|
7
8
|
import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
|
|
@@ -47,5 +48,6 @@ export type InsertBlockPluginDependencies = [
|
|
|
47
48
|
OptionalPlugin<TasksAndDecisionsPlugin>,
|
|
48
49
|
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
49
50
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
50
|
-
OptionalPlugin<ContextPanelPlugin
|
|
51
|
+
OptionalPlugin<ContextPanelPlugin>,
|
|
52
|
+
OptionalPlugin<ConnectivityPlugin>
|
|
51
53
|
];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import type { InsertMenuProps } from './types';
|
|
3
|
+
export declare const DEFAULT_HEIGHT = 560;
|
|
3
4
|
declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, isFullPageAppearance, }: InsertMenuProps) => jsx.JSX.Element;
|
|
4
5
|
export default InsertMenu;
|
|
@@ -33,6 +33,7 @@ export interface CreateItemsConfig {
|
|
|
33
33
|
numberOfButtons: number;
|
|
34
34
|
formatMessage: WrappedComponentProps['intl']['formatMessage'];
|
|
35
35
|
isNewMenuEnabled?: boolean;
|
|
36
|
+
isEditorOffline?: boolean;
|
|
36
37
|
}
|
|
37
38
|
export interface BlockMenuItem extends MenuItem {
|
|
38
39
|
title: JSX.Element | null;
|
|
@@ -23,6 +23,7 @@ export interface Props {
|
|
|
23
23
|
mentionsSupported?: boolean;
|
|
24
24
|
mediaUploadsEnabled?: boolean;
|
|
25
25
|
mediaSupported?: boolean;
|
|
26
|
+
isEditorOffline?: boolean;
|
|
26
27
|
imageUploadSupported?: boolean;
|
|
27
28
|
imageUploadEnabled?: boolean;
|
|
28
29
|
handleImageUpload?: (event?: ImageUploadPluginReferenceEvent) => Command;
|
|
@@ -2,6 +2,7 @@ import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { BlockTypePlugin } from '@atlaskit/editor-plugin-block-type';
|
|
4
4
|
import type { CodeBlockPlugin } from '@atlaskit/editor-plugin-code-block';
|
|
5
|
+
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
5
6
|
import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
6
7
|
import type { DatePlugin } from '@atlaskit/editor-plugin-date';
|
|
7
8
|
import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
|
|
@@ -47,5 +48,6 @@ export type InsertBlockPluginDependencies = [
|
|
|
47
48
|
OptionalPlugin<TasksAndDecisionsPlugin>,
|
|
48
49
|
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
49
50
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
50
|
-
OptionalPlugin<ContextPanelPlugin
|
|
51
|
+
OptionalPlugin<ContextPanelPlugin>,
|
|
52
|
+
OptionalPlugin<ConnectivityPlugin>
|
|
51
53
|
];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import type { InsertMenuProps } from './types';
|
|
3
|
+
export declare const DEFAULT_HEIGHT = 560;
|
|
3
4
|
declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, isFullPageAppearance, }: InsertMenuProps) => jsx.JSX.Element;
|
|
4
5
|
export default InsertMenu;
|
|
@@ -33,6 +33,7 @@ export interface CreateItemsConfig {
|
|
|
33
33
|
numberOfButtons: number;
|
|
34
34
|
formatMessage: WrappedComponentProps['intl']['formatMessage'];
|
|
35
35
|
isNewMenuEnabled?: boolean;
|
|
36
|
+
isEditorOffline?: boolean;
|
|
36
37
|
}
|
|
37
38
|
export interface BlockMenuItem extends MenuItem {
|
|
38
39
|
title: JSX.Element | null;
|
|
@@ -23,6 +23,7 @@ export interface Props {
|
|
|
23
23
|
mentionsSupported?: boolean;
|
|
24
24
|
mediaUploadsEnabled?: boolean;
|
|
25
25
|
mediaSupported?: boolean;
|
|
26
|
+
isEditorOffline?: boolean;
|
|
26
27
|
imageUploadSupported?: boolean;
|
|
27
28
|
imageUploadEnabled?: boolean;
|
|
28
29
|
handleImageUpload?: (event?: ImageUploadPluginReferenceEvent) => Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-insert-block",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.17",
|
|
4
4
|
"description": "Insert block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,10 +32,11 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/button": "^20.3.0",
|
|
35
|
-
"@atlaskit/editor-common": "^95.
|
|
35
|
+
"@atlaskit/editor-common": "^95.10.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-block-type": "^4.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-code-block": "^3.5.0",
|
|
39
|
+
"@atlaskit/editor-plugin-connectivity": "^1.0.0",
|
|
39
40
|
"@atlaskit/editor-plugin-date": "^2.4.0",
|
|
40
41
|
"@atlaskit/editor-plugin-emoji": "^2.7.0",
|
|
41
42
|
"@atlaskit/editor-plugin-expand": "^2.10.0",
|
|
@@ -53,20 +54,20 @@
|
|
|
53
54
|
"@atlaskit/editor-plugin-quick-insert": "^1.7.0",
|
|
54
55
|
"@atlaskit/editor-plugin-rule": "^1.9.0",
|
|
55
56
|
"@atlaskit/editor-plugin-status": "^2.5.0",
|
|
56
|
-
"@atlaskit/editor-plugin-table": "^8.
|
|
57
|
+
"@atlaskit/editor-plugin-table": "^8.2.0",
|
|
57
58
|
"@atlaskit/editor-plugin-tasks-and-decisions": "^2.12.0",
|
|
58
|
-
"@atlaskit/editor-plugin-type-ahead": "^1.
|
|
59
|
-
"@atlaskit/editor-prosemirror": "6.
|
|
59
|
+
"@atlaskit/editor-plugin-type-ahead": "^1.11.0",
|
|
60
|
+
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
60
61
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
61
62
|
"@atlaskit/emoji": "^67.11.0",
|
|
62
|
-
"@atlaskit/heading": "
|
|
63
|
-
"@atlaskit/icon": "^22.
|
|
63
|
+
"@atlaskit/heading": "4.0.0",
|
|
64
|
+
"@atlaskit/icon": "^22.28.0",
|
|
64
65
|
"@atlaskit/icon-lab": "^1.2.0",
|
|
65
66
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
66
|
-
"@atlaskit/primitives": "^13.
|
|
67
|
+
"@atlaskit/primitives": "^13.3.0",
|
|
67
68
|
"@atlaskit/theme": "^14.0.0",
|
|
68
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
69
|
-
"@atlaskit/tokens": "^2.
|
|
69
|
+
"@atlaskit/tmp-editor-statsig": "^2.21.0",
|
|
70
|
+
"@atlaskit/tokens": "^2.4.0",
|
|
70
71
|
"@atlaskit/tooltip": "18.9.3",
|
|
71
72
|
"@babel/runtime": "^7.0.0",
|
|
72
73
|
"@emotion/react": "^11.7.1",
|
|
@@ -126,6 +127,9 @@
|
|
|
126
127
|
"platform_editor_toolbar_responsive_fixes": {
|
|
127
128
|
"type": "boolean"
|
|
128
129
|
},
|
|
130
|
+
"platform_editor_consistent_insert_menu": {
|
|
131
|
+
"type": "boolean"
|
|
132
|
+
},
|
|
129
133
|
"platform_editor_reduce_element_browser_padding": {
|
|
130
134
|
"type": "boolean"
|
|
131
135
|
}
|