@atlaskit/editor-core 226.2.0 → 226.3.0
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 +20 -0
- package/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/create-editor/ReactEditorView.js +2 -2
- package/dist/cjs/ui/Appearance/Chromeless.js +2 -2
- package/dist/cjs/ui/Appearance/Comment/Comment-emotion.js +2 -1
- package/dist/cjs/ui/ContextPanel/index.js +2 -1
- package/dist/cjs/ui/Toolbar/Toolbar.js +3 -3
- package/dist/cjs/ui/quick-insert/ExtensionQuickInsertIcon.js +18 -1
- package/dist/cjs/ui/quick-insert/getExtensionQuickInsertComponents.js +39 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +2 -2
- package/dist/es2019/ui/Appearance/Chromeless.js +2 -2
- package/dist/es2019/ui/Appearance/Comment/Comment-emotion.js +2 -1
- package/dist/es2019/ui/ContextPanel/index.js +2 -1
- package/dist/es2019/ui/Toolbar/Toolbar.js +3 -3
- package/dist/es2019/ui/quick-insert/ExtensionQuickInsertIcon.js +20 -1
- package/dist/es2019/ui/quick-insert/getExtensionQuickInsertComponents.js +50 -24
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +2 -2
- package/dist/esm/ui/Appearance/Chromeless.js +2 -2
- package/dist/esm/ui/Appearance/Comment/Comment-emotion.js +2 -1
- package/dist/esm/ui/ContextPanel/index.js +2 -1
- package/dist/esm/ui/Toolbar/Toolbar.js +3 -3
- package/dist/esm/ui/quick-insert/ExtensionQuickInsertIcon.js +18 -1
- package/dist/esm/ui/quick-insert/getExtensionQuickInsertComponents.js +39 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 226.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`ec66928dbdbeb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ec66928dbdbeb) -
|
|
8
|
+
For the platform_editor_slash_command experiment, reorder Structure items, update slash-command
|
|
9
|
+
icons, move Jira work items to Data & Charts, and move Create Jira work item and Mention to
|
|
10
|
+
Structure. Use BlockSyncedIcon for the Synced block command.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`08bf773f7599a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/08bf773f7599a) -
|
|
15
|
+
Migrate experiments to use the new platform experiment API. This major release removes the
|
|
16
|
+
migrated experiment entries from `@atlaskit/tmp-editor-statsig`'s `editorExperimentsConfig` and
|
|
17
|
+
test overrides. Consumers must replace legacy `expVal`/`expValEquals` calls with
|
|
18
|
+
`@atlaskit/platform-feature-experiments` APIs, using `isExperimentEnabled` for boolean `isEnabled`
|
|
19
|
+
experiments and `expVal` for parameterized experiments; use `mockExpEnabled`/`mockExpDisabled` in
|
|
20
|
+
tests.
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 226.2.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -1138,7 +1138,7 @@ function ReactEditorView(props) {
|
|
|
1138
1138
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1139
1139
|
[editorRef, props.editorProps.popupsMountPoint]);
|
|
1140
1140
|
// eslint-disable-next-line @atlassian/perf-linting/no-inline-context-value, @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017
|
|
1141
|
-
var reactEditorViewContext = (0,
|
|
1141
|
+
var reactEditorViewContext = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_perf_lint_cleanup') ? memoizedReactEditorViewContext : {
|
|
1142
1142
|
editorRef: editorRef,
|
|
1143
1143
|
editorView: viewRef.current,
|
|
1144
1144
|
popupsMountPoint: props.editorProps.popupsMountPoint
|
|
@@ -1171,7 +1171,7 @@ function ReactEditorView(props) {
|
|
|
1171
1171
|
prebuiltEditorState: ssrDeps.ssrEditorState
|
|
1172
1172
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1173
1173
|
,
|
|
1174
|
-
onEditorStateChanged: (0,
|
|
1174
|
+
onEditorStateChanged: (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_perf_lint_cleanup') ? handleSsrEditorStateChanged : function (state) {
|
|
1175
1175
|
preMountEditorStateRef.current = state;
|
|
1176
1176
|
// Notify listeners about the initial SSR state
|
|
1177
1177
|
pluginInjectionAPI.current.onEditorViewUpdated({
|
|
@@ -14,7 +14,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
16
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
17
|
-
var
|
|
17
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
18
18
|
var _EditorContentContainer = _interopRequireDefault(require("../EditorContentContainer/EditorContentContainer"));
|
|
19
19
|
var _PluginSlot = _interopRequireDefault(require("../PluginSlot"));
|
|
20
20
|
var _WithFlash = _interopRequireDefault(require("../WithFlash"));
|
|
@@ -66,7 +66,7 @@ var Editor = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
66
66
|
var _states$editorViewMod;
|
|
67
67
|
return states === null || states === void 0 || (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode;
|
|
68
68
|
});
|
|
69
|
-
var containerRef = (0,
|
|
69
|
+
var containerRef = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_perf_lint_cleanup') ? _this.setContainerElement : function (ref) {
|
|
70
70
|
return _this.containerElement = ref;
|
|
71
71
|
};
|
|
72
72
|
return /*#__PURE__*/_react.default.createElement(_WithFlash.default, {
|
|
@@ -19,6 +19,7 @@ var _messages = _interopRequireDefault(require("@atlaskit/editor-common/messages
|
|
|
19
19
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
20
20
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
21
21
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
22
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
22
23
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
23
24
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
24
25
|
var _ClickAreaBlock = _interopRequireDefault(require("../../Addon/ClickAreaBlock"));
|
|
@@ -221,7 +222,7 @@ var CommentEditorWithIntlEmotion = exports.CommentEditorWithIntlEmotion = functi
|
|
|
221
222
|
overflowY: 'auto'
|
|
222
223
|
}) : null];
|
|
223
224
|
}, [maxHeight]);
|
|
224
|
-
var contentAreaStyles = (0,
|
|
225
|
+
var contentAreaStyles = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_perf_lint_cleanup') ? memoizedContentAreaStyles : [maxHeight ?
|
|
225
226
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
226
227
|
(0, _react2.css)({
|
|
227
228
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
@@ -20,6 +20,7 @@ var _contextPanel = require("@atlaskit/editor-common/context-panel");
|
|
|
20
20
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
21
21
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
22
22
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
23
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
23
24
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
24
25
|
var _componentWithCondition = require("@atlaskit/platform-feature-flags-react/component-with-condition");
|
|
25
26
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
@@ -67,7 +68,7 @@ var SwappableContentAreaInner = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
67
68
|
return;
|
|
68
69
|
}
|
|
69
70
|
var animSpeedMs = (0, _fg.fg)('platform_editor_disable_context_panel_animation') ? 0 : ANIM_SPEED_MS;
|
|
70
|
-
var onExited = (0,
|
|
71
|
+
var onExited = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_perf_lint_cleanup') ? _this.handleTransitionExited : function () {
|
|
71
72
|
return _this.unsetPluginContent();
|
|
72
73
|
};
|
|
73
74
|
return /*#__PURE__*/_react.default.createElement(_Transition.default, {
|
|
@@ -12,7 +12,7 @@ var _types = require("@atlaskit/editor-common/types");
|
|
|
12
12
|
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
13
13
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
14
14
|
var _editorToolbarModel = require("@atlaskit/editor-toolbar-model");
|
|
15
|
-
var
|
|
15
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
16
16
|
var _ToolbarInner = require("./ToolbarInner");
|
|
17
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
18
18
|
var TOOLBAR_FALLBACKS = {
|
|
@@ -83,10 +83,10 @@ var ToolbarNext = exports.ToolbarNext = function ToolbarNext(_ref) {
|
|
|
83
83
|
var _editorAPI$analytics;
|
|
84
84
|
editorAPI === null || editorAPI === void 0 || (_editorAPI$analytics = editorAPI.analytics) === null || _editorAPI$analytics === void 0 || _editorAPI$analytics.actions.fireAnalyticsEvent(payload);
|
|
85
85
|
}, [editorAPI]);
|
|
86
|
-
var fireAnalyticsEvent = (0,
|
|
86
|
+
var fireAnalyticsEvent = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_perf_lint_cleanup') ? memoizedFireAnalyticsEvent : function (payload) {
|
|
87
87
|
return memoizedFireAnalyticsEvent(payload);
|
|
88
88
|
};
|
|
89
|
-
var fallbacks = (0,
|
|
89
|
+
var fallbacks = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_perf_lint_cleanup') ? TOOLBAR_FALLBACKS : {
|
|
90
90
|
group: _editorToolbar.ToolbarButtonGroup,
|
|
91
91
|
section: _editorToolbar.ToolbarSection,
|
|
92
92
|
menuSection: _editorToolbar.ToolbarDropdownItemSection
|
|
@@ -9,9 +9,19 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _apps = _interopRequireDefault(require("@atlaskit/icon/core/apps"));
|
|
12
|
+
var _card = _interopRequireDefault(require("@atlaskit/icon/core/card"));
|
|
12
13
|
var _whiteboard = _interopRequireDefault(require("@atlaskit/icon/core/whiteboard"));
|
|
14
|
+
var _carousel = _interopRequireDefault(require("@atlaskit/icon-lab/core/carousel"));
|
|
15
|
+
var _tableOfContent = _interopRequireDefault(require("@atlaskit/icon-lab/core/table-of-content"));
|
|
16
|
+
var _template = _interopRequireDefault(require("@atlaskit/icon-lab/core/template"));
|
|
13
17
|
var lazyExtensionIconCache = new WeakMap();
|
|
14
18
|
var whiteboardQuickInsertItemKeys = new Set(['whiteboard-extension:create-whiteboard', 'whiteboard-extension:create-diagram', 'whiteboard-extension:create-flowchart', 'whiteboard-extension:create-brainstorming', 'whiteboard-extension:create-retrospective', 'whiteboard-extension:create-roadmap']);
|
|
19
|
+
var quickInsertItemIcons = {
|
|
20
|
+
'toc:toc': _tableOfContent.default,
|
|
21
|
+
'cards:quick-insert': _card.default,
|
|
22
|
+
'carousel:quick-insert': _carousel.default,
|
|
23
|
+
'create-from-template:create-from-template': _template.default
|
|
24
|
+
};
|
|
15
25
|
var resolveExtensionIcon = /*#__PURE__*/function () {
|
|
16
26
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(getIcon) {
|
|
17
27
|
var maybeIcon, _default, _t;
|
|
@@ -80,7 +90,14 @@ var ExtensionQuickInsertIcon = exports.ExtensionQuickInsertIcon = function Exten
|
|
|
80
90
|
itemKey = _ref2.itemKey,
|
|
81
91
|
label = _ref2.label;
|
|
82
92
|
var Icon = _react.default.useMemo(function () {
|
|
83
|
-
|
|
93
|
+
var quickInsertItemIcon = quickInsertItemIcons[itemKey];
|
|
94
|
+
if (quickInsertItemIcon) {
|
|
95
|
+
return quickInsertItemIcon;
|
|
96
|
+
}
|
|
97
|
+
if (whiteboardQuickInsertItemKeys.has(itemKey)) {
|
|
98
|
+
return _whiteboard.default;
|
|
99
|
+
}
|
|
100
|
+
return getIcon ? createLazyExtensionIcon(getIcon) : _apps.default;
|
|
84
101
|
}, [getIcon, itemKey]);
|
|
85
102
|
return /*#__PURE__*/_react.default.createElement(Icon, {
|
|
86
103
|
label: label
|
|
@@ -8,20 +8,56 @@ exports.getExtensionQuickInsertComponents = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _createQuickInsertMatcher = require("@atlaskit/editor-common/quick-insert/create-quick-insert-matcher");
|
|
10
10
|
var _getMenuItemParents = require("@atlaskit/editor-common/quick-insert/get-menu-item-parents");
|
|
11
|
+
var _keys = require("@atlaskit/editor-common/quick-insert/keys");
|
|
11
12
|
var _rank = require("@atlaskit/editor-common/quick-insert/rank");
|
|
12
13
|
var _ExtensionQuickInsertMenuItem = require("./ExtensionQuickInsertMenuItem");
|
|
14
|
+
var structureExtensionItemKeyRanks = {
|
|
15
|
+
'toc:toc': 600,
|
|
16
|
+
'native-tabs:native-tabs': 1900,
|
|
17
|
+
'cards:quick-insert': 2000,
|
|
18
|
+
'carousel:quick-insert': 2100,
|
|
19
|
+
'spotlight:quick-insert': 2200,
|
|
20
|
+
'com.atlassian.linking-platform.create:linking-platform-create-jira-issue': 2500,
|
|
21
|
+
'com.atlassian.linking-platform.create:linking-platform-create-confluence-page': 2600,
|
|
22
|
+
'create-from-template:create-from-template': 2700,
|
|
23
|
+
'anchor:anchor': 2900,
|
|
24
|
+
'smart-button:quick-insert': 3000
|
|
25
|
+
};
|
|
26
|
+
var UNRECOGNIZED_STRUCTURE_EXTENSION_ITEM_RANK = 3100;
|
|
27
|
+
var getStructureExtensionItemRank = function getStructureExtensionItemRank(item) {
|
|
28
|
+
return structureExtensionItemKeyRanks[item.key];
|
|
29
|
+
};
|
|
30
|
+
var isStructureExtensionItem = function isStructureExtensionItem(item) {
|
|
31
|
+
return (0, _getMenuItemParents.getQuickInsertMenuItemParents)({
|
|
32
|
+
categories: item.categories,
|
|
33
|
+
rank: 0
|
|
34
|
+
}).some(function (parent) {
|
|
35
|
+
return parent.key === _keys.STRUCTURE_SECTION.key;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
13
38
|
var getExtensionQuickInsertComponents = exports.getExtensionQuickInsertComponents = function getExtensionQuickInsertComponents(_ref) {
|
|
14
39
|
var apiRef = _ref.apiRef,
|
|
15
40
|
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
16
41
|
items = _ref.items;
|
|
42
|
+
var unrecognizedStructureItemRanks = new Map(items.filter(isStructureExtensionItem).filter(function (item) {
|
|
43
|
+
return getStructureExtensionItemRank(item) === undefined;
|
|
44
|
+
}).sort(function (firstItem, secondItem) {
|
|
45
|
+
return firstItem.title.localeCompare(secondItem.title) || firstItem.key.localeCompare(secondItem.key);
|
|
46
|
+
}).map(function (item, index) {
|
|
47
|
+
return [item, UNRECOGNIZED_STRUCTURE_EXTENSION_ITEM_RANK + index];
|
|
48
|
+
}));
|
|
17
49
|
return items.map(function (item, index) {
|
|
18
|
-
var _item$priority;
|
|
50
|
+
var _unrecognizedStructur, _item$priority;
|
|
51
|
+
var structureRank = getStructureExtensionItemRank(item);
|
|
52
|
+
var isStructureItem = structureRank !== undefined;
|
|
53
|
+
var categories = isStructureItem ? ['structure'] : item.categories;
|
|
54
|
+
var fallbackRank = (_unrecognizedStructur = unrecognizedStructureItemRanks.get(item)) !== null && _unrecognizedStructur !== void 0 ? _unrecognizedStructur : _rank.EXTENSION_ITEM_RANK + ((_item$priority = item.priority) !== null && _item$priority !== void 0 ? _item$priority : index);
|
|
19
55
|
return {
|
|
20
56
|
type: 'menu-item',
|
|
21
57
|
key: item.key,
|
|
22
58
|
parents: (0, _getMenuItemParents.getQuickInsertMenuItemParents)({
|
|
23
|
-
categories:
|
|
24
|
-
rank:
|
|
59
|
+
categories: categories,
|
|
60
|
+
rank: structureRank !== null && structureRank !== void 0 ? structureRank : fallbackRank
|
|
25
61
|
}),
|
|
26
62
|
match: (0, _createQuickInsertMatcher.createQuickInsertMatcher)(function () {
|
|
27
63
|
return {
|
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
8
|
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
9
|
-
var version = exports.version = "226.
|
|
9
|
+
var version = exports.version = "226.2.0";
|
|
@@ -1054,7 +1054,7 @@ export function ReactEditorView(props) {
|
|
|
1054
1054
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1055
1055
|
[editorRef, props.editorProps.popupsMountPoint]);
|
|
1056
1056
|
// eslint-disable-next-line @atlassian/perf-linting/no-inline-context-value, @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017
|
|
1057
|
-
const reactEditorViewContext =
|
|
1057
|
+
const reactEditorViewContext = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? memoizedReactEditorViewContext : {
|
|
1058
1058
|
editorRef,
|
|
1059
1059
|
editorView: viewRef.current,
|
|
1060
1060
|
popupsMountPoint: props.editorProps.popupsMountPoint
|
|
@@ -1087,7 +1087,7 @@ export function ReactEditorView(props) {
|
|
|
1087
1087
|
prebuiltEditorState: ssrDeps.ssrEditorState
|
|
1088
1088
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1089
1089
|
,
|
|
1090
|
-
onEditorStateChanged:
|
|
1090
|
+
onEditorStateChanged: isExperimentEnabled('platform_editor_perf_lint_cleanup') ? handleSsrEditorStateChanged : state => {
|
|
1091
1091
|
preMountEditorStateRef.current = state;
|
|
1092
1092
|
// Notify listeners about the initial SSR state
|
|
1093
1093
|
pluginInjectionAPI.current.onEditorViewUpdated({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React, { Fragment } from 'react';
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
|
-
import {
|
|
4
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
5
5
|
import EditorContentContainer from '../EditorContentContainer/EditorContentContainer';
|
|
6
6
|
import PluginSlot from '../PluginSlot';
|
|
7
7
|
import WithFlash from '../WithFlash';
|
|
@@ -46,7 +46,7 @@ export default class Editor extends React.Component {
|
|
|
46
46
|
var _states$editorViewMod;
|
|
47
47
|
return states === null || states === void 0 ? void 0 : (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode;
|
|
48
48
|
});
|
|
49
|
-
const containerRef =
|
|
49
|
+
const containerRef = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? this.setContainerElement : ref => this.containerElement = ref;
|
|
50
50
|
return /*#__PURE__*/React.createElement(WithFlash, {
|
|
51
51
|
animate: maxContentSizeReached
|
|
52
52
|
}, /*#__PURE__*/React.createElement(ChromelessEditorContainer, {
|
|
@@ -21,6 +21,7 @@ import messages from '@atlaskit/editor-common/messages';
|
|
|
21
21
|
import { WidthConsumer, WidthProvider } from '@atlaskit/editor-common/ui';
|
|
22
22
|
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
23
23
|
import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
24
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
24
25
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
25
26
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
26
27
|
// Ignored via go/ees005
|
|
@@ -207,7 +208,7 @@ export const CommentEditorWithIntlEmotion = props => {
|
|
|
207
208
|
// so need to set overflow-y as auto to make sure the content area is scrollable
|
|
208
209
|
overflowY: 'auto'
|
|
209
210
|
}) : null], [maxHeight]);
|
|
210
|
-
const contentAreaStyles =
|
|
211
|
+
const contentAreaStyles = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? memoizedContentAreaStyles : [maxHeight ?
|
|
211
212
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
212
213
|
css({
|
|
213
214
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
@@ -8,6 +8,7 @@ import { ContextPanelConsumer } from '@atlaskit/editor-common/context-panel';
|
|
|
8
8
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
9
9
|
import { contextPanelMessages } from '@atlaskit/editor-common/messages';
|
|
10
10
|
import { akEditorContextPanelWidth } from '@atlaskit/editor-shared-styles';
|
|
11
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
11
12
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
12
13
|
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react/component-with-condition';
|
|
13
14
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -48,7 +49,7 @@ class SwappableContentAreaInner extends React.PureComponent {
|
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
51
|
const animSpeedMs = fg('platform_editor_disable_context_panel_animation') ? 0 : ANIM_SPEED_MS;
|
|
51
|
-
const onExited =
|
|
52
|
+
const onExited = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? this.handleTransitionExited : () => this.unsetPluginContent();
|
|
52
53
|
return /*#__PURE__*/React.createElement(Transition, {
|
|
53
54
|
timeout: this.state.mounted ? animSpeedMs : 0,
|
|
54
55
|
in: !!pluginContent,
|
|
@@ -5,7 +5,7 @@ import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
|
5
5
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
6
6
|
import { ToolbarButtonGroup, ToolbarDropdownItemSection, ToolbarSection } from '@atlaskit/editor-toolbar';
|
|
7
7
|
import { ToolbarModelRenderer } from '@atlaskit/editor-toolbar-model';
|
|
8
|
-
import {
|
|
8
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
9
9
|
import { ToolbarInner } from './ToolbarInner';
|
|
10
10
|
const TOOLBAR_FALLBACKS = {
|
|
11
11
|
group: ToolbarButtonGroup,
|
|
@@ -77,8 +77,8 @@ export const ToolbarNext = ({
|
|
|
77
77
|
var _editorAPI$analytics;
|
|
78
78
|
editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$analytics = editorAPI.analytics) === null || _editorAPI$analytics === void 0 ? void 0 : _editorAPI$analytics.actions.fireAnalyticsEvent(payload);
|
|
79
79
|
}, [editorAPI]);
|
|
80
|
-
const fireAnalyticsEvent =
|
|
81
|
-
const fallbacks =
|
|
80
|
+
const fireAnalyticsEvent = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? memoizedFireAnalyticsEvent : payload => memoizedFireAnalyticsEvent(payload);
|
|
81
|
+
const fallbacks = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? TOOLBAR_FALLBACKS : {
|
|
82
82
|
group: ToolbarButtonGroup,
|
|
83
83
|
section: ToolbarSection,
|
|
84
84
|
menuSection: ToolbarDropdownItemSection
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import AppsIcon from '@atlaskit/icon/core/apps';
|
|
3
|
+
import CardIcon from '@atlaskit/icon/core/card';
|
|
3
4
|
import WhiteboardIcon from '@atlaskit/icon/core/whiteboard';
|
|
5
|
+
import CarouselIcon from '@atlaskit/icon-lab/core/carousel';
|
|
6
|
+
import TableOfContentIcon from '@atlaskit/icon-lab/core/table-of-content';
|
|
7
|
+
import TemplateIcon from '@atlaskit/icon-lab/core/template';
|
|
4
8
|
const lazyExtensionIconCache = new WeakMap();
|
|
5
9
|
const whiteboardQuickInsertItemKeys = new Set(['whiteboard-extension:create-whiteboard', 'whiteboard-extension:create-diagram', 'whiteboard-extension:create-flowchart', 'whiteboard-extension:create-brainstorming', 'whiteboard-extension:create-retrospective', 'whiteboard-extension:create-roadmap']);
|
|
10
|
+
const quickInsertItemIcons = {
|
|
11
|
+
'toc:toc': TableOfContentIcon,
|
|
12
|
+
'cards:quick-insert': CardIcon,
|
|
13
|
+
'carousel:quick-insert': CarouselIcon,
|
|
14
|
+
'create-from-template:create-from-template': TemplateIcon
|
|
15
|
+
};
|
|
6
16
|
const resolveExtensionIcon = async getIcon => {
|
|
7
17
|
try {
|
|
8
18
|
const maybeIcon = await (getIcon === null || getIcon === void 0 ? void 0 : getIcon());
|
|
@@ -42,7 +52,16 @@ export const ExtensionQuickInsertIcon = ({
|
|
|
42
52
|
itemKey,
|
|
43
53
|
label
|
|
44
54
|
}) => {
|
|
45
|
-
const Icon = React.useMemo(() =>
|
|
55
|
+
const Icon = React.useMemo(() => {
|
|
56
|
+
const quickInsertItemIcon = quickInsertItemIcons[itemKey];
|
|
57
|
+
if (quickInsertItemIcon) {
|
|
58
|
+
return quickInsertItemIcon;
|
|
59
|
+
}
|
|
60
|
+
if (whiteboardQuickInsertItemKeys.has(itemKey)) {
|
|
61
|
+
return WhiteboardIcon;
|
|
62
|
+
}
|
|
63
|
+
return getIcon ? createLazyExtensionIcon(getIcon) : AppsIcon;
|
|
64
|
+
}, [getIcon, itemKey]);
|
|
46
65
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
47
66
|
label: label
|
|
48
67
|
});
|
|
@@ -1,33 +1,59 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
|
|
3
3
|
import { getQuickInsertMenuItemParents } from '@atlaskit/editor-common/quick-insert/get-menu-item-parents';
|
|
4
|
+
import { STRUCTURE_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
4
5
|
import { EXTENSION_ITEM_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
5
6
|
import { ExtensionQuickInsertMenuItem } from './ExtensionQuickInsertMenuItem';
|
|
7
|
+
const structureExtensionItemKeyRanks = {
|
|
8
|
+
'toc:toc': 600,
|
|
9
|
+
'native-tabs:native-tabs': 1900,
|
|
10
|
+
'cards:quick-insert': 2000,
|
|
11
|
+
'carousel:quick-insert': 2100,
|
|
12
|
+
'spotlight:quick-insert': 2200,
|
|
13
|
+
'com.atlassian.linking-platform.create:linking-platform-create-jira-issue': 2500,
|
|
14
|
+
'com.atlassian.linking-platform.create:linking-platform-create-confluence-page': 2600,
|
|
15
|
+
'create-from-template:create-from-template': 2700,
|
|
16
|
+
'anchor:anchor': 2900,
|
|
17
|
+
'smart-button:quick-insert': 3000
|
|
18
|
+
};
|
|
19
|
+
const UNRECOGNIZED_STRUCTURE_EXTENSION_ITEM_RANK = 3100;
|
|
20
|
+
const getStructureExtensionItemRank = item => structureExtensionItemKeyRanks[item.key];
|
|
21
|
+
const isStructureExtensionItem = item => getQuickInsertMenuItemParents({
|
|
22
|
+
categories: item.categories,
|
|
23
|
+
rank: 0
|
|
24
|
+
}).some(parent => parent.key === STRUCTURE_SECTION.key);
|
|
6
25
|
export const getExtensionQuickInsertComponents = ({
|
|
7
26
|
apiRef,
|
|
8
27
|
createAnalyticsEvent,
|
|
9
28
|
items
|
|
10
|
-
}) =>
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
}) => {
|
|
30
|
+
const unrecognizedStructureItemRanks = new Map(items.filter(isStructureExtensionItem).filter(item => getStructureExtensionItemRank(item) === undefined).sort((firstItem, secondItem) => firstItem.title.localeCompare(secondItem.title) || firstItem.key.localeCompare(secondItem.key)).map((item, index) => [item, UNRECOGNIZED_STRUCTURE_EXTENSION_ITEM_RANK + index]));
|
|
31
|
+
return items.map((item, index) => {
|
|
32
|
+
var _unrecognizedStructur, _item$priority;
|
|
33
|
+
const structureRank = getStructureExtensionItemRank(item);
|
|
34
|
+
const isStructureItem = structureRank !== undefined;
|
|
35
|
+
const categories = isStructureItem ? ['structure'] : item.categories;
|
|
36
|
+
const fallbackRank = (_unrecognizedStructur = unrecognizedStructureItemRanks.get(item)) !== null && _unrecognizedStructur !== void 0 ? _unrecognizedStructur : EXTENSION_ITEM_RANK + ((_item$priority = item.priority) !== null && _item$priority !== void 0 ? _item$priority : index);
|
|
37
|
+
return {
|
|
38
|
+
type: 'menu-item',
|
|
39
|
+
key: item.key,
|
|
40
|
+
parents: getQuickInsertMenuItemParents({
|
|
41
|
+
categories,
|
|
42
|
+
rank: structureRank !== null && structureRank !== void 0 ? structureRank : fallbackRank
|
|
43
|
+
}),
|
|
44
|
+
match: createQuickInsertMatcher(() => ({
|
|
45
|
+
description: item.description,
|
|
46
|
+
keywords: item.keywords,
|
|
47
|
+
title: item.title
|
|
48
|
+
})),
|
|
49
|
+
component: props => {
|
|
50
|
+
return /*#__PURE__*/React.createElement(ExtensionQuickInsertMenuItem, {
|
|
51
|
+
apiRef: apiRef,
|
|
52
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
53
|
+
item: item,
|
|
54
|
+
onInsert: props.onInsert
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
};
|
|
@@ -1129,7 +1129,7 @@ export function ReactEditorView(props) {
|
|
|
1129
1129
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1130
1130
|
[editorRef, props.editorProps.popupsMountPoint]);
|
|
1131
1131
|
// eslint-disable-next-line @atlassian/perf-linting/no-inline-context-value, @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017
|
|
1132
|
-
var reactEditorViewContext =
|
|
1132
|
+
var reactEditorViewContext = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? memoizedReactEditorViewContext : {
|
|
1133
1133
|
editorRef: editorRef,
|
|
1134
1134
|
editorView: viewRef.current,
|
|
1135
1135
|
popupsMountPoint: props.editorProps.popupsMountPoint
|
|
@@ -1162,7 +1162,7 @@ export function ReactEditorView(props) {
|
|
|
1162
1162
|
prebuiltEditorState: ssrDeps.ssrEditorState
|
|
1163
1163
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1164
1164
|
,
|
|
1165
|
-
onEditorStateChanged:
|
|
1165
|
+
onEditorStateChanged: isExperimentEnabled('platform_editor_perf_lint_cleanup') ? handleSsrEditorStateChanged : function (state) {
|
|
1166
1166
|
preMountEditorStateRef.current = state;
|
|
1167
1167
|
// Notify listeners about the initial SSR state
|
|
1168
1168
|
pluginInjectionAPI.current.onEditorViewUpdated({
|
|
@@ -8,7 +8,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
9
|
import React, { Fragment } from 'react';
|
|
10
10
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
11
|
-
import {
|
|
11
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
12
12
|
import EditorContentContainer from '../EditorContentContainer/EditorContentContainer';
|
|
13
13
|
import PluginSlot from '../PluginSlot';
|
|
14
14
|
import WithFlash from '../WithFlash';
|
|
@@ -57,7 +57,7 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
57
57
|
var _states$editorViewMod;
|
|
58
58
|
return states === null || states === void 0 || (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode;
|
|
59
59
|
});
|
|
60
|
-
var containerRef =
|
|
60
|
+
var containerRef = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? _this.setContainerElement : function (ref) {
|
|
61
61
|
return _this.containerElement = ref;
|
|
62
62
|
};
|
|
63
63
|
return /*#__PURE__*/React.createElement(WithFlash, {
|
|
@@ -23,6 +23,7 @@ import messages from '@atlaskit/editor-common/messages';
|
|
|
23
23
|
import { WidthConsumer, WidthProvider } from '@atlaskit/editor-common/ui';
|
|
24
24
|
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
25
25
|
import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
26
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
26
27
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
27
28
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
28
29
|
// Ignored via go/ees005
|
|
@@ -210,7 +211,7 @@ export var CommentEditorWithIntlEmotion = function CommentEditorWithIntlEmotion(
|
|
|
210
211
|
overflowY: 'auto'
|
|
211
212
|
}) : null];
|
|
212
213
|
}, [maxHeight]);
|
|
213
|
-
var contentAreaStyles =
|
|
214
|
+
var contentAreaStyles = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? memoizedContentAreaStyles : [maxHeight ?
|
|
214
215
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
215
216
|
css({
|
|
216
217
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
@@ -17,6 +17,7 @@ import { ContextPanelConsumer } from '@atlaskit/editor-common/context-panel';
|
|
|
17
17
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
18
18
|
import { contextPanelMessages } from '@atlaskit/editor-common/messages';
|
|
19
19
|
import { akEditorContextPanelWidth } from '@atlaskit/editor-shared-styles';
|
|
20
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
20
21
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
21
22
|
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react/component-with-condition';
|
|
22
23
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -60,7 +61,7 @@ var SwappableContentAreaInner = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
63
|
var animSpeedMs = fg('platform_editor_disable_context_panel_animation') ? 0 : ANIM_SPEED_MS;
|
|
63
|
-
var onExited =
|
|
64
|
+
var onExited = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? _this.handleTransitionExited : function () {
|
|
64
65
|
return _this.unsetPluginContent();
|
|
65
66
|
};
|
|
66
67
|
return /*#__PURE__*/React.createElement(Transition, {
|
|
@@ -5,7 +5,7 @@ import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
|
5
5
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
6
6
|
import { ToolbarButtonGroup, ToolbarDropdownItemSection, ToolbarSection } from '@atlaskit/editor-toolbar';
|
|
7
7
|
import { ToolbarModelRenderer } from '@atlaskit/editor-toolbar-model';
|
|
8
|
-
import {
|
|
8
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
9
9
|
import { ToolbarInner } from './ToolbarInner';
|
|
10
10
|
var TOOLBAR_FALLBACKS = {
|
|
11
11
|
group: ToolbarButtonGroup,
|
|
@@ -75,10 +75,10 @@ export var ToolbarNext = function ToolbarNext(_ref) {
|
|
|
75
75
|
var _editorAPI$analytics;
|
|
76
76
|
editorAPI === null || editorAPI === void 0 || (_editorAPI$analytics = editorAPI.analytics) === null || _editorAPI$analytics === void 0 || _editorAPI$analytics.actions.fireAnalyticsEvent(payload);
|
|
77
77
|
}, [editorAPI]);
|
|
78
|
-
var fireAnalyticsEvent =
|
|
78
|
+
var fireAnalyticsEvent = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? memoizedFireAnalyticsEvent : function (payload) {
|
|
79
79
|
return memoizedFireAnalyticsEvent(payload);
|
|
80
80
|
};
|
|
81
|
-
var fallbacks =
|
|
81
|
+
var fallbacks = isExperimentEnabled('platform_editor_perf_lint_cleanup') ? TOOLBAR_FALLBACKS : {
|
|
82
82
|
group: ToolbarButtonGroup,
|
|
83
83
|
section: ToolbarSection,
|
|
84
84
|
menuSection: ToolbarDropdownItemSection
|
|
@@ -2,9 +2,19 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import AppsIcon from '@atlaskit/icon/core/apps';
|
|
5
|
+
import CardIcon from '@atlaskit/icon/core/card';
|
|
5
6
|
import WhiteboardIcon from '@atlaskit/icon/core/whiteboard';
|
|
7
|
+
import CarouselIcon from '@atlaskit/icon-lab/core/carousel';
|
|
8
|
+
import TableOfContentIcon from '@atlaskit/icon-lab/core/table-of-content';
|
|
9
|
+
import TemplateIcon from '@atlaskit/icon-lab/core/template';
|
|
6
10
|
var lazyExtensionIconCache = new WeakMap();
|
|
7
11
|
var whiteboardQuickInsertItemKeys = new Set(['whiteboard-extension:create-whiteboard', 'whiteboard-extension:create-diagram', 'whiteboard-extension:create-flowchart', 'whiteboard-extension:create-brainstorming', 'whiteboard-extension:create-retrospective', 'whiteboard-extension:create-roadmap']);
|
|
12
|
+
var quickInsertItemIcons = {
|
|
13
|
+
'toc:toc': TableOfContentIcon,
|
|
14
|
+
'cards:quick-insert': CardIcon,
|
|
15
|
+
'carousel:quick-insert': CarouselIcon,
|
|
16
|
+
'create-from-template:create-from-template': TemplateIcon
|
|
17
|
+
};
|
|
8
18
|
var resolveExtensionIcon = /*#__PURE__*/function () {
|
|
9
19
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(getIcon) {
|
|
10
20
|
var maybeIcon, _default, _t;
|
|
@@ -73,7 +83,14 @@ export var ExtensionQuickInsertIcon = function ExtensionQuickInsertIcon(_ref2) {
|
|
|
73
83
|
itemKey = _ref2.itemKey,
|
|
74
84
|
label = _ref2.label;
|
|
75
85
|
var Icon = React.useMemo(function () {
|
|
76
|
-
|
|
86
|
+
var quickInsertItemIcon = quickInsertItemIcons[itemKey];
|
|
87
|
+
if (quickInsertItemIcon) {
|
|
88
|
+
return quickInsertItemIcon;
|
|
89
|
+
}
|
|
90
|
+
if (whiteboardQuickInsertItemKeys.has(itemKey)) {
|
|
91
|
+
return WhiteboardIcon;
|
|
92
|
+
}
|
|
93
|
+
return getIcon ? createLazyExtensionIcon(getIcon) : AppsIcon;
|
|
77
94
|
}, [getIcon, itemKey]);
|
|
78
95
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
79
96
|
label: label
|
|
@@ -1,20 +1,56 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
|
|
3
3
|
import { getQuickInsertMenuItemParents } from '@atlaskit/editor-common/quick-insert/get-menu-item-parents';
|
|
4
|
+
import { STRUCTURE_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
4
5
|
import { EXTENSION_ITEM_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
5
6
|
import { ExtensionQuickInsertMenuItem } from './ExtensionQuickInsertMenuItem';
|
|
7
|
+
var structureExtensionItemKeyRanks = {
|
|
8
|
+
'toc:toc': 600,
|
|
9
|
+
'native-tabs:native-tabs': 1900,
|
|
10
|
+
'cards:quick-insert': 2000,
|
|
11
|
+
'carousel:quick-insert': 2100,
|
|
12
|
+
'spotlight:quick-insert': 2200,
|
|
13
|
+
'com.atlassian.linking-platform.create:linking-platform-create-jira-issue': 2500,
|
|
14
|
+
'com.atlassian.linking-platform.create:linking-platform-create-confluence-page': 2600,
|
|
15
|
+
'create-from-template:create-from-template': 2700,
|
|
16
|
+
'anchor:anchor': 2900,
|
|
17
|
+
'smart-button:quick-insert': 3000
|
|
18
|
+
};
|
|
19
|
+
var UNRECOGNIZED_STRUCTURE_EXTENSION_ITEM_RANK = 3100;
|
|
20
|
+
var getStructureExtensionItemRank = function getStructureExtensionItemRank(item) {
|
|
21
|
+
return structureExtensionItemKeyRanks[item.key];
|
|
22
|
+
};
|
|
23
|
+
var isStructureExtensionItem = function isStructureExtensionItem(item) {
|
|
24
|
+
return getQuickInsertMenuItemParents({
|
|
25
|
+
categories: item.categories,
|
|
26
|
+
rank: 0
|
|
27
|
+
}).some(function (parent) {
|
|
28
|
+
return parent.key === STRUCTURE_SECTION.key;
|
|
29
|
+
});
|
|
30
|
+
};
|
|
6
31
|
export var getExtensionQuickInsertComponents = function getExtensionQuickInsertComponents(_ref) {
|
|
7
32
|
var apiRef = _ref.apiRef,
|
|
8
33
|
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
9
34
|
items = _ref.items;
|
|
35
|
+
var unrecognizedStructureItemRanks = new Map(items.filter(isStructureExtensionItem).filter(function (item) {
|
|
36
|
+
return getStructureExtensionItemRank(item) === undefined;
|
|
37
|
+
}).sort(function (firstItem, secondItem) {
|
|
38
|
+
return firstItem.title.localeCompare(secondItem.title) || firstItem.key.localeCompare(secondItem.key);
|
|
39
|
+
}).map(function (item, index) {
|
|
40
|
+
return [item, UNRECOGNIZED_STRUCTURE_EXTENSION_ITEM_RANK + index];
|
|
41
|
+
}));
|
|
10
42
|
return items.map(function (item, index) {
|
|
11
|
-
var _item$priority;
|
|
43
|
+
var _unrecognizedStructur, _item$priority;
|
|
44
|
+
var structureRank = getStructureExtensionItemRank(item);
|
|
45
|
+
var isStructureItem = structureRank !== undefined;
|
|
46
|
+
var categories = isStructureItem ? ['structure'] : item.categories;
|
|
47
|
+
var fallbackRank = (_unrecognizedStructur = unrecognizedStructureItemRanks.get(item)) !== null && _unrecognizedStructur !== void 0 ? _unrecognizedStructur : EXTENSION_ITEM_RANK + ((_item$priority = item.priority) !== null && _item$priority !== void 0 ? _item$priority : index);
|
|
12
48
|
return {
|
|
13
49
|
type: 'menu-item',
|
|
14
50
|
key: item.key,
|
|
15
51
|
parents: getQuickInsertMenuItemParents({
|
|
16
|
-
categories:
|
|
17
|
-
rank:
|
|
52
|
+
categories: categories,
|
|
53
|
+
rank: structureRank !== null && structureRank !== void 0 ? structureRank : fallbackRank
|
|
18
54
|
}),
|
|
19
55
|
match: createQuickInsertMatcher(function () {
|
|
20
56
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "226.
|
|
3
|
+
"version": "226.3.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"@atlaskit/feature-gate-js-client": "^6.0.0",
|
|
63
63
|
"@atlaskit/heading": "^7.2.0",
|
|
64
64
|
"@atlaskit/icon": "^37.6.0",
|
|
65
|
+
"@atlaskit/icon-lab": "^7.7.0",
|
|
65
66
|
"@atlaskit/link": "^5.1.0",
|
|
66
67
|
"@atlaskit/media-card": "^81.9.0",
|
|
67
68
|
"@atlaskit/mention": "^27.19.0",
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
74
75
|
"@atlaskit/react-ufo": "^7.7.0",
|
|
75
76
|
"@atlaskit/task-decision": "^21.9.0",
|
|
76
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
77
|
+
"@atlaskit/tmp-editor-statsig": "^169.0.0",
|
|
77
78
|
"@atlaskit/tokens": "^16.10.0",
|
|
78
79
|
"@atlaskit/tooltip": "^24.3.0",
|
|
79
80
|
"@atlaskit/width-detector": "^7.2.0",
|
|
@@ -91,7 +92,7 @@
|
|
|
91
92
|
"uuid": "^3.1.0"
|
|
92
93
|
},
|
|
93
94
|
"peerDependencies": {
|
|
94
|
-
"@atlaskit/editor-common": "^120.
|
|
95
|
+
"@atlaskit/editor-common": "^120.10.0",
|
|
95
96
|
"@atlaskit/link-provider": "^5.5.0",
|
|
96
97
|
"@atlaskit/media-core": "^38.2.0",
|
|
97
98
|
"react": "^18.2.0",
|