@atlaskit/editor-core 221.1.3 → 221.2.1
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 +20 -0
- package/dist/cjs/ui/Appearance/Comment/FixedToolbar-compiled.compiled.css +20 -0
- package/dist/cjs/ui/Appearance/Comment/FixedToolbar-compiled.js +35 -0
- package/dist/cjs/ui/Appearance/Comment/FixedToolbar-emotion.js +94 -0
- package/dist/cjs/ui/Appearance/Comment/StickyToolbar-compiled.compiled.css +25 -0
- package/dist/cjs/ui/Appearance/Comment/StickyToolbar-compiled.js +66 -0
- package/dist/cjs/ui/Appearance/Comment/StickyToolbar-emotion.js +131 -0
- package/dist/cjs/ui/Appearance/Comment/Toolbar.js +14 -134
- package/dist/cjs/ui/Toolbar/ToolbarComponentsWrapper-compiled.compiled.css +2 -0
- package/dist/cjs/ui/Toolbar/ToolbarComponentsWrapper-compiled.js +29 -0
- package/dist/cjs/ui/Toolbar/ToolbarComponentsWrapper-emotion.js +36 -0
- package/dist/cjs/ui/Toolbar/ToolbarInner.js +9 -14
- package/dist/cjs/ui/Toolbar/ToolbarSizeDetectorWrapper-compiled.compiled.css +2 -0
- package/dist/cjs/ui/Toolbar/ToolbarSizeDetectorWrapper-compiled.js +29 -0
- package/dist/cjs/ui/Toolbar/ToolbarSizeDetectorWrapper-emotion.js +32 -0
- package/dist/cjs/ui/Toolbar/ToolbarWithSizeDetector.js +21 -19
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/ui/Appearance/Comment/FixedToolbar-compiled.compiled.css +20 -0
- package/dist/es2019/ui/Appearance/Comment/FixedToolbar-compiled.js +26 -0
- package/dist/es2019/ui/Appearance/Comment/FixedToolbar-emotion.js +91 -0
- package/dist/es2019/ui/Appearance/Comment/StickyToolbar-compiled.compiled.css +25 -0
- package/dist/es2019/ui/Appearance/Comment/StickyToolbar-compiled.js +51 -0
- package/dist/es2019/ui/Appearance/Comment/StickyToolbar-emotion.js +128 -0
- package/dist/es2019/ui/Appearance/Comment/Toolbar.js +10 -133
- package/dist/es2019/ui/Toolbar/ToolbarComponentsWrapper-compiled.compiled.css +2 -0
- package/dist/es2019/ui/Toolbar/ToolbarComponentsWrapper-compiled.js +20 -0
- package/dist/es2019/ui/Toolbar/ToolbarComponentsWrapper-emotion.js +28 -0
- package/dist/es2019/ui/Toolbar/ToolbarInner.js +6 -17
- package/dist/es2019/ui/Toolbar/ToolbarSizeDetectorWrapper-compiled.compiled.css +2 -0
- package/dist/es2019/ui/Toolbar/ToolbarSizeDetectorWrapper-compiled.js +20 -0
- package/dist/es2019/ui/Toolbar/ToolbarSizeDetectorWrapper-emotion.js +24 -0
- package/dist/es2019/ui/Toolbar/ToolbarWithSizeDetector.js +18 -19
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/ui/Appearance/Comment/FixedToolbar-compiled.compiled.css +20 -0
- package/dist/esm/ui/Appearance/Comment/FixedToolbar-compiled.js +28 -0
- package/dist/esm/ui/Appearance/Comment/FixedToolbar-emotion.js +86 -0
- package/dist/esm/ui/Appearance/Comment/StickyToolbar-compiled.compiled.css +25 -0
- package/dist/esm/ui/Appearance/Comment/StickyToolbar-compiled.js +58 -0
- package/dist/esm/ui/Appearance/Comment/StickyToolbar-emotion.js +124 -0
- package/dist/esm/ui/Appearance/Comment/Toolbar.js +14 -132
- package/dist/esm/ui/Toolbar/ToolbarComponentsWrapper-compiled.compiled.css +2 -0
- package/dist/esm/ui/Toolbar/ToolbarComponentsWrapper-compiled.js +21 -0
- package/dist/esm/ui/Toolbar/ToolbarComponentsWrapper-emotion.js +28 -0
- package/dist/esm/ui/Toolbar/ToolbarInner.js +8 -16
- package/dist/esm/ui/Toolbar/ToolbarSizeDetectorWrapper-compiled.compiled.css +2 -0
- package/dist/esm/ui/Toolbar/ToolbarSizeDetectorWrapper-compiled.js +21 -0
- package/dist/esm/ui/Toolbar/ToolbarSizeDetectorWrapper-emotion.js +25 -0
- package/dist/esm/ui/Toolbar/ToolbarWithSizeDetector.js +21 -18
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/ui/Appearance/Comment/FixedToolbar-compiled.d.ts +20 -0
- package/dist/types/ui/Appearance/Comment/FixedToolbar-emotion.d.ts +19 -0
- package/dist/types/ui/Appearance/Comment/StickyToolbar-compiled.d.ts +22 -0
- package/dist/types/ui/Appearance/Comment/StickyToolbar-emotion.d.ts +21 -0
- package/dist/types/ui/Appearance/Comment/Toolbar.d.ts +1 -2
- package/dist/types/ui/Toolbar/ToolbarComponentsWrapper-compiled.d.ts +17 -0
- package/dist/types/ui/Toolbar/ToolbarComponentsWrapper-emotion.d.ts +17 -0
- package/dist/types/ui/Toolbar/ToolbarInner.d.ts +1 -6
- package/dist/types/ui/Toolbar/ToolbarSizeDetectorWrapper-compiled.d.ts +17 -0
- package/dist/types/ui/Toolbar/ToolbarSizeDetectorWrapper-emotion.d.ts +17 -0
- package/dist/types/ui/Toolbar/ToolbarWithSizeDetector.d.ts +2 -2
- package/package.json +11 -11
|
@@ -1,136 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { useEffect, useState } from 'react';
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic
|
|
10
|
-
import { css, jsx } from '@emotion/react';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
12
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
padding: `${"var(--ds-space-100, 8px)"} ${"var(--ds-space-100, 8px)"} 0`,
|
|
20
|
-
display: 'flex',
|
|
21
|
-
height: 'auto',
|
|
22
|
-
backgroundColor: "var(--ds-surface, #FFFFFF)",
|
|
23
|
-
boxShadow: 'none',
|
|
24
|
-
paddingLeft: "var(--ds-space-250, 20px)",
|
|
25
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
26
|
-
'> div': {
|
|
27
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
28
|
-
'> div:first-of-type:not(style), > style:first-of-type + *': {
|
|
29
|
-
marginLeft: 0
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
33
|
-
'.block-type-btn': {
|
|
34
|
-
paddingLeft: 0
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
/** keep default padding for entire toolbar */
|
|
39
|
-
const mainToolbarWithoutLeftPadding = css({
|
|
40
|
-
padding: `${"var(--ds-space-100, 8px)"} ${"var(--ds-space-100, 8px)"} 0`
|
|
41
|
-
});
|
|
42
|
-
const mainToolbarWithPadding = css({
|
|
43
|
-
padding: `${"var(--ds-space-100, 8px)"}`
|
|
44
|
-
});
|
|
45
|
-
const mainToolbarTwoLineStylesNew = css({
|
|
46
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
47
|
-
'& > div': {
|
|
48
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
|
|
49
|
-
[`@media (max-width: ${MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT}px)`]: {
|
|
50
|
-
flexDirection: 'column-reverse',
|
|
51
|
-
alignItems: 'end',
|
|
52
|
-
display: 'flex',
|
|
53
|
-
justifyContent: 'flex-end'
|
|
54
|
-
},
|
|
55
|
-
/* make this more explicit for a toolbar */
|
|
56
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
57
|
-
'> div:first-of-type': {
|
|
58
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
|
|
59
|
-
[`@media (max-width: ${MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT}px)`]: {
|
|
60
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
61
|
-
'> div:nth-of-type(2)': {
|
|
62
|
-
justifyContent: 'flex-end',
|
|
63
|
-
display: 'flex'
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
const mainToolbarWrapperStylesVisualRefresh = css({
|
|
70
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
71
|
-
'span svg': {
|
|
72
|
-
maxWidth: '100%'
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
const mainToolbarWithRadiusStyle = css({
|
|
76
|
-
borderRadius: `${"var(--ds-radius-small, 3px)"} ${"var(--ds-radius-small, 3px)"} 0 0`
|
|
77
|
-
});
|
|
78
|
-
const mainToolbarRadius = css({
|
|
79
|
-
borderRadius: `${"var(--ds-radius-medium, 6px)"} ${"var(--ds-radius-medium, 6px)"} 0 0`
|
|
80
|
-
});
|
|
81
|
-
const editorModernisationToolbarStyle = css({
|
|
82
|
-
borderRadius: `${"var(--ds-radius-xlarge, 12px)"} ${"var(--ds-radius-xlarge, 12px)"} 0 0`,
|
|
83
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
84
|
-
'&.show-keyline': {
|
|
85
|
-
boxShadow: 'none'
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
const stickyToolbarWrapperStyleNew = css({
|
|
89
|
-
position: 'sticky',
|
|
90
|
-
paddingBottom: "var(--ds-space-100, 8px)",
|
|
91
|
-
zIndex: akEditorMenuZIndex,
|
|
92
|
-
transition: 'box-shadow ease-in-out 0.2s',
|
|
93
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
94
|
-
'&.show-keyline': {
|
|
95
|
-
boxShadow: `0 ${akEditorToolbarKeylineHeight}px 0 0 ${"var(--ds-background-accent-gray-subtlest, #F0F1F2)"}`
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
const StickyToolbar = props => {
|
|
99
|
-
const [top, setTop] = useState(0);
|
|
100
|
-
|
|
101
|
-
// ED-15802: if externalToolbarRef is passed in, set top to externalToolbarRef?.current?.clientHeight
|
|
102
|
-
// else if offsetTop is a number set top to offsetTop
|
|
103
|
-
// otherwise top is 0 as initial state
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
var _props$externalToolba, _props$externalToolba2;
|
|
106
|
-
if ((_props$externalToolba = props.externalToolbarRef) !== null && _props$externalToolba !== void 0 && (_props$externalToolba2 = _props$externalToolba.current) !== null && _props$externalToolba2 !== void 0 && _props$externalToolba2.clientHeight) {
|
|
107
|
-
setTop(props.externalToolbarRef.current.clientHeight);
|
|
108
|
-
} else {
|
|
109
|
-
setTop(props.offsetTop || 0);
|
|
110
|
-
}
|
|
111
|
-
}, [props.externalToolbarRef, props.offsetTop]);
|
|
112
|
-
return (
|
|
113
|
-
// eslint-disable-next-line @atlaskit/design-system/prefer-primitives
|
|
114
|
-
jsx("div", {
|
|
115
|
-
css: [mainToolbarWrapperStyleNew, props.twoLineEditorToolbar && mainToolbarTwoLineStylesNew, mainToolbarWrapperStylesVisualRefresh, stickyToolbarWrapperStyleNew, props.isNewToolbarEnabled && mainToolbarWithPadding, expValEquals('platform_editor_comment_editor_border_radius', 'isEnabled', true) && mainToolbarRadius, !expValEquals('platform_editor_comment_editor_border_radius', 'isEnabled', true) && fg('platform_editor_comments_border_radius') && mainToolbarWithRadiusStyle, props.isEditorModernisationEnabled && editorModernisationToolbarStyle]
|
|
116
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
117
|
-
,
|
|
118
|
-
style: {
|
|
119
|
-
top: `${top}px`
|
|
120
|
-
},
|
|
121
|
-
"data-testid": "ak-editor-main-toolbar"
|
|
122
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
123
|
-
,
|
|
124
|
-
className: 'show-keyline'
|
|
125
|
-
}, props.children)
|
|
126
|
-
);
|
|
127
|
-
};
|
|
128
|
-
const FixedToolbar = props =>
|
|
129
|
-
// eslint-disable-next-line @atlaskit/design-system/prefer-primitives
|
|
130
|
-
jsx("div", {
|
|
131
|
-
css: [mainToolbarWrapperStyleNew, props.twoLineEditorToolbar && mainToolbarTwoLineStylesNew, mainToolbarWrapperStylesVisualRefresh, props.isNewToolbarEnabled && mainToolbarWithoutLeftPadding, !expValEquals('platform_editor_comment_editor_border_radius', 'isEnabled', true) && fg('platform_editor_comments_border_radius') && mainToolbarWithRadiusStyle, expValEquals('platform_editor_comment_editor_border_radius', 'isEnabled', true) && mainToolbarRadius, props.isEditorModernisationEnabled && editorModernisationToolbarStyle],
|
|
132
|
-
"data-testid": "ak-editor-main-toolbar"
|
|
133
|
-
}, props.children);
|
|
5
|
+
import { FixedToolbarCompiled } from './FixedToolbar-compiled';
|
|
6
|
+
import { FixedToolbarEmotion } from './FixedToolbar-emotion';
|
|
7
|
+
import { StickyToolbarCompiled } from './StickyToolbar-compiled';
|
|
8
|
+
import { StickyToolbarEmotion } from './StickyToolbar-emotion';
|
|
9
|
+
const StickyToolbarMigration = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true), StickyToolbarCompiled, StickyToolbarEmotion);
|
|
10
|
+
const FixedToolbarMigration = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true), FixedToolbarCompiled, FixedToolbarEmotion);
|
|
134
11
|
|
|
135
12
|
/**
|
|
136
13
|
* ED-15802: Scenarios when a sticky bar is used:
|
|
@@ -167,7 +44,7 @@ export const MainToolbar = ({
|
|
|
167
44
|
isNewToolbarEnabled
|
|
168
45
|
}) => {
|
|
169
46
|
if (useStickyToolbar) {
|
|
170
|
-
return
|
|
47
|
+
return /*#__PURE__*/React.createElement(StickyToolbarMigration
|
|
171
48
|
// Ignored via go/ees005
|
|
172
49
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
173
50
|
, _extends({}, getStickyParameters(useStickyToolbar), {
|
|
@@ -176,7 +53,7 @@ export const MainToolbar = ({
|
|
|
176
53
|
isNewToolbarEnabled: isNewToolbarEnabled
|
|
177
54
|
}), children);
|
|
178
55
|
}
|
|
179
|
-
return
|
|
56
|
+
return /*#__PURE__*/React.createElement(FixedToolbarMigration, {
|
|
180
57
|
isEditorModernisationEnabled: isEditorModernisationEnabled,
|
|
181
58
|
twoLineEditorToolbar: twoLineEditorToolbar,
|
|
182
59
|
isNewToolbarEnabled: isNewToolbarEnabled
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* ToolbarComponentsWrapper-compiled.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
/**
|
|
3
|
+
* Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
|
|
4
|
+
* Used via `componentWithCondition` in `ToolbarInner.tsx`.
|
|
5
|
+
*
|
|
6
|
+
* Cleanup: delete this file once the experiment has shipped.
|
|
7
|
+
*/
|
|
8
|
+
import "./ToolbarComponentsWrapper-compiled.compiled.css";
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
11
|
+
const toolbarComponentsWrapperCompiledStyles = {
|
|
12
|
+
root: "_1e0c1txw _1hm21yb4"
|
|
13
|
+
};
|
|
14
|
+
export const ToolbarComponentsWrapperCompiled = ({
|
|
15
|
+
children,
|
|
16
|
+
'data-vc': dataVc
|
|
17
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
"data-vc": dataVc,
|
|
19
|
+
className: ax([toolbarComponentsWrapperCompiledStyles.root])
|
|
20
|
+
}, children);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Emotion fallback branch of the `platform_editor_core_non_ecc_static_css` experiment.
|
|
7
|
+
* Used via `componentWithCondition` in `ToolbarInner.tsx`.
|
|
8
|
+
*
|
|
9
|
+
* Cleanup: delete this file once the experiment has shipped.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- intentional: emotion fallback for compiled migration
|
|
13
|
+
import { css, jsx } from '@emotion/react';
|
|
14
|
+
import { akEditorMobileMaxWidth } from '@atlaskit/editor-shared-styles';
|
|
15
|
+
const toolbarComponentsWrapperEmotionStyles = css({
|
|
16
|
+
display: 'flex',
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
18
|
+
[`@media (max-width: ${akEditorMobileMaxWidth}px)`]: {
|
|
19
|
+
justifyContent: 'space-between'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export const ToolbarComponentsWrapperEmotion = ({
|
|
23
|
+
children,
|
|
24
|
+
'data-vc': dataVc
|
|
25
|
+
}) => jsx("div", {
|
|
26
|
+
css: toolbarComponentsWrapperEmotionStyles,
|
|
27
|
+
"data-vc": dataVc
|
|
28
|
+
}, children);
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
1
|
import React from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic
|
|
8
|
-
import { css, jsx } from '@emotion/react';
|
|
9
2
|
import isEqual from 'lodash/isEqual';
|
|
10
3
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
justifyContent: 'space-between'
|
|
17
|
-
}
|
|
18
|
-
});
|
|
4
|
+
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
|
+
import { ToolbarComponentsWrapperCompiled } from './ToolbarComponentsWrapper-compiled';
|
|
7
|
+
import { ToolbarComponentsWrapperEmotion } from './ToolbarComponentsWrapper-emotion';
|
|
8
|
+
const ToolbarComponentsWrapperMigration = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true), ToolbarComponentsWrapperCompiled, ToolbarComponentsWrapperEmotion);
|
|
19
9
|
|
|
20
10
|
// Ignored via go/ees005
|
|
21
11
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -48,8 +38,7 @@ export class ToolbarInner extends React.Component {
|
|
|
48
38
|
// Hiding toolbar in SSR until the dependency of screen width is resolved in SSR environment.
|
|
49
39
|
return null;
|
|
50
40
|
}
|
|
51
|
-
return
|
|
52
|
-
css: toolbarComponentsWrapper,
|
|
41
|
+
return /*#__PURE__*/React.createElement(ToolbarComponentsWrapperMigration, {
|
|
53
42
|
"data-vc": "toolbar-inner"
|
|
54
43
|
}, items.map((component, key) => {
|
|
55
44
|
const element = component({
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* ToolbarSizeDetectorWrapper-compiled.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
/**
|
|
3
|
+
* Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
|
|
4
|
+
* Used via `componentWithCondition` in `ToolbarWithSizeDetector.tsx`.
|
|
5
|
+
*
|
|
6
|
+
* Cleanup: delete this file once the experiment has shipped.
|
|
7
|
+
*/
|
|
8
|
+
import "./ToolbarSizeDetectorWrapper-compiled.compiled.css";
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
11
|
+
const toolbarSizeDetectorWrapperCompiledStyles = {
|
|
12
|
+
root: "_1bsb1osq _kqswh2mm"
|
|
13
|
+
};
|
|
14
|
+
export const ToolbarSizeDetectorWrapperCompiled = ({
|
|
15
|
+
children,
|
|
16
|
+
style
|
|
17
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
style: style,
|
|
19
|
+
className: ax([toolbarSizeDetectorWrapperCompiledStyles.root])
|
|
20
|
+
}, children);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Emotion fallback branch of the `platform_editor_core_non_ecc_static_css` experiment.
|
|
7
|
+
* Used via `componentWithCondition` in `ToolbarWithSizeDetector.tsx`.
|
|
8
|
+
*
|
|
9
|
+
* Cleanup: delete this file once the experiment has shipped.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- intentional: emotion fallback for compiled migration
|
|
13
|
+
import { css, jsx } from '@emotion/react';
|
|
14
|
+
const toolbarSizeDetectorWrapperEmotionStyles = css({
|
|
15
|
+
width: '100%',
|
|
16
|
+
position: 'relative'
|
|
17
|
+
});
|
|
18
|
+
export const ToolbarSizeDetectorWrapperEmotion = ({
|
|
19
|
+
children,
|
|
20
|
+
style
|
|
21
|
+
}) => jsx("div", {
|
|
22
|
+
css: toolbarSizeDetectorWrapperEmotionStyles,
|
|
23
|
+
style: style
|
|
24
|
+
}, children);
|
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
1
|
import React, { useMemo } from 'react';
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic
|
|
8
|
-
import { css, jsx } from '@emotion/react';
|
|
9
2
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
10
3
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
4
|
+
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
7
|
import { WidthObserver } from '@atlaskit/width-detector';
|
|
13
8
|
import { isFullPage } from '../../utils/is-full-page';
|
|
14
9
|
import { useElementWidth } from './hooks';
|
|
15
10
|
import { Toolbar } from './Toolbar';
|
|
16
11
|
import { toolbarSizeToWidth, widthToToolbarSize } from './toolbar-size';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
12
|
+
import { ToolbarSizeDetectorWrapperCompiled } from './ToolbarSizeDetectorWrapper-compiled';
|
|
13
|
+
import { ToolbarSizeDetectorWrapperEmotion } from './ToolbarSizeDetectorWrapper-emotion';
|
|
14
|
+
const ToolbarSizeDetectorWrapperMigration = componentWithCondition(() => expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true), ToolbarSizeDetectorWrapperCompiled, ToolbarSizeDetectorWrapperEmotion);
|
|
21
15
|
export const ToolbarWithSizeDetector = props => {
|
|
22
16
|
const ref = React.useRef(null);
|
|
23
17
|
const [width, setWidth] = React.useState(undefined);
|
|
@@ -40,14 +34,19 @@ export const ToolbarWithSizeDetector = props => {
|
|
|
40
34
|
return isPreviewPanelResponsivenessEnabled ? 'fit-content' : '254px';
|
|
41
35
|
}
|
|
42
36
|
}, [props.appearance, props.hasMinWidth, props.twoLineEditorToolbar]);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
37
|
+
const memoizedWrapperStyle = useMemo(() => ({
|
|
38
|
+
minWidth: minWidthValue
|
|
39
|
+
}), [minWidthValue]);
|
|
40
|
+
const wrapperStyle = expValEquals('platform_editor_core_non_ecc_static_css', 'isEnabled', true) ? memoizedWrapperStyle : {
|
|
41
|
+
minWidth: minWidthValue
|
|
42
|
+
};
|
|
43
|
+
return /*#__PURE__*/React.createElement(ToolbarSizeDetectorWrapperMigration
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- minWidth is computed dynamically from props.hasMinWidth, props.appearance, props.twoLineEditorToolbar, and the platform_editor_preview_panel_responsiveness experiment, so it cannot be expressed as a static css value.
|
|
45
|
+
, {
|
|
46
|
+
style: wrapperStyle
|
|
47
|
+
}, /*#__PURE__*/React.createElement(WidthObserver, {
|
|
49
48
|
setWidth: setWidth
|
|
50
|
-
}), props.editorView && toolbarSize ?
|
|
49
|
+
}), props.editorView && toolbarSize ? /*#__PURE__*/React.createElement(Toolbar, {
|
|
51
50
|
toolbarSize: toolbarSize,
|
|
52
51
|
items: props.items,
|
|
53
52
|
editorView: props.editorView,
|
|
@@ -63,7 +62,7 @@ export const ToolbarWithSizeDetector = props => {
|
|
|
63
62
|
containerElement: props.containerElement,
|
|
64
63
|
hasMinWidth: props.hasMinWidth,
|
|
65
64
|
twoLineEditorToolbar: props.twoLineEditorToolbar
|
|
66
|
-
}) :
|
|
65
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
67
66
|
ref: ref
|
|
68
67
|
}));
|
|
69
68
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
._2rko12c2{border-radius:var(--ds-radius-medium,6px) var(--ds-radius-medium,6px) 0 0}
|
|
3
|
+
._2rko15b0{border-radius:var(--ds-radius-xlarge,9pt) var(--ds-radius-xlarge,9pt) 0 0}
|
|
4
|
+
._2rko1cku{border-radius:var(--ds-radius-small,3px) var(--ds-radius-small,3px) 0 0}._10ytglyw.show-keyline{box-shadow:none}
|
|
5
|
+
._16qsglyw{box-shadow:none}
|
|
6
|
+
._19bvu2gc{padding-left:var(--ds-space-100,8px)}
|
|
7
|
+
._19bvv47k{padding-left:var(--ds-space-250,20px)}
|
|
8
|
+
._1cuzidpf .block-type-btn{padding-left:0}
|
|
9
|
+
._1e0c1txw{display:flex}
|
|
10
|
+
._1khpidpf >div>div:first-of-type:not(style){margin-left:0}
|
|
11
|
+
._3pwj1osq span svg{max-width:100%}
|
|
12
|
+
._4cvr1h6o{align-items:center}
|
|
13
|
+
._4t3i1wug{height:auto}
|
|
14
|
+
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
15
|
+
._ca0qu2gc{padding-top:var(--ds-space-100,8px)}
|
|
16
|
+
._kqswh2mm{position:relative}
|
|
17
|
+
._lg5oidpf >div>style:first-of-type+*{margin-left:0}
|
|
18
|
+
._n3tdidpf{padding-bottom:0}
|
|
19
|
+
._u5f3u2gc{padding-right:var(--ds-space-100,8px)}
|
|
20
|
+
@media (max-width:490px){._1q27esu3>div>div:first-of-type>div:nth-of-type(2){justify-content:flex-end}._16ec1txw>div>div:first-of-type>div:nth-of-type(2){display:flex}._1uq61sxn>div{flex-direction:column-reverse}._cnpmh9n0>div{align-items:end}._1djy1txw>div{display:flex}._17mgesu3>div{justify-content:flex-end}}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* FixedToolbar-compiled.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
/**
|
|
3
|
+
* Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
|
|
4
|
+
* Used via `componentWithCondition` in `Toolbar.tsx`.
|
|
5
|
+
*
|
|
6
|
+
* Cleanup: delete this file once the experiment has shipped.
|
|
7
|
+
*/
|
|
8
|
+
import "./FixedToolbar-compiled.compiled.css";
|
|
9
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
|
+
var MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT = 490;
|
|
14
|
+
var fixedToolbarCompiledStyles = {
|
|
15
|
+
mainToolbarWrapper: "_kqswh2mm _4cvr1h6o _ca0qu2gc _u5f3u2gc _n3tdidpf _19bvv47k _1e0c1txw _4t3i1wug _bfhkvuon _16qsglyw _1khpidpf _lg5oidpf _1cuzidpf",
|
|
16
|
+
mainToolbarWithoutLeftPadding: "_ca0qu2gc _u5f3u2gc _n3tdidpf _19bvu2gc",
|
|
17
|
+
mainToolbarTwoLine: "_1uq61sxn _cnpmh9n0 _1djy1txw _17mgesu3 _1q27esu3 _16ec1txw",
|
|
18
|
+
mainToolbarWrapperVisualRefresh: "_3pwj1osq",
|
|
19
|
+
mainToolbarWithRadius: "_2rko1cku",
|
|
20
|
+
mainToolbarRadius: "_2rko12c2",
|
|
21
|
+
editorModernisationToolbar: "_2rko15b0 _10ytglyw"
|
|
22
|
+
};
|
|
23
|
+
export var FixedToolbarCompiled = function FixedToolbarCompiled(props) {
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
"data-testid": "ak-editor-main-toolbar",
|
|
26
|
+
className: ax([fixedToolbarCompiledStyles.mainToolbarWrapper, props.twoLineEditorToolbar && fixedToolbarCompiledStyles.mainToolbarTwoLine, fixedToolbarCompiledStyles.mainToolbarWrapperVisualRefresh, props.isNewToolbarEnabled && fixedToolbarCompiledStyles.mainToolbarWithoutLeftPadding, !expValEquals('platform_editor_comment_editor_border_radius', 'isEnabled', true) && fg('platform_editor_comments_border_radius') && fixedToolbarCompiledStyles.mainToolbarWithRadius, expValEquals('platform_editor_comment_editor_border_radius', 'isEnabled', true) && fixedToolbarCompiledStyles.mainToolbarRadius, props.isEditorModernisationEnabled && fixedToolbarCompiledStyles.editorModernisationToolbar])
|
|
27
|
+
}, props.children);
|
|
28
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Emotion fallback branch of the `platform_editor_core_non_ecc_static_css` experiment.
|
|
8
|
+
* Used via `componentWithCondition` in `Toolbar.tsx`.
|
|
9
|
+
*
|
|
10
|
+
* Cleanup: delete this file once the experiment has shipped.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- intentional: emotion fallback for compiled migration
|
|
14
|
+
import { css, jsx } from '@emotion/react';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
|
+
var MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT = 490;
|
|
18
|
+
var mainToolbarWrapperStyleNew = css({
|
|
19
|
+
position: 'relative',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
padding: "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-100, 8px)", " 0"),
|
|
22
|
+
display: 'flex',
|
|
23
|
+
height: 'auto',
|
|
24
|
+
backgroundColor: "var(--ds-surface, #FFFFFF)",
|
|
25
|
+
boxShadow: 'none',
|
|
26
|
+
paddingLeft: "var(--ds-space-250, 20px)",
|
|
27
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
28
|
+
'> div': {
|
|
29
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
30
|
+
'> div:first-of-type:not(style), > style:first-of-type + *': {
|
|
31
|
+
marginLeft: 0
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
35
|
+
'.block-type-btn': {
|
|
36
|
+
paddingLeft: 0
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/** keep default padding for entire toolbar */
|
|
41
|
+
var mainToolbarWithoutLeftPadding = css({
|
|
42
|
+
padding: "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-100, 8px)", " 0")
|
|
43
|
+
});
|
|
44
|
+
var mainToolbarTwoLineStylesNew = css({
|
|
45
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
46
|
+
'& > div': _defineProperty(_defineProperty({}, "@media (max-width: ".concat(MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT, "px)"), {
|
|
47
|
+
flexDirection: 'column-reverse',
|
|
48
|
+
alignItems: 'end',
|
|
49
|
+
display: 'flex',
|
|
50
|
+
justifyContent: 'flex-end'
|
|
51
|
+
}), '> div:first-of-type', _defineProperty({}, "@media (max-width: ".concat(MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT, "px)"), {
|
|
52
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
53
|
+
'> div:nth-of-type(2)': {
|
|
54
|
+
justifyContent: 'flex-end',
|
|
55
|
+
display: 'flex'
|
|
56
|
+
}
|
|
57
|
+
}))
|
|
58
|
+
});
|
|
59
|
+
var mainToolbarWrapperStylesVisualRefresh = css({
|
|
60
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
61
|
+
'span svg': {
|
|
62
|
+
maxWidth: '100%'
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
var mainToolbarWithRadiusStyle = css({
|
|
66
|
+
borderRadius: "var(--ds-radius-small, 3px)".concat(" ", "var(--ds-radius-small, 3px)", " 0 0")
|
|
67
|
+
});
|
|
68
|
+
var mainToolbarRadius = css({
|
|
69
|
+
borderRadius: "var(--ds-radius-medium, 6px)".concat(" ", "var(--ds-radius-medium, 6px)", " 0 0")
|
|
70
|
+
});
|
|
71
|
+
var editorModernisationToolbarStyle = css({
|
|
72
|
+
borderRadius: "var(--ds-radius-xlarge, 12px)".concat(" ", "var(--ds-radius-xlarge, 12px)", " 0 0"),
|
|
73
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
74
|
+
'&.show-keyline': {
|
|
75
|
+
boxShadow: 'none'
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
export var FixedToolbarEmotion = function FixedToolbarEmotion(props) {
|
|
79
|
+
return (
|
|
80
|
+
// eslint-disable-next-line @atlaskit/design-system/prefer-primitives
|
|
81
|
+
jsx("div", {
|
|
82
|
+
css: [mainToolbarWrapperStyleNew, props.twoLineEditorToolbar && mainToolbarTwoLineStylesNew, mainToolbarWrapperStylesVisualRefresh, props.isNewToolbarEnabled && mainToolbarWithoutLeftPadding, !expValEquals('platform_editor_comment_editor_border_radius', 'isEnabled', true) && fg('platform_editor_comments_border_radius') && mainToolbarWithRadiusStyle, expValEquals('platform_editor_comment_editor_border_radius', 'isEnabled', true) && mainToolbarRadius, props.isEditorModernisationEnabled && editorModernisationToolbarStyle],
|
|
83
|
+
"data-testid": "ak-editor-main-toolbar"
|
|
84
|
+
}, props.children)
|
|
85
|
+
);
|
|
86
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
._2rko12c2{border-radius:var(--ds-radius-medium,6px) var(--ds-radius-medium,6px) 0 0}
|
|
3
|
+
._2rko15b0{border-radius:var(--ds-radius-xlarge,9pt) var(--ds-radius-xlarge,9pt) 0 0}
|
|
4
|
+
._2rko1cku{border-radius:var(--ds-radius-small,3px) var(--ds-radius-small,3px) 0 0}
|
|
5
|
+
._v56416gf{transition:box-shadow .2s ease-in-out}._10ytglyw.show-keyline{box-shadow:none}
|
|
6
|
+
._10ytl2q5.show-keyline{box-shadow:0 2px 0 0 var(--ds-background-accent-gray-subtlest,#f0f1f2)}
|
|
7
|
+
._16qsglyw{box-shadow:none}
|
|
8
|
+
._19bvu2gc{padding-left:var(--ds-space-100,8px)}
|
|
9
|
+
._19bvv47k{padding-left:var(--ds-space-250,20px)}
|
|
10
|
+
._1cuzidpf .block-type-btn{padding-left:0}
|
|
11
|
+
._1e0c1txw{display:flex}
|
|
12
|
+
._1khpidpf >div>div:first-of-type:not(style){margin-left:0}
|
|
13
|
+
._1pbybfng{z-index:500}
|
|
14
|
+
._3pwj1osq span svg{max-width:100%}
|
|
15
|
+
._4cvr1h6o{align-items:center}
|
|
16
|
+
._4t3i1wug{height:auto}
|
|
17
|
+
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
18
|
+
._ca0qu2gc{padding-top:var(--ds-space-100,8px)}
|
|
19
|
+
._kqsw1if8{position:sticky}
|
|
20
|
+
._kqswh2mm{position:relative}
|
|
21
|
+
._lg5oidpf >div>style:first-of-type+*{margin-left:0}
|
|
22
|
+
._n3tdidpf{padding-bottom:0}
|
|
23
|
+
._n3tdu2gc{padding-bottom:var(--ds-space-100,8px)}
|
|
24
|
+
._u5f3u2gc{padding-right:var(--ds-space-100,8px)}
|
|
25
|
+
@media (max-width:490px){._1q27esu3>div>div:first-of-type>div:nth-of-type(2){justify-content:flex-end}._16ec1txw>div>div:first-of-type>div:nth-of-type(2){display:flex}._1uq61sxn>div{flex-direction:column-reverse}._cnpmh9n0>div{align-items:end}._1djy1txw>div{display:flex}._17mgesu3>div{justify-content:flex-end}}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* StickyToolbar-compiled.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import "./StickyToolbar-compiled.compiled.css";
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
/**
|
|
6
|
+
* Compiled branch of the `platform_editor_core_non_ecc_static_css` experiment.
|
|
7
|
+
* Used via `componentWithCondition` in `Toolbar.tsx`.
|
|
8
|
+
*
|
|
9
|
+
* Cleanup: delete this file once the experiment has shipped.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
|
+
var MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT = 490;
|
|
16
|
+
var akEditorMenuZIndex = 500;
|
|
17
|
+
var akEditorToolbarKeylineHeight = 2;
|
|
18
|
+
var stickyToolbarCompiledStyles = {
|
|
19
|
+
mainToolbarWrapper: "_kqswh2mm _4cvr1h6o _ca0qu2gc _u5f3u2gc _n3tdidpf _19bvv47k _1e0c1txw _4t3i1wug _bfhkvuon _16qsglyw _1khpidpf _lg5oidpf _1cuzidpf",
|
|
20
|
+
mainToolbarWithPadding: "_ca0qu2gc _u5f3u2gc _n3tdu2gc _19bvu2gc",
|
|
21
|
+
mainToolbarTwoLine: "_1uq61sxn _cnpmh9n0 _1djy1txw _17mgesu3 _1q27esu3 _16ec1txw",
|
|
22
|
+
mainToolbarWrapperVisualRefresh: "_3pwj1osq",
|
|
23
|
+
mainToolbarWithRadius: "_2rko1cku",
|
|
24
|
+
mainToolbarRadius: "_2rko12c2",
|
|
25
|
+
editorModernisationToolbar: "_2rko15b0 _10ytglyw",
|
|
26
|
+
stickyToolbarWrapper: "_v56416gf _kqsw1if8 _n3tdu2gc _1pbybfng _10ytl2q5"
|
|
27
|
+
};
|
|
28
|
+
export var StickyToolbarCompiled = function StickyToolbarCompiled(props) {
|
|
29
|
+
var _useState = useState(0),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
top = _useState2[0],
|
|
32
|
+
setTop = _useState2[1];
|
|
33
|
+
|
|
34
|
+
// ED-15802: if externalToolbarRef is passed in, set top to externalToolbarRef?.current?.clientHeight
|
|
35
|
+
// else if offsetTop is a number set top to offsetTop
|
|
36
|
+
// otherwise top is 0 as initial state
|
|
37
|
+
useEffect(function () {
|
|
38
|
+
var _props$externalToolba;
|
|
39
|
+
if ((_props$externalToolba = props.externalToolbarRef) !== null && _props$externalToolba !== void 0 && (_props$externalToolba = _props$externalToolba.current) !== null && _props$externalToolba !== void 0 && _props$externalToolba.clientHeight) {
|
|
40
|
+
setTop(props.externalToolbarRef.current.clientHeight);
|
|
41
|
+
} else {
|
|
42
|
+
setTop(props.offsetTop || 0);
|
|
43
|
+
}
|
|
44
|
+
}, [props.externalToolbarRef, props.offsetTop]);
|
|
45
|
+
var wrapperStyle = useMemo(function () {
|
|
46
|
+
return {
|
|
47
|
+
top: "".concat(top, "px")
|
|
48
|
+
};
|
|
49
|
+
}, [top]);
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/enforce-style-prop -- top is computed dynamically from externalToolbarRef height / offsetTop and cannot be a static css value
|
|
52
|
+
style: wrapperStyle,
|
|
53
|
+
"data-testid": "ak-editor-main-toolbar"
|
|
54
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
55
|
+
,
|
|
56
|
+
className: ax([stickyToolbarCompiledStyles.mainToolbarWrapper, props.twoLineEditorToolbar && stickyToolbarCompiledStyles.mainToolbarTwoLine, stickyToolbarCompiledStyles.mainToolbarWrapperVisualRefresh, stickyToolbarCompiledStyles.stickyToolbarWrapper, props.isNewToolbarEnabled && stickyToolbarCompiledStyles.mainToolbarWithPadding, expValEquals('platform_editor_comment_editor_border_radius', 'isEnabled', true) && stickyToolbarCompiledStyles.mainToolbarRadius, !expValEquals('platform_editor_comment_editor_border_radius', 'isEnabled', true) && fg('platform_editor_comments_border_radius') && stickyToolbarCompiledStyles.mainToolbarWithRadius, props.isEditorModernisationEnabled && stickyToolbarCompiledStyles.editorModernisationToolbar, 'show-keyline'])
|
|
57
|
+
}, props.children);
|
|
58
|
+
};
|