@atlaskit/editor-plugin-insert-block 2.4.7 → 2.4.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 +10 -0
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +38 -8
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +34 -9
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +39 -9
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types-ts4.5/plugin.d.ts +1 -1
- package/package.json +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 2.4.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#162455](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/162455)
|
|
8
|
+
[`37db7ee7998bb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/37db7ee7998bb) -
|
|
9
|
+
[ux] ED-25030: Reduce padding between insert menu items and remove padding from the right hand
|
|
10
|
+
side of the insert menu when a scrollbar is not present
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 2.4.7
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -11,10 +11,12 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
var _react = require("react");
|
|
13
13
|
var _react2 = require("@emotion/react");
|
|
14
|
+
var _CellMeasurer = require("react-virtualized/dist/commonjs/CellMeasurer");
|
|
14
15
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
15
16
|
var _elementBrowser = require("@atlaskit/editor-common/element-browser");
|
|
16
17
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
17
18
|
var _uiReact = require("@atlaskit/editor-common/ui-react");
|
|
19
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
20
|
var _theme = require("@atlaskit/theme");
|
|
19
21
|
var _colors = require("@atlaskit/theme/colors");
|
|
20
22
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
@@ -26,6 +28,7 @@ var _excluded = ["children"];
|
|
|
26
28
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
27
29
|
// AFP-2532 TODO: Fix automatic suppressions below
|
|
28
30
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
31
|
+
var DEFAULT_HEIGHT = 560;
|
|
29
32
|
var InsertMenu = function InsertMenu(_ref) {
|
|
30
33
|
var _pluginInjectionApi$q7, _pluginInjectionApi$q8;
|
|
31
34
|
var editorView = _ref.editorView,
|
|
@@ -39,6 +42,31 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
39
42
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
40
43
|
itemCount = _useState2[0],
|
|
41
44
|
setItemCount = _useState2[1];
|
|
45
|
+
var _useState3 = (0, _react.useState)(DEFAULT_HEIGHT),
|
|
46
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
47
|
+
height = _useState4[0],
|
|
48
|
+
setHeight = _useState4[1];
|
|
49
|
+
|
|
50
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
|
+
var cache = new _CellMeasurer.CellMeasurerCache({
|
|
52
|
+
fixedWidth: true,
|
|
53
|
+
defaultHeight: _elementBrowser.ELEMENT_ITEM_HEIGHT,
|
|
54
|
+
minHeight: _elementBrowser.ELEMENT_ITEM_HEIGHT
|
|
55
|
+
});
|
|
56
|
+
(0, _react.useLayoutEffect)(function () {
|
|
57
|
+
// Figure based on visuals to exclude the searchbar, padding/margin, and the ViewMore item.
|
|
58
|
+
var EXTRA_SPACE_EXCLUDING_ELEMENTLIST = 128;
|
|
59
|
+
var totalItemHeight = (0, _toConsumableArray2.default)(Array(itemCount)).reduce(function (sum, _, index) {
|
|
60
|
+
return sum + cache.rowHeight({
|
|
61
|
+
index: index
|
|
62
|
+
});
|
|
63
|
+
}, 0) + EXTRA_SPACE_EXCLUDING_ELEMENTLIST;
|
|
64
|
+
if (itemCount > 0 && totalItemHeight < DEFAULT_HEIGHT) {
|
|
65
|
+
setHeight(totalItemHeight);
|
|
66
|
+
} else {
|
|
67
|
+
setHeight(DEFAULT_HEIGHT);
|
|
68
|
+
}
|
|
69
|
+
}, [cache, itemCount]);
|
|
42
70
|
var transform = (0, _react.useCallback)(function (item) {
|
|
43
71
|
return {
|
|
44
72
|
title: item.content,
|
|
@@ -131,7 +159,7 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
131
159
|
return (
|
|
132
160
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
133
161
|
(0, _react2.jsx)("div", {
|
|
134
|
-
css: insertMenuWrapper(itemCount, isFullPageAppearance)
|
|
162
|
+
css: insertMenuWrapper(height, itemCount, isFullPageAppearance)
|
|
135
163
|
}, (0, _react2.jsx)(FlexWrapper, null, (0, _react2.jsx)(_elementBrowser.ElementBrowser, {
|
|
136
164
|
mode: "inline",
|
|
137
165
|
getItems: getItems,
|
|
@@ -142,14 +170,15 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
142
170
|
// On page resize we want the InlineElementBrowser to show updated tools/overflow items
|
|
143
171
|
,
|
|
144
172
|
key: quickInsertDropdownItems.length,
|
|
145
|
-
viewMoreItem: viewMoreItem
|
|
173
|
+
viewMoreItem: viewMoreItem,
|
|
174
|
+
cache: (0, _platformFeatureFlags.fg)('platform_editor_reduce_element_browser_padding') ? cache : undefined
|
|
146
175
|
})))
|
|
147
176
|
);
|
|
148
177
|
}
|
|
149
178
|
return (
|
|
150
179
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
151
180
|
(0, _react2.jsx)("div", {
|
|
152
|
-
css: insertMenuWrapper(itemCount, isFullPageAppearance)
|
|
181
|
+
css: insertMenuWrapper(height, itemCount, isFullPageAppearance)
|
|
153
182
|
}, (0, _react2.jsx)(ElementBrowserWrapper, {
|
|
154
183
|
handleClickOutside: toggleVisiblity,
|
|
155
184
|
handleEscapeKeydown: toggleVisiblity,
|
|
@@ -164,7 +193,8 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
164
193
|
// On page resize we want the InlineElementBrowser to show updated tools/overflow items
|
|
165
194
|
,
|
|
166
195
|
key: quickInsertDropdownItems.length,
|
|
167
|
-
viewMoreItem: viewMoreItem
|
|
196
|
+
viewMoreItem: viewMoreItem,
|
|
197
|
+
cache: (0, _platformFeatureFlags.fg)('platform_editor_reduce_element_browser_padding') ? cache : undefined
|
|
168
198
|
})))
|
|
169
199
|
);
|
|
170
200
|
};
|
|
@@ -189,11 +219,11 @@ var getInsertMenuHeight = function getInsertMenuHeight(_ref3) {
|
|
|
189
219
|
// Figure based on visuals to exclude the searchbar, padding/margin, and the ViewMore item.
|
|
190
220
|
var EXTRA_SPACE_EXCLUDING_ELEMENTLIST = 128;
|
|
191
221
|
if (itemCount > 0 && itemCount < 6) {
|
|
192
|
-
return itemCount *
|
|
222
|
+
return itemCount * 75 + EXTRA_SPACE_EXCLUDING_ELEMENTLIST;
|
|
193
223
|
}
|
|
194
224
|
return 560; // For showing 6 Elements.
|
|
195
225
|
};
|
|
196
|
-
var insertMenuWrapper = function insertMenuWrapper(itemCount, isFullPageAppearance) {
|
|
226
|
+
var insertMenuWrapper = function insertMenuWrapper(height, itemCount, isFullPageAppearance) {
|
|
197
227
|
if (isFullPageAppearance && (0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)) {
|
|
198
228
|
return (0, _react2.css)({
|
|
199
229
|
display: 'flex',
|
|
@@ -211,8 +241,8 @@ var insertMenuWrapper = function insertMenuWrapper(itemCount, isFullPageAppearan
|
|
|
211
241
|
display: 'flex',
|
|
212
242
|
flexDirection: 'column',
|
|
213
243
|
width: '320px',
|
|
214
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
215
|
-
height: "".concat(getInsertMenuHeight({
|
|
244
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
245
|
+
height: "".concat((0, _platformFeatureFlags.fg)('platform_editor_reduce_element_browser_padding') ? height : getInsertMenuHeight({
|
|
216
246
|
itemCount: itemCount
|
|
217
247
|
}), "px"),
|
|
218
248
|
backgroundColor: "".concat("var(--ds-surface-overlay, ".concat(_colors.N0, ")")),
|
|
@@ -4,19 +4,22 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { useCallback, useContext, useState } from 'react';
|
|
7
|
+
import { useCallback, useContext, useLayoutEffect, useState } from 'react';
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
|
+
import { CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
|
|
11
12
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
12
13
|
import { ELEMENT_ITEM_HEIGHT, ElementBrowser } from '@atlaskit/editor-common/element-browser';
|
|
13
14
|
import { IconCode, IconDate, IconDecision, IconDivider, IconExpand, IconPanel, IconQuote, IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
14
15
|
import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
16
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
17
|
// AFP-2532 TODO: Fix automatic suppressions below
|
|
16
18
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
17
19
|
import { borderRadius } from '@atlaskit/theme';
|
|
18
20
|
import { N0, N30A, N60A } from '@atlaskit/theme/colors';
|
|
19
21
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
22
|
+
const DEFAULT_HEIGHT = 560;
|
|
20
23
|
const InsertMenu = ({
|
|
21
24
|
editorView,
|
|
22
25
|
dropdownItems,
|
|
@@ -28,6 +31,26 @@ const InsertMenu = ({
|
|
|
28
31
|
}) => {
|
|
29
32
|
var _pluginInjectionApi$q7, _pluginInjectionApi$q8, _pluginInjectionApi$q9;
|
|
30
33
|
const [itemCount, setItemCount] = useState(0);
|
|
34
|
+
const [height, setHeight] = useState(DEFAULT_HEIGHT);
|
|
35
|
+
|
|
36
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
|
+
const cache = new CellMeasurerCache({
|
|
38
|
+
fixedWidth: true,
|
|
39
|
+
defaultHeight: ELEMENT_ITEM_HEIGHT,
|
|
40
|
+
minHeight: ELEMENT_ITEM_HEIGHT
|
|
41
|
+
});
|
|
42
|
+
useLayoutEffect(() => {
|
|
43
|
+
// Figure based on visuals to exclude the searchbar, padding/margin, and the ViewMore item.
|
|
44
|
+
const EXTRA_SPACE_EXCLUDING_ELEMENTLIST = 128;
|
|
45
|
+
const totalItemHeight = [...Array(itemCount)].reduce((sum, _, index) => sum + cache.rowHeight({
|
|
46
|
+
index
|
|
47
|
+
}), 0) + EXTRA_SPACE_EXCLUDING_ELEMENTLIST;
|
|
48
|
+
if (itemCount > 0 && totalItemHeight < DEFAULT_HEIGHT) {
|
|
49
|
+
setHeight(totalItemHeight);
|
|
50
|
+
} else {
|
|
51
|
+
setHeight(DEFAULT_HEIGHT);
|
|
52
|
+
}
|
|
53
|
+
}, [cache, itemCount]);
|
|
31
54
|
const transform = useCallback(item => ({
|
|
32
55
|
title: item.content,
|
|
33
56
|
description: item.tooltipDescription,
|
|
@@ -114,7 +137,7 @@ const InsertMenu = ({
|
|
|
114
137
|
return (
|
|
115
138
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
116
139
|
jsx("div", {
|
|
117
|
-
css: insertMenuWrapper(itemCount, isFullPageAppearance)
|
|
140
|
+
css: insertMenuWrapper(height, itemCount, isFullPageAppearance)
|
|
118
141
|
}, jsx(FlexWrapper, null, jsx(ElementBrowser, {
|
|
119
142
|
mode: "inline",
|
|
120
143
|
getItems: getItems,
|
|
@@ -125,14 +148,15 @@ const InsertMenu = ({
|
|
|
125
148
|
// On page resize we want the InlineElementBrowser to show updated tools/overflow items
|
|
126
149
|
,
|
|
127
150
|
key: quickInsertDropdownItems.length,
|
|
128
|
-
viewMoreItem: viewMoreItem
|
|
151
|
+
viewMoreItem: viewMoreItem,
|
|
152
|
+
cache: fg('platform_editor_reduce_element_browser_padding') ? cache : undefined
|
|
129
153
|
})))
|
|
130
154
|
);
|
|
131
155
|
}
|
|
132
156
|
return (
|
|
133
157
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
134
158
|
jsx("div", {
|
|
135
|
-
css: insertMenuWrapper(itemCount, isFullPageAppearance)
|
|
159
|
+
css: insertMenuWrapper(height, itemCount, isFullPageAppearance)
|
|
136
160
|
}, jsx(ElementBrowserWrapper, {
|
|
137
161
|
handleClickOutside: toggleVisiblity,
|
|
138
162
|
handleEscapeKeydown: toggleVisiblity,
|
|
@@ -147,7 +171,8 @@ const InsertMenu = ({
|
|
|
147
171
|
// On page resize we want the InlineElementBrowser to show updated tools/overflow items
|
|
148
172
|
,
|
|
149
173
|
key: quickInsertDropdownItems.length,
|
|
150
|
-
viewMoreItem: viewMoreItem
|
|
174
|
+
viewMoreItem: viewMoreItem,
|
|
175
|
+
cache: fg('platform_editor_reduce_element_browser_padding') ? cache : undefined
|
|
151
176
|
})))
|
|
152
177
|
);
|
|
153
178
|
};
|
|
@@ -174,11 +199,11 @@ const getInsertMenuHeight = ({
|
|
|
174
199
|
// Figure based on visuals to exclude the searchbar, padding/margin, and the ViewMore item.
|
|
175
200
|
const EXTRA_SPACE_EXCLUDING_ELEMENTLIST = 128;
|
|
176
201
|
if (itemCount > 0 && itemCount < 6) {
|
|
177
|
-
return itemCount *
|
|
202
|
+
return itemCount * 75 + EXTRA_SPACE_EXCLUDING_ELEMENTLIST;
|
|
178
203
|
}
|
|
179
204
|
return 560; // For showing 6 Elements.
|
|
180
205
|
};
|
|
181
|
-
const insertMenuWrapper = (itemCount, isFullPageAppearance) => {
|
|
206
|
+
const insertMenuWrapper = (height, itemCount, isFullPageAppearance) => {
|
|
182
207
|
if (isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true)) {
|
|
183
208
|
return css({
|
|
184
209
|
display: 'flex',
|
|
@@ -196,8 +221,8 @@ const insertMenuWrapper = (itemCount, isFullPageAppearance) => {
|
|
|
196
221
|
display: 'flex',
|
|
197
222
|
flexDirection: 'column',
|
|
198
223
|
width: '320px',
|
|
199
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
200
|
-
height: `${getInsertMenuHeight({
|
|
224
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
225
|
+
height: `${fg('platform_editor_reduce_element_browser_padding') ? height : getInsertMenuHeight({
|
|
201
226
|
itemCount
|
|
202
227
|
})}px`,
|
|
203
228
|
backgroundColor: `${`var(--ds-surface-overlay, ${N0})`}`,
|
|
@@ -8,19 +8,22 @@ var _excluded = ["children"];
|
|
|
8
8
|
* @jsx jsx
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { useCallback, useContext, useState } from 'react';
|
|
11
|
+
import { useCallback, useContext, useLayoutEffect, useState } from 'react';
|
|
12
12
|
|
|
13
13
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
14
14
|
import { css, jsx } from '@emotion/react';
|
|
15
|
+
import { CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
|
|
15
16
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
16
17
|
import { ELEMENT_ITEM_HEIGHT, ElementBrowser } from '@atlaskit/editor-common/element-browser';
|
|
17
18
|
import { IconCode, IconDate, IconDecision, IconDivider, IconExpand, IconPanel, IconQuote, IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
18
19
|
import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
20
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
19
21
|
// AFP-2532 TODO: Fix automatic suppressions below
|
|
20
22
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
21
23
|
import { borderRadius } from '@atlaskit/theme';
|
|
22
24
|
import { N0, N30A, N60A } from '@atlaskit/theme/colors';
|
|
23
25
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
26
|
+
var DEFAULT_HEIGHT = 560;
|
|
24
27
|
var InsertMenu = function InsertMenu(_ref) {
|
|
25
28
|
var _pluginInjectionApi$q7, _pluginInjectionApi$q8;
|
|
26
29
|
var editorView = _ref.editorView,
|
|
@@ -34,6 +37,31 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
34
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
35
38
|
itemCount = _useState2[0],
|
|
36
39
|
setItemCount = _useState2[1];
|
|
40
|
+
var _useState3 = useState(DEFAULT_HEIGHT),
|
|
41
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
42
|
+
height = _useState4[0],
|
|
43
|
+
setHeight = _useState4[1];
|
|
44
|
+
|
|
45
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
+
var cache = new CellMeasurerCache({
|
|
47
|
+
fixedWidth: true,
|
|
48
|
+
defaultHeight: ELEMENT_ITEM_HEIGHT,
|
|
49
|
+
minHeight: ELEMENT_ITEM_HEIGHT
|
|
50
|
+
});
|
|
51
|
+
useLayoutEffect(function () {
|
|
52
|
+
// Figure based on visuals to exclude the searchbar, padding/margin, and the ViewMore item.
|
|
53
|
+
var EXTRA_SPACE_EXCLUDING_ELEMENTLIST = 128;
|
|
54
|
+
var totalItemHeight = _toConsumableArray(Array(itemCount)).reduce(function (sum, _, index) {
|
|
55
|
+
return sum + cache.rowHeight({
|
|
56
|
+
index: index
|
|
57
|
+
});
|
|
58
|
+
}, 0) + EXTRA_SPACE_EXCLUDING_ELEMENTLIST;
|
|
59
|
+
if (itemCount > 0 && totalItemHeight < DEFAULT_HEIGHT) {
|
|
60
|
+
setHeight(totalItemHeight);
|
|
61
|
+
} else {
|
|
62
|
+
setHeight(DEFAULT_HEIGHT);
|
|
63
|
+
}
|
|
64
|
+
}, [cache, itemCount]);
|
|
37
65
|
var transform = useCallback(function (item) {
|
|
38
66
|
return {
|
|
39
67
|
title: item.content,
|
|
@@ -126,7 +154,7 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
126
154
|
return (
|
|
127
155
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
128
156
|
jsx("div", {
|
|
129
|
-
css: insertMenuWrapper(itemCount, isFullPageAppearance)
|
|
157
|
+
css: insertMenuWrapper(height, itemCount, isFullPageAppearance)
|
|
130
158
|
}, jsx(FlexWrapper, null, jsx(ElementBrowser, {
|
|
131
159
|
mode: "inline",
|
|
132
160
|
getItems: getItems,
|
|
@@ -137,14 +165,15 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
137
165
|
// On page resize we want the InlineElementBrowser to show updated tools/overflow items
|
|
138
166
|
,
|
|
139
167
|
key: quickInsertDropdownItems.length,
|
|
140
|
-
viewMoreItem: viewMoreItem
|
|
168
|
+
viewMoreItem: viewMoreItem,
|
|
169
|
+
cache: fg('platform_editor_reduce_element_browser_padding') ? cache : undefined
|
|
141
170
|
})))
|
|
142
171
|
);
|
|
143
172
|
}
|
|
144
173
|
return (
|
|
145
174
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
146
175
|
jsx("div", {
|
|
147
|
-
css: insertMenuWrapper(itemCount, isFullPageAppearance)
|
|
176
|
+
css: insertMenuWrapper(height, itemCount, isFullPageAppearance)
|
|
148
177
|
}, jsx(ElementBrowserWrapper, {
|
|
149
178
|
handleClickOutside: toggleVisiblity,
|
|
150
179
|
handleEscapeKeydown: toggleVisiblity,
|
|
@@ -159,7 +188,8 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
159
188
|
// On page resize we want the InlineElementBrowser to show updated tools/overflow items
|
|
160
189
|
,
|
|
161
190
|
key: quickInsertDropdownItems.length,
|
|
162
|
-
viewMoreItem: viewMoreItem
|
|
191
|
+
viewMoreItem: viewMoreItem,
|
|
192
|
+
cache: fg('platform_editor_reduce_element_browser_padding') ? cache : undefined
|
|
163
193
|
})))
|
|
164
194
|
);
|
|
165
195
|
};
|
|
@@ -184,11 +214,11 @@ var getInsertMenuHeight = function getInsertMenuHeight(_ref3) {
|
|
|
184
214
|
// Figure based on visuals to exclude the searchbar, padding/margin, and the ViewMore item.
|
|
185
215
|
var EXTRA_SPACE_EXCLUDING_ELEMENTLIST = 128;
|
|
186
216
|
if (itemCount > 0 && itemCount < 6) {
|
|
187
|
-
return itemCount *
|
|
217
|
+
return itemCount * 75 + EXTRA_SPACE_EXCLUDING_ELEMENTLIST;
|
|
188
218
|
}
|
|
189
219
|
return 560; // For showing 6 Elements.
|
|
190
220
|
};
|
|
191
|
-
var insertMenuWrapper = function insertMenuWrapper(itemCount, isFullPageAppearance) {
|
|
221
|
+
var insertMenuWrapper = function insertMenuWrapper(height, itemCount, isFullPageAppearance) {
|
|
192
222
|
if (isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true)) {
|
|
193
223
|
return css({
|
|
194
224
|
display: 'flex',
|
|
@@ -206,8 +236,8 @@ var insertMenuWrapper = function insertMenuWrapper(itemCount, isFullPageAppearan
|
|
|
206
236
|
display: 'flex',
|
|
207
237
|
flexDirection: 'column',
|
|
208
238
|
width: '320px',
|
|
209
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
210
|
-
height: "".concat(getInsertMenuHeight({
|
|
239
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
240
|
+
height: "".concat(fg('platform_editor_reduce_element_browser_padding') ? height : getInsertMenuHeight({
|
|
211
241
|
itemCount: itemCount
|
|
212
242
|
}), "px"),
|
|
213
243
|
backgroundColor: "".concat("var(--ds-surface-overlay, ".concat(N0, ")")),
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { EditorAppearance, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { InsertBlockPluginDependencies } from './types';
|
|
4
|
-
export declare const toolbarSizeToButtons: (toolbarSize: ToolbarSize, appearance?: EditorAppearance) =>
|
|
4
|
+
export declare const toolbarSizeToButtons: (toolbarSize: ToolbarSize, appearance?: EditorAppearance) => 0 | 2 | 3 | 5 | 7;
|
|
5
5
|
export interface InsertBlockOptions {
|
|
6
6
|
allowTables?: boolean;
|
|
7
7
|
allowExpand?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { EditorAppearance, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { InsertBlockPluginDependencies } from './types';
|
|
4
|
-
export declare const toolbarSizeToButtons: (toolbarSize: ToolbarSize, appearance?: EditorAppearance) =>
|
|
4
|
+
export declare const toolbarSizeToButtons: (toolbarSize: ToolbarSize, appearance?: EditorAppearance) => 0 | 2 | 3 | 5 | 7;
|
|
5
5
|
export interface InsertBlockOptions {
|
|
6
6
|
allowTables?: boolean;
|
|
7
7
|
allowExpand?: boolean;
|
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.8",
|
|
4
4
|
"description": "Insert block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/button": "^20.3.0",
|
|
35
|
-
"@atlaskit/editor-common": "^94.
|
|
35
|
+
"@atlaskit/editor-common": "^94.16.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",
|
|
@@ -72,7 +72,8 @@
|
|
|
72
72
|
"@emotion/react": "^11.7.1",
|
|
73
73
|
"bind-event-listener": "^3.0.0",
|
|
74
74
|
"lodash": "^4.17.21",
|
|
75
|
-
"memoize-one": "^6.0.0"
|
|
75
|
+
"memoize-one": "^6.0.0",
|
|
76
|
+
"react-virtualized": "^9.8.0"
|
|
76
77
|
},
|
|
77
78
|
"peerDependencies": {
|
|
78
79
|
"react": "^16.8.0 || ^17.0.0 || ~18.2.0",
|
|
@@ -85,6 +86,7 @@
|
|
|
85
86
|
"@atlaskit/ssr": "*",
|
|
86
87
|
"@atlaskit/visual-regression": "*",
|
|
87
88
|
"@testing-library/react": "^12.1.5",
|
|
89
|
+
"@types/react-virtualized": "^9.18.12",
|
|
88
90
|
"typescript": "~5.4.2"
|
|
89
91
|
},
|
|
90
92
|
"techstack": {
|
|
@@ -123,6 +125,9 @@
|
|
|
123
125
|
"platform-feature-flags": {
|
|
124
126
|
"platform_editor_toolbar_responsive_fixes": {
|
|
125
127
|
"type": "boolean"
|
|
128
|
+
},
|
|
129
|
+
"platform_editor_reduce_element_browser_padding": {
|
|
130
|
+
"type": "boolean"
|
|
126
131
|
}
|
|
127
132
|
}
|
|
128
133
|
}
|