@atlaskit/editor-common 96.0.2 → 96.1.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 +31 -0
- package/dist/cjs/commands/index.js +1 -0
- package/dist/cjs/element-browser/components/ElementList/ElementList.js +31 -8
- package/dist/cjs/element-browser/components/StatelessElementBrowser.js +7 -2
- package/dist/cjs/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +102 -19
- package/dist/cjs/insert/index.js +19 -0
- package/dist/cjs/lazy-node-view/index.js +1 -0
- package/dist/cjs/messages/insert-block.js +5 -0
- package/dist/cjs/messages/layout.js +13 -3
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/preset/builder.js +1 -0
- package/dist/cjs/preset/core-plugin/index.js +1 -1
- package/dist/cjs/rank.js +3 -0
- package/dist/cjs/types/index.js +2 -1
- package/dist/cjs/types/toolbar.js +2 -2
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +3 -1
- package/dist/cjs/utils/dom.js +1 -0
- package/dist/cjs/utils/index.js +1 -0
- package/dist/cjs/utils/performance/measure.js +3 -0
- package/dist/cjs/utils/scroll-gutter.js +1 -0
- package/dist/es2019/commands/index.js +1 -0
- package/dist/es2019/element-browser/components/ElementList/ElementList.js +31 -8
- package/dist/es2019/element-browser/components/StatelessElementBrowser.js +7 -2
- package/dist/es2019/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +97 -14
- package/dist/es2019/insert/index.js +18 -0
- package/dist/es2019/lazy-node-view/index.js +1 -0
- package/dist/es2019/messages/insert-block.js +5 -0
- package/dist/es2019/messages/layout.js +13 -3
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/preset/builder.js +1 -0
- package/dist/es2019/preset/core-plugin/index.js +1 -1
- package/dist/es2019/rank.js +3 -0
- package/dist/es2019/types/index.js +2 -0
- package/dist/es2019/types/toolbar.js +2 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +3 -1
- package/dist/es2019/utils/dom.js +1 -0
- package/dist/es2019/utils/index.js +1 -0
- package/dist/es2019/utils/performance/measure.js +3 -0
- package/dist/es2019/utils/scroll-gutter.js +1 -0
- package/dist/esm/commands/index.js +1 -0
- package/dist/esm/element-browser/components/ElementList/ElementList.js +31 -8
- package/dist/esm/element-browser/components/StatelessElementBrowser.js +7 -2
- package/dist/esm/element-browser/hooks/use-select-and-focus-on-arrow-navigation.js +102 -20
- package/dist/esm/insert/index.js +18 -0
- package/dist/esm/lazy-node-view/index.js +1 -0
- package/dist/esm/messages/insert-block.js +5 -0
- package/dist/esm/messages/layout.js +13 -3
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/preset/builder.js +1 -0
- package/dist/esm/preset/core-plugin/index.js +1 -1
- package/dist/esm/rank.js +3 -0
- package/dist/esm/types/index.js +2 -0
- package/dist/esm/types/toolbar.js +2 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +3 -1
- package/dist/esm/utils/dom.js +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/performance/measure.js +3 -0
- package/dist/esm/utils/scroll-gutter.js +1 -0
- package/dist/types/element-browser/hooks/use-select-and-focus-on-arrow-navigation.d.ts +1 -1
- package/dist/types/insert/index.d.ts +6 -0
- package/dist/types/messages/insert-block.d.ts +5 -0
- package/dist/types/messages/layout.d.ts +10 -0
- package/dist/types/types/selection-toolbar.d.ts +1 -0
- package/dist/types-ts4.5/element-browser/hooks/use-select-and-focus-on-arrow-navigation.d.ts +1 -1
- package/dist/types-ts4.5/insert/index.d.ts +6 -0
- package/dist/types-ts4.5/messages/insert-block.d.ts +5 -0
- package/dist/types-ts4.5/messages/layout.d.ts +10 -0
- package/dist/types-ts4.5/types/selection-toolbar.d.ts +1 -0
- package/package.json +6 -3
|
@@ -530,7 +530,8 @@ export function ElementItem({
|
|
|
530
530
|
icon,
|
|
531
531
|
title,
|
|
532
532
|
description,
|
|
533
|
-
keyshortcut
|
|
533
|
+
keyshortcut,
|
|
534
|
+
isDisabled
|
|
534
535
|
} = item;
|
|
535
536
|
return jsx(Tooltip, {
|
|
536
537
|
content: description,
|
|
@@ -545,7 +546,8 @@ export function ElementItem({
|
|
|
545
546
|
"aria-describedby": title,
|
|
546
547
|
ref: ref,
|
|
547
548
|
testId: `element-item-${index}`,
|
|
548
|
-
id: `searched-item-${index}
|
|
549
|
+
id: `searched-item-${index}`,
|
|
550
|
+
isDisabled: isDisabled
|
|
549
551
|
}, jsx(ItemContent
|
|
550
552
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
551
553
|
, {
|
|
@@ -553,7 +555,8 @@ export function ElementItem({
|
|
|
553
555
|
tabIndex: 0,
|
|
554
556
|
title: title,
|
|
555
557
|
description: description,
|
|
556
|
-
keyshortcut: keyshortcut
|
|
558
|
+
keyshortcut: keyshortcut,
|
|
559
|
+
isDisabled: isDisabled
|
|
557
560
|
})));
|
|
558
561
|
}
|
|
559
562
|
|
|
@@ -571,7 +574,8 @@ const ElementBefore = /*#__PURE__*/memo(({
|
|
|
571
574
|
const ItemContent = /*#__PURE__*/memo(({
|
|
572
575
|
title,
|
|
573
576
|
description,
|
|
574
|
-
keyshortcut
|
|
577
|
+
keyshortcut,
|
|
578
|
+
isDisabled
|
|
575
579
|
}) => {
|
|
576
580
|
if (fg('platform_editor_typography_ugc')) {
|
|
577
581
|
return (
|
|
@@ -586,13 +590,14 @@ const ItemContent = /*#__PURE__*/memo(({
|
|
|
586
590
|
}, jsx("div", {
|
|
587
591
|
css: itemTitleWrapper
|
|
588
592
|
}, jsx(Text, {
|
|
593
|
+
color: isDisabled ? 'color.text.disabled' : undefined,
|
|
589
594
|
maxLines: 1
|
|
590
595
|
}, title), jsx("div", {
|
|
591
596
|
css: itemAfter
|
|
592
597
|
}, keyshortcut && jsx("div", {
|
|
593
598
|
css: shortcutStyle
|
|
594
599
|
}, keyshortcut))), description && jsx(Text, {
|
|
595
|
-
color:
|
|
600
|
+
color: isDisabled ? 'color.text.disabled' : 'color.text.subtle',
|
|
596
601
|
size: "small",
|
|
597
602
|
maxLines: 2
|
|
598
603
|
}, description))))
|
|
@@ -608,13 +613,15 @@ const ItemContent = /*#__PURE__*/memo(({
|
|
|
608
613
|
}, jsx("div", {
|
|
609
614
|
css: itemTitleWrapper
|
|
610
615
|
}, jsx("p", {
|
|
611
|
-
css: itemTitle
|
|
616
|
+
css: isDisabled ? itemTitleDisabled : itemTitle
|
|
612
617
|
}, title), jsx("div", {
|
|
613
618
|
css: itemAfter
|
|
614
619
|
}, keyshortcut && jsx("div", {
|
|
615
620
|
css: shortcutStyle
|
|
616
|
-
}, keyshortcut))), description &&
|
|
617
|
-
|
|
621
|
+
}, keyshortcut))), description &&
|
|
622
|
+
// eslint-disable-next-line @atlaskit/design-system/use-primitives-text
|
|
623
|
+
jsx("p", {
|
|
624
|
+
css: isDisabled ? itemDescriptionDisabled : itemDescription
|
|
618
625
|
}, description)))
|
|
619
626
|
);
|
|
620
627
|
}
|
|
@@ -694,6 +701,15 @@ const itemDescription = css(multilineStyle, {
|
|
|
694
701
|
color: "var(--ds-text-subtle, #44546F)",
|
|
695
702
|
marginTop: "var(--ds-space-025, 2px)"
|
|
696
703
|
});
|
|
704
|
+
|
|
705
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
706
|
+
const itemDescriptionDisabled = css(multilineStyle, {
|
|
707
|
+
overflow: 'hidden',
|
|
708
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
709
|
+
fontSize: relativeFontSizeToBase16(11.67),
|
|
710
|
+
color: "var(--ds-text-disabled, #091E424F)",
|
|
711
|
+
marginTop: "var(--ds-space-025, 2px)"
|
|
712
|
+
});
|
|
697
713
|
const itemText = css({
|
|
698
714
|
width: 'inherit',
|
|
699
715
|
whiteSpace: 'initial'
|
|
@@ -708,6 +724,13 @@ const itemTitle = css({
|
|
|
708
724
|
whiteSpace: 'nowrap',
|
|
709
725
|
textOverflow: 'ellipsis'
|
|
710
726
|
});
|
|
727
|
+
const itemTitleDisabled = css({
|
|
728
|
+
width: '100%',
|
|
729
|
+
overflow: 'hidden',
|
|
730
|
+
whiteSpace: 'nowrap',
|
|
731
|
+
textOverflow: 'ellipsis',
|
|
732
|
+
color: "var(--ds-text-disabled, #091E424F)"
|
|
733
|
+
});
|
|
711
734
|
const itemAfter = css({
|
|
712
735
|
flex: '0 0 auto',
|
|
713
736
|
paddingTop: "var(--ds-space-025, 2px)",
|
|
@@ -145,6 +145,10 @@ function StatelessElementBrowser(props) {
|
|
|
145
145
|
// After user pick some category the category should stay focused.
|
|
146
146
|
isFocusSearch = !categoryBeenChosen.current || !isEmptySearchTerm;
|
|
147
147
|
}
|
|
148
|
+
const itemIsDisabled = useCallback(index => {
|
|
149
|
+
var _items$index$isDisabl, _items$index;
|
|
150
|
+
return (_items$index$isDisabl = (_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.isDisabled) !== null && _items$index$isDisabl !== void 0 ? _items$index$isDisabl : false;
|
|
151
|
+
}, [items]);
|
|
148
152
|
const {
|
|
149
153
|
selectedItemIndex,
|
|
150
154
|
focusedItemIndex,
|
|
@@ -155,7 +159,7 @@ function StatelessElementBrowser(props) {
|
|
|
155
159
|
focusOnViewMore,
|
|
156
160
|
onKeyDown,
|
|
157
161
|
setFocusOnSearch
|
|
158
|
-
} = useSelectAndFocusOnArrowNavigation(items.length - 1, columnCount, !!viewMoreItem, isFocusSearch);
|
|
162
|
+
} = useSelectAndFocusOnArrowNavigation(items.length - 1, columnCount, !!viewMoreItem, itemIsDisabled, isFocusSearch);
|
|
159
163
|
useEffect(() => {
|
|
160
164
|
fireAnalyticsEvent(props.createAnalyticsEvent)({
|
|
161
165
|
payload: {
|
|
@@ -186,6 +190,7 @@ function StatelessElementBrowser(props) {
|
|
|
186
190
|
*/
|
|
187
191
|
const selectedItem = selectedItemIndex !== undefined ? items[selectedItemIndex] : null;
|
|
188
192
|
const onItemsEnterTabKeyPress = useCallback(e => {
|
|
193
|
+
var _selectedItem$isDisab;
|
|
189
194
|
if (e.key !== 'Enter' && (e.key !== 'Tab' || !showCategories)) {
|
|
190
195
|
return;
|
|
191
196
|
}
|
|
@@ -195,7 +200,7 @@ function StatelessElementBrowser(props) {
|
|
|
195
200
|
e.preventDefault();
|
|
196
201
|
return;
|
|
197
202
|
}
|
|
198
|
-
if (onInsertItem && selectedItem != null) {
|
|
203
|
+
if (onInsertItem && selectedItem != null && !((_selectedItem$isDisab = selectedItem.isDisabled) !== null && _selectedItem$isDisab !== void 0 ? _selectedItem$isDisab : false)) {
|
|
199
204
|
onInsertItem(selectedItem);
|
|
200
205
|
}
|
|
201
206
|
e.preventDefault();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useReducer, useRef } from 'react';
|
|
2
|
-
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
/**
|
|
4
4
|
* a custom hook that handles keyboard navigation for Arrow keys based on a
|
|
5
5
|
* given listSize, and a step (for up and down arrows).
|
|
@@ -81,13 +81,29 @@ const moveReducer = (state, action) => {
|
|
|
81
81
|
selectedItemIndex: canFocusViewMore ? undefined : listSize
|
|
82
82
|
};
|
|
83
83
|
} else {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
if (fg('platform_editor_is_disabled_state_element_browser')) {
|
|
85
|
+
var _action$payload$step;
|
|
86
|
+
const newIndex = action.payload.positions ? action.payload.positions - ((_action$payload$step = action.payload.step) !== null && _action$payload$step !== void 0 ? _action$payload$step : 1) : 0;
|
|
87
|
+
const safeIndex = ensureSafeIndex(newIndex, state.listSize);
|
|
88
|
+
const isLastItemFocused = newIndex > listSize;
|
|
89
|
+
const focusOnSearch = isLastItemFocused && !canFocusViewMore;
|
|
90
|
+
const focusOnViewMore = isLastItemFocused && !!canFocusViewMore;
|
|
91
|
+
return {
|
|
92
|
+
...state,
|
|
93
|
+
focusOnSearch: focusOnSearch,
|
|
94
|
+
focusOnViewMore: focusOnViewMore,
|
|
95
|
+
focusedItemIndex: safeIndex,
|
|
96
|
+
selectedItemIndex: safeIndex
|
|
97
|
+
};
|
|
98
|
+
} else {
|
|
99
|
+
return {
|
|
100
|
+
...state,
|
|
101
|
+
focusOnSearch: false,
|
|
102
|
+
focusOnViewMore: false,
|
|
103
|
+
focusedItemIndex: 0,
|
|
104
|
+
selectedItemIndex: 0
|
|
105
|
+
};
|
|
106
|
+
}
|
|
91
107
|
}
|
|
92
108
|
}
|
|
93
109
|
if (state.focusOnViewMore) {
|
|
@@ -172,7 +188,40 @@ const getInitialState = (listSize, canFocusViewMore) => initialState => ({
|
|
|
172
188
|
listSize,
|
|
173
189
|
canFocusViewMore
|
|
174
190
|
});
|
|
175
|
-
|
|
191
|
+
|
|
192
|
+
// Get the offset forwards - skip items that are disabled
|
|
193
|
+
const skipForwardOffsetToSafeItem = (currentIndex, listSize, stepSize, itemIsDisabled) => {
|
|
194
|
+
if (currentIndex === undefined) {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
// Iterate through the list starting from the next item
|
|
198
|
+
for (let offset = 1; currentIndex + offset * stepSize <= listSize; offset++) {
|
|
199
|
+
if (!itemIsDisabled(currentIndex + offset * stepSize)) {
|
|
200
|
+
return offset * stepSize;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Move to the last place if possible
|
|
205
|
+
return listSize - currentIndex + 1;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// Get the offset backwards - skip items that are disabled
|
|
209
|
+
const skipBackwardOffsetToSafeItem = (currentIndex, stepSize, itemIsDisabled) => {
|
|
210
|
+
if (currentIndex === undefined) {
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Iterate backwards starting from the previous item
|
|
215
|
+
for (let offset = 1; currentIndex - offset * stepSize >= -1; offset++) {
|
|
216
|
+
if (!itemIsDisabled(currentIndex - offset * stepSize) || currentIndex - offset * stepSize === -1) {
|
|
217
|
+
return offset * stepSize;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Move to search if no available index
|
|
222
|
+
return currentIndex + 1;
|
|
223
|
+
};
|
|
224
|
+
function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore, itemIsDisabled, isFocusSearch) {
|
|
176
225
|
const [state, dispatch] = useReducer(reducer, initialState, getInitialState(listSize, canFocusViewMore));
|
|
177
226
|
useEffect(() => {
|
|
178
227
|
dispatch({
|
|
@@ -272,15 +321,49 @@ function useSelectAndFocusOnArrowNavigation(listSize, step, canFocusViewMore, is
|
|
|
272
321
|
e.stopPropagation();
|
|
273
322
|
return setFocusOnSearch();
|
|
274
323
|
case 'ArrowRight':
|
|
275
|
-
|
|
324
|
+
{
|
|
325
|
+
if (fg('platform_editor_is_disabled_state_element_browser')) {
|
|
326
|
+
var _skipForwardOffsetToS;
|
|
327
|
+
const itemIndex = focusOnSearch ? -1 : selectedItemIndex;
|
|
328
|
+
const nextItem = (_skipForwardOffsetToS = skipForwardOffsetToSafeItem(itemIndex, listSize, 1, itemIsDisabled)) !== null && _skipForwardOffsetToS !== void 0 ? _skipForwardOffsetToS : 1;
|
|
329
|
+
return move(e, nextItem);
|
|
330
|
+
} else {
|
|
331
|
+
return move(e, +1);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
276
334
|
case 'ArrowLeft':
|
|
277
|
-
|
|
335
|
+
{
|
|
336
|
+
if (fg('platform_editor_is_disabled_state_element_browser')) {
|
|
337
|
+
var _skipBackwardOffsetTo;
|
|
338
|
+
const nextItem = (_skipBackwardOffsetTo = skipBackwardOffsetToSafeItem(selectedItemIndex, 1, itemIsDisabled)) !== null && _skipBackwardOffsetTo !== void 0 ? _skipBackwardOffsetTo : 1;
|
|
339
|
+
return move(e, -nextItem);
|
|
340
|
+
} else {
|
|
341
|
+
return move(e, -1);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
278
344
|
case 'ArrowDown':
|
|
279
|
-
|
|
345
|
+
{
|
|
346
|
+
if (fg('platform_editor_is_disabled_state_element_browser')) {
|
|
347
|
+
var _skipForwardOffsetToS2;
|
|
348
|
+
const itemIndex = focusOnSearch ? -step : selectedItemIndex;
|
|
349
|
+
const nextItem = (_skipForwardOffsetToS2 = skipForwardOffsetToSafeItem(itemIndex, listSize, step, itemIsDisabled)) !== null && _skipForwardOffsetToS2 !== void 0 ? _skipForwardOffsetToS2 : step;
|
|
350
|
+
return move(e, +nextItem, step);
|
|
351
|
+
} else {
|
|
352
|
+
return move(e, +step);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
280
355
|
case 'ArrowUp':
|
|
281
|
-
|
|
356
|
+
{
|
|
357
|
+
if (fg('platform_editor_is_disabled_state_element_browser')) {
|
|
358
|
+
var _skipBackwardOffsetTo2;
|
|
359
|
+
const nextItem = (_skipBackwardOffsetTo2 = skipBackwardOffsetToSafeItem(selectedItemIndex, step, itemIsDisabled)) !== null && _skipBackwardOffsetTo2 !== void 0 ? _skipBackwardOffsetTo2 : step;
|
|
360
|
+
return move(e, Math.min(-nextItem, -step), step);
|
|
361
|
+
} else {
|
|
362
|
+
return move(e, -step, step);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
282
365
|
}
|
|
283
|
-
}, [focusOnSearch, setFocusOnSearch, move, step]);
|
|
366
|
+
}, [focusOnSearch, setFocusOnSearch, move, selectedItemIndex, itemIsDisabled, listSize, step]);
|
|
284
367
|
useEffect(() => {
|
|
285
368
|
// To reset selection when user filters
|
|
286
369
|
reset(listSize);
|
|
@@ -305,6 +305,24 @@ export function contentAllowedInCodeBlock(state) {
|
|
|
305
305
|
return isAllowedChild;
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
+
/**
|
|
309
|
+
* Check if a fragment contains a particular node by iterating through all the nodes in the fragment.
|
|
310
|
+
* If the node type is found will stop looking and return true.
|
|
311
|
+
* If the node type is not found, it will return false.
|
|
312
|
+
*/
|
|
313
|
+
export function fragmentContainsNodeType(fragment, nodeType) {
|
|
314
|
+
let doesContainNodeType = false;
|
|
315
|
+
fragment.descendants(node => {
|
|
316
|
+
if (node.type === nodeType) {
|
|
317
|
+
doesContainNodeType = true;
|
|
318
|
+
// Stop looking
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
return true;
|
|
322
|
+
});
|
|
323
|
+
return doesContainNodeType;
|
|
324
|
+
}
|
|
325
|
+
|
|
308
326
|
// For platform_editor_element_level_templates experiment only
|
|
309
327
|
// clean up ticket ED-24873
|
|
310
328
|
const insertTemplateFragment = ({
|
|
@@ -52,6 +52,7 @@ const resolvedNodesPerEditorView = new WeakMap();
|
|
|
52
52
|
*/
|
|
53
53
|
const debounceToEditorViewMap = new WeakMap();
|
|
54
54
|
const testOnlyIgnoreLazyNodeViewSet = new WeakSet();
|
|
55
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
55
56
|
/**
|
|
56
57
|
* 🧱 Internal: Editor FE Platform
|
|
57
58
|
*
|
|
@@ -170,6 +170,11 @@ export const toolbarInsertBlockMessages = defineMessages({
|
|
|
170
170
|
defaultMessage: 'Structure your page using sections',
|
|
171
171
|
description: 'Create a multi column section or layout'
|
|
172
172
|
},
|
|
173
|
+
columnsDescriptionAdvancedLayout: {
|
|
174
|
+
id: 'fabric.editor.columns.advanced.layout.description',
|
|
175
|
+
defaultMessage: 'Insert {numberOfColumns} equal columns',
|
|
176
|
+
description: 'Create a multi column section or layout'
|
|
177
|
+
},
|
|
173
178
|
status: {
|
|
174
179
|
id: 'fabric.editor.status',
|
|
175
180
|
defaultMessage: 'Status',
|
|
@@ -10,19 +10,29 @@ export const toolbarMessages = defineMessages({
|
|
|
10
10
|
defaultMessage: 'Two columns layout',
|
|
11
11
|
description: 'Layout with two columns of equal width'
|
|
12
12
|
},
|
|
13
|
+
twoColumnsAdvancedLayout: {
|
|
14
|
+
id: 'fabric.editor.twoColumns',
|
|
15
|
+
defaultMessage: '2 Column layout',
|
|
16
|
+
description: 'Layout with two columns of equal width'
|
|
17
|
+
},
|
|
13
18
|
threeColumns: {
|
|
14
19
|
id: 'fabric.editor.threeColumns',
|
|
15
20
|
defaultMessage: 'Three columns layout',
|
|
16
21
|
description: 'Layout with three columns of equal width'
|
|
17
22
|
},
|
|
23
|
+
threeColumnsAdvancedLayout: {
|
|
24
|
+
id: 'fabric.editor.threeColumns',
|
|
25
|
+
defaultMessage: '3 Column layout',
|
|
26
|
+
description: 'Layout with three columns of equal width'
|
|
27
|
+
},
|
|
18
28
|
fourColumns: {
|
|
19
29
|
id: 'fabric.editor.fourColumns',
|
|
20
|
-
defaultMessage: '
|
|
30
|
+
defaultMessage: '4 Column layout',
|
|
21
31
|
description: 'Layout with four columns of equal width'
|
|
22
32
|
},
|
|
23
33
|
fiveColumns: {
|
|
24
34
|
id: 'fabric.editor.fiveColumns',
|
|
25
|
-
defaultMessage: '
|
|
35
|
+
defaultMessage: '5 Column layout',
|
|
26
36
|
description: 'Layout with five columns of equal width'
|
|
27
37
|
},
|
|
28
38
|
rightSidebar: {
|
|
@@ -62,7 +72,7 @@ export const toolbarMessages = defineMessages({
|
|
|
62
72
|
},
|
|
63
73
|
columnOption: {
|
|
64
74
|
id: 'fabric.editor.layout.columnOption',
|
|
65
|
-
defaultMessage: '{count, plural, one {
|
|
75
|
+
defaultMessage: '{count, plural, one { Column} other {{count} Columns}}',
|
|
66
76
|
description: 'column option text for layout'
|
|
67
77
|
}
|
|
68
78
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "96.
|
|
4
|
+
const packageVersion = "96.1.1";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -528,6 +528,7 @@ import { EventDispatcher } from '../event-dispatcher';
|
|
|
528
528
|
*/
|
|
529
529
|
export class EditorPresetBuilder {
|
|
530
530
|
constructor(...more) {
|
|
531
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
531
532
|
/**
|
|
532
533
|
* @deprecated Use `apiResolver` instead
|
|
533
534
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { processRawFragmentValue, processRawValue } from '
|
|
1
|
+
import { processRawFragmentValue, processRawValue } from '../../utils/processRawValue';
|
|
2
2
|
import { editorCommandToPMCommand } from '../editor-commands';
|
|
3
3
|
import { scheduleDocumentRequest } from './requestDocument';
|
|
4
4
|
|
package/dist/es2019/rank.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
1
2
|
// @deprecated
|
|
2
3
|
// @private This rank is not stable and should not be trusted. If you need to change this file, please let the Editor lego team know about it
|
|
3
4
|
export const rankEditorPlugins = {
|
|
@@ -28,6 +29,7 @@ export const rankEditorPlugins = {
|
|
|
28
29
|
'unsupportedMark', 'unsupportedNodeAttribute']
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
31
33
|
// @deprecated
|
|
32
34
|
// @private This rank is not stable and should not be trusted. If you need to change this file, please let the Editor lego team know about it
|
|
33
35
|
export function sortByOrder(item) {
|
|
@@ -41,6 +43,7 @@ export function sortByOrder(item) {
|
|
|
41
43
|
// function avoided that whole mess. If someone can think of a better way to implement
|
|
42
44
|
// the above and below into a single function please do so
|
|
43
45
|
|
|
46
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
44
47
|
// @deprecated
|
|
45
48
|
// @private This rank is not stable and should not be trusted. If you need to change this file, please let the Editor lego team know about it
|
|
46
49
|
export function sortByOrderWithTypeName(item) {
|
|
@@ -10,10 +10,12 @@ export let SortOrder = /*#__PURE__*/function (SortOrder) {
|
|
|
10
10
|
export { AnnotationUpdateEmitter, AnnotationUpdateEvent } from './annotation/emitter';
|
|
11
11
|
export { ToolbarSize, ToolbarWidths, ToolbarWidthsNext, ToolbarWidthsFullPage, ToolbarWidthsFullPageNext } from './toolbar';
|
|
12
12
|
|
|
13
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
13
14
|
/**
|
|
14
15
|
* @deprecated
|
|
15
16
|
*/
|
|
16
17
|
|
|
18
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
17
19
|
/**
|
|
18
20
|
* @deprecated
|
|
19
21
|
*
|
|
@@ -8,6 +8,7 @@ export let ToolbarSize = /*#__PURE__*/function (ToolbarSize) {
|
|
|
8
8
|
return ToolbarSize;
|
|
9
9
|
}({});
|
|
10
10
|
|
|
11
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
11
12
|
/** @deprecated
|
|
12
13
|
* To be removed as part of ED-25129 in favour of ToolbarWidthsNext along with references
|
|
13
14
|
* to platform_editor_toolbar_responsive_fixes feature gate
|
|
@@ -29,6 +30,7 @@ export let ToolbarWidthsNext = /*#__PURE__*/function (ToolbarWidthsNext) {
|
|
|
29
30
|
return ToolbarWidthsNext;
|
|
30
31
|
}({});
|
|
31
32
|
|
|
33
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
32
34
|
/** @deprecated
|
|
33
35
|
* To be removed as part of ED-25129 in favour of ToolbarWidthsFullPageNext along with references
|
|
34
36
|
* to platform_editor_toolbar_responsive_fixes feature gate
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "96.
|
|
16
|
+
const packageVersion = "96.1.1";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
class DropList extends Component {
|
|
@@ -17,7 +17,9 @@ class WithOutsideClick extends PureComponent {
|
|
|
17
17
|
if (!this.props.isActiveComponent || !this.props.handleClickOutside) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
const domNode = fg('platform_editor_replace_finddomnode_in_common') ? (_this$props$outsideCl = this.props.outsideClickTargetRef.current) === null || _this$props$outsideCl === void 0 ? void 0 : _this$props$outsideCl.deref() :
|
|
20
|
+
const domNode = fg('platform_editor_replace_finddomnode_in_common') ? (_this$props$outsideCl = this.props.outsideClickTargetRef.current) === null || _this$props$outsideCl === void 0 ? void 0 : _this$props$outsideCl.deref() :
|
|
21
|
+
// eslint-disable-next-line react/no-find-dom-node -- Ignored via go/ED-25883
|
|
22
|
+
ReactDOM.findDOMNode(this);
|
|
21
23
|
if (!domNode || evt.target instanceof Node && !domNode.contains(evt.target)) {
|
|
22
24
|
var _this$props$editorVie;
|
|
23
25
|
this.props.handleClickOutside(evt);
|
package/dist/es2019/utils/dom.js
CHANGED
|
@@ -126,6 +126,7 @@ export { hasMergedCell, calcTableColumnWidths, convertProsemirrorTableNodeToArra
|
|
|
126
126
|
export { createCompareNodes } from './compareNodes';
|
|
127
127
|
export { compose } from './compose';
|
|
128
128
|
export { isTextInput } from './is-text-input';
|
|
129
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
129
130
|
/**
|
|
130
131
|
* @deprecated - [ED-23844] moving to own entry point @atlaskit/editor-common/whitespace
|
|
131
132
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isPerformanceAPIAvailable } from './is-performance-api-available';
|
|
2
2
|
const measureMap = new Map();
|
|
3
3
|
|
|
4
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
4
5
|
/**
|
|
5
6
|
* @deprecated use 'startMeasure' from '@atlaskit/editor-common/performance-measures'
|
|
6
7
|
*/
|
|
@@ -12,6 +13,7 @@ export function startMeasure(measureName) {
|
|
|
12
13
|
measureMap.set(measureName, performance.now());
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
15
17
|
/**
|
|
16
18
|
* @deprecated use 'stopMeasure' from '@atlaskit/editor-common/performance-measures'
|
|
17
19
|
*/
|
|
@@ -36,6 +38,7 @@ export function stopMeasure(measureName, onMeasureComplete) {
|
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
|
|
41
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
39
42
|
/**
|
|
40
43
|
* @deprecated use 'clearMeasure' from '@atlaskit/editor-common/performance-measures'
|
|
41
44
|
*/
|
|
@@ -535,7 +535,8 @@ export function ElementItem(_ref10) {
|
|
|
535
535
|
var icon = item.icon,
|
|
536
536
|
title = item.title,
|
|
537
537
|
description = item.description,
|
|
538
|
-
keyshortcut = item.keyshortcut
|
|
538
|
+
keyshortcut = item.keyshortcut,
|
|
539
|
+
isDisabled = item.isDisabled;
|
|
539
540
|
return jsx(Tooltip, {
|
|
540
541
|
content: description,
|
|
541
542
|
testId: "element-item-tooltip-".concat(index)
|
|
@@ -549,7 +550,8 @@ export function ElementItem(_ref10) {
|
|
|
549
550
|
"aria-describedby": title,
|
|
550
551
|
ref: ref,
|
|
551
552
|
testId: "element-item-".concat(index),
|
|
552
|
-
id: "searched-item-".concat(index)
|
|
553
|
+
id: "searched-item-".concat(index),
|
|
554
|
+
isDisabled: isDisabled
|
|
553
555
|
}, jsx(ItemContent
|
|
554
556
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
555
557
|
, {
|
|
@@ -557,7 +559,8 @@ export function ElementItem(_ref10) {
|
|
|
557
559
|
tabIndex: 0,
|
|
558
560
|
title: title,
|
|
559
561
|
description: description,
|
|
560
|
-
keyshortcut: keyshortcut
|
|
562
|
+
keyshortcut: keyshortcut,
|
|
563
|
+
isDisabled: isDisabled
|
|
561
564
|
})));
|
|
562
565
|
}
|
|
563
566
|
|
|
@@ -576,7 +579,8 @@ var ElementBefore = /*#__PURE__*/memo(function (_ref11) {
|
|
|
576
579
|
var ItemContent = /*#__PURE__*/memo(function (_ref12) {
|
|
577
580
|
var title = _ref12.title,
|
|
578
581
|
description = _ref12.description,
|
|
579
|
-
keyshortcut = _ref12.keyshortcut
|
|
582
|
+
keyshortcut = _ref12.keyshortcut,
|
|
583
|
+
isDisabled = _ref12.isDisabled;
|
|
580
584
|
if (fg('platform_editor_typography_ugc')) {
|
|
581
585
|
return (
|
|
582
586
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -590,13 +594,14 @@ var ItemContent = /*#__PURE__*/memo(function (_ref12) {
|
|
|
590
594
|
}, jsx("div", {
|
|
591
595
|
css: itemTitleWrapper
|
|
592
596
|
}, jsx(Text, {
|
|
597
|
+
color: isDisabled ? 'color.text.disabled' : undefined,
|
|
593
598
|
maxLines: 1
|
|
594
599
|
}, title), jsx("div", {
|
|
595
600
|
css: itemAfter
|
|
596
601
|
}, keyshortcut && jsx("div", {
|
|
597
602
|
css: shortcutStyle
|
|
598
603
|
}, keyshortcut))), description && jsx(Text, {
|
|
599
|
-
color:
|
|
604
|
+
color: isDisabled ? 'color.text.disabled' : 'color.text.subtle',
|
|
600
605
|
size: "small",
|
|
601
606
|
maxLines: 2
|
|
602
607
|
}, description))))
|
|
@@ -612,13 +617,15 @@ var ItemContent = /*#__PURE__*/memo(function (_ref12) {
|
|
|
612
617
|
}, jsx("div", {
|
|
613
618
|
css: itemTitleWrapper
|
|
614
619
|
}, jsx("p", {
|
|
615
|
-
css: itemTitle
|
|
620
|
+
css: isDisabled ? itemTitleDisabled : itemTitle
|
|
616
621
|
}, title), jsx("div", {
|
|
617
622
|
css: itemAfter
|
|
618
623
|
}, keyshortcut && jsx("div", {
|
|
619
624
|
css: shortcutStyle
|
|
620
|
-
}, keyshortcut))), description &&
|
|
621
|
-
|
|
625
|
+
}, keyshortcut))), description &&
|
|
626
|
+
// eslint-disable-next-line @atlaskit/design-system/use-primitives-text
|
|
627
|
+
jsx("p", {
|
|
628
|
+
css: isDisabled ? itemDescriptionDisabled : itemDescription
|
|
622
629
|
}, description)))
|
|
623
630
|
);
|
|
624
631
|
}
|
|
@@ -698,6 +705,15 @@ var itemDescription = css(multilineStyle, {
|
|
|
698
705
|
color: "var(--ds-text-subtle, #44546F)",
|
|
699
706
|
marginTop: "var(--ds-space-025, 2px)"
|
|
700
707
|
});
|
|
708
|
+
|
|
709
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
710
|
+
var itemDescriptionDisabled = css(multilineStyle, {
|
|
711
|
+
overflow: 'hidden',
|
|
712
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
713
|
+
fontSize: relativeFontSizeToBase16(11.67),
|
|
714
|
+
color: "var(--ds-text-disabled, #091E424F)",
|
|
715
|
+
marginTop: "var(--ds-space-025, 2px)"
|
|
716
|
+
});
|
|
701
717
|
var itemText = css({
|
|
702
718
|
width: 'inherit',
|
|
703
719
|
whiteSpace: 'initial'
|
|
@@ -712,6 +728,13 @@ var itemTitle = css({
|
|
|
712
728
|
whiteSpace: 'nowrap',
|
|
713
729
|
textOverflow: 'ellipsis'
|
|
714
730
|
});
|
|
731
|
+
var itemTitleDisabled = css({
|
|
732
|
+
width: '100%',
|
|
733
|
+
overflow: 'hidden',
|
|
734
|
+
whiteSpace: 'nowrap',
|
|
735
|
+
textOverflow: 'ellipsis',
|
|
736
|
+
color: "var(--ds-text-disabled, #091E424F)"
|
|
737
|
+
});
|
|
715
738
|
var itemAfter = css({
|
|
716
739
|
flex: '0 0 auto',
|
|
717
740
|
paddingTop: "var(--ds-space-025, 2px)",
|
|
@@ -146,7 +146,11 @@ function StatelessElementBrowser(props) {
|
|
|
146
146
|
// After user pick some category the category should stay focused.
|
|
147
147
|
isFocusSearch = !categoryBeenChosen.current || !isEmptySearchTerm;
|
|
148
148
|
}
|
|
149
|
-
var
|
|
149
|
+
var itemIsDisabled = useCallback(function (index) {
|
|
150
|
+
var _items$index$isDisabl, _items$index;
|
|
151
|
+
return (_items$index$isDisabl = (_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.isDisabled) !== null && _items$index$isDisabl !== void 0 ? _items$index$isDisabl : false;
|
|
152
|
+
}, [items]);
|
|
153
|
+
var _useSelectAndFocusOnA = useSelectAndFocusOnArrowNavigation(items.length - 1, columnCount, !!viewMoreItem, itemIsDisabled, isFocusSearch),
|
|
150
154
|
selectedItemIndex = _useSelectAndFocusOnA.selectedItemIndex,
|
|
151
155
|
focusedItemIndex = _useSelectAndFocusOnA.focusedItemIndex,
|
|
152
156
|
setFocusedItemIndex = _useSelectAndFocusOnA.setFocusedItemIndex,
|
|
@@ -186,6 +190,7 @@ function StatelessElementBrowser(props) {
|
|
|
186
190
|
*/
|
|
187
191
|
var selectedItem = selectedItemIndex !== undefined ? items[selectedItemIndex] : null;
|
|
188
192
|
var onItemsEnterTabKeyPress = useCallback(function (e) {
|
|
193
|
+
var _selectedItem$isDisab;
|
|
189
194
|
if (e.key !== 'Enter' && (e.key !== 'Tab' || !showCategories)) {
|
|
190
195
|
return;
|
|
191
196
|
}
|
|
@@ -195,7 +200,7 @@ function StatelessElementBrowser(props) {
|
|
|
195
200
|
e.preventDefault();
|
|
196
201
|
return;
|
|
197
202
|
}
|
|
198
|
-
if (onInsertItem && selectedItem != null) {
|
|
203
|
+
if (onInsertItem && selectedItem != null && !((_selectedItem$isDisab = selectedItem.isDisabled) !== null && _selectedItem$isDisab !== void 0 ? _selectedItem$isDisab : false)) {
|
|
199
204
|
onInsertItem(selectedItem);
|
|
200
205
|
}
|
|
201
206
|
e.preventDefault();
|