@atlaskit/editor-core 187.8.11 → 187.8.13
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 +6 -0
- package/dist/cjs/ui/ElementBrowser/components/ElementSearch.js +5 -3
- package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +8 -6
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/ui/ElementBrowser/components/ElementSearch.js +5 -3
- package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +9 -6
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/ui/ElementBrowser/components/ElementSearch.js +5 -3
- package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +8 -6
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/ui/ElementBrowser/components/ElementSearch.d.ts +2 -1
- package/dist/types/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +4 -4
- package/dist/types-ts4.5/ui/ElementBrowser/components/ElementSearch.d.ts +2 -1
- package/dist/types-ts4.5/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.8.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0756bf2b120`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0756bf2b120) - [ux] ED-18780 Add first element to page when pressing enter on Insert Menu
|
|
8
|
+
|
|
3
9
|
## 187.8.11
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -29,6 +29,7 @@ function ElementSearch(_ref) {
|
|
|
29
29
|
formatMessage = _ref.intl.formatMessage,
|
|
30
30
|
focus = _ref.focus,
|
|
31
31
|
onClick = _ref.onClick,
|
|
32
|
+
onKeyDown = _ref.onKeyDown,
|
|
32
33
|
searchTerm = _ref.searchTerm;
|
|
33
34
|
var ref = (0, _useFocus.default)(focus);
|
|
34
35
|
var onChange = function onChange(_ref2) {
|
|
@@ -44,6 +45,7 @@ function ElementSearch(_ref) {
|
|
|
44
45
|
onChange: onChange,
|
|
45
46
|
onClick: onClick,
|
|
46
47
|
onFocus: onFocus,
|
|
48
|
+
onKeyDown: onKeyDown,
|
|
47
49
|
onBlur: onBlur,
|
|
48
50
|
elemBeforeInput: (0, _react2.jsx)("div", {
|
|
49
51
|
css: elementBeforeInput,
|
|
@@ -75,10 +77,10 @@ var placeHolderMessage = {
|
|
|
75
77
|
description: 'Search field placeholder'
|
|
76
78
|
};
|
|
77
79
|
var styledShortcut = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", "\n padding: ", "px ", "px;\n width: ", "px;\n"])), _styles.shortcutStyle, _constants.GRID_SIZE / 2, _constants.GRID_SIZE, _constants.GRID_SIZE * 6);
|
|
78
|
-
var wrapper = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n border-radius: ", "px;\n flex: 1 1 100%;\n overflow: visible;\n & > [data-ds--text-field--input] {\n margin-bottom: 3px;\n font-size: ", ";\n padding: ", "px
|
|
80
|
+
var wrapper = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n border-radius: ", "px;\n flex: 1 1 100%;\n overflow: visible;\n & > [data-ds--text-field--input] {\n margin-bottom: 3px;\n font-size: ", ";\n padding: ", "px ", " ", "px 0;\n }\n }\n"])), _constants.GRID_SIZE * 6, _constants.GRID_SIZE, (0, _editorSharedStyles.relativeFontSizeToBase16)(14), _constants.GRID_SIZE, "var(--ds-space-075, 6px)", _constants.GRID_SIZE);
|
|
79
81
|
var wrapperInline = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n flex: none;\n overflow: revert;\n }\n"])), _constants.GRID_SIZE * 5);
|
|
80
|
-
var elementBeforeInput = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n margin: 1px
|
|
81
|
-
var elementAfterInput = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0
|
|
82
|
+
var elementBeforeInput = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n margin: 1px ", " 0 ", ";\n color: ", ";\n\n // Custom SearchIcon style\n span,\n svg {\n height: 20px;\n width: 20px;\n }\n"])), "var(--ds-space-075, 6px)", "var(--ds-space-100, 8px)", "var(--ds-icon, ".concat(_colors.N200, ")"));
|
|
83
|
+
var elementAfterInput = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 ", ";\n height: ", ";\n text-align: center;\n"])), "var(--ds-space-100, 8px)", _constants.SEARCH_ITEM_HEIGHT_WIDTH);
|
|
82
84
|
var MemoizedElementSearchWithAnalytics = /*#__PURE__*/(0, _react.memo)((0, _analyticsNext.withAnalyticsContext)({
|
|
83
85
|
component: 'Searchbar'
|
|
84
86
|
})((0, _reactIntlNext.injectIntl)(ElementSearch)));
|
|
@@ -30,7 +30,7 @@ var baseBrowserContainerStyles = (0, _react2.css)(_templateObject2 || (_template
|
|
|
30
30
|
var mobileElementBrowserContainer = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n flex-direction: column;\n"])), baseBrowserContainerStyles);
|
|
31
31
|
var elementBrowserContainer = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n flex-direction: row;\n"])), baseBrowserContainerStyles);
|
|
32
32
|
var baseSidebarStyles = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n\n overflow-x: auto;\n overflow-y: hidden;\n"])));
|
|
33
|
-
var mobileSideBar = (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n flex: 0 0 ", ";\n padding:
|
|
33
|
+
var mobileSideBar = (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n flex: 0 0 ", ";\n padding: ", " ", " 0\n ", ";\n"])), baseSidebarStyles, _constants.INLINE_SIDEBAR_HEIGHT, "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)");
|
|
34
34
|
var mobileSideBarShowCategories = (0, _react2.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n flex: 0 0 auto;\n"])));
|
|
35
35
|
var sideBar = (0, _react2.css)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n flex: 0 0 'auto';\n"])), baseSidebarStyles);
|
|
36
36
|
var sideBarShowCategories = (0, _react2.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n flex: 0 0 ", ";\n"])), baseSidebarStyles, _constants.SIDEBAR_WIDTH);
|
|
@@ -43,6 +43,7 @@ var categoryListWrapper = (0, _react2.css)(_templateObject15 || (_templateObject
|
|
|
43
43
|
function StatelessElementBrowser(props) {
|
|
44
44
|
var items = props.items,
|
|
45
45
|
onSelectItem = props.onSelectItem,
|
|
46
|
+
onInsertItem = props.onInsertItem,
|
|
46
47
|
viewMoreItem = props.viewMoreItem;
|
|
47
48
|
var _useContainerWidth = (0, _useContainerWidth2.default)(),
|
|
48
49
|
containerWidth = _useContainerWidth.containerWidth,
|
|
@@ -92,10 +93,11 @@ function StatelessElementBrowser(props) {
|
|
|
92
93
|
if (e.key !== 'Enter') {
|
|
93
94
|
return;
|
|
94
95
|
}
|
|
95
|
-
if (
|
|
96
|
-
|
|
96
|
+
if (onInsertItem && selectedItem != null) {
|
|
97
|
+
onInsertItem(selectedItem);
|
|
97
98
|
}
|
|
98
|
-
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
}, [onInsertItem, selectedItem]);
|
|
99
101
|
|
|
100
102
|
/**
|
|
101
103
|
* On arrow key selection and clicks the selectedItemIndex will change.
|
|
@@ -156,13 +158,13 @@ function MobileBrowser(_ref) {
|
|
|
156
158
|
viewMoreItem = _ref.viewMoreItem;
|
|
157
159
|
return (0, _react2.jsx)("div", {
|
|
158
160
|
css: mobileElementBrowserContainer,
|
|
159
|
-
onKeyPress: onKeyPress,
|
|
160
161
|
onKeyDown: onKeyDown,
|
|
161
162
|
"data-testid": "mobile__element-browser"
|
|
162
163
|
}, (0, _react2.jsx)("div", {
|
|
163
164
|
css: showCategories ? [mobileSideBar, mobileSideBarShowCategories] : mobileSideBar
|
|
164
165
|
}, showSearch && (0, _react2.jsx)(_ElementSearch.default, {
|
|
165
166
|
onSearch: onSearch,
|
|
167
|
+
onKeyDown: onKeyPress,
|
|
166
168
|
mode: mode,
|
|
167
169
|
focus: focusOnSearch,
|
|
168
170
|
onClick: setFocusOnSearch,
|
|
@@ -235,13 +237,13 @@ function DesktopBrowser(_ref2) {
|
|
|
235
237
|
createAnalyticsEvent: createAnalyticsEvent
|
|
236
238
|
}))), (0, _react2.jsx)("div", {
|
|
237
239
|
css: mainContent,
|
|
238
|
-
onKeyPress: onKeyPress,
|
|
239
240
|
onKeyDown: onKeyDown,
|
|
240
241
|
"data-testid": "main-content"
|
|
241
242
|
}, showSearch && (0, _react2.jsx)("div", {
|
|
242
243
|
css: searchContainer
|
|
243
244
|
}, (0, _react2.jsx)(_ElementSearch.default, {
|
|
244
245
|
onSearch: onSearch,
|
|
246
|
+
onKeyDown: onKeyPress,
|
|
245
247
|
mode: mode,
|
|
246
248
|
focus: focusOnSearch,
|
|
247
249
|
onClick: setFocusOnSearch,
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.8.
|
|
9
|
+
var version = "187.8.13";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -19,6 +19,7 @@ function ElementSearch({
|
|
|
19
19
|
},
|
|
20
20
|
focus,
|
|
21
21
|
onClick,
|
|
22
|
+
onKeyDown,
|
|
22
23
|
searchTerm
|
|
23
24
|
}) {
|
|
24
25
|
const ref = useFocus(focus);
|
|
@@ -38,6 +39,7 @@ function ElementSearch({
|
|
|
38
39
|
onChange: onChange,
|
|
39
40
|
onClick: onClick,
|
|
40
41
|
onFocus: onFocus,
|
|
42
|
+
onKeyDown: onKeyDown,
|
|
41
43
|
onBlur: onBlur,
|
|
42
44
|
elemBeforeInput: jsx("div", {
|
|
43
45
|
css: elementBeforeInput,
|
|
@@ -82,7 +84,7 @@ const wrapper = css`
|
|
|
82
84
|
& > [data-ds--text-field--input] {
|
|
83
85
|
margin-bottom: 3px;
|
|
84
86
|
font-size: ${relativeFontSizeToBase16(14)};
|
|
85
|
-
padding: ${GRID_SIZE}px 6px ${GRID_SIZE}px 0;
|
|
87
|
+
padding: ${GRID_SIZE}px ${"var(--ds-space-075, 6px)"} ${GRID_SIZE}px 0;
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
`;
|
|
@@ -94,7 +96,7 @@ const wrapperInline = css`
|
|
|
94
96
|
}
|
|
95
97
|
`;
|
|
96
98
|
const elementBeforeInput = css`
|
|
97
|
-
margin: 1px 6px 0 8px;
|
|
99
|
+
margin: 1px ${"var(--ds-space-075, 6px)"} 0 ${"var(--ds-space-100, 8px)"};
|
|
98
100
|
color: ${`var(--ds-icon, ${N200})`};
|
|
99
101
|
|
|
100
102
|
// Custom SearchIcon style
|
|
@@ -105,7 +107,7 @@ const elementBeforeInput = css`
|
|
|
105
107
|
}
|
|
106
108
|
`;
|
|
107
109
|
const elementAfterInput = css`
|
|
108
|
-
margin: 0 8px;
|
|
110
|
+
margin: 0 ${"var(--ds-space-100, 8px)"};
|
|
109
111
|
height: ${SEARCH_ITEM_HEIGHT_WIDTH};
|
|
110
112
|
text-align: center;
|
|
111
113
|
`;
|
|
@@ -49,7 +49,8 @@ const baseSidebarStyles = css`
|
|
|
49
49
|
const mobileSideBar = css`
|
|
50
50
|
${baseSidebarStyles};
|
|
51
51
|
flex: 0 0 ${INLINE_SIDEBAR_HEIGHT};
|
|
52
|
-
padding: 12px 12px 0
|
|
52
|
+
padding: ${"var(--ds-space-150, 12px)"} ${"var(--ds-space-150, 12px)"} 0
|
|
53
|
+
${"var(--ds-space-150, 12px)"};
|
|
53
54
|
`;
|
|
54
55
|
const mobileSideBarShowCategories = css`
|
|
55
56
|
flex: 0 0 auto;
|
|
@@ -111,6 +112,7 @@ function StatelessElementBrowser(props) {
|
|
|
111
112
|
const {
|
|
112
113
|
items,
|
|
113
114
|
onSelectItem,
|
|
115
|
+
onInsertItem,
|
|
114
116
|
viewMoreItem
|
|
115
117
|
} = props;
|
|
116
118
|
const {
|
|
@@ -160,10 +162,11 @@ function StatelessElementBrowser(props) {
|
|
|
160
162
|
if (e.key !== 'Enter') {
|
|
161
163
|
return;
|
|
162
164
|
}
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
+
if (onInsertItem && selectedItem != null) {
|
|
166
|
+
onInsertItem(selectedItem);
|
|
165
167
|
}
|
|
166
|
-
|
|
168
|
+
e.preventDefault();
|
|
169
|
+
}, [onInsertItem, selectedItem]);
|
|
167
170
|
|
|
168
171
|
/**
|
|
169
172
|
* On arrow key selection and clicks the selectedItemIndex will change.
|
|
@@ -225,13 +228,13 @@ function MobileBrowser({
|
|
|
225
228
|
}) {
|
|
226
229
|
return jsx("div", {
|
|
227
230
|
css: mobileElementBrowserContainer,
|
|
228
|
-
onKeyPress: onKeyPress,
|
|
229
231
|
onKeyDown: onKeyDown,
|
|
230
232
|
"data-testid": "mobile__element-browser"
|
|
231
233
|
}, jsx("div", {
|
|
232
234
|
css: showCategories ? [mobileSideBar, mobileSideBarShowCategories] : mobileSideBar
|
|
233
235
|
}, showSearch && jsx(ElementSearch, {
|
|
234
236
|
onSearch: onSearch,
|
|
237
|
+
onKeyDown: onKeyPress,
|
|
235
238
|
mode: mode,
|
|
236
239
|
focus: focusOnSearch,
|
|
237
240
|
onClick: setFocusOnSearch,
|
|
@@ -305,13 +308,13 @@ function DesktopBrowser({
|
|
|
305
308
|
createAnalyticsEvent: createAnalyticsEvent
|
|
306
309
|
}))), jsx("div", {
|
|
307
310
|
css: mainContent,
|
|
308
|
-
onKeyPress: onKeyPress,
|
|
309
311
|
onKeyDown: onKeyDown,
|
|
310
312
|
"data-testid": "main-content"
|
|
311
313
|
}, showSearch && jsx("div", {
|
|
312
314
|
css: searchContainer
|
|
313
315
|
}, jsx(ElementSearch, {
|
|
314
316
|
onSearch: onSearch,
|
|
317
|
+
onKeyDown: onKeyPress,
|
|
315
318
|
mode: mode,
|
|
316
319
|
focus: focusOnSearch,
|
|
317
320
|
onClick: setFocusOnSearch,
|
package/dist/es2019/version.json
CHANGED
|
@@ -19,6 +19,7 @@ function ElementSearch(_ref) {
|
|
|
19
19
|
formatMessage = _ref.intl.formatMessage,
|
|
20
20
|
focus = _ref.focus,
|
|
21
21
|
onClick = _ref.onClick,
|
|
22
|
+
onKeyDown = _ref.onKeyDown,
|
|
22
23
|
searchTerm = _ref.searchTerm;
|
|
23
24
|
var ref = useFocus(focus);
|
|
24
25
|
var onChange = function onChange(_ref2) {
|
|
@@ -34,6 +35,7 @@ function ElementSearch(_ref) {
|
|
|
34
35
|
onChange: onChange,
|
|
35
36
|
onClick: onClick,
|
|
36
37
|
onFocus: onFocus,
|
|
38
|
+
onKeyDown: onKeyDown,
|
|
37
39
|
onBlur: onBlur,
|
|
38
40
|
elemBeforeInput: jsx("div", {
|
|
39
41
|
css: elementBeforeInput,
|
|
@@ -65,10 +67,10 @@ var placeHolderMessage = {
|
|
|
65
67
|
description: 'Search field placeholder'
|
|
66
68
|
};
|
|
67
69
|
var styledShortcut = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n padding: ", "px ", "px;\n width: ", "px;\n"])), shortcutStyle, GRID_SIZE / 2, GRID_SIZE, GRID_SIZE * 6);
|
|
68
|
-
var wrapper = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n border-radius: ", "px;\n flex: 1 1 100%;\n overflow: visible;\n & > [data-ds--text-field--input] {\n margin-bottom: 3px;\n font-size: ", ";\n padding: ", "px
|
|
70
|
+
var wrapper = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n border-radius: ", "px;\n flex: 1 1 100%;\n overflow: visible;\n & > [data-ds--text-field--input] {\n margin-bottom: 3px;\n font-size: ", ";\n padding: ", "px ", " ", "px 0;\n }\n }\n"])), GRID_SIZE * 6, GRID_SIZE, relativeFontSizeToBase16(14), GRID_SIZE, "var(--ds-space-075, 6px)", GRID_SIZE);
|
|
69
71
|
var wrapperInline = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n flex: none;\n overflow: revert;\n }\n"])), GRID_SIZE * 5);
|
|
70
|
-
var elementBeforeInput = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin: 1px
|
|
71
|
-
var elementAfterInput = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: 0
|
|
72
|
+
var elementBeforeInput = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin: 1px ", " 0 ", ";\n color: ", ";\n\n // Custom SearchIcon style\n span,\n svg {\n height: 20px;\n width: 20px;\n }\n"])), "var(--ds-space-075, 6px)", "var(--ds-space-100, 8px)", "var(--ds-icon, ".concat(N200, ")"));
|
|
73
|
+
var elementAfterInput = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: 0 ", ";\n height: ", ";\n text-align: center;\n"])), "var(--ds-space-100, 8px)", SEARCH_ITEM_HEIGHT_WIDTH);
|
|
72
74
|
var MemoizedElementSearchWithAnalytics = /*#__PURE__*/memo(withAnalyticsContext({
|
|
73
75
|
component: 'Searchbar'
|
|
74
76
|
})(injectIntl(ElementSearch)));
|
|
@@ -20,7 +20,7 @@ var baseBrowserContainerStyles = css(_templateObject2 || (_templateObject2 = _ta
|
|
|
20
20
|
var mobileElementBrowserContainer = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", ";\n flex-direction: column;\n"])), baseBrowserContainerStyles);
|
|
21
21
|
var elementBrowserContainer = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n flex-direction: row;\n"])), baseBrowserContainerStyles);
|
|
22
22
|
var baseSidebarStyles = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n\n overflow-x: auto;\n overflow-y: hidden;\n"])));
|
|
23
|
-
var mobileSideBar = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 ", ";\n padding:
|
|
23
|
+
var mobileSideBar = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 ", ";\n padding: ", " ", " 0\n ", ";\n"])), baseSidebarStyles, INLINE_SIDEBAR_HEIGHT, "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)");
|
|
24
24
|
var mobileSideBarShowCategories = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n flex: 0 0 auto;\n"])));
|
|
25
25
|
var sideBar = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 'auto';\n"])), baseSidebarStyles);
|
|
26
26
|
var sideBarShowCategories = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n ", ";\n flex: 0 0 ", ";\n"])), baseSidebarStyles, SIDEBAR_WIDTH);
|
|
@@ -33,6 +33,7 @@ var categoryListWrapper = css(_templateObject15 || (_templateObject15 = _taggedT
|
|
|
33
33
|
function StatelessElementBrowser(props) {
|
|
34
34
|
var items = props.items,
|
|
35
35
|
onSelectItem = props.onSelectItem,
|
|
36
|
+
onInsertItem = props.onInsertItem,
|
|
36
37
|
viewMoreItem = props.viewMoreItem;
|
|
37
38
|
var _useContainerWidth = useContainerWidth(),
|
|
38
39
|
containerWidth = _useContainerWidth.containerWidth,
|
|
@@ -82,10 +83,11 @@ function StatelessElementBrowser(props) {
|
|
|
82
83
|
if (e.key !== 'Enter') {
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
|
-
if (
|
|
86
|
-
|
|
86
|
+
if (onInsertItem && selectedItem != null) {
|
|
87
|
+
onInsertItem(selectedItem);
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
}, [onInsertItem, selectedItem]);
|
|
89
91
|
|
|
90
92
|
/**
|
|
91
93
|
* On arrow key selection and clicks the selectedItemIndex will change.
|
|
@@ -146,13 +148,13 @@ function MobileBrowser(_ref) {
|
|
|
146
148
|
viewMoreItem = _ref.viewMoreItem;
|
|
147
149
|
return jsx("div", {
|
|
148
150
|
css: mobileElementBrowserContainer,
|
|
149
|
-
onKeyPress: onKeyPress,
|
|
150
151
|
onKeyDown: onKeyDown,
|
|
151
152
|
"data-testid": "mobile__element-browser"
|
|
152
153
|
}, jsx("div", {
|
|
153
154
|
css: showCategories ? [mobileSideBar, mobileSideBarShowCategories] : mobileSideBar
|
|
154
155
|
}, showSearch && jsx(ElementSearch, {
|
|
155
156
|
onSearch: onSearch,
|
|
157
|
+
onKeyDown: onKeyPress,
|
|
156
158
|
mode: mode,
|
|
157
159
|
focus: focusOnSearch,
|
|
158
160
|
onClick: setFocusOnSearch,
|
|
@@ -225,13 +227,13 @@ function DesktopBrowser(_ref2) {
|
|
|
225
227
|
createAnalyticsEvent: createAnalyticsEvent
|
|
226
228
|
}))), jsx("div", {
|
|
227
229
|
css: mainContent,
|
|
228
|
-
onKeyPress: onKeyPress,
|
|
229
230
|
onKeyDown: onKeyDown,
|
|
230
231
|
"data-testid": "main-content"
|
|
231
232
|
}, showSearch && jsx("div", {
|
|
232
233
|
css: searchContainer
|
|
233
234
|
}, jsx(ElementSearch, {
|
|
234
235
|
onSearch: onSearch,
|
|
236
|
+
onKeyDown: onKeyPress,
|
|
235
237
|
mode: mode,
|
|
236
238
|
focus: focusOnSearch,
|
|
237
239
|
onClick: setFocusOnSearch,
|
package/dist/esm/version.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
4
4
|
import { Modes } from '../types';
|
|
5
5
|
interface Props {
|
|
6
6
|
onSearch: (value: string) => void;
|
|
7
7
|
mode: keyof typeof Modes;
|
|
8
8
|
focus: boolean;
|
|
9
9
|
onClick: (e: React.MouseEvent) => void;
|
|
10
|
+
onKeyDown: (e: React.KeyboardEvent) => void;
|
|
10
11
|
searchTerm?: string;
|
|
11
12
|
}
|
|
12
13
|
declare const MemoizedElementSearchWithAnalytics: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<Props & WrappedComponentProps<"intl">, "intl"> & {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
-
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
5
|
-
import { Category, Modes } from '../types';
|
|
6
|
-
import { EmptyStateHandler } from '../../../types/empty-state-handler';
|
|
3
|
+
import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
5
|
+
import type { Category, Modes } from '../types';
|
|
6
|
+
import type { EmptyStateHandler } from '../../../types/empty-state-handler';
|
|
7
7
|
export type StatelessElementBrowserProps = {
|
|
8
8
|
categories?: Category[];
|
|
9
9
|
items: QuickInsertItem[];
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
4
4
|
import { Modes } from '../types';
|
|
5
5
|
interface Props {
|
|
6
6
|
onSearch: (value: string) => void;
|
|
7
7
|
mode: keyof typeof Modes;
|
|
8
8
|
focus: boolean;
|
|
9
9
|
onClick: (e: React.MouseEvent) => void;
|
|
10
|
+
onKeyDown: (e: React.KeyboardEvent) => void;
|
|
10
11
|
searchTerm?: string;
|
|
11
12
|
}
|
|
12
13
|
declare const MemoizedElementSearchWithAnalytics: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<Props & WrappedComponentProps<"intl">, "intl"> & {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
-
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
5
|
-
import { Category, Modes } from '../types';
|
|
6
|
-
import { EmptyStateHandler } from '../../../types/empty-state-handler';
|
|
3
|
+
import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
5
|
+
import type { Category, Modes } from '../types';
|
|
6
|
+
import type { EmptyStateHandler } from '../../../types/empty-state-handler';
|
|
7
7
|
export type StatelessElementBrowserProps = {
|
|
8
8
|
categories?: Category[];
|
|
9
9
|
items: QuickInsertItem[];
|