@atlaskit/editor-common 70.2.1 → 71.0.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 +50 -0
- package/dist/cjs/analytics/types/enums.js +10 -1
- package/dist/cjs/keymaps/index.js +5 -8
- package/dist/cjs/messages/insert-block.js +12 -7
- package/dist/cjs/panel.js +6 -0
- package/dist/cjs/styles/shared/code-block.js +5 -5
- package/dist/cjs/styles/shared/panel.js +54 -17
- package/dist/cjs/styles/shared/table.js +12 -7
- package/dist/cjs/styles/shared/text-color.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui-color/ColorPalette/Color/index.js +6 -2
- package/dist/cjs/ui-color/ColorPalette/index.js +21 -11
- package/dist/cjs/ui-menu/Dropdown/index.js +16 -2
- package/dist/cjs/ui-menu/DropdownMenu/index.js +27 -8
- package/dist/cjs/ui-menu/MenuArrowKeyNavigationProvider/index.js +162 -0
- package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +22 -13
- package/dist/cjs/utils/index.js +6 -0
- package/dist/cjs/utils/performance/measure-render.js +44 -23
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/types/enums.js +10 -1
- package/dist/es2019/keymaps/index.js +4 -6
- package/dist/es2019/messages/insert-block.js +12 -7
- package/dist/es2019/panel.js +1 -1
- package/dist/es2019/styles/shared/code-block.js +39 -25
- package/dist/es2019/styles/shared/panel.js +48 -18
- package/dist/es2019/styles/shared/table.js +24 -13
- package/dist/es2019/styles/shared/text-color.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui-color/ColorPalette/Color/index.js +6 -3
- package/dist/es2019/ui-color/ColorPalette/index.js +19 -11
- package/dist/es2019/ui-menu/Dropdown/index.js +13 -2
- package/dist/es2019/ui-menu/DropdownMenu/index.js +41 -6
- package/dist/es2019/ui-menu/MenuArrowKeyNavigationProvider/index.js +146 -0
- package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +20 -13
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/utils/performance/measure-render.js +43 -23
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/types/enums.js +10 -1
- package/dist/esm/keymaps/index.js +3 -6
- package/dist/esm/messages/insert-block.js +12 -7
- package/dist/esm/panel.js +1 -1
- package/dist/esm/styles/shared/code-block.js +5 -5
- package/dist/esm/styles/shared/panel.js +49 -18
- package/dist/esm/styles/shared/table.js +12 -9
- package/dist/esm/styles/shared/text-color.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui-color/ColorPalette/Color/index.js +5 -2
- package/dist/esm/ui-color/ColorPalette/index.js +20 -11
- package/dist/esm/ui-menu/Dropdown/index.js +15 -2
- package/dist/esm/ui-menu/DropdownMenu/index.js +28 -9
- package/dist/esm/ui-menu/MenuArrowKeyNavigationProvider/index.js +147 -0
- package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +22 -13
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/performance/measure-render.js +42 -23
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/index.d.ts +1 -1
- package/dist/types/analytics/types/enums.d.ts +18 -1
- package/dist/types/analytics/types/general-events.d.ts +2 -1
- package/dist/types/analytics/types/index.d.ts +1 -0
- package/dist/types/analytics/types/referentiality-events.d.ts +47 -4
- package/dist/types/keymaps/index.d.ts +0 -1
- package/dist/types/messages/insert-block.d.ts +7 -2
- package/dist/types/panel.d.ts +1 -1
- package/dist/types/styles/shared/code-block.d.ts +1 -0
- package/dist/types/styles/shared/panel.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +27 -6
- package/dist/types/types/floating-toolbar.d.ts +4 -0
- package/dist/types/ui-color/ColorPalette/Color/index.d.ts +5 -0
- package/dist/types/ui-color/ColorPalette/index.d.ts +8 -0
- package/dist/types/ui-menu/Dropdown/index.d.ts +3 -0
- package/dist/types/ui-menu/DropdownMenu/index.d.ts +1 -0
- package/dist/types/ui-menu/DropdownMenu/types.d.ts +7 -0
- package/dist/types/ui-menu/MenuArrowKeyNavigationProvider/index.d.ts +15 -0
- package/dist/types/ui-react/with-react-editor-view-outer-listeners.d.ts +2 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/performance/measure-render.d.ts +12 -0
- package/package.json +8 -7
- package/report.api.md +12 -5
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import React, { useLayoutEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This component is a wrapper of vertical menus which listens to keydown events of children
|
|
5
|
+
* and handles up/down arrow key navigation
|
|
6
|
+
*/
|
|
7
|
+
export const MenuArrowKeyNavigationProvider = ({
|
|
8
|
+
children,
|
|
9
|
+
handleClose,
|
|
10
|
+
disableArrowKeyNavigation,
|
|
11
|
+
keyDownHandlerContext,
|
|
12
|
+
closeonTab
|
|
13
|
+
}) => {
|
|
14
|
+
const wrapperRef = useRef(null);
|
|
15
|
+
const currentSelectedItemIndex = useRef(-1);
|
|
16
|
+
|
|
17
|
+
const incrementIndex = list => {
|
|
18
|
+
if (currentSelectedItemIndex.current === list.length - 1 || currentSelectedItemIndex.current === -1) {
|
|
19
|
+
currentSelectedItemIndex.current = 0;
|
|
20
|
+
} else {
|
|
21
|
+
currentSelectedItemIndex.current = currentSelectedItemIndex.current + 1;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const decrementIndex = list => {
|
|
26
|
+
if (currentSelectedItemIndex.current === 0 || currentSelectedItemIndex.current === -1) {
|
|
27
|
+
currentSelectedItemIndex.current = list.length - 1;
|
|
28
|
+
} else {
|
|
29
|
+
currentSelectedItemIndex.current = currentSelectedItemIndex.current - 1;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
useLayoutEffect(() => {
|
|
34
|
+
if (disableArrowKeyNavigation) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* To handle the key events on the list
|
|
39
|
+
* @param event
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const handleKeyDown = event => {
|
|
44
|
+
var _wrapperRef$current, _focusableElements$cu, _focusableElements$cu2;
|
|
45
|
+
|
|
46
|
+
const targetElement = event.target; //Tab key on menu items can be handled in the parent components of dropdown menus with KeydownHandlerContext
|
|
47
|
+
|
|
48
|
+
if (event.key === 'Tab' && closeonTab) {
|
|
49
|
+
handleClose(event);
|
|
50
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleTab();
|
|
51
|
+
return;
|
|
52
|
+
} //To trap the focus inside the toolbar using left and right arrow keys
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
const focusableElements = getEnabledElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
|
|
56
|
+
|
|
57
|
+
if (!focusableElements || (focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements.length) === 0) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!((_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(targetElement))) {
|
|
62
|
+
currentSelectedItemIndex.current = -1;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
switch (event.key) {
|
|
66
|
+
case 'ArrowDown':
|
|
67
|
+
//If ArrowDown pressed
|
|
68
|
+
//If on last item
|
|
69
|
+
// Focus last item
|
|
70
|
+
//Else
|
|
71
|
+
// Focus next item
|
|
72
|
+
incrementIndex(focusableElements);
|
|
73
|
+
(_focusableElements$cu = focusableElements[currentSelectedItemIndex.current]) === null || _focusableElements$cu === void 0 ? void 0 : _focusableElements$cu.focus();
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
break;
|
|
76
|
+
|
|
77
|
+
case 'ArrowUp':
|
|
78
|
+
//ArrowUP pressed
|
|
79
|
+
//If on First item
|
|
80
|
+
// Focus last item
|
|
81
|
+
//Else
|
|
82
|
+
// Focus previous item
|
|
83
|
+
decrementIndex(focusableElements);
|
|
84
|
+
(_focusableElements$cu2 = focusableElements[currentSelectedItemIndex.current]) === null || _focusableElements$cu2 === void 0 ? void 0 : _focusableElements$cu2.focus();
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
break;
|
|
87
|
+
//ArrowLeft/Right on the menu should close the menus
|
|
88
|
+
//then logic to retain the focus can be handled in the parent components with KeydownHandlerContext
|
|
89
|
+
|
|
90
|
+
case 'ArrowLeft':
|
|
91
|
+
//Filter out the events from outside the menu
|
|
92
|
+
if (!targetElement.closest('.custom-key-handler-wrapper')) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
handleClose(event);
|
|
97
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowLeft();
|
|
98
|
+
break;
|
|
99
|
+
|
|
100
|
+
case 'ArrowRight':
|
|
101
|
+
//Filter out the events from outside the menu
|
|
102
|
+
if (!targetElement.closest('.custom-key-handler-wrapper')) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
handleClose(event);
|
|
107
|
+
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowRight();
|
|
108
|
+
break;
|
|
109
|
+
|
|
110
|
+
case 'Escape':
|
|
111
|
+
handleClose(event);
|
|
112
|
+
break;
|
|
113
|
+
|
|
114
|
+
default:
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
120
|
+
return () => {
|
|
121
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
122
|
+
};
|
|
123
|
+
}, [currentSelectedItemIndex, wrapperRef, handleClose, disableArrowKeyNavigation, keyDownHandlerContext, closeonTab]);
|
|
124
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
125
|
+
className: "custom-key-handler-wrapper",
|
|
126
|
+
ref: wrapperRef
|
|
127
|
+
}, children);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
function getFocusableElements(rootNode) {
|
|
131
|
+
if (!rootNode) {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const focusableModalElements = rootNode.querySelectorAll('a[href], button:not([disabled]), textarea, input, select, div[tabindex="-1"]') || [];
|
|
136
|
+
return Array.from(focusableModalElements);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* This method filters out all the disabled menu items
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
function getEnabledElements(rootNode) {
|
|
144
|
+
const focusableElements = getFocusableElements(rootNode);
|
|
145
|
+
return focusableElements.filter(element => !element.querySelector('[role="button"][aria-disabled="true"]') && !element.querySelector('[role="menuitem"][aria-disabled="true"]'));
|
|
146
|
+
}
|
|
@@ -16,7 +16,15 @@ class WithOutsideClick extends PureComponent {
|
|
|
16
16
|
|
|
17
17
|
if (!domNode || evt.target instanceof Node && !domNode.contains(evt.target)) {
|
|
18
18
|
if (this.props.handleClickOutside) {
|
|
19
|
-
|
|
19
|
+
var _this$props$editorVie;
|
|
20
|
+
|
|
21
|
+
this.props.handleClickOutside(evt); //When the menus are closed by clicking outside the focus is set on editor.
|
|
22
|
+
|
|
23
|
+
if (!((_this$props$editorVie = this.props.editorView) !== null && _this$props$editorVie !== void 0 && _this$props$editorVie.hasFocus())) {
|
|
24
|
+
var _this$props$editorVie2;
|
|
25
|
+
|
|
26
|
+
(_this$props$editorVie2 = this.props.editorView) === null || _this$props$editorVie2 === void 0 ? void 0 : _this$props$editorVie2.focus();
|
|
27
|
+
}
|
|
20
28
|
}
|
|
21
29
|
}
|
|
22
30
|
});
|
|
@@ -27,21 +35,16 @@ class WithOutsideClick extends PureComponent {
|
|
|
27
35
|
}
|
|
28
36
|
|
|
29
37
|
if (evt.code === 'Escape' && this.props.handleEscapeKeydown) {
|
|
30
|
-
var _this$props$editorVie;
|
|
31
|
-
|
|
32
38
|
evt.preventDefault();
|
|
33
39
|
evt.stopPropagation();
|
|
34
|
-
this.props.handleEscapeKeydown(evt);
|
|
35
|
-
|
|
36
|
-
if (!((_this$props$editorVie = this.props.editorView) !== null && _this$props$editorVie !== void 0 && _this$props$editorVie.hasFocus())) {
|
|
37
|
-
var _this$props$editorVie2;
|
|
38
|
-
|
|
39
|
-
(_this$props$editorVie2 = this.props.editorView) === null || _this$props$editorVie2 === void 0 ? void 0 : _this$props$editorVie2.focus();
|
|
40
|
-
}
|
|
40
|
+
this.props.handleEscapeKeydown(evt); //on 'Esc', Focus is handled in 'handleEscapeKeydown'.
|
|
41
41
|
|
|
42
42
|
return false;
|
|
43
43
|
} else if (evt.code === 'Enter' && this.props.handleEnterKeydown) {
|
|
44
44
|
this.props.handleEnterKeydown(evt);
|
|
45
|
+
} else if (evt.code === 'Tab' && this.props.handleEscapeKeydown && this.props.closeonTab) {
|
|
46
|
+
//The menus should be closed when the tab is pressed as it takes the focus out of the menu
|
|
47
|
+
this.props.handleEscapeKeydown(evt);
|
|
45
48
|
}
|
|
46
49
|
});
|
|
47
50
|
}
|
|
@@ -54,7 +57,8 @@ class WithOutsideClick extends PureComponent {
|
|
|
54
57
|
if (this.props.handleEscapeKeydown) {
|
|
55
58
|
var _this$props$editorRef;
|
|
56
59
|
|
|
57
|
-
|
|
60
|
+
//Attached event to the menu so that 'ESC' events from the opened menu also will be handled.
|
|
61
|
+
(((_this$props$editorRef = this.props.editorRef) === null || _this$props$editorRef === void 0 ? void 0 : _this$props$editorRef.current) || this.props.targetRef || document).addEventListener('keydown', this.handleKeydown, false);
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
|
|
@@ -66,7 +70,7 @@ class WithOutsideClick extends PureComponent {
|
|
|
66
70
|
if (this.props.handleEscapeKeydown) {
|
|
67
71
|
var _this$props$editorRef2;
|
|
68
72
|
|
|
69
|
-
(((_this$props$editorRef2 = this.props.editorRef) === null || _this$props$editorRef2 === void 0 ? void 0 : _this$props$editorRef2.current) || document).removeEventListener('keydown', this.handleKeydown, false);
|
|
73
|
+
(((_this$props$editorRef2 = this.props.editorRef) === null || _this$props$editorRef2 === void 0 ? void 0 : _this$props$editorRef2.current) || this.props.targetRef || document).removeEventListener('keydown', this.handleKeydown, false);
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
76
|
|
|
@@ -85,6 +89,7 @@ export default function withReactEditorViewOuterListeners(Component) {
|
|
|
85
89
|
handleClickOutside,
|
|
86
90
|
handleEnterKeydown,
|
|
87
91
|
handleEscapeKeydown,
|
|
92
|
+
closeonTab,
|
|
88
93
|
...props
|
|
89
94
|
}) => {
|
|
90
95
|
const isActiveComponent = hasIsOpen(props) ? props.isOpen : true;
|
|
@@ -94,10 +99,12 @@ export default function withReactEditorViewOuterListeners(Component) {
|
|
|
94
99
|
}) => /*#__PURE__*/React.createElement(WithOutsideClick, {
|
|
95
100
|
editorView: editorView,
|
|
96
101
|
editorRef: editorRef,
|
|
102
|
+
targetRef: props.targetRef,
|
|
97
103
|
isActiveComponent: isActiveComponent,
|
|
98
104
|
handleClickOutside: handleClickOutside,
|
|
99
105
|
handleEnterKeydown: handleEnterKeydown,
|
|
100
|
-
handleEscapeKeydown: handleEscapeKeydown
|
|
106
|
+
handleEscapeKeydown: handleEscapeKeydown,
|
|
107
|
+
closeonTab: closeonTab
|
|
101
108
|
}, /*#__PURE__*/React.createElement(Component, props)));
|
|
102
109
|
};
|
|
103
110
|
}
|
|
@@ -13,7 +13,7 @@ export { walkUpTreeUntil, unwrap, removeNestedEmptyEls, containsClassName, close
|
|
|
13
13
|
export { default as ADFTraversor } from './traversor';
|
|
14
14
|
export { analyticsEventKey, getAnalyticsAppearance, getAnalyticsEventSeverity, SEVERITY, getUnsupportedContentLevelData, UNSUPPORTED_CONTENT_LEVEL_SEVERITY, UNSUPPORTED_CONTENT_LEVEL_SEVERITY_THRESHOLD_DEFAULTS } from './analytics';
|
|
15
15
|
export { findAndTrackUnsupportedContentNodes } from './track-unsupported-content';
|
|
16
|
-
export { measureRender } from './performance/measure-render';
|
|
16
|
+
export { getDistortedDurationMonitor, measureRender } from './performance/measure-render';
|
|
17
17
|
export { startMeasure, stopMeasure, clearMeasure } from './performance/measure';
|
|
18
18
|
export { measureTTI, getTTISeverity, TTI_SEVERITY_THRESHOLD_DEFAULTS, TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS } from './performance/measure-tti';
|
|
19
19
|
export { isPerformanceAPIAvailable, isPerformanceObserverAvailable } from './performance/is-performance-api-available';
|
|
@@ -1,4 +1,41 @@
|
|
|
1
1
|
import { isPerformanceAPIAvailable } from './is-performance-api-available';
|
|
2
|
+
/**
|
|
3
|
+
* Monitors if a pages enters a visibility state which will lead to
|
|
4
|
+
* distorted duration measurements (where the measurement uses the
|
|
5
|
+
* requestAnimationFrame api).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export function getDistortedDurationMonitor() {
|
|
9
|
+
// If an editor is rendered when the document is not visible -- the callback passed to
|
|
10
|
+
// requestAnimationFrame will not fire until the document becomes visible again.
|
|
11
|
+
//
|
|
12
|
+
// For the purposes of using performance measurement -- this behaviour means the events
|
|
13
|
+
// which have been fired in the background are not useful -- and lead to other events
|
|
14
|
+
// being hard to draw conclusions from.
|
|
15
|
+
//
|
|
16
|
+
// To mitigate this -- we detect this state -- and fire a seperate callback when the
|
|
17
|
+
// measurement has occured when the render was in the backgroun
|
|
18
|
+
let distortedDuration = document.visibilityState !== 'visible';
|
|
19
|
+
|
|
20
|
+
function handleVisibilityChange() {
|
|
21
|
+
if (document.visibilityState !== 'visible') {
|
|
22
|
+
distortedDuration = true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
27
|
+
return {
|
|
28
|
+
distortedDuration,
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Cleans up the document visibility event listener
|
|
32
|
+
*/
|
|
33
|
+
cleanup() {
|
|
34
|
+
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
};
|
|
38
|
+
}
|
|
2
39
|
/**
|
|
3
40
|
* Measures time it takes to render a frame including -> style, paint, layout and composition.
|
|
4
41
|
*
|
|
@@ -37,29 +74,12 @@ onMeasureComplete) {
|
|
|
37
74
|
const startMark = `[START]: ${measureName}`;
|
|
38
75
|
const endMark = `[END]: ${measureName}`;
|
|
39
76
|
const startTime = performance.now();
|
|
40
|
-
performance.mark(startMark);
|
|
41
|
-
|
|
42
|
-
//
|
|
43
|
-
// For the purposes of using performance measurement -- this behaviour means the events
|
|
44
|
-
// which have been fired in the background are not useful -- and lead to other events
|
|
45
|
-
// being hard to draw conclusions from.
|
|
46
|
-
//
|
|
47
|
-
// To mitigate this -- we detect this state -- and fire a seperate callback when the
|
|
48
|
-
// measurement has occured when the render was in the backgroun
|
|
49
|
-
|
|
50
|
-
let distortedDuration = document.visibilityState !== 'visible';
|
|
51
|
-
|
|
52
|
-
function handleVisibilityChange() {
|
|
53
|
-
if (document.visibilityState !== 'visible') {
|
|
54
|
-
distortedDuration = true;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
77
|
+
performance.mark(startMark);
|
|
78
|
+
let distortedDurationMonitor = getDistortedDurationMonitor();
|
|
59
79
|
requestAnimationFrame(() => {
|
|
60
80
|
requestAnimationFrame(() => {
|
|
61
81
|
performance.mark(endMark);
|
|
62
|
-
|
|
82
|
+
distortedDurationMonitor.cleanup();
|
|
63
83
|
const duration = performance.now() - startTime;
|
|
64
84
|
|
|
65
85
|
try {
|
|
@@ -70,20 +90,20 @@ onMeasureComplete) {
|
|
|
70
90
|
onMeasureComplete({
|
|
71
91
|
duration,
|
|
72
92
|
startTime,
|
|
73
|
-
distortedDuration
|
|
93
|
+
distortedDuration: distortedDurationMonitor.distortedDuration
|
|
74
94
|
});
|
|
75
95
|
} else {
|
|
76
96
|
onMeasureComplete({
|
|
77
97
|
duration: entry.duration,
|
|
78
98
|
startTime: entry.startTime,
|
|
79
|
-
distortedDuration
|
|
99
|
+
distortedDuration: distortedDurationMonitor.distortedDuration
|
|
80
100
|
});
|
|
81
101
|
}
|
|
82
102
|
} catch (e) {
|
|
83
103
|
onMeasureComplete({
|
|
84
104
|
duration,
|
|
85
105
|
startTime,
|
|
86
|
-
distortedDuration
|
|
106
|
+
distortedDuration: distortedDurationMonitor.distortedDuration
|
|
87
107
|
});
|
|
88
108
|
}
|
|
89
109
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -24,6 +24,7 @@ export var ACTION;
|
|
|
24
24
|
ACTION["CLICKED"] = "clicked";
|
|
25
25
|
ACTION["CLOSED"] = "closed";
|
|
26
26
|
ACTION["COMMITTED"] = "committed";
|
|
27
|
+
ACTION["CONNECTED_NODES"] = "connectedNodes";
|
|
27
28
|
ACTION["CONVERTED"] = "converted";
|
|
28
29
|
ACTION["COPIED"] = "copied";
|
|
29
30
|
ACTION["CUT"] = "cut";
|
|
@@ -31,6 +32,8 @@ export var ACTION;
|
|
|
31
32
|
ACTION["DECREMENTED"] = "decremented";
|
|
32
33
|
ACTION["DELETED"] = "deleted";
|
|
33
34
|
ACTION["DISCARDED_INVALID_STEPS_FROM_TRANSACTION"] = "discardedInvalidStepsFromTransaction";
|
|
35
|
+
ACTION["DISCONNECTED_SOURCE"] = "disconnectedSource";
|
|
36
|
+
ACTION["DISCONNECTED_TARGET"] = "disconnectedTarget";
|
|
34
37
|
ACTION["DISMISSED"] = "dismissed";
|
|
35
38
|
ACTION["DISPATCHED_INVALID_TRANSACTION"] = "dispatchedInvalidTransaction";
|
|
36
39
|
ACTION["DISPATCHED_VALID_TRANSACTION"] = "dispatchedValidTransaction";
|
|
@@ -54,11 +57,13 @@ export var ACTION;
|
|
|
54
57
|
ACTION["INCREMENTED"] = "incremented";
|
|
55
58
|
ACTION["INDENTED"] = "indented";
|
|
56
59
|
ACTION["INITIALISED"] = "initialised";
|
|
60
|
+
ACTION["INITIALISED_FRAGMENT_MARK"] = "initialisedFragmentMark";
|
|
57
61
|
ACTION["INPUT_PERF_SAMPLING"] = "inputPerfSampling";
|
|
58
62
|
ACTION["INPUT_PERF_SAMPLING_AVG"] = "inputPerfSamplingAvg";
|
|
59
63
|
ACTION["INSERTED"] = "inserted";
|
|
60
64
|
ACTION["INVALID_DOCUMENT_ENCOUNTERED"] = "invalidDocumentEncountered";
|
|
61
65
|
ACTION["INVOKED"] = "invoked";
|
|
66
|
+
ACTION["GOT_CONNECTIONS"] = "gotConnections";
|
|
62
67
|
ACTION["LANGUAGE_SELECTED"] = "languageSelected";
|
|
63
68
|
ACTION["LIST_ITEM_JOINED"] = "listItemJoined";
|
|
64
69
|
ACTION["MATCHED"] = "matched";
|
|
@@ -87,6 +92,7 @@ export var ACTION;
|
|
|
87
92
|
ACTION["DEDUPE_MARKS_TRANSFORMED"] = "dedupeMarksTransformed";
|
|
88
93
|
ACTION["NODES_MISSING_CONTENT_TRANSFORMED"] = "nodesMissingContentTransformed";
|
|
89
94
|
ACTION["INDENTATION_MARKS_TRANSFORMED"] = "indentationMarksTransformed";
|
|
95
|
+
ACTION["INVALID_MEDIA_CONTENT_TRANSFORMED"] = "invalidMediaContentTransformed";
|
|
90
96
|
ACTION["TOGGLE_EXPAND"] = "toggleExpand";
|
|
91
97
|
ACTION["TRANSACTION_DISPATCHED"] = "transactionDispatched";
|
|
92
98
|
ACTION["TRANSACTION_MUTATED_AFTER_DISPATCH"] = "transactionMutatedAfterDispatched";
|
|
@@ -95,6 +101,9 @@ export var ACTION;
|
|
|
95
101
|
ACTION["UNLINK"] = "unlinked";
|
|
96
102
|
ACTION["UNSUPPORTED_CONTENT_ENCOUNTERED"] = "unsupportedContentEncountered";
|
|
97
103
|
ACTION["UPDATED"] = "updated";
|
|
104
|
+
ACTION["UPDATED_FRAGMENT_MARK_NAME"] = "updatedFragmentMarkName";
|
|
105
|
+
ACTION["UPDATED_SOURCE"] = "updatedSource";
|
|
106
|
+
ACTION["UPDATED_TARGET"] = "updatedTarget";
|
|
98
107
|
ACTION["UPLOAD_EXTERNAL_FAIL"] = "uploadExternalFailed";
|
|
99
108
|
ACTION["VIEWED"] = "viewed";
|
|
100
109
|
ACTION["VISITED"] = "visited";
|
|
@@ -242,7 +251,7 @@ export var ACTION_SUBJECT_ID;
|
|
|
242
251
|
ACTION_SUBJECT_ID["FORMAT_SUB"] = "subscript";
|
|
243
252
|
ACTION_SUBJECT_ID["FORMAT_SUPER"] = "superscript";
|
|
244
253
|
ACTION_SUBJECT_ID["FORMAT_UNDERLINE"] = "underline";
|
|
245
|
-
ACTION_SUBJECT_ID["
|
|
254
|
+
ACTION_SUBJECT_ID["FRAGMENT_MARK"] = "fragmentMark";
|
|
246
255
|
ACTION_SUBJECT_ID["GOTO_SMART_LINK_SETTINGS"] = "goToSmartLinkSettings";
|
|
247
256
|
ACTION_SUBJECT_ID["HELP_QUICK_INSERT"] = "helpQuickInsert";
|
|
248
257
|
ACTION_SUBJECT_ID["HYPERLINK"] = "hyperlink";
|
|
@@ -6,6 +6,7 @@ var _templateObject;
|
|
|
6
6
|
import React, { Fragment } from 'react';
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
8
|
import { N400 } from '@atlaskit/theme/colors';
|
|
9
|
+
import { token } from '@atlaskit/tokens';
|
|
9
10
|
import { browser } from '../utils';
|
|
10
11
|
export var addAltText = makeKeyMapWithCommon('Add Alt Text', 'Mod-Alt-y');
|
|
11
12
|
export var toggleBold = makeKeyMapWithCommon('Bold', 'Mod-b');
|
|
@@ -69,18 +70,14 @@ export var paste = makeKeyMapWithCommon('Paste', 'Mod-v');
|
|
|
69
70
|
export var altPaste = makeKeyMapWithCommon('Paste', 'Mod-Shift-v');
|
|
70
71
|
export var find = makeKeyMapWithCommon('Find', 'Mod-f');
|
|
71
72
|
export var alignLeft = makeKeyMapWithCommon('Align Left', 'Mod-Shift-l');
|
|
72
|
-
export var alignRight = makeKeyMapWithCommon('Align Right', 'Mod-Shift-r');
|
|
73
73
|
var arrowKeysMap = {
|
|
74
74
|
// for reference: https://wincent.com/wiki/Unicode_representations_of_modifier_keys
|
|
75
75
|
ARROWLEFT: "\u2190",
|
|
76
76
|
ARROWRIGHT: "\u2192",
|
|
77
77
|
ARROWUP: "\u2191",
|
|
78
78
|
ARROWDOWN: "\u2193"
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
82
|
-
|
|
83
|
-
var tooltipShortcutStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-radius: 2px;\n background-color: ", ";\n padding: 0 2px;\n /* TODO: fix in develop: https://atlassian.slack.com/archives/CFG3PSQ9E/p1647395052443259?thread_ts=1647394572.556029&cid=CFG3PSQ9E */\n /* stylelint-disable-next-line */\n label: tooltip-shortcut;\n"])), N400);
|
|
79
|
+
};
|
|
80
|
+
var tooltipShortcutStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-radius: 2px;\n background-color: ", ";\n padding: 0 2px;\n\n /* TODO: fix in develop: https://atlassian.slack.com/archives/CFG3PSQ9E/p1647395052443259?thread_ts=1647394572.556029&cid=CFG3PSQ9E */\n /* stylelint-disable-next-line */\n label: tooltip-shortcut;\n"])), token('color.background.inverse.subtle', N400));
|
|
84
81
|
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
85
82
|
|
|
86
83
|
function formatShortcut(keymap) {
|
|
@@ -20,13 +20,18 @@ export var toolbarInsertBlockMessages = defineMessages({
|
|
|
20
20
|
defaultMessage: 'Insert a link',
|
|
21
21
|
description: 'Insert a hyperlink'
|
|
22
22
|
},
|
|
23
|
-
|
|
24
|
-
id: 'fabric.editor.
|
|
25
|
-
defaultMessage: '
|
|
26
|
-
description: 'Insert one or more files or images'
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
id: 'fabric.editor.
|
|
23
|
+
mediaFiles: {
|
|
24
|
+
id: 'fabric.editor.mediaFiles',
|
|
25
|
+
defaultMessage: 'Image, video, or file',
|
|
26
|
+
description: 'Insert one or more files, videos or images'
|
|
27
|
+
},
|
|
28
|
+
addMediaFiles: {
|
|
29
|
+
id: 'fabric.editor.addMediaFiles',
|
|
30
|
+
defaultMessage: 'Add image, video, or file',
|
|
31
|
+
description: 'Insert one or more files, videos or images'
|
|
32
|
+
},
|
|
33
|
+
mediaFilesDescription: {
|
|
34
|
+
id: 'fabric.editor.mediaFiles.description',
|
|
30
35
|
defaultMessage: 'Add images and other files to your page',
|
|
31
36
|
description: 'Insert one or more files or images'
|
|
32
37
|
},
|
package/dist/esm/panel.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getPanelTypeBackground, darkPanelColors, getPanelDarkColor, panelSharedStyles, panelSharedStylesWithoutPrefix, PanelSharedCssClassName, PanelSharedSelectors, getPanelBackgroundDarkModeColors } from './styles/shared/panel';
|
|
1
|
+
export { getPanelTypeBackground, getPanelTypeBackgroundNoTokens, darkPanelColors, getPanelDarkColor, panelSharedStyles, panelSharedStylesWithoutPrefix, PanelSharedCssClassName, PanelSharedSelectors, getPanelBackgroundDarkModeColors } from './styles/shared/panel';
|
|
@@ -12,23 +12,23 @@ export var CodeBlockSharedCssClassName = {
|
|
|
12
12
|
CODEBLOCK_CONTAINER: 'code-block',
|
|
13
13
|
CODEBLOCK_START: 'code-block--start',
|
|
14
14
|
CODEBLOCK_END: 'code-block--end',
|
|
15
|
+
CODEBLOCK_CONTENT_WRAPPER: 'code-block-content-wrapper',
|
|
15
16
|
CODEBLOCK_LINE_NUMBER_GUTTER: 'line-number-gutter',
|
|
16
17
|
CODEBLOCK_CONTENT: 'code-content',
|
|
17
18
|
DS_CODEBLOCK: '[data-ds--code--code-block]'
|
|
18
19
|
};
|
|
19
20
|
export var codeBlockSharedStyles = function codeBlockSharedStyles(props) {
|
|
20
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n position: relative;\n background-color: ", ";\n border-radius: ", "px;\n
|
|
21
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n position: relative;\n background-color: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n font-family: ", ";\n min-width: ", "px;\n cursor: pointer;\n\n --ds--code--bg-color: transparent;\n\n /* This is necessary to allow for arrow key navigation in/out of code blocks in Firefox. */\n white-space: normal;\n\n .", " {\n position: absolute;\n visibility: hidden;\n height: 1.5rem;\n top: 0px;\n left: 0px;\n }\n\n .", " {\n position: absolute;\n visibility: hidden;\n height: 1.5rem;\n bottom: 0px;\n right: 0px;\n }\n\n .", " {\n background-color: ", ";\n display: flex;\n border-radius: ", "px;\n width: 100%;\n counter-reset: line;\n overflow-x: auto;\n\n background-image: ", ";\n\n background-repeat: no-repeat;\n background-attachment: local, local, local, local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%, 8px 100%, 8px 100%,\n 8px 100%;\n background-position: 0 0, 0 0, 100% 0, 100% 0, 100% 0, 0 0;\n\n /* Be careful if refactoring this; it is needed to keep arrow key navigation in Firefox consistent with other browsers. */\n overflow-y: hidden;\n }\n\n .", " {\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n position: relative;\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n ::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n color: ", ";\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n }\n\n .", " {\n display: flex;\n flex: 1;\n\n code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n color: ", ";\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n }\n"])), CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, token('elevation.surface.raised', 'transparent'), borderRadius(), blockNodesVerticalMargin, akEditorCodeFontFamily, akEditorTableCellMinWidth, CodeBlockSharedCssClassName.CODEBLOCK_START, CodeBlockSharedCssClassName.CODEBLOCK_END, CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER, themed({
|
|
21
22
|
light: token('color.background.neutral', N20),
|
|
22
23
|
dark: token('color.background.neutral', DN50)
|
|
23
24
|
})(props), borderRadius(), overflowShadow({
|
|
24
25
|
// TODO: https://product-fabric.atlassian.net/browse/DSP-4118
|
|
25
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
26
26
|
background: themed({
|
|
27
|
-
light: N20,
|
|
28
|
-
dark: DN50
|
|
27
|
+
light: token('color.background.neutral', N20),
|
|
28
|
+
dark: token('color.background.neutral', DN50)
|
|
29
29
|
})(props),
|
|
30
30
|
width: '8px'
|
|
31
|
-
}),
|
|
31
|
+
}), CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, themed({
|
|
32
32
|
light: token('color.background.neutral', N30),
|
|
33
33
|
dark: token('color.background.neutral', DN20)
|
|
34
34
|
})(props), gridSize(), themed({
|
|
@@ -3,8 +3,6 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
|
|
4
4
|
var _templateObject, _templateObject2;
|
|
5
5
|
|
|
6
|
-
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
7
|
-
// TODO: https://product-fabric.atlassian.net/browse/DSP-4066
|
|
8
6
|
import { css } from '@emotion/react';
|
|
9
7
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
10
8
|
import { akEditorTableCellMinWidth, blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
|
|
@@ -13,7 +11,19 @@ import { emojiImage, emojiSprite } from '@atlaskit/emoji';
|
|
|
13
11
|
import * as colors from '@atlaskit/theme/colors';
|
|
14
12
|
import { themed } from '@atlaskit/theme/components';
|
|
15
13
|
import { borderRadius, gridSize } from '@atlaskit/theme/constants';
|
|
14
|
+
import { token } from '@atlaskit/tokens';
|
|
15
|
+
var tokenPanelColor = {
|
|
16
|
+
info: 'color.background.information',
|
|
17
|
+
note: 'color.background.discovery',
|
|
18
|
+
tip: 'color.background.success',
|
|
19
|
+
success: 'color.background.success',
|
|
20
|
+
warning: 'color.background.warning',
|
|
21
|
+
error: 'color.background.danger'
|
|
22
|
+
};
|
|
16
23
|
var lightPanelColor = {
|
|
24
|
+
// TODO: https://product-fabric.atlassian.net/browse/DSP-4066
|
|
25
|
+
|
|
26
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
17
27
|
info: colors.B50,
|
|
18
28
|
note: colors.P50,
|
|
19
29
|
tip: colors.G50,
|
|
@@ -23,7 +33,7 @@ var lightPanelColor = {
|
|
|
23
33
|
};
|
|
24
34
|
export var darkPanelColors = {
|
|
25
35
|
// standard panels
|
|
26
|
-
info:
|
|
36
|
+
info: "#0C294F",
|
|
27
37
|
error: "#441C13",
|
|
28
38
|
warning: "#413001",
|
|
29
39
|
tip: "#052E21",
|
|
@@ -83,26 +93,31 @@ export var darkPanelColors = {
|
|
|
83
93
|
LightGray: '#5A6977',
|
|
84
94
|
TextColor: '#D9DDE3'
|
|
85
95
|
};
|
|
96
|
+
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
97
|
+
|
|
86
98
|
var lightIconColor = {
|
|
87
|
-
info: colors.B400,
|
|
88
|
-
note: colors.P400,
|
|
89
|
-
tip: colors.G400,
|
|
90
|
-
success: colors.G400,
|
|
91
|
-
warning: colors.Y400,
|
|
92
|
-
error: colors.R400
|
|
99
|
+
info: token('color.icon.information', colors.B400),
|
|
100
|
+
note: token('color.icon.discovery', colors.P400),
|
|
101
|
+
tip: token('color.icon.success', colors.G400),
|
|
102
|
+
success: token('color.icon.success', colors.G400),
|
|
103
|
+
warning: token('color.icon.warning', colors.Y400),
|
|
104
|
+
error: token('color.icon.danger', colors.R400)
|
|
93
105
|
};
|
|
94
106
|
var darkIconColor = {
|
|
95
|
-
info: colors.B100,
|
|
96
|
-
note: colors.P100,
|
|
97
|
-
tip: colors.G200,
|
|
98
|
-
success: colors.G200,
|
|
99
|
-
warning: colors.Y100,
|
|
100
|
-
error: colors.R200
|
|
107
|
+
info: token('color.icon.information', colors.B100),
|
|
108
|
+
note: token('color.icon.discovery', colors.P100),
|
|
109
|
+
tip: token('color.icon.success', colors.G200),
|
|
110
|
+
success: token('color.icon.success', colors.G200),
|
|
111
|
+
warning: token('color.icon.warning', colors.Y100),
|
|
112
|
+
error: token('color.icon.danger', colors.R200)
|
|
101
113
|
}; // New custom icons are a little smaller than predefined icons.
|
|
102
114
|
// To fix alignment issues with custom icons, vertical alignment is updated.
|
|
103
115
|
|
|
104
116
|
var panelEmojiSpriteVerticalAlignment = -(gridSize() * 3 - akEditorCustomIconSize) / 2;
|
|
105
|
-
var panelEmojiImageVerticalAlignment = panelEmojiSpriteVerticalAlignment - 1;
|
|
117
|
+
var panelEmojiImageVerticalAlignment = panelEmojiSpriteVerticalAlignment - 1; // TODO: https://product-fabric.atlassian.net/browse/DSP-4066
|
|
118
|
+
|
|
119
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
120
|
+
|
|
106
121
|
var panelDarkModeColors = [[colors.B50, darkPanelColors.B1200S], [colors.B75, darkPanelColors.B900], [colors.B100, darkPanelColors.B800S], [colors.N0, darkPanelColors.LightGray], [colors.N20, darkPanelColors.Gray], [colors.N60, darkPanelColors.DarkGray], [colors.T50, darkPanelColors.T1200S], [colors.T75, darkPanelColors.T900], [colors.T100, darkPanelColors.T900S], [colors.G50, darkPanelColors.G1200S], [colors.G75, darkPanelColors.G900], [colors.G200, darkPanelColors.G900S], [colors.Y50, darkPanelColors.Y1200S], [colors.Y75, darkPanelColors.Y900], [colors.Y200, darkPanelColors.Y800S], [colors.R50, darkPanelColors.R1200S], [colors.R75, darkPanelColors.R900], [colors.R100, darkPanelColors.R800S], [colors.P50, darkPanelColors.P1200S], [colors.P75, darkPanelColors.P900], [colors.P100, darkPanelColors.P800S]];
|
|
107
122
|
export var getPanelDarkColor = function getPanelDarkColor(panelColor) {
|
|
108
123
|
var colorObject = panelDarkModeColors.find(function (color) {
|
|
@@ -160,9 +175,10 @@ var iconDynamicStyles = function iconDynamicStyles(panelType) {
|
|
|
160
175
|
})(props);
|
|
161
176
|
return "\n color: ".concat(color, ";\n ");
|
|
162
177
|
};
|
|
163
|
-
};
|
|
178
|
+
}; // Provides the color without tokens, used when converting to a custom panel
|
|
164
179
|
|
|
165
|
-
|
|
180
|
+
|
|
181
|
+
export var getPanelTypeBackgroundNoTokens = function getPanelTypeBackgroundNoTokens(panelType) {
|
|
166
182
|
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
167
183
|
var light = lightPanelColor[panelType];
|
|
168
184
|
var dark = darkPanelColors[panelType];
|
|
@@ -172,6 +188,21 @@ export var getPanelTypeBackground = function getPanelTypeBackground(panelType) {
|
|
|
172
188
|
})(props);
|
|
173
189
|
return background || 'none';
|
|
174
190
|
};
|
|
191
|
+
export var getPanelTypeBackground = function getPanelTypeBackground(panelType) {
|
|
192
|
+
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
193
|
+
// TODO: https://product-fabric.atlassian.net/browse/DSP-4066
|
|
194
|
+
|
|
195
|
+
/* eslint-disable @atlaskit/design-system/no-unsafe-design-token-usage */
|
|
196
|
+
var light = token(tokenPanelColor[panelType], lightPanelColor[panelType]);
|
|
197
|
+
var dark = token(tokenPanelColor[panelType], darkPanelColors[panelType]);
|
|
198
|
+
/* eslint-disable @atlaskit/design-system/no-unsafe-design-token-usage */
|
|
199
|
+
|
|
200
|
+
var background = themed({
|
|
201
|
+
light: light,
|
|
202
|
+
dark: dark
|
|
203
|
+
})(props);
|
|
204
|
+
return background || 'none';
|
|
205
|
+
};
|
|
175
206
|
|
|
176
207
|
var mainDynamicStyles = function mainDynamicStyles(panelType) {
|
|
177
208
|
return function (props) {
|