@atlaskit/editor-plugin-insert-block 26.0.1 → 26.0.3
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
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 26.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 26.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`685643d223f9d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/685643d223f9d) -
|
|
14
|
+
Complete cleanup of the `cc_fd_db_top_editor_toolbar` experiment. Always sort featured toolbar
|
|
15
|
+
insert items by provider priority across platforms, matching quick insert ordering. Remove
|
|
16
|
+
hardcoded whiteboard pinning and preserve provider descriptions, retaining the shipped
|
|
17
|
+
`new-description` behavior without product checks, preset options, or experiment setup.
|
|
18
|
+
|
|
19
|
+
Breaking change in `@atlaskit/tmp-editor-statsig`: remove `cc_fd_db_top_editor_toolbar` from
|
|
20
|
+
`editorExperimentsConfig` and `testMultivariateOverrides`. Consumers referencing
|
|
21
|
+
`editorExperimentsConfig.cc_fd_db_top_editor_toolbar` or calling
|
|
22
|
+
`expVal('cc_fd_db_top_editor_toolbar', ...)` (or other typed experiment helpers) will receive
|
|
23
|
+
TypeScript errors after upgrading. To migrate, remove those experiment queries and test overrides,
|
|
24
|
+
and retain the shipped `new-description` behavior instead of branching on the removed experiment.
|
|
25
|
+
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
|
|
3
28
|
## 26.0.1
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -7,12 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.sortFeaturedItems = 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
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
13
|
var _react = require("react");
|
|
14
14
|
var _react2 = require("@emotion/react");
|
|
15
|
-
var _reactIntl = require("react-intl");
|
|
16
15
|
var _CellMeasurer = require("react-virtualized/dist/commonjs/CellMeasurer");
|
|
17
16
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
18
17
|
var _elementBrowser = require("@atlaskit/editor-common/element-browser");
|
|
@@ -20,7 +19,6 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
20
19
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
21
20
|
var _uiReact = require("@atlaskit/editor-common/ui-react");
|
|
22
21
|
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
23
|
-
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
24
22
|
var _excluded = ["children"];
|
|
25
23
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
26
24
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
@@ -30,45 +28,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
30
28
|
var DEFAULT_HEIGHT = exports.DEFAULT_HEIGHT = 560;
|
|
31
29
|
|
|
32
30
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* The `cc_fd_db_top_editor_toolbar` experiment adds new logic to sort elements by `priority`.
|
|
36
|
-
* This newer implementation matches how the quick insert menu sorts elements.
|
|
31
|
+
* Sort featured elements by priority, matching the quick insert menu.
|
|
37
32
|
*/
|
|
38
|
-
var sortFeaturedItems = exports.sortFeaturedItems = function sortFeaturedItems(featuredItems
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return (a.priority || Number.POSITIVE_INFINITY) - (b.priority || Number.POSITIVE_INFINITY);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// NOTE: this is *not* the ideal way to approach this. Old logic sort whiteboards to top
|
|
48
|
-
var DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
|
|
49
|
-
var isDiagram = function isDiagram(item) {
|
|
50
|
-
return item.key === DIAGRAM_KEY;
|
|
51
|
-
};
|
|
52
|
-
var featuredWhiteboardsPresent = featuredItems.some(isDiagram);
|
|
53
|
-
if (featuredWhiteboardsPresent) {
|
|
54
|
-
var pin = function pin(key) {
|
|
55
|
-
var idx = featuredItems.findIndex(function (item) {
|
|
56
|
-
return item.key === key;
|
|
57
|
-
});
|
|
58
|
-
var filtered = featuredItems.filter(function (item) {
|
|
59
|
-
return !isDiagram(item);
|
|
60
|
-
});
|
|
61
|
-
if (idx === -1) {
|
|
62
|
-
return filtered;
|
|
63
|
-
}
|
|
64
|
-
var picked = _objectSpread(_objectSpread({}, featuredItems[idx]), {}, {
|
|
65
|
-
description: formatMessage(_quickInsert.messages.featuredWhiteboardDescription)
|
|
66
|
-
});
|
|
67
|
-
return [picked].concat((0, _toConsumableArray2.default)(filtered));
|
|
68
|
-
};
|
|
69
|
-
return pin(DIAGRAM_KEY);
|
|
70
|
-
}
|
|
71
|
-
return featuredItems;
|
|
33
|
+
var sortFeaturedItems = exports.sortFeaturedItems = function sortFeaturedItems(featuredItems) {
|
|
34
|
+
return featuredItems.slice(0).sort(function (a, b) {
|
|
35
|
+
var _a$priority, _b$priority;
|
|
36
|
+
return ((_a$priority = a.priority) !== null && _a$priority !== void 0 ? _a$priority : Number.POSITIVE_INFINITY) - ((_b$priority = b.priority) !== null && _b$priority !== void 0 ? _b$priority : Number.POSITIVE_INFINITY);
|
|
37
|
+
});
|
|
72
38
|
};
|
|
73
39
|
var selector = function selector(states) {
|
|
74
40
|
var _states$connectivityS;
|
|
@@ -92,8 +58,6 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
92
58
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
93
59
|
height = _useState4[0],
|
|
94
60
|
setHeight = _useState4[1];
|
|
95
|
-
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
96
|
-
formatMessage = _useIntl.formatMessage;
|
|
97
61
|
var cache = (0, _react.useMemo)(function () {
|
|
98
62
|
return new _CellMeasurer.CellMeasurerCache({
|
|
99
63
|
fixedWidth: true,
|
|
@@ -182,11 +146,11 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
182
146
|
})) !== null && _pluginInjectionApi$q4 !== void 0 ? _pluginInjectionApi$q4 : [];
|
|
183
147
|
var unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
|
|
184
148
|
// need to sort on the concatenated list so desired elements are at the top
|
|
185
|
-
result = sortFeaturedItems(unfilteredResult
|
|
149
|
+
result = sortFeaturedItems(unfilteredResult);
|
|
186
150
|
}
|
|
187
151
|
setItemCount(result.length);
|
|
188
152
|
return result;
|
|
189
|
-
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q6 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q6 === void 0 ? void 0 : _pluginInjectionApi$q6.actions, quickInsertDropdownItems, connectivityMode
|
|
153
|
+
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q6 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q6 === void 0 ? void 0 : _pluginInjectionApi$q6.actions, quickInsertDropdownItems, connectivityMode]);
|
|
190
154
|
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;
|
|
191
155
|
var onViewMore = (0, _react.useCallback)(function () {
|
|
192
156
|
var _pluginInjectionApi$c, _pluginInjectionApi$q8;
|
|
@@ -8,50 +8,23 @@ import { useCallback, useContext, useLayoutEffect, useMemo, useState } from 'rea
|
|
|
8
8
|
|
|
9
9
|
/* eslint-disable @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports, jsdoc/require-description -- Ignored via go/DSP-18766; jsdoc debt surfaced by this mechanical PR */
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
|
-
import { useIntl } from 'react-intl';
|
|
12
11
|
import { CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
|
|
13
12
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
14
13
|
import { ELEMENT_ITEM_HEIGHT, ElementBrowser } from '@atlaskit/editor-common/element-browser';
|
|
15
14
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
16
|
-
import {
|
|
15
|
+
import { IconCode, IconDate, IconDecision, IconDivider, IconExpand, IconPanel, IconQuote, IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
17
16
|
import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
18
17
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
19
|
-
import { expVal, expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
20
18
|
export const DEFAULT_HEIGHT = 560;
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* The `cc_fd_db_top_editor_toolbar` experiment adds new logic to sort elements by `priority`.
|
|
26
|
-
* This newer implementation matches how the quick insert menu sorts elements.
|
|
21
|
+
* Sort featured elements by priority, matching the quick insert menu.
|
|
27
22
|
*/
|
|
28
|
-
export const sortFeaturedItems =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// NOTE: this is *not* the ideal way to approach this. Old logic sort whiteboards to top
|
|
36
|
-
const DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
|
|
37
|
-
const isDiagram = item => item.key === DIAGRAM_KEY;
|
|
38
|
-
const featuredWhiteboardsPresent = featuredItems.some(isDiagram);
|
|
39
|
-
if (featuredWhiteboardsPresent) {
|
|
40
|
-
const pin = key => {
|
|
41
|
-
const idx = featuredItems.findIndex(item => item.key === key);
|
|
42
|
-
const filtered = featuredItems.filter(item => !isDiagram(item));
|
|
43
|
-
if (idx === -1) {
|
|
44
|
-
return filtered;
|
|
45
|
-
}
|
|
46
|
-
const picked = {
|
|
47
|
-
...featuredItems[idx],
|
|
48
|
-
description: formatMessage(messages.featuredWhiteboardDescription)
|
|
49
|
-
};
|
|
50
|
-
return [picked, ...filtered];
|
|
51
|
-
};
|
|
52
|
-
return pin(DIAGRAM_KEY);
|
|
53
|
-
}
|
|
54
|
-
return featuredItems;
|
|
23
|
+
export const sortFeaturedItems = featuredItems => {
|
|
24
|
+
return featuredItems.slice(0).sort((a, b) => {
|
|
25
|
+
var _a$priority, _b$priority;
|
|
26
|
+
return ((_a$priority = a.priority) !== null && _a$priority !== void 0 ? _a$priority : Number.POSITIVE_INFINITY) - ((_b$priority = b.priority) !== null && _b$priority !== void 0 ? _b$priority : Number.POSITIVE_INFINITY);
|
|
27
|
+
});
|
|
55
28
|
};
|
|
56
29
|
const selector = states => {
|
|
57
30
|
var _states$connectivityS;
|
|
@@ -70,9 +43,6 @@ const InsertMenu = ({
|
|
|
70
43
|
var _pluginInjectionApi$q8, _pluginInjectionApi$q9, _pluginInjectionApi$q0;
|
|
71
44
|
const [itemCount, setItemCount] = useState(0);
|
|
72
45
|
const [height, setHeight] = useState(DEFAULT_HEIGHT);
|
|
73
|
-
const {
|
|
74
|
-
formatMessage
|
|
75
|
-
} = useIntl();
|
|
76
46
|
const cache = useMemo(() => {
|
|
77
47
|
return new CellMeasurerCache({
|
|
78
48
|
fixedWidth: true,
|
|
@@ -152,11 +122,11 @@ const InsertMenu = ({
|
|
|
152
122
|
} : item)) !== null && _pluginInjectionApi$q5 !== void 0 ? _pluginInjectionApi$q5 : [];
|
|
153
123
|
const unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
|
|
154
124
|
// need to sort on the concatenated list so desired elements are at the top
|
|
155
|
-
result = sortFeaturedItems(unfilteredResult
|
|
125
|
+
result = sortFeaturedItems(unfilteredResult);
|
|
156
126
|
}
|
|
157
127
|
setItemCount(result.length);
|
|
158
128
|
return result;
|
|
159
|
-
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q8 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q8 === void 0 ? void 0 : _pluginInjectionApi$q8.actions, quickInsertDropdownItems, connectivityMode
|
|
129
|
+
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q8 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q8 === void 0 ? void 0 : _pluginInjectionApi$q8.actions, quickInsertDropdownItems, connectivityMode]);
|
|
160
130
|
const emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q9 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q9 === void 0 ? void 0 : (_pluginInjectionApi$q0 = _pluginInjectionApi$q9.sharedState.currentState()) === null || _pluginInjectionApi$q0 === void 0 ? void 0 : _pluginInjectionApi$q0.emptyStateHandler;
|
|
161
131
|
const onViewMore = useCallback(() => {
|
|
162
132
|
var _pluginInjectionApi$c, _pluginInjectionApi$q1;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
5
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
5
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
6
6
|
var _excluded = ["children"];
|
|
7
7
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
8
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -15,57 +15,23 @@ import { useCallback, useContext, useLayoutEffect, useMemo, useState } from 'rea
|
|
|
15
15
|
|
|
16
16
|
/* eslint-disable @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports, jsdoc/require-description -- Ignored via go/DSP-18766; jsdoc debt surfaced by this mechanical PR */
|
|
17
17
|
import { css, jsx } from '@emotion/react';
|
|
18
|
-
import { useIntl } from 'react-intl';
|
|
19
18
|
import { CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
|
|
20
19
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
21
20
|
import { ELEMENT_ITEM_HEIGHT, ElementBrowser } from '@atlaskit/editor-common/element-browser';
|
|
22
21
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
23
|
-
import {
|
|
22
|
+
import { IconCode, IconDate, IconDecision, IconDivider, IconExpand, IconPanel, IconQuote, IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
24
23
|
import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
25
24
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
26
|
-
import { expVal, expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
27
25
|
export var DEFAULT_HEIGHT = 560;
|
|
28
26
|
|
|
29
27
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* The `cc_fd_db_top_editor_toolbar` experiment adds new logic to sort elements by `priority`.
|
|
33
|
-
* This newer implementation matches how the quick insert menu sorts elements.
|
|
28
|
+
* Sort featured elements by priority, matching the quick insert menu.
|
|
34
29
|
*/
|
|
35
|
-
export var sortFeaturedItems = function sortFeaturedItems(featuredItems
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return (a.priority || Number.POSITIVE_INFINITY) - (b.priority || Number.POSITIVE_INFINITY);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// NOTE: this is *not* the ideal way to approach this. Old logic sort whiteboards to top
|
|
45
|
-
var DIAGRAM_KEY = 'whiteboard-extension:create-diagram';
|
|
46
|
-
var isDiagram = function isDiagram(item) {
|
|
47
|
-
return item.key === DIAGRAM_KEY;
|
|
48
|
-
};
|
|
49
|
-
var featuredWhiteboardsPresent = featuredItems.some(isDiagram);
|
|
50
|
-
if (featuredWhiteboardsPresent) {
|
|
51
|
-
var pin = function pin(key) {
|
|
52
|
-
var idx = featuredItems.findIndex(function (item) {
|
|
53
|
-
return item.key === key;
|
|
54
|
-
});
|
|
55
|
-
var filtered = featuredItems.filter(function (item) {
|
|
56
|
-
return !isDiagram(item);
|
|
57
|
-
});
|
|
58
|
-
if (idx === -1) {
|
|
59
|
-
return filtered;
|
|
60
|
-
}
|
|
61
|
-
var picked = _objectSpread(_objectSpread({}, featuredItems[idx]), {}, {
|
|
62
|
-
description: formatMessage(messages.featuredWhiteboardDescription)
|
|
63
|
-
});
|
|
64
|
-
return [picked].concat(_toConsumableArray(filtered));
|
|
65
|
-
};
|
|
66
|
-
return pin(DIAGRAM_KEY);
|
|
67
|
-
}
|
|
68
|
-
return featuredItems;
|
|
30
|
+
export var sortFeaturedItems = function sortFeaturedItems(featuredItems) {
|
|
31
|
+
return featuredItems.slice(0).sort(function (a, b) {
|
|
32
|
+
var _a$priority, _b$priority;
|
|
33
|
+
return ((_a$priority = a.priority) !== null && _a$priority !== void 0 ? _a$priority : Number.POSITIVE_INFINITY) - ((_b$priority = b.priority) !== null && _b$priority !== void 0 ? _b$priority : Number.POSITIVE_INFINITY);
|
|
34
|
+
});
|
|
69
35
|
};
|
|
70
36
|
var selector = function selector(states) {
|
|
71
37
|
var _states$connectivityS;
|
|
@@ -89,8 +55,6 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
89
55
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
90
56
|
height = _useState4[0],
|
|
91
57
|
setHeight = _useState4[1];
|
|
92
|
-
var _useIntl = useIntl(),
|
|
93
|
-
formatMessage = _useIntl.formatMessage;
|
|
94
58
|
var cache = useMemo(function () {
|
|
95
59
|
return new CellMeasurerCache({
|
|
96
60
|
fixedWidth: true,
|
|
@@ -179,11 +143,11 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
179
143
|
})) !== null && _pluginInjectionApi$q4 !== void 0 ? _pluginInjectionApi$q4 : [];
|
|
180
144
|
var unfilteredResult = quickInsertDropdownItems.concat(featuredQuickInsertSuggestions);
|
|
181
145
|
// need to sort on the concatenated list so desired elements are at the top
|
|
182
|
-
result = sortFeaturedItems(unfilteredResult
|
|
146
|
+
result = sortFeaturedItems(unfilteredResult);
|
|
183
147
|
}
|
|
184
148
|
setItemCount(result.length);
|
|
185
149
|
return result;
|
|
186
|
-
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q6 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q6 === void 0 ? void 0 : _pluginInjectionApi$q6.actions, quickInsertDropdownItems, connectivityMode
|
|
150
|
+
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q6 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q6 === void 0 ? void 0 : _pluginInjectionApi$q6.actions, quickInsertDropdownItems, connectivityMode]);
|
|
187
151
|
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;
|
|
188
152
|
var onViewMore = useCallback(function () {
|
|
189
153
|
var _pluginInjectionApi$c, _pluginInjectionApi$q8;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import type { MessageDescriptor } from 'react-intl';
|
|
3
2
|
import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
4
3
|
import type { InsertMenuProps } from './types';
|
|
5
4
|
export declare const DEFAULT_HEIGHT = 560;
|
|
6
5
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* The `cc_fd_db_top_editor_toolbar` experiment adds new logic to sort elements by `priority`.
|
|
10
|
-
* This newer implementation matches how the quick insert menu sorts elements.
|
|
6
|
+
* Sort featured elements by priority, matching the quick insert menu.
|
|
11
7
|
*/
|
|
12
|
-
export declare const sortFeaturedItems: (featuredItems: QuickInsertItem[]
|
|
8
|
+
export declare const sortFeaturedItems: (featuredItems: QuickInsertItem[]) => QuickInsertItem[];
|
|
13
9
|
declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, }: InsertMenuProps) => jsx.JSX.Element;
|
|
14
10
|
export default InsertMenu;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-insert-block",
|
|
3
|
-
"version": "26.0.
|
|
3
|
+
"version": "26.0.3",
|
|
4
4
|
"description": "Insert block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
63
63
|
"@atlaskit/primitives": "^22.5.0",
|
|
64
64
|
"@atlaskit/textfield": "^10.2.0",
|
|
65
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
65
|
+
"@atlaskit/tmp-editor-statsig": "^227.0.0",
|
|
66
66
|
"@atlaskit/tokens": "^20.3.0",
|
|
67
67
|
"@babel/runtime": "^7.0.0",
|
|
68
68
|
"@emotion/react": "^11.7.1",
|