@atlaskit/editor-common 133.7.2 → 134.0.1
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/dist/cjs/insert/index.js +1 -0
- package/dist/cjs/lists/messages.js +3 -3
- package/dist/cjs/messages/block-type.js +9 -9
- package/dist/cjs/messages/card.js +4 -4
- package/dist/cjs/messages/insert-block.js +8 -8
- package/dist/cjs/messages/layout.js +5 -5
- package/dist/cjs/messages/list.js +3 -3
- package/dist/cjs/messages/snippets.js +1 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/quick-insert/QuickInsertContext.js +4 -0
- package/dist/cjs/quick-insert/QuickInsertMenuItem.js +4 -1
- package/dist/cjs/registered-menu/ActiveMenuItemKeyContext.js +11 -0
- package/dist/cjs/registered-menu/MeasuredRow.js +41 -0
- package/dist/cjs/registered-menu/RegisteredMenuContext.js +15 -0
- package/dist/cjs/registered-menu/RegisteredMenuList.js +224 -0
- package/dist/cjs/registered-menu/RegisteredMenuListItemRow.js +62 -0
- package/dist/cjs/registered-menu/RegisteredMenuSurfaceContext.js +12 -0
- package/dist/cjs/registered-menu/getRegisteredMenuRows.js +11 -0
- package/dist/cjs/registered-menu/types.js +5 -0
- package/dist/cjs/{quick-insert/use-menu-list-height.js → registered-menu/useMenuListHeight.js} +15 -11
- package/dist/cjs/{quick-insert/use-menu-popup-sizing.js → registered-menu/useMenuPopupSizing.js} +5 -1
- package/dist/cjs/registered-menu/useRegisteredMenu.js +133 -0
- package/dist/cjs/registered-menu/useRegisteredMenuSelection.js +53 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/insert/index.js +3 -0
- package/dist/es2019/lists/messages.js +3 -3
- package/dist/es2019/messages/block-type.js +9 -9
- package/dist/es2019/messages/card.js +4 -4
- package/dist/es2019/messages/insert-block.js +8 -8
- package/dist/es2019/messages/layout.js +5 -5
- package/dist/es2019/messages/list.js +3 -3
- package/dist/es2019/messages/snippets.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/quick-insert/QuickInsertContext.js +4 -0
- package/dist/es2019/quick-insert/QuickInsertMenuItem.js +4 -1
- package/dist/es2019/registered-menu/ActiveMenuItemKeyContext.js +5 -0
- package/dist/es2019/registered-menu/MeasuredRow.js +32 -0
- package/dist/es2019/registered-menu/RegisteredMenuContext.js +9 -0
- package/dist/es2019/registered-menu/RegisteredMenuList.js +177 -0
- package/dist/es2019/registered-menu/RegisteredMenuListItemRow.js +47 -0
- package/dist/es2019/registered-menu/RegisteredMenuSurfaceContext.js +4 -0
- package/dist/es2019/registered-menu/getRegisteredMenuRows.js +1 -0
- package/dist/es2019/registered-menu/types.js +1 -0
- package/dist/es2019/{quick-insert/use-menu-list-height.js → registered-menu/useMenuListHeight.js} +14 -10
- package/dist/es2019/{quick-insert/use-menu-popup-sizing.js → registered-menu/useMenuPopupSizing.js} +5 -1
- package/dist/es2019/registered-menu/useRegisteredMenu.js +120 -0
- package/dist/es2019/registered-menu/useRegisteredMenuSelection.js +39 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/insert/index.js +3 -0
- package/dist/esm/lists/messages.js +3 -3
- package/dist/esm/messages/block-type.js +9 -9
- package/dist/esm/messages/card.js +4 -4
- package/dist/esm/messages/insert-block.js +8 -8
- package/dist/esm/messages/layout.js +5 -5
- package/dist/esm/messages/list.js +3 -3
- package/dist/esm/messages/snippets.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/quick-insert/QuickInsertContext.js +4 -0
- package/dist/esm/quick-insert/QuickInsertMenuItem.js +4 -1
- package/dist/esm/registered-menu/ActiveMenuItemKeyContext.js +5 -0
- package/dist/esm/registered-menu/MeasuredRow.js +33 -0
- package/dist/esm/registered-menu/RegisteredMenuContext.js +9 -0
- package/dist/esm/registered-menu/RegisteredMenuList.js +215 -0
- package/dist/esm/registered-menu/RegisteredMenuListItemRow.js +54 -0
- package/dist/esm/registered-menu/RegisteredMenuSurfaceContext.js +6 -0
- package/dist/esm/registered-menu/getRegisteredMenuRows.js +4 -0
- package/dist/esm/registered-menu/types.js +1 -0
- package/dist/esm/{quick-insert/use-menu-list-height.js → registered-menu/useMenuListHeight.js} +15 -11
- package/dist/esm/{quick-insert/use-menu-popup-sizing.js → registered-menu/useMenuPopupSizing.js} +5 -1
- package/dist/esm/registered-menu/useRegisteredMenu.js +126 -0
- package/dist/esm/registered-menu/useRegisteredMenuSelection.js +46 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/insert/index.d.ts +5 -1
- package/dist/types/quick-insert/QuickInsertContext.d.ts +6 -5
- package/dist/types/quick-insert/QuickInsertMenuItem.d.ts +2 -2
- package/dist/types/quick-insert/quick-insert-rank.d.ts +1 -1
- package/dist/types/registered-menu/ActiveMenuItemKeyContext.d.ts +2 -0
- package/dist/types/registered-menu/MeasuredRow.d.ts +10 -0
- package/dist/types/registered-menu/RegisteredMenuContext.d.ts +4 -0
- package/dist/types/registered-menu/RegisteredMenuList.d.ts +31 -0
- package/dist/types/registered-menu/RegisteredMenuListItemRow.d.ts +28 -0
- package/dist/types/registered-menu/RegisteredMenuSurfaceContext.d.ts +7 -0
- package/dist/types/registered-menu/getRegisteredMenuRows.d.ts +4 -0
- package/dist/types/registered-menu/types.d.ts +55 -0
- package/dist/types/{quick-insert/use-menu-list-height.d.ts → registered-menu/useMenuListHeight.d.ts} +5 -1
- package/dist/types/{quick-insert/use-menu-popup-sizing.d.ts → registered-menu/useMenuPopupSizing.d.ts} +5 -1
- package/dist/types/registered-menu/useRegisteredMenu.d.ts +28 -0
- package/dist/types/registered-menu/useRegisteredMenuSelection.d.ts +16 -0
- package/dist/types/type-ahead/index.d.ts +0 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/quick-insert.d.ts +1 -1
- package/dist/types/types/type-ahead.d.ts +9 -6
- package/package.json +9 -9
- package/registered-menu/context/package.json +10 -0
- package/registered-menu/item-rank/package.json +10 -0
- package/registered-menu/list/package.json +10 -0
- package/registered-menu/list-height/package.json +10 -0
- package/registered-menu/package.json +10 -0
- package/registered-menu/popup-sizing/package.json +10 -0
- package/registered-menu/rows/package.json +10 -0
- package/registered-menu/surface-context/package.json +10 -0
- package/registered-menu/use-registered-menu/package.json +10 -0
- package/dist/cjs/quick-insert/QuickInsertEmptyState.compiled.css +0 -11
- package/dist/cjs/quick-insert/QuickInsertEmptyState.js +0 -61
- package/dist/cjs/quick-insert/QuickInsertMenuRoot.js +0 -13
- package/dist/cjs/quick-insert/QuickInsertMenuSection.js +0 -23
- package/dist/cjs/quick-insert/QuickInsertSearchResultsSection.js +0 -19
- package/dist/cjs/quick-insert/assets/no-results.js +0 -36
- package/dist/cjs/quick-insert/get-quick-insert-menu-model.js +0 -234
- package/dist/cjs/quick-insert/getQuickInsertMenuRows.js +0 -12
- package/dist/cjs/quick-insert/registered-menu-model.js +0 -33
- package/dist/cjs/quick-insert/selectQuickInsertCategoryItems.js +0 -27
- package/dist/cjs/quick-insert/useQuickInsertSearchAnalytics.js +0 -100
- package/dist/cjs/type-ahead/TypeAheadSurfaceContext.js +0 -11
- package/dist/es2019/quick-insert/QuickInsertEmptyState.compiled.css +0 -11
- package/dist/es2019/quick-insert/QuickInsertEmptyState.js +0 -47
- package/dist/es2019/quick-insert/QuickInsertMenuRoot.js +0 -5
- package/dist/es2019/quick-insert/QuickInsertMenuSection.js +0 -15
- package/dist/es2019/quick-insert/QuickInsertSearchResultsSection.js +0 -14
- package/dist/es2019/quick-insert/assets/no-results.js +0 -30
- package/dist/es2019/quick-insert/get-quick-insert-menu-model.js +0 -174
- package/dist/es2019/quick-insert/getQuickInsertMenuRows.js +0 -4
- package/dist/es2019/quick-insert/registered-menu-model.js +0 -6
- package/dist/es2019/quick-insert/selectQuickInsertCategoryItems.js +0 -19
- package/dist/es2019/quick-insert/useQuickInsertSearchAnalytics.js +0 -91
- package/dist/es2019/type-ahead/TypeAheadSurfaceContext.js +0 -5
- package/dist/esm/quick-insert/QuickInsertEmptyState.compiled.css +0 -11
- package/dist/esm/quick-insert/QuickInsertEmptyState.js +0 -50
- package/dist/esm/quick-insert/QuickInsertMenuRoot.js +0 -6
- package/dist/esm/quick-insert/QuickInsertMenuSection.js +0 -16
- package/dist/esm/quick-insert/QuickInsertSearchResultsSection.js +0 -12
- package/dist/esm/quick-insert/assets/no-results.js +0 -29
- package/dist/esm/quick-insert/get-quick-insert-menu-model.js +0 -227
- package/dist/esm/quick-insert/getQuickInsertMenuRows.js +0 -5
- package/dist/esm/quick-insert/registered-menu-model.js +0 -6
- package/dist/esm/quick-insert/selectQuickInsertCategoryItems.js +0 -21
- package/dist/esm/quick-insert/useQuickInsertSearchAnalytics.js +0 -93
- package/dist/esm/type-ahead/TypeAheadSurfaceContext.js +0 -5
- package/dist/types/quick-insert/QuickInsertEmptyState.d.ts +0 -7
- package/dist/types/quick-insert/QuickInsertMenuRoot.d.ts +0 -2
- package/dist/types/quick-insert/QuickInsertMenuSection.d.ts +0 -4
- package/dist/types/quick-insert/QuickInsertSearchResultsSection.d.ts +0 -2
- package/dist/types/quick-insert/assets/no-results.d.ts +0 -7
- package/dist/types/quick-insert/get-quick-insert-menu-model.d.ts +0 -29
- package/dist/types/quick-insert/getQuickInsertMenuRows.d.ts +0 -3
- package/dist/types/quick-insert/registered-menu-model.d.ts +0 -6
- package/dist/types/quick-insert/selectQuickInsertCategoryItems.d.ts +0 -7
- package/dist/types/quick-insert/useQuickInsertSearchAnalytics.d.ts +0 -12
- package/dist/types/type-ahead/TypeAheadSurfaceContext.d.ts +0 -8
- package/quick-insert/empty-state/package.json +0 -10
- package/quick-insert/menu-root/package.json +0 -10
- package/quick-insert/menu-section/package.json +0 -10
- package/quick-insert/registered-menu-model/package.json +0 -10
- package/quick-insert/use-menu-list-height/package.json +0 -10
- package/quick-insert/use-menu-popup-sizing/package.json +0 -10
- package/quick-insert/use-search-analytics/package.json +0 -10
- package/type-ahead/item-rank/package.json +0 -10
- package/type-ahead-surface-context/package.json +0 -10
- /package/dist/cjs/{type-ahead → registered-menu}/item-rank.js +0 -0
- /package/dist/es2019/{type-ahead → registered-menu}/item-rank.js +0 -0
- /package/dist/esm/{type-ahead → registered-menu}/item-rank.js +0 -0
- /package/dist/types/{type-ahead → registered-menu}/item-rank.d.ts +0 -0
|
@@ -17,7 +17,7 @@ export var messages = defineMessages({
|
|
|
17
17
|
},
|
|
18
18
|
heading1Description: {
|
|
19
19
|
id: 'fabric.editor.heading1Description',
|
|
20
|
-
defaultMessage: '
|
|
20
|
+
defaultMessage: 'Insert a level 1 heading',
|
|
21
21
|
description: 'Description of the main heading, heading 1'
|
|
22
22
|
},
|
|
23
23
|
heading2: {
|
|
@@ -27,7 +27,7 @@ export var messages = defineMessages({
|
|
|
27
27
|
},
|
|
28
28
|
heading2Description: {
|
|
29
29
|
id: 'fabric.editor.heading2Description',
|
|
30
|
-
defaultMessage: '
|
|
30
|
+
defaultMessage: 'Insert a level 2 heading',
|
|
31
31
|
description: 'Description of a subtitle heading or secondary heading'
|
|
32
32
|
},
|
|
33
33
|
heading3: {
|
|
@@ -37,7 +37,7 @@ export var messages = defineMessages({
|
|
|
37
37
|
},
|
|
38
38
|
heading3Description: {
|
|
39
39
|
id: 'fabric.editor.heading3Description',
|
|
40
|
-
defaultMessage: '
|
|
40
|
+
defaultMessage: 'Insert a level 3 heading',
|
|
41
41
|
description: 'Description text shown in the block type menu to help users understand when to use Heading 3 for sub sections and group headings in the editor.'
|
|
42
42
|
},
|
|
43
43
|
heading4: {
|
|
@@ -47,7 +47,7 @@ export var messages = defineMessages({
|
|
|
47
47
|
},
|
|
48
48
|
heading4Description: {
|
|
49
49
|
id: 'fabric.editor.heading4Description',
|
|
50
|
-
defaultMessage: '
|
|
50
|
+
defaultMessage: 'Insert a level 4 heading',
|
|
51
51
|
description: 'Description text shown in the block type menu to help users understand when to use Heading 4 for deep headings in the editor.'
|
|
52
52
|
},
|
|
53
53
|
heading5: {
|
|
@@ -57,7 +57,7 @@ export var messages = defineMessages({
|
|
|
57
57
|
},
|
|
58
58
|
heading5Description: {
|
|
59
59
|
id: 'fabric.editor.heading5Description',
|
|
60
|
-
defaultMessage: '
|
|
60
|
+
defaultMessage: 'Insert a level 5 heading',
|
|
61
61
|
description: 'Description text shown in the block type menu to help users understand when to use Heading 5 for grouping list items in the editor.'
|
|
62
62
|
},
|
|
63
63
|
heading6: {
|
|
@@ -67,7 +67,7 @@ export var messages = defineMessages({
|
|
|
67
67
|
},
|
|
68
68
|
heading6Description: {
|
|
69
69
|
id: 'fabric.editor.heading6Description',
|
|
70
|
-
defaultMessage: '
|
|
70
|
+
defaultMessage: 'Insert a level 6 heading',
|
|
71
71
|
description: 'Description text shown in the block type menu to help users understand when to use Heading 6 for low level headings in the editor.'
|
|
72
72
|
},
|
|
73
73
|
blockquote: {
|
|
@@ -127,7 +127,7 @@ export var messages = defineMessages({
|
|
|
127
127
|
},
|
|
128
128
|
warningPanelDescription: {
|
|
129
129
|
id: 'fabric.editor.warningPanel.description',
|
|
130
|
-
defaultMessage: 'Add a
|
|
130
|
+
defaultMessage: 'Add a caution in a colored panel',
|
|
131
131
|
description: 'Visually distinguishes your text by adding a warning panel'
|
|
132
132
|
},
|
|
133
133
|
errorPanel: {
|
|
@@ -147,7 +147,7 @@ export var messages = defineMessages({
|
|
|
147
147
|
},
|
|
148
148
|
customPanelDescription: {
|
|
149
149
|
id: 'fabric.editor.customPanel.description',
|
|
150
|
-
defaultMessage: 'Add a
|
|
150
|
+
defaultMessage: 'Add a panel with colors and emojis',
|
|
151
151
|
description: 'Visually distinguishes your panel by adding a emoji icon and background color '
|
|
152
152
|
},
|
|
153
153
|
syncedBlock: {
|
|
@@ -167,7 +167,7 @@ export var messages = defineMessages({
|
|
|
167
167
|
},
|
|
168
168
|
syncedBlockDescription: {
|
|
169
169
|
id: 'fabric.editor.syncedBlock.description',
|
|
170
|
-
defaultMessage: '
|
|
170
|
+
defaultMessage: 'Keep content consistent across multiple locations',
|
|
171
171
|
description: 'Description of the synced block that auto-updates content across Atlassian apps'
|
|
172
172
|
},
|
|
173
173
|
newLozenge: {
|
|
@@ -147,7 +147,7 @@ export var messages = defineMessages({
|
|
|
147
147
|
},
|
|
148
148
|
datasourceAssetsObjectsDescription: {
|
|
149
149
|
id: 'fabric.editor.datasource.assetsObjects.description',
|
|
150
|
-
defaultMessage: '
|
|
150
|
+
defaultMessage: 'Display filtered Assets objects',
|
|
151
151
|
description: 'Description text displayed when selecting the type of data to include onto the page, in this case: JSM Assets objects'
|
|
152
152
|
},
|
|
153
153
|
inlineOverlay: {
|
|
@@ -172,17 +172,17 @@ export var messages = defineMessages({
|
|
|
172
172
|
},
|
|
173
173
|
datasourceConfluenceSearchDescription: {
|
|
174
174
|
id: 'fabric.editor.datasource.confluenceSearch.description',
|
|
175
|
-
defaultMessage: '
|
|
175
|
+
defaultMessage: 'Display filtered Confluence search results',
|
|
176
176
|
description: 'Description text displayed when selecting the type of data to include onto the page, in this case: Confluence Search objects'
|
|
177
177
|
},
|
|
178
178
|
datasourceJiraIssueIssueTermRefresh: {
|
|
179
179
|
id: 'fabric.editor.datasource.jiraIssue.issue-term-refresh',
|
|
180
|
-
defaultMessage: 'Jira
|
|
180
|
+
defaultMessage: 'Jira work items',
|
|
181
181
|
description: 'Insert a jira datasource table (Issue Terminology Refresh)'
|
|
182
182
|
},
|
|
183
183
|
datasourceJiraIssueDescriptionIssueTermRefresh: {
|
|
184
184
|
id: 'fabric.editor.datasource.jiraIssue.description.issue-term-refresh',
|
|
185
|
-
defaultMessage: '
|
|
185
|
+
defaultMessage: 'Display filtered Jira work items',
|
|
186
186
|
description: 'Insert a jira datasource table (Issue Terminology Refresh)'
|
|
187
187
|
}
|
|
188
188
|
});
|
|
@@ -22,7 +22,7 @@ export var toolbarInsertBlockMessages = defineMessages({
|
|
|
22
22
|
},
|
|
23
23
|
linkDescription: {
|
|
24
24
|
id: 'fabric.editor.link.description',
|
|
25
|
-
defaultMessage: '
|
|
25
|
+
defaultMessage: 'Connect readers to related content',
|
|
26
26
|
description: 'Displayed as a description text for the link option in the editor insert menu, explaining that it allows users to insert a hyperlink into the document.'
|
|
27
27
|
},
|
|
28
28
|
mediaFiles: {
|
|
@@ -42,7 +42,7 @@ export var toolbarInsertBlockMessages = defineMessages({
|
|
|
42
42
|
},
|
|
43
43
|
mediaFilesDescription: {
|
|
44
44
|
id: 'fabric.editor.mediaFiles.description',
|
|
45
|
-
defaultMessage: 'Add
|
|
45
|
+
defaultMessage: 'Add media and files',
|
|
46
46
|
description: 'Menu description shown in the quick insert menu. Explains that users can add images and other files to their page.'
|
|
47
47
|
},
|
|
48
48
|
image: {
|
|
@@ -82,7 +82,7 @@ export var toolbarInsertBlockMessages = defineMessages({
|
|
|
82
82
|
},
|
|
83
83
|
emojiDescription: {
|
|
84
84
|
id: 'fabric.editor.emoji.description',
|
|
85
|
-
defaultMessage: '
|
|
85
|
+
defaultMessage: 'Find and insert your favorite emoji 🎉',
|
|
86
86
|
description: 'Menu description shown in the quick insert menu. Explains that users can insert emojis to enhance their content.'
|
|
87
87
|
},
|
|
88
88
|
table: {
|
|
@@ -92,7 +92,7 @@ export var toolbarInsertBlockMessages = defineMessages({
|
|
|
92
92
|
},
|
|
93
93
|
tableDescription: {
|
|
94
94
|
id: 'fabric.editor.table.description',
|
|
95
|
-
defaultMessage: 'Insert a table',
|
|
95
|
+
defaultMessage: 'Insert a table to organize information',
|
|
96
96
|
description: 'Menu description shown in the quick insert menu. Explains that users can insert a table to organize data.'
|
|
97
97
|
},
|
|
98
98
|
tableSelector: {
|
|
@@ -122,7 +122,7 @@ export var toolbarInsertBlockMessages = defineMessages({
|
|
|
122
122
|
},
|
|
123
123
|
expandDescription: {
|
|
124
124
|
id: 'fabric.editor.expand.description',
|
|
125
|
-
defaultMessage: '
|
|
125
|
+
defaultMessage: 'Show or hide content in expandable sections',
|
|
126
126
|
description: 'Menu description shown in the quick insert menu. Explains that users can insert expandable content sections.'
|
|
127
127
|
},
|
|
128
128
|
decision: {
|
|
@@ -132,7 +132,7 @@ export var toolbarInsertBlockMessages = defineMessages({
|
|
|
132
132
|
},
|
|
133
133
|
decisionDescription: {
|
|
134
134
|
id: 'fabric.editor.decision.description',
|
|
135
|
-
defaultMessage:
|
|
135
|
+
defaultMessage: 'Track decisions with a visible record',
|
|
136
136
|
description: 'Menu description shown in the quick insert menu. Explains that users can insert decision elements for tracking.'
|
|
137
137
|
},
|
|
138
138
|
feedbackDialog: {
|
|
@@ -152,7 +152,7 @@ export var toolbarInsertBlockMessages = defineMessages({
|
|
|
152
152
|
},
|
|
153
153
|
horizontalRuleDescription: {
|
|
154
154
|
id: 'fabric.editor.horizontalRule.description',
|
|
155
|
-
defaultMessage: 'Separate
|
|
155
|
+
defaultMessage: 'Separate sections with a dividing line',
|
|
156
156
|
description: 'Displayed as a description text for the divider option in the editor insert menu, explaining that it inserts a horizontal line to separate content sections in the document.'
|
|
157
157
|
},
|
|
158
158
|
date: {
|
|
@@ -187,7 +187,7 @@ export var toolbarInsertBlockMessages = defineMessages({
|
|
|
187
187
|
},
|
|
188
188
|
columnsDescriptionAdvancedLayout: {
|
|
189
189
|
id: 'fabric.editor.columns.advanced.layout.description',
|
|
190
|
-
defaultMessage: 'Insert {numberOfColumns}
|
|
190
|
+
defaultMessage: 'Insert a {numberOfColumns} column layout',
|
|
191
191
|
description: 'Menu option for advanced layouts. The placeholder {numberOfColumns} will be substituted with the number of equal columns being inserted.'
|
|
192
192
|
},
|
|
193
193
|
singleColumnsDescriptionAdvancedLayout: {
|
|
@@ -12,12 +12,12 @@ export var toolbarMessages = defineMessages({
|
|
|
12
12
|
},
|
|
13
13
|
singleColumnAdvancedLayout: {
|
|
14
14
|
id: 'fabric.editor.singleColumns',
|
|
15
|
-
defaultMessage: '1
|
|
15
|
+
defaultMessage: '1 column layout',
|
|
16
16
|
description: 'Label for the toolbar button that applies a single-column layout to the selected content in the advanced layout options.'
|
|
17
17
|
},
|
|
18
18
|
twoColumnsAdvancedLayout: {
|
|
19
19
|
id: 'fabric.editor.twoColumns',
|
|
20
|
-
defaultMessage: '2
|
|
20
|
+
defaultMessage: '2 column layout',
|
|
21
21
|
description: 'Label for the advanced layout toolbar button that applies a two equal-width columns layout.'
|
|
22
22
|
},
|
|
23
23
|
threeColumns: {
|
|
@@ -27,17 +27,17 @@ export var toolbarMessages = defineMessages({
|
|
|
27
27
|
},
|
|
28
28
|
threeColumnsAdvancedLayout: {
|
|
29
29
|
id: 'fabric.editor.threeColumns',
|
|
30
|
-
defaultMessage: '3
|
|
30
|
+
defaultMessage: '3 column layout',
|
|
31
31
|
description: 'Layout with three columns of equal width'
|
|
32
32
|
},
|
|
33
33
|
fourColumns: {
|
|
34
34
|
id: 'fabric.editor.fourColumns',
|
|
35
|
-
defaultMessage: '4
|
|
35
|
+
defaultMessage: '4 column layout',
|
|
36
36
|
description: 'Label for the advanced layout toolbar button that applies a four equal-width columns layout.'
|
|
37
37
|
},
|
|
38
38
|
fiveColumns: {
|
|
39
39
|
id: 'fabric.editor.fiveColumns',
|
|
40
|
-
defaultMessage: '5
|
|
40
|
+
defaultMessage: '5 column layout',
|
|
41
41
|
description: 'Label for the advanced layout toolbar button that applies a five equal-width columns layout.'
|
|
42
42
|
},
|
|
43
43
|
rightSidebar: {
|
|
@@ -3,12 +3,12 @@ import { defineMessages } from 'react-intl';
|
|
|
3
3
|
export var messages = defineMessages({
|
|
4
4
|
unorderedList: {
|
|
5
5
|
id: 'fabric.editor.unorderedList',
|
|
6
|
-
defaultMessage: '
|
|
6
|
+
defaultMessage: 'Bulleted list',
|
|
7
7
|
description: 'A list with bullets. Also known as an “unordered” list'
|
|
8
8
|
},
|
|
9
9
|
unorderedListDescription: {
|
|
10
10
|
id: 'fabric.editor.unorderedList.description',
|
|
11
|
-
defaultMessage: '
|
|
11
|
+
defaultMessage: 'Organize items with bullets',
|
|
12
12
|
description: 'The text is shown as a description for the bullet list item in the quick insert menu when the user searches for formatting options.'
|
|
13
13
|
},
|
|
14
14
|
bulletedList: {
|
|
@@ -23,7 +23,7 @@ export var messages = defineMessages({
|
|
|
23
23
|
},
|
|
24
24
|
orderedListDescription: {
|
|
25
25
|
id: 'fabric.editor.orderedList.description',
|
|
26
|
-
defaultMessage: '
|
|
26
|
+
defaultMessage: 'Organize items with numbers',
|
|
27
27
|
description: 'The text is shown as a description for the numbered list item in the quick insert menu when the user searches for formatting options.'
|
|
28
28
|
},
|
|
29
29
|
lists: {
|
|
@@ -17,7 +17,7 @@ export var templateGalleryMessages = defineMessages({
|
|
|
17
17
|
},
|
|
18
18
|
templateGalleryDescription: {
|
|
19
19
|
id: 'editor-plugin-snippets.snippetsPlugin.templateGalleryDescription',
|
|
20
|
-
defaultMessage: 'Create
|
|
20
|
+
defaultMessage: 'Create and reuse block templates',
|
|
21
21
|
description: 'Description for the block template gallery quick insert item'
|
|
22
22
|
},
|
|
23
23
|
templateGalleryTitle: {
|
|
@@ -19,7 +19,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
19
19
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
20
20
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
21
21
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
22
|
-
var packageVersion = "
|
|
22
|
+
var packageVersion = "134.0.0";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Gives Quick Insert items access to the editor and the function for selecting a command.
|
|
4
|
+
* The menu supplies shared values; each item adds its selected and preview state.
|
|
5
|
+
*/
|
|
2
6
|
export var QuickInsertContext = /*#__PURE__*/createContext(null);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { REGISTERED_MENU_SURFACE_CONTEXT } from '../registered-menu/RegisteredMenuSurfaceContext';
|
|
2
3
|
import { CompactQuickInsertMenuItem } from './CompactQuickInsertMenuItem';
|
|
3
4
|
import { ElementBrowserQuickInsertMenuItem } from './ElementBrowserQuickInsertMenuItem';
|
|
4
5
|
import { useQuickInsertContext } from './useQuickInsertContext';
|
|
5
6
|
export var QuickInsertMenuItem = function QuickInsertMenuItem(_ref) {
|
|
7
|
+
var _surfaceContext$get;
|
|
6
8
|
var ariaLabel = _ref.ariaLabel,
|
|
7
9
|
description = _ref.description,
|
|
8
10
|
iconBefore = _ref.iconBefore,
|
|
@@ -19,7 +21,8 @@ export var QuickInsertMenuItem = function QuickInsertMenuItem(_ref) {
|
|
|
19
21
|
shouldWrapIcon = _ref.shouldWrapIcon,
|
|
20
22
|
title = _ref.title;
|
|
21
23
|
var _useQuickInsertContex = useQuickInsertContext(),
|
|
22
|
-
|
|
24
|
+
surfaceContext = _useQuickInsertContex.surfaceContext;
|
|
25
|
+
var surface = surfaceContext === null || surfaceContext === void 0 || (_surfaceContext$get = surfaceContext.get(REGISTERED_MENU_SURFACE_CONTEXT)) === null || _surfaceContext$get === void 0 ? void 0 : _surfaceContext$get.surface;
|
|
23
26
|
return surface === 'element-browser' ? /*#__PURE__*/React.createElement(ElementBrowserQuickInsertMenuItem, {
|
|
24
27
|
ariaLabel: ariaLabel,
|
|
25
28
|
description: description,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
// The list caches rendered rows while scrolling, so those rows may not receive
|
|
3
|
+
// updated props. We pass the active item key down through context so their styling
|
|
4
|
+
// updates without rebuilding the wrappers that measure row height.
|
|
5
|
+
export var ActiveMenuItemKeyContext = /*#__PURE__*/createContext(undefined);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { Box } from '@atlaskit/primitives/compiled/box';
|
|
3
|
+
export var MeasuredRow = function MeasuredRow(_ref) {
|
|
4
|
+
var children = _ref.children,
|
|
5
|
+
isScrolling = _ref.isScrolling,
|
|
6
|
+
isVisible = _ref.isVisible,
|
|
7
|
+
measure = _ref.measure,
|
|
8
|
+
onMeasured = _ref.onMeasured,
|
|
9
|
+
paddingBlockStart = _ref.paddingBlockStart,
|
|
10
|
+
paddingBlockEnd = _ref.paddingBlockEnd;
|
|
11
|
+
var rowRef = useRef(null);
|
|
12
|
+
useEffect(function () {
|
|
13
|
+
var row = rowRef.current;
|
|
14
|
+
if (!row || isScrolling || !isVisible || typeof ResizeObserver === 'undefined') {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
var observer = new ResizeObserver(function () {
|
|
18
|
+
measure();
|
|
19
|
+
onMeasured();
|
|
20
|
+
});
|
|
21
|
+
observer.observe(row, {
|
|
22
|
+
box: 'border-box'
|
|
23
|
+
});
|
|
24
|
+
return function () {
|
|
25
|
+
return observer.disconnect();
|
|
26
|
+
};
|
|
27
|
+
}, [isScrolling, isVisible, measure, onMeasured]);
|
|
28
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
29
|
+
ref: rowRef,
|
|
30
|
+
paddingBlockStart: paddingBlockStart,
|
|
31
|
+
paddingBlockEnd: paddingBlockEnd
|
|
32
|
+
}, children);
|
|
33
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export var RegisteredMenuContext = /*#__PURE__*/createContext(null);
|
|
3
|
+
export var useRegisteredMenuContext = function useRegisteredMenuContext() {
|
|
4
|
+
var context = useContext(RegisteredMenuContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error('useRegisteredMenuContext must be used within RegisteredMenuContext.Provider');
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
4
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
|
+
import React, { useCallback, useLayoutEffect, useMemo, useRef } from 'react';
|
|
7
|
+
import { CellMeasurer, CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
|
|
8
|
+
import { List } from 'react-virtualized/dist/commonjs/List';
|
|
9
|
+
import { ActiveMenuItemKeyContext } from './ActiveMenuItemKeyContext';
|
|
10
|
+
import { MeasuredRow } from './MeasuredRow';
|
|
11
|
+
import { RegisteredMenuListItemRow } from './RegisteredMenuListItemRow';
|
|
12
|
+
import { useMenuListHeight } from './useMenuListHeight';
|
|
13
|
+
var ESTIMATED_ROW_HEIGHT = 44;
|
|
14
|
+
export var RegisteredMenuList = function RegisteredMenuList(_ref) {
|
|
15
|
+
var rows = _ref.rows,
|
|
16
|
+
Item = _ref.Item,
|
|
17
|
+
selectedItemIndex = _ref.selectedItemIndex,
|
|
18
|
+
activeItemKey = _ref.activeItemKey,
|
|
19
|
+
maxHeight = _ref.maxHeight,
|
|
20
|
+
width = _ref.width,
|
|
21
|
+
getItemId = _ref.getItemId,
|
|
22
|
+
onItemHover = _ref.onItemHover,
|
|
23
|
+
onItemFocus = _ref.onItemFocus,
|
|
24
|
+
onItemLeave = _ref.onItemLeave,
|
|
25
|
+
onItemBlur = _ref.onItemBlur,
|
|
26
|
+
onItemVisibilityChange = _ref.onItemVisibilityChange,
|
|
27
|
+
onRenderedItemsChange = _ref.onRenderedItemsChange,
|
|
28
|
+
scrollResetKey = _ref.scrollResetKey,
|
|
29
|
+
_ref$role = _ref.role,
|
|
30
|
+
role = _ref$role === void 0 ? 'presentation' : _ref$role,
|
|
31
|
+
_ref$containerRole = _ref.containerRole,
|
|
32
|
+
containerRole = _ref$containerRole === void 0 ? 'presentation' : _ref$containerRole,
|
|
33
|
+
tabIndex = _ref.tabIndex,
|
|
34
|
+
_ref$omitAriaReadonly = _ref.omitAriaReadonly,
|
|
35
|
+
omitAriaReadonly = _ref$omitAriaReadonly === void 0 ? false : _ref$omitAriaReadonly,
|
|
36
|
+
_ref$hasScrollPadding = _ref.hasScrollPadding,
|
|
37
|
+
hasScrollPadding = _ref$hasScrollPadding === void 0 ? false : _ref$hasScrollPadding,
|
|
38
|
+
_ref$lastRowPadding = _ref.lastRowPadding,
|
|
39
|
+
lastRowPadding = _ref$lastRowPadding === void 0 ? 'none' : _ref$lastRowPadding,
|
|
40
|
+
_ref$scrollTo = _ref.scrollTo,
|
|
41
|
+
scrollTo = _ref$scrollTo === void 0 ? 'selected' : _ref$scrollTo;
|
|
42
|
+
var listRef = useRef(null);
|
|
43
|
+
var cache = useMemo(function () {
|
|
44
|
+
return new CellMeasurerCache({
|
|
45
|
+
defaultHeight: ESTIMATED_ROW_HEIGHT,
|
|
46
|
+
fixedWidth: true
|
|
47
|
+
});
|
|
48
|
+
}, []);
|
|
49
|
+
var itemIndexByRowIndex = useMemo(function () {
|
|
50
|
+
var indexes = new Map();
|
|
51
|
+
var itemIndex = 0;
|
|
52
|
+
rows.forEach(function (row, rowIndex) {
|
|
53
|
+
if (row.type === 'menu-item') {
|
|
54
|
+
indexes.set(rowIndex, itemIndex++);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return indexes;
|
|
58
|
+
}, [rows]);
|
|
59
|
+
var selectedRowIndex = useMemo(function () {
|
|
60
|
+
var _iterator = _createForOfIteratorHelper(itemIndexByRowIndex),
|
|
61
|
+
_step;
|
|
62
|
+
try {
|
|
63
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
64
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
|
65
|
+
rowIndex = _step$value[0],
|
|
66
|
+
itemIndex = _step$value[1];
|
|
67
|
+
if (itemIndex === selectedItemIndex) {
|
|
68
|
+
return rowIndex;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} catch (err) {
|
|
72
|
+
_iterator.e(err);
|
|
73
|
+
} finally {
|
|
74
|
+
_iterator.f();
|
|
75
|
+
}
|
|
76
|
+
return -1;
|
|
77
|
+
}, [itemIndexByRowIndex, selectedItemIndex]);
|
|
78
|
+
var rowKeySignature = useMemo(function () {
|
|
79
|
+
return rows.map(function (_ref2) {
|
|
80
|
+
var key = _ref2.key,
|
|
81
|
+
type = _ref2.type;
|
|
82
|
+
return "".concat(type, ":").concat(key);
|
|
83
|
+
}).join('\0');
|
|
84
|
+
}, [rows]);
|
|
85
|
+
var _useMenuListHeight = useMenuListHeight(cache, rows.length, rowKeySignature),
|
|
86
|
+
measuredHeight = _useMenuListHeight.height,
|
|
87
|
+
updateHeight = _useMenuListHeight.updateHeight;
|
|
88
|
+
// react-virtualized forwards null to omit its grid-only default value.
|
|
89
|
+
var ariaReadonly = omitAriaReadonly ? null : undefined;
|
|
90
|
+
useLayoutEffect(function () {
|
|
91
|
+
var _listRef$current;
|
|
92
|
+
cache.clearAll();
|
|
93
|
+
(_listRef$current = listRef.current) === null || _listRef$current === void 0 || _listRef$current.recomputeRowHeights();
|
|
94
|
+
}, [cache, rowKeySignature]);
|
|
95
|
+
var previousResetKeyRef = useRef(scrollResetKey);
|
|
96
|
+
useLayoutEffect(function () {
|
|
97
|
+
if (scrollTo === 'top-on-reset' && previousResetKeyRef.current !== scrollResetKey) {
|
|
98
|
+
var _listRef$current2;
|
|
99
|
+
previousResetKeyRef.current = scrollResetKey;
|
|
100
|
+
(_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 || _listRef$current2.scrollToPosition(0);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
previousResetKeyRef.current = scrollResetKey;
|
|
104
|
+
if (selectedRowIndex >= 0) {
|
|
105
|
+
var _listRef$current3;
|
|
106
|
+
(_listRef$current3 = listRef.current) === null || _listRef$current3 === void 0 || _listRef$current3.scrollToRow(selectedRowIndex);
|
|
107
|
+
}
|
|
108
|
+
}, [scrollResetKey, rowKeySignature, scrollTo, selectedRowIndex]);
|
|
109
|
+
var handleRowsRendered = useCallback(function (_ref3) {
|
|
110
|
+
var _indexes$, _indexes;
|
|
111
|
+
var overscanStartIndex = _ref3.overscanStartIndex,
|
|
112
|
+
overscanStopIndex = _ref3.overscanStopIndex,
|
|
113
|
+
startIndex = _ref3.startIndex,
|
|
114
|
+
stopIndex = _ref3.stopIndex;
|
|
115
|
+
if (activeItemKey) {
|
|
116
|
+
var activeRowIndex = rows.findIndex(function (row) {
|
|
117
|
+
return row.type === 'menu-item' && row.key === activeItemKey;
|
|
118
|
+
});
|
|
119
|
+
if (activeRowIndex >= 0 && (activeRowIndex < startIndex || activeRowIndex > stopIndex)) {
|
|
120
|
+
onItemVisibilityChange(activeItemKey, false);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
updateHeight();
|
|
124
|
+
var indexes = _toConsumableArray(itemIndexByRowIndex).filter(function (_ref4) {
|
|
125
|
+
var _ref5 = _slicedToArray(_ref4, 1),
|
|
126
|
+
rowIndex = _ref5[0];
|
|
127
|
+
return rowIndex >= overscanStartIndex && rowIndex <= overscanStopIndex;
|
|
128
|
+
}).map(function (_ref6) {
|
|
129
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
|
130
|
+
itemIndex = _ref7[1];
|
|
131
|
+
return itemIndex;
|
|
132
|
+
});
|
|
133
|
+
onRenderedItemsChange === null || onRenderedItemsChange === void 0 || onRenderedItemsChange({
|
|
134
|
+
startIndex: (_indexes$ = indexes[0]) !== null && _indexes$ !== void 0 ? _indexes$ : -1,
|
|
135
|
+
stopIndex: (_indexes = indexes[indexes.length - 1]) !== null && _indexes !== void 0 ? _indexes : -1
|
|
136
|
+
});
|
|
137
|
+
}, [activeItemKey, itemIndexByRowIndex, onItemVisibilityChange, onRenderedItemsChange, rows, updateHeight]);
|
|
138
|
+
var renderRow = useCallback(function (_ref8) {
|
|
139
|
+
var index = _ref8.index,
|
|
140
|
+
key = _ref8.key,
|
|
141
|
+
parent = _ref8.parent,
|
|
142
|
+
style = _ref8.style,
|
|
143
|
+
_ref8$isScrolling = _ref8.isScrolling,
|
|
144
|
+
isScrolling = _ref8$isScrolling === void 0 ? false : _ref8$isScrolling,
|
|
145
|
+
_ref8$isVisible = _ref8.isVisible,
|
|
146
|
+
isVisible = _ref8$isVisible === void 0 ? true : _ref8$isVisible;
|
|
147
|
+
var registration = rows[index];
|
|
148
|
+
if (!registration) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
var itemIndex = itemIndexByRowIndex.get(index);
|
|
152
|
+
var RegisteredComponent = registration.component;
|
|
153
|
+
var paddingBlockStart = hasScrollPadding && index === 0 ? 'space.100' : undefined;
|
|
154
|
+
var paddingBlockEnd = (hasScrollPadding || lastRowPadding === 'space.100') && index === rows.length - 1 ? 'space.100' : undefined;
|
|
155
|
+
return /*#__PURE__*/React.createElement(CellMeasurer, {
|
|
156
|
+
key: key,
|
|
157
|
+
cache: cache,
|
|
158
|
+
parent: parent,
|
|
159
|
+
columnIndex: 0,
|
|
160
|
+
rowIndex: index
|
|
161
|
+
}, function (_ref9) {
|
|
162
|
+
var registerChild = _ref9.registerChild,
|
|
163
|
+
measure = _ref9.measure;
|
|
164
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
165
|
+
ref: function ref(element) {
|
|
166
|
+
return registerChild === null || registerChild === void 0 ? void 0 : registerChild(element !== null && element !== void 0 ? element : undefined);
|
|
167
|
+
}
|
|
168
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- react-virtualized provides row offsets at runtime.
|
|
169
|
+
,
|
|
170
|
+
style: style
|
|
171
|
+
}, /*#__PURE__*/React.createElement(MeasuredRow, {
|
|
172
|
+
paddingBlockStart: paddingBlockStart,
|
|
173
|
+
paddingBlockEnd: paddingBlockEnd,
|
|
174
|
+
isScrolling: isScrolling,
|
|
175
|
+
isVisible: isVisible,
|
|
176
|
+
measure: measure,
|
|
177
|
+
onMeasured: updateHeight
|
|
178
|
+
}, registration.type === 'menu-section' ? RegisteredComponent ? /*#__PURE__*/React.createElement(RegisteredComponent, null) : null : /*#__PURE__*/React.createElement(RegisteredMenuListItemRow, {
|
|
179
|
+
Item: Item,
|
|
180
|
+
getItemId: getItemId,
|
|
181
|
+
itemIndex: itemIndex !== null && itemIndex !== void 0 ? itemIndex : 0,
|
|
182
|
+
isVisible: isVisible,
|
|
183
|
+
onItemBlur: onItemBlur,
|
|
184
|
+
onItemFocus: onItemFocus,
|
|
185
|
+
onItemHover: onItemHover,
|
|
186
|
+
onItemLeave: onItemLeave,
|
|
187
|
+
onItemVisibilityChange: onItemVisibilityChange,
|
|
188
|
+
registration: registration,
|
|
189
|
+
rowIndex: index,
|
|
190
|
+
selectedItemIndex: selectedItemIndex
|
|
191
|
+
})));
|
|
192
|
+
});
|
|
193
|
+
}, [Item, cache, getItemId, hasScrollPadding, itemIndexByRowIndex, lastRowPadding, onItemBlur, onItemFocus, onItemHover, onItemLeave, onItemVisibilityChange, rows, selectedItemIndex, updateHeight]);
|
|
194
|
+
if (rows.length === 0) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
return /*#__PURE__*/React.createElement(ActiveMenuItemKeyContext.Provider, {
|
|
198
|
+
value: activeItemKey
|
|
199
|
+
}, /*#__PURE__*/React.createElement(List, {
|
|
200
|
+
"aria-readonly": ariaReadonly,
|
|
201
|
+
containerRole: containerRole,
|
|
202
|
+
height: Math.min(measuredHeight, Math.max(0, maxHeight)),
|
|
203
|
+
ref: listRef,
|
|
204
|
+
onRowsRendered: handleRowsRendered,
|
|
205
|
+
overscanRowCount: 3,
|
|
206
|
+
role: role,
|
|
207
|
+
rowCount: rows.length,
|
|
208
|
+
rowHeight: cache.rowHeight,
|
|
209
|
+
rowRenderer: renderRow,
|
|
210
|
+
scrollToAlignment: "auto",
|
|
211
|
+
scrollToIndex: scrollTo === 'selected' ? selectedRowIndex : undefined,
|
|
212
|
+
tabIndex: tabIndex,
|
|
213
|
+
width: width
|
|
214
|
+
}));
|
|
215
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useCallback, useContext, useLayoutEffect } from 'react';
|
|
2
|
+
import { ActiveMenuItemKeyContext } from './ActiveMenuItemKeyContext';
|
|
3
|
+
/**
|
|
4
|
+
* Connects a rendered item to the list's active state and interaction callbacks.
|
|
5
|
+
* The list may reuse this row while scrolling, so context keeps its active styling
|
|
6
|
+
* current. The wrapper handles events without requiring registered components to
|
|
7
|
+
* forward them, and keeps the item active when focus moves between its children.
|
|
8
|
+
*/
|
|
9
|
+
export var RegisteredMenuListItemRow = function RegisteredMenuListItemRow(_ref) {
|
|
10
|
+
var Item = _ref.Item,
|
|
11
|
+
getItemId = _ref.getItemId,
|
|
12
|
+
itemIndex = _ref.itemIndex,
|
|
13
|
+
isVisible = _ref.isVisible,
|
|
14
|
+
onItemBlur = _ref.onItemBlur,
|
|
15
|
+
onItemFocus = _ref.onItemFocus,
|
|
16
|
+
onItemHover = _ref.onItemHover,
|
|
17
|
+
onItemLeave = _ref.onItemLeave,
|
|
18
|
+
onItemVisibilityChange = _ref.onItemVisibilityChange,
|
|
19
|
+
registration = _ref.registration,
|
|
20
|
+
rowIndex = _ref.rowIndex,
|
|
21
|
+
selectedItemIndex = _ref.selectedItemIndex;
|
|
22
|
+
var activeItemKey = useContext(ActiveMenuItemKeyContext);
|
|
23
|
+
useLayoutEffect(function () {
|
|
24
|
+
onItemVisibilityChange(registration.key, isVisible);
|
|
25
|
+
return function () {
|
|
26
|
+
return onItemVisibilityChange(registration.key, false);
|
|
27
|
+
};
|
|
28
|
+
}, [isVisible, onItemVisibilityChange, registration.key]);
|
|
29
|
+
var onBlur = useCallback(function (event) {
|
|
30
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
31
|
+
onItemBlur(registration.key);
|
|
32
|
+
}
|
|
33
|
+
}, [onItemBlur, registration.key]);
|
|
34
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
onBlur: onBlur,
|
|
36
|
+
onFocus: function onFocus() {
|
|
37
|
+
return onItemFocus(itemIndex, registration.key);
|
|
38
|
+
},
|
|
39
|
+
onMouseLeave: function onMouseLeave() {
|
|
40
|
+
return onItemLeave(registration.key);
|
|
41
|
+
},
|
|
42
|
+
onMouseMove: function onMouseMove() {
|
|
43
|
+
return onItemHover(itemIndex, registration.key);
|
|
44
|
+
}
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Item, {
|
|
46
|
+
id: getItemId({
|
|
47
|
+
itemIndex: itemIndex,
|
|
48
|
+
rowIndex: rowIndex
|
|
49
|
+
}),
|
|
50
|
+
isActive: activeItemKey === registration.key,
|
|
51
|
+
isSelected: itemIndex === selectedItemIndex,
|
|
52
|
+
registration: registration
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createSurfaceContext } from '@atlaskit/editor-ui-control-model/create-surface-context';
|
|
2
|
+
import { createContextToken } from '@atlaskit/editor-ui-control-model/types';
|
|
3
|
+
export var REGISTERED_MENU_SURFACE_CONTEXT = createContextToken('registered-menu-surface-context');
|
|
4
|
+
export var createRegisteredMenuSurfaceContext = function createRegisteredMenuSurfaceContext(value) {
|
|
5
|
+
return createSurfaceContext(REGISTERED_MENU_SURFACE_CONTEXT, value);
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|