@atlaskit/editor-core 187.8.3 → 187.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +4 -5
- package/dist/cjs/plugins/annotation/commands/transform.js +2 -2
- package/dist/cjs/plugins/block-type/commands/block-type.js +2 -2
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +2 -2
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +2 -2
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +2 -2
- package/dist/cjs/plugins/text-color/commands/toggle-color.js +2 -2
- package/dist/cjs/plugins/text-formatting/commands/text-formatting.js +9 -9
- package/dist/cjs/plugins/text-formatting/commands/transform-to-code.js +2 -2
- package/dist/cjs/plugins/text-formatting/pm-plugins/clear-formatting.js +2 -5
- package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +2 -2
- package/dist/cjs/plugins/text-formatting/pm-plugins/main.js +2 -1
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +2 -2
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +2 -3
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -2
- package/dist/cjs/ui/Appearance/Comment/Comment.js +5 -6
- package/dist/cjs/ui/Appearance/Comment/Toolbar.js +2 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +5 -5
- package/dist/cjs/ui/Dropdown/index.js +1 -2
- package/dist/cjs/ui/styles.js +3 -5
- package/dist/cjs/utils/commands.js +8 -121
- package/dist/cjs/utils/index.js +0 -13
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +3 -6
- package/dist/es2019/plugins/annotation/commands/transform.js +1 -1
- package/dist/es2019/plugins/block-type/commands/block-type.js +1 -1
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +3 -5
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -1
- package/dist/es2019/plugins/text-color/commands/toggle-color.js +1 -1
- package/dist/es2019/plugins/text-formatting/commands/text-formatting.js +1 -1
- package/dist/es2019/plugins/text-formatting/commands/transform-to-code.js +1 -1
- package/dist/es2019/plugins/text-formatting/pm-plugins/clear-formatting.js +2 -2
- package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +1 -1
- package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +2 -1
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +1 -1
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +1 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +1 -1
- package/dist/es2019/ui/Appearance/Comment/Comment.js +6 -5
- package/dist/es2019/ui/Appearance/Comment/Toolbar.js +3 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +2 -3
- package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +2 -2
- package/dist/es2019/ui/Dropdown/index.js +1 -2
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +1 -0
- package/dist/es2019/ui/styles.js +0 -5
- package/dist/es2019/utils/commands.js +1 -113
- package/dist/es2019/utils/index.js +0 -12
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +3 -6
- package/dist/esm/plugins/annotation/commands/transform.js +1 -1
- package/dist/esm/plugins/block-type/commands/block-type.js +1 -1
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +3 -5
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +1 -1
- package/dist/esm/plugins/text-color/commands/toggle-color.js +1 -1
- package/dist/esm/plugins/text-formatting/commands/text-formatting.js +1 -1
- package/dist/esm/plugins/text-formatting/commands/transform-to-code.js +1 -1
- package/dist/esm/plugins/text-formatting/pm-plugins/clear-formatting.js +2 -2
- package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +1 -1
- package/dist/esm/plugins/text-formatting/pm-plugins/main.js +2 -1
- package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +1 -1
- package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +1 -2
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +1 -1
- package/dist/esm/ui/Appearance/Comment/Comment.js +4 -5
- package/dist/esm/ui/Appearance/Comment/Toolbar.js +3 -2
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +2 -3
- package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +2 -2
- package/dist/esm/ui/Dropdown/index.js +1 -2
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +1 -0
- package/dist/esm/ui/styles.js +2 -3
- package/dist/esm/utils/commands.js +7 -118
- package/dist/esm/utils/index.js +0 -12
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +0 -1
- package/dist/types/plugins/block-type/commands/block-type.d.ts +1 -2
- package/dist/types/plugins/code-block/ide-ux/quote-handling.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/item.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -1
- package/dist/types/plugins/text-color/commands/toggle-color.d.ts +1 -1
- package/dist/types/plugins/text-formatting/pm-plugins/clear-formatting.d.ts +2 -2
- package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +1 -1
- package/dist/types/types/editor-appearance-component.d.ts +4 -4
- package/dist/types/types/editor-instance.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +5 -8
- package/dist/types/ui/Appearance/Comment/Comment.d.ts +2 -2
- package/dist/types/ui/Appearance/Comment/Toolbar.d.ts +1 -2
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ColorPickerButton/index.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/types.d.ts +1 -1
- package/dist/types/ui/styles.d.ts +0 -1
- package/dist/types/utils/commands.d.ts +2 -12
- package/dist/types/utils/index.d.ts +0 -4
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +0 -1
- package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +1 -2
- package/dist/types-ts4.5/plugins/code-block/ide-ux/quote-handling.d.ts +1 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +1 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/item.d.ts +1 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.d.ts +1 -1
- package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/text-color/commands/toggle-color.d.ts +1 -1
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/clear-formatting.d.ts +2 -2
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +1 -1
- package/dist/types-ts4.5/types/editor-appearance-component.d.ts +4 -4
- package/dist/types-ts4.5/types/editor-instance.d.ts +1 -1
- package/dist/types-ts4.5/types/editor-props.d.ts +5 -8
- package/dist/types-ts4.5/ui/Appearance/Comment/Comment.d.ts +2 -2
- package/dist/types-ts4.5/ui/Appearance/Comment/Toolbar.d.ts +1 -2
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types-ts4.5/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +1 -1
- package/dist/types-ts4.5/ui/ElementBrowser/types.d.ts +1 -1
- package/dist/types-ts4.5/ui/styles.d.ts +0 -1
- package/dist/types-ts4.5/utils/commands.d.ts +2 -12
- package/dist/types-ts4.5/utils/index.d.ts +0 -4
- package/package.json +3 -3
- package/report.api.md +2 -10
- package/tmp/api-report-tmp.d.ts +2 -7
- package/dist/cjs/ui/Appearance/FullPage/messages.js +0 -25
- package/dist/cjs/ui/DropdownMenu/index.js +0 -31
- package/dist/cjs/ui/DropdownMenu/types.js +0 -5
- package/dist/cjs/ui/ToolbarArrowKeyNavigationProvider/index.js +0 -218
- package/dist/es2019/ui/Appearance/FullPage/messages.js +0 -18
- package/dist/es2019/ui/DropdownMenu/index.js +0 -18
- package/dist/es2019/ui/DropdownMenu/types.js +0 -1
- package/dist/es2019/ui/ToolbarArrowKeyNavigationProvider/index.js +0 -205
- package/dist/esm/ui/Appearance/FullPage/messages.js +0 -18
- package/dist/esm/ui/DropdownMenu/index.js +0 -20
- package/dist/esm/ui/DropdownMenu/types.js +0 -1
- package/dist/esm/ui/ToolbarArrowKeyNavigationProvider/index.js +0 -205
- package/dist/types/ui/Appearance/FullPage/messages.d.ts +0 -18
- package/dist/types/ui/DropdownMenu/index.d.ts +0 -3
- package/dist/types/ui/DropdownMenu/types.d.ts +0 -1
- package/dist/types/ui/ToolbarArrowKeyNavigationProvider/index.d.ts +0 -31
- package/dist/types-ts4.5/ui/Appearance/FullPage/messages.d.ts +0 -18
- package/dist/types-ts4.5/ui/DropdownMenu/index.d.ts +0 -3
- package/dist/types-ts4.5/ui/DropdownMenu/types.d.ts +0 -1
- package/dist/types-ts4.5/ui/ToolbarArrowKeyNavigationProvider/index.d.ts +0 -31
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
/* eslint-disable no-console */
|
|
3
|
-
import { jsx } from '@emotion/react';
|
|
4
|
-
import { centeredToolbarContainer } from '../styles';
|
|
5
|
-
import React, { useCallback, useLayoutEffect, useRef } from 'react';
|
|
6
|
-
import { EDIT_AREA_ID } from '../../create-editor/ReactEditorViewInternal';
|
|
7
|
-
import messages from '../Appearance/FullPage/messages';
|
|
8
|
-
/*
|
|
9
|
-
** The context is used to handle the keydown events of submenus.
|
|
10
|
-
** Because the keyboard navigation is explicitly managed for main toolbar items
|
|
11
|
-
** Few key presses such as Tab,Arrow Right/Left need ot be handled here via context
|
|
12
|
-
*/
|
|
13
|
-
export var KeyDownHandlerContext = /*#__PURE__*/React.createContext({
|
|
14
|
-
handleArrowLeft: function handleArrowLeft() {},
|
|
15
|
-
handleArrowRight: function handleArrowRight() {},
|
|
16
|
-
handleTab: function handleTab() {}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* This component is a wrapper of main toolbar which listens to keydown events of children
|
|
21
|
-
* and handles left/right arrow key navigation for all focusable elements
|
|
22
|
-
* @param
|
|
23
|
-
* @returns
|
|
24
|
-
*/
|
|
25
|
-
export var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigationProvider(_ref) {
|
|
26
|
-
var children = _ref.children,
|
|
27
|
-
editorView = _ref.editorView,
|
|
28
|
-
childComponentSelector = _ref.childComponentSelector,
|
|
29
|
-
handleEscape = _ref.handleEscape,
|
|
30
|
-
disableArrowKeyNavigation = _ref.disableArrowKeyNavigation,
|
|
31
|
-
isShortcutToFocusToolbar = _ref.isShortcutToFocusToolbar,
|
|
32
|
-
editorAppearance = _ref.editorAppearance,
|
|
33
|
-
useStickyToolbar = _ref.useStickyToolbar,
|
|
34
|
-
intl = _ref.intl;
|
|
35
|
-
var wrapperRef = useRef(null);
|
|
36
|
-
var selectedItemIndex = useRef(0);
|
|
37
|
-
var incrementIndex = useCallback(function (list) {
|
|
38
|
-
var index = 0;
|
|
39
|
-
if (document.activeElement) {
|
|
40
|
-
index = list.indexOf(document.activeElement);
|
|
41
|
-
index = (index + 1) % list.length;
|
|
42
|
-
}
|
|
43
|
-
selectedItemIndex.current = index;
|
|
44
|
-
}, []);
|
|
45
|
-
var decrementIndex = useCallback(function (list) {
|
|
46
|
-
var index = 0;
|
|
47
|
-
if (document.activeElement) {
|
|
48
|
-
index = list.indexOf(document.activeElement);
|
|
49
|
-
index = (list.length + index - 1) % list.length;
|
|
50
|
-
}
|
|
51
|
-
selectedItemIndex.current = index;
|
|
52
|
-
}, []);
|
|
53
|
-
var handleArrowRight = function handleArrowRight() {
|
|
54
|
-
var _filteredFocusableEle;
|
|
55
|
-
var filteredFocusableElements = getFilteredFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
|
|
56
|
-
incrementIndex(filteredFocusableElements);
|
|
57
|
-
(_filteredFocusableEle = filteredFocusableElements[selectedItemIndex.current]) === null || _filteredFocusableEle === void 0 ? void 0 : _filteredFocusableEle.focus();
|
|
58
|
-
};
|
|
59
|
-
var handleArrowLeft = function handleArrowLeft() {
|
|
60
|
-
var _filteredFocusableEle2;
|
|
61
|
-
var filteredFocusableElements = getFilteredFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
|
|
62
|
-
decrementIndex(filteredFocusableElements);
|
|
63
|
-
(_filteredFocusableEle2 = filteredFocusableElements[selectedItemIndex.current]) === null || _filteredFocusableEle2 === void 0 ? void 0 : _filteredFocusableEle2.focus();
|
|
64
|
-
};
|
|
65
|
-
var handleTab = function handleTab() {
|
|
66
|
-
var _filteredFocusableEle3;
|
|
67
|
-
var filteredFocusableElements = getFilteredFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
|
|
68
|
-
(_filteredFocusableEle3 = filteredFocusableElements[selectedItemIndex.current]) === null || _filteredFocusableEle3 === void 0 ? void 0 : _filteredFocusableEle3.focus();
|
|
69
|
-
};
|
|
70
|
-
var handleTabLocal = function handleTabLocal() {
|
|
71
|
-
var filteredFocusableElements = getFilteredFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
|
|
72
|
-
filteredFocusableElements.forEach(function (element) {
|
|
73
|
-
element.setAttribute('tabindex', '-1');
|
|
74
|
-
});
|
|
75
|
-
filteredFocusableElements[selectedItemIndex.current].setAttribute('tabindex', '0');
|
|
76
|
-
};
|
|
77
|
-
var focusAndScrollToElement = function focusAndScrollToElement(element) {
|
|
78
|
-
var scrollToElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
79
|
-
if (scrollToElement) {
|
|
80
|
-
element === null || element === void 0 ? void 0 : element.scrollIntoView({
|
|
81
|
-
behavior: 'smooth',
|
|
82
|
-
block: 'center',
|
|
83
|
-
inline: 'nearest'
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
element.focus();
|
|
87
|
-
};
|
|
88
|
-
var submenuKeydownHandleContext = {
|
|
89
|
-
handleArrowLeft: handleArrowLeft,
|
|
90
|
-
handleArrowRight: handleArrowRight,
|
|
91
|
-
handleTab: handleTab
|
|
92
|
-
};
|
|
93
|
-
useLayoutEffect(function () {
|
|
94
|
-
if (!wrapperRef.current || disableArrowKeyNavigation) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
var element = wrapperRef.current;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* To handle the key events on the list
|
|
101
|
-
* @param event
|
|
102
|
-
*/
|
|
103
|
-
var handleKeyDown = function handleKeyDown(event) {
|
|
104
|
-
var _document$querySelect, _document$querySelect2, _wrapperRef$current;
|
|
105
|
-
//To trap the focus inside the horizontal toolbar for left and right arrow keys
|
|
106
|
-
var targetElement = event.target;
|
|
107
|
-
|
|
108
|
-
//To filter out the events outside the child component
|
|
109
|
-
if (!targetElement.closest("".concat(childComponentSelector))) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
//The key events are from child components such as dropdown menus / popups are ignored
|
|
114
|
-
if ((_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) || (_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) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
var menuWrapper = document.querySelector('.menu-key-handler-wrapper');
|
|
118
|
-
if (menuWrapper) {
|
|
119
|
-
// if menu wrapper exists, then a menu is open and arrow keys will be handled by MenuArrowKeyNavigationProvider
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
var filteredFocusableElements = getFilteredFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
|
|
123
|
-
if (!filteredFocusableElements || (filteredFocusableElements === null || filteredFocusableElements === void 0 ? void 0 : filteredFocusableElements.length) === 0) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
//This is kind of hack to reset the current focused toolbar item
|
|
128
|
-
//to handle some use cases such as Tab in/out of main toolbar
|
|
129
|
-
if (!((_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(targetElement))) {
|
|
130
|
-
selectedItemIndex.current = -1;
|
|
131
|
-
} else {
|
|
132
|
-
selectedItemIndex.current = filteredFocusableElements.indexOf(targetElement) > -1 ? filteredFocusableElements.indexOf(targetElement) : selectedItemIndex.current;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
//do not scroll to focused element for sticky toolbar when navigating with arrows to avoid unnesessary scroll jump
|
|
136
|
-
var allowScrollToElement = !(editorAppearance === 'comment' && !!useStickyToolbar);
|
|
137
|
-
switch (event.key) {
|
|
138
|
-
case 'ArrowRight':
|
|
139
|
-
incrementIndex(filteredFocusableElements);
|
|
140
|
-
focusAndScrollToElement(filteredFocusableElements[selectedItemIndex.current], allowScrollToElement);
|
|
141
|
-
event.preventDefault();
|
|
142
|
-
break;
|
|
143
|
-
case 'ArrowLeft':
|
|
144
|
-
decrementIndex(filteredFocusableElements);
|
|
145
|
-
focusAndScrollToElement(filteredFocusableElements[selectedItemIndex.current], allowScrollToElement);
|
|
146
|
-
event.preventDefault();
|
|
147
|
-
break;
|
|
148
|
-
case 'Tab':
|
|
149
|
-
handleTabLocal();
|
|
150
|
-
break;
|
|
151
|
-
case 'Escape':
|
|
152
|
-
handleEscape(event);
|
|
153
|
-
break;
|
|
154
|
-
default:
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
var globalKeyDownHandler = function globalKeyDownHandler(event) {
|
|
158
|
-
//To focus the first element in the toolbar
|
|
159
|
-
if (isShortcutToFocusToolbar(event)) {
|
|
160
|
-
var _filteredFocusableEle4, _filteredFocusableEle5;
|
|
161
|
-
var filteredFocusableElements = getFilteredFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
|
|
162
|
-
(_filteredFocusableEle4 = filteredFocusableElements[0]) === null || _filteredFocusableEle4 === void 0 ? void 0 : _filteredFocusableEle4.focus();
|
|
163
|
-
(_filteredFocusableEle5 = filteredFocusableElements[0]) === null || _filteredFocusableEle5 === void 0 ? void 0 : _filteredFocusableEle5.scrollIntoView({
|
|
164
|
-
behavior: 'smooth',
|
|
165
|
-
block: 'center',
|
|
166
|
-
inline: 'nearest'
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
element === null || element === void 0 ? void 0 : element.addEventListener('keydown', handleKeyDown);
|
|
171
|
-
var editorViewDom = editorView === null || editorView === void 0 ? void 0 : editorView.dom;
|
|
172
|
-
if (isShortcutToFocusToolbar) {
|
|
173
|
-
editorViewDom === null || editorViewDom === void 0 ? void 0 : editorViewDom.addEventListener('keydown', globalKeyDownHandler);
|
|
174
|
-
}
|
|
175
|
-
return function () {
|
|
176
|
-
element === null || element === void 0 ? void 0 : element.removeEventListener('keydown', handleKeyDown);
|
|
177
|
-
if (isShortcutToFocusToolbar) {
|
|
178
|
-
editorViewDom === null || editorViewDom === void 0 ? void 0 : editorViewDom.removeEventListener('keydown', globalKeyDownHandler);
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
}, [selectedItemIndex, wrapperRef, editorView, disableArrowKeyNavigation, handleEscape, childComponentSelector, incrementIndex, decrementIndex, isShortcutToFocusToolbar, editorAppearance, useStickyToolbar]);
|
|
182
|
-
return jsx("div", {
|
|
183
|
-
css: editorAppearance === 'comment' && centeredToolbarContainer,
|
|
184
|
-
className: "custom-key-handler-wrapper",
|
|
185
|
-
ref: wrapperRef,
|
|
186
|
-
role: "toolbar",
|
|
187
|
-
"aria-label": intl.formatMessage(messages.toolbarLabel),
|
|
188
|
-
"aria-controls": EDIT_AREA_ID
|
|
189
|
-
}, jsx(KeyDownHandlerContext.Provider, {
|
|
190
|
-
value: submenuKeydownHandleContext
|
|
191
|
-
}, children));
|
|
192
|
-
};
|
|
193
|
-
function getFocusableElements(rootNode) {
|
|
194
|
-
if (!rootNode) {
|
|
195
|
-
return [];
|
|
196
|
-
}
|
|
197
|
-
var focusableModalElements = rootNode.querySelectorAll('a[href], button:not([disabled]), textarea, input, select, div[tabindex="-1"], div[tabindex="0"]') || [];
|
|
198
|
-
return Array.from(focusableModalElements);
|
|
199
|
-
}
|
|
200
|
-
function getFilteredFocusableElements(rootNode) {
|
|
201
|
-
//The focusable elements from child components such as dropdown menus / popups are ignored
|
|
202
|
-
return getFocusableElements(rootNode).filter(function (elm) {
|
|
203
|
-
return !elm.closest('[data-role="droplistContent"]') && !elm.closest('[data-emoji-picker-container="true"]') && !elm.closest('[data-test-id="color-picker-menu"]') && !elm.closest('.scroll-buttons');
|
|
204
|
-
});
|
|
205
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
toolbarLabel: {
|
|
3
|
-
id: string;
|
|
4
|
-
defaultMessage: string;
|
|
5
|
-
description: string;
|
|
6
|
-
};
|
|
7
|
-
pageActionsLabel: {
|
|
8
|
-
id: string;
|
|
9
|
-
defaultMessage: string;
|
|
10
|
-
description: string;
|
|
11
|
-
};
|
|
12
|
-
editableContentLabel: {
|
|
13
|
-
id: string;
|
|
14
|
-
defaultMessage: string;
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
|
-
import type { EditorAppearance } from '../../types';
|
|
4
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { ReactNode } from 'react';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import type { UseStickyToolbarType } from '../../types/editor-props';
|
|
8
|
-
import type { IntlShape } from 'react-intl-next/src/types';
|
|
9
|
-
export interface KeyDownHandlerContext {
|
|
10
|
-
handleArrowLeft: () => void;
|
|
11
|
-
handleArrowRight: () => void;
|
|
12
|
-
handleTab: () => void;
|
|
13
|
-
}
|
|
14
|
-
export declare const KeyDownHandlerContext: React.Context<KeyDownHandlerContext>;
|
|
15
|
-
/**
|
|
16
|
-
* This component is a wrapper of main toolbar which listens to keydown events of children
|
|
17
|
-
* and handles left/right arrow key navigation for all focusable elements
|
|
18
|
-
* @param
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
export declare const ToolbarArrowKeyNavigationProvider: ({ children, editorView, childComponentSelector, handleEscape, disableArrowKeyNavigation, isShortcutToFocusToolbar, editorAppearance, useStickyToolbar, intl, }: {
|
|
22
|
-
children: ReactNode;
|
|
23
|
-
editorView?: EditorView | undefined;
|
|
24
|
-
childComponentSelector: string;
|
|
25
|
-
handleEscape?: ((event: KeyboardEvent) => void) | undefined;
|
|
26
|
-
disableArrowKeyNavigation?: boolean | undefined;
|
|
27
|
-
isShortcutToFocusToolbar?: ((event: KeyboardEvent) => boolean) | undefined;
|
|
28
|
-
editorAppearance?: EditorAppearance | undefined;
|
|
29
|
-
useStickyToolbar?: UseStickyToolbarType | undefined;
|
|
30
|
-
intl: IntlShape;
|
|
31
|
-
}) => jsx.JSX.Element;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
toolbarLabel: {
|
|
3
|
-
id: string;
|
|
4
|
-
defaultMessage: string;
|
|
5
|
-
description: string;
|
|
6
|
-
};
|
|
7
|
-
pageActionsLabel: {
|
|
8
|
-
id: string;
|
|
9
|
-
defaultMessage: string;
|
|
10
|
-
description: string;
|
|
11
|
-
};
|
|
12
|
-
editableContentLabel: {
|
|
13
|
-
id: string;
|
|
14
|
-
defaultMessage: string;
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
|
-
import type { EditorAppearance } from '../../types';
|
|
4
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { ReactNode } from 'react';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import type { UseStickyToolbarType } from '../../types/editor-props';
|
|
8
|
-
import type { IntlShape } from 'react-intl-next/src/types';
|
|
9
|
-
export interface KeyDownHandlerContext {
|
|
10
|
-
handleArrowLeft: () => void;
|
|
11
|
-
handleArrowRight: () => void;
|
|
12
|
-
handleTab: () => void;
|
|
13
|
-
}
|
|
14
|
-
export declare const KeyDownHandlerContext: React.Context<KeyDownHandlerContext>;
|
|
15
|
-
/**
|
|
16
|
-
* This component is a wrapper of main toolbar which listens to keydown events of children
|
|
17
|
-
* and handles left/right arrow key navigation for all focusable elements
|
|
18
|
-
* @param
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
export declare const ToolbarArrowKeyNavigationProvider: ({ children, editorView, childComponentSelector, handleEscape, disableArrowKeyNavigation, isShortcutToFocusToolbar, editorAppearance, useStickyToolbar, intl, }: {
|
|
22
|
-
children: ReactNode;
|
|
23
|
-
editorView?: EditorView | undefined;
|
|
24
|
-
childComponentSelector: string;
|
|
25
|
-
handleEscape?: ((event: KeyboardEvent) => void) | undefined;
|
|
26
|
-
disableArrowKeyNavigation?: boolean | undefined;
|
|
27
|
-
isShortcutToFocusToolbar?: ((event: KeyboardEvent) => boolean) | undefined;
|
|
28
|
-
editorAppearance?: EditorAppearance | undefined;
|
|
29
|
-
useStickyToolbar?: UseStickyToolbarType | undefined;
|
|
30
|
-
intl: IntlShape;
|
|
31
|
-
}) => jsx.JSX.Element;
|