@atlaskit/editor-core 213.5.5 → 213.6.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 +26 -0
- package/dist/cjs/ui/Appearance/Comment/Comment.js +5 -12
- package/dist/cjs/ui/Appearance/Comment/Toolbar.js +5 -24
- package/dist/cjs/ui/Appearance/FullPage/CustomToolbarWrapper.js +5 -42
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +15 -137
- package/dist/cjs/ui/Appearance/FullPage/MainToolbar.js +1 -55
- package/dist/cjs/ui/Appearance/FullPage/MainToolbarWrapper.js +2 -31
- package/dist/cjs/ui/Appearance/FullPage/StyledComponents.js +1 -25
- package/dist/cjs/ui/Toolbar/ToolbarWithSizeDetector.js +4 -70
- package/dist/cjs/utils/validateNodes.js +1 -46
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/ui/Appearance/Comment/Comment.js +1 -23
- package/dist/es2019/ui/Appearance/Comment/Toolbar.js +2 -72
- package/dist/es2019/ui/Appearance/FullPage/CustomToolbarWrapper.js +3 -34
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +17 -135
- package/dist/es2019/ui/Appearance/FullPage/MainToolbar.js +1 -58
- package/dist/es2019/ui/Appearance/FullPage/MainToolbarWrapper.js +3 -31
- package/dist/es2019/ui/Appearance/FullPage/StyledComponents.js +0 -24
- package/dist/es2019/ui/Toolbar/ToolbarWithSizeDetector.js +3 -65
- package/dist/es2019/utils/validateNodes.js +1 -43
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/ui/Appearance/Comment/Comment.js +1 -11
- package/dist/esm/ui/Appearance/Comment/Toolbar.js +2 -23
- package/dist/esm/ui/Appearance/FullPage/CustomToolbarWrapper.js +5 -42
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +17 -139
- package/dist/esm/ui/Appearance/FullPage/MainToolbar.js +1 -55
- package/dist/esm/ui/Appearance/FullPage/MainToolbarWrapper.js +3 -32
- package/dist/esm/ui/Appearance/FullPage/StyledComponents.js +0 -24
- package/dist/esm/ui/Toolbar/ToolbarWithSizeDetector.js +4 -70
- package/dist/esm/utils/validateNodes.js +1 -47
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/ui/Appearance/FullPage/CustomToolbarWrapper.d.ts +3 -2
- package/dist/types/ui/Appearance/FullPage/MainToolbar.d.ts +0 -1
- package/dist/types/ui/Appearance/FullPage/MainToolbarWrapper.d.ts +2 -8
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +0 -1
- package/dist/types/ui/Toolbar/ToolbarWithSizeDetector.d.ts +2 -6
- package/dist/types-ts4.5/ui/Appearance/FullPage/CustomToolbarWrapper.d.ts +3 -2
- package/dist/types-ts4.5/ui/Appearance/FullPage/MainToolbar.d.ts +0 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/MainToolbarWrapper.d.ts +2 -8
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +0 -1
- package/dist/types-ts4.5/ui/Toolbar/ToolbarWithSizeDetector.d.ts +2 -6
- package/package.json +12 -28
|
@@ -1,65 +1,8 @@
|
|
|
1
1
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
|
-
import {
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { akEditorMobileMaxWidth, FULL_PAGE_EDITOR_TOOLBAR_HEIGHT } from '@atlaskit/editor-shared-styles';
|
|
5
4
|
export const MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT = 868;
|
|
6
5
|
|
|
7
|
-
// box-shadow is overriden by the mainToolbar
|
|
8
|
-
const mainToolbarWithKeyline = css({
|
|
9
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
10
|
-
boxShadow: `${"var(--ds-shadow-overflow, 0px 0px 8px #091E4228, 0px 0px 1px #091E421e)"}`
|
|
11
|
-
});
|
|
12
|
-
const mainToolbarTwoLineStyle = () => {
|
|
13
|
-
const editorToolbarHeight = FULL_PAGE_EDITOR_TOOLBAR_HEIGHT();
|
|
14
|
-
return css({
|
|
15
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
16
|
-
[`@media (max-width: ${MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT}px)`]: {
|
|
17
|
-
flexWrap: 'wrap',
|
|
18
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
19
|
-
height: `calc(${editorToolbarHeight} * 2)`
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
const flexibleIconSize = css({
|
|
24
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
25
|
-
'& span svg': {
|
|
26
|
-
maxWidth: '100%'
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
const mainToolbar = () => {
|
|
30
|
-
const editorToolbarHeight = FULL_PAGE_EDITOR_TOOLBAR_HEIGHT();
|
|
31
|
-
return css({
|
|
32
|
-
position: 'relative',
|
|
33
|
-
alignItems: 'center',
|
|
34
|
-
boxShadow: 'none',
|
|
35
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
36
|
-
borderBottom: `${"var(--ds-border-width, 1px)"} solid ${"var(--ds-border, #091E4224)"}`,
|
|
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
|
-
transition: `box-shadow 200ms ${akEditorSwoopCubicBezier}`,
|
|
39
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
40
|
-
zIndex: akEditorFloatingDialogZIndex,
|
|
41
|
-
display: 'flex',
|
|
42
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
43
|
-
height: editorToolbarHeight,
|
|
44
|
-
flexShrink: 0,
|
|
45
|
-
backgroundColor: "var(--ds-surface, white)",
|
|
46
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
47
|
-
'& object': {
|
|
48
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
49
|
-
height: '0 !important'
|
|
50
|
-
},
|
|
51
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
52
|
-
[`@media (max-width: ${akEditorMobileMaxWidth}px)`]: {
|
|
53
|
-
display: 'grid',
|
|
54
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
55
|
-
height: `calc(${editorToolbarHeight} * 2)`
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/platform/ensure-feature-flag-registration, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
59
|
-
fg('platform-visual-refresh-icons') && flexibleIconSize);
|
|
60
|
-
};
|
|
61
|
-
export const mainToolbarStyle = (showKeyline, twoLineEditorToolbar) => [mainToolbar, showKeyline && mainToolbarWithKeyline, twoLineEditorToolbar && mainToolbarTwoLineStyle];
|
|
62
|
-
|
|
63
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
64
7
|
export const mainToolbarIconBeforeStyle = css({
|
|
65
8
|
margin: "var(--ds-space-200, 16px)",
|
|
@@ -8,9 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { akEditorFloatingDialogZIndex, akEditorSwoopCubicBezier } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
-
import {
|
|
12
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
|
-
import { mainToolbarStyle as mainToolbarStyleDynamic, MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT } from './MainToolbar';
|
|
11
|
+
import { MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT } from './MainToolbar';
|
|
14
12
|
|
|
15
13
|
// Base styles that don't depend on feature flags
|
|
16
14
|
const baseToolbarStyles = css({
|
|
@@ -52,7 +50,7 @@ const mainToolbarTwoLineStyle = css({
|
|
|
52
50
|
height: `calc(var(--ak-editor-fullpage-toolbar-height) * 2)`
|
|
53
51
|
}
|
|
54
52
|
});
|
|
55
|
-
const
|
|
53
|
+
export const MainToolbarWrapper = ({
|
|
56
54
|
showKeyline,
|
|
57
55
|
twoLineEditorToolbar,
|
|
58
56
|
children,
|
|
@@ -63,30 +61,4 @@ const MainToolbarWrapperNext = ({
|
|
|
63
61
|
css: [baseToolbarStyles, fg('platform-visual-refresh-icons') && flexibleIconSize, showKeyline && mainToolbarWithKeyline, twoLineEditorToolbar && mainToolbarTwoLineStyle],
|
|
64
62
|
"data-testid": testId
|
|
65
63
|
}, children);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Original version of the toolbar wrapper using dynamic styles
|
|
70
|
-
*/
|
|
71
|
-
const MainToolbarWrapperOld = ({
|
|
72
|
-
showKeyline,
|
|
73
|
-
twoLineEditorToolbar,
|
|
74
|
-
children,
|
|
75
|
-
'data-testid': testId
|
|
76
|
-
}) => {
|
|
77
|
-
return jsx("div", {
|
|
78
|
-
css:
|
|
79
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
80
|
-
mainToolbarStyleDynamic(showKeyline, twoLineEditorToolbar),
|
|
81
|
-
"data-testid": testId
|
|
82
|
-
}, children);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Wrapper component for the main toolbar that handles feature flag based styling
|
|
87
|
-
* @example
|
|
88
|
-
* <MainToolbarWrapper showKeyline={true} twoLineEditorToolbar={false}>
|
|
89
|
-
* <ToolbarContent />
|
|
90
|
-
* </MainToolbarWrapper>
|
|
91
|
-
*/
|
|
92
|
-
export const MainToolbarWrapper = componentWithCondition(() => expValEquals('platform_editor_core_static_emotion_non_central', 'isEnabled', true), MainToolbarWrapperNext, MainToolbarWrapperOld);
|
|
64
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
|
-
import { FULL_PAGE_EDITOR_TOOLBAR_HEIGHT, akEditorSwoopCubicBezier } from '@atlaskit/editor-shared-styles';
|
|
4
3
|
|
|
5
4
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
6
5
|
export const fullPageEditorWrapper = css({
|
|
@@ -11,29 +10,6 @@ export const fullPageEditorWrapper = css({
|
|
|
11
10
|
boxSizing: 'border-box'
|
|
12
11
|
});
|
|
13
12
|
|
|
14
|
-
// delete when cleaning up experiment `platform_editor_core_static_emotion_non_central`
|
|
15
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
16
|
-
export const contentArea = () => {
|
|
17
|
-
const editorToolbarHeight = FULL_PAGE_EDITOR_TOOLBAR_HEIGHT();
|
|
18
|
-
return css({
|
|
19
|
-
display: 'flex',
|
|
20
|
-
flexDirection: 'row',
|
|
21
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
22
|
-
height: `calc(100% - ${editorToolbarHeight})`,
|
|
23
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
24
|
-
'&.ak-editor-content-area-no-toolbar': {
|
|
25
|
-
// The editor toolbar height is 1px off (from the border) -- so we need to add 1px to the height
|
|
26
|
-
// to match the toolbar height
|
|
27
|
-
height: `calc(100% + 1px)`
|
|
28
|
-
},
|
|
29
|
-
boxSizing: 'border-box',
|
|
30
|
-
margin: 0,
|
|
31
|
-
padding: 0,
|
|
32
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
33
|
-
transition: `padding 0ms ${akEditorSwoopCubicBezier}`
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
|
|
37
13
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
38
14
|
export const contentAreaWrapper = css({
|
|
39
15
|
width: '100%',
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
/**
|
|
3
2
|
* @jsxRuntime classic
|
|
4
3
|
* @jsx jsx
|
|
@@ -9,77 +8,17 @@ import React, { useMemo } from 'react';
|
|
|
9
8
|
import { css, jsx } from '@emotion/react';
|
|
10
9
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
11
10
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
12
|
-
import { akEditorMobileMaxWidth } from '@atlaskit/editor-shared-styles';
|
|
13
|
-
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
14
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
16
12
|
import { WidthObserver } from '@atlaskit/width-detector';
|
|
17
13
|
import { isFullPage } from '../../utils/is-full-page';
|
|
18
14
|
import { useElementWidth } from './hooks';
|
|
19
15
|
import { Toolbar } from './Toolbar';
|
|
20
16
|
import { toolbarSizeToWidth, widthToToolbarSize } from './toolbar-size';
|
|
21
|
-
// Remove when platform_editor_core_static_emotion_non_central is cleaned up
|
|
22
17
|
const toolbar = css({
|
|
23
|
-
width: '100%',
|
|
24
|
-
position: 'relative',
|
|
25
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
26
|
-
[`@media (max-width: ${akEditorMobileMaxWidth}px)`]: {
|
|
27
|
-
gridColumn: '1 / 2',
|
|
28
|
-
gridRow: 2,
|
|
29
|
-
width: 'calc(100% - 30px)',
|
|
30
|
-
margin: `0 ${"var(--ds-space-200, 16px)"}`
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// Rename to toolbar when platform_editor_core_static_emotion_non_central is cleaned up
|
|
35
|
-
const staticToolbar = css({
|
|
36
18
|
width: '100%',
|
|
37
19
|
position: 'relative'
|
|
38
|
-
// The media query below has been commented out as akEditorMobileMaxWidth is 0px and thus the styles are never applied.
|
|
39
|
-
// [`@media (max-width: ${akEditorMobileMaxWidth}px)`]: {
|
|
40
|
-
// gridColumn: '1 / 2',
|
|
41
|
-
// gridRow: 2,
|
|
42
|
-
// width: 'calc(100% - 30px)',
|
|
43
|
-
// margin: `0 ${token('space.200', '16px')}`,
|
|
44
|
-
// },
|
|
45
20
|
});
|
|
46
|
-
const
|
|
47
|
-
const ref = React.useRef(null);
|
|
48
|
-
const [width, setWidth] = React.useState(undefined);
|
|
49
|
-
const elementWidth = useElementWidth(ref, {
|
|
50
|
-
skip: typeof width !== 'undefined'
|
|
51
|
-
});
|
|
52
|
-
const defaultToolbarSize = isSSR() && isFullPage(props.appearance) ? ToolbarSize.XXL : undefined;
|
|
53
|
-
const toolbarSize = typeof width === 'undefined' && typeof elementWidth === 'undefined' ? defaultToolbarSize :
|
|
54
|
-
// Ignored via go/ees005
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
56
|
-
widthToToolbarSize(width || elementWidth, props.appearance);
|
|
57
|
-
const toolbarStyle = useMemo(() => {
|
|
58
|
-
const toolbarWidth = isFullPage(props.appearance) && props.twoLineEditorToolbar ? ToolbarSize.S : ToolbarSize.M;
|
|
59
|
-
const toolbarMinWidth = toolbarSizeToWidth(toolbarWidth, props.appearance);
|
|
60
|
-
const isPreviewPanelResponsivenessEnabled = editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
61
|
-
exposure: true
|
|
62
|
-
});
|
|
63
|
-
const minWidth = `min-width: ${props.hasMinWidth ? `${toolbarMinWidth}px` : isPreviewPanelResponsivenessEnabled ? 'fit-content' : '254px'}`;
|
|
64
|
-
return [toolbar, minWidth];
|
|
65
|
-
}, [props.appearance, props.hasMinWidth, props.twoLineEditorToolbar]);
|
|
66
|
-
return (
|
|
67
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
68
|
-
jsx("div", {
|
|
69
|
-
css: toolbarStyle
|
|
70
|
-
}, jsx(WidthObserver, {
|
|
71
|
-
setWidth: setWidth
|
|
72
|
-
}), props.editorView && toolbarSize ?
|
|
73
|
-
// Ignored via go/ees005
|
|
74
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
75
|
-
jsx(Toolbar, _extends({}, props, {
|
|
76
|
-
toolbarSize: toolbarSize
|
|
77
|
-
})) : jsx("div", {
|
|
78
|
-
ref: ref
|
|
79
|
-
}))
|
|
80
|
-
);
|
|
81
|
-
};
|
|
82
|
-
const StaticStyleToolbarWithSizeDetector = props => {
|
|
21
|
+
export const ToolbarWithSizeDetector = props => {
|
|
83
22
|
const ref = React.useRef(null);
|
|
84
23
|
const [width, setWidth] = React.useState(undefined);
|
|
85
24
|
const elementWidth = useElementWidth(ref, {
|
|
@@ -102,7 +41,7 @@ const StaticStyleToolbarWithSizeDetector = props => {
|
|
|
102
41
|
}
|
|
103
42
|
}, [props.appearance, props.hasMinWidth, props.twoLineEditorToolbar]);
|
|
104
43
|
return jsx("div", {
|
|
105
|
-
css:
|
|
44
|
+
css: toolbar,
|
|
106
45
|
style: {
|
|
107
46
|
minWidth: minWidthValue
|
|
108
47
|
}
|
|
@@ -127,5 +66,4 @@ const StaticStyleToolbarWithSizeDetector = props => {
|
|
|
127
66
|
}) : jsx("div", {
|
|
128
67
|
ref: ref
|
|
129
68
|
}));
|
|
130
|
-
};
|
|
131
|
-
export const ToolbarWithSizeDetector = componentWithCondition(() => expValEquals('platform_editor_core_static_emotion_non_central', 'isEnabled', true), StaticStyleToolbarWithSizeDetector, DynamicStyleToolbarWithSizeDetector);
|
|
69
|
+
};
|
|
@@ -1,48 +1,6 @@
|
|
|
1
|
-
import { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
|
-
|
|
4
|
-
// We don't want to use memoize from lodash, because we need to use WeakMap or WeakSet
|
|
5
|
-
// to avoid memory leaks, but lodash allow to change the cache type only globally
|
|
6
|
-
// like `memoize.Cache = WeakMap`, and we don't want to do that.
|
|
7
|
-
// So we use our own cache implementation.
|
|
8
|
-
const cache = new WeakSet();
|
|
9
|
-
|
|
10
|
-
// See https://github.com/ProseMirror/prosemirror-model/blob/20d26c9843d6a69a1d417d937c401537ee0b2342/src/node.ts#L303
|
|
11
|
-
function checkNode(node) {
|
|
12
|
-
if (cache.has(node)) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// @ts-expect-error - This is internal ProseMirror API, but we okay with it
|
|
17
|
-
node.type.checkContent(node.content);
|
|
18
|
-
// @ts-expect-error - This is internal ProseMirror API, but we okay with it
|
|
19
|
-
node.type.checkAttrs(node.attrs);
|
|
20
|
-
let copy = Mark.none;
|
|
21
|
-
for (let i = 0; i < node.marks.length; i++) {
|
|
22
|
-
const mark = node.marks[i];
|
|
23
|
-
// @ts-expect-error - This is internal ProseMirror API, but we okay with it
|
|
24
|
-
mark.type.checkAttrs(mark.attrs);
|
|
25
|
-
copy = mark.addToSet(copy);
|
|
26
|
-
}
|
|
27
|
-
if (!Mark.sameSet(copy, node.marks)) {
|
|
28
|
-
throw new RangeError(`Invalid collection of marks for node ${node.type.name}: ${node.marks.map(m => m.type.name)}`);
|
|
29
|
-
}
|
|
30
|
-
node.content.forEach(node => checkNode(node));
|
|
31
|
-
|
|
32
|
-
// The set value should be added in the end of the function,
|
|
33
|
-
// because any previous check can throw an error,
|
|
34
|
-
// and we don't want to add invalid node to the cache.
|
|
35
|
-
cache.add(node);
|
|
36
|
-
}
|
|
37
1
|
export const validNode = node => {
|
|
38
2
|
try {
|
|
39
|
-
|
|
40
|
-
exposure: true
|
|
41
|
-
})) {
|
|
42
|
-
checkNode(node);
|
|
43
|
-
} else {
|
|
44
|
-
node.check();
|
|
45
|
-
}
|
|
3
|
+
node.check();
|
|
46
4
|
} catch (error) {
|
|
47
5
|
return false;
|
|
48
6
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "213.5.
|
|
2
|
+
export const version = "213.5.6";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
4
|
-
var _templateObject;
|
|
5
3
|
/**
|
|
6
4
|
* @jsxRuntime classic
|
|
7
5
|
* @jsx jsx
|
|
@@ -19,7 +17,6 @@ import messages from '@atlaskit/editor-common/messages';
|
|
|
19
17
|
import { WidthConsumer, WidthProvider } from '@atlaskit/editor-common/ui';
|
|
20
18
|
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
21
19
|
import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
22
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
23
20
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
24
21
|
// Ignored via go/ees005
|
|
25
22
|
// eslint-disable-next-line import/no-named-as-default
|
|
@@ -57,12 +54,6 @@ var secondaryToolbarStyles = css({
|
|
|
57
54
|
display: 'flex',
|
|
58
55
|
padding: "var(--ds-space-150, 12px)".concat(" ", "var(--ds-space-025, 2px)")
|
|
59
56
|
});
|
|
60
|
-
var mainToolbarCustomComponentsSlotStyle = function mainToolbarCustomComponentsSlotStyle() {
|
|
61
|
-
var isTwoLineEditorToolbar = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
62
|
-
return (// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
|
|
63
|
-
css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\tdisplay: flex;\n\t\tjustify-content: flex-end;\n\t\talign-items: center;\n\t\tflex-grow: 1;\n\t\tpadding-right: ", ";\n\t\t> div {\n\t\t\tdisplay: flex;\n\t\t\tflex-shrink: 0;\n\t\t}\n\t\t", "\n\t"])), "var(--ds-space-250, 20px)", isTwoLineEditorToolbar && "\n @media (max-width: ".concat(MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT, "px) {\n {\n padding-right: 0;\n }\n }\n "))
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
57
|
var mainToolbarCustomComponentsSlotStyleNew = css({
|
|
67
58
|
display: 'flex',
|
|
68
59
|
justifyContent: 'flex-end',
|
|
@@ -168,8 +159,7 @@ export var CommentEditorWithIntl = function CommentEditorWithIntl(props) {
|
|
|
168
159
|
primaryToolbarComponents = primaryToolbarState.components.concat(primaryToolbarComponents);
|
|
169
160
|
}
|
|
170
161
|
var customToolbarSlot = jsx("div", {
|
|
171
|
-
css:
|
|
172
|
-
mainToolbarCustomComponentsSlotStyle(isTwoLineToolbarEnabled)
|
|
162
|
+
css: [mainToolbarCustomComponentsSlotStyleNew, isTwoLineToolbarEnabled && mainToolbarCustomComponentsSlotStyleTwoLineToolbarNew]
|
|
173
163
|
}, customPrimaryToolbarComponents);
|
|
174
164
|
var isToolbarAIFCEnabled = Boolean(editorAPI === null || editorAPI === void 0 ? void 0 : editorAPI.toolbar) && editorExperiment('platform_editor_toolbar_aifc', true);
|
|
175
165
|
return jsx(WithFlash, {
|
|
@@ -2,8 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
6
|
-
var _templateObject, _templateObject2;
|
|
7
5
|
/**
|
|
8
6
|
* @jsxRuntime classic
|
|
9
7
|
* @jsx jsx
|
|
@@ -14,15 +12,9 @@ import React, { useEffect, useState } from 'react';
|
|
|
14
12
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
13
|
import { css, jsx } from '@emotion/react';
|
|
16
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
18
15
|
var MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT = 490;
|
|
19
16
|
var akEditorMenuZIndex = 500;
|
|
20
17
|
var akEditorToolbarKeylineHeight = 2;
|
|
21
|
-
var mainToolbarWrapperStyle = function mainToolbarWrapperStyle() {
|
|
22
|
-
var isTwoLineEditorToolbar = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
23
|
-
var isToolbarAifcEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
24
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tposition: relative;\n\talign-items: center;\n\tpadding: ", " ", " 0;\n\tdisplay: flex;\n\theight: auto;\n\tbackground-color: ", ";\n\tbox-shadow: none;\n\t", "\n\n\t& > div {\n\t\t> :first-child:not(style),\n\t\t> style:first-child + * {\n\t\t\tmargin-left: 0;\n\t\t}\n\t\t", "\n\t}\n\n\t.block-type-btn {\n\t\tpadding-left: 0;\n\t}\n\n\t", "\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-surface, white)", isToolbarAifcEnabled ? '' : "padding-left: ".concat("var(--ds-space-250, 20px)", ";"), isTwoLineEditorToolbar && "\n @media (max-width: ".concat(MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT, "px) {\n flex-direction: column-reverse;\n align-items: end;\n display: flex;\n justify-content: flex-end;\n }\n\n /* make this more explicit for a toolbar */\n > *:nth-child(1) {\n @media (max-width: ").concat(MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT, "px) {\n > div:nth-child(2) {\n justify-content: flex-end;\n display: flex;\n }\n }\n }\n "), fg('platform-visual-refresh-icons') && 'span svg { max-width: 100%; }');
|
|
25
|
-
};
|
|
26
18
|
var mainToolbarWrapperStyleNew = css({
|
|
27
19
|
position: 'relative',
|
|
28
20
|
alignItems: 'center',
|
|
@@ -70,11 +62,6 @@ var mainToolbarWrapperStylesVisualRefresh = css({
|
|
|
70
62
|
maxWidth: '100%'
|
|
71
63
|
}
|
|
72
64
|
});
|
|
73
|
-
|
|
74
|
-
/* eslint-enable @atlaskit/platform/ensure-feature-flag-registration */
|
|
75
|
-
|
|
76
|
-
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
77
|
-
var stickyToolbarWrapperStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n\t/* stylelint-disable declaration-block-no-duplicate-properties */\n\tposition: relative;\n\tposition: sticky;\n\t/* stylelint-enable declaration-block-no-duplicate-properties */\n\tpadding-bottom: ", ";\n\tz-index: ", ";\n\ttransition: box-shadow ease-in-out 0.2s;\n\t&.show-keyline {\n\t\tbox-shadow: 0 ", "px 0 0\n\t\t\t", ";\n\t}\n"])), "var(--ds-space-100, 8px)", akEditorMenuZIndex, akEditorToolbarKeylineHeight, "var(--ds-background-accent-gray-subtlest, #F1F2F4)");
|
|
78
65
|
var stickyToolbarWrapperStyleNew = css({
|
|
79
66
|
position: 'sticky',
|
|
80
67
|
paddingBottom: "var(--ds-space-100, 8px)",
|
|
@@ -105,11 +92,7 @@ var StickyToolbar = function StickyToolbar(props) {
|
|
|
105
92
|
return (
|
|
106
93
|
// eslint-disable-next-line @atlaskit/design-system/prefer-primitives
|
|
107
94
|
jsx("div", {
|
|
108
|
-
css:
|
|
109
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
110
|
-
mainToolbarWrapperStyle(props.twoLineEditorToolbar,
|
|
111
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
112
|
-
props.isNewToolbarEnabled), stickyToolbarWrapperStyle]
|
|
95
|
+
css: [mainToolbarWrapperStyleNew, props.twoLineEditorToolbar && mainToolbarTwoLineStylesNew, fg('platform-visual-refresh-icons') && mainToolbarWrapperStylesVisualRefresh, stickyToolbarWrapperStyleNew, props.isNewToolbarEnabled && mainToolbarWithoutLeftPadding]
|
|
113
96
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
114
97
|
,
|
|
115
98
|
style: {
|
|
@@ -126,11 +109,7 @@ var FixedToolbar = function FixedToolbar(props) {
|
|
|
126
109
|
return (
|
|
127
110
|
// eslint-disable-next-line @atlaskit/design-system/prefer-primitives
|
|
128
111
|
jsx("div", {
|
|
129
|
-
css:
|
|
130
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
131
|
-
mainToolbarWrapperStyle(props.twoLineEditorToolbar,
|
|
132
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
133
|
-
props.isNewToolbarEnabled),
|
|
112
|
+
css: [mainToolbarWrapperStyleNew, props.twoLineEditorToolbar && mainToolbarTwoLineStylesNew, fg('platform-visual-refresh-icons') && mainToolbarWrapperStylesVisualRefresh, props.isNewToolbarEnabled && mainToolbarWithoutLeftPadding],
|
|
134
113
|
"data-testid": "ak-editor-main-toolbar"
|
|
135
114
|
}, props.children)
|
|
136
115
|
);
|
|
@@ -6,9 +6,6 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
|
-
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
10
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
|
-
import { mainToolbarFirstChildStyle, mainToolbarSecondChildStyle } from './MainToolbar';
|
|
12
9
|
// Pre-computed static styles for first- and second-child wrappers.
|
|
13
10
|
// These contain no runtime logic and are safe for static-emotion mode.
|
|
14
11
|
|
|
@@ -47,7 +44,7 @@ var secondChildStaticTwoLine = css({
|
|
|
47
44
|
});
|
|
48
45
|
|
|
49
46
|
// ---------------- First child wrapper ----------------
|
|
50
|
-
var
|
|
47
|
+
export var MainToolbarForFirstChildWrapper = function MainToolbarForFirstChildWrapper(_ref) {
|
|
51
48
|
var twoLineEditorToolbar = _ref.twoLineEditorToolbar,
|
|
52
49
|
children = _ref.children,
|
|
53
50
|
role = _ref.role,
|
|
@@ -60,52 +57,18 @@ var FirstChildWrapperStatic = function FirstChildWrapperStatic(_ref) {
|
|
|
60
57
|
"data-testid": testId
|
|
61
58
|
}, children);
|
|
62
59
|
};
|
|
63
|
-
|
|
60
|
+
|
|
61
|
+
// ---------------- Second child wrapper ----------------
|
|
62
|
+
export var MainToolbarForSecondChildWrapper = function MainToolbarForSecondChildWrapper(_ref2) {
|
|
64
63
|
var twoLineEditorToolbar = _ref2.twoLineEditorToolbar,
|
|
65
64
|
children = _ref2.children,
|
|
66
65
|
role = _ref2.role,
|
|
67
66
|
ariaLabel = _ref2['aria-label'],
|
|
68
67
|
testId = _ref2['data-testid'];
|
|
69
|
-
return jsx("div", {
|
|
70
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/design-system/consistent-css-prop-usage
|
|
71
|
-
css: mainToolbarFirstChildStyle(twoLineEditorToolbar),
|
|
72
|
-
role: role,
|
|
73
|
-
"aria-label": ariaLabel,
|
|
74
|
-
"data-testid": testId
|
|
75
|
-
}, children);
|
|
76
|
-
};
|
|
77
|
-
export var MainToolbarForFirstChildWrapper = componentWithCondition(function () {
|
|
78
|
-
return expValEquals('platform_editor_core_static_emotion_non_central', 'isEnabled', true);
|
|
79
|
-
}, FirstChildWrapperStatic, FirstChildWrapperDynamic);
|
|
80
|
-
|
|
81
|
-
// ---------------- Second child wrapper ----------------
|
|
82
|
-
var SecondChildWrapperStatic = function SecondChildWrapperStatic(_ref3) {
|
|
83
|
-
var twoLineEditorToolbar = _ref3.twoLineEditorToolbar,
|
|
84
|
-
children = _ref3.children,
|
|
85
|
-
role = _ref3.role,
|
|
86
|
-
ariaLabel = _ref3['aria-label'],
|
|
87
|
-
testId = _ref3['data-testid'];
|
|
88
68
|
return jsx("div", {
|
|
89
69
|
css: [secondChildStaticBase, twoLineEditorToolbar && secondChildStaticTwoLine],
|
|
90
70
|
role: role,
|
|
91
71
|
"aria-label": ariaLabel,
|
|
92
72
|
"data-testid": testId
|
|
93
73
|
}, children);
|
|
94
|
-
};
|
|
95
|
-
var SecondChildWrapperDynamic = function SecondChildWrapperDynamic(_ref4) {
|
|
96
|
-
var twoLineEditorToolbar = _ref4.twoLineEditorToolbar,
|
|
97
|
-
children = _ref4.children,
|
|
98
|
-
role = _ref4.role,
|
|
99
|
-
ariaLabel = _ref4['aria-label'],
|
|
100
|
-
testId = _ref4['data-testid'];
|
|
101
|
-
return jsx("div", {
|
|
102
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/design-system/consistent-css-prop-usage
|
|
103
|
-
css: mainToolbarSecondChildStyle(twoLineEditorToolbar),
|
|
104
|
-
role: role,
|
|
105
|
-
"aria-label": ariaLabel,
|
|
106
|
-
"data-testid": testId
|
|
107
|
-
}, children);
|
|
108
|
-
};
|
|
109
|
-
export var MainToolbarForSecondChildWrapper = componentWithCondition(function () {
|
|
110
|
-
return expValEquals('platform_editor_core_static_emotion_non_central', 'isEnabled', true);
|
|
111
|
-
}, SecondChildWrapperStatic, SecondChildWrapperDynamic);
|
|
74
|
+
};
|