@atlaskit/editor-common 72.1.1 → 72.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/cjs/analytics/types/enums.js +1 -1
- package/dist/cjs/styles/shared/code-block.js +1 -3
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui-menu/Dropdown/index.js +1 -1
- package/dist/cjs/ui-menu/DropdownMenu/index.js +23 -7
- package/dist/cjs/ui-menu/MenuArrowKeyNavigationProvider/index.js +68 -51
- package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +4 -4
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/types/enums.js +1 -1
- package/dist/es2019/styles/shared/code-block.js +3 -6
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui-menu/Dropdown/index.js +1 -1
- package/dist/es2019/ui-menu/DropdownMenu/index.js +23 -7
- package/dist/es2019/ui-menu/MenuArrowKeyNavigationProvider/index.js +60 -51
- package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +3 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/types/enums.js +1 -1
- package/dist/esm/styles/shared/code-block.js +1 -2
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui-menu/Dropdown/index.js +1 -1
- package/dist/esm/ui-menu/DropdownMenu/index.js +23 -7
- package/dist/esm/ui-menu/MenuArrowKeyNavigationProvider/index.js +66 -52
- package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +4 -4
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/types/enums.d.ts +1 -1
- package/dist/types/analytics/types/events.d.ts +3 -2
- package/dist/types/analytics/types/general-events.d.ts +8 -3
- package/dist/types/types/editor-plugin.d.ts +24 -2
- package/dist/types/types/floating-toolbar.d.ts +10 -0
- package/dist/types/types/type-ahead.d.ts +8 -0
- package/dist/types/ui-menu/DropdownMenu/index.d.ts +1 -1
- package/dist/types/ui-menu/DropdownMenu/types.d.ts +1 -0
- package/dist/types/ui-menu/MenuArrowKeyNavigationProvider/index.d.ts +3 -2
- package/dist/types/ui-react/with-react-editor-view-outer-listeners.d.ts +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 72.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`a0a35fe7fb1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a0a35fe7fb1) - Renaming contentComponent event subject to contentComponentv2. Move errorStack attribute to nonPrivacySafeAttributes
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`513cb2010b7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/513cb2010b7) - Users are able to select dropdown menu item using keyboard via the Enter key
|
|
12
|
+
- [`aaa6509f036`](https://bitbucket.org/atlassian/atlassian-frontend/commits/aaa6509f036) - ED-16198 Update & restore dedupeMarksTransformed analytics event. Also addresses
|
|
13
|
+
a bug when `discardedMarks` would only return the latest discarded mark
|
|
14
|
+
- [`314777fbb20`](https://bitbucket.org/atlassian/atlassian-frontend/commits/314777fbb20) - [ux] ED-16490 fixed bug so big margin will not occur before a Decision node on iOS
|
|
15
|
+
- [`a5dcaef4136`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a5dcaef4136) - [ux] Fixed keyboard navigation issues relating to the main editor toolbar and floating toolbars.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 72.1.2
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [`2ff1c66a6ab`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2ff1c66a6ab) - [ux] ED-16490 fixed bug so big margin will not occur before a Decision node in Renderer on iOS
|
|
23
|
+
|
|
3
24
|
## 72.1.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -97,7 +97,7 @@ exports.ACTION = ACTION;
|
|
|
97
97
|
ACTION["SYNCHRONY_ENTITY_ERROR"] = "synchronyEntityError";
|
|
98
98
|
ACTION["SYNCHRONY_ERROR"] = "synchronyError";
|
|
99
99
|
ACTION["TEXT_LINK_MARK_TRANSFORMED"] = "textLinkMarkTransformed";
|
|
100
|
-
ACTION["
|
|
100
|
+
ACTION["DEDUPE_MARKS_TRANSFORMED_V2"] = "dedupeMarksTransformedV2";
|
|
101
101
|
ACTION["NODES_MISSING_CONTENT_TRANSFORMED"] = "nodesMissingContentTransformed";
|
|
102
102
|
ACTION["INDENTATION_MARKS_TRANSFORMED"] = "indentationMarksTransformed";
|
|
103
103
|
ACTION["INVALID_MEDIA_CONTENT_TRANSFORMED"] = "invalidMediaContentTransformed";
|
|
@@ -19,8 +19,6 @@ var _components = require("@atlaskit/theme/components");
|
|
|
19
19
|
|
|
20
20
|
var _constants = require("@atlaskit/theme/constants");
|
|
21
21
|
|
|
22
|
-
var _taskDecision = require("./task-decision");
|
|
23
|
-
|
|
24
22
|
var _templateObject, _templateObject2;
|
|
25
23
|
|
|
26
24
|
var CodeBlockSharedCssClassName = {
|
|
@@ -57,5 +55,5 @@ var codeBlockSharedStyles = function codeBlockSharedStyles(props) {
|
|
|
57
55
|
};
|
|
58
56
|
|
|
59
57
|
exports.codeBlockSharedStyles = codeBlockSharedStyles;
|
|
60
|
-
var codeBlockInListSafariFix = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n
|
|
58
|
+
var codeBlockInListSafariFix = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ::before {\n content: ' ';\n line-height: ", ";\n }\n\n > p:first-child,\n > .code-block:first-child,\n > .ProseMirror-gapcursor:first-child + .code-block {\n margin-top: -", "em !important;\n }\n"])), _editorSharedStyles.akEditorLineHeight, _editorSharedStyles.akEditorLineHeight);
|
|
61
59
|
exports.codeBlockInListSafariFix = codeBlockInListSafariFix;
|
|
@@ -44,7 +44,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
44
44
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
45
|
|
|
46
46
|
var packageName = "@atlaskit/editor-common";
|
|
47
|
-
var packageVersion = "72.
|
|
47
|
+
var packageVersion = "72.2.0";
|
|
48
48
|
var halfFocusRing = 1;
|
|
49
49
|
var dropOffset = "0, ".concat((0, _constants.gridSize)(), "px");
|
|
50
50
|
|
|
@@ -102,7 +102,7 @@ var Dropdown = /*#__PURE__*/function (_PureComponent) {
|
|
|
102
102
|
}, /*#__PURE__*/_react.default.createElement(_MenuArrowKeyNavigationProvider.MenuArrowKeyNavigationProvider, {
|
|
103
103
|
disableArrowKeyNavigation: disableArrowKeyNavigation,
|
|
104
104
|
keyDownHandlerContext: keyDownHandlerContext,
|
|
105
|
-
|
|
105
|
+
closeOnTab: true,
|
|
106
106
|
handleClose: function handleClose(event) {
|
|
107
107
|
return onOpenChange && onOpenChange({
|
|
108
108
|
isOpen: false,
|
|
@@ -115,7 +115,8 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
|
|
|
115
115
|
|
|
116
116
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
117
117
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
118
|
-
popupPlacement: ['bottom', 'left']
|
|
118
|
+
popupPlacement: ['bottom', 'left'],
|
|
119
|
+
selectionIndex: -1
|
|
119
120
|
});
|
|
120
121
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleRef", function (target) {
|
|
121
122
|
_this.setState({
|
|
@@ -131,7 +132,7 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
|
|
|
131
132
|
});
|
|
132
133
|
}
|
|
133
134
|
});
|
|
134
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
135
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleCloseAndFocus", function () {
|
|
135
136
|
var _this$state$target, _this$state$target$qu;
|
|
136
137
|
|
|
137
138
|
_this.handleClose();
|
|
@@ -168,7 +169,8 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
|
|
|
168
169
|
zIndex = _this$props.zIndex,
|
|
169
170
|
shouldUseDefaultRole = _this$props.shouldUseDefaultRole,
|
|
170
171
|
disableArrowKeyNavigation = _this$props.disableArrowKeyNavigation,
|
|
171
|
-
keyDownHandlerContext = _this$props.keyDownHandlerContext
|
|
172
|
+
keyDownHandlerContext = _this$props.keyDownHandlerContext,
|
|
173
|
+
onItemActivated = _this$props.onItemActivated;
|
|
172
174
|
return (0, _react2.jsx)(_Popup.default, {
|
|
173
175
|
target: isOpen ? target : undefined,
|
|
174
176
|
mountTo: mountTo,
|
|
@@ -181,9 +183,22 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
|
|
|
181
183
|
offset: offset
|
|
182
184
|
}, (0, _react2.jsx)(_MenuArrowKeyNavigationProvider.MenuArrowKeyNavigationProvider, {
|
|
183
185
|
disableArrowKeyNavigation: disableArrowKeyNavigation,
|
|
184
|
-
handleClose: this.
|
|
186
|
+
handleClose: this.handleCloseAndFocus,
|
|
185
187
|
keyDownHandlerContext: keyDownHandlerContext,
|
|
186
|
-
|
|
188
|
+
onSelection: function onSelection(index) {
|
|
189
|
+
var result = [];
|
|
190
|
+
|
|
191
|
+
if (typeof onItemActivated === 'function') {
|
|
192
|
+
result = items.reduce(function (result, group) {
|
|
193
|
+
return result.concat(group.items);
|
|
194
|
+
}, result);
|
|
195
|
+
onItemActivated({
|
|
196
|
+
item: result[index],
|
|
197
|
+
shouldCloseMenu: false
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
closeOnTab: true
|
|
187
202
|
}, (0, _react2.jsx)(DropListWithOutsideListeners, {
|
|
188
203
|
isOpen: true,
|
|
189
204
|
appearance: "tall",
|
|
@@ -192,7 +207,7 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
|
|
|
192
207
|
shouldFitContainer: true,
|
|
193
208
|
isTriggerNotTabbable: true,
|
|
194
209
|
handleClickOutside: this.handleClose,
|
|
195
|
-
handleEscapeKeydown: this.
|
|
210
|
+
handleEscapeKeydown: this.handleCloseAndFocus,
|
|
196
211
|
targetRef: this.state.target
|
|
197
212
|
}, (0, _react2.jsx)("div", {
|
|
198
213
|
style: {
|
|
@@ -266,7 +281,8 @@ function DropdownMenuItem(_ref) {
|
|
|
266
281
|
theme: theme
|
|
267
282
|
});
|
|
268
283
|
},
|
|
269
|
-
tabIndex: -1
|
|
284
|
+
tabIndex: -1,
|
|
285
|
+
"aria-disabled": item.isDisabled ? 'true' : 'false'
|
|
270
286
|
}, (0, _react2.jsx)(_menu.CustomItem, {
|
|
271
287
|
item: item,
|
|
272
288
|
key: (_item$key2 = item.key) !== null && _item$key2 !== void 0 ? _item$key2 : String(item.content),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
6
|
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
9
|
});
|
|
8
10
|
exports.MenuArrowKeyNavigationProvider = void 0;
|
|
9
11
|
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
10
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
15
|
|
|
12
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -22,26 +26,38 @@ var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvider(_re
|
|
|
22
26
|
handleClose = _ref.handleClose,
|
|
23
27
|
disableArrowKeyNavigation = _ref.disableArrowKeyNavigation,
|
|
24
28
|
keyDownHandlerContext = _ref.keyDownHandlerContext,
|
|
25
|
-
|
|
29
|
+
closeOnTab = _ref.closeOnTab,
|
|
30
|
+
onSelection = _ref.onSelection;
|
|
26
31
|
var wrapperRef = (0, _react.useRef)(null);
|
|
27
|
-
var currentSelectedItemIndex = (0, _react.useRef)(-1);
|
|
28
32
|
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
currentSelectedItemIndex
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
var _useState = (0, _react.useState)(-1),
|
|
34
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
35
|
+
currentSelectedItemIndex = _useState2[0],
|
|
36
|
+
setCurrentSelectedItemIndex = _useState2[1];
|
|
37
|
+
|
|
38
|
+
var incrementIndex = (0, _react.useCallback)(function (list) {
|
|
39
|
+
var currentIndex = currentSelectedItemIndex;
|
|
40
|
+
var nextIndex = (currentIndex + 1) % list.length; // Skips disabled items. Previously this function relied on a list of enabled elements which caused a
|
|
41
|
+
// difference between currentIndex and the item index in the menu.
|
|
42
|
+
|
|
43
|
+
while (nextIndex !== currentIndex && list[nextIndex].getAttribute('aria-disabled') === 'true') {
|
|
44
|
+
nextIndex = (nextIndex + 1) % list.length;
|
|
34
45
|
}
|
|
35
|
-
};
|
|
36
46
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
setCurrentSelectedItemIndex(nextIndex);
|
|
48
|
+
return nextIndex;
|
|
49
|
+
}, [currentSelectedItemIndex]);
|
|
50
|
+
var decrementIndex = (0, _react.useCallback)(function (list) {
|
|
51
|
+
var currentIndex = currentSelectedItemIndex;
|
|
52
|
+
var nextIndex = (list.length + currentIndex - 1) % list.length;
|
|
53
|
+
|
|
54
|
+
while (nextIndex !== currentIndex && list[nextIndex].getAttribute('aria-disabled') === 'true') {
|
|
55
|
+
nextIndex = (list.length + nextIndex - 1) % list.length;
|
|
42
56
|
}
|
|
43
|
-
};
|
|
44
57
|
|
|
58
|
+
setCurrentSelectedItemIndex(nextIndex);
|
|
59
|
+
return nextIndex;
|
|
60
|
+
}, [currentSelectedItemIndex]);
|
|
45
61
|
(0, _react.useLayoutEffect)(function () {
|
|
46
62
|
if (disableArrowKeyNavigation) {
|
|
47
63
|
return;
|
|
@@ -53,49 +69,48 @@ var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvider(_re
|
|
|
53
69
|
|
|
54
70
|
|
|
55
71
|
var handleKeyDown = function handleKeyDown(event) {
|
|
56
|
-
var _wrapperRef$current
|
|
72
|
+
var _wrapperRef$current;
|
|
57
73
|
|
|
58
74
|
var targetElement = event.target; //Tab key on menu items can be handled in the parent components of dropdown menus with KeydownHandlerContext
|
|
59
75
|
|
|
60
|
-
if (event.key === 'Tab' &&
|
|
76
|
+
if (event.key === 'Tab' && closeOnTab) {
|
|
61
77
|
handleClose(event);
|
|
62
78
|
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleTab();
|
|
63
79
|
return;
|
|
64
80
|
} //To trap the focus inside the toolbar using left and right arrow keys
|
|
65
81
|
|
|
66
82
|
|
|
67
|
-
var focusableElements =
|
|
83
|
+
var focusableElements = getFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
|
|
68
84
|
|
|
69
85
|
if (!focusableElements || (focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements.length) === 0) {
|
|
70
86
|
return;
|
|
71
87
|
}
|
|
72
88
|
|
|
73
89
|
if (!((_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(targetElement))) {
|
|
74
|
-
|
|
90
|
+
setCurrentSelectedItemIndex(-1);
|
|
75
91
|
}
|
|
76
92
|
|
|
77
93
|
switch (event.key) {
|
|
78
94
|
case 'ArrowDown':
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
break;
|
|
95
|
+
{
|
|
96
|
+
var _focusableElements$fo;
|
|
97
|
+
|
|
98
|
+
var focusIndex = incrementIndex(focusableElements);
|
|
99
|
+
(_focusableElements$fo = focusableElements[focusIndex]) === null || _focusableElements$fo === void 0 ? void 0 : _focusableElements$fo.focus();
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
88
103
|
|
|
89
104
|
case 'ArrowUp':
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
105
|
+
{
|
|
106
|
+
var _focusableElements$_f;
|
|
107
|
+
|
|
108
|
+
var _focusIndex = decrementIndex(focusableElements);
|
|
109
|
+
|
|
110
|
+
(_focusableElements$_f = focusableElements[_focusIndex]) === null || _focusableElements$_f === void 0 ? void 0 : _focusableElements$_f.focus();
|
|
111
|
+
event.preventDefault();
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
99
114
|
//ArrowLeft/Right on the menu should close the menus
|
|
100
115
|
//then logic to retain the focus can be handled in the parent components with KeydownHandlerContext
|
|
101
116
|
|
|
@@ -105,8 +120,11 @@ var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvider(_re
|
|
|
105
120
|
return;
|
|
106
121
|
}
|
|
107
122
|
|
|
123
|
+
if (!targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
124
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowLeft();
|
|
125
|
+
}
|
|
126
|
+
|
|
108
127
|
handleClose(event);
|
|
109
|
-
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowLeft();
|
|
110
128
|
break;
|
|
111
129
|
|
|
112
130
|
case 'ArrowRight':
|
|
@@ -115,14 +133,24 @@ var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvider(_re
|
|
|
115
133
|
return;
|
|
116
134
|
}
|
|
117
135
|
|
|
136
|
+
if (!targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
137
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowRight();
|
|
138
|
+
}
|
|
139
|
+
|
|
118
140
|
handleClose(event);
|
|
119
|
-
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowRight();
|
|
120
141
|
break;
|
|
121
142
|
|
|
122
143
|
case 'Escape':
|
|
123
144
|
handleClose(event);
|
|
124
145
|
break;
|
|
125
146
|
|
|
147
|
+
case 'Enter':
|
|
148
|
+
if (typeof onSelection === 'function') {
|
|
149
|
+
onSelection(currentSelectedItemIndex);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
break;
|
|
153
|
+
|
|
126
154
|
default:
|
|
127
155
|
return;
|
|
128
156
|
}
|
|
@@ -132,9 +160,9 @@ var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvider(_re
|
|
|
132
160
|
return function () {
|
|
133
161
|
document.removeEventListener('keydown', handleKeyDown);
|
|
134
162
|
};
|
|
135
|
-
}, [currentSelectedItemIndex, wrapperRef, handleClose, disableArrowKeyNavigation, keyDownHandlerContext,
|
|
163
|
+
}, [currentSelectedItemIndex, wrapperRef, handleClose, disableArrowKeyNavigation, keyDownHandlerContext, closeOnTab, onSelection, incrementIndex, decrementIndex]);
|
|
136
164
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
137
|
-
className: "custom-key-handler-wrapper",
|
|
165
|
+
className: "menu-key-handler-wrapper custom-key-handler-wrapper",
|
|
138
166
|
ref: wrapperRef
|
|
139
167
|
}, children);
|
|
140
168
|
};
|
|
@@ -148,15 +176,4 @@ function getFocusableElements(rootNode) {
|
|
|
148
176
|
|
|
149
177
|
var focusableModalElements = rootNode.querySelectorAll('a[href], button:not([disabled]), textarea, input, select, div[tabindex="-1"]') || [];
|
|
150
178
|
return Array.from(focusableModalElements);
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* This method filters out all the disabled menu items
|
|
154
|
-
*/
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
function getEnabledElements(rootNode) {
|
|
158
|
-
var focusableElements = getFocusableElements(rootNode);
|
|
159
|
-
return focusableElements.filter(function (element) {
|
|
160
|
-
return !element.querySelector('[role="button"][aria-disabled="true"]') && !element.querySelector('[role="menuitem"][aria-disabled="true"]');
|
|
161
|
-
});
|
|
162
179
|
}
|
|
@@ -31,7 +31,7 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
|
31
31
|
|
|
32
32
|
var _ReactEditorViewContext = _interopRequireDefault(require("./ReactEditorViewContext"));
|
|
33
33
|
|
|
34
|
-
var _excluded = ["handleClickOutside", "handleEnterKeydown", "handleEscapeKeydown", "
|
|
34
|
+
var _excluded = ["handleClickOutside", "handleEnterKeydown", "handleEscapeKeydown", "closeOnTab"];
|
|
35
35
|
|
|
36
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
37
|
|
|
@@ -94,7 +94,7 @@ var WithOutsideClick = /*#__PURE__*/function (_PureComponent) {
|
|
|
94
94
|
return false;
|
|
95
95
|
} else if (evt.code === 'Enter' && _this.props.handleEnterKeydown) {
|
|
96
96
|
_this.props.handleEnterKeydown(evt);
|
|
97
|
-
} else if (evt.code === 'Tab' && _this.props.handleEscapeKeydown && _this.props.
|
|
97
|
+
} else if (evt.code === 'Tab' && _this.props.handleEscapeKeydown && _this.props.closeOnTab) {
|
|
98
98
|
//The menus should be closed when the tab is pressed as it takes the focus out of the menu
|
|
99
99
|
_this.props.handleEscapeKeydown(evt);
|
|
100
100
|
}
|
|
@@ -147,7 +147,7 @@ function withReactEditorViewOuterListeners(Component) {
|
|
|
147
147
|
var handleClickOutside = _ref.handleClickOutside,
|
|
148
148
|
handleEnterKeydown = _ref.handleEnterKeydown,
|
|
149
149
|
handleEscapeKeydown = _ref.handleEscapeKeydown,
|
|
150
|
-
|
|
150
|
+
closeOnTab = _ref.closeOnTab,
|
|
151
151
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
152
152
|
var isActiveComponent = hasIsOpen(props) ? props.isOpen : true;
|
|
153
153
|
return /*#__PURE__*/_react.default.createElement(_ReactEditorViewContext.default.Consumer, null, function (_ref2) {
|
|
@@ -161,7 +161,7 @@ function withReactEditorViewOuterListeners(Component) {
|
|
|
161
161
|
handleClickOutside: handleClickOutside,
|
|
162
162
|
handleEnterKeydown: handleEnterKeydown,
|
|
163
163
|
handleEscapeKeydown: handleEscapeKeydown,
|
|
164
|
-
|
|
164
|
+
closeOnTab: closeOnTab
|
|
165
165
|
}, /*#__PURE__*/_react.default.createElement(Component, props));
|
|
166
166
|
});
|
|
167
167
|
};
|
package/dist/cjs/version.json
CHANGED
|
@@ -89,7 +89,7 @@ export let ACTION;
|
|
|
89
89
|
ACTION["SYNCHRONY_ENTITY_ERROR"] = "synchronyEntityError";
|
|
90
90
|
ACTION["SYNCHRONY_ERROR"] = "synchronyError";
|
|
91
91
|
ACTION["TEXT_LINK_MARK_TRANSFORMED"] = "textLinkMarkTransformed";
|
|
92
|
-
ACTION["
|
|
92
|
+
ACTION["DEDUPE_MARKS_TRANSFORMED_V2"] = "dedupeMarksTransformedV2";
|
|
93
93
|
ACTION["NODES_MISSING_CONTENT_TRANSFORMED"] = "nodesMissingContentTransformed";
|
|
94
94
|
ACTION["INDENTATION_MARKS_TRANSFORMED"] = "indentationMarksTransformed";
|
|
95
95
|
ACTION["INVALID_MEDIA_CONTENT_TRANSFORMED"] = "invalidMediaContentTransformed";
|
|
@@ -3,7 +3,6 @@ import { akEditorCodeFontFamily, akEditorLineHeight, akEditorTableCellMinWidth,
|
|
|
3
3
|
import { DN20, DN400, DN50, DN800, N20, N30, N400, N800 } from '@atlaskit/theme/colors';
|
|
4
4
|
import { themed } from '@atlaskit/theme/components';
|
|
5
5
|
import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
|
|
6
|
-
import { TaskDecisionSharedCssClassName } from './task-decision';
|
|
7
6
|
export const CodeBlockSharedCssClassName = {
|
|
8
7
|
CODEBLOCK_CONTAINER: 'code-block',
|
|
9
8
|
CODEBLOCK_START: 'code-block--start',
|
|
@@ -126,11 +125,9 @@ export const codeBlockSharedStyles = props => css`
|
|
|
126
125
|
}
|
|
127
126
|
`;
|
|
128
127
|
export const codeBlockInListSafariFix = css`
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
line-height: ${akEditorLineHeight};
|
|
133
|
-
}
|
|
128
|
+
::before {
|
|
129
|
+
content: ' ';
|
|
130
|
+
line-height: ${akEditorLineHeight};
|
|
134
131
|
}
|
|
135
132
|
|
|
136
133
|
> p:first-child,
|
|
@@ -9,7 +9,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
9
9
|
import { borderRadius, gridSize } from '@atlaskit/theme/constants';
|
|
10
10
|
import Layer from '../Layer';
|
|
11
11
|
const packageName = "@atlaskit/editor-common";
|
|
12
|
-
const packageVersion = "72.
|
|
12
|
+
const packageVersion = "72.2.0";
|
|
13
13
|
const halfFocusRing = 1;
|
|
14
14
|
const dropOffset = `0, ${gridSize()}px`;
|
|
15
15
|
|
|
@@ -61,7 +61,7 @@ export class Dropdown extends PureComponent {
|
|
|
61
61
|
}, /*#__PURE__*/React.createElement(MenuArrowKeyNavigationProvider, {
|
|
62
62
|
disableArrowKeyNavigation: disableArrowKeyNavigation,
|
|
63
63
|
keyDownHandlerContext: keyDownHandlerContext,
|
|
64
|
-
|
|
64
|
+
closeOnTab: true,
|
|
65
65
|
handleClose: event => onOpenChange && onOpenChange({
|
|
66
66
|
isOpen: false,
|
|
67
67
|
event
|
|
@@ -92,7 +92,8 @@ export default class DropdownMenuWrapper extends PureComponent {
|
|
|
92
92
|
super(...args);
|
|
93
93
|
|
|
94
94
|
_defineProperty(this, "state", {
|
|
95
|
-
popupPlacement: ['bottom', 'left']
|
|
95
|
+
popupPlacement: ['bottom', 'left'],
|
|
96
|
+
selectionIndex: -1
|
|
96
97
|
});
|
|
97
98
|
|
|
98
99
|
_defineProperty(this, "handleRef", target => {
|
|
@@ -113,7 +114,7 @@ export default class DropdownMenuWrapper extends PureComponent {
|
|
|
113
114
|
}
|
|
114
115
|
});
|
|
115
116
|
|
|
116
|
-
_defineProperty(this, "
|
|
117
|
+
_defineProperty(this, "handleCloseAndFocus", () => {
|
|
117
118
|
var _this$state$target, _this$state$target$qu;
|
|
118
119
|
|
|
119
120
|
this.handleClose();
|
|
@@ -146,7 +147,8 @@ export default class DropdownMenuWrapper extends PureComponent {
|
|
|
146
147
|
zIndex,
|
|
147
148
|
shouldUseDefaultRole,
|
|
148
149
|
disableArrowKeyNavigation,
|
|
149
|
-
keyDownHandlerContext
|
|
150
|
+
keyDownHandlerContext,
|
|
151
|
+
onItemActivated
|
|
150
152
|
} = this.props;
|
|
151
153
|
return jsx(Popup, {
|
|
152
154
|
target: isOpen ? target : undefined,
|
|
@@ -160,9 +162,22 @@ export default class DropdownMenuWrapper extends PureComponent {
|
|
|
160
162
|
offset: offset
|
|
161
163
|
}, jsx(MenuArrowKeyNavigationProvider, {
|
|
162
164
|
disableArrowKeyNavigation: disableArrowKeyNavigation,
|
|
163
|
-
handleClose: this.
|
|
165
|
+
handleClose: this.handleCloseAndFocus,
|
|
164
166
|
keyDownHandlerContext: keyDownHandlerContext,
|
|
165
|
-
|
|
167
|
+
onSelection: index => {
|
|
168
|
+
let result = [];
|
|
169
|
+
|
|
170
|
+
if (typeof onItemActivated === 'function') {
|
|
171
|
+
result = items.reduce((result, group) => {
|
|
172
|
+
return result.concat(group.items);
|
|
173
|
+
}, result);
|
|
174
|
+
onItemActivated({
|
|
175
|
+
item: result[index],
|
|
176
|
+
shouldCloseMenu: false
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
closeOnTab: true
|
|
166
181
|
}, jsx(DropListWithOutsideListeners, {
|
|
167
182
|
isOpen: true,
|
|
168
183
|
appearance: "tall",
|
|
@@ -171,7 +186,7 @@ export default class DropdownMenuWrapper extends PureComponent {
|
|
|
171
186
|
shouldFitContainer: true,
|
|
172
187
|
isTriggerNotTabbable: true,
|
|
173
188
|
handleClickOutside: this.handleClose,
|
|
174
|
-
handleEscapeKeydown: this.
|
|
189
|
+
handleEscapeKeydown: this.handleCloseAndFocus,
|
|
175
190
|
targetRef: this.state.target
|
|
176
191
|
}, jsx("div", {
|
|
177
192
|
style: {
|
|
@@ -239,7 +254,8 @@ function DropdownMenuItem({
|
|
|
239
254
|
css: theme => buttonStyles(item.isActive)({
|
|
240
255
|
theme
|
|
241
256
|
}),
|
|
242
|
-
tabIndex: -1
|
|
257
|
+
tabIndex: -1,
|
|
258
|
+
"aria-disabled": item.isDisabled ? 'true' : 'false'
|
|
243
259
|
}, jsx(CustomItem, {
|
|
244
260
|
item: item,
|
|
245
261
|
key: (_item$key2 = item.key) !== null && _item$key2 !== void 0 ? _item$key2 : String(item.content),
|