@atlaskit/editor-plugin-type-ahead 1.11.3 → 1.11.4
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 +8 -0
- package/dist/cjs/pm-plugins/actions.js +1 -0
- package/dist/cjs/pm-plugins/commands/update-list-error.js +24 -0
- package/dist/cjs/pm-plugins/main.js +1 -0
- package/dist/cjs/pm-plugins/reducer.js +8 -0
- package/dist/cjs/pm-plugins/utils.js +49 -14
- package/dist/cjs/typeAheadPlugin.js +3 -1
- package/dist/cjs/ui/TypeAheadErrorFallback/EmptyState.js +38 -0
- package/dist/cjs/ui/TypeAheadErrorFallback/GenericErrorSVG.js +67 -0
- package/dist/cjs/ui/TypeAheadErrorFallback/MinHeightContainer.js +41 -0
- package/dist/cjs/ui/TypeAheadErrorFallback/index.js +38 -0
- package/dist/cjs/ui/TypeAheadListItem.js +1 -0
- package/dist/cjs/ui/TypeAheadMenu.js +3 -1
- package/dist/cjs/ui/TypeAheadPopup.js +4 -2
- package/dist/cjs/ui/WrapperTypeAhead.js +12 -4
- package/dist/cjs/ui/hooks/use-load-items.js +13 -0
- package/dist/es2019/pm-plugins/actions.js +1 -0
- package/dist/es2019/pm-plugins/commands/update-list-error.js +18 -0
- package/dist/es2019/pm-plugins/main.js +1 -0
- package/dist/es2019/pm-plugins/reducer.js +11 -0
- package/dist/es2019/pm-plugins/utils.js +44 -7
- package/dist/es2019/typeAheadPlugin.js +3 -1
- package/dist/es2019/ui/TypeAheadErrorFallback/EmptyState.js +32 -0
- package/dist/es2019/ui/TypeAheadErrorFallback/GenericErrorSVG.js +59 -0
- package/dist/es2019/ui/TypeAheadErrorFallback/MinHeightContainer.js +33 -0
- package/dist/es2019/ui/TypeAheadErrorFallback/index.js +29 -0
- package/dist/es2019/ui/TypeAheadListItem.js +1 -0
- package/dist/es2019/ui/TypeAheadMenu.js +3 -1
- package/dist/es2019/ui/TypeAheadPopup.js +4 -2
- package/dist/es2019/ui/WrapperTypeAhead.js +10 -2
- package/dist/es2019/ui/hooks/use-load-items.js +13 -0
- package/dist/esm/pm-plugins/actions.js +1 -0
- package/dist/esm/pm-plugins/commands/update-list-error.js +18 -0
- package/dist/esm/pm-plugins/main.js +1 -0
- package/dist/esm/pm-plugins/reducer.js +8 -0
- package/dist/esm/pm-plugins/utils.js +49 -14
- package/dist/esm/typeAheadPlugin.js +3 -1
- package/dist/esm/ui/TypeAheadErrorFallback/EmptyState.js +31 -0
- package/dist/esm/ui/TypeAheadErrorFallback/GenericErrorSVG.js +59 -0
- package/dist/esm/ui/TypeAheadErrorFallback/MinHeightContainer.js +33 -0
- package/dist/esm/ui/TypeAheadErrorFallback/index.js +31 -0
- package/dist/esm/ui/TypeAheadListItem.js +1 -0
- package/dist/esm/ui/TypeAheadMenu.js +3 -1
- package/dist/esm/ui/TypeAheadPopup.js +4 -2
- package/dist/esm/ui/WrapperTypeAhead.js +12 -4
- package/dist/esm/ui/hooks/use-load-items.js +13 -0
- package/dist/types/pm-plugins/actions.d.ts +1 -0
- package/dist/types/pm-plugins/commands/update-list-error.d.ts +2 -0
- package/dist/types/pm-plugins/utils.d.ts +12 -2
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/ui/TypeAheadErrorFallback/EmptyState.d.ts +9 -0
- package/dist/types/ui/TypeAheadErrorFallback/GenericErrorSVG.d.ts +6 -0
- package/dist/types/ui/TypeAheadErrorFallback/MinHeightContainer.d.ts +9 -0
- package/dist/types/ui/TypeAheadErrorFallback/index.d.ts +6 -0
- package/dist/types/ui/TypeAheadPopup.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/commands/update-list-error.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +12 -2
- package/dist/types-ts4.5/types/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/TypeAheadErrorFallback/EmptyState.d.ts +9 -0
- package/dist/types-ts4.5/ui/TypeAheadErrorFallback/GenericErrorSVG.d.ts +6 -0
- package/dist/types-ts4.5/ui/TypeAheadErrorFallback/MinHeightContainer.d.ts +9 -0
- package/dist/types-ts4.5/ui/TypeAheadErrorFallback/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/TypeAheadPopup.d.ts +2 -1
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 1.11.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#101866](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101866)
|
|
8
|
+
[`f22dfbe75b007`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f22dfbe75b007) -
|
|
9
|
+
[ux] Fix first typeahead item inserting in an inconsistent manner while offline
|
|
10
|
+
|
|
3
11
|
## 1.11.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -11,6 +11,7 @@ var ACTIONS = exports.ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
|
11
11
|
ACTIONS["INSERT_ITEM"] = "INSERT_ITEM";
|
|
12
12
|
ACTIONS["INSERT_RAW_QUERY"] = "INSERT_RAW_QUERY";
|
|
13
13
|
ACTIONS["UPDATE_LIST_ITEMS"] = "UPDATE_LIST_ITEMS";
|
|
14
|
+
ACTIONS["UPDATE_LIST_ERROR"] = "UPDATE_LIST_ERROR";
|
|
14
15
|
ACTIONS["UPDATE_SELECTED_INDEX"] = "UPDATE_SELECTED_INDEX";
|
|
15
16
|
return ACTIONS;
|
|
16
17
|
}({});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.updateListError = void 0;
|
|
7
|
+
var _actions = require("../actions");
|
|
8
|
+
var _key = require("../key");
|
|
9
|
+
var updateListError = exports.updateListError = function updateListError(errorInfo) {
|
|
10
|
+
return function (state, dispatch) {
|
|
11
|
+
var tr = state.tr;
|
|
12
|
+
tr.setMeta(_key.pluginKey, {
|
|
13
|
+
action: _actions.ACTIONS.UPDATE_LIST_ERROR,
|
|
14
|
+
params: {
|
|
15
|
+
errorInfo: errorInfo,
|
|
16
|
+
items: []
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
if (dispatch) {
|
|
20
|
+
dispatch(tr);
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -109,6 +109,7 @@ var createReducer = exports.createReducer = function createReducer(_ref) {
|
|
|
109
109
|
var shouldCloseMenu = [_actions.ACTIONS.CLOSE_TYPE_AHEAD, _actions.ACTIONS.INSERT_ITEM].includes(action) || selectionChanged;
|
|
110
110
|
var shouldUpdateQuery = action === _actions.ACTIONS.CHANGE_QUERY;
|
|
111
111
|
var shouldUpdateListItems = action === _actions.ACTIONS.UPDATE_LIST_ITEMS;
|
|
112
|
+
var shouldUpdateListError = action === _actions.ACTIONS.UPDATE_LIST_ERROR;
|
|
112
113
|
var shouldUpdateSelectedIndex = action === _actions.ACTIONS.UPDATE_SELECTED_INDEX;
|
|
113
114
|
if (shouldOpenMenu) {
|
|
114
115
|
return openMenu(currentPluginState, {
|
|
@@ -123,6 +124,13 @@ var createReducer = exports.createReducer = function createReducer(_ref) {
|
|
|
123
124
|
return _objectSpread(_objectSpread({}, currentPluginState), {}, {
|
|
124
125
|
query: params.query
|
|
125
126
|
});
|
|
127
|
+
} else if (shouldUpdateListError) {
|
|
128
|
+
var errorInfo = params.errorInfo;
|
|
129
|
+
return _objectSpread(_objectSpread({}, currentPluginState), {}, {
|
|
130
|
+
errorInfo: errorInfo,
|
|
131
|
+
items: [],
|
|
132
|
+
selectedIndex: -1
|
|
133
|
+
});
|
|
126
134
|
} else if (shouldUpdateListItems) {
|
|
127
135
|
var items = params.items;
|
|
128
136
|
var selectedIndex = currentPluginState.selectedIndex;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.skipForwardToSafeItem = exports.skipBackwardToSafeItem = exports.moveSelectedIndex = exports.isTypeAheadOpen = exports.isTypeAheadHandler = exports.isTypeAheadAllowed = exports.getTypeAheadQuery = exports.getTypeAheadListAriaLabels = exports.getTypeAheadHandler = exports.getPluginState = exports.findHandlerByTrigger = exports.findHandler = void 0;
|
|
7
7
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
8
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
9
|
var _updateSelectedIndex = require("./commands/update-selected-index");
|
|
9
10
|
var _itemIsDisabled = require("./item-is-disabled");
|
|
10
11
|
var _key = require("./key");
|
|
@@ -45,32 +46,56 @@ var findHandler = exports.findHandler = function findHandler(id, state) {
|
|
|
45
46
|
return h.id === id;
|
|
46
47
|
}) || null;
|
|
47
48
|
};
|
|
48
|
-
var skipForwardToSafeItem = exports.skipForwardToSafeItem = function skipForwardToSafeItem(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
var skipForwardToSafeItem = exports.skipForwardToSafeItem = function skipForwardToSafeItem(_ref) {
|
|
50
|
+
var currentIndex = _ref.currentIndex,
|
|
51
|
+
nextIndex = _ref.nextIndex,
|
|
52
|
+
listSize = _ref.listSize,
|
|
53
|
+
itemIsDisabled = _ref.itemIsDisabled;
|
|
52
54
|
// Use a loop to find the next selectable item
|
|
53
55
|
for (var idx = nextIndex; idx < listSize; idx++) {
|
|
54
56
|
if (!itemIsDisabled(idx)) {
|
|
55
57
|
return idx;
|
|
56
58
|
}
|
|
57
59
|
}
|
|
60
|
+
|
|
61
|
+
// We got to the end of the list ^, now try from the start
|
|
62
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_offline_editing_ga')) {
|
|
63
|
+
for (var _idx = 0; _idx < nextIndex; _idx++) {
|
|
64
|
+
if (!itemIsDisabled(_idx)) {
|
|
65
|
+
return _idx;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
58
70
|
// If no selectable items are found, return currentIndex
|
|
59
71
|
return currentIndex;
|
|
60
72
|
};
|
|
61
|
-
var skipBackwardToSafeItem = exports.skipBackwardToSafeItem = function skipBackwardToSafeItem(
|
|
73
|
+
var skipBackwardToSafeItem = exports.skipBackwardToSafeItem = function skipBackwardToSafeItem(_ref2) {
|
|
74
|
+
var currentIndex = _ref2.currentIndex,
|
|
75
|
+
nextIndex = _ref2.nextIndex,
|
|
76
|
+
listSize = _ref2.listSize,
|
|
77
|
+
itemIsDisabled = _ref2.itemIsDisabled;
|
|
62
78
|
// Use a loop to find the next non-selectable item when going backwards
|
|
63
79
|
for (var idx = nextIndex; idx >= 0; idx--) {
|
|
64
80
|
if (!itemIsDisabled(idx)) {
|
|
65
81
|
return idx;
|
|
66
82
|
}
|
|
67
83
|
}
|
|
84
|
+
|
|
85
|
+
// We got to the start of the list ^, now try from the end
|
|
86
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_offline_editing_ga')) {
|
|
87
|
+
for (var _idx2 = listSize; _idx2 > nextIndex; _idx2--) {
|
|
88
|
+
if (!itemIsDisabled(_idx2)) {
|
|
89
|
+
return _idx2;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
68
93
|
// If no non-selectable items are found, return currentIndex
|
|
69
94
|
return currentIndex;
|
|
70
95
|
};
|
|
71
|
-
var findHandlerByTrigger = exports.findHandlerByTrigger = function findHandlerByTrigger(
|
|
72
|
-
var trigger =
|
|
73
|
-
editorState =
|
|
96
|
+
var findHandlerByTrigger = exports.findHandlerByTrigger = function findHandlerByTrigger(_ref3) {
|
|
97
|
+
var trigger = _ref3.trigger,
|
|
98
|
+
editorState = _ref3.editorState;
|
|
74
99
|
var pluginState = _key.pluginKey.getState(editorState);
|
|
75
100
|
if (!pluginState || !pluginState.typeAheadHandlers || pluginState.typeAheadHandlers.length === 0) {
|
|
76
101
|
return null;
|
|
@@ -80,10 +105,10 @@ var findHandlerByTrigger = exports.findHandlerByTrigger = function findHandlerBy
|
|
|
80
105
|
return h.trigger === trigger;
|
|
81
106
|
}) || null;
|
|
82
107
|
};
|
|
83
|
-
var moveSelectedIndex = exports.moveSelectedIndex = function moveSelectedIndex(
|
|
84
|
-
var editorView =
|
|
85
|
-
direction =
|
|
86
|
-
api =
|
|
108
|
+
var moveSelectedIndex = exports.moveSelectedIndex = function moveSelectedIndex(_ref4) {
|
|
109
|
+
var editorView = _ref4.editorView,
|
|
110
|
+
direction = _ref4.direction,
|
|
111
|
+
api = _ref4.api;
|
|
87
112
|
return function () {
|
|
88
113
|
var typeAheadState = getPluginState(editorView.state);
|
|
89
114
|
if (!typeAheadState) {
|
|
@@ -117,11 +142,21 @@ var moveSelectedIndex = exports.moveSelectedIndex = function moveSelectedIndex(_
|
|
|
117
142
|
} else {
|
|
118
143
|
nextIndex = selectedIndex >= items.length - 1 ? 0 : selectedIndex + 1;
|
|
119
144
|
}
|
|
120
|
-
nextIndex = skipForwardToSafeItem(
|
|
145
|
+
nextIndex = skipForwardToSafeItem({
|
|
146
|
+
currentIndex: selectedIndex,
|
|
147
|
+
nextIndex: nextIndex,
|
|
148
|
+
listSize: items.length,
|
|
149
|
+
itemIsDisabled: isDisabled
|
|
150
|
+
});
|
|
121
151
|
} else {
|
|
122
152
|
stats.increaseArrowUp();
|
|
123
153
|
nextIndex = selectedIndex <= 0 ? items.length - 1 : selectedIndex - 1;
|
|
124
|
-
nextIndex = skipBackwardToSafeItem(
|
|
154
|
+
nextIndex = skipBackwardToSafeItem({
|
|
155
|
+
currentIndex: selectedIndex,
|
|
156
|
+
nextIndex: nextIndex,
|
|
157
|
+
listSize: items.length,
|
|
158
|
+
itemIsDisabled: isDisabled
|
|
159
|
+
});
|
|
125
160
|
}
|
|
126
161
|
(0, _updateSelectedIndex.updateSelectedIndex)(nextIndex, api)(editorView.state, editorView.dispatch);
|
|
127
162
|
};
|
|
@@ -201,7 +201,7 @@ var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref) {
|
|
|
201
201
|
}];
|
|
202
202
|
},
|
|
203
203
|
getSharedState: function getSharedState(editorState) {
|
|
204
|
-
var _state$decorationSet, _state$decorationElem, _state$items, _state$selectedIndex;
|
|
204
|
+
var _state$decorationSet, _state$decorationElem, _state$items, _state$errorInfo, _state$selectedIndex;
|
|
205
205
|
if (!editorState) {
|
|
206
206
|
return {
|
|
207
207
|
query: '',
|
|
@@ -212,6 +212,7 @@ var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref) {
|
|
|
212
212
|
decorationElement: null,
|
|
213
213
|
triggerHandler: undefined,
|
|
214
214
|
items: [],
|
|
215
|
+
errorInfo: null,
|
|
215
216
|
selectedIndex: 0
|
|
216
217
|
};
|
|
217
218
|
}
|
|
@@ -226,6 +227,7 @@ var typeAheadPlugin = exports.typeAheadPlugin = function typeAheadPlugin(_ref) {
|
|
|
226
227
|
decorationElement: (_state$decorationElem = state === null || state === void 0 ? void 0 : state.decorationElement) !== null && _state$decorationElem !== void 0 ? _state$decorationElem : null,
|
|
227
228
|
triggerHandler: state === null || state === void 0 ? void 0 : state.triggerHandler,
|
|
228
229
|
items: (_state$items = state === null || state === void 0 ? void 0 : state.items) !== null && _state$items !== void 0 ? _state$items : [],
|
|
230
|
+
errorInfo: (_state$errorInfo = state === null || state === void 0 ? void 0 : state.errorInfo) !== null && _state$errorInfo !== void 0 ? _state$errorInfo : null,
|
|
229
231
|
selectedIndex: (_state$selectedIndex = state === null || state === void 0 ? void 0 : state.selectedIndex) !== null && _state$selectedIndex !== void 0 ? _state$selectedIndex : 0
|
|
230
232
|
};
|
|
231
233
|
},
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.EmptyState = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
|
|
10
|
+
var _primitives = require("@atlaskit/primitives");
|
|
11
|
+
var containerStyles = (0, _primitives.xcss)({
|
|
12
|
+
marginBlockStart: 'space.600',
|
|
13
|
+
marginBlockEnd: 'space.600',
|
|
14
|
+
textAlign: 'center'
|
|
15
|
+
});
|
|
16
|
+
var EmptyState = exports.EmptyState = function EmptyState(_ref) {
|
|
17
|
+
var testId = _ref.testId,
|
|
18
|
+
header = _ref.header,
|
|
19
|
+
description = _ref.description,
|
|
20
|
+
renderImage = _ref.renderImage;
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Flex, {
|
|
22
|
+
xcss: containerStyles,
|
|
23
|
+
testId: testId,
|
|
24
|
+
direction: "column",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
gap: "space.300"
|
|
27
|
+
}, renderImage === null || renderImage === void 0 ? void 0 : renderImage(), /*#__PURE__*/_react.default.createElement(_primitives.Flex, {
|
|
28
|
+
direction: "column",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
gap: "space.200"
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement(_heading.default, {
|
|
32
|
+
size: "medium",
|
|
33
|
+
as: "h2"
|
|
34
|
+
}, header), description && /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
35
|
+
as: "p",
|
|
36
|
+
color: "color.text"
|
|
37
|
+
}, description)));
|
|
38
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.GenericErrorSVG = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = require("@emotion/react");
|
|
10
|
+
/**
|
|
11
|
+
* @jsxRuntime classic
|
|
12
|
+
* @jsx jsx
|
|
13
|
+
*/
|
|
14
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
|
+
|
|
16
|
+
var HEIGHT = 90;
|
|
17
|
+
var genericErrorStyles = (0, _react.css)({
|
|
18
|
+
height: "".concat(HEIGHT, "px"),
|
|
19
|
+
display: 'block'
|
|
20
|
+
});
|
|
21
|
+
var GenericErrorSVG = exports.GenericErrorSVG = function GenericErrorSVG(props) {
|
|
22
|
+
var id = 'link-picker-ui-generic-error-svg';
|
|
23
|
+
return (0, _react.jsx)("svg", (0, _extends2.default)({
|
|
24
|
+
height: "90",
|
|
25
|
+
viewBox: "0 0 164 212",
|
|
26
|
+
fill: "none",
|
|
27
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
28
|
+
css: genericErrorStyles
|
|
29
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
30
|
+
}, props), (0, _react.jsx)("path", {
|
|
31
|
+
d: "m95.43 74.16 66.44 115.08c5.84 10.12-1.46 22.76-13.14 22.76H15.85c-11.68 0-18.98-12.65-13.14-22.76L69.15 74.16c5.84-10.12 20.44-10.12 26.28 0Zm-7.56 83.55 2.88-44.35c.34-5.29-3.86-9.78-9.16-9.78-5.31 0-9.51 4.48-9.16 9.78l2.88 44.35a6.3 6.3 0 0 0 6.28 5.89c3.31 0 6.06-2.58 6.28-5.89Zm-15.84 23.54c0 5.66 4.76 10.1 10.39 9.58 4.85-.45 8.73-4.5 8.83-9.37.11-5.45-4.31-9.94-9.73-9.94-5.23-.01-9.49 4.37-9.49 9.73Z",
|
|
32
|
+
fill: "url(#".concat(id, ")")
|
|
33
|
+
}), (0, _react.jsx)("path", {
|
|
34
|
+
opacity: ".6",
|
|
35
|
+
d: "M93.35 27.17 85.94.45c-.17-.62-1.07-.58-1.19.05l-4.66 25.1-5.8-1.08a.612.612 0 0 0-.7.76L81 52c.17.62 1.07.58 1.19-.05l4.66-25.1 5.8 1.08c.45.08.82-.33.7-.76ZM66.77 41.81 55.9 33.26c-.22-.18-.53.07-.41.33l5.53 11.43-2.66 1.29c-.18.09-.2.33-.05.45l10.87 8.55c.22.18.53-.07.41-.33l-5.53-11.43 2.66-1.29c.17-.08.2-.33.05-.45Z",
|
|
36
|
+
fill: "#C1C7D0"
|
|
37
|
+
}), (0, _react.jsx)("path", {
|
|
38
|
+
opacity: ".6",
|
|
39
|
+
d: "M102.78 56.75a.993.993 0 0 1-.92-1.38c-.24-.77-2.29-2.85-3.54-4.11-2.97-3.01-4.93-5-3.84-6.49 1.09-1.48 3.58-.22 7.35 1.7 1.32.67 3.35 1.7 4.45 2.03-.64-.95-2.24-2.58-3.28-3.63-2.97-3.01-4.93-5-3.84-6.49 1.08-1.48 3.58-.22 7.34 1.7 1.32.67 3.34 1.7 4.45 2.03-.64-.95-2.24-2.57-3.28-3.62-2.97-3.01-4.93-5-3.84-6.49 1.08-1.48 3.57-.22 7.34 1.7 1.58.8 4.18 2.13 4.98 2.13a1.005 1.005 0 0 1 1.46 1.36c-1.09 1.48-3.57.22-7.34-1.7-1.32-.67-3.34-1.7-4.44-2.03.64.95 2.24 2.57 3.28 3.62 2.97 3.01 4.93 5 3.84 6.49-1.08 1.48-3.57.22-7.34-1.7-1.32-.67-3.35-1.7-4.45-2.03.64.95 2.24 2.57 3.28 3.63 2.97 3.01 4.93 5 3.84 6.49-1.09 1.48-3.58.22-7.35-1.7-1.32-.67-3.35-1.71-4.45-2.03.64.95 2.24 2.58 3.28 3.63 2.97 3.01 4.93 5 3.84 6.49-.21.26-.51.4-.82.4Zm5.56 14.32c-.35 0-.69-.19-.88-.52-1.04-1.88-2.22-4.02-.91-5.21 1.31-1.2 3.34.18 5.49 1.63.87.59 2.26 1.53 2.93 1.71-.12-.68-.93-2.15-1.45-3.07-1.26-2.27-2.45-4.41-1.14-5.61 1.31-1.2 3.34.18 5.49 1.63.96.65 2.54 1.72 3.1 1.74a1 1 0 0 1 1.27 1.54c-1.31 1.2-3.34-.17-5.49-1.63-.87-.59-2.26-1.53-2.93-1.71.12.68.93 2.15 1.45 3.07 1.26 2.27 2.45 4.41 1.14 5.61-1.31 1.2-3.34-.18-5.49-1.63-.87-.59-2.26-1.53-2.93-1.71.12.68.93 2.14 1.22 2.67.27.48.09 1.09-.39 1.36-.15.09-.32.13-.48.13Zm-54.32-2.89c-.22 0-.44-.04-.67-.14-1.64-.69-1.24-3.11-.81-5.67.17-1.04.45-2.7.33-3.38-.57.39-1.56 1.75-2.18 2.6-1.53 2.09-2.99 4.07-4.62 3.38a.991.991 0 0 1-.53-1.31c.2-.48.73-.72 1.21-.57.52-.21 1.65-1.75 2.34-2.68 1.53-2.09 2.98-4.08 4.62-3.38 1.64.69 1.24 3.11.81 5.67-.17 1.04-.45 2.7-.33 3.38.57-.39 1.56-1.75 2.18-2.6 1.53-2.09 2.98-4.08 4.62-3.38 1.63.69 1.24 3.09.89 5.21-.09.54-.6.91-1.15.83-.54-.09-.92-.6-.83-1.15.1-.59.37-2.24.26-2.92-.57.39-1.56 1.75-2.18 2.6-1.33 1.79-2.59 3.51-3.96 3.51Z",
|
|
40
|
+
fill: "#B3BAC5"
|
|
41
|
+
}), (0, _react.jsx)("defs", null, (0, _react.jsx)("linearGradient", {
|
|
42
|
+
id: id,
|
|
43
|
+
x1: "26.169",
|
|
44
|
+
y1: "228.621",
|
|
45
|
+
x2: "138.408",
|
|
46
|
+
y2: "116.382",
|
|
47
|
+
gradientUnits: "userSpaceOnUse"
|
|
48
|
+
}, (0, _react.jsx)("stop", {
|
|
49
|
+
stopColor: "#C1C7D0"
|
|
50
|
+
}), (0, _react.jsx)("stop", {
|
|
51
|
+
offset: ".297",
|
|
52
|
+
stopColor: "#C6CBD4",
|
|
53
|
+
stopOpacity: ".881"
|
|
54
|
+
}), (0, _react.jsx)("stop", {
|
|
55
|
+
offset: ".63",
|
|
56
|
+
stopColor: "#D3D7DE",
|
|
57
|
+
stopOpacity: ".748"
|
|
58
|
+
}), (0, _react.jsx)("stop", {
|
|
59
|
+
offset: ".98",
|
|
60
|
+
stopColor: "#E9EBEF",
|
|
61
|
+
stopOpacity: ".608"
|
|
62
|
+
}), (0, _react.jsx)("stop", {
|
|
63
|
+
offset: "1",
|
|
64
|
+
stopColor: "#EBECF0",
|
|
65
|
+
stopOpacity: ".6"
|
|
66
|
+
}))));
|
|
67
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.minHeightComponentStyles = exports.MinHeightContainer = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _react2 = require("@emotion/react");
|
|
14
|
+
var _excluded = ["minHeight"];
|
|
15
|
+
/**
|
|
16
|
+
* @jsxRuntime classic
|
|
17
|
+
* @jsx jsx
|
|
18
|
+
*/
|
|
19
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
20
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
23
|
+
var minHeightComponentStyles = exports.minHeightComponentStyles = (0, _react2.css)({
|
|
24
|
+
display: 'flex',
|
|
25
|
+
alignItems: 'stretch',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
minHeight: 'var(--link-picker-min-height)'
|
|
28
|
+
});
|
|
29
|
+
var MinHeightContainer = exports.MinHeightContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
30
|
+
var minHeight = _ref.minHeight,
|
|
31
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
32
|
+
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
33
|
+
ref: ref
|
|
34
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
35
|
+
,
|
|
36
|
+
css: minHeightComponentStyles
|
|
37
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
38
|
+
}, props, {
|
|
39
|
+
style: (0, _defineProperty2.default)({}, '--link-picker-min-height', minHeight)
|
|
40
|
+
}));
|
|
41
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TypeAheadErrorFallback = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _reactIntlNext = require("react-intl-next");
|
|
9
|
+
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
10
|
+
var _EmptyState = require("./EmptyState");
|
|
11
|
+
var _GenericErrorSVG = require("./GenericErrorSVG");
|
|
12
|
+
/**
|
|
13
|
+
* @jsxRuntime classic
|
|
14
|
+
* @jsx jsx
|
|
15
|
+
*/
|
|
16
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
17
|
+
|
|
18
|
+
var minHeightComponentStyles = (0, _react.css)({
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'stretch',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
minHeight: '290px'
|
|
23
|
+
});
|
|
24
|
+
var TypeAheadErrorFallback = exports.TypeAheadErrorFallback = function TypeAheadErrorFallback() {
|
|
25
|
+
var intl = (0, _reactIntlNext.useIntl)();
|
|
26
|
+
var header = intl.formatMessage(_typeAhead.typeAheadListMessages.offlineErrorFallbackHeading);
|
|
27
|
+
var description = intl.formatMessage(_typeAhead.typeAheadListMessages.offlineErrorFallbackDesc);
|
|
28
|
+
return (0, _react.jsx)("div", {
|
|
29
|
+
"data-testid": "mentions-typeahead-error-boundary-ui",
|
|
30
|
+
css: minHeightComponentStyles
|
|
31
|
+
}, (0, _react.jsx)(_EmptyState.EmptyState, {
|
|
32
|
+
header: header,
|
|
33
|
+
renderImage: function renderImage() {
|
|
34
|
+
return (0, _react.jsx)(_GenericErrorSVG.GenericErrorSVG, null);
|
|
35
|
+
},
|
|
36
|
+
description: description
|
|
37
|
+
}));
|
|
38
|
+
};
|
|
@@ -67,6 +67,7 @@ var itemText = (0, _react2.css)({
|
|
|
67
67
|
color: "".concat("var(--ds-text, ".concat(_colors.N800, ")"))
|
|
68
68
|
});
|
|
69
69
|
var itemTitle = (0, _react2.css)({
|
|
70
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
70
71
|
lineHeight: '1.4'
|
|
71
72
|
});
|
|
72
73
|
var itemTitleOverride = (0, _react2.css)({
|
|
@@ -20,6 +20,7 @@ var TypeAheadMenu = exports.TypeAheadMenu = /*#__PURE__*/_react.default.memo(fun
|
|
|
20
20
|
var isOpen = typeAheadState.decorationSet.find().length > 0;
|
|
21
21
|
var triggerHandler = typeAheadState.triggerHandler,
|
|
22
22
|
items = typeAheadState.items,
|
|
23
|
+
errorInfo = typeAheadState.errorInfo,
|
|
23
24
|
selectedIndex = typeAheadState.selectedIndex,
|
|
24
25
|
decorationElement = typeAheadState.decorationElement,
|
|
25
26
|
decorationSet = typeAheadState.decorationSet,
|
|
@@ -76,7 +77,7 @@ var TypeAheadMenu = exports.TypeAheadMenu = /*#__PURE__*/_react.default.memo(fun
|
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
79
|
}, [isOpen, query, onItemMatch]);
|
|
79
|
-
if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || items.length === 0) {
|
|
80
|
+
if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || items.length === 0 && !errorInfo) {
|
|
80
81
|
return null;
|
|
81
82
|
}
|
|
82
83
|
return /*#__PURE__*/_react.default.createElement(_TypeAheadPopup.TypeAheadPopup, {
|
|
@@ -87,6 +88,7 @@ var TypeAheadMenu = exports.TypeAheadMenu = /*#__PURE__*/_react.default.memo(fun
|
|
|
87
88
|
anchorElement: decorationElement,
|
|
88
89
|
triggerHandler: triggerHandler,
|
|
89
90
|
items: items,
|
|
91
|
+
errorInfo: errorInfo,
|
|
90
92
|
selectedIndex: selectedIndex,
|
|
91
93
|
setSelectedItem: setSelectedItem,
|
|
92
94
|
onItemInsert: insertItem,
|
|
@@ -17,6 +17,7 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
17
17
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
18
18
|
var _colors = require("@atlaskit/theme/colors");
|
|
19
19
|
var _constants = require("../pm-plugins/constants");
|
|
20
|
+
var _TypeAheadErrorFallback = require("./TypeAheadErrorFallback");
|
|
20
21
|
var _TypeAheadList = require("./TypeAheadList");
|
|
21
22
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
23
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -61,6 +62,7 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
61
62
|
popupsBoundariesElement = props.popupsBoundariesElement,
|
|
62
63
|
popupsScrollableElement = props.popupsScrollableElement,
|
|
63
64
|
items = props.items,
|
|
65
|
+
errorInfo = props.errorInfo,
|
|
64
66
|
selectedIndex = props.selectedIndex,
|
|
65
67
|
onItemInsert = props.onItemInsert,
|
|
66
68
|
isEmptyQuery = props.isEmptyQuery,
|
|
@@ -260,7 +262,7 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
260
262
|
,
|
|
261
263
|
className: _constants.TYPE_AHEAD_POPUP_CONTENT_CLASS,
|
|
262
264
|
ref: ref
|
|
263
|
-
}, (0, _react2.jsx)(Highlight, {
|
|
265
|
+
}, errorInfo ? (0, _react2.jsx)(_TypeAheadErrorFallback.TypeAheadErrorFallback, null) : (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(Highlight, {
|
|
264
266
|
state: editorView.state,
|
|
265
267
|
triggerHandler: triggerHandler
|
|
266
268
|
}), (0, _react2.jsx)(_TypeAheadList.TypeAheadList, {
|
|
@@ -273,6 +275,6 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
273
275
|
triggerHandler: triggerHandler,
|
|
274
276
|
moreElementsInQuickInsertViewEnabled: moreElementsInQuickInsertViewEnabled,
|
|
275
277
|
api: api
|
|
276
|
-
})));
|
|
278
|
+
}))));
|
|
277
279
|
});
|
|
278
280
|
TypeAheadPopup.displayName = 'TypeAheadPopup';
|
|
@@ -10,7 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
12
12
|
var _updateQuery = require("../pm-plugins/commands/update-query");
|
|
13
|
-
var
|
|
13
|
+
var _itemIsDisabled2 = require("../pm-plugins/item-is-disabled");
|
|
14
14
|
var _utils = require("../pm-plugins/utils");
|
|
15
15
|
var _useItemInsert3 = require("./hooks/use-item-insert");
|
|
16
16
|
var _useLoadItems = require("./hooks/use-load-items");
|
|
@@ -84,8 +84,13 @@ var WrapperTypeAhead = exports.WrapperTypeAhead = /*#__PURE__*/_react.default.me
|
|
|
84
84
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
85
85
|
var _ref3 = (0, _utils.getPluginState)(view.state),
|
|
86
86
|
selectedIndex = _ref3.selectedIndex;
|
|
87
|
-
var safeSelectedIndex = (0, _utils.skipForwardToSafeItem)(
|
|
88
|
-
|
|
87
|
+
var safeSelectedIndex = (0, _utils.skipForwardToSafeItem)({
|
|
88
|
+
currentIndex: selectedIndex,
|
|
89
|
+
nextIndex: 1,
|
|
90
|
+
listSize: items.length,
|
|
91
|
+
itemIsDisabled: function itemIsDisabled(idx) {
|
|
92
|
+
return (0, _itemIsDisabled2.itemIsDisabled)(items[idx], api);
|
|
93
|
+
}
|
|
89
94
|
});
|
|
90
95
|
// If the only safe index is -1 then none are safe - do not insert item
|
|
91
96
|
if (safeSelectedIndex === -1) {
|
|
@@ -122,8 +127,11 @@ var WrapperTypeAhead = exports.WrapperTypeAhead = /*#__PURE__*/_react.default.me
|
|
|
122
127
|
if (closed) {
|
|
123
128
|
return null;
|
|
124
129
|
}
|
|
130
|
+
if (!triggerHandler) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
125
133
|
return /*#__PURE__*/_react.default.createElement(_InputQuery.InputQuery, {
|
|
126
|
-
triggerQueryPrefix: triggerHandler.trigger,
|
|
134
|
+
triggerQueryPrefix: triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger,
|
|
127
135
|
onQueryChange: setQuery,
|
|
128
136
|
onItemSelect: insertSelectedItem,
|
|
129
137
|
selectNextItem: selectNextItem,
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useLoadItems = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
+
var _updateListError = require("../../pm-plugins/commands/update-list-error");
|
|
10
12
|
var _updateListItems = require("../../pm-plugins/commands/update-list-items");
|
|
11
13
|
var EMPTY_LIST_ITEM = [];
|
|
12
14
|
var useLoadItems = exports.useLoadItems = function useLoadItems(triggerHandler, editorView, query) {
|
|
@@ -35,6 +37,17 @@ var useLoadItems = exports.useLoadItems = function useLoadItems(triggerHandler,
|
|
|
35
37
|
queueMicrotask(function () {
|
|
36
38
|
(0, _updateListItems.updateListItem)(list)(view.state, view.dispatch);
|
|
37
39
|
});
|
|
40
|
+
}).catch(function (e) {
|
|
41
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_offline_editing_ga')) {
|
|
42
|
+
if (e) {
|
|
43
|
+
if (componentIsMounted.current) {
|
|
44
|
+
setItems(EMPTY_LIST_ITEM);
|
|
45
|
+
}
|
|
46
|
+
queueMicrotask(function () {
|
|
47
|
+
(0, _updateListError.updateListError)(e)(view.state, view.dispatch);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
38
51
|
});
|
|
39
52
|
|
|
40
53
|
// ignore because EditorView is mutable but we don't want to
|
|
@@ -5,6 +5,7 @@ export let ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
|
5
5
|
ACTIONS["INSERT_ITEM"] = "INSERT_ITEM";
|
|
6
6
|
ACTIONS["INSERT_RAW_QUERY"] = "INSERT_RAW_QUERY";
|
|
7
7
|
ACTIONS["UPDATE_LIST_ITEMS"] = "UPDATE_LIST_ITEMS";
|
|
8
|
+
ACTIONS["UPDATE_LIST_ERROR"] = "UPDATE_LIST_ERROR";
|
|
8
9
|
ACTIONS["UPDATE_SELECTED_INDEX"] = "UPDATE_SELECTED_INDEX";
|
|
9
10
|
return ACTIONS;
|
|
10
11
|
}({});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ACTIONS } from '../actions';
|
|
2
|
+
import { pluginKey as typeAheadPluginKey } from '../key';
|
|
3
|
+
export const updateListError = errorInfo => {
|
|
4
|
+
return (state, dispatch) => {
|
|
5
|
+
const tr = state.tr;
|
|
6
|
+
tr.setMeta(typeAheadPluginKey, {
|
|
7
|
+
action: ACTIONS.UPDATE_LIST_ERROR,
|
|
8
|
+
params: {
|
|
9
|
+
errorInfo,
|
|
10
|
+
items: []
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
if (dispatch) {
|
|
14
|
+
dispatch(tr);
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -101,6 +101,7 @@ export const createReducer = ({
|
|
|
101
101
|
const shouldCloseMenu = [ACTIONS.CLOSE_TYPE_AHEAD, ACTIONS.INSERT_ITEM].includes(action) || selectionChanged;
|
|
102
102
|
const shouldUpdateQuery = action === ACTIONS.CHANGE_QUERY;
|
|
103
103
|
const shouldUpdateListItems = action === ACTIONS.UPDATE_LIST_ITEMS;
|
|
104
|
+
const shouldUpdateListError = action === ACTIONS.UPDATE_LIST_ERROR;
|
|
104
105
|
const shouldUpdateSelectedIndex = action === ACTIONS.UPDATE_SELECTED_INDEX;
|
|
105
106
|
if (shouldOpenMenu) {
|
|
106
107
|
return openMenu(currentPluginState, {
|
|
@@ -116,6 +117,16 @@ export const createReducer = ({
|
|
|
116
117
|
...currentPluginState,
|
|
117
118
|
query: params.query
|
|
118
119
|
};
|
|
120
|
+
} else if (shouldUpdateListError) {
|
|
121
|
+
const {
|
|
122
|
+
errorInfo
|
|
123
|
+
} = params;
|
|
124
|
+
return {
|
|
125
|
+
...currentPluginState,
|
|
126
|
+
errorInfo,
|
|
127
|
+
items: [],
|
|
128
|
+
selectedIndex: -1
|
|
129
|
+
};
|
|
119
130
|
} else if (shouldUpdateListItems) {
|
|
120
131
|
const {
|
|
121
132
|
items
|