@atlaskit/editor-common 78.33.2 → 78.33.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 +14 -0
- package/dist/cjs/extensibility/Extension/Lozenge/ExtensionLabel.js +2 -1
- package/dist/cjs/messages/table.js +20 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/selection/index.js +13 -3
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +43 -11
- package/dist/cjs/ui-menu/DropdownMenu/index.js +5 -1
- package/dist/cjs/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +32 -8
- package/dist/es2019/extensibility/Extension/Lozenge/ExtensionLabel.js +2 -1
- package/dist/es2019/messages/table.js +20 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/selection/index.js +13 -3
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +43 -11
- package/dist/es2019/ui-menu/DropdownMenu/index.js +5 -1
- package/dist/es2019/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +32 -8
- package/dist/esm/extensibility/Extension/Lozenge/ExtensionLabel.js +2 -1
- package/dist/esm/messages/table.js +20 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/selection/index.js +13 -3
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +43 -11
- package/dist/esm/ui-menu/DropdownMenu/index.js +5 -1
- package/dist/esm/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +32 -8
- package/dist/types/messages/table.d.ts +20 -0
- package/dist/types-ts4.5/messages/table.d.ts +20 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 78.33.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#94715](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94715) [`6606b85603b4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6606b85603b4) - [ux] Fixes issue where label hides behind smart link
|
|
8
|
+
- [#92552](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/92552) [`7cd874b858c8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7cd874b858c8) - Check target elements are actually HTMLElement rather than typecasting.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 78.33.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#85498](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/85498) [`ae3b8e85ce49`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ae3b8e85ce49) - [ux] [ECA11Y-17] Added screen reader announcement for insertion and removal of table columns and rows
|
|
16
|
+
|
|
3
17
|
## 78.33.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -12,6 +12,7 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
12
12
|
/** @jsx jsx */
|
|
13
13
|
|
|
14
14
|
var labelStyles = (0, _react2.css)({
|
|
15
|
+
zIndex: 1,
|
|
15
16
|
opacity: 0,
|
|
16
17
|
display: 'inline-flex',
|
|
17
18
|
width: 'max-content',
|
|
@@ -22,7 +23,7 @@ var labelStyles = (0, _react2.css)({
|
|
|
22
23
|
top: '-19px',
|
|
23
24
|
'&.inline': {
|
|
24
25
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
25
|
-
top: '-
|
|
26
|
+
top: '-18px',
|
|
26
27
|
marginLeft: "var(--ds-space-150, 12px)"
|
|
27
28
|
},
|
|
28
29
|
'&.show-label': {
|
|
@@ -121,6 +121,26 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
|
121
121
|
defaultMessage: 'Row numbers',
|
|
122
122
|
desciption: 'Adds a number to each row except header row'
|
|
123
123
|
},
|
|
124
|
+
rowsAreInserted: {
|
|
125
|
+
id: 'fabric.editor.rowsAreInserted',
|
|
126
|
+
defaultMessage: '{count, plural, one {A row has been} other {{count} rows have been}} inserted',
|
|
127
|
+
description: 'Assistive message following the insertion of row(s)'
|
|
128
|
+
},
|
|
129
|
+
rowsAreRemoved: {
|
|
130
|
+
id: 'fabric.editor.rowsAreRemoved',
|
|
131
|
+
defaultMessage: '{count, plural, one {The row has been} other {{count} rows have been}} removed',
|
|
132
|
+
description: 'Assistive message following the removal of row(s)'
|
|
133
|
+
},
|
|
134
|
+
columnsAreInserted: {
|
|
135
|
+
id: 'fabric.editor.columnsAreInserted',
|
|
136
|
+
defaultMessage: '{count, plural, one {A column has been} other {{count} columns have been}} inserted',
|
|
137
|
+
description: 'Assistive message following the insertion of column(s)'
|
|
138
|
+
},
|
|
139
|
+
columnsAreRemoved: {
|
|
140
|
+
id: 'fabric.editor.columnsAreRemoved',
|
|
141
|
+
defaultMessage: '{count, plural, one {The column has been} other {{count} columns have been}} removed',
|
|
142
|
+
description: 'Assistive message following the removal of column(s)'
|
|
143
|
+
},
|
|
124
144
|
cellOptions: {
|
|
125
145
|
id: 'fabric.editor.cellOptions',
|
|
126
146
|
defaultMessage: 'Cell options',
|
|
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
16
16
|
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 && Object.prototype.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; }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "78.33.
|
|
19
|
+
var packageVersion = "78.33.4";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -132,6 +132,7 @@ Object.defineProperty(exports, "startPositionOfParent", {
|
|
|
132
132
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
133
133
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
134
134
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
135
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
135
136
|
var _analytics = require("../analytics");
|
|
136
137
|
var _types = require("./types");
|
|
137
138
|
var _selection = require("./gap-cursor/selection");
|
|
@@ -233,13 +234,22 @@ function createSelectionClickHandler(nodes, isValidTarget, options) {
|
|
|
233
234
|
return false;
|
|
234
235
|
}
|
|
235
236
|
if (direct && nodes.indexOf(node.type.name) !== -1) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if (isValidTarget(_target)) {
|
|
237
|
+
var _target = event.target;
|
|
238
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.explicit-html-element-check')) {
|
|
239
|
+
if (_target instanceof HTMLElement && isValidTarget(_target)) {
|
|
239
240
|
var selectionPos = options.getNodeSelectionPos ? options.getNodeSelectionPos(view.state, nodePos) : nodePos;
|
|
240
241
|
selectNode(selectionPos)(view.state, view.dispatch);
|
|
241
242
|
return true;
|
|
242
243
|
}
|
|
244
|
+
} else {
|
|
245
|
+
if (event.target) {
|
|
246
|
+
var _target2 = event.target;
|
|
247
|
+
if (isValidTarget(_target2)) {
|
|
248
|
+
var _selectionPos = options.getNodeSelectionPos ? options.getNodeSelectionPos(view.state, nodePos) : nodePos;
|
|
249
|
+
selectNode(_selectionPos)(view.state, view.dispatch);
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
243
253
|
}
|
|
244
254
|
}
|
|
245
255
|
return false;
|
|
@@ -20,7 +20,7 @@ var _Layer = _interopRequireDefault(require("../Layer"));
|
|
|
20
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
21
21
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "78.33.
|
|
23
|
+
var packageVersion = "78.33.4";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.MenuArrowKeyNavigationProvider = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
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); }
|
|
12
13
|
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 && Object.prototype.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; }
|
|
13
14
|
var hasEnabledItems = function hasEnabledItems(list) {
|
|
@@ -81,7 +82,6 @@ var MenuArrowKeyNavigationProvider = exports.MenuArrowKeyNavigationProvider = fu
|
|
|
81
82
|
* @param event
|
|
82
83
|
*/
|
|
83
84
|
var handleKeyDown = function handleKeyDown(event) {
|
|
84
|
-
var _wrapperRef$current;
|
|
85
85
|
var targetElement = event.target;
|
|
86
86
|
|
|
87
87
|
// Tab key on menu items can be handled in the parent components of dropdown menus with KeydownHandlerContext
|
|
@@ -96,8 +96,16 @@ var MenuArrowKeyNavigationProvider = exports.MenuArrowKeyNavigationProvider = fu
|
|
|
96
96
|
if (!focusableElements || (focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements.length) === 0) {
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
if (
|
|
100
|
-
|
|
99
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.explicit-html-element-check')) {
|
|
100
|
+
var _wrapperRef$current;
|
|
101
|
+
if (targetElement instanceof HTMLElement && !((_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(targetElement))) {
|
|
102
|
+
setCurrentSelectedItemIndex(-1);
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
var _wrapperRef$current2;
|
|
106
|
+
if (!((_wrapperRef$current2 = wrapperRef.current) !== null && _wrapperRef$current2 !== void 0 && _wrapperRef$current2.contains(targetElement))) {
|
|
107
|
+
setCurrentSelectedItemIndex(-1);
|
|
108
|
+
}
|
|
101
109
|
}
|
|
102
110
|
switch (event.key) {
|
|
103
111
|
case 'ArrowDown':
|
|
@@ -125,22 +133,46 @@ var MenuArrowKeyNavigationProvider = exports.MenuArrowKeyNavigationProvider = fu
|
|
|
125
133
|
// then logic to retain the focus can be handled in the parent components with KeydownHandlerContext
|
|
126
134
|
case 'ArrowLeft':
|
|
127
135
|
// Filter out the events from outside the menu
|
|
128
|
-
if (
|
|
129
|
-
|
|
136
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.explicit-html-element-check')) {
|
|
137
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest('.custom-key-handler-wrapper')) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
if (!(targetElement !== null && targetElement !== void 0 && targetElement.closest('.custom-key-handler-wrapper'))) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
130
144
|
}
|
|
131
145
|
handleClose(event);
|
|
132
|
-
if (
|
|
133
|
-
|
|
146
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.explicit-html-element-check')) {
|
|
147
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
148
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 || keyDownHandlerContext.handleArrowLeft();
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
if (!(targetElement !== null && targetElement !== void 0 && targetElement.closest('[data-testid="editor-floating-toolbar"]'))) {
|
|
152
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 || keyDownHandlerContext.handleArrowLeft();
|
|
153
|
+
}
|
|
134
154
|
}
|
|
135
155
|
break;
|
|
136
156
|
case 'ArrowRight':
|
|
137
157
|
// Filter out the events from outside the menu
|
|
138
|
-
if (
|
|
139
|
-
|
|
158
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.explicit-html-element-check')) {
|
|
159
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest('.custom-key-handler-wrapper')) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
if (!targetElement.closest('.custom-key-handler-wrapper')) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
140
166
|
}
|
|
141
167
|
handleClose(event);
|
|
142
|
-
if (
|
|
143
|
-
|
|
168
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.explicit-html-element-check')) {
|
|
169
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
170
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 || keyDownHandlerContext.handleArrowRight();
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
if (!targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
174
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 || keyDownHandlerContext.handleArrowRight();
|
|
175
|
+
}
|
|
144
176
|
}
|
|
145
177
|
break;
|
|
146
178
|
case 'Escape':
|
|
@@ -291,7 +291,11 @@ function DropdownMenuItem(_ref) {
|
|
|
291
291
|
}, item.content);
|
|
292
292
|
}
|
|
293
293
|
var _handleSubmenuActive = function _handleSubmenuActive(event) {
|
|
294
|
-
|
|
294
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.explicit-html-element-check')) {
|
|
295
|
+
setSubmenuActive(Boolean(event.target instanceof HTMLElement && event.target.closest(".".concat(_styles.DropdownMenuSharedCssClassName.SUBMENU))));
|
|
296
|
+
} else {
|
|
297
|
+
setSubmenuActive(!!event.target.closest(".".concat(_styles.DropdownMenuSharedCssClassName.SUBMENU)));
|
|
298
|
+
}
|
|
295
299
|
};
|
|
296
300
|
var dropListItem = (0, _react2.jsx)("div", {
|
|
297
301
|
css: function css() {
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.ToolbarArrowKeyNavigationProvider = exports.KeyDownHandlerContext = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _react2 = require("@emotion/react");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var _messages = require("../../messages");
|
|
11
12
|
var _ui = require("../../ui");
|
|
12
13
|
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); }
|
|
@@ -115,18 +116,31 @@ var ToolbarArrowKeyNavigationProvider = exports.ToolbarArrowKeyNavigationProvide
|
|
|
115
116
|
* @param event
|
|
116
117
|
*/
|
|
117
118
|
var handleKeyDown = function handleKeyDown(event) {
|
|
118
|
-
var _document$querySelect, _document$querySelect2, _wrapperRef$current;
|
|
119
119
|
// To trap the focus inside the horizontal toolbar for left and right arrow keys
|
|
120
120
|
var targetElement = event.target;
|
|
121
121
|
|
|
122
122
|
// To filter out the events outside the child component
|
|
123
|
-
if (
|
|
124
|
-
|
|
123
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.explicit-html-element-check')) {
|
|
124
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest("".concat(childComponentSelector))) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
if (!(targetElement !== null && targetElement !== void 0 && targetElement.closest("".concat(childComponentSelector)))) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
125
131
|
}
|
|
126
132
|
|
|
127
133
|
// The key events are from child components such as dropdown menus / popups are ignored
|
|
128
|
-
if ((
|
|
129
|
-
|
|
134
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.explicit-html-element-check')) {
|
|
135
|
+
var _document$querySelect, _document$querySelect2;
|
|
136
|
+
if (targetElement instanceof HTMLElement && (_document$querySelect = document.querySelector('[data-role="droplistContent"], [data-test-id="color-picker-menu"], [data-emoji-picker-container="true"]')) !== null && _document$querySelect !== void 0 && _document$querySelect.contains(targetElement) || targetElement instanceof HTMLElement && (_document$querySelect2 = document.querySelector('[data-test-id="color-picker-menu"]')) !== null && _document$querySelect2 !== void 0 && _document$querySelect2.contains(targetElement) || event.key === 'ArrowUp' || event.key === 'ArrowDown' || disableArrowKeyNavigation) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
var _document$querySelect3, _document$querySelect4;
|
|
141
|
+
if ((_document$querySelect3 = document.querySelector('[data-role="droplistContent"], [data-test-id="color-picker-menu"], [data-emoji-picker-container="true"]')) !== null && _document$querySelect3 !== void 0 && _document$querySelect3.contains(targetElement) || (_document$querySelect4 = document.querySelector('[data-test-id="color-picker-menu"]')) !== null && _document$querySelect4 !== void 0 && _document$querySelect4.contains(targetElement) || event.key === 'ArrowUp' || event.key === 'ArrowDown' || disableArrowKeyNavigation) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
130
144
|
}
|
|
131
145
|
var menuWrapper = document.querySelector('.menu-key-handler-wrapper');
|
|
132
146
|
if (menuWrapper) {
|
|
@@ -140,10 +154,20 @@ var ToolbarArrowKeyNavigationProvider = exports.ToolbarArrowKeyNavigationProvide
|
|
|
140
154
|
|
|
141
155
|
// This is kind of hack to reset the current focused toolbar item
|
|
142
156
|
// to handle some use cases such as Tab in/out of main toolbar
|
|
143
|
-
if (
|
|
144
|
-
|
|
157
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.explicit-html-element-check')) {
|
|
158
|
+
var _wrapperRef$current;
|
|
159
|
+
if (targetElement instanceof HTMLElement && !((_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(targetElement))) {
|
|
160
|
+
selectedItemIndex.current = -1;
|
|
161
|
+
} else {
|
|
162
|
+
selectedItemIndex.current = targetElement instanceof HTMLElement && filteredFocusableElements.indexOf(targetElement) > -1 ? filteredFocusableElements.indexOf(targetElement) : selectedItemIndex.current;
|
|
163
|
+
}
|
|
145
164
|
} else {
|
|
146
|
-
|
|
165
|
+
var _wrapperRef$current2;
|
|
166
|
+
if (!((_wrapperRef$current2 = wrapperRef.current) !== null && _wrapperRef$current2 !== void 0 && _wrapperRef$current2.contains(targetElement))) {
|
|
167
|
+
selectedItemIndex.current = -1;
|
|
168
|
+
} else {
|
|
169
|
+
selectedItemIndex.current = filteredFocusableElements.indexOf(targetElement) > -1 ? filteredFocusableElements.indexOf(targetElement) : selectedItemIndex.current;
|
|
170
|
+
}
|
|
147
171
|
}
|
|
148
172
|
|
|
149
173
|
// do not scroll to focused element for sticky toolbar when navigating with arrows to avoid unnesessary scroll jump
|
|
@@ -4,6 +4,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { N0, N30, N40, N500 } from '@atlaskit/theme/colors';
|
|
6
6
|
const labelStyles = css({
|
|
7
|
+
zIndex: 1,
|
|
7
8
|
opacity: 0,
|
|
8
9
|
display: 'inline-flex',
|
|
9
10
|
width: 'max-content',
|
|
@@ -14,7 +15,7 @@ const labelStyles = css({
|
|
|
14
15
|
top: '-19px',
|
|
15
16
|
'&.inline': {
|
|
16
17
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
17
|
-
top: '-
|
|
18
|
+
top: '-18px',
|
|
18
19
|
marginLeft: "var(--ds-space-150, 12px)"
|
|
19
20
|
},
|
|
20
21
|
'&.show-label': {
|
|
@@ -115,6 +115,26 @@ export const messages = defineMessages({
|
|
|
115
115
|
defaultMessage: 'Row numbers',
|
|
116
116
|
desciption: 'Adds a number to each row except header row'
|
|
117
117
|
},
|
|
118
|
+
rowsAreInserted: {
|
|
119
|
+
id: 'fabric.editor.rowsAreInserted',
|
|
120
|
+
defaultMessage: '{count, plural, one {A row has been} other {{count} rows have been}} inserted',
|
|
121
|
+
description: 'Assistive message following the insertion of row(s)'
|
|
122
|
+
},
|
|
123
|
+
rowsAreRemoved: {
|
|
124
|
+
id: 'fabric.editor.rowsAreRemoved',
|
|
125
|
+
defaultMessage: '{count, plural, one {The row has been} other {{count} rows have been}} removed',
|
|
126
|
+
description: 'Assistive message following the removal of row(s)'
|
|
127
|
+
},
|
|
128
|
+
columnsAreInserted: {
|
|
129
|
+
id: 'fabric.editor.columnsAreInserted',
|
|
130
|
+
defaultMessage: '{count, plural, one {A column has been} other {{count} columns have been}} inserted',
|
|
131
|
+
description: 'Assistive message following the insertion of column(s)'
|
|
132
|
+
},
|
|
133
|
+
columnsAreRemoved: {
|
|
134
|
+
id: 'fabric.editor.columnsAreRemoved',
|
|
135
|
+
defaultMessage: '{count, plural, one {The column has been} other {{count} columns have been}} removed',
|
|
136
|
+
description: 'Assistive message following the removal of column(s)'
|
|
137
|
+
},
|
|
118
138
|
cellOptions: {
|
|
119
139
|
id: 'fabric.editor.cellOptions',
|
|
120
140
|
defaultMessage: 'Cell options',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
2
2
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
3
|
-
const packageVersion = "78.33.
|
|
3
|
+
const packageVersion = "78.33.4";
|
|
4
4
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
5
5
|
// Remove URL as it has UGC
|
|
6
6
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AllSelection, NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
3
3
|
import { selectedRect } from '@atlaskit/editor-tables/utils';
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analytics';
|
|
5
6
|
export { RelativeSelectionPos } from './types';
|
|
6
7
|
export { GapCursorSelection, Side, JSON_ID, GapBookmark } from './gap-cursor/selection';
|
|
@@ -102,13 +103,22 @@ export function createSelectionClickHandler(nodes, isValidTarget, options) {
|
|
|
102
103
|
return false;
|
|
103
104
|
}
|
|
104
105
|
if (direct && nodes.indexOf(node.type.name) !== -1) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (isValidTarget(target)) {
|
|
106
|
+
const target = event.target;
|
|
107
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
108
|
+
if (target instanceof HTMLElement && isValidTarget(target)) {
|
|
108
109
|
const selectionPos = options.getNodeSelectionPos ? options.getNodeSelectionPos(view.state, nodePos) : nodePos;
|
|
109
110
|
selectNode(selectionPos)(view.state, view.dispatch);
|
|
110
111
|
return true;
|
|
111
112
|
}
|
|
113
|
+
} else {
|
|
114
|
+
if (event.target) {
|
|
115
|
+
const target = event.target;
|
|
116
|
+
if (isValidTarget(target)) {
|
|
117
|
+
const selectionPos = options.getNodeSelectionPos ? options.getNodeSelectionPos(view.state, nodePos) : nodePos;
|
|
118
|
+
selectNode(selectionPos)(view.state, view.dispatch);
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
112
122
|
}
|
|
113
123
|
}
|
|
114
124
|
return false;
|
|
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
7
7
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
8
8
|
import Layer from '../Layer';
|
|
9
9
|
const packageName = "@atlaskit/editor-common";
|
|
10
|
-
const packageVersion = "78.33.
|
|
10
|
+
const packageVersion = "78.33.4";
|
|
11
11
|
const halfFocusRing = 1;
|
|
12
12
|
const dropOffset = '0, 8';
|
|
13
13
|
class DropList extends Component {
|
package/dist/es2019/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
const hasEnabledItems = list => list.some(item => item.getAttribute('aria-disabled') !== 'true');
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -62,7 +63,6 @@ export const MenuArrowKeyNavigationProvider = ({
|
|
|
62
63
|
* @param event
|
|
63
64
|
*/
|
|
64
65
|
const handleKeyDown = event => {
|
|
65
|
-
var _wrapperRef$current;
|
|
66
66
|
const targetElement = event.target;
|
|
67
67
|
|
|
68
68
|
// Tab key on menu items can be handled in the parent components of dropdown menus with KeydownHandlerContext
|
|
@@ -77,8 +77,16 @@ export const MenuArrowKeyNavigationProvider = ({
|
|
|
77
77
|
if (!focusableElements || (focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements.length) === 0) {
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
if (
|
|
81
|
-
|
|
80
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
81
|
+
var _wrapperRef$current;
|
|
82
|
+
if (targetElement instanceof HTMLElement && !((_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(targetElement))) {
|
|
83
|
+
setCurrentSelectedItemIndex(-1);
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
var _wrapperRef$current2;
|
|
87
|
+
if (!((_wrapperRef$current2 = wrapperRef.current) !== null && _wrapperRef$current2 !== void 0 && _wrapperRef$current2.contains(targetElement))) {
|
|
88
|
+
setCurrentSelectedItemIndex(-1);
|
|
89
|
+
}
|
|
82
90
|
}
|
|
83
91
|
switch (event.key) {
|
|
84
92
|
case 'ArrowDown':
|
|
@@ -106,22 +114,46 @@ export const MenuArrowKeyNavigationProvider = ({
|
|
|
106
114
|
// then logic to retain the focus can be handled in the parent components with KeydownHandlerContext
|
|
107
115
|
case 'ArrowLeft':
|
|
108
116
|
// Filter out the events from outside the menu
|
|
109
|
-
if (
|
|
110
|
-
|
|
117
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
118
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest('.custom-key-handler-wrapper')) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
if (!(targetElement !== null && targetElement !== void 0 && targetElement.closest('.custom-key-handler-wrapper'))) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
111
125
|
}
|
|
112
126
|
handleClose(event);
|
|
113
|
-
if (
|
|
114
|
-
|
|
127
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
128
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
129
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowLeft();
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
if (!(targetElement !== null && targetElement !== void 0 && targetElement.closest('[data-testid="editor-floating-toolbar"]'))) {
|
|
133
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowLeft();
|
|
134
|
+
}
|
|
115
135
|
}
|
|
116
136
|
break;
|
|
117
137
|
case 'ArrowRight':
|
|
118
138
|
// Filter out the events from outside the menu
|
|
119
|
-
if (
|
|
120
|
-
|
|
139
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
140
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest('.custom-key-handler-wrapper')) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
if (!targetElement.closest('.custom-key-handler-wrapper')) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
121
147
|
}
|
|
122
148
|
handleClose(event);
|
|
123
|
-
if (
|
|
124
|
-
|
|
149
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
150
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
151
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowRight();
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
if (!targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
155
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowRight();
|
|
156
|
+
}
|
|
125
157
|
}
|
|
126
158
|
break;
|
|
127
159
|
case 'Escape':
|
|
@@ -283,7 +283,11 @@ export function DropdownMenuItem({
|
|
|
283
283
|
}, item.content);
|
|
284
284
|
}
|
|
285
285
|
const _handleSubmenuActive = event => {
|
|
286
|
-
|
|
286
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
287
|
+
setSubmenuActive(Boolean(event.target instanceof HTMLElement && event.target.closest(`.${DropdownMenuSharedCssClassName.SUBMENU}`)));
|
|
288
|
+
} else {
|
|
289
|
+
setSubmenuActive(!!event.target.closest(`.${DropdownMenuSharedCssClassName.SUBMENU}`));
|
|
290
|
+
}
|
|
287
291
|
};
|
|
288
292
|
const dropListItem = jsx("div", {
|
|
289
293
|
css: () => buttonStyles(item.isActive, submenuActive),
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import React, { useCallback, useLayoutEffect, useRef } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { fullPageMessages as messages } from '../../messages';
|
|
7
8
|
import { EDIT_AREA_ID } from '../../ui';
|
|
8
9
|
/*
|
|
@@ -108,18 +109,31 @@ export const ToolbarArrowKeyNavigationProvider = ({
|
|
|
108
109
|
* @param event
|
|
109
110
|
*/
|
|
110
111
|
const handleKeyDown = event => {
|
|
111
|
-
var _document$querySelect, _document$querySelect2, _wrapperRef$current;
|
|
112
112
|
// To trap the focus inside the horizontal toolbar for left and right arrow keys
|
|
113
113
|
const targetElement = event.target;
|
|
114
114
|
|
|
115
115
|
// To filter out the events outside the child component
|
|
116
|
-
if (
|
|
117
|
-
|
|
116
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
117
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest(`${childComponentSelector}`)) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
if (!(targetElement !== null && targetElement !== void 0 && targetElement.closest(`${childComponentSelector}`))) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
118
124
|
}
|
|
119
125
|
|
|
120
126
|
// The key events are from child components such as dropdown menus / popups are ignored
|
|
121
|
-
if ((
|
|
122
|
-
|
|
127
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
128
|
+
var _document$querySelect, _document$querySelect2;
|
|
129
|
+
if (targetElement instanceof HTMLElement && (_document$querySelect = document.querySelector('[data-role="droplistContent"], [data-test-id="color-picker-menu"], [data-emoji-picker-container="true"]')) !== null && _document$querySelect !== void 0 && _document$querySelect.contains(targetElement) || targetElement instanceof HTMLElement && (_document$querySelect2 = document.querySelector('[data-test-id="color-picker-menu"]')) !== null && _document$querySelect2 !== void 0 && _document$querySelect2.contains(targetElement) || event.key === 'ArrowUp' || event.key === 'ArrowDown' || disableArrowKeyNavigation) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
var _document$querySelect3, _document$querySelect4;
|
|
134
|
+
if ((_document$querySelect3 = document.querySelector('[data-role="droplistContent"], [data-test-id="color-picker-menu"], [data-emoji-picker-container="true"]')) !== null && _document$querySelect3 !== void 0 && _document$querySelect3.contains(targetElement) || (_document$querySelect4 = document.querySelector('[data-test-id="color-picker-menu"]')) !== null && _document$querySelect4 !== void 0 && _document$querySelect4.contains(targetElement) || event.key === 'ArrowUp' || event.key === 'ArrowDown' || disableArrowKeyNavigation) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
123
137
|
}
|
|
124
138
|
const menuWrapper = document.querySelector('.menu-key-handler-wrapper');
|
|
125
139
|
if (menuWrapper) {
|
|
@@ -133,10 +147,20 @@ export const ToolbarArrowKeyNavigationProvider = ({
|
|
|
133
147
|
|
|
134
148
|
// This is kind of hack to reset the current focused toolbar item
|
|
135
149
|
// to handle some use cases such as Tab in/out of main toolbar
|
|
136
|
-
if (
|
|
137
|
-
|
|
150
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
151
|
+
var _wrapperRef$current;
|
|
152
|
+
if (targetElement instanceof HTMLElement && !((_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(targetElement))) {
|
|
153
|
+
selectedItemIndex.current = -1;
|
|
154
|
+
} else {
|
|
155
|
+
selectedItemIndex.current = targetElement instanceof HTMLElement && filteredFocusableElements.indexOf(targetElement) > -1 ? filteredFocusableElements.indexOf(targetElement) : selectedItemIndex.current;
|
|
156
|
+
}
|
|
138
157
|
} else {
|
|
139
|
-
|
|
158
|
+
var _wrapperRef$current2;
|
|
159
|
+
if (!((_wrapperRef$current2 = wrapperRef.current) !== null && _wrapperRef$current2 !== void 0 && _wrapperRef$current2.contains(targetElement))) {
|
|
160
|
+
selectedItemIndex.current = -1;
|
|
161
|
+
} else {
|
|
162
|
+
selectedItemIndex.current = filteredFocusableElements.indexOf(targetElement) > -1 ? filteredFocusableElements.indexOf(targetElement) : selectedItemIndex.current;
|
|
163
|
+
}
|
|
140
164
|
}
|
|
141
165
|
|
|
142
166
|
// do not scroll to focused element for sticky toolbar when navigating with arrows to avoid unnesessary scroll jump
|
|
@@ -4,6 +4,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { N0, N30, N40, N500 } from '@atlaskit/theme/colors';
|
|
6
6
|
var labelStyles = css({
|
|
7
|
+
zIndex: 1,
|
|
7
8
|
opacity: 0,
|
|
8
9
|
display: 'inline-flex',
|
|
9
10
|
width: 'max-content',
|
|
@@ -14,7 +15,7 @@ var labelStyles = css({
|
|
|
14
15
|
top: '-19px',
|
|
15
16
|
'&.inline': {
|
|
16
17
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
17
|
-
top: '-
|
|
18
|
+
top: '-18px',
|
|
18
19
|
marginLeft: "var(--ds-space-150, 12px)"
|
|
19
20
|
},
|
|
20
21
|
'&.show-label': {
|
|
@@ -115,6 +115,26 @@ export var messages = defineMessages({
|
|
|
115
115
|
defaultMessage: 'Row numbers',
|
|
116
116
|
desciption: 'Adds a number to each row except header row'
|
|
117
117
|
},
|
|
118
|
+
rowsAreInserted: {
|
|
119
|
+
id: 'fabric.editor.rowsAreInserted',
|
|
120
|
+
defaultMessage: '{count, plural, one {A row has been} other {{count} rows have been}} inserted',
|
|
121
|
+
description: 'Assistive message following the insertion of row(s)'
|
|
122
|
+
},
|
|
123
|
+
rowsAreRemoved: {
|
|
124
|
+
id: 'fabric.editor.rowsAreRemoved',
|
|
125
|
+
defaultMessage: '{count, plural, one {The row has been} other {{count} rows have been}} removed',
|
|
126
|
+
description: 'Assistive message following the removal of row(s)'
|
|
127
|
+
},
|
|
128
|
+
columnsAreInserted: {
|
|
129
|
+
id: 'fabric.editor.columnsAreInserted',
|
|
130
|
+
defaultMessage: '{count, plural, one {A column has been} other {{count} columns have been}} inserted',
|
|
131
|
+
description: 'Assistive message following the insertion of column(s)'
|
|
132
|
+
},
|
|
133
|
+
columnsAreRemoved: {
|
|
134
|
+
id: 'fabric.editor.columnsAreRemoved',
|
|
135
|
+
defaultMessage: '{count, plural, one {The column has been} other {{count} columns have been}} removed',
|
|
136
|
+
description: 'Assistive message following the removal of column(s)'
|
|
137
|
+
},
|
|
118
138
|
cellOptions: {
|
|
119
139
|
id: 'fabric.editor.cellOptions',
|
|
120
140
|
defaultMessage: 'Cell options',
|
|
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
8
8
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
9
|
-
var packageVersion = "78.33.
|
|
9
|
+
var packageVersion = "78.33.4";
|
|
10
10
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
11
11
|
// Remove URL as it has UGC
|
|
12
12
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AllSelection, NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
3
3
|
import { selectedRect } from '@atlaskit/editor-tables/utils';
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analytics';
|
|
5
6
|
export { RelativeSelectionPos } from './types';
|
|
6
7
|
export { GapCursorSelection, Side, JSON_ID, GapBookmark } from './gap-cursor/selection';
|
|
@@ -102,13 +103,22 @@ export function createSelectionClickHandler(nodes, isValidTarget, options) {
|
|
|
102
103
|
return false;
|
|
103
104
|
}
|
|
104
105
|
if (direct && nodes.indexOf(node.type.name) !== -1) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (isValidTarget(_target)) {
|
|
106
|
+
var _target = event.target;
|
|
107
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
108
|
+
if (_target instanceof HTMLElement && isValidTarget(_target)) {
|
|
108
109
|
var selectionPos = options.getNodeSelectionPos ? options.getNodeSelectionPos(view.state, nodePos) : nodePos;
|
|
109
110
|
selectNode(selectionPos)(view.state, view.dispatch);
|
|
110
111
|
return true;
|
|
111
112
|
}
|
|
113
|
+
} else {
|
|
114
|
+
if (event.target) {
|
|
115
|
+
var _target2 = event.target;
|
|
116
|
+
if (isValidTarget(_target2)) {
|
|
117
|
+
var _selectionPos = options.getNodeSelectionPos ? options.getNodeSelectionPos(view.state, nodePos) : nodePos;
|
|
118
|
+
selectNode(_selectionPos)(view.state, view.dispatch);
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
112
122
|
}
|
|
113
123
|
}
|
|
114
124
|
return false;
|
|
@@ -15,7 +15,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
15
15
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
16
16
|
import Layer from '../Layer';
|
|
17
17
|
var packageName = "@atlaskit/editor-common";
|
|
18
|
-
var packageVersion = "78.33.
|
|
18
|
+
var packageVersion = "78.33.4";
|
|
19
19
|
var halfFocusRing = 1;
|
|
20
20
|
var dropOffset = '0, 8';
|
|
21
21
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
var hasEnabledItems = function hasEnabledItems(list) {
|
|
4
5
|
return list.some(function (item) {
|
|
5
6
|
return item.getAttribute('aria-disabled') !== 'true';
|
|
@@ -71,7 +72,6 @@ export var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvi
|
|
|
71
72
|
* @param event
|
|
72
73
|
*/
|
|
73
74
|
var handleKeyDown = function handleKeyDown(event) {
|
|
74
|
-
var _wrapperRef$current;
|
|
75
75
|
var targetElement = event.target;
|
|
76
76
|
|
|
77
77
|
// Tab key on menu items can be handled in the parent components of dropdown menus with KeydownHandlerContext
|
|
@@ -86,8 +86,16 @@ export var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvi
|
|
|
86
86
|
if (!focusableElements || (focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements.length) === 0) {
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
|
-
if (
|
|
90
|
-
|
|
89
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
90
|
+
var _wrapperRef$current;
|
|
91
|
+
if (targetElement instanceof HTMLElement && !((_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(targetElement))) {
|
|
92
|
+
setCurrentSelectedItemIndex(-1);
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
var _wrapperRef$current2;
|
|
96
|
+
if (!((_wrapperRef$current2 = wrapperRef.current) !== null && _wrapperRef$current2 !== void 0 && _wrapperRef$current2.contains(targetElement))) {
|
|
97
|
+
setCurrentSelectedItemIndex(-1);
|
|
98
|
+
}
|
|
91
99
|
}
|
|
92
100
|
switch (event.key) {
|
|
93
101
|
case 'ArrowDown':
|
|
@@ -115,22 +123,46 @@ export var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvi
|
|
|
115
123
|
// then logic to retain the focus can be handled in the parent components with KeydownHandlerContext
|
|
116
124
|
case 'ArrowLeft':
|
|
117
125
|
// Filter out the events from outside the menu
|
|
118
|
-
if (
|
|
119
|
-
|
|
126
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
127
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest('.custom-key-handler-wrapper')) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
131
|
+
if (!(targetElement !== null && targetElement !== void 0 && targetElement.closest('.custom-key-handler-wrapper'))) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
120
134
|
}
|
|
121
135
|
handleClose(event);
|
|
122
|
-
if (
|
|
123
|
-
|
|
136
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
137
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
138
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 || keyDownHandlerContext.handleArrowLeft();
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
if (!(targetElement !== null && targetElement !== void 0 && targetElement.closest('[data-testid="editor-floating-toolbar"]'))) {
|
|
142
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 || keyDownHandlerContext.handleArrowLeft();
|
|
143
|
+
}
|
|
124
144
|
}
|
|
125
145
|
break;
|
|
126
146
|
case 'ArrowRight':
|
|
127
147
|
// Filter out the events from outside the menu
|
|
128
|
-
if (
|
|
129
|
-
|
|
148
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
149
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest('.custom-key-handler-wrapper')) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
if (!targetElement.closest('.custom-key-handler-wrapper')) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
130
156
|
}
|
|
131
157
|
handleClose(event);
|
|
132
|
-
if (
|
|
133
|
-
|
|
158
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
159
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
160
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 || keyDownHandlerContext.handleArrowRight();
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
if (!targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
164
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 || keyDownHandlerContext.handleArrowRight();
|
|
165
|
+
}
|
|
134
166
|
}
|
|
135
167
|
break;
|
|
136
168
|
case 'Escape':
|
|
@@ -282,7 +282,11 @@ export function DropdownMenuItem(_ref) {
|
|
|
282
282
|
}, item.content);
|
|
283
283
|
}
|
|
284
284
|
var _handleSubmenuActive = function _handleSubmenuActive(event) {
|
|
285
|
-
|
|
285
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
286
|
+
setSubmenuActive(Boolean(event.target instanceof HTMLElement && event.target.closest(".".concat(DropdownMenuSharedCssClassName.SUBMENU))));
|
|
287
|
+
} else {
|
|
288
|
+
setSubmenuActive(!!event.target.closest(".".concat(DropdownMenuSharedCssClassName.SUBMENU)));
|
|
289
|
+
}
|
|
286
290
|
};
|
|
287
291
|
var dropListItem = jsx("div", {
|
|
288
292
|
css: function css() {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import React, { useCallback, useLayoutEffect, useRef } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { fullPageMessages as messages } from '../../messages';
|
|
7
8
|
import { EDIT_AREA_ID } from '../../ui';
|
|
8
9
|
/*
|
|
@@ -106,18 +107,31 @@ export var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigatio
|
|
|
106
107
|
* @param event
|
|
107
108
|
*/
|
|
108
109
|
var handleKeyDown = function handleKeyDown(event) {
|
|
109
|
-
var _document$querySelect, _document$querySelect2, _wrapperRef$current;
|
|
110
110
|
// To trap the focus inside the horizontal toolbar for left and right arrow keys
|
|
111
111
|
var targetElement = event.target;
|
|
112
112
|
|
|
113
113
|
// To filter out the events outside the child component
|
|
114
|
-
if (
|
|
115
|
-
|
|
114
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
115
|
+
if (targetElement instanceof HTMLElement && !targetElement.closest("".concat(childComponentSelector))) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
if (!(targetElement !== null && targetElement !== void 0 && targetElement.closest("".concat(childComponentSelector)))) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
116
122
|
}
|
|
117
123
|
|
|
118
124
|
// The key events are from child components such as dropdown menus / popups are ignored
|
|
119
|
-
if ((
|
|
120
|
-
|
|
125
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
126
|
+
var _document$querySelect, _document$querySelect2;
|
|
127
|
+
if (targetElement instanceof HTMLElement && (_document$querySelect = document.querySelector('[data-role="droplistContent"], [data-test-id="color-picker-menu"], [data-emoji-picker-container="true"]')) !== null && _document$querySelect !== void 0 && _document$querySelect.contains(targetElement) || targetElement instanceof HTMLElement && (_document$querySelect2 = document.querySelector('[data-test-id="color-picker-menu"]')) !== null && _document$querySelect2 !== void 0 && _document$querySelect2.contains(targetElement) || event.key === 'ArrowUp' || event.key === 'ArrowDown' || disableArrowKeyNavigation) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
131
|
+
var _document$querySelect3, _document$querySelect4;
|
|
132
|
+
if ((_document$querySelect3 = document.querySelector('[data-role="droplistContent"], [data-test-id="color-picker-menu"], [data-emoji-picker-container="true"]')) !== null && _document$querySelect3 !== void 0 && _document$querySelect3.contains(targetElement) || (_document$querySelect4 = document.querySelector('[data-test-id="color-picker-menu"]')) !== null && _document$querySelect4 !== void 0 && _document$querySelect4.contains(targetElement) || event.key === 'ArrowUp' || event.key === 'ArrowDown' || disableArrowKeyNavigation) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
121
135
|
}
|
|
122
136
|
var menuWrapper = document.querySelector('.menu-key-handler-wrapper');
|
|
123
137
|
if (menuWrapper) {
|
|
@@ -131,10 +145,20 @@ export var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigatio
|
|
|
131
145
|
|
|
132
146
|
// This is kind of hack to reset the current focused toolbar item
|
|
133
147
|
// to handle some use cases such as Tab in/out of main toolbar
|
|
134
|
-
if (
|
|
135
|
-
|
|
148
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
149
|
+
var _wrapperRef$current;
|
|
150
|
+
if (targetElement instanceof HTMLElement && !((_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(targetElement))) {
|
|
151
|
+
selectedItemIndex.current = -1;
|
|
152
|
+
} else {
|
|
153
|
+
selectedItemIndex.current = targetElement instanceof HTMLElement && filteredFocusableElements.indexOf(targetElement) > -1 ? filteredFocusableElements.indexOf(targetElement) : selectedItemIndex.current;
|
|
154
|
+
}
|
|
136
155
|
} else {
|
|
137
|
-
|
|
156
|
+
var _wrapperRef$current2;
|
|
157
|
+
if (!((_wrapperRef$current2 = wrapperRef.current) !== null && _wrapperRef$current2 !== void 0 && _wrapperRef$current2.contains(targetElement))) {
|
|
158
|
+
selectedItemIndex.current = -1;
|
|
159
|
+
} else {
|
|
160
|
+
selectedItemIndex.current = filteredFocusableElements.indexOf(targetElement) > -1 ? filteredFocusableElements.indexOf(targetElement) : selectedItemIndex.current;
|
|
161
|
+
}
|
|
138
162
|
}
|
|
139
163
|
|
|
140
164
|
// do not scroll to focused element for sticky toolbar when navigating with arrows to avoid unnesessary scroll jump
|
|
@@ -114,6 +114,26 @@ export declare const messages: {
|
|
|
114
114
|
defaultMessage: string;
|
|
115
115
|
desciption: string;
|
|
116
116
|
};
|
|
117
|
+
rowsAreInserted: {
|
|
118
|
+
id: string;
|
|
119
|
+
defaultMessage: string;
|
|
120
|
+
description: string;
|
|
121
|
+
};
|
|
122
|
+
rowsAreRemoved: {
|
|
123
|
+
id: string;
|
|
124
|
+
defaultMessage: string;
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
127
|
+
columnsAreInserted: {
|
|
128
|
+
id: string;
|
|
129
|
+
defaultMessage: string;
|
|
130
|
+
description: string;
|
|
131
|
+
};
|
|
132
|
+
columnsAreRemoved: {
|
|
133
|
+
id: string;
|
|
134
|
+
defaultMessage: string;
|
|
135
|
+
description: string;
|
|
136
|
+
};
|
|
117
137
|
cellOptions: {
|
|
118
138
|
id: string;
|
|
119
139
|
defaultMessage: string;
|
|
@@ -114,6 +114,26 @@ export declare const messages: {
|
|
|
114
114
|
defaultMessage: string;
|
|
115
115
|
desciption: string;
|
|
116
116
|
};
|
|
117
|
+
rowsAreInserted: {
|
|
118
|
+
id: string;
|
|
119
|
+
defaultMessage: string;
|
|
120
|
+
description: string;
|
|
121
|
+
};
|
|
122
|
+
rowsAreRemoved: {
|
|
123
|
+
id: string;
|
|
124
|
+
defaultMessage: string;
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
127
|
+
columnsAreInserted: {
|
|
128
|
+
id: string;
|
|
129
|
+
defaultMessage: string;
|
|
130
|
+
description: string;
|
|
131
|
+
};
|
|
132
|
+
columnsAreRemoved: {
|
|
133
|
+
id: string;
|
|
134
|
+
defaultMessage: string;
|
|
135
|
+
description: string;
|
|
136
|
+
};
|
|
117
137
|
cellOptions: {
|
|
118
138
|
id: string;
|
|
119
139
|
defaultMessage: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "78.33.
|
|
3
|
+
"version": "78.33.4",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"@atlaskit/icon-object": "^6.3.0",
|
|
116
116
|
"@atlaskit/in-product-testing": "^0.2.0",
|
|
117
117
|
"@atlaskit/link-datasource": "^1.29.0",
|
|
118
|
-
"@atlaskit/link-picker": "^1.
|
|
118
|
+
"@atlaskit/link-picker": "^1.36.0",
|
|
119
119
|
"@atlaskit/media-card": "^77.11.0",
|
|
120
120
|
"@atlaskit/media-client": "^26.3.0",
|
|
121
121
|
"@atlaskit/media-client-react": "^2.0.0",
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
"@atlaskit/primitives": "^5.6.0",
|
|
131
131
|
"@atlaskit/profilecard": "^19.11.0",
|
|
132
132
|
"@atlaskit/section-message": "^6.4.0",
|
|
133
|
-
"@atlaskit/smart-card": "^26.
|
|
133
|
+
"@atlaskit/smart-card": "^26.58.0",
|
|
134
134
|
"@atlaskit/smart-user-picker": "^6.9.0",
|
|
135
135
|
"@atlaskit/spinner": "^16.0.0",
|
|
136
136
|
"@atlaskit/task-decision": "^17.9.0",
|
|
@@ -249,6 +249,9 @@
|
|
|
249
249
|
},
|
|
250
250
|
"platform.editor.mbe-update-params-change": {
|
|
251
251
|
"type": "boolean"
|
|
252
|
+
},
|
|
253
|
+
"platform.editor.explicit-html-element-check": {
|
|
254
|
+
"type": "boolean"
|
|
252
255
|
}
|
|
253
256
|
}
|
|
254
257
|
}
|