@atlaskit/editor-plugin-floating-toolbar 3.3.3 → 3.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/floatingToolbarPlugin.js +29 -0
- package/dist/cjs/ui/Toolbar.js +1 -5
- package/dist/cjs/ui/utils/index.js +42 -0
- package/dist/es2019/floatingToolbarPlugin.js +24 -0
- package/dist/es2019/ui/Toolbar.js +1 -5
- package/dist/es2019/ui/utils/index.js +28 -0
- package/dist/esm/floatingToolbarPlugin.js +29 -0
- package/dist/esm/ui/Toolbar.js +1 -5
- package/dist/esm/ui/utils/index.js +35 -0
- package/dist/types/ui/utils/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/utils/index.d.ts +2 -0
- package/package.json +13 -10
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,7 @@ exports.floatingToolbarPlugin = void 0;
|
|
|
10
10
|
exports.floatingToolbarPluginFactory = floatingToolbarPluginFactory;
|
|
11
11
|
exports.pluginKey = exports.getRelevantConfig = void 0;
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
14
|
var _react = _interopRequireDefault(require("react"));
|
|
14
15
|
var _camelCase = _interopRequireDefault(require("lodash/camelCase"));
|
|
15
16
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
@@ -20,6 +21,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
20
21
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
21
22
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
22
23
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
24
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
23
25
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
24
26
|
var _commands = require("./pm-plugins/commands");
|
|
25
27
|
var _forceFocus = _interopRequireWildcard(require("./pm-plugins/force-focus"));
|
|
@@ -30,6 +32,7 @@ var _utils2 = require("./pm-plugins/utils");
|
|
|
30
32
|
var _ConfirmationModal = require("./ui/ConfirmationModal");
|
|
31
33
|
var _ExpandButton = require("./ui/ExpandButton");
|
|
32
34
|
var _ToolbarLoader = require("./ui/ToolbarLoader");
|
|
35
|
+
var _utils3 = require("./ui/utils");
|
|
33
36
|
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); }
|
|
34
37
|
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; }
|
|
35
38
|
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; }
|
|
@@ -275,6 +278,32 @@ function ContentComponent(_ref5) {
|
|
|
275
278
|
return toolbarItemViewModeProp in item && !!item[toolbarItemViewModeProp];
|
|
276
279
|
});
|
|
277
280
|
}
|
|
281
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1')) {
|
|
282
|
+
var _items2;
|
|
283
|
+
// Consolidate floating toolbar items
|
|
284
|
+
var toolbarItemsArray = Array.isArray(items) ? items : (_items2 = items) === null || _items2 === void 0 ? void 0 : _items2(node);
|
|
285
|
+
var overflowDropdownItems = toolbarItemsArray.filter(function (item) {
|
|
286
|
+
return item.type === 'overflow-dropdown';
|
|
287
|
+
});
|
|
288
|
+
if (overflowDropdownItems.length > 1) {
|
|
289
|
+
var consolidatedOverflowDropdown = (0, _utils3.consolidateOverflowDropdownItems)(overflowDropdownItems);
|
|
290
|
+
var otherItems = toolbarItemsArray.filter(function (item) {
|
|
291
|
+
return item.type !== 'overflow-dropdown';
|
|
292
|
+
});
|
|
293
|
+
if (otherItems.length > 0) {
|
|
294
|
+
// remove the last separators
|
|
295
|
+
while (((_otherItems$at = otherItems.at(-1)) === null || _otherItems$at === void 0 ? void 0 : _otherItems$at.type) === 'separator') {
|
|
296
|
+
var _otherItems$at;
|
|
297
|
+
otherItems.pop();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
items = [].concat((0, _toConsumableArray2.default)(otherItems), [{
|
|
301
|
+
type: 'separator',
|
|
302
|
+
fullHeight: true,
|
|
303
|
+
supportsViewMode: true
|
|
304
|
+
}, consolidatedOverflowDropdown]);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
278
307
|
var customPositionCalculation;
|
|
279
308
|
var toolbarItems = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.copyButton) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.hoverDecoration);
|
|
280
309
|
var viewModeToolbarEntry = (0, _experiments.unstable_editorExperimentParam)('live_pages_graceful_edit', 'toolbar-entry', {
|
package/dist/cjs/ui/Toolbar.js
CHANGED
|
@@ -206,11 +206,7 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
206
206
|
setDisableParentScroll: scrollable ? setDisableScroll : undefined,
|
|
207
207
|
dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && "".concat(item.id, "-dropdownList"),
|
|
208
208
|
alignDropdownWithToolbar: items.length === 1,
|
|
209
|
-
|
|
210
|
-
footer: item.footer,
|
|
211
|
-
onMount: item.onMount,
|
|
212
|
-
onClick: item.onClick,
|
|
213
|
-
pulse: item.pulse
|
|
209
|
+
onClick: item.onClick
|
|
214
210
|
});
|
|
215
211
|
case 'dropdown':
|
|
216
212
|
var DropdownIcon = item.icon;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.consolidateOverflowDropdownItems = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
// if there are more than 1 item with type `overflow-dropdown`, we should only show one and combine the options
|
|
10
|
+
var consolidateOverflowDropdownItems = exports.consolidateOverflowDropdownItems = function consolidateOverflowDropdownItems(overflowDropdowns) {
|
|
11
|
+
if (overflowDropdowns.length <= 1) {
|
|
12
|
+
return overflowDropdowns[0];
|
|
13
|
+
}
|
|
14
|
+
var combinedItems = overflowDropdowns.reduce(function (acc, item) {
|
|
15
|
+
if (item.options) {
|
|
16
|
+
acc.push.apply(acc, (0, _toConsumableArray2.default)(item.options));
|
|
17
|
+
}
|
|
18
|
+
return acc;
|
|
19
|
+
}, []);
|
|
20
|
+
|
|
21
|
+
// To filter out items that have a rank property, sort them by rank in descending order (highest rank first)
|
|
22
|
+
var rankedItems = combinedItems.filter(function (item) {
|
|
23
|
+
return 'rank' in item && typeof item.rank === 'number';
|
|
24
|
+
}).sort(function (a, b) {
|
|
25
|
+
return (b.rank || 0) - (a.rank || 0);
|
|
26
|
+
});
|
|
27
|
+
var unrankedItems = combinedItems.filter(function (item) {
|
|
28
|
+
return !('rank' in item && typeof item.rank === 'number');
|
|
29
|
+
});
|
|
30
|
+
var sortedItems = [].concat((0, _toConsumableArray2.default)(rankedItems), (0, _toConsumableArray2.default)(unrankedItems));
|
|
31
|
+
var largestDropdownWidth = overflowDropdowns.reduce(function (acc, item) {
|
|
32
|
+
if (item.dropdownWidth && item.dropdownWidth > acc) {
|
|
33
|
+
return item.dropdownWidth;
|
|
34
|
+
}
|
|
35
|
+
return acc;
|
|
36
|
+
}, 0);
|
|
37
|
+
return {
|
|
38
|
+
type: 'overflow-dropdown',
|
|
39
|
+
dropdownWidth: largestDropdownWidth,
|
|
40
|
+
options: sortedItems
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -8,6 +8,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
8
8
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import { AllSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { editorExperiment, unstable_editorExperimentParam } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
13
|
import { copyNode } from './pm-plugins/commands';
|
|
13
14
|
import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
|
|
@@ -18,6 +19,7 @@ import { findNode } from './pm-plugins/utils';
|
|
|
18
19
|
import { ConfirmationModal } from './ui/ConfirmationModal';
|
|
19
20
|
import { ExpandButton } from './ui/ExpandButton';
|
|
20
21
|
import { ToolbarLoader } from './ui/ToolbarLoader';
|
|
22
|
+
import { consolidateOverflowDropdownItems } from './ui/utils';
|
|
21
23
|
|
|
22
24
|
// TODO: AFP-2532 - Fix automatic suppressions below
|
|
23
25
|
export const getRelevantConfig = (selection, configs) => {
|
|
@@ -259,6 +261,28 @@ export function ContentComponent({
|
|
|
259
261
|
const toolbarItemViewModeProp = 'supportsViewMode';
|
|
260
262
|
items = iterableItems.filter(item => toolbarItemViewModeProp in item && !!item[toolbarItemViewModeProp]);
|
|
261
263
|
}
|
|
264
|
+
if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_1')) {
|
|
265
|
+
var _items2;
|
|
266
|
+
// Consolidate floating toolbar items
|
|
267
|
+
const toolbarItemsArray = Array.isArray(items) ? items : (_items2 = items) === null || _items2 === void 0 ? void 0 : _items2(node);
|
|
268
|
+
const overflowDropdownItems = toolbarItemsArray.filter(item => item.type === 'overflow-dropdown');
|
|
269
|
+
if (overflowDropdownItems.length > 1) {
|
|
270
|
+
const consolidatedOverflowDropdown = consolidateOverflowDropdownItems(overflowDropdownItems);
|
|
271
|
+
const otherItems = toolbarItemsArray.filter(item => item.type !== 'overflow-dropdown');
|
|
272
|
+
if (otherItems.length > 0) {
|
|
273
|
+
// remove the last separators
|
|
274
|
+
while (((_otherItems$at = otherItems.at(-1)) === null || _otherItems$at === void 0 ? void 0 : _otherItems$at.type) === 'separator') {
|
|
275
|
+
var _otherItems$at;
|
|
276
|
+
otherItems.pop();
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
items = [...otherItems, {
|
|
280
|
+
type: 'separator',
|
|
281
|
+
fullHeight: true,
|
|
282
|
+
supportsViewMode: true
|
|
283
|
+
}, consolidatedOverflowDropdown];
|
|
284
|
+
}
|
|
285
|
+
}
|
|
262
286
|
let customPositionCalculation;
|
|
263
287
|
const toolbarItems = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.copyButton) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.hoverDecoration);
|
|
264
288
|
const viewModeToolbarEntry = unstable_editorExperimentParam('live_pages_graceful_edit', 'toolbar-entry', {
|
|
@@ -183,11 +183,7 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
183
183
|
setDisableParentScroll: scrollable ? setDisableScroll : undefined,
|
|
184
184
|
dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && `${item.id}-dropdownList`,
|
|
185
185
|
alignDropdownWithToolbar: items.length === 1,
|
|
186
|
-
|
|
187
|
-
footer: item.footer,
|
|
188
|
-
onMount: item.onMount,
|
|
189
|
-
onClick: item.onClick,
|
|
190
|
-
pulse: item.pulse
|
|
186
|
+
onClick: item.onClick
|
|
191
187
|
});
|
|
192
188
|
case 'dropdown':
|
|
193
189
|
const DropdownIcon = item.icon;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// if there are more than 1 item with type `overflow-dropdown`, we should only show one and combine the options
|
|
2
|
+
export const consolidateOverflowDropdownItems = overflowDropdowns => {
|
|
3
|
+
if (overflowDropdowns.length <= 1) {
|
|
4
|
+
return overflowDropdowns[0];
|
|
5
|
+
}
|
|
6
|
+
const combinedItems = overflowDropdowns.reduce((acc, item) => {
|
|
7
|
+
if (item.options) {
|
|
8
|
+
acc.push(...item.options);
|
|
9
|
+
}
|
|
10
|
+
return acc;
|
|
11
|
+
}, []);
|
|
12
|
+
|
|
13
|
+
// To filter out items that have a rank property, sort them by rank in descending order (highest rank first)
|
|
14
|
+
const rankedItems = combinedItems.filter(item => 'rank' in item && typeof item.rank === 'number').sort((a, b) => (b.rank || 0) - (a.rank || 0));
|
|
15
|
+
const unrankedItems = combinedItems.filter(item => !('rank' in item && typeof item.rank === 'number'));
|
|
16
|
+
const sortedItems = [...rankedItems, ...unrankedItems];
|
|
17
|
+
const largestDropdownWidth = overflowDropdowns.reduce((acc, item) => {
|
|
18
|
+
if (item.dropdownWidth && item.dropdownWidth > acc) {
|
|
19
|
+
return item.dropdownWidth;
|
|
20
|
+
}
|
|
21
|
+
return acc;
|
|
22
|
+
}, 0);
|
|
23
|
+
return {
|
|
24
|
+
type: 'overflow-dropdown',
|
|
25
|
+
dropdownWidth: largestDropdownWidth,
|
|
26
|
+
options: sortedItems
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
3
|
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; }
|
|
3
4
|
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; }
|
|
4
5
|
import React from 'react';
|
|
@@ -11,6 +12,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
11
12
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
12
13
|
import { AllSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
13
14
|
import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
16
|
import { editorExperiment, unstable_editorExperimentParam } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
17
|
import { copyNode as _copyNode } from './pm-plugins/commands';
|
|
16
18
|
import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
|
|
@@ -21,6 +23,7 @@ import { findNode } from './pm-plugins/utils';
|
|
|
21
23
|
import { ConfirmationModal } from './ui/ConfirmationModal';
|
|
22
24
|
import { ExpandButton } from './ui/ExpandButton';
|
|
23
25
|
import { ToolbarLoader } from './ui/ToolbarLoader';
|
|
26
|
+
import { consolidateOverflowDropdownItems } from './ui/utils';
|
|
24
27
|
|
|
25
28
|
// TODO: AFP-2532 - Fix automatic suppressions below
|
|
26
29
|
export var getRelevantConfig = function getRelevantConfig(selection, configs) {
|
|
@@ -263,6 +266,32 @@ export function ContentComponent(_ref5) {
|
|
|
263
266
|
return toolbarItemViewModeProp in item && !!item[toolbarItemViewModeProp];
|
|
264
267
|
});
|
|
265
268
|
}
|
|
269
|
+
if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_1')) {
|
|
270
|
+
var _items2;
|
|
271
|
+
// Consolidate floating toolbar items
|
|
272
|
+
var toolbarItemsArray = Array.isArray(items) ? items : (_items2 = items) === null || _items2 === void 0 ? void 0 : _items2(node);
|
|
273
|
+
var overflowDropdownItems = toolbarItemsArray.filter(function (item) {
|
|
274
|
+
return item.type === 'overflow-dropdown';
|
|
275
|
+
});
|
|
276
|
+
if (overflowDropdownItems.length > 1) {
|
|
277
|
+
var consolidatedOverflowDropdown = consolidateOverflowDropdownItems(overflowDropdownItems);
|
|
278
|
+
var otherItems = toolbarItemsArray.filter(function (item) {
|
|
279
|
+
return item.type !== 'overflow-dropdown';
|
|
280
|
+
});
|
|
281
|
+
if (otherItems.length > 0) {
|
|
282
|
+
// remove the last separators
|
|
283
|
+
while (((_otherItems$at = otherItems.at(-1)) === null || _otherItems$at === void 0 ? void 0 : _otherItems$at.type) === 'separator') {
|
|
284
|
+
var _otherItems$at;
|
|
285
|
+
otherItems.pop();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
items = [].concat(_toConsumableArray(otherItems), [{
|
|
289
|
+
type: 'separator',
|
|
290
|
+
fullHeight: true,
|
|
291
|
+
supportsViewMode: true
|
|
292
|
+
}, consolidatedOverflowDropdown]);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
266
295
|
var customPositionCalculation;
|
|
267
296
|
var toolbarItems = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.copyButton) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.hoverDecoration);
|
|
268
297
|
var viewModeToolbarEntry = unstable_editorExperimentParam('live_pages_graceful_edit', 'toolbar-entry', {
|
package/dist/esm/ui/Toolbar.js
CHANGED
|
@@ -199,11 +199,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
199
199
|
setDisableParentScroll: scrollable ? setDisableScroll : undefined,
|
|
200
200
|
dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && "".concat(item.id, "-dropdownList"),
|
|
201
201
|
alignDropdownWithToolbar: items.length === 1,
|
|
202
|
-
|
|
203
|
-
footer: item.footer,
|
|
204
|
-
onMount: item.onMount,
|
|
205
|
-
onClick: item.onClick,
|
|
206
|
-
pulse: item.pulse
|
|
202
|
+
onClick: item.onClick
|
|
207
203
|
});
|
|
208
204
|
case 'dropdown':
|
|
209
205
|
var DropdownIcon = item.icon;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
// if there are more than 1 item with type `overflow-dropdown`, we should only show one and combine the options
|
|
3
|
+
export var consolidateOverflowDropdownItems = function consolidateOverflowDropdownItems(overflowDropdowns) {
|
|
4
|
+
if (overflowDropdowns.length <= 1) {
|
|
5
|
+
return overflowDropdowns[0];
|
|
6
|
+
}
|
|
7
|
+
var combinedItems = overflowDropdowns.reduce(function (acc, item) {
|
|
8
|
+
if (item.options) {
|
|
9
|
+
acc.push.apply(acc, _toConsumableArray(item.options));
|
|
10
|
+
}
|
|
11
|
+
return acc;
|
|
12
|
+
}, []);
|
|
13
|
+
|
|
14
|
+
// To filter out items that have a rank property, sort them by rank in descending order (highest rank first)
|
|
15
|
+
var rankedItems = combinedItems.filter(function (item) {
|
|
16
|
+
return 'rank' in item && typeof item.rank === 'number';
|
|
17
|
+
}).sort(function (a, b) {
|
|
18
|
+
return (b.rank || 0) - (a.rank || 0);
|
|
19
|
+
});
|
|
20
|
+
var unrankedItems = combinedItems.filter(function (item) {
|
|
21
|
+
return !('rank' in item && typeof item.rank === 'number');
|
|
22
|
+
});
|
|
23
|
+
var sortedItems = [].concat(_toConsumableArray(rankedItems), _toConsumableArray(unrankedItems));
|
|
24
|
+
var largestDropdownWidth = overflowDropdowns.reduce(function (acc, item) {
|
|
25
|
+
if (item.dropdownWidth && item.dropdownWidth > acc) {
|
|
26
|
+
return item.dropdownWidth;
|
|
27
|
+
}
|
|
28
|
+
return acc;
|
|
29
|
+
}, 0);
|
|
30
|
+
return {
|
|
31
|
+
type: 'overflow-dropdown',
|
|
32
|
+
dropdownWidth: largestDropdownWidth,
|
|
33
|
+
options: sortedItems
|
|
34
|
+
};
|
|
35
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-floating-toolbar",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.4",
|
|
4
4
|
"description": "Floating toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -26,29 +26,29 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@atlaskit/adf-utils": "^19.19.0",
|
|
29
|
-
"@atlaskit/button": "^
|
|
29
|
+
"@atlaskit/button": "^23.0.0",
|
|
30
30
|
"@atlaskit/checkbox": "^17.0.0",
|
|
31
|
-
"@atlaskit/editor-common": "^102.
|
|
31
|
+
"@atlaskit/editor-common": "^102.16.0",
|
|
32
32
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
33
|
-
"@atlaskit/editor-plugin-block-controls": "^3.
|
|
33
|
+
"@atlaskit/editor-plugin-block-controls": "^3.8.0",
|
|
34
34
|
"@atlaskit/editor-plugin-context-panel": "^4.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-copy-button": "^2.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-decorations": "^2.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-editor-viewmode": "^3.0.0",
|
|
39
|
-
"@atlaskit/editor-plugin-emoji": "^3.
|
|
40
|
-
"@atlaskit/editor-plugin-extension": "^5.
|
|
39
|
+
"@atlaskit/editor-plugin-emoji": "^3.3.0",
|
|
40
|
+
"@atlaskit/editor-plugin-extension": "^5.1.0",
|
|
41
41
|
"@atlaskit/editor-plugin-table": "^10.5.0",
|
|
42
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
43
43
|
"@atlaskit/emoji": "^69.0.0",
|
|
44
|
-
"@atlaskit/icon": "^25.
|
|
45
|
-
"@atlaskit/menu": "^3.
|
|
46
|
-
"@atlaskit/modal-dialog": "^14.
|
|
44
|
+
"@atlaskit/icon": "^25.4.0",
|
|
45
|
+
"@atlaskit/menu": "^3.2.0",
|
|
46
|
+
"@atlaskit/modal-dialog": "^14.1.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
48
|
"@atlaskit/primitives": "^14.2.0",
|
|
49
49
|
"@atlaskit/select": "^20.0.0",
|
|
50
50
|
"@atlaskit/theme": "^18.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^4.6.0",
|
|
52
52
|
"@atlaskit/tokens": "^4.5.0",
|
|
53
53
|
"@atlaskit/tooltip": "^20.0.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
@@ -127,6 +127,9 @@
|
|
|
127
127
|
},
|
|
128
128
|
"platform_editor_fix_floating_toolbar_scrollbar": {
|
|
129
129
|
"type": "boolean"
|
|
130
|
+
},
|
|
131
|
+
"platform_editor_controls_patch_1": {
|
|
132
|
+
"type": "boolean"
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
135
|
}
|