@atlaskit/editor-common 131.0.0 → 131.1.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 +35 -0
- package/dist/cjs/extensibility/Extension/Extension/index.js +23 -2
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/portal/PortalBucket.js +51 -11
- package/dist/cjs/portal/PortalManager.js +6 -3
- package/dist/cjs/preset/core-plugin/index.js +4 -20
- package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.js +6 -6
- package/dist/cjs/quick-insert/QuickInsertSearchResultsSection.js +19 -0
- package/dist/cjs/quick-insert/get-quick-insert-menu-model.js +20 -31
- package/dist/cjs/quick-insert/getQuickInsertMenuRows.js +2 -2
- package/dist/cjs/quick-insert/keys.js +10 -1
- package/dist/cjs/quick-insert/messages.js +5 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/OverflowShadow/index.js +14 -2
- package/dist/es2019/extensibility/Extension/Extension/index.js +21 -2
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/portal/PortalBucket.js +48 -12
- package/dist/es2019/portal/PortalManager.js +6 -3
- package/dist/es2019/preset/core-plugin/index.js +4 -20
- package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.js +6 -6
- package/dist/es2019/quick-insert/QuickInsertSearchResultsSection.js +14 -0
- package/dist/es2019/quick-insert/get-quick-insert-menu-model.js +15 -17
- package/dist/es2019/quick-insert/getQuickInsertMenuRows.js +2 -2
- package/dist/es2019/quick-insert/keys.js +9 -0
- package/dist/es2019/quick-insert/messages.js +5 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/OverflowShadow/index.js +12 -2
- package/dist/esm/extensibility/Extension/Extension/index.js +23 -2
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/portal/PortalBucket.js +52 -12
- package/dist/esm/portal/PortalManager.js +6 -3
- package/dist/esm/preset/core-plugin/index.js +4 -20
- package/dist/esm/quick-insert/CompactQuickInsertMenuItem.js +6 -6
- package/dist/esm/quick-insert/QuickInsertSearchResultsSection.js +12 -0
- package/dist/esm/quick-insert/get-quick-insert-menu-model.js +21 -32
- package/dist/esm/quick-insert/getQuickInsertMenuRows.js +2 -2
- package/dist/esm/quick-insert/keys.js +9 -0
- package/dist/esm/quick-insert/messages.js +5 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/OverflowShadow/index.js +14 -2
- package/dist/types/quick-insert/QuickInsertSearchResultsSection.d.ts +2 -0
- package/dist/types/quick-insert/get-quick-insert-menu-model.d.ts +4 -1
- package/dist/types/quick-insert/keys.d.ts +8 -0
- package/dist/types/quick-insert/messages.d.ts +1 -1
- package/dist/types/ui/OverflowShadow/index.d.ts +5 -0
- package/package.json +2 -5
|
@@ -9,8 +9,19 @@ import { getComponentIdentity, resolveSurface, willComponentRender } from '@atla
|
|
|
9
9
|
import { isMenuFooterSectionKey } from '../type-ahead/isMenuFooterSectionKey';
|
|
10
10
|
import { isSectionOverflowItemKey } from '../type-ahead/isSectionOverflowItemKey';
|
|
11
11
|
import { applyRegisteredItemRanks } from '../type-ahead/item-rank';
|
|
12
|
-
import { ASK_ROVO_MENU_ITEM } from './keys';
|
|
12
|
+
import { ASK_ROVO_MENU_ITEM, MENU, SEARCH_RESULTS_SECTION } from './keys';
|
|
13
|
+
import { QuickInsertSearchResultsSection } from './QuickInsertSearchResultsSection';
|
|
13
14
|
var SEARCH_TOP_MATCH_LIMIT = 5;
|
|
15
|
+
var SEARCH_RESULTS_HEADING = {
|
|
16
|
+
key: SEARCH_RESULTS_SECTION.key,
|
|
17
|
+
type: SEARCH_RESULTS_SECTION.type,
|
|
18
|
+
component: QuickInsertSearchResultsSection,
|
|
19
|
+
parents: [{
|
|
20
|
+
key: MENU.key,
|
|
21
|
+
type: MENU.type,
|
|
22
|
+
rank: 0
|
|
23
|
+
}]
|
|
24
|
+
};
|
|
14
25
|
var getParentRank = function getParentRank(component, parentKey) {
|
|
15
26
|
var _component$parents$fi, _component$parents;
|
|
16
27
|
return (_component$parents$fi = (_component$parents = component.parents) === null || _component$parents === void 0 || (_component$parents = _component$parents.find(function (parent) {
|
|
@@ -99,12 +110,12 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
99
110
|
try {
|
|
100
111
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
101
112
|
var section = _step2.value;
|
|
102
|
-
var
|
|
103
|
-
|
|
113
|
+
var _iterator3 = _createForOfIteratorHelper(getRenderedMenuItems(section, childrenMap, surfaceContext)),
|
|
114
|
+
_step3;
|
|
104
115
|
try {
|
|
105
|
-
for (
|
|
116
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
106
117
|
var _item$match, _match$score, _sourceIndexByCompone;
|
|
107
|
-
var item =
|
|
118
|
+
var item = _step3.value;
|
|
108
119
|
if (isSectionOverflowItemKey(item.key)) {
|
|
109
120
|
continue;
|
|
110
121
|
}
|
|
@@ -121,7 +132,6 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
121
132
|
itemRank: getParentRank(item, section.key),
|
|
122
133
|
score: Math.min(1, Math.max(0, (_match$score = match === null || match === void 0 ? void 0 : match.score) !== null && _match$score !== void 0 ? _match$score : 0)),
|
|
123
134
|
sourceIndex: (_sourceIndexByCompone = sourceIndexByComponent.get(item)) !== null && _sourceIndexByCompone !== void 0 ? _sourceIndexByCompone : Number.MAX_SAFE_INTEGER,
|
|
124
|
-
section: section,
|
|
125
135
|
sectionRank: getParentRank(section, root.key)
|
|
126
136
|
};
|
|
127
137
|
var existing = matches.get(candidate.identity);
|
|
@@ -130,9 +140,9 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
130
140
|
}
|
|
131
141
|
}
|
|
132
142
|
} catch (err) {
|
|
133
|
-
|
|
143
|
+
_iterator3.e(err);
|
|
134
144
|
} finally {
|
|
135
|
-
|
|
145
|
+
_iterator3.f();
|
|
136
146
|
}
|
|
137
147
|
}
|
|
138
148
|
} catch (err) {
|
|
@@ -142,29 +152,9 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
142
152
|
}
|
|
143
153
|
var uniqueMatches = Array.from(matches.values()).sort(compareMatchedItems);
|
|
144
154
|
var searchResults = getSearchResults(uniqueMatches);
|
|
145
|
-
|
|
146
|
-
var _iterator3 = _createForOfIteratorHelper(uniqueMatches),
|
|
147
|
-
_step3;
|
|
148
|
-
try {
|
|
149
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
150
|
-
var _match = _step3.value;
|
|
151
|
-
var _existing = sectionsByKey.get(_match.section.key);
|
|
152
|
-
if (_existing) {
|
|
153
|
-
_existing.push(_match.item);
|
|
154
|
-
} else {
|
|
155
|
-
sectionsByKey.set(_match.section.key, [_match.section, _match.item]);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
} catch (err) {
|
|
159
|
-
_iterator3.e(err);
|
|
160
|
-
} finally {
|
|
161
|
-
_iterator3.f();
|
|
162
|
-
}
|
|
163
|
-
var sections = Array.from(sectionsByKey.values());
|
|
164
|
-
if (sections.length > 0) {
|
|
155
|
+
if (searchResults.length > 0) {
|
|
165
156
|
return {
|
|
166
|
-
|
|
167
|
-
sections: sections
|
|
157
|
+
sections: [[SEARCH_RESULTS_HEADING].concat(_toConsumableArray(searchResults))]
|
|
168
158
|
};
|
|
169
159
|
}
|
|
170
160
|
var fallbackItem = contentSections.flatMap(function (section) {
|
|
@@ -175,8 +165,7 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
175
165
|
});
|
|
176
166
|
return {
|
|
177
167
|
fallbackItems: fallbackItem ? [fallbackItem] : [],
|
|
178
|
-
|
|
179
|
-
sections: sections
|
|
168
|
+
sections: []
|
|
180
169
|
};
|
|
181
170
|
};
|
|
182
171
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
export var getQuickInsertMenuRows = function getQuickInsertMenuRows(model) {
|
|
3
|
-
var _model$
|
|
4
|
-
return [].concat(_toConsumableArray(
|
|
3
|
+
var _model$fallbackItems;
|
|
4
|
+
return [].concat(_toConsumableArray(model.sections.flat()), _toConsumableArray((_model$fallbackItems = model.fallbackItems) !== null && _model$fallbackItems !== void 0 ? _model$fallbackItems : []));
|
|
5
5
|
};
|
|
@@ -44,6 +44,15 @@ export var OTHER_SECTION = {
|
|
|
44
44
|
key: 'quick-insert-other-section',
|
|
45
45
|
type: 'menu-section'
|
|
46
46
|
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Heading shown above the matching items when the menu has a search query. It is not registered,
|
|
50
|
+
* so it never appears in browse mode.
|
|
51
|
+
*/
|
|
52
|
+
export var SEARCH_RESULTS_SECTION = {
|
|
53
|
+
key: 'quick-insert-search-results-section',
|
|
54
|
+
type: 'menu-section'
|
|
55
|
+
};
|
|
47
56
|
export var VIEW_ALL_ELEMENTS_MENU_ITEM = {
|
|
48
57
|
key: 'quick-insert-view-all-elements-menu-item',
|
|
49
58
|
type: 'menu-item'
|
|
@@ -135,6 +135,11 @@ export var messages = defineMessages({
|
|
|
135
135
|
defaultMessage: 'Other elements',
|
|
136
136
|
description: 'Other items in the Quick Insert menu.'
|
|
137
137
|
},
|
|
138
|
+
searchResults: {
|
|
139
|
+
id: 'editor-common.quick-insert.searchResults',
|
|
140
|
+
defaultMessage: 'Search results',
|
|
141
|
+
description: 'Heading shown above the matching items when searching in the Quick Insert menu.'
|
|
142
|
+
},
|
|
138
143
|
previewAttributionBy: {
|
|
139
144
|
id: 'editor-common.quick-insert.previewAttributionBy',
|
|
140
145
|
defaultMessage: 'By {name}',
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "131.0.
|
|
24
|
+
var packageVersion = "131.0.1";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -36,7 +36,7 @@ export default function overflowShadow(Component, options) {
|
|
|
36
36
|
_this.updateShadows();
|
|
37
37
|
});
|
|
38
38
|
_defineProperty(_this, "updateShadows", function () {
|
|
39
|
-
if (options.useShadowObserver) {
|
|
39
|
+
if (_this.isDisabled || options.useShadowObserver) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
_this.setState(function (prevState) {
|
|
@@ -90,6 +90,9 @@ export default function overflowShadow(Component, options) {
|
|
|
90
90
|
if (!_this.overflowContainer) {
|
|
91
91
|
_this.overflowContainer = container;
|
|
92
92
|
}
|
|
93
|
+
if (_this.isDisabled) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
93
96
|
if (options.useShadowObserver) {
|
|
94
97
|
_this.initShadowObserver();
|
|
95
98
|
return;
|
|
@@ -103,6 +106,15 @@ export default function overflowShadow(Component, options) {
|
|
|
103
106
|
}
|
|
104
107
|
_inherits(OverflowShadow, _React$Component);
|
|
105
108
|
return _createClass(OverflowShadow, [{
|
|
109
|
+
key: "isDisabled",
|
|
110
|
+
get: function get() {
|
|
111
|
+
if (this.disabled === undefined) {
|
|
112
|
+
var _options$isDisabled, _options$isDisabled2;
|
|
113
|
+
this.disabled = (_options$isDisabled = (_options$isDisabled2 = options.isDisabled) === null || _options$isDisabled2 === void 0 ? void 0 : _options$isDisabled2.call(options)) !== null && _options$isDisabled !== void 0 ? _options$isDisabled : false;
|
|
114
|
+
}
|
|
115
|
+
return this.disabled;
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
106
118
|
key: "componentWillUnmount",
|
|
107
119
|
value: function componentWillUnmount() {
|
|
108
120
|
if (options.useShadowObserver) {
|
|
@@ -153,7 +165,7 @@ export default function overflowShadow(Component, options) {
|
|
|
153
165
|
var _this$state = this.state,
|
|
154
166
|
showLeftShadow = _this$state.showLeftShadow,
|
|
155
167
|
showRightShadow = _this$state.showRightShadow;
|
|
156
|
-
var classNames = [!((_this$props = this.props) !== null && _this$props !== void 0 && _this$props.disableTableOverflowShadow) && showRightShadow && shadowClassNames.RIGHT_SHADOW, !((_this$props2 = this.props) !== null && _this$props2 !== void 0 && _this$props2.disableTableOverflowShadow) && showLeftShadow && shadowClassNames.LEFT_SHADOW, options.useShadowObserver && shadowObserverClassNames.SHADOW_CONTAINER].filter(Boolean).join(' ');
|
|
168
|
+
var classNames = this.isDisabled ? '' : [!((_this$props = this.props) !== null && _this$props !== void 0 && _this$props.disableTableOverflowShadow) && showRightShadow && shadowClassNames.RIGHT_SHADOW, !((_this$props2 = this.props) !== null && _this$props2 !== void 0 && _this$props2.disableTableOverflowShadow) && showLeftShadow && shadowClassNames.LEFT_SHADOW, options.useShadowObserver && shadowObserverClassNames.SHADOW_CONTAINER].filter(Boolean).join(' ');
|
|
157
169
|
|
|
158
170
|
/**
|
|
159
171
|
* The widths have already been calculated to determine
|
|
@@ -8,7 +8,10 @@ export type QuickInsertMenuModel = {
|
|
|
8
8
|
fallbackItems?: RegisterMenuItem[];
|
|
9
9
|
footer: RegisterMenuItem | undefined;
|
|
10
10
|
root: RegisterComponent | undefined;
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Groups to render, in order. Browse returns one group per category. A search with matches
|
|
13
|
+
* returns a single Search results group of ranked matches.
|
|
14
|
+
*/
|
|
12
15
|
sections: QuickInsertMenuSection[];
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
@@ -42,6 +42,14 @@ export declare const OTHER_SECTION: {
|
|
|
42
42
|
readonly key: 'quick-insert-other-section';
|
|
43
43
|
readonly type: 'menu-section';
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Heading shown above the matching items when the menu has a search query. It is not registered,
|
|
47
|
+
* so it never appears in browse mode.
|
|
48
|
+
*/
|
|
49
|
+
export declare const SEARCH_RESULTS_SECTION: {
|
|
50
|
+
readonly key: 'quick-insert-search-results-section';
|
|
51
|
+
readonly type: 'menu-section';
|
|
52
|
+
};
|
|
45
53
|
export declare const VIEW_ALL_ELEMENTS_MENU_ITEM: {
|
|
46
54
|
readonly key: 'quick-insert-view-all-elements-menu-item';
|
|
47
55
|
readonly type: 'menu-item';
|
|
@@ -3,5 +3,5 @@ type Messages<Keys extends string> = Record<Keys, MessageDescriptor & {
|
|
|
3
3
|
defaultMessage: string;
|
|
4
4
|
id: string;
|
|
5
5
|
}>;
|
|
6
|
-
export declare const messages: Messages<'admin' | 'AI' | 'all' | 'browse' | 'categoryBlockTemplates' | 'categoryCreate' | 'categoryDataAndCharts' | 'categoryEmbed' | 'categoryMedia' | 'categoryOther' | 'categoryRecommended' | 'categoryRovo' | 'categoryStructure' | 'categoryTextFormatting' | 'previewAttributionBy' | 'previewAttributionAtlassian' | 'previewAttributionAssets' | 'previewAttributionConfluence' | 'previewAttributionJira' | 'previewAttributionJiraServiceManagement' | 'previewAttributionMicrosoft' | 'close' | 'communication' | 'confluence-content' | 'development' | 'external-content' | 'featuredWhiteboardDescription' | 'formatting' | 'help' | 'insert' | 'media' | 'navigation' | 'reporting' | 'visuals'>;
|
|
6
|
+
export declare const messages: Messages<'admin' | 'AI' | 'all' | 'browse' | 'categoryBlockTemplates' | 'categoryCreate' | 'categoryDataAndCharts' | 'categoryEmbed' | 'categoryMedia' | 'categoryOther' | 'categoryRecommended' | 'categoryRovo' | 'categoryStructure' | 'categoryTextFormatting' | 'searchResults' | 'previewAttributionBy' | 'previewAttributionAtlassian' | 'previewAttributionAssets' | 'previewAttributionConfluence' | 'previewAttributionJira' | 'previewAttributionJiraServiceManagement' | 'previewAttributionMicrosoft' | 'close' | 'communication' | 'confluence-content' | 'development' | 'external-content' | 'featuredWhiteboardDescription' | 'formatting' | 'help' | 'insert' | 'media' | 'navigation' | 'reporting' | 'visuals'>;
|
|
7
7
|
export {};
|
|
@@ -14,6 +14,11 @@ export interface OverflowShadowState {
|
|
|
14
14
|
showRightShadow: boolean;
|
|
15
15
|
}
|
|
16
16
|
export interface OverflowShadowOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Opts the wrapped component out of the JavaScript driven shadows entirely: no scroll listeners
|
|
19
|
+
* or intersection observers are registered
|
|
20
|
+
*/
|
|
21
|
+
isDisabled?: () => boolean;
|
|
17
22
|
overflowSelector: string;
|
|
18
23
|
useShadowObserver?: boolean;
|
|
19
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "131.
|
|
3
|
+
"version": "131.1.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@atlaskit/task-decision": "^21.12.0",
|
|
86
86
|
"@atlaskit/teams-app-config": "^3.1.0",
|
|
87
87
|
"@atlaskit/textfield": "^10.2.0",
|
|
88
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
88
|
+
"@atlaskit/tmp-editor-statsig": "^237.0.0",
|
|
89
89
|
"@atlaskit/tokens": "^20.5.0",
|
|
90
90
|
"@atlaskit/tooltip": "^24.4.0",
|
|
91
91
|
"@atlaskit/width-detector": "^7.2.0",
|
|
@@ -229,9 +229,6 @@
|
|
|
229
229
|
"platform_editor_panel_c1_fallback_transform": {
|
|
230
230
|
"type": "boolean"
|
|
231
231
|
},
|
|
232
|
-
"platform_editor_fix_scroll_to_pos": {
|
|
233
|
-
"type": "boolean"
|
|
234
|
-
},
|
|
235
232
|
"platform_editor_custom_emoji_unicode_fallback": {
|
|
236
233
|
"type": "boolean"
|
|
237
234
|
},
|