@atlaskit/editor-core 187.15.0 → 187.16.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 +17 -0
- package/dist/cjs/create-editor/create-plugins-list.js +2 -7
- package/dist/cjs/create-editor/feature-flags-from-props.js +23 -28
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/plugins/media/toolbar/alt-text.js +5 -2
- package/dist/cjs/plugins/media/toolbar/index.js +7 -5
- package/dist/cjs/plugins/media/toolbar/linking-toolbar-appearance.js +3 -4
- package/dist/cjs/plugins/media/ui/MediaLinkingToolbar.js +1 -2
- package/dist/cjs/plugins/panel/pm-plugins/keymaps.js +13 -4
- package/dist/cjs/plugins/type-ahead/index.js +1 -4
- package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +2 -4
- package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +2 -4
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +21 -40
- package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -9
- package/dist/cjs/plugins/type-ahead/utils.js +15 -19
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +2 -7
- package/dist/es2019/create-editor/feature-flags-from-props.js +23 -28
- package/dist/es2019/index.js +0 -1
- package/dist/es2019/plugins/media/toolbar/alt-text.js +6 -4
- package/dist/es2019/plugins/media/toolbar/index.js +7 -5
- package/dist/es2019/plugins/media/toolbar/linking-toolbar-appearance.js +1 -1
- package/dist/es2019/plugins/media/ui/MediaLinkingToolbar.js +1 -2
- package/dist/es2019/plugins/panel/pm-plugins/keymaps.js +13 -4
- package/dist/es2019/plugins/type-ahead/index.js +1 -4
- package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +2 -4
- package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +2 -4
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +21 -40
- package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -9
- package/dist/es2019/plugins/type-ahead/utils.js +15 -19
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +2 -7
- package/dist/esm/create-editor/feature-flags-from-props.js +23 -28
- package/dist/esm/index.js +0 -1
- package/dist/esm/plugins/media/toolbar/alt-text.js +6 -4
- package/dist/esm/plugins/media/toolbar/index.js +7 -5
- package/dist/esm/plugins/media/toolbar/linking-toolbar-appearance.js +1 -1
- package/dist/esm/plugins/media/ui/MediaLinkingToolbar.js +1 -2
- package/dist/esm/plugins/panel/pm-plugins/keymaps.js +13 -4
- package/dist/esm/plugins/type-ahead/index.js +1 -4
- package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +2 -4
- package/dist/esm/plugins/type-ahead/pm-plugins/main.js +2 -4
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +21 -40
- package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -9
- package/dist/esm/plugins/type-ahead/utils.js +15 -19
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/create-plugins-list.d.ts +6 -6
- package/dist/types/index.d.ts +0 -5
- package/dist/types/plugins/annotation/toolbar.d.ts +1 -1
- package/dist/types/plugins/code-block/toolbar.d.ts +1 -2
- package/dist/types/plugins/copy-button/toolbar.d.ts +1 -1
- package/dist/types/plugins/expand/toolbar.d.ts +1 -1
- package/dist/types/plugins/extension/toolbar.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/index.d.ts +3 -6
- package/dist/types/plugins/floating-toolbar/ui/CheckboxModal.d.ts +2 -2
- package/dist/types/plugins/floating-toolbar/ui/ConfirmationModal.d.ts +2 -2
- package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/SimpleModal.d.ts +2 -2
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
- package/dist/types/plugins/layout/index.d.ts +1 -1
- package/dist/types/plugins/layout/toolbar.d.ts +1 -1
- package/dist/types/plugins/media/toolbar/alt-text.d.ts +3 -1
- package/dist/types/plugins/media/toolbar/index.d.ts +1 -1
- package/dist/types/plugins/media/toolbar/linking.d.ts +1 -1
- package/dist/types/plugins/panel/toolbar.d.ts +1 -1
- package/dist/types/plugins/type-ahead/index.d.ts +0 -1
- package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +1 -2
- package/dist/types/plugins/type-ahead/pm-plugins/main.d.ts +1 -2
- package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +0 -1
- package/dist/types/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -1
- package/dist/types/plugins/type-ahead/utils.d.ts +1 -2
- package/dist/types-ts4.5/create-editor/create-plugins-list.d.ts +6 -6
- package/dist/types-ts4.5/index.d.ts +0 -5
- package/dist/types-ts4.5/plugins/annotation/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/code-block/toolbar.d.ts +1 -2
- package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/expand/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +3 -6
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/CheckboxModal.d.ts +2 -2
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/ConfirmationModal.d.ts +2 -2
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Dropdown.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/SimpleModal.d.ts +2 -2
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/layout/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/layout/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/toolbar/alt-text.d.ts +3 -1
- package/dist/types-ts4.5/plugins/media/toolbar/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/toolbar/linking.d.ts +1 -1
- package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/type-ahead/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/decorations.d.ts +1 -2
- package/dist/types-ts4.5/plugins/type-ahead/pm-plugins/main.d.ts +1 -2
- package/dist/types-ts4.5/plugins/type-ahead/ui/InputQuery.d.ts +0 -1
- package/dist/types-ts4.5/plugins/type-ahead/ui/WrapperTypeAhead.d.ts +0 -1
- package/dist/types-ts4.5/plugins/type-ahead/utils.d.ts +1 -2
- package/package.json +2 -2
- package/report.api.md +1 -48
- package/tmp/api-report-tmp.d.ts +1 -46
- package/dist/cjs/plugins/floating-toolbar/types.js +0 -5
- package/dist/cjs/plugins/floating-toolbar/ui/types.js +0 -5
- package/dist/es2019/plugins/floating-toolbar/types.js +0 -1
- package/dist/es2019/plugins/floating-toolbar/ui/types.js +0 -1
- package/dist/esm/plugins/floating-toolbar/types.js +0 -1
- package/dist/esm/plugins/floating-toolbar/ui/types.js +0 -1
- package/dist/types/plugins/floating-toolbar/types.d.ts +0 -1
- package/dist/types/plugins/floating-toolbar/ui/types.d.ts +0 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/types.d.ts +0 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/types.d.ts +0 -1
|
@@ -29,22 +29,17 @@ export function getScrollGutterOptions(props) {
|
|
|
29
29
|
return undefined;
|
|
30
30
|
}
|
|
31
31
|
export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent) {
|
|
32
|
-
var _props$performanceTra, _props$linking,
|
|
32
|
+
var _props$performanceTra, _props$linking, _props$performanceTra2, _props$textFormatting, _props$linking2;
|
|
33
33
|
const appearance = props.appearance;
|
|
34
34
|
const isMobile = appearance === 'mobile';
|
|
35
35
|
const inputTracking = (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : _props$performanceTra.inputTracking;
|
|
36
36
|
const cardOptions = ((_props$linking = props.linking) === null || _props$linking === void 0 ? void 0 : _props$linking.smartLinks) || props.smartLinks || props.UNSAFE_cards;
|
|
37
|
-
|
|
38
|
-
// duplicated logic from `feature-flags-from-props.ts` due to presets not being finalised
|
|
39
|
-
const pseudoNormalisedUseBetterTypeaheadNavigation = (_ref = (_props$featureFlags$u = (_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags['use-better-typeahead-navigation']) !== null && _props$featureFlags$u !== void 0 ? _props$featureFlags$u : (_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2.useBetterTypeaheadNavigation) !== null && _ref !== void 0 ? _ref : null;
|
|
40
|
-
const useBetterTypeaheadNavigation = Boolean(typeof pseudoNormalisedUseBetterTypeaheadNavigation === 'boolean' ? !!pseudoNormalisedUseBetterTypeaheadNavigation : true);
|
|
41
37
|
return {
|
|
42
38
|
...props,
|
|
43
39
|
createAnalyticsEvent,
|
|
44
40
|
typeAhead: {
|
|
45
41
|
createAnalyticsEvent,
|
|
46
|
-
isMobile
|
|
47
|
-
useBetterTypeaheadNavigation: useBetterTypeaheadNavigation
|
|
42
|
+
isMobile
|
|
48
43
|
},
|
|
49
44
|
featureFlags: createFeatureFlagsFromProps(props),
|
|
50
45
|
paste: {
|
|
@@ -21,12 +21,9 @@ function getSpellCheck(featureFlags) {
|
|
|
21
21
|
* which is used by both current and archv3 editors.
|
|
22
22
|
*/
|
|
23
23
|
export function createFeatureFlagsFromProps(props) {
|
|
24
|
-
var _props$featureFlags,
|
|
24
|
+
var _props$featureFlags, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$allowTables5, _props$featureFlags10, _props$featureFlags11, _props$allowTables6, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$collabEdit, _props$collabEdit2, _props$featureFlags30, _props$featureFlags31, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41, _props$featureFlags42;
|
|
25
25
|
const normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
|
|
26
26
|
const tableCellOptionsInFloatingToolbar = normalizedFeatureFlags.tableCellOptionsInFloatingToolbar || ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableCellOptionsInFloatingToolbar) || undefined;
|
|
27
|
-
|
|
28
|
-
// duplicated logic from `feature-flags-from-props.ts` due to presets not being finalised
|
|
29
|
-
const pseudoNormalisedUseBetterTypeaheadNavigation = (_ref = (_props$featureFlags$u = (_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2['use-better-typeahead-navigation']) !== null && _props$featureFlags$u !== void 0 ? _props$featureFlags$u : (_props$featureFlags3 = props.featureFlags) === null || _props$featureFlags3 === void 0 ? void 0 : _props$featureFlags3.useBetterTypeaheadNavigation) !== null && _ref !== void 0 ? _ref : null;
|
|
30
27
|
return {
|
|
31
28
|
...normalizedFeatureFlags,
|
|
32
29
|
newInsertionBehaviour: props.allowNewInsertionBehaviour,
|
|
@@ -38,36 +35,34 @@ export function createFeatureFlagsFromProps(props) {
|
|
|
38
35
|
singleLayout: typeof props.allowLayouts === 'object' && !!((_props$allowLayouts = props.allowLayouts) !== null && _props$allowLayouts !== void 0 && _props$allowLayouts.UNSAFE_allowSingleColumnLayout),
|
|
39
36
|
undoRedoButtons: props.allowUndoRedoButtons,
|
|
40
37
|
catchAllTracking: (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : (_props$performanceTra2 = _props$performanceTra.catchAllTracking) === null || _props$performanceTra2 === void 0 ? void 0 : _props$performanceTra2.enabled,
|
|
41
|
-
stickyHeadersOptimization: typeof ((_props$
|
|
42
|
-
initialRenderOptimization: typeof ((_props$
|
|
43
|
-
mouseMoveOptimization: typeof ((_props$
|
|
44
|
-
tableRenderOptimization: typeof ((_props$
|
|
45
|
-
tableOverflowShadowsOptimization: typeof ((_props$
|
|
38
|
+
stickyHeadersOptimization: typeof ((_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2.stickyHeadersOptimization) === 'boolean' ? !!((_props$featureFlags3 = props.featureFlags) !== null && _props$featureFlags3 !== void 0 && _props$featureFlags3.stickyHeadersOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables = props.allowTables) !== null && _props$allowTables !== void 0 && _props$allowTables.stickyHeadersOptimization),
|
|
39
|
+
initialRenderOptimization: typeof ((_props$featureFlags4 = props.featureFlags) === null || _props$featureFlags4 === void 0 ? void 0 : _props$featureFlags4.initialRenderOptimization) === 'boolean' ? !!((_props$featureFlags5 = props.featureFlags) !== null && _props$featureFlags5 !== void 0 && _props$featureFlags5.initialRenderOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables2 = props.allowTables) !== null && _props$allowTables2 !== void 0 && _props$allowTables2.initialRenderOptimization),
|
|
40
|
+
mouseMoveOptimization: typeof ((_props$featureFlags6 = props.featureFlags) === null || _props$featureFlags6 === void 0 ? void 0 : _props$featureFlags6.mouseMoveOptimization) === 'boolean' ? !!((_props$featureFlags7 = props.featureFlags) !== null && _props$featureFlags7 !== void 0 && _props$featureFlags7.mouseMoveOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables3 = props.allowTables) !== null && _props$allowTables3 !== void 0 && _props$allowTables3.mouseMoveOptimization),
|
|
41
|
+
tableRenderOptimization: typeof ((_props$featureFlags8 = props.featureFlags) === null || _props$featureFlags8 === void 0 ? void 0 : _props$featureFlags8.tableRenderOptimization) === 'boolean' ? !!((_props$featureFlags9 = props.featureFlags) !== null && _props$featureFlags9 !== void 0 && _props$featureFlags9.tableRenderOptimization) : typeof props.allowTables === 'object' && typeof ((_props$allowTables4 = props.allowTables) === null || _props$allowTables4 === void 0 ? void 0 : _props$allowTables4.tableRenderOptimization) === 'boolean' ? (_props$allowTables5 = props.allowTables) === null || _props$allowTables5 === void 0 ? void 0 : _props$allowTables5.tableRenderOptimization : true,
|
|
42
|
+
tableOverflowShadowsOptimization: typeof ((_props$featureFlags10 = props.featureFlags) === null || _props$featureFlags10 === void 0 ? void 0 : _props$featureFlags10.tableOverflowShadowsOptimization) === 'boolean' ? !!((_props$featureFlags11 = props.featureFlags) !== null && _props$featureFlags11 !== void 0 && _props$featureFlags11.tableOverflowShadowsOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables6 = props.allowTables) !== null && _props$allowTables6 !== void 0 && _props$allowTables6.tableOverflowShadowsOptimization),
|
|
46
43
|
extendFloatingToolbar: Boolean(typeof props.allowExtension === 'object' && ((_props$allowExtension = props.allowExtension) === null || _props$allowExtension === void 0 ? void 0 : _props$allowExtension.allowExtendFloatingToolbars)),
|
|
47
|
-
showAvatarGroupAsPlugin: Boolean(typeof ((_props$
|
|
48
|
-
errorBoundaryDocStructure: Boolean(typeof ((_props$
|
|
49
|
-
synchronyErrorDocStructure: Boolean(typeof ((_props$
|
|
50
|
-
enableViewUpdateSubscription: Boolean(typeof ((_props$
|
|
51
|
-
collabAvatarScroll: Boolean(typeof ((_props$
|
|
52
|
-
ufo: Boolean(typeof ((_props$
|
|
53
|
-
twoLineEditorToolbar: Boolean(typeof ((_props$
|
|
54
|
-
saferDispatchedTransactions: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactions === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactions || (typeof ((_props$
|
|
55
|
-
saferDispatchedTransactionsAnalyticsOnly: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly || (typeof ((_props$
|
|
44
|
+
showAvatarGroupAsPlugin: Boolean(typeof ((_props$featureFlags12 = props.featureFlags) === null || _props$featureFlags12 === void 0 ? void 0 : _props$featureFlags12.showAvatarGroupAsPlugin) === 'boolean' ? !!((_props$featureFlags13 = props.featureFlags) !== null && _props$featureFlags13 !== void 0 && _props$featureFlags13.showAvatarGroupAsPlugin) : false),
|
|
45
|
+
errorBoundaryDocStructure: Boolean(typeof ((_props$featureFlags14 = props.featureFlags) === null || _props$featureFlags14 === void 0 ? void 0 : _props$featureFlags14.useErrorBoundaryDocStructure) === 'boolean' ? !!((_props$featureFlags15 = props.featureFlags) !== null && _props$featureFlags15 !== void 0 && _props$featureFlags15.useErrorBoundaryDocStructure) : false),
|
|
46
|
+
synchronyErrorDocStructure: Boolean(typeof ((_props$featureFlags16 = props.featureFlags) === null || _props$featureFlags16 === void 0 ? void 0 : _props$featureFlags16.synchronyErrorDocStructure) === 'boolean' ? !!((_props$featureFlags17 = props.featureFlags) !== null && _props$featureFlags17 !== void 0 && _props$featureFlags17.synchronyErrorDocStructure) : false),
|
|
47
|
+
enableViewUpdateSubscription: Boolean(typeof ((_props$featureFlags18 = props.featureFlags) === null || _props$featureFlags18 === void 0 ? void 0 : _props$featureFlags18.enableViewUpdateSubscription) === 'boolean' ? !!((_props$featureFlags19 = props.featureFlags) !== null && _props$featureFlags19 !== void 0 && _props$featureFlags19.enableViewUpdateSubscription) : false),
|
|
48
|
+
collabAvatarScroll: Boolean(typeof ((_props$featureFlags20 = props.featureFlags) === null || _props$featureFlags20 === void 0 ? void 0 : _props$featureFlags20.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags21 = props.featureFlags) !== null && _props$featureFlags21 !== void 0 && _props$featureFlags21.collabAvatarScroll) : false),
|
|
49
|
+
ufo: Boolean(typeof ((_props$featureFlags22 = props.featureFlags) === null || _props$featureFlags22 === void 0 ? void 0 : _props$featureFlags22.ufo) === 'boolean' ? !!((_props$featureFlags23 = props.featureFlags) !== null && _props$featureFlags23 !== void 0 && _props$featureFlags23.ufo) : false),
|
|
50
|
+
twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags24 = props.featureFlags) === null || _props$featureFlags24 === void 0 ? void 0 : _props$featureFlags24.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags25 = props.featureFlags) !== null && _props$featureFlags25 !== void 0 && _props$featureFlags25.twoLineEditorToolbar) : false),
|
|
51
|
+
saferDispatchedTransactions: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactions === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactions || (typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26.saferDispatchedTransactions) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27.saferDispatchedTransactions) : false)),
|
|
52
|
+
saferDispatchedTransactionsAnalyticsOnly: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly || (typeof ((_props$featureFlags28 = props.featureFlags) === null || _props$featureFlags28 === void 0 ? void 0 : _props$featureFlags28.saferDispatchedTransactionsAnalyticsOnly) === 'boolean' ? !!((_props$featureFlags29 = props.featureFlags) !== null && _props$featureFlags29 !== void 0 && _props$featureFlags29.saferDispatchedTransactionsAnalyticsOnly) : false)),
|
|
56
53
|
useNativeCollabPlugin: Boolean(typeof ((_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.useNativePlugin) === 'boolean' ? !!((_props$collabEdit2 = props.collabEdit) !== null && _props$collabEdit2 !== void 0 && _props$collabEdit2.useNativePlugin) : false),
|
|
57
|
-
chromeCursorHandlerFixedVersion: typeof ((_props$
|
|
54
|
+
chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags30 = props.featureFlags) === null || _props$featureFlags30 === void 0 ? void 0 : _props$featureFlags30.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
|
|
58
55
|
tableCellOptionsInFloatingToolbar: typeof tableCellOptionsInFloatingToolbar === 'boolean' ? tableCellOptionsInFloatingToolbar : false,
|
|
59
|
-
showHoverPreview: Boolean(typeof ((_props$
|
|
60
|
-
indentationButtonsInTheToolbar: Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$
|
|
61
|
-
floatingToolbarCopyButton: Boolean(typeof normalizedFeatureFlags.floatingToolbarCopyButton === 'boolean' && !!normalizedFeatureFlags.floatingToolbarCopyButton || (typeof ((_props$
|
|
62
|
-
floatingToolbarLinkSettingsButton: typeof ((_props$
|
|
56
|
+
showHoverPreview: Boolean(typeof ((_props$featureFlags31 = props.featureFlags) === null || _props$featureFlags31 === void 0 ? void 0 : _props$featureFlags31.showHoverPreview) === 'boolean' ? !!((_props$featureFlags32 = props.featureFlags) !== null && _props$featureFlags32 !== void 0 && _props$featureFlags32.showHoverPreview) : false),
|
|
57
|
+
indentationButtonsInTheToolbar: Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags33 = props.featureFlags) === null || _props$featureFlags33 === void 0 ? void 0 : _props$featureFlags33.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags34 = props.featureFlags) !== null && _props$featureFlags34 !== void 0 && _props$featureFlags34.indentationButtonsInTheToolbar) : false)),
|
|
58
|
+
floatingToolbarCopyButton: Boolean(typeof normalizedFeatureFlags.floatingToolbarCopyButton === 'boolean' && !!normalizedFeatureFlags.floatingToolbarCopyButton || (typeof ((_props$featureFlags35 = props.featureFlags) === null || _props$featureFlags35 === void 0 ? void 0 : _props$featureFlags35.floatingToolbarCopyButton) === 'boolean' ? !!((_props$featureFlags36 = props.featureFlags) !== null && _props$featureFlags36 !== void 0 && _props$featureFlags36.floatingToolbarCopyButton) : false)),
|
|
59
|
+
floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags37 = props.featureFlags) === null || _props$featureFlags37 === void 0 ? void 0 : _props$featureFlags37['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
|
|
63
60
|
disableSpellcheckByBrowser: getSpellCheck(props.featureFlags),
|
|
64
61
|
// Including fallback to props.featureFlags so that mobile feature flags
|
|
65
62
|
// are included (they are not kebab cased)
|
|
66
|
-
restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$
|
|
67
|
-
useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$
|
|
63
|
+
restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags38 = props.featureFlags) === null || _props$featureFlags38 === void 0 ? void 0 : _props$featureFlags38.restartNumberedLists) === true,
|
|
64
|
+
useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$featureFlags39 = props.featureFlags) === null || _props$featureFlags39 === void 0 ? void 0 : _props$featureFlags39.useSomewhatSemanticTextColorNames) === 'boolean' ? !!((_props$featureFlags40 = props.featureFlags) !== null && _props$featureFlags40 !== void 0 && _props$featureFlags40.useSomewhatSemanticTextColorNames) : false)),
|
|
68
65
|
lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
|
|
69
|
-
preventPopupOverflow: Boolean(typeof ((_props$
|
|
70
|
-
// duplicated logic from `create-plugins-list.ts` due to presets not being finalised
|
|
71
|
-
useBetterTypeaheadNavigation: Boolean(typeof pseudoNormalisedUseBetterTypeaheadNavigation === 'boolean' ? !!pseudoNormalisedUseBetterTypeaheadNavigation : true)
|
|
66
|
+
preventPopupOverflow: Boolean(typeof ((_props$featureFlags41 = props.featureFlags) === null || _props$featureFlags41 === void 0 ? void 0 : _props$featureFlags41['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags42 = props.featureFlags) !== null && _props$featureFlags42 !== void 0 && _props$featureFlags42['prevent-popup-overflow']) : false)
|
|
72
67
|
};
|
|
73
68
|
}
|
package/dist/es2019/index.js
CHANGED
|
@@ -52,7 +52,6 @@ export { GapCursorSelection, Side as GapCursorSide } from './plugins/selection/g
|
|
|
52
52
|
export { selectionPluginKey } from './plugins/mobile-selection';
|
|
53
53
|
export { insertExpand } from './plugins/expand/commands';
|
|
54
54
|
export { default as WithPluginState } from './ui/WithPluginState';
|
|
55
|
-
export { pluginKey as floatingToolbarPluginKey } from './plugins/floating-toolbar';
|
|
56
55
|
export { lightModeStatusColorPalette, darkModeStatusColorPalette } from './ui/ColorPalette/Palettes/statusColorPalette';
|
|
57
56
|
export { DEFAULT_BORDER_COLOR } from './ui/ColorPalette/Palettes/common';
|
|
58
57
|
export { default as messages, statusMessages, dateMessages } from './messages';
|
|
@@ -2,11 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { openMediaAltTextMenu } from '../pm-plugins/alt-text/commands';
|
|
3
3
|
import { ToolTipContent, addAltText } from '../../../keymaps';
|
|
4
4
|
import { messages } from '../pm-plugins/alt-text/messages';
|
|
5
|
-
import AltTextEdit from '../pm-plugins/alt-text/ui/AltTextEdit';
|
|
6
|
-
import { CONTAINER_WIDTH_IN_PX } from '../pm-plugins/alt-text/ui/AltTextEdit';
|
|
5
|
+
import AltTextEdit, { CONTAINER_WIDTH_IN_PX } from '../pm-plugins/alt-text/ui/AltTextEdit';
|
|
7
6
|
import { getMediaNodeFromSelection } from '../utils/media-common';
|
|
8
7
|
import { ClassNames } from '../pm-plugins/alt-text/style';
|
|
9
|
-
import { forceFocusSelector } from '../../floating-toolbar/pm-plugins/force-focus';
|
|
10
8
|
const testId = 'alt-text-edit-button';
|
|
11
9
|
export const altTextButton = (intl, state) => {
|
|
12
10
|
const mediaNode = getMediaNodeFromSelection(state);
|
|
@@ -42,13 +40,17 @@ export const altTextEditComponent = options => {
|
|
|
42
40
|
* and not close the floating toolbar.
|
|
43
41
|
*/
|
|
44
42
|
const handleEsc = () => {
|
|
43
|
+
var _options$forceFocusSe;
|
|
45
44
|
const {
|
|
46
45
|
state: {
|
|
47
46
|
tr
|
|
48
47
|
},
|
|
49
48
|
dispatch
|
|
50
49
|
} = view;
|
|
51
|
-
|
|
50
|
+
const newTr = options === null || options === void 0 ? void 0 : (_options$forceFocusSe = options.forceFocusSelector) === null || _options$forceFocusSe === void 0 ? void 0 : _options$forceFocusSe.call(options, `[data-testid="${testId}"]`)(tr);
|
|
51
|
+
if (newTr) {
|
|
52
|
+
dispatch(newTr);
|
|
53
|
+
}
|
|
52
54
|
};
|
|
53
55
|
return /*#__PURE__*/React.createElement(AltTextEdit, {
|
|
54
56
|
view: view,
|
|
@@ -440,8 +440,10 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
440
440
|
if (allowAltTextOnImages) {
|
|
441
441
|
const mediaAltTextPluginState = getMediaAltTextPluginState(state);
|
|
442
442
|
if (mediaAltTextPluginState.isAltTextEditorOpen) {
|
|
443
|
+
var _pluginInjectionApi$d9;
|
|
443
444
|
return getAltTextToolbar(baseToolbar, {
|
|
444
|
-
altTextValidator
|
|
445
|
+
altTextValidator,
|
|
446
|
+
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d9 = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d9 === void 0 ? void 0 : _pluginInjectionApi$d9.forceFocusSelector
|
|
445
447
|
});
|
|
446
448
|
}
|
|
447
449
|
}
|
|
@@ -452,22 +454,22 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
452
454
|
selectedNodeType = state.selection.node.type;
|
|
453
455
|
}
|
|
454
456
|
if (allowMediaInline && (parentMediaGroupNode === null || parentMediaGroupNode === void 0 ? void 0 : parentMediaGroupNode.node.type) === mediaGroup) {
|
|
455
|
-
var _pluginInjectionApi$
|
|
457
|
+
var _pluginInjectionApi$d10, _pluginInjectionApi$d11;
|
|
456
458
|
const mediaOffset = state.selection.$from.parentOffset + 1;
|
|
457
459
|
baseToolbar.getDomRef = () => {
|
|
458
460
|
var _mediaPluginState$ele;
|
|
459
461
|
const selector = mediaFilmstripItemDOMSelector(mediaOffset);
|
|
460
462
|
return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
|
|
461
463
|
};
|
|
462
|
-
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
464
|
+
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d10 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d10 === void 0 ? void 0 : (_pluginInjectionApi$d11 = _pluginInjectionApi$d10.analytics) === null || _pluginInjectionApi$d11 === void 0 ? void 0 : _pluginInjectionApi$d11.actions);
|
|
463
465
|
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
464
|
-
var _pluginInjectionApi$
|
|
466
|
+
var _pluginInjectionApi$d12, _pluginInjectionApi$d13;
|
|
465
467
|
baseToolbar.getDomRef = () => {
|
|
466
468
|
var _mediaPluginState$ele2;
|
|
467
469
|
const element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(`.${MediaInlineNodeSelector}`);
|
|
468
470
|
return element || mediaPluginState.element;
|
|
469
471
|
};
|
|
470
|
-
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
472
|
+
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d12 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d12 === void 0 ? void 0 : (_pluginInjectionApi$d13 = _pluginInjectionApi$d12.analytics) === null || _pluginInjectionApi$d13 === void 0 ? void 0 : _pluginInjectionApi$d13.actions);
|
|
471
473
|
} else {
|
|
472
474
|
baseToolbar.getDomRef = () => {
|
|
473
475
|
var _mediaPluginState$ele3;
|
|
@@ -7,7 +7,7 @@ import OpenIcon from '@atlaskit/icon/glyph/shortcut';
|
|
|
7
7
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
8
8
|
import { checkMediaType } from '../utils/check-media-type';
|
|
9
9
|
import { FloatingToolbarButton as ToolbarButton } from '@atlaskit/editor-common/ui';
|
|
10
|
-
import Separator from '
|
|
10
|
+
import { FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
|
|
11
11
|
import { linkMessages } from '../../../messages';
|
|
12
12
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
13
13
|
import { ToolTipContent, addLink } from '../../../keymaps';
|
|
@@ -8,8 +8,7 @@ import EditorUnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
|
|
|
8
8
|
// Common Translations will live here
|
|
9
9
|
|
|
10
10
|
import { PanelTextInput } from '@atlaskit/editor-common/ui';
|
|
11
|
-
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
12
|
-
import Separator from '../../floating-toolbar/ui/Separator';
|
|
11
|
+
import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
|
|
13
12
|
import { container, containerWithProvider, inputWrapper, RecentSearch } from '@atlaskit/editor-common/link';
|
|
14
13
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
15
14
|
import { normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
@@ -20,6 +20,7 @@ export function keymapPlugin() {
|
|
|
20
20
|
};
|
|
21
21
|
const keymaps = {
|
|
22
22
|
Backspace: (state, dispatch) => {
|
|
23
|
+
var _nodeBeforePanel$type, _nodeBeforePanel$type2;
|
|
23
24
|
const {
|
|
24
25
|
selection,
|
|
25
26
|
schema: {
|
|
@@ -44,17 +45,25 @@ export function keymapPlugin() {
|
|
|
44
45
|
if ($from.parentOffset !== 0) {
|
|
45
46
|
return false;
|
|
46
47
|
}
|
|
47
|
-
const previousPos = tr.doc.resolve(Math.max(0, $from.before($from.depth) - 1));
|
|
48
|
-
const previousNodeType = previousPos.pos > 0 && previousPos.parent && previousPos.parent.type;
|
|
48
|
+
const $previousPos = tr.doc.resolve(Math.max(0, $from.before($from.depth) - 1));
|
|
49
|
+
const previousNodeType = $previousPos.pos > 0 && $previousPos.parent && $previousPos.parent.type;
|
|
49
50
|
const parentNodeType = $from.parent.type;
|
|
50
51
|
const isPreviousNodeAPanel = previousNodeType === panel;
|
|
51
52
|
const isParentNodeAPanel = parentNodeType === panel;
|
|
53
|
+
const nodeBeforePanel = $previousPos === null || $previousPos === void 0 ? void 0 : $previousPos.nodeBefore;
|
|
52
54
|
|
|
53
55
|
// Stops merging panels when deleting empty paragraph in between
|
|
54
56
|
// Stops merging blockquotes with panels when deleting from start of blockquote
|
|
55
|
-
|
|
57
|
+
|
|
58
|
+
if (isPreviousNodeAPanel && !isParentNodeAPanel || isInsideAnEmptyNode(selection, panel, state.schema) || hasParentNodeOfType(blockquote)(selection) ||
|
|
59
|
+
// Lift line of panel content up and out of the panel, when backspacing
|
|
60
|
+
// at the start of a panel, if the node before the panel is an 'isolating' node
|
|
61
|
+
// (for e.g. a table, or an expand), otherwise the default prosemirror backspace
|
|
62
|
+
// behaviour will fallback to 'select node backward' logic because the node
|
|
63
|
+
// before is an isolating node.
|
|
64
|
+
nodeBeforePanel !== null && nodeBeforePanel !== void 0 && (_nodeBeforePanel$type = nodeBeforePanel.type) !== null && _nodeBeforePanel$type !== void 0 && (_nodeBeforePanel$type2 = _nodeBeforePanel$type.spec) !== null && _nodeBeforePanel$type2 !== void 0 && _nodeBeforePanel$type2.isolating && hasParentNodeOfType(panel)(selection)) {
|
|
56
65
|
const content = $from.node($from.depth).content;
|
|
57
|
-
const insertPos = previousPos.pos;
|
|
66
|
+
const insertPos = $previousPos.pos;
|
|
58
67
|
deleteCurrentItem($from, tr).insert(insertPos, content);
|
|
59
68
|
if (dispatch) {
|
|
60
69
|
dispatch(setTextSelection(insertPos)(tr).scrollIntoView());
|
|
@@ -111,8 +111,6 @@ const TypeAheadMenu = /*#__PURE__*/React.memo(({
|
|
|
111
111
|
*
|
|
112
112
|
*/
|
|
113
113
|
const typeAheadPlugin = options => {
|
|
114
|
-
var _options$useBetterTyp;
|
|
115
|
-
const useBetterTypeaheadNavigation = (_options$useBetterTyp = options === null || options === void 0 ? void 0 : options.useBetterTypeaheadNavigation) !== null && _options$useBetterTyp !== void 0 ? _options$useBetterTyp : true;
|
|
116
114
|
const fireAnalyticsCallback = fireAnalyticsEvent(options === null || options === void 0 ? void 0 : options.createAnalyticsEvent);
|
|
117
115
|
const popupMountRef = {
|
|
118
116
|
current: null
|
|
@@ -138,8 +136,7 @@ const typeAheadPlugin = options => {
|
|
|
138
136
|
popupMountRef,
|
|
139
137
|
reactDispatch: dispatch,
|
|
140
138
|
typeAheadHandlers: typeAhead,
|
|
141
|
-
createAnalyticsEvent: options === null || options === void 0 ? void 0 : options.createAnalyticsEvent
|
|
142
|
-
useBetterTypeaheadNavigation
|
|
139
|
+
createAnalyticsEvent: options === null || options === void 0 ? void 0 : options.createAnalyticsEvent
|
|
143
140
|
})
|
|
144
141
|
}, {
|
|
145
142
|
name: 'typeAheadInsertItem',
|
|
@@ -15,8 +15,7 @@ import { closeTypeAhead } from '../transforms/close-type-ahead';
|
|
|
15
15
|
export const factoryDecorations = ({
|
|
16
16
|
intl,
|
|
17
17
|
popupMountRef,
|
|
18
|
-
createAnalyticsEvent
|
|
19
|
-
useBetterTypeaheadNavigation
|
|
18
|
+
createAnalyticsEvent
|
|
20
19
|
}) => {
|
|
21
20
|
const createDecorations = (tr, {
|
|
22
21
|
triggerHandler,
|
|
@@ -94,8 +93,7 @@ export const factoryDecorations = ({
|
|
|
94
93
|
popupsBoundariesElement: (_popupMountRef$curren2 = popupMountRef.current) === null || _popupMountRef$curren2 === void 0 ? void 0 : _popupMountRef$curren2.popupsBoundariesElement,
|
|
95
94
|
popupsScrollableElement: (_popupMountRef$curren3 = popupMountRef.current) === null || _popupMountRef$curren3 === void 0 ? void 0 : _popupMountRef$curren3.popupsScrollableElement,
|
|
96
95
|
onUndoRedo: onUndoRedo,
|
|
97
|
-
reopenQuery: reopenQuery
|
|
98
|
-
useBetterTypeaheadNavigation: useBetterTypeaheadNavigation
|
|
96
|
+
reopenQuery: reopenQuery
|
|
99
97
|
})), typeaheadComponent);
|
|
100
98
|
shouldFocusCursorInsideQuery = false;
|
|
101
99
|
return typeaheadComponent;
|
|
@@ -23,8 +23,7 @@ export function createPlugin({
|
|
|
23
23
|
popupMountRef,
|
|
24
24
|
createAnalyticsEvent,
|
|
25
25
|
typeAheadHandlers,
|
|
26
|
-
getIntl
|
|
27
|
-
useBetterTypeaheadNavigation
|
|
26
|
+
getIntl
|
|
28
27
|
}) {
|
|
29
28
|
const intl = getIntl();
|
|
30
29
|
const {
|
|
@@ -33,8 +32,7 @@ export function createPlugin({
|
|
|
33
32
|
} = factoryDecorations({
|
|
34
33
|
intl,
|
|
35
34
|
popupMountRef,
|
|
36
|
-
createAnalyticsEvent: createAnalyticsEvent
|
|
37
|
-
useBetterTypeaheadNavigation
|
|
35
|
+
createAnalyticsEvent: createAnalyticsEvent
|
|
38
36
|
});
|
|
39
37
|
const reducer = createReducer({
|
|
40
38
|
createDecorations,
|
|
@@ -65,8 +65,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
65
65
|
onQueryFocus,
|
|
66
66
|
onUndoRedo,
|
|
67
67
|
editorView,
|
|
68
|
-
items
|
|
69
|
-
useBetterTypeaheadNavigation
|
|
68
|
+
items
|
|
70
69
|
}) => {
|
|
71
70
|
const ref = useRef(document.createElement('span'));
|
|
72
71
|
const inputRef = useRef(null);
|
|
@@ -135,27 +134,6 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
135
134
|
// Some suggested the other workaround maybe listen on`keypress` instead of `keydown`
|
|
136
135
|
if (!event.isComposing && event.which !== 229 && event.keyCode !== 229) {
|
|
137
136
|
if (selectedIndex === -1) {
|
|
138
|
-
if (useBetterTypeaheadNavigation) {
|
|
139
|
-
/**
|
|
140
|
-
* TODO DTR-1401: (also see ED-17200) There are two options
|
|
141
|
-
* here, either
|
|
142
|
-
* - set the index directly to 1 in WrapperTypeAhead.tsx's
|
|
143
|
-
* `insertSelectedItem` at the cost of breaking some of the a11y
|
|
144
|
-
* focus changes,
|
|
145
|
-
* - or do this jank at the cost of some small analytics noise.
|
|
146
|
-
*
|
|
147
|
-
* The focus behaviour still needs cleanup
|
|
148
|
-
*/
|
|
149
|
-
selectPreviousItem();
|
|
150
|
-
}
|
|
151
|
-
selectNextItem();
|
|
152
|
-
}
|
|
153
|
-
onItemSelect(event.shiftKey ? SelectItemMode.SHIFT_ENTER : SelectItemMode.ENTER);
|
|
154
|
-
}
|
|
155
|
-
break;
|
|
156
|
-
case 'Tab':
|
|
157
|
-
if (selectedIndex === -1) {
|
|
158
|
-
if (useBetterTypeaheadNavigation) {
|
|
159
137
|
/**
|
|
160
138
|
* TODO DTR-1401: (also see ED-17200) There are two options
|
|
161
139
|
* here, either
|
|
@@ -164,33 +142,36 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
164
142
|
* focus changes,
|
|
165
143
|
* - or do this jank at the cost of some small analytics noise.
|
|
166
144
|
*
|
|
145
|
+
* The focus behaviour still needs cleanup
|
|
167
146
|
*/
|
|
168
147
|
selectPreviousItem();
|
|
148
|
+
selectNextItem();
|
|
169
149
|
}
|
|
150
|
+
onItemSelect(event.shiftKey ? SelectItemMode.SHIFT_ENTER : SelectItemMode.ENTER);
|
|
151
|
+
}
|
|
152
|
+
break;
|
|
153
|
+
case 'Tab':
|
|
154
|
+
if (selectedIndex === -1) {
|
|
155
|
+
/**
|
|
156
|
+
* TODO DTR-1401: (also see ED-17200) There are two options
|
|
157
|
+
* here, either
|
|
158
|
+
* - set the index directly to 1 in WrapperTypeAhead.tsx's
|
|
159
|
+
* `insertSelectedItem` at the cost of breaking some of the a11y
|
|
160
|
+
* focus changes,
|
|
161
|
+
* - or do this jank at the cost of some small analytics noise.
|
|
162
|
+
*
|
|
163
|
+
*/
|
|
164
|
+
selectPreviousItem();
|
|
170
165
|
selectNextItem();
|
|
171
166
|
}
|
|
172
167
|
// TODO DTR-1401: why is this calling select item when hitting tab? fix this in DTR-1401
|
|
173
168
|
onItemSelect(SelectItemMode.TAB);
|
|
174
169
|
break;
|
|
175
170
|
case 'ArrowDown':
|
|
176
|
-
|
|
177
|
-
selectNextItem();
|
|
178
|
-
} else {
|
|
179
|
-
// TODO DTR-1401: why were we preventing selection?
|
|
180
|
-
if (selectedIndex === -1) {
|
|
181
|
-
selectNextItem();
|
|
182
|
-
}
|
|
183
|
-
}
|
|
171
|
+
selectNextItem();
|
|
184
172
|
break;
|
|
185
173
|
case 'ArrowUp':
|
|
186
|
-
|
|
187
|
-
selectPreviousItem();
|
|
188
|
-
} else {
|
|
189
|
-
// TODO DTR-1401: why were we preventing selection?
|
|
190
|
-
if (selectedIndex === -1) {
|
|
191
|
-
selectPreviousItem();
|
|
192
|
-
}
|
|
193
|
-
}
|
|
174
|
+
selectPreviousItem();
|
|
194
175
|
break;
|
|
195
176
|
}
|
|
196
177
|
const undoRedoType = isUndoRedoShortcut(event);
|
|
@@ -202,7 +183,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
|
|
|
202
183
|
event.preventDefault();
|
|
203
184
|
return false;
|
|
204
185
|
}
|
|
205
|
-
}, [
|
|
186
|
+
}, [onUndoRedo, onItemSelect, selectNextItem, selectPreviousItem, cancel, cleanedInputContent, editorView.state]);
|
|
206
187
|
const onClick = useCallback(event => {
|
|
207
188
|
var _inputRef$current;
|
|
208
189
|
event.stopPropagation();
|
|
@@ -18,8 +18,7 @@ export const WrapperTypeAhead = /*#__PURE__*/React.memo(({
|
|
|
18
18
|
inputMethod,
|
|
19
19
|
getDecorationPosition,
|
|
20
20
|
reopenQuery,
|
|
21
|
-
onUndoRedo
|
|
22
|
-
useBetterTypeaheadNavigation
|
|
21
|
+
onUndoRedo
|
|
23
22
|
}) => {
|
|
24
23
|
const [closed, setClosed] = useState(false);
|
|
25
24
|
const [query, setQuery] = useState(reopenQuery || '');
|
|
@@ -32,14 +31,12 @@ export const WrapperTypeAhead = /*#__PURE__*/React.memo(({
|
|
|
32
31
|
const [onItemInsert, onTextInsert] = useItemInsert(triggerHandler, editorView, items);
|
|
33
32
|
const selectNextItem = useMemo(() => moveSelectedIndex({
|
|
34
33
|
editorView,
|
|
35
|
-
direction: 'next'
|
|
36
|
-
|
|
37
|
-
}), [editorView, useBetterTypeaheadNavigation]);
|
|
34
|
+
direction: 'next'
|
|
35
|
+
}), [editorView]);
|
|
38
36
|
const selectPreviousItem = useMemo(() => moveSelectedIndex({
|
|
39
37
|
editorView,
|
|
40
|
-
direction: 'previous'
|
|
41
|
-
|
|
42
|
-
}), [editorView, useBetterTypeaheadNavigation]);
|
|
38
|
+
direction: 'previous'
|
|
39
|
+
}), [editorView]);
|
|
43
40
|
const cancel = useCallback(({
|
|
44
41
|
setSelectionAt,
|
|
45
42
|
addPrefixTrigger,
|
|
@@ -95,7 +92,6 @@ export const WrapperTypeAhead = /*#__PURE__*/React.memo(({
|
|
|
95
92
|
return null;
|
|
96
93
|
}
|
|
97
94
|
return /*#__PURE__*/React.createElement(InputQuery, {
|
|
98
|
-
useBetterTypeaheadNavigation: useBetterTypeaheadNavigation,
|
|
99
95
|
triggerQueryPrefix: triggerHandler.trigger,
|
|
100
96
|
onQueryChange: setQuery,
|
|
101
97
|
onItemSelect: insertSelectedItem,
|
|
@@ -54,8 +54,7 @@ export const findHandlerByTrigger = ({
|
|
|
54
54
|
};
|
|
55
55
|
export const moveSelectedIndex = ({
|
|
56
56
|
editorView,
|
|
57
|
-
direction
|
|
58
|
-
useBetterTypeaheadNavigation
|
|
57
|
+
direction
|
|
59
58
|
}) => () => {
|
|
60
59
|
const typeAheadState = getPluginState(editorView.state);
|
|
61
60
|
if (!typeAheadState) {
|
|
@@ -69,23 +68,20 @@ export const moveSelectedIndex = ({
|
|
|
69
68
|
let nextIndex;
|
|
70
69
|
if (direction === 'next') {
|
|
71
70
|
stats.increaseArrowDown();
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
} else {
|
|
87
|
-
nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
|
|
88
|
-
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* See: https://product-fabric.atlassian.net/browse/ED-17200
|
|
74
|
+
* `selectedIndex` is forced to -1 now to not immediately focus the typeahead
|
|
75
|
+
* and only do so when there is explicit logic to focus into the typeahead
|
|
76
|
+
* options.
|
|
77
|
+
*
|
|
78
|
+
* This check for "set index to 1 when -1"
|
|
79
|
+
* - is a temporary workaround to get back the previous behaviour without
|
|
80
|
+
* entirely reverting the a11y improvements
|
|
81
|
+
*
|
|
82
|
+
*/
|
|
83
|
+
if (selectedIndex === -1 && items.length > 1) {
|
|
84
|
+
nextIndex = 1;
|
|
89
85
|
} else {
|
|
90
86
|
nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
|
|
91
87
|
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -34,21 +34,16 @@ export function getScrollGutterOptions(props) {
|
|
|
34
34
|
return undefined;
|
|
35
35
|
}
|
|
36
36
|
export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent) {
|
|
37
|
-
var _props$performanceTra, _props$linking,
|
|
37
|
+
var _props$performanceTra, _props$linking, _props$performanceTra2, _props$textFormatting, _props$linking2;
|
|
38
38
|
var appearance = props.appearance;
|
|
39
39
|
var isMobile = appearance === 'mobile';
|
|
40
40
|
var inputTracking = (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : _props$performanceTra.inputTracking;
|
|
41
41
|
var cardOptions = ((_props$linking = props.linking) === null || _props$linking === void 0 ? void 0 : _props$linking.smartLinks) || props.smartLinks || props.UNSAFE_cards;
|
|
42
|
-
|
|
43
|
-
// duplicated logic from `feature-flags-from-props.ts` due to presets not being finalised
|
|
44
|
-
var pseudoNormalisedUseBetterTypeaheadNavigation = (_ref = (_props$featureFlags$u = (_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags['use-better-typeahead-navigation']) !== null && _props$featureFlags$u !== void 0 ? _props$featureFlags$u : (_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2.useBetterTypeaheadNavigation) !== null && _ref !== void 0 ? _ref : null;
|
|
45
|
-
var useBetterTypeaheadNavigation = Boolean(typeof pseudoNormalisedUseBetterTypeaheadNavigation === 'boolean' ? !!pseudoNormalisedUseBetterTypeaheadNavigation : true);
|
|
46
42
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
47
43
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
48
44
|
typeAhead: {
|
|
49
45
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
50
|
-
isMobile: isMobile
|
|
51
|
-
useBetterTypeaheadNavigation: useBetterTypeaheadNavigation
|
|
46
|
+
isMobile: isMobile
|
|
52
47
|
},
|
|
53
48
|
featureFlags: createFeatureFlagsFromProps(props),
|
|
54
49
|
paste: {
|