@atlaskit/editor-core 206.0.2 → 206.1.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 +25 -0
- package/dist/cjs/ui/Appearance/Chromeless.js +12 -4
- package/dist/cjs/ui/Appearance/Comment/Comment.js +9 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +25 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +2 -1
- package/dist/cjs/ui/Appearance/FullPage/StyledComponents.js +1 -18
- package/dist/cjs/ui/ContentStyles/index.js +11 -4
- package/dist/cjs/ui/ContentStyles/layout.js +4 -0
- package/dist/cjs/ui/EditorContentContainer.js +260 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/ui/Appearance/Chromeless.js +9 -3
- package/dist/es2019/ui/Appearance/Comment/Comment.js +7 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +25 -4
- package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +2 -1
- package/dist/es2019/ui/Appearance/FullPage/StyledComponents.js +0 -18
- package/dist/es2019/ui/ContentStyles/index.js +11 -4
- package/dist/es2019/ui/ContentStyles/layout.js +4 -0
- package/dist/es2019/ui/EditorContentContainer.js +624 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/ui/Appearance/Chromeless.js +11 -3
- package/dist/esm/ui/Appearance/Comment/Comment.js +9 -2
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +27 -4
- package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +2 -1
- package/dist/esm/ui/Appearance/FullPage/StyledComponents.js +0 -18
- package/dist/esm/ui/ContentStyles/index.js +11 -4
- package/dist/esm/ui/ContentStyles/layout.js +4 -0
- package/dist/esm/ui/EditorContentContainer.js +251 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/create-universal-preset.d.ts +3 -0
- package/dist/types/presets/universal.d.ts +3 -0
- package/dist/types/presets/useUniversalPreset.d.ts +3 -0
- package/dist/types/ui/Appearance/Chromeless.d.ts +10 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +0 -9
- package/dist/types/ui/ContentStyles/index.d.ts +2 -1
- package/dist/types/ui/EditorContentContainer.d.ts +39 -0
- package/dist/types-ts4.5/create-editor/create-universal-preset.d.ts +3 -0
- package/dist/types-ts4.5/presets/universal.d.ts +3 -0
- package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +3 -0
- package/dist/types-ts4.5/ui/Appearance/Chromeless.d.ts +10 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +0 -9
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/EditorContentContainer.d.ts +39 -0
- package/package.json +6 -7
|
@@ -9,7 +9,10 @@ import React, { Fragment } from 'react';
|
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
11
11
|
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
12
|
+
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
13
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
14
|
import { createEditorContentStyle } from '../ContentStyles';
|
|
15
|
+
import EditorContentContainer from '../EditorContentContainer';
|
|
13
16
|
import PluginSlot from '../PluginSlot';
|
|
14
17
|
import WithFlash from '../WithFlash';
|
|
15
18
|
const chromelessEditorStyles = css({
|
|
@@ -36,8 +39,10 @@ scrollbarStyles, {
|
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
});
|
|
39
|
-
const ContentArea = createEditorContentStyle();
|
|
42
|
+
export const ContentArea = createEditorContentStyle();
|
|
40
43
|
ContentArea.displayName = 'ContentArea';
|
|
44
|
+
const EditorContainer = componentWithCondition(() => editorExperiment('platform_editor_core_static_emotion', true), EditorContentContainer, ContentArea);
|
|
45
|
+
|
|
41
46
|
// Ignored via go/ees005
|
|
42
47
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
43
48
|
export default class Editor extends React.Component {
|
|
@@ -86,12 +91,13 @@ export default class Editor extends React.Component {
|
|
|
86
91
|
})],
|
|
87
92
|
"data-testid": "chromeless-editor",
|
|
88
93
|
ref: ref => this.containerElement = ref
|
|
89
|
-
}, jsx(
|
|
94
|
+
}, jsx(EditorContainer
|
|
90
95
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
91
96
|
, {
|
|
92
97
|
className: "ak-editor-content-area",
|
|
93
98
|
featureFlags: featureFlags,
|
|
94
|
-
viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
99
|
+
viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
|
|
100
|
+
appearance: this.appearance
|
|
95
101
|
}, customContentComponents && 'before' in customContentComponents ? customContentComponents.before : customContentComponents, jsx(PluginSlot, {
|
|
96
102
|
editorView: editorView,
|
|
97
103
|
editorActions: editorActions,
|
|
@@ -17,11 +17,14 @@ import { WidthConsumer, WidthProvider } from '@atlaskit/editor-common/ui';
|
|
|
17
17
|
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
18
18
|
import { tableCommentEditorStyles } from '@atlaskit/editor-plugins/table/ui/common-styles';
|
|
19
19
|
import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
20
|
+
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
21
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
20
22
|
// Ignored via go/ees005
|
|
21
23
|
// eslint-disable-next-line import/no-named-as-default
|
|
22
24
|
import ClickAreaBlock from '../../Addon/ClickAreaBlock';
|
|
23
25
|
import { contentComponentClickWrapper } from '../../Addon/ClickAreaBlock/contentComponentWrapper';
|
|
24
26
|
import { createEditorContentStyle } from '../../ContentStyles';
|
|
27
|
+
import EditorContentContainer from '../../EditorContentContainer';
|
|
25
28
|
import PluginSlot from '../../PluginSlot';
|
|
26
29
|
import { ToolbarWithSizeDetector as Toolbar } from '../../Toolbar/ToolbarWithSizeDetector';
|
|
27
30
|
import WithFlash from '../../WithFlash';
|
|
@@ -73,6 +76,7 @@ const secondaryToolbarStyles = css({
|
|
|
73
76
|
padding: `${"var(--ds-space-150, 12px)"} ${"var(--ds-space-025, 2px)"}`
|
|
74
77
|
});
|
|
75
78
|
const appearance = 'comment';
|
|
79
|
+
const EditorContainer = componentWithCondition(() => editorExperiment('platform_editor_core_static_emotion', true), EditorContentContainer, ContentArea);
|
|
76
80
|
export const CommentEditorWithIntl = props => {
|
|
77
81
|
const {
|
|
78
82
|
editorAPI
|
|
@@ -205,7 +209,7 @@ export const CommentEditorWithIntl = props => {
|
|
|
205
209
|
}, jsx(WidthConsumer, null, ({
|
|
206
210
|
width
|
|
207
211
|
}) => {
|
|
208
|
-
return jsx(
|
|
212
|
+
return jsx(EditorContainer, {
|
|
209
213
|
ref: containerElement,
|
|
210
214
|
css: maxHeight ?
|
|
211
215
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -224,7 +228,8 @@ export const CommentEditorWithIntl = props => {
|
|
|
224
228
|
'less-margin': width < akEditorMobileBreakoutPoint
|
|
225
229
|
}),
|
|
226
230
|
featureFlags: featureFlags,
|
|
227
|
-
viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
231
|
+
viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
|
|
232
|
+
appearance: appearance
|
|
228
233
|
}, customContentComponents && 'before' in customContentComponents ? contentComponentClickWrapper(customContentComponents.before) : contentComponentClickWrapper(customContentComponents), jsx(PluginSlot, {
|
|
229
234
|
editorView: editorView,
|
|
230
235
|
editorActions: editorActions,
|
|
@@ -6,21 +6,41 @@
|
|
|
6
6
|
import React, { useImperativeHandle, useRef } from 'react';
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
-
import { jsx, useTheme } from '@emotion/react';
|
|
9
|
+
import { css, jsx, useTheme } from '@emotion/react';
|
|
10
10
|
import classnames from 'classnames';
|
|
11
11
|
import { injectIntl } from 'react-intl-next';
|
|
12
12
|
import { fullPageMessages as messages } from '@atlaskit/editor-common/messages';
|
|
13
|
+
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
13
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
|
+
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
14
16
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
17
|
// Ignored via go/ees005
|
|
16
18
|
// eslint-disable-next-line import/no-named-as-default
|
|
17
19
|
import ClickAreaBlock from '../../Addon/ClickAreaBlock';
|
|
18
20
|
import { contentComponentClickWrapper } from '../../Addon/ClickAreaBlock/contentComponentWrapper';
|
|
21
|
+
import { createEditorContentStyle } from '../../ContentStyles';
|
|
19
22
|
import { ContextPanel } from '../../ContextPanel';
|
|
23
|
+
import EditorContentContainer from '../../EditorContentContainer';
|
|
20
24
|
import PluginSlot from '../../PluginSlot';
|
|
21
|
-
import { contentArea, contentAreaHeightNoToolbar, contentAreaWrapper, editorContentAreaStyle, editorContentGutterStyle,
|
|
25
|
+
import { contentArea, contentAreaHeightNoToolbar, contentAreaWrapper, editorContentAreaStyle, editorContentGutterStyle, sidebarArea } from './StyledComponents';
|
|
22
26
|
export const CONTENT_AREA_TEST_ID = 'ak-editor-fp-content-area';
|
|
23
27
|
export const EDITOR_CONTAINER = 'ak-editor-container';
|
|
28
|
+
const scrollStyles = css({
|
|
29
|
+
flexGrow: 1,
|
|
30
|
+
height: '100%',
|
|
31
|
+
overflowY: 'scroll',
|
|
32
|
+
position: 'relative',
|
|
33
|
+
display: 'flex',
|
|
34
|
+
flexDirection: 'column',
|
|
35
|
+
scrollBehavior: 'smooth'
|
|
36
|
+
},
|
|
37
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
38
|
+
scrollbarStyles);
|
|
39
|
+
|
|
40
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
41
|
+
const ScrollContainer = createEditorContentStyle(scrollStyles);
|
|
42
|
+
ScrollContainer.displayName = 'ScrollContainer';
|
|
43
|
+
const EditorContainer = componentWithCondition(() => editorExperiment('platform_editor_core_static_emotion', true), EditorContentContainer, ScrollContainer);
|
|
24
44
|
const Content = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
25
45
|
var _contentAreaRef$curre;
|
|
26
46
|
const theme = useTheme();
|
|
@@ -62,14 +82,15 @@ const Content = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
62
82
|
contentAreaWrapper,
|
|
63
83
|
"data-testid": EDITOR_CONTAINER,
|
|
64
84
|
"data-editor-container": 'true'
|
|
65
|
-
}, jsx(
|
|
85
|
+
}, jsx(EditorContainer
|
|
66
86
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
67
87
|
, {
|
|
68
88
|
className: "fabric-editor-popup-scroll-parent",
|
|
69
89
|
featureFlags: props.featureFlags,
|
|
70
90
|
ref: scrollContainerRef,
|
|
71
91
|
viewMode: props === null || props === void 0 ? void 0 : props.viewMode,
|
|
72
|
-
isScrollable: true
|
|
92
|
+
isScrollable: true,
|
|
93
|
+
appearance: props.appearance
|
|
73
94
|
}, jsx(ClickAreaBlock, {
|
|
74
95
|
editorView: props.editorView,
|
|
75
96
|
editorDisabled: props.disabled
|
|
@@ -11,6 +11,7 @@ import { injectIntl } from 'react-intl-next';
|
|
|
11
11
|
import { fullPageMessages as messages } from '@atlaskit/editor-common/messages';
|
|
12
12
|
import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
|
|
13
13
|
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
16
|
import { ToolbarPortalMountPoint, useToolbarPortal } from '../../Toolbar/ToolbarPortal';
|
|
16
17
|
import { ToolbarWithSizeDetector as Toolbar } from '../../Toolbar/ToolbarWithSizeDetector';
|
|
@@ -63,7 +64,7 @@ export const EditorToolbar = /*#__PURE__*/React.memo(props => {
|
|
|
63
64
|
css: customToolbarWrapperStyle
|
|
64
65
|
}, !!props.customPrimaryToolbarComponents && 'before' in props.customPrimaryToolbarComponents ? jsx(BeforePrimaryToolbarWrapper, {
|
|
65
66
|
beforePrimaryToolbarComponents: (_props$customPrimaryT = props.customPrimaryToolbarComponents) === null || _props$customPrimaryT === void 0 ? void 0 : _props$customPrimaryT.before
|
|
66
|
-
}) : null, editorAPI !== null && editorAPI !== void 0 && editorAPI.findReplace && twoLineEditorToolbar ? editorAPI === null || editorAPI === void 0 ? void 0 : editorAPI.findReplace.actions.registerToolbarButton({
|
|
67
|
+
}) : null, !(editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_find_and_replace_duplication')) && editorAPI !== null && editorAPI !== void 0 && editorAPI.findReplace && twoLineEditorToolbar ? editorAPI === null || editorAPI === void 0 ? void 0 : editorAPI.findReplace.actions.registerToolbarButton({
|
|
67
68
|
popupsBoundariesElement: props.popupsBoundariesElement,
|
|
68
69
|
popupsMountPoint: popupsMountPoint,
|
|
69
70
|
popupsScrollableElement: props.popupsScrollableElement,
|
|
@@ -4,11 +4,8 @@ import { decisionListSelector, taskListSelector } from '@atlaskit/adf-schema';
|
|
|
4
4
|
import { tableFullPageEditorStyles } from '@atlaskit/editor-plugins/table/ui/common-styles';
|
|
5
5
|
import { tableMarginFullWidthMode } from '@atlaskit/editor-plugins/table/ui/consts';
|
|
6
6
|
import { FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorSwoopCubicBezier, akLayoutGutterOffset } from '@atlaskit/editor-shared-styles';
|
|
7
|
-
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
8
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
|
-
import { createEditorContentStyle } from '../../ContentStyles';
|
|
11
|
-
|
|
12
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
13
10
|
const SWOOP_ANIMATION = `0.5s ${akEditorSwoopCubicBezier}`;
|
|
14
11
|
const getTotalPadding = () => akEditorGutterPaddingDynamic() * 2;
|
|
@@ -21,21 +18,6 @@ export const fullPageEditorWrapper = css({
|
|
|
21
18
|
flexDirection: 'column',
|
|
22
19
|
boxSizing: 'border-box'
|
|
23
20
|
});
|
|
24
|
-
const scrollStyles = css({
|
|
25
|
-
flexGrow: 1,
|
|
26
|
-
height: '100%',
|
|
27
|
-
overflowY: 'scroll',
|
|
28
|
-
position: 'relative',
|
|
29
|
-
display: 'flex',
|
|
30
|
-
flexDirection: 'column',
|
|
31
|
-
scrollBehavior: 'smooth'
|
|
32
|
-
},
|
|
33
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
34
|
-
scrollbarStyles);
|
|
35
|
-
|
|
36
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
37
|
-
export const ScrollContainer = createEditorContentStyle(scrollStyles);
|
|
38
|
-
ScrollContainer.displayName = 'ScrollContainer';
|
|
39
21
|
|
|
40
22
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
41
23
|
export const contentArea = () => {
|
|
@@ -299,7 +299,12 @@ export const fixBlockControlStylesSSR = () => {
|
|
|
299
299
|
|
|
300
300
|
// The breakpoint for small devices is 1266px, copied from getBreakpoint in platform/packages/editor/editor-common/src/ui/WidthProvider/index.tsx
|
|
301
301
|
const akEditorBreakpointForSmallDevice = `1266px`;
|
|
302
|
-
|
|
302
|
+
|
|
303
|
+
// We are going to deprecate this in near future
|
|
304
|
+
// Currently, we are migrating content styles in packages/editor/editor-core/src/ui/EditorContentContainer.tsx
|
|
305
|
+
// Under editor experiment platform_editor_core_static_emotion
|
|
306
|
+
// If you are making changes to this file, please make sure to update in EditorContentContainer.tsx as well
|
|
307
|
+
const legacyContentStyles = props => css`
|
|
303
308
|
--ak-editor--default-gutter-padding: ${akEditorGutterPadding}px;
|
|
304
309
|
/* 52 is from akEditorGutterPaddingDynamic via editor-shared-styles */
|
|
305
310
|
--ak-editor--large-gutter-padding: ${akEditorGutterPaddingDynamic()}px;
|
|
@@ -545,7 +550,7 @@ export const createEditorContentStyle = styles => {
|
|
|
545
550
|
colorMode,
|
|
546
551
|
typography
|
|
547
552
|
} = useThemeObserver();
|
|
548
|
-
const memoizedStyle = useMemo(() =>
|
|
553
|
+
const memoizedStyle = useMemo(() => legacyContentStyles({
|
|
549
554
|
theme,
|
|
550
555
|
colorMode,
|
|
551
556
|
featureFlags,
|
|
@@ -558,14 +563,16 @@ export const createEditorContentStyle = styles => {
|
|
|
558
563
|
className: className,
|
|
559
564
|
ref: ref,
|
|
560
565
|
css: [memoizedStyle, styles],
|
|
561
|
-
"data-editor-scroll-container": "true"
|
|
566
|
+
"data-editor-scroll-container": "true",
|
|
567
|
+
"data-testid": "editor-content-container"
|
|
562
568
|
}, children);
|
|
563
569
|
}
|
|
564
570
|
return jsx("div", {
|
|
565
571
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
566
572
|
className: className,
|
|
567
573
|
ref: ref,
|
|
568
|
-
css: [memoizedStyle, styles]
|
|
574
|
+
css: [memoizedStyle, styles],
|
|
575
|
+
"data-testid": "editor-content-container"
|
|
569
576
|
}, children);
|
|
570
577
|
});
|
|
571
578
|
};
|
|
@@ -165,6 +165,8 @@ const rowSeparatorStyles = viewMode => css`
|
|
|
165
165
|
height: unset;
|
|
166
166
|
}
|
|
167
167
|
`;
|
|
168
|
+
|
|
169
|
+
// jest warning: JSDOM version (22) doesn't support the new @container CSS rule
|
|
168
170
|
const layoutWithSeparatorBorderResponsiveStyles = (breakpoint, viewMode
|
|
169
171
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
170
172
|
) => css`
|
|
@@ -219,6 +221,8 @@ const layoutWithSeparatorBorderStyles = viewMode => {
|
|
|
219
221
|
}
|
|
220
222
|
`;
|
|
221
223
|
};
|
|
224
|
+
|
|
225
|
+
// jest warning: JSDOM version (22) doesn't support the new @container CSS rule
|
|
222
226
|
const layoutResponsiveStyles = viewMode =>
|
|
223
227
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
224
228
|
css`
|