@atlaskit/editor-core 172.3.2 → 173.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 +52 -0
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/plugins/base/index.js +8 -0
- package/dist/cjs/plugins/base/pm-plugins/composition.js +60 -0
- package/dist/cjs/plugins/breakout/index.js +5 -4
- package/dist/cjs/plugins/breakout/ui/LayoutButton.js +1 -3
- package/dist/cjs/plugins/card/pm-plugins/doc.js +8 -1
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +2 -36
- package/dist/cjs/plugins/collab-edit/plugin-state.js +16 -9
- package/dist/cjs/plugins/collab-edit/utils.js +16 -2
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
- package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +20 -15
- package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +8 -5
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/cjs/plugins/paste/actions.js +13 -0
- package/dist/cjs/plugins/paste/commands.js +44 -0
- package/dist/cjs/plugins/paste/handlers.js +48 -7
- package/dist/cjs/plugins/paste/index.js +3 -2
- package/dist/cjs/plugins/paste/pm-plugins/main.js +34 -9
- package/dist/cjs/plugins/paste/pm-plugins/plugin-factory.js +62 -0
- package/dist/cjs/plugins/paste/reducer.js +47 -0
- package/dist/cjs/plugins/paste/types.js +5 -0
- package/dist/cjs/plugins/placeholder/index.js +3 -1
- package/dist/cjs/plugins/placeholder-text/index.js +9 -3
- package/dist/cjs/plugins/status/ui/statusPicker.js +4 -1
- package/dist/cjs/plugins/table/commands-with-analytics.js +59 -52
- package/dist/cjs/plugins/table/index.js +53 -36
- package/dist/cjs/plugins/table/toolbar.js +136 -20
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +1 -16
- package/dist/cjs/plugins/type-ahead/constants.js +3 -1
- package/dist/cjs/plugins/type-ahead/messages.js +16 -1
- package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +1 -1
- package/dist/cjs/plugins/type-ahead/pm-plugins/reducer.js +2 -2
- package/dist/cjs/plugins/type-ahead/ui/AssistiveText.js +143 -0
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +59 -11
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +156 -31
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +55 -29
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
- package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
- package/dist/cjs/plugins/type-ahead/utils.js +1 -1
- package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +8 -0
- package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +2 -6
- package/dist/cjs/ui/PortalProvider/index.js +26 -32
- package/dist/cjs/utils/index.js +8 -1
- package/dist/cjs/utils/selection.js +6 -8
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugins/base/index.js +5 -0
- package/dist/es2019/plugins/base/pm-plugins/composition.js +45 -0
- package/dist/es2019/plugins/breakout/index.js +5 -4
- package/dist/es2019/plugins/breakout/ui/LayoutButton.js +1 -3
- package/dist/es2019/plugins/card/pm-plugins/doc.js +10 -1
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +3 -40
- package/dist/es2019/plugins/collab-edit/plugin-state.js +9 -3
- package/dist/es2019/plugins/collab-edit/utils.js +17 -3
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
- package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +15 -7
- package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +9 -5
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/es2019/plugins/paste/actions.js +6 -0
- package/dist/es2019/plugins/paste/commands.js +27 -0
- package/dist/es2019/plugins/paste/handlers.js +50 -8
- package/dist/es2019/plugins/paste/index.js +3 -2
- package/dist/es2019/plugins/paste/pm-plugins/main.js +29 -6
- package/dist/es2019/plugins/paste/pm-plugins/plugin-factory.js +33 -0
- package/dist/es2019/plugins/paste/reducer.js +24 -0
- package/dist/es2019/plugins/paste/types.js +1 -0
- package/dist/es2019/plugins/placeholder/index.js +2 -1
- package/dist/es2019/plugins/placeholder-text/index.js +13 -3
- package/dist/es2019/plugins/status/ui/statusPicker.js +5 -1
- package/dist/es2019/plugins/table/commands-with-analytics.js +6 -3
- package/dist/es2019/plugins/table/index.js +22 -4
- package/dist/es2019/plugins/table/toolbar.js +118 -14
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +0 -9
- package/dist/es2019/plugins/type-ahead/constants.js +1 -0
- package/dist/es2019/plugins/type-ahead/messages.js +16 -1
- package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +2 -2
- package/dist/es2019/plugins/type-ahead/ui/AssistiveText.js +95 -0
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +49 -12
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +143 -29
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +64 -31
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
- package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
- package/dist/es2019/plugins/type-ahead/utils.js +1 -1
- package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +17 -0
- package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +2 -5
- package/dist/es2019/ui/PortalProvider/index.js +5 -8
- package/dist/es2019/utils/index.js +6 -0
- package/dist/es2019/utils/selection.js +1 -9
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugins/base/index.js +7 -0
- package/dist/esm/plugins/base/pm-plugins/composition.js +45 -0
- package/dist/esm/plugins/breakout/index.js +5 -4
- package/dist/esm/plugins/breakout/ui/LayoutButton.js +1 -3
- package/dist/esm/plugins/card/pm-plugins/doc.js +8 -1
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +3 -37
- package/dist/esm/plugins/collab-edit/plugin-state.js +9 -3
- package/dist/esm/plugins/collab-edit/utils.js +17 -3
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
- package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +20 -15
- package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +8 -5
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/esm/plugins/paste/actions.js +6 -0
- package/dist/esm/plugins/paste/commands.js +31 -0
- package/dist/esm/plugins/paste/handlers.js +46 -8
- package/dist/esm/plugins/paste/index.js +3 -2
- package/dist/esm/plugins/paste/pm-plugins/main.js +27 -6
- package/dist/esm/plugins/paste/pm-plugins/plugin-factory.js +46 -0
- package/dist/esm/plugins/paste/reducer.js +34 -0
- package/dist/esm/plugins/paste/types.js +1 -0
- package/dist/esm/plugins/placeholder/index.js +2 -1
- package/dist/esm/plugins/placeholder-text/index.js +9 -3
- package/dist/esm/plugins/status/ui/statusPicker.js +4 -1
- package/dist/esm/plugins/table/commands-with-analytics.js +56 -49
- package/dist/esm/plugins/table/index.js +54 -37
- package/dist/esm/plugins/table/toolbar.js +124 -15
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/esm/plugins/tasks-and-decisions/commands.js +0 -12
- package/dist/esm/plugins/type-ahead/constants.js +1 -0
- package/dist/esm/plugins/type-ahead/messages.js +16 -1
- package/dist/esm/plugins/type-ahead/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +2 -2
- package/dist/esm/plugins/type-ahead/ui/AssistiveText.js +129 -0
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +56 -12
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +151 -32
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +54 -31
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
- package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
- package/dist/esm/plugins/type-ahead/utils.js +1 -1
- package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +7 -0
- package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +2 -5
- package/dist/esm/ui/PortalProvider/index.js +26 -35
- package/dist/esm/utils/index.js +4 -0
- package/dist/esm/utils/selection.js +1 -7
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugins/base/pm-plugins/composition.d.ts +8 -0
- package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +1 -4
- package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +2 -0
- package/dist/types/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -0
- package/dist/types/plugins/paste/actions.d.ts +15 -0
- package/dist/types/plugins/paste/commands.d.ts +16 -0
- package/dist/types/plugins/paste/handlers.d.ts +1 -1
- package/dist/types/plugins/paste/pm-plugins/main.d.ts +3 -3
- package/dist/types/plugins/paste/pm-plugins/plugin-factory.d.ts +3 -0
- package/dist/types/plugins/paste/reducer.d.ts +3 -0
- package/dist/types/plugins/paste/types.d.ts +6 -0
- package/dist/types/plugins/table/commands-with-analytics.d.ts +5 -5
- package/dist/types/plugins/tasks-and-decisions/commands.d.ts +0 -2
- package/dist/types/plugins/type-ahead/constants.d.ts +1 -0
- package/dist/types/plugins/type-ahead/messages.d.ts +15 -0
- package/dist/types/plugins/type-ahead/ui/AssistiveText.d.ts +33 -0
- package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +3 -0
- package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +6 -3
- package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +2 -2
- package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/selection.d.ts +1 -2
- package/dist/types-ts4.0/index.d.ts +1 -1
- package/dist/types-ts4.0/plugins/base/pm-plugins/composition.d.ts +8 -0
- package/dist/types-ts4.0/plugins/code-block/pm-plugins/ide-ux.d.ts +1 -4
- package/dist/types-ts4.0/plugins/floating-toolbar/ui/Dropdown.d.ts +2 -0
- package/dist/types-ts4.0/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -0
- package/dist/types-ts4.0/plugins/paste/actions.d.ts +15 -0
- package/dist/types-ts4.0/plugins/paste/commands.d.ts +16 -0
- package/dist/types-ts4.0/plugins/paste/handlers.d.ts +1 -1
- package/dist/types-ts4.0/plugins/paste/pm-plugins/main.d.ts +3 -3
- package/dist/types-ts4.0/plugins/paste/pm-plugins/plugin-factory.d.ts +3 -0
- package/dist/types-ts4.0/plugins/paste/reducer.d.ts +3 -0
- package/dist/types-ts4.0/plugins/paste/types.d.ts +6 -0
- package/dist/types-ts4.0/plugins/table/commands-with-analytics.d.ts +5 -5
- package/dist/types-ts4.0/plugins/tasks-and-decisions/commands.d.ts +0 -2
- package/dist/types-ts4.0/plugins/type-ahead/constants.d.ts +1 -0
- package/dist/types-ts4.0/plugins/type-ahead/messages.d.ts +15 -0
- package/dist/types-ts4.0/plugins/type-ahead/ui/AssistiveText.d.ts +33 -0
- package/dist/types-ts4.0/plugins/type-ahead/ui/InputQuery.d.ts +3 -0
- package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadList.d.ts +6 -3
- package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadListItem.d.ts +2 -2
- package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadPopup.d.ts +1 -1
- package/dist/types-ts4.0/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types-ts4.0/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.0/utils/index.d.ts +1 -0
- package/dist/types-ts4.0/utils/selection.d.ts +1 -2
- package/package.json +30 -31
- package/report.api.md +161 -49
|
@@ -7,21 +7,42 @@ var _templateObject;
|
|
|
7
7
|
import React, { useMemo, useRef, useCallback, useLayoutEffect, useState } from 'react';
|
|
8
8
|
import { jsx, css } from '@emotion/react';
|
|
9
9
|
import { MenuGroup } from '@atlaskit/menu';
|
|
10
|
+
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
10
11
|
import { CellMeasurer, CellMeasurerCache } from 'react-virtualized/dist/commonjs/CellMeasurer';
|
|
11
12
|
import { List } from 'react-virtualized/dist/commonjs/List';
|
|
12
13
|
import { ICON_HEIGHT, ITEM_PADDING, TypeAheadListItem } from './TypeAheadListItem';
|
|
13
|
-
import { injectIntl } from 'react-intl-next';
|
|
14
|
+
import { injectIntl, useIntl } from 'react-intl-next';
|
|
14
15
|
import { typeAheadListMessages } from '../messages';
|
|
16
|
+
import { moveSelectedIndex } from '../utils';
|
|
17
|
+
import { updateSelectedIndex } from '../commands/update-selected-index';
|
|
18
|
+
import { AssistiveText } from './AssistiveText';
|
|
19
|
+
import { TYPE_AHEAD_DECORATION_ELEMENT_ID } from '../constants';
|
|
15
20
|
var LIST_ITEM_ESTIMATED_HEIGHT = ICON_HEIGHT + ITEM_PADDING * 2;
|
|
16
21
|
var LIST_WIDTH = 320;
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
var TypeaheadAssistiveTextPureComponent = /*#__PURE__*/React.memo(function (_ref) {
|
|
23
|
+
var numberOfResults = _ref.numberOfResults;
|
|
24
|
+
var intl = useIntl();
|
|
25
|
+
return jsx(AssistiveText, {
|
|
26
|
+
assistiveText: intl.formatMessage(typeAheadListMessages.searchResultsLabel, {
|
|
27
|
+
itemsLength: numberOfResults
|
|
28
|
+
}) // when the popup is open its always in focus
|
|
29
|
+
,
|
|
30
|
+
isInFocus: true,
|
|
31
|
+
id: TYPE_AHEAD_DECORATION_ELEMENT_ID + '__popup'
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
|
|
35
|
+
var _decorationElement$qu2;
|
|
36
|
+
|
|
37
|
+
var items = _ref2.items,
|
|
38
|
+
selectedIndex = _ref2.selectedIndex,
|
|
39
|
+
editorView = _ref2.editorView,
|
|
40
|
+
onItemClick = _ref2.onItemClick,
|
|
41
|
+
intl = _ref2.intl,
|
|
42
|
+
fitHeight = _ref2.fitHeight,
|
|
43
|
+
decorationElement = _ref2.decorationElement;
|
|
24
44
|
var listRef = useRef();
|
|
45
|
+
var listContainerRef = useRef(null);
|
|
25
46
|
var lastVisibleIndexes = useRef({
|
|
26
47
|
overscanStartIndex: 0,
|
|
27
48
|
overscanStopIndex: 0,
|
|
@@ -48,12 +69,38 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
48
69
|
}, []);
|
|
49
70
|
var actions = useMemo(function () {
|
|
50
71
|
return {
|
|
51
|
-
onItemClick: onItemClick
|
|
52
|
-
onItemHover: onItemHover
|
|
72
|
+
onItemClick: onItemClick
|
|
53
73
|
};
|
|
54
|
-
}, [onItemClick
|
|
55
|
-
|
|
56
|
-
|
|
74
|
+
}, [onItemClick]);
|
|
75
|
+
|
|
76
|
+
var isNavigationKey = function isNavigationKey(event) {
|
|
77
|
+
return ['ArrowDown', 'ArrowUp', 'Tab', 'Enter'].includes(event.key);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
var focusTargetElement = useCallback(function () {
|
|
81
|
+
var _decorationElement$qu;
|
|
82
|
+
|
|
83
|
+
//To reset the selected index
|
|
84
|
+
updateSelectedIndex(-1)(editorView.state, editorView.dispatch);
|
|
85
|
+
listRef.current.scrollToRow(0);
|
|
86
|
+
decorationElement === null || decorationElement === void 0 ? void 0 : (_decorationElement$qu = decorationElement.querySelector("[role='combobox']")) === null || _decorationElement$qu === void 0 ? void 0 : _decorationElement$qu.focus();
|
|
87
|
+
}, [editorView, listRef, decorationElement]);
|
|
88
|
+
var selectNextItem = useMemo(function () {
|
|
89
|
+
return moveSelectedIndex({
|
|
90
|
+
editorView: editorView,
|
|
91
|
+
direction: 'next'
|
|
92
|
+
});
|
|
93
|
+
}, [editorView]);
|
|
94
|
+
var selectPreviousItem = useMemo(function () {
|
|
95
|
+
return moveSelectedIndex({
|
|
96
|
+
editorView: editorView,
|
|
97
|
+
direction: 'previous'
|
|
98
|
+
});
|
|
99
|
+
}, [editorView]);
|
|
100
|
+
var lastVisibleStartIndex = lastVisibleIndexes.current.startIndex;
|
|
101
|
+
var lastVisibleStopIndex = lastVisibleIndexes.current.stopIndex;
|
|
102
|
+
var onScroll = useCallback(function (_ref3) {
|
|
103
|
+
var scrollUpdateWasRequested = _ref3.scrollUpdateWasRequested;
|
|
57
104
|
|
|
58
105
|
if (!scrollUpdateWasRequested) {
|
|
59
106
|
return;
|
|
@@ -71,27 +118,29 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
71
118
|
|
|
72
119
|
requestAnimationFrame(function () {
|
|
73
120
|
requestAnimationFrame(function () {
|
|
74
|
-
var
|
|
75
|
-
var isSelectedItemVisible = selectedIndex >= indexes.startIndex && selectedIndex <= indexes.stopIndex;
|
|
121
|
+
var isSelectedItemVisible = selectedIndex >= lastVisibleStartIndex && selectedIndex <= lastVisibleStopIndex; //Should scroll to the list item only when the selectedIndex >= 0 and item is not visible
|
|
76
122
|
|
|
77
|
-
if (!isSelectedItemVisible) {
|
|
123
|
+
if (!isSelectedItemVisible && selectedIndex !== -1) {
|
|
78
124
|
listRef.current.scrollToRow(selectedIndex);
|
|
125
|
+
} else if (selectedIndex === -1) {
|
|
126
|
+
listRef.current.scrollToRow(0);
|
|
79
127
|
}
|
|
80
128
|
});
|
|
81
129
|
});
|
|
82
|
-
}, [selectedIndex,
|
|
130
|
+
}, [selectedIndex, lastVisibleStartIndex, lastVisibleStopIndex]);
|
|
83
131
|
useLayoutEffect(function () {
|
|
84
132
|
if (!listRef.current) {
|
|
85
133
|
return;
|
|
86
134
|
}
|
|
87
135
|
|
|
88
|
-
var
|
|
89
|
-
var isSelectedItemVisible = selectedIndex >= indexes.startIndex && selectedIndex <= indexes.stopIndex;
|
|
136
|
+
var isSelectedItemVisible = selectedIndex >= lastVisibleStartIndex && selectedIndex <= lastVisibleStopIndex; //Should scroll to the list item only when the selectedIndex >= 0 and item is not visible
|
|
90
137
|
|
|
91
|
-
if (!isSelectedItemVisible) {
|
|
138
|
+
if (!isSelectedItemVisible && selectedIndex !== -1) {
|
|
92
139
|
listRef.current.scrollToRow(selectedIndex);
|
|
140
|
+
} else if (selectedIndex === -1) {
|
|
141
|
+
listRef.current.scrollToRow(0);
|
|
93
142
|
}
|
|
94
|
-
}, [selectedIndex,
|
|
143
|
+
}, [selectedIndex, lastVisibleStartIndex, lastVisibleStopIndex]);
|
|
95
144
|
useLayoutEffect(function () {
|
|
96
145
|
setCache(new CellMeasurerCache({
|
|
97
146
|
fixedWidth: true,
|
|
@@ -106,12 +155,76 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
106
155
|
}, 0), fitHeight);
|
|
107
156
|
setHeight(height);
|
|
108
157
|
}, [items, cache, fitHeight]);
|
|
158
|
+
useLayoutEffect(function () {
|
|
159
|
+
if (!listContainerRef.current) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
var element = listContainerRef.current;
|
|
164
|
+
/**
|
|
165
|
+
* To handle the key events on the list
|
|
166
|
+
* @param event
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
170
|
+
if (isNavigationKey(event)) {
|
|
171
|
+
switch (event.key) {
|
|
172
|
+
case 'ArrowDown':
|
|
173
|
+
if (selectedIndex === items.length - 1) {
|
|
174
|
+
event.stopPropagation();
|
|
175
|
+
} else {
|
|
176
|
+
selectNextItem();
|
|
177
|
+
}
|
|
109
178
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
179
|
+
event.preventDefault();
|
|
180
|
+
break;
|
|
181
|
+
|
|
182
|
+
case 'ArrowUp':
|
|
183
|
+
if (selectedIndex === 0) {
|
|
184
|
+
//To set focus on target element when up arrow is pressed on first option of list
|
|
185
|
+
focusTargetElement();
|
|
186
|
+
} else {
|
|
187
|
+
selectPreviousItem();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
break;
|
|
192
|
+
|
|
193
|
+
case 'Tab':
|
|
194
|
+
//Tab key quick inserts the selected item.
|
|
195
|
+
onItemClick(SelectItemMode.TAB, selectedIndex);
|
|
196
|
+
event.preventDefault();
|
|
197
|
+
break;
|
|
198
|
+
|
|
199
|
+
case 'Enter':
|
|
200
|
+
//Enter key quick inserts the selected item.
|
|
201
|
+
if (!event.isComposing || event.which !== 229 && event.keyCode !== 229) {
|
|
202
|
+
onItemClick(event.shiftKey ? SelectItemMode.SHIFT_ENTER : SelectItemMode.ENTER, selectedIndex);
|
|
203
|
+
event.preventDefault();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
break;
|
|
207
|
+
|
|
208
|
+
default:
|
|
209
|
+
event.preventDefault();
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
//All the remaining keys sets focus on the typeahead query(inputQuery.tsx))
|
|
213
|
+
focusTargetElement();
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
element === null || element === void 0 ? void 0 : element.addEventListener('keydown', handleKeyDown);
|
|
218
|
+
return function () {
|
|
219
|
+
element === null || element === void 0 ? void 0 : element.removeEventListener('keydown', handleKeyDown);
|
|
220
|
+
};
|
|
221
|
+
}, [editorView.state, focusTargetElement, selectNextItem, selectPreviousItem, selectedIndex, onItemClick, items.length]);
|
|
222
|
+
|
|
223
|
+
var renderRow = function renderRow(_ref4) {
|
|
224
|
+
var index = _ref4.index,
|
|
225
|
+
key = _ref4.key,
|
|
226
|
+
style = _ref4.style,
|
|
227
|
+
parent = _ref4.parent;
|
|
115
228
|
return jsx(CellMeasurer, {
|
|
116
229
|
key: key,
|
|
117
230
|
cache: cache,
|
|
@@ -126,10 +239,10 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
126
239
|
}, jsx(TypeAheadListItem, {
|
|
127
240
|
key: items[index].title,
|
|
128
241
|
item: items[index],
|
|
242
|
+
itemsLength: items.length,
|
|
129
243
|
itemIndex: index,
|
|
130
244
|
selectedIndex: selectedIndex,
|
|
131
|
-
onItemClick: actions.onItemClick
|
|
132
|
-
onItemHover: actions.onItemHover
|
|
245
|
+
onItemClick: actions.onItemClick
|
|
133
246
|
}))));
|
|
134
247
|
};
|
|
135
248
|
|
|
@@ -137,11 +250,13 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
137
250
|
return null;
|
|
138
251
|
}
|
|
139
252
|
|
|
253
|
+
var menuGroupId = ((_decorationElement$qu2 = decorationElement.querySelector("[role='combobox']")) === null || _decorationElement$qu2 === void 0 ? void 0 : _decorationElement$qu2.getAttribute('aria-controls')) || TYPE_AHEAD_DECORATION_ELEMENT_ID;
|
|
140
254
|
return jsx(MenuGroup, {
|
|
141
|
-
role: "listbox",
|
|
142
|
-
"aria-live": "polite",
|
|
143
255
|
"aria-label": intl.formatMessage(typeAheadListMessages.typeAheadResultLabel),
|
|
144
256
|
"aria-relevant": "additions removals"
|
|
257
|
+
}, jsx("div", {
|
|
258
|
+
id: menuGroupId,
|
|
259
|
+
ref: listContainerRef
|
|
145
260
|
}, jsx(List, {
|
|
146
261
|
rowRenderer: renderRow,
|
|
147
262
|
ref: listRef,
|
|
@@ -152,8 +267,12 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
152
267
|
onScroll: onScroll,
|
|
153
268
|
height: height,
|
|
154
269
|
overscanRowCount: 3,
|
|
155
|
-
|
|
156
|
-
|
|
270
|
+
containerRole: "presentation",
|
|
271
|
+
role: "listbox",
|
|
272
|
+
css: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n button {\n padding: 12px 12px 11px;\n span:last-child span:last-child {\n white-space: normal;\n }\n }\n "])))
|
|
273
|
+
}), jsx(TypeaheadAssistiveTextPureComponent, {
|
|
274
|
+
numberOfResults: items.length.toString()
|
|
275
|
+
})));
|
|
157
276
|
});
|
|
158
277
|
export var TypeAheadList = injectIntl(TypeAheadListComponent);
|
|
159
278
|
TypeAheadList.displayName = 'TypeAheadList';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
4
4
|
|
|
5
5
|
/** @jsx jsx */
|
|
6
|
-
import React, { useCallback, useMemo,
|
|
6
|
+
import React, { useCallback, useMemo, useLayoutEffect } from 'react';
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
|
-
import { DN600, N200, N800 } from '@atlaskit/theme/colors';
|
|
8
|
+
import { DN600, N200, N800, N30, B100 } from '@atlaskit/theme/colors';
|
|
9
9
|
import { themed } from '@atlaskit/theme/components';
|
|
10
10
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
11
11
|
import { ButtonItem } from '@atlaskit/menu';
|
|
@@ -28,9 +28,23 @@ var itemText = function itemText(theme) {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
var itemAfter = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n flex: 0 0 auto;\n"])));
|
|
31
|
-
var
|
|
32
|
-
|
|
31
|
+
var customRenderItemDivStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n overflow: hidden;\n &:hover {\n background-color: ", ";\n }\n &:focus {\n box-shadow: inset 0px 0px 0px 2px ", ";\n outline: none;\n }\n"])), token('color.background.selected', N30), token('color.border.focused', B100));
|
|
32
|
+
/**
|
|
33
|
+
* This CSS emulates the desired behaviour with :focus-visible for firefox.
|
|
34
|
+
* Firefox unfortunately does not register keyboard focus if user mouseDown and drag a typeahead item
|
|
35
|
+
* resulting in focus-visible style not drawn.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
var selectionFrame = {
|
|
39
|
+
'& > button:focus': {
|
|
40
|
+
boxShadow: "inset 0px 0px 0px 2px ".concat(token('color.border.focused', B100)),
|
|
41
|
+
outline: 'none',
|
|
42
|
+
'&:active': {
|
|
43
|
+
boxShadow: 'none'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
33
46
|
};
|
|
47
|
+
var selectedStyle = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n background-color: ", ";\n"])), token('color.background.selected', N30));
|
|
34
48
|
var FallbackIcon = /*#__PURE__*/React.memo(function (_ref) {
|
|
35
49
|
var label = _ref.label;
|
|
36
50
|
return jsx(IconFallback, null);
|
|
@@ -40,31 +54,16 @@ var noop = function noop() {};
|
|
|
40
54
|
|
|
41
55
|
export var TypeAheadListItem = function TypeAheadListItem(_ref2) {
|
|
42
56
|
var item = _ref2.item,
|
|
57
|
+
itemsLength = _ref2.itemsLength,
|
|
43
58
|
selectedIndex = _ref2.selectedIndex,
|
|
44
|
-
onItemHover = _ref2.onItemHover,
|
|
45
59
|
onItemClick = _ref2.onItemClick,
|
|
46
60
|
itemIndex = _ref2.itemIndex;
|
|
47
|
-
var isSelected = itemIndex === selectedIndex; // It's possible for onMouseMove to be called multiple times in quick
|
|
48
|
-
// succession because the mousemove event can fire very rapidly. This
|
|
49
|
-
// provides an additional safety net to prevent that.
|
|
50
61
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
mouseMoveCalled.current = true;
|
|
58
|
-
onItemHover({
|
|
59
|
-
item: item,
|
|
60
|
-
index: itemIndex
|
|
61
|
-
});
|
|
62
|
-
}, [item, itemIndex, onItemHover, isSelected]);
|
|
63
|
-
useLayoutEffect(function () {
|
|
64
|
-
if (!isSelected) {
|
|
65
|
-
mouseMoveCalled.current = false;
|
|
66
|
-
}
|
|
67
|
-
}, [isSelected]);
|
|
62
|
+
/**
|
|
63
|
+
* To select and highlight the first Item when no item is selected
|
|
64
|
+
* However selectedIndex remains -1, So that user does not skip the first item when down arrow key is used from typeahead query(inputQuery.tsx)
|
|
65
|
+
*/
|
|
66
|
+
var isSelected = itemIndex === selectedIndex || selectedIndex === -1 && itemIndex === 0;
|
|
68
67
|
var icon = item.icon,
|
|
69
68
|
title = item.title,
|
|
70
69
|
customRenderItem = item.render;
|
|
@@ -78,39 +77,63 @@ export var TypeAheadListItem = function TypeAheadListItem(_ref2) {
|
|
|
78
77
|
var insertSelectedItem = useCallback(function () {
|
|
79
78
|
onItemClick(SelectItemMode.SELECTED, itemIndex);
|
|
80
79
|
}, [onItemClick, itemIndex]);
|
|
80
|
+
var customItemRef = /*#__PURE__*/React.createRef();
|
|
81
|
+
var buttonItemRef = /*#__PURE__*/React.createRef();
|
|
82
|
+
var shouldUpdateFocus = selectedIndex === itemIndex;
|
|
83
|
+
useLayoutEffect(function () {
|
|
84
|
+
if (shouldUpdateFocus) {
|
|
85
|
+
var _customItemRef$curren;
|
|
86
|
+
|
|
87
|
+
customItemRef === null || customItemRef === void 0 ? void 0 : (_customItemRef$curren = customItemRef.current) === null || _customItemRef$curren === void 0 ? void 0 : _customItemRef$curren.focus();
|
|
88
|
+
}
|
|
89
|
+
}, [customItemRef, shouldUpdateFocus]);
|
|
90
|
+
useLayoutEffect(function () {
|
|
91
|
+
if (shouldUpdateFocus) {
|
|
92
|
+
var _buttonItemRef$curren;
|
|
93
|
+
|
|
94
|
+
buttonItemRef === null || buttonItemRef === void 0 ? void 0 : (_buttonItemRef$curren = buttonItemRef.current) === null || _buttonItemRef$curren === void 0 ? void 0 : _buttonItemRef$curren.focus();
|
|
95
|
+
}
|
|
96
|
+
}, [buttonItemRef, shouldUpdateFocus]);
|
|
81
97
|
var customItem = useMemo(function () {
|
|
82
98
|
if (!customRenderItem) {
|
|
83
99
|
return null;
|
|
84
100
|
}
|
|
85
101
|
|
|
86
102
|
var Comp = customRenderItem;
|
|
103
|
+
var listItemClasses = [customRenderItemDivStyle, isSelected && selectedStyle];
|
|
87
104
|
return jsx("div", {
|
|
88
105
|
"aria-selected": isSelected,
|
|
89
106
|
"aria-label": title,
|
|
90
107
|
role: "option",
|
|
108
|
+
"aria-setsize": itemsLength,
|
|
91
109
|
tabIndex: 0,
|
|
92
|
-
|
|
93
|
-
|
|
110
|
+
css: listItemClasses,
|
|
111
|
+
className: "ak-typeahead-item ".concat(isSelected ? 'typeahead-selected-item' : '') //CSS classes added for test cases purpose
|
|
112
|
+
,
|
|
113
|
+
ref: customItemRef
|
|
94
114
|
}, jsx(Comp, {
|
|
95
115
|
onClick: insertSelectedItem,
|
|
96
|
-
isSelected: isSelected
|
|
116
|
+
isSelected: false //The selection styles are handled in the parent div instead. Hence isSelected is made false always.
|
|
117
|
+
,
|
|
97
118
|
onHover: noop
|
|
98
119
|
}));
|
|
99
|
-
}, [customRenderItem, insertSelectedItem,
|
|
120
|
+
}, [customRenderItem, insertSelectedItem, isSelected, title, customItemRef, itemsLength]);
|
|
100
121
|
|
|
101
122
|
if (customItem) {
|
|
102
123
|
return customItem;
|
|
103
124
|
}
|
|
104
125
|
|
|
105
126
|
return jsx("span", {
|
|
106
|
-
|
|
127
|
+
css: selectionFrame
|
|
107
128
|
}, jsx(ButtonItem, {
|
|
108
129
|
onClick: insertSelectedItem,
|
|
109
130
|
iconBefore: elementIcon,
|
|
110
131
|
isSelected: isSelected,
|
|
111
132
|
"aria-selected": isSelected,
|
|
112
133
|
"aria-label": item.title,
|
|
134
|
+
"aria-setsize": itemsLength,
|
|
113
135
|
role: "option",
|
|
136
|
+
ref: buttonItemRef,
|
|
114
137
|
description: item.description
|
|
115
138
|
}, jsx("div", {
|
|
116
139
|
css: itemBody
|
|
@@ -41,7 +41,6 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
41
41
|
popupsScrollableElement = props.popupsScrollableElement,
|
|
42
42
|
items = props.items,
|
|
43
43
|
selectedIndex = props.selectedIndex,
|
|
44
|
-
setSelectedItem = props.setSelectedItem,
|
|
45
44
|
onItemInsert = props.onItemInsert,
|
|
46
45
|
fireAnalyticsCallback = props.fireAnalyticsCallback,
|
|
47
46
|
isEmptyQuery = props.isEmptyQuery;
|
|
@@ -175,9 +174,10 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
175
174
|
}), jsx(TypeAheadList, {
|
|
176
175
|
items: items,
|
|
177
176
|
selectedIndex: selectedIndex,
|
|
178
|
-
onItemHover: setSelectedItem,
|
|
179
177
|
onItemClick: onItemInsert,
|
|
180
|
-
fitHeight: fitHeight
|
|
178
|
+
fitHeight: fitHeight,
|
|
179
|
+
editorView: editorView,
|
|
180
|
+
decorationElement: anchorElement
|
|
181
181
|
})));
|
|
182
182
|
});
|
|
183
183
|
TypeAheadPopup.displayName = 'TypeAheadPopup';
|
|
@@ -120,6 +120,9 @@ export var WrapperTypeAhead = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
120
120
|
cancel: cancel,
|
|
121
121
|
forceFocus: shouldFocusCursorInsideQuery,
|
|
122
122
|
onUndoRedo: onUndoRedo,
|
|
123
|
-
reopenQuery: reopenQuery
|
|
123
|
+
reopenQuery: reopenQuery,
|
|
124
|
+
editorView: editorView,
|
|
125
|
+
items: items
|
|
124
126
|
});
|
|
125
|
-
});
|
|
127
|
+
});
|
|
128
|
+
WrapperTypeAhead.displayName = 'WrapperTypeAhead';
|
|
@@ -87,7 +87,7 @@ export var moveSelectedIndex = function moveSelectedIndex(_ref2) {
|
|
|
87
87
|
var selectedIndex = typeAheadState.selectedIndex,
|
|
88
88
|
items = typeAheadState.items;
|
|
89
89
|
var stats = typeAheadState.stats instanceof StatsModifier ? typeAheadState.stats : new StatsModifier();
|
|
90
|
-
var nextIndex
|
|
90
|
+
var nextIndex;
|
|
91
91
|
|
|
92
92
|
if (direction === 'next') {
|
|
93
93
|
stats.increaseArrowDown();
|
|
@@ -15,6 +15,7 @@ import { DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
|
15
15
|
import { addAnalytics } from '../../plugins/analytics/utils';
|
|
16
16
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, ACTION } from '../../plugins/analytics';
|
|
17
17
|
import { toolbarMessages } from './toolbar-messages';
|
|
18
|
+
import { insideTable, isInLayoutColumn } from '../../utils';
|
|
18
19
|
var alignmentIcons = [{
|
|
19
20
|
id: 'editor.media.alignLeft',
|
|
20
21
|
value: 'align-start',
|
|
@@ -88,6 +89,12 @@ var makeAlign = function makeAlign(layout, nodeType) {
|
|
|
88
89
|
// setNodeMarkup is called
|
|
89
90
|
|
|
90
91
|
tr.setSelection(NodeSelection.create(tr.doc, state.selection.from));
|
|
92
|
+
var paragraph = tr.doc.type.schema.nodes.paragraph; // see https://product-fabric.atlassian.net/browse/ED-15518 insert a new paragraph when an embedded card is wrapped left or right
|
|
93
|
+
|
|
94
|
+
if (layout.startsWith('wrap') && paragraph && !tr.doc.nodeAt(state.selection.to) && (insideTable(state) || isInLayoutColumn(state))) {
|
|
95
|
+
tr.insert(state.selection.to, paragraph.createAndFill());
|
|
96
|
+
}
|
|
97
|
+
|
|
91
98
|
dispatch(addAnalytics(state, tr, {
|
|
92
99
|
eventType: EVENT_TYPE.TRACK,
|
|
93
100
|
action: ACTION.SELECTED,
|
|
@@ -3,7 +3,6 @@ import React from 'react';
|
|
|
3
3
|
import AtlaskitTheme from '@atlaskit/theme/components';
|
|
4
4
|
import { CHANNEL } from '@atlaskit/theme/constants';
|
|
5
5
|
import { ThemeProvider } from '@emotion/react';
|
|
6
|
-
import { ThemeProvider as DeprectateStyledComponentsProvider } from 'styled-components';
|
|
7
6
|
export function PortalProviderThemeProviders(props) {
|
|
8
7
|
var children = props.children,
|
|
9
8
|
mode = props.mode;
|
|
@@ -29,11 +28,9 @@ export function PortalProviderThemeProviders(props) {
|
|
|
29
28
|
mode: mode
|
|
30
29
|
};
|
|
31
30
|
}, [mode]);
|
|
32
|
-
return /*#__PURE__*/React.createElement(
|
|
33
|
-
theme: styledComponentsAndEmotionTheme
|
|
34
|
-
}, /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
31
|
+
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
35
32
|
theme: styledComponentsAndEmotionTheme
|
|
36
33
|
}, /*#__PURE__*/React.createElement(AtlaskitTheme.Provider, {
|
|
37
34
|
value: atlaskitTheme
|
|
38
|
-
}, children))
|
|
35
|
+
}, children));
|
|
39
36
|
}
|
|
@@ -50,8 +50,6 @@ export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
50
50
|
_createClass(PortalProviderAPI, [{
|
|
51
51
|
key: "render",
|
|
52
52
|
value: function render(children, container) {
|
|
53
|
-
var _this2 = this;
|
|
54
|
-
|
|
55
53
|
var hasAnalyticsContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
56
54
|
var hasIntlContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
57
55
|
this.portals.set(container, {
|
|
@@ -59,14 +57,10 @@ export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
59
57
|
hasAnalyticsContext: hasAnalyticsContext,
|
|
60
58
|
hasIntlContext: hasIntlContext
|
|
61
59
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}, children());
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
var wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders()) : childrenWithThemeProviders();
|
|
60
|
+
var childrenWithThemeProviders = /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
|
|
61
|
+
mode: this.themeMode
|
|
62
|
+
}, children());
|
|
63
|
+
var wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders) : childrenWithThemeProviders;
|
|
70
64
|
|
|
71
65
|
if (hasIntlContext) {
|
|
72
66
|
wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
@@ -82,36 +76,33 @@ export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
82
76
|
}, {
|
|
83
77
|
key: "forceUpdate",
|
|
84
78
|
value: function forceUpdate(_ref) {
|
|
85
|
-
var
|
|
79
|
+
var _this2 = this;
|
|
86
80
|
|
|
87
81
|
var intl = _ref.intl,
|
|
88
82
|
themeMode = _ref.themeMode;
|
|
89
83
|
this.intl = intl;
|
|
90
84
|
this.themeMode = themeMode;
|
|
91
85
|
this.portals.forEach(function (portal, container) {
|
|
92
|
-
if (!portal.hasAnalyticsContext && !
|
|
86
|
+
if (!portal.hasAnalyticsContext && !_this2.useAnalyticsContext && !portal.hasIntlContext) {
|
|
93
87
|
return;
|
|
94
88
|
}
|
|
95
89
|
|
|
96
90
|
var wrappedChildren = portal.children();
|
|
91
|
+
var childrenWithThemeProviders = /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
|
|
92
|
+
mode: themeMode
|
|
93
|
+
}, wrappedChildren);
|
|
97
94
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
mode: themeMode
|
|
101
|
-
}, wrappedChildren);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
if (portal.hasAnalyticsContext && _this3.useAnalyticsContext) {
|
|
105
|
-
wrappedChildren = /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders());
|
|
95
|
+
if (portal.hasAnalyticsContext && _this2.useAnalyticsContext) {
|
|
96
|
+
wrappedChildren = /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders);
|
|
106
97
|
}
|
|
107
98
|
|
|
108
99
|
if (portal.hasIntlContext) {
|
|
109
100
|
wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
110
|
-
value:
|
|
111
|
-
}, childrenWithThemeProviders
|
|
101
|
+
value: _this2.intl
|
|
102
|
+
}, childrenWithThemeProviders);
|
|
112
103
|
}
|
|
113
104
|
|
|
114
|
-
unstable_renderSubtreeIntoContainer(
|
|
105
|
+
unstable_renderSubtreeIntoContainer(_this2.context, wrappedChildren, container);
|
|
115
106
|
});
|
|
116
107
|
}
|
|
117
108
|
}, {
|
|
@@ -157,13 +148,13 @@ var BasePortalProvider = /*#__PURE__*/function (_React$Component) {
|
|
|
157
148
|
var _super2 = _createSuper(BasePortalProvider);
|
|
158
149
|
|
|
159
150
|
function BasePortalProvider(props) {
|
|
160
|
-
var
|
|
151
|
+
var _this3;
|
|
161
152
|
|
|
162
153
|
_classCallCheck(this, BasePortalProvider);
|
|
163
154
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return
|
|
155
|
+
_this3 = _super2.call(this, props);
|
|
156
|
+
_this3.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext, props.themeMode);
|
|
157
|
+
return _this3;
|
|
167
158
|
}
|
|
168
159
|
|
|
169
160
|
_createClass(BasePortalProvider, [{
|
|
@@ -204,24 +195,24 @@ export var PortalRenderer = /*#__PURE__*/function (_React$Component2) {
|
|
|
204
195
|
var _super3 = _createSuper(PortalRenderer);
|
|
205
196
|
|
|
206
197
|
function PortalRenderer(props) {
|
|
207
|
-
var
|
|
198
|
+
var _this4;
|
|
208
199
|
|
|
209
200
|
_classCallCheck(this, PortalRenderer);
|
|
210
201
|
|
|
211
|
-
|
|
202
|
+
_this4 = _super3.call(this, props);
|
|
212
203
|
|
|
213
|
-
_defineProperty(_assertThisInitialized(
|
|
214
|
-
return
|
|
204
|
+
_defineProperty(_assertThisInitialized(_this4), "handleUpdate", function (portals) {
|
|
205
|
+
return _this4.setState({
|
|
215
206
|
portals: portals
|
|
216
207
|
});
|
|
217
208
|
});
|
|
218
209
|
|
|
219
|
-
props.portalProviderAPI.setContext(_assertThisInitialized(
|
|
220
|
-
props.portalProviderAPI.on('update',
|
|
221
|
-
|
|
210
|
+
props.portalProviderAPI.setContext(_assertThisInitialized(_this4));
|
|
211
|
+
props.portalProviderAPI.on('update', _this4.handleUpdate);
|
|
212
|
+
_this4.state = {
|
|
222
213
|
portals: new Map()
|
|
223
214
|
};
|
|
224
|
-
return
|
|
215
|
+
return _this4;
|
|
225
216
|
}
|
|
226
217
|
|
|
227
218
|
_createClass(PortalRenderer, [{
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -515,6 +515,10 @@ export var isInListItem = function isInListItem(state) {
|
|
|
515
515
|
export var hasOpenEnd = function hasOpenEnd(slice) {
|
|
516
516
|
return slice.openStart > 0 || slice.openEnd > 0;
|
|
517
517
|
};
|
|
518
|
+
export var isInsideBlockQuote = function isInsideBlockQuote(state) {
|
|
519
|
+
var blockquote = state.schema.nodes.blockquote;
|
|
520
|
+
return hasParentNodeOfType(blockquote)(state.selection);
|
|
521
|
+
};
|
|
518
522
|
export function filterChildrenBetween(doc, from, to, predicate) {
|
|
519
523
|
var results = [];
|
|
520
524
|
doc.nodesBetween(from, to, function (node, pos, parent) {
|
|
@@ -7,13 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
7
7
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
8
8
|
import { NodeSelection, TextSelection, AllSelection } from 'prosemirror-state';
|
|
9
9
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
10
|
-
export { setNodeSelection } from '@atlaskit/editor-common/utils';
|
|
11
|
-
export function setTextSelection(view, anchor, head) {
|
|
12
|
-
var state = view.state,
|
|
13
|
-
dispatch = view.dispatch;
|
|
14
|
-
var tr = state.tr.setSelection(TextSelection.create(state.doc, anchor, head));
|
|
15
|
-
dispatch(tr);
|
|
16
|
-
}
|
|
10
|
+
export { setNodeSelection, setTextSelection } from '@atlaskit/editor-common/utils';
|
|
17
11
|
export function setAllSelection(view) {
|
|
18
12
|
var state = view.state,
|
|
19
13
|
dispatch = view.dispatch;
|
package/dist/esm/version.json
CHANGED