@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
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
|
|
2
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
3
|
+
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- Requires manual remediation over time due to use of unsafe nested mixins */
|
|
4
|
+
/**
|
|
5
|
+
* @jsxRuntime classic
|
|
6
|
+
* @jsx jsx
|
|
7
|
+
*/
|
|
8
|
+
import React, { useMemo } from 'react';
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
|
+
import { css, jsx, useTheme } from '@emotion/react';
|
|
12
|
+
import { browser } from '@atlaskit/editor-common/browser';
|
|
13
|
+
import { telepointerStyle, telepointerStyleWithInitialOnly } from '@atlaskit/editor-common/collab';
|
|
14
|
+
import { EmojiSharedCssClassName, defaultEmojiHeight } from '@atlaskit/editor-common/emoji';
|
|
15
|
+
import { MentionSharedCssClassName } from '@atlaskit/editor-common/mention';
|
|
16
|
+
import { PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
|
|
17
|
+
import { gapCursorStyles } from '@atlaskit/editor-common/selection';
|
|
18
|
+
import { CodeBlockSharedCssClassName, GRID_GUTTER, MediaSharedClassNames, SmartCardSharedCssClassName, annotationSharedStyles, backgroundColorStyles, blockMarksSharedStyles, codeBlockInListSafariFix, codeMarkSharedStyles, dateSharedStyle, embedCardStyles, expandClassNames, getSmartCardSharedStyles, gridStyles, indentationSharedStyles, linkSharedStyle, listsSharedStyles, paragraphSharedStyles, resizerStyles, ruleSharedStyles, shadowSharedStyle, smartCardSharedStyles, smartCardStyles, tasksAndDecisionsStyles, textColorStyles, unsupportedStyles, whitespaceSharedStyles } from '@atlaskit/editor-common/styles';
|
|
19
|
+
import { blocktypeStyles } from '@atlaskit/editor-plugins/block-type/styles';
|
|
20
|
+
import { findReplaceStyles } from '@atlaskit/editor-plugins/find-replace/styles';
|
|
21
|
+
import { textHighlightStyle } from '@atlaskit/editor-plugins/paste-options-toolbar/styles';
|
|
22
|
+
import { placeholderTextStyles } from '@atlaskit/editor-plugins/placeholder-text/styles';
|
|
23
|
+
import { tableCommentEditorStyles } from '@atlaskit/editor-plugins/table/ui/common-styles';
|
|
24
|
+
import { SelectionStyle, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorDefaultLayoutWidth, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorSelectedBorderColor, akEditorSelectedBorderSize, akEditorSelectedNodeClassName, blockNodesVerticalMargin, editorFontSize, getSelectionStyles } from '@atlaskit/editor-shared-styles';
|
|
25
|
+
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
26
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
27
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
28
|
+
import { useThemeObserver } from '@atlaskit/tokens';
|
|
29
|
+
import { InlineNodeViewSharedStyles } from '../nodeviews/getInlineNodeViewProducer.styles';
|
|
30
|
+
import { aiPanelStyles } from './ContentStyles/ai-panels';
|
|
31
|
+
import { codeBlockStyles } from './ContentStyles/code-block';
|
|
32
|
+
import { dateStyles, dateVanillaStyles } from './ContentStyles/date';
|
|
33
|
+
import { expandStyles } from './ContentStyles/expand';
|
|
34
|
+
import { extensionStyles } from './ContentStyles/extension';
|
|
35
|
+
import { layoutStyles } from './ContentStyles/layout';
|
|
36
|
+
import { mediaStyles } from './ContentStyles/media';
|
|
37
|
+
import { panelStyles } from './ContentStyles/panel';
|
|
38
|
+
import { statusStyles, vanillaStatusStyles } from './ContentStyles/status';
|
|
39
|
+
import { taskDecisionStyles, vanillaTaskDecisionIconWithoutVisualRefresh as vanillaDecisionIconWithoutVisualRefresh, vanillaTaskDecisionIconWithVisualRefresh as vanillaDecisionIconWithVisualRefresh, vanillaTaskDecisionStyles as vanillaDecisionStyles, vanillaTaskItemStyles } from './ContentStyles/tasks-and-decisions';
|
|
40
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
41
|
+
export const linkStyles = css`
|
|
42
|
+
.ProseMirror {
|
|
43
|
+
${linkSharedStyle()}
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
const ruleStyles = () => css`
|
|
47
|
+
.ProseMirror {
|
|
48
|
+
${ruleSharedStyles()};
|
|
49
|
+
|
|
50
|
+
hr {
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
padding: ${"var(--ds-space-050, 4px)"} 0;
|
|
53
|
+
margin: ${"var(--ds-space-300, 24px)"} 0;
|
|
54
|
+
background-clip: content-box;
|
|
55
|
+
|
|
56
|
+
&.${akEditorSelectedNodeClassName} {
|
|
57
|
+
outline: none;
|
|
58
|
+
background-color: ${`var(--ds-border-selected, ${akEditorSelectedBorderColor})`};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
const vanillaMentionsStyles = css({
|
|
64
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
65
|
+
'.editor-mention-primitive': {
|
|
66
|
+
display: 'inline',
|
|
67
|
+
borderRadius: '20px',
|
|
68
|
+
cursor: 'pointer',
|
|
69
|
+
padding: '0 0.3em 2px 0.23em',
|
|
70
|
+
fontWeight: "var(--ds-font-weight-regular, 400)",
|
|
71
|
+
wordBreak: 'break-word',
|
|
72
|
+
background: "var(--ds-background-neutral, #091E420F)",
|
|
73
|
+
border: '1px solid transparent',
|
|
74
|
+
color: "var(--ds-text-subtle, #44546F)",
|
|
75
|
+
'&:hover': {
|
|
76
|
+
background: "var(--ds-background-neutral-hovered, #091E4224)"
|
|
77
|
+
},
|
|
78
|
+
'&:active': {
|
|
79
|
+
background: "var(--ds-background-neutral-pressed, #091E424F)"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
83
|
+
'.editor-mention-primitive.mention-restricted': {
|
|
84
|
+
background: 'transparent',
|
|
85
|
+
border: `1px solid ${"var(--ds-border-bold, #758195)"}`,
|
|
86
|
+
color: "var(--ds-text, #172B4D)",
|
|
87
|
+
'&:hover': {
|
|
88
|
+
background: 'transparent'
|
|
89
|
+
},
|
|
90
|
+
'&:active': {
|
|
91
|
+
background: 'transparent'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
95
|
+
'.editor-mention-primitive.mention-self': {
|
|
96
|
+
background: "var(--ds-background-brand-bold, #0C66E4)",
|
|
97
|
+
border: '1px solid transparent',
|
|
98
|
+
color: "var(--ds-text-inverse, #FFFFFF)",
|
|
99
|
+
'&:hover': {
|
|
100
|
+
background: "var(--ds-background-brand-bold-hovered, #0055CC)"
|
|
101
|
+
},
|
|
102
|
+
'&:active': {
|
|
103
|
+
background: "var(--ds-background-brand-bold-pressed, #09326C)"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
const vanillaSelectionStyles = css`
|
|
108
|
+
.danger {
|
|
109
|
+
.editor-mention-primitive {
|
|
110
|
+
box-shadow: 0 0 0 ${akEditorSelectedBorderSize}px ${akEditorDeleteBorder};
|
|
111
|
+
background-color: ${`var(--ds-background-danger, ${akEditorDeleteBackgroundWithOpacity})`};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.${akEditorSelectedNodeClassName} > .editor-mention-primitive,
|
|
116
|
+
.${akEditorSelectedNodeClassName} > .editor-mention-primitive.mention-self,
|
|
117
|
+
.${akEditorSelectedNodeClassName} > .editor-mention-primitive.mention-restricted {
|
|
118
|
+
${getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Background])}
|
|
119
|
+
/* need to specify dark text colour because personal mentions
|
|
120
|
+
(in dark blue) have white text by default */
|
|
121
|
+
color: ${"var(--ds-text-subtle, #44546F)"}
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
124
|
+
const mentionsStyles = css`
|
|
125
|
+
.${MentionSharedCssClassName.MENTION_CONTAINER} {
|
|
126
|
+
&.${akEditorSelectedNodeClassName} [data-mention-id] > span {
|
|
127
|
+
${getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Background])}
|
|
128
|
+
|
|
129
|
+
/* need to specify dark text colour because personal mentions
|
|
130
|
+
(in dark blue) have white text by default */
|
|
131
|
+
color: ${"var(--ds-text-subtle, #44546F)"};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.danger {
|
|
136
|
+
.${MentionSharedCssClassName.MENTION_CONTAINER}.${akEditorSelectedNodeClassName}
|
|
137
|
+
> span
|
|
138
|
+
> span
|
|
139
|
+
> span {
|
|
140
|
+
box-shadow: 0 0 0 ${akEditorSelectedBorderSize}px ${akEditorDeleteBorder};
|
|
141
|
+
background-color: ${`var(--ds-background-danger, ${akEditorDeleteBackgroundWithOpacity})`};
|
|
142
|
+
}
|
|
143
|
+
.${MentionSharedCssClassName.MENTION_CONTAINER} > span > span > span {
|
|
144
|
+
background-color: ${"var(--ds-background-neutral, #091E420F)"};
|
|
145
|
+
color: ${"var(--ds-text-subtle, #44546F)"};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
`;
|
|
149
|
+
const listsStyles = css`
|
|
150
|
+
.ProseMirror {
|
|
151
|
+
li {
|
|
152
|
+
position: relative;
|
|
153
|
+
|
|
154
|
+
> p:not(:first-child) {
|
|
155
|
+
margin: ${"var(--ds-space-050, 4px)"} 0 0 0;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// In SSR the above rule will apply to all p tags because first-child would be a style tag.
|
|
159
|
+
// The following rule resets the first p tag back to its original margin
|
|
160
|
+
// defined in packages/editor/editor-common/src/styles/shared/paragraph.ts
|
|
161
|
+
> style:first-child + p {
|
|
162
|
+
margin-top: ${blockNodesVerticalMargin};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&:not([data-node-type='decisionList']) > li,
|
|
167
|
+
// This prevents https://product-fabric.atlassian.net/browse/ED-20924
|
|
168
|
+
&:not(.${SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER}) > li {
|
|
169
|
+
${browser.safari ? codeBlockInListSafariFix : ''}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
`;
|
|
173
|
+
const reactEmojiStyles = css`
|
|
174
|
+
.${EmojiSharedCssClassName.EMOJI_CONTAINER} {
|
|
175
|
+
display: inline-block;
|
|
176
|
+
|
|
177
|
+
.${EmojiSharedCssClassName.EMOJI_NODE} {
|
|
178
|
+
cursor: pointer;
|
|
179
|
+
|
|
180
|
+
&.${EmojiSharedCssClassName.EMOJI_IMAGE} > span {
|
|
181
|
+
/** needed for selection style to cover custom emoji image properly */
|
|
182
|
+
display: flex;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&.${akEditorSelectedNodeClassName} {
|
|
187
|
+
.${EmojiSharedCssClassName.EMOJI_SPRITE}, .${EmojiSharedCssClassName.EMOJI_IMAGE} {
|
|
188
|
+
border-radius: 2px;
|
|
189
|
+
${getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.BoxShadow])}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
`;
|
|
194
|
+
const emojiStyles = css`
|
|
195
|
+
[data-prosemirror-node-view-type='vanilla'] {
|
|
196
|
+
.${EmojiSharedCssClassName.EMOJI_CONTAINER} {
|
|
197
|
+
display: inline-block;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.${EmojiSharedCssClassName.EMOJI_SPRITE}, .${EmojiSharedCssClassName.EMOJI_IMAGE} {
|
|
201
|
+
background: no-repeat transparent;
|
|
202
|
+
display: inline-block;
|
|
203
|
+
height: ${defaultEmojiHeight}px;
|
|
204
|
+
max-height: ${defaultEmojiHeight}px;
|
|
205
|
+
cursor: pointer;
|
|
206
|
+
vertical-align: middle;
|
|
207
|
+
user-select: all;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&.${akEditorSelectedNodeClassName} {
|
|
211
|
+
.${EmojiSharedCssClassName.EMOJI_SPRITE}, .${EmojiSharedCssClassName.EMOJI_IMAGE} {
|
|
212
|
+
border-radius: 2px;
|
|
213
|
+
${getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.BoxShadow])}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
`;
|
|
218
|
+
|
|
219
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
220
|
+
export const placeholderStyles = css({
|
|
221
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
222
|
+
'.ProseMirror .placeholder-decoration': {
|
|
223
|
+
color: "var(--ds-text-subtlest, #626F86)",
|
|
224
|
+
width: '100%',
|
|
225
|
+
pointerEvents: 'none',
|
|
226
|
+
userSelect: 'none',
|
|
227
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
228
|
+
'.placeholder-android': {
|
|
229
|
+
pointerEvents: 'none',
|
|
230
|
+
outline: 'none',
|
|
231
|
+
userSelect: 'none',
|
|
232
|
+
position: 'absolute'
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
const placeholderOverflowStyles = css({
|
|
237
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
238
|
+
'.ProseMirror p:has(.placeholder-decoration-hide-overflow)': {
|
|
239
|
+
overflow: 'hidden',
|
|
240
|
+
whiteSpace: 'nowrap',
|
|
241
|
+
textOverflow: 'ellipsis'
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
const placeholderWrapStyles = css({
|
|
245
|
+
// As part of controls work, we add placeholder `Search` to quick insert command
|
|
246
|
+
// This style is to prevent `/Search` being wrapped if it's triggered at the end of the line
|
|
247
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
248
|
+
'.ProseMirror mark[data-type-ahead-query="true"]:has(.placeholder-decoration-wrap)': {
|
|
249
|
+
whiteSpace: 'nowrap'
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
const firstBlockNodeStyles = css`
|
|
253
|
+
.ProseMirror {
|
|
254
|
+
> .${PanelSharedCssClassName.prefix},
|
|
255
|
+
> .${CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER},
|
|
256
|
+
> .${SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER},
|
|
257
|
+
> div[data-task-list-local-id],
|
|
258
|
+
> div[data-layout-section],
|
|
259
|
+
> .${expandClassNames.prefix} {
|
|
260
|
+
&:first-child {
|
|
261
|
+
margin-top: 0;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
> hr:first-of-type {
|
|
266
|
+
margin-top: 0;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
`;
|
|
270
|
+
const firstBlockNodeStylesNew = css`
|
|
271
|
+
.ProseMirror {
|
|
272
|
+
> .${PanelSharedCssClassName.prefix},
|
|
273
|
+
> .${CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER},
|
|
274
|
+
> .${SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER},
|
|
275
|
+
> div[data-task-list-local-id],
|
|
276
|
+
> div[data-layout-section],
|
|
277
|
+
> .${expandClassNames.prefix} {
|
|
278
|
+
&:first-child {
|
|
279
|
+
margin-top: 0;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
> hr:first-child,
|
|
284
|
+
> .ProseMirror-widget:first-child + hr {
|
|
285
|
+
margin-top: 0;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
`;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* fix layout issue of first block node
|
|
292
|
+
*/
|
|
293
|
+
export const fixBlockControlStylesSSR = () => {
|
|
294
|
+
if (fg('platform_editor_element_dnd_nested_fix_patch_6')) {
|
|
295
|
+
return firstBlockNodeStylesNew;
|
|
296
|
+
}
|
|
297
|
+
return firstBlockNodeStyles;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// The breakpoint for small devices is 1266px, copied from getBreakpoint in platform/packages/editor/editor-common/src/ui/WidthProvider/index.tsx
|
|
301
|
+
const akEditorBreakpointForSmallDevice = `1266px`;
|
|
302
|
+
|
|
303
|
+
// jest warning: JSDOM version (22) doesn't support the new @container CSS rule
|
|
304
|
+
const contentStyles = props => css`
|
|
305
|
+
--ak-editor--default-gutter-padding: ${akEditorGutterPadding}px;
|
|
306
|
+
/* 52 is from akEditorGutterPaddingDynamic via editor-shared-styles */
|
|
307
|
+
--ak-editor--large-gutter-padding: ${akEditorGutterPaddingDynamic()}px;
|
|
308
|
+
--ak-editor--default-layout-width: ${akEditorDefaultLayoutWidth}px;
|
|
309
|
+
--ak-editor--full-width-layout-width: ${akEditorFullWidthLayoutWidth}px;
|
|
310
|
+
/* calculate editor line length, 100cqw is the editor container width */
|
|
311
|
+
--ak-editor--line-length: min(
|
|
312
|
+
calc(100cqw - var(--ak-editor--large-gutter-padding) * 2),
|
|
313
|
+
var(--ak-editor--default-layout-width)
|
|
314
|
+
);
|
|
315
|
+
--ak-editor--breakout-wide-layout-width: ${akEditorCalculatedWideLayoutWidthSmallViewport}px;
|
|
316
|
+
--ak-editor--breakout-full-page-guttering-padding: calc(
|
|
317
|
+
var(--ak-editor--large-gutter-padding) * 2 + var(--ak-editor--default-gutter-padding)
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
.fabric-editor--full-width-mode {
|
|
321
|
+
--ak-editor--line-length: min(
|
|
322
|
+
calc(100cqw - var(--ak-editor--large-gutter-padding) * 2),
|
|
323
|
+
var(--ak-editor--full-width-layout-width)
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.ProseMirror {
|
|
328
|
+
--ak-editor-max-container-width: calc(100cqw - var(--ak-editor--large-gutter-padding));
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/* We can't allow nodes that are inside other nodes to bleed from the parent container */
|
|
332
|
+
.ProseMirror > div[data-prosemirror-node-block] [data-prosemirror-node-block] {
|
|
333
|
+
--ak-editor-max-container-width: 100%;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/* container editor-area is defined in platform/packages/editor/editor-core/src/ui/Appearance/FullPage/StyledComponents.ts */
|
|
337
|
+
@container editor-area (width >= ${akEditorBreakpointForSmallDevice}) {
|
|
338
|
+
.ProseMirror {
|
|
339
|
+
--ak-editor--breakout-wide-layout-width: ${akEditorCalculatedWideLayoutWidth}px;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.ProseMirror {
|
|
344
|
+
outline: none;
|
|
345
|
+
font-size: ${editorFontSize({
|
|
346
|
+
theme: props.theme
|
|
347
|
+
})}px;
|
|
348
|
+
${whitespaceSharedStyles};
|
|
349
|
+
${paragraphSharedStyles(props.typographyTheme)};
|
|
350
|
+
${listsSharedStyles};
|
|
351
|
+
${indentationSharedStyles};
|
|
352
|
+
${shadowSharedStyle};
|
|
353
|
+
${InlineNodeViewSharedStyles};
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
${fg('editor_request_to_edit_task') ? null : css`
|
|
357
|
+
.ProseMirror[contenteditable='false'] .taskItemView-content-wrap {
|
|
358
|
+
pointer-events: none;
|
|
359
|
+
opacity: 0.7;
|
|
360
|
+
}
|
|
361
|
+
`}
|
|
362
|
+
|
|
363
|
+
.ProseMirror-hideselection *::selection {
|
|
364
|
+
background: transparent;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
368
|
+
background: transparent;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* This prosemirror css style: https://github.com/ProseMirror/prosemirror-view/blob/f37ebb29befdbde3cd194fe13fe17b78e743d2f2/style/prosemirror.css#L24
|
|
373
|
+
*
|
|
374
|
+
* 1. Merge and Release platform_editor_hide_cursor_when_pm_hideselection
|
|
375
|
+
* 2. Cleanup duplicated style from platform_editor_advanced_code_blocks
|
|
376
|
+
* https://product-fabric.atlassian.net/browse/ED-26331
|
|
377
|
+
*/
|
|
378
|
+
${fg('platform_editor_hide_cursor_when_pm_hideselection') ? css`
|
|
379
|
+
.ProseMirror-hideselection {
|
|
380
|
+
caret-color: transparent;
|
|
381
|
+
}
|
|
382
|
+
` : null}
|
|
383
|
+
|
|
384
|
+
/* This prosemirror css style: https://github.com/ProseMirror/prosemirror-view/blob/f37ebb29befdbde3cd194fe13fe17b78e743d2f2/style/prosemirror.css#L24 */
|
|
385
|
+
${editorExperiment('platform_editor_advanced_code_blocks', true) ? css`
|
|
386
|
+
.ProseMirror-hideselection {
|
|
387
|
+
caret-color: transparent;
|
|
388
|
+
}
|
|
389
|
+
` : null}
|
|
390
|
+
|
|
391
|
+
.ProseMirror-selectednode {
|
|
392
|
+
outline: none;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.ProseMirror-selectednode:empty {
|
|
396
|
+
outline: 2px solid ${"var(--ds-border-focused, #8cf)"};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.ProseMirror.ProseMirror-focused:has(.ProseMirror-mark-boundary-cursor) {
|
|
400
|
+
caret-color: transparent;
|
|
401
|
+
}
|
|
402
|
+
.ProseMirror:not(.ProseMirror-focused) .ProseMirror-mark-boundary-cursor {
|
|
403
|
+
display: none;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
${placeholderTextStyles}
|
|
407
|
+
${placeholderStyles}
|
|
408
|
+
${editorExperiment('platform_editor_controls', 'variant1') ? placeholderOverflowStyles : null}
|
|
409
|
+
${editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_quick_insert_placeholder') ? placeholderWrapStyles : null}
|
|
410
|
+
|
|
411
|
+
${codeBlockStyles()}
|
|
412
|
+
|
|
413
|
+
${blocktypeStyles(props.typographyTheme)}
|
|
414
|
+
${codeMarkSharedStyles()}
|
|
415
|
+
${textColorStyles}
|
|
416
|
+
${backgroundColorStyles()}
|
|
417
|
+
${listsStyles}
|
|
418
|
+
${ruleStyles()}
|
|
419
|
+
${mediaStyles()}
|
|
420
|
+
${layoutStyles(props.viewMode)}
|
|
421
|
+
${fg('confluence_team_presence_scroll_to_pointer') ? telepointerStyle : telepointerStyleWithInitialOnly}
|
|
422
|
+
${gapCursorStyles};
|
|
423
|
+
${panelStyles()}
|
|
424
|
+
${mentionsStyles}
|
|
425
|
+
${editorExperiment('platform_editor_vanilla_dom', true, {
|
|
426
|
+
exposure: false
|
|
427
|
+
}) && vanillaMentionsStyles}
|
|
428
|
+
${editorExperiment('platform_editor_vanilla_dom', true, {
|
|
429
|
+
exposure: false
|
|
430
|
+
}) && vanillaSelectionStyles}
|
|
431
|
+
${editorExperiment('platform_editor_vanilla_dom', true, {
|
|
432
|
+
exposure: false
|
|
433
|
+
}) ? emojiStyles : reactEmojiStyles}
|
|
434
|
+
${emojiStyles}
|
|
435
|
+
${tasksAndDecisionsStyles}
|
|
436
|
+
${gridStyles}
|
|
437
|
+
${linkStyles}
|
|
438
|
+
${blockMarksSharedStyles}
|
|
439
|
+
${dateSharedStyle}
|
|
440
|
+
${extensionStyles}
|
|
441
|
+
${expandStyles()}
|
|
442
|
+
${findReplaceStyles}
|
|
443
|
+
${textHighlightStyle}
|
|
444
|
+
${taskDecisionStyles}
|
|
445
|
+
${editorExperiment('platform_editor_vanilla_dom', true, {
|
|
446
|
+
exposure: false
|
|
447
|
+
}) && vanillaTaskItemStyles}
|
|
448
|
+
${editorExperiment('platform_editor_vanilla_dom', true, {
|
|
449
|
+
exposure: false
|
|
450
|
+
}) && vanillaDecisionStyles}
|
|
451
|
+
// Switch between the two icons based on the visual refresh feature gate
|
|
452
|
+
${editorExperiment('platform_editor_vanilla_dom', true, {
|
|
453
|
+
exposure: false
|
|
454
|
+
}) && fg('platform-visual-refresh-icons') && vanillaDecisionIconWithVisualRefresh}
|
|
455
|
+
${editorExperiment('platform_editor_vanilla_dom', true, {
|
|
456
|
+
exposure: false
|
|
457
|
+
}) && !fg('platform-visual-refresh-icons') && vanillaDecisionIconWithoutVisualRefresh}
|
|
458
|
+
${statusStyles}
|
|
459
|
+
${editorExperiment('platform_editor_vanilla_dom', true) ? vanillaStatusStyles : null}
|
|
460
|
+
${annotationSharedStyles()}
|
|
461
|
+
${smartCardStyles()}
|
|
462
|
+
${fg('platform-linking-visual-refresh-v1') ? getSmartCardSharedStyles() : smartCardSharedStyles}
|
|
463
|
+
${editorExperiment('platform_editor_vanilla_dom', true) ? dateVanillaStyles : null}
|
|
464
|
+
${dateStyles}
|
|
465
|
+
${embedCardStyles()}
|
|
466
|
+
${unsupportedStyles}
|
|
467
|
+
${resizerStyles}
|
|
468
|
+
${aiPanelStyles(props.colorMode)}
|
|
469
|
+
${fixBlockControlStylesSSR()}
|
|
470
|
+
|
|
471
|
+
.panelView-content-wrap {
|
|
472
|
+
box-sizing: border-box;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.mediaGroupView-content-wrap ul {
|
|
476
|
+
padding: 0;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/** Needed to override any cleared floats, e.g. image wrapping */
|
|
480
|
+
|
|
481
|
+
div.fabric-editor-block-mark[class^='fabric-editor-align'] {
|
|
482
|
+
clear: none !important;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.fabric-editor-align-end {
|
|
486
|
+
text-align: right;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.fabric-editor-align-start {
|
|
490
|
+
text-align: left;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.fabric-editor-align-center {
|
|
494
|
+
text-align: center;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// For FullPage only when inside a table
|
|
498
|
+
// Related code all lives inside: packages/editor/editor-core/src/ui/Appearance/FullPage/StyledComponents.ts
|
|
499
|
+
// In the "editorContentAreaContainerStyle" function
|
|
500
|
+
.fabric-editor--full-width-mode {
|
|
501
|
+
.pm-table-container {
|
|
502
|
+
.code-block,
|
|
503
|
+
.extension-container,
|
|
504
|
+
.multiBodiedExtension--container {
|
|
505
|
+
max-width: 100%;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.pm-table-header-content-wrap :not(.fabric-editor-alignment),
|
|
511
|
+
.pm-table-header-content-wrap :not(p, .fabric-editor-block-mark) + div.fabric-editor-block-mark,
|
|
512
|
+
.pm-table-cell-content-wrap :not(p, .fabric-editor-block-mark) + div.fabric-editor-block-mark {
|
|
513
|
+
p:first-of-type {
|
|
514
|
+
margin-top: 0;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
.pm-table-cell-content-wrap .mediaGroupView-content-wrap {
|
|
518
|
+
clear: both;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.hyperlink-floating-toolbar,
|
|
522
|
+
.${MediaSharedClassNames.FLOATING_TOOLBAR_COMPONENT} {
|
|
523
|
+
padding: 0;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/* Legacy Link icon in the Atlaskit package
|
|
527
|
+
is bigger than the others, new ADS icon does not have this issue
|
|
528
|
+
*/
|
|
529
|
+
${!fg('platform-visual-refresh-icons') ? css`
|
|
530
|
+
.hyperlink-open-link {
|
|
531
|
+
min-width: 24px;
|
|
532
|
+
svg {
|
|
533
|
+
max-width: 18px;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
` : null}
|
|
537
|
+
`;
|
|
538
|
+
const CommentEditorMargin = 14;
|
|
539
|
+
|
|
540
|
+
// Originally copied from packages/editor/editor-core/src/ui/Appearance/Comment/Comment.tsx
|
|
541
|
+
const commentEditorStyles = css({
|
|
542
|
+
flexGrow: 1,
|
|
543
|
+
overflowX: 'clip',
|
|
544
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
545
|
+
lineHeight: '24px',
|
|
546
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
547
|
+
'.ProseMirror': {
|
|
548
|
+
margin: "var(--ds-space-150, 12px)"
|
|
549
|
+
},
|
|
550
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
551
|
+
'.gridParent': {
|
|
552
|
+
marginLeft: "var(--ds-space-025, 2px)",
|
|
553
|
+
marginRight: "var(--ds-space-025, 2px)",
|
|
554
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
555
|
+
width: `calc(100% + ${CommentEditorMargin - GRID_GUTTER}px)`
|
|
556
|
+
},
|
|
557
|
+
padding: "var(--ds-space-250, 20px)"
|
|
558
|
+
},
|
|
559
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
560
|
+
tableCommentEditorStyles);
|
|
561
|
+
|
|
562
|
+
// Originally copied from scrollStyles in packages/editor/editor-core/src/ui/Appearance/FullPage/StyledComponents.ts
|
|
563
|
+
const fullPageEditorStyles = css({
|
|
564
|
+
flexGrow: 1,
|
|
565
|
+
height: '100%',
|
|
566
|
+
overflowY: 'scroll',
|
|
567
|
+
position: 'relative',
|
|
568
|
+
display: 'flex',
|
|
569
|
+
flexDirection: 'column',
|
|
570
|
+
scrollBehavior: 'smooth'
|
|
571
|
+
},
|
|
572
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
573
|
+
scrollbarStyles);
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* EditorContentStyles is a wrapper component that applies styles to its children
|
|
577
|
+
* based on the provided feature flags, view mode, and other props.
|
|
578
|
+
* It uses Emotion for styling and supports scrollable content.
|
|
579
|
+
* The component is memoized to optimize performance.
|
|
580
|
+
*
|
|
581
|
+
* This will be used in near future to replace the current editor content styles from index.tsx
|
|
582
|
+
*
|
|
583
|
+
* @param {EditorContentContainerProps} props - The props for the component.
|
|
584
|
+
* @param {string} props.className - Additional class name for the component.
|
|
585
|
+
* @param {React.ReactNode} props.children - The content to be rendered inside the component.
|
|
586
|
+
* @param {FeatureFlags} props.featureFlags - Feature flags to control the styles.
|
|
587
|
+
* @param {'view' | 'edit'} props.viewMode - The view mode of the editor.
|
|
588
|
+
* @param {boolean} props.isScrollable - Whether the content is scrollable.
|
|
589
|
+
* @param {'full-page' | 'full-width' | 'comment' | 'chromeless'} props.appearance - The appearance of the editor.
|
|
590
|
+
* @returns {JSX.Element} The styled content component.
|
|
591
|
+
*/
|
|
592
|
+
const EditorContentContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
593
|
+
const {
|
|
594
|
+
className,
|
|
595
|
+
children,
|
|
596
|
+
featureFlags,
|
|
597
|
+
viewMode,
|
|
598
|
+
isScrollable,
|
|
599
|
+
appearance
|
|
600
|
+
} = props;
|
|
601
|
+
const theme = useTheme();
|
|
602
|
+
const {
|
|
603
|
+
colorMode,
|
|
604
|
+
typography
|
|
605
|
+
} = useThemeObserver();
|
|
606
|
+
const memoizedStyle = useMemo(() => contentStyles({
|
|
607
|
+
theme,
|
|
608
|
+
colorMode,
|
|
609
|
+
featureFlags,
|
|
610
|
+
viewMode,
|
|
611
|
+
typographyTheme: typography
|
|
612
|
+
}), [theme, colorMode, featureFlags, viewMode, typography]);
|
|
613
|
+
const isFullPage = appearance === 'full-page' || appearance === 'full-width';
|
|
614
|
+
const isComment = appearance === 'comment';
|
|
615
|
+
return jsx("div", {
|
|
616
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
617
|
+
className: className,
|
|
618
|
+
ref: ref,
|
|
619
|
+
css: [memoizedStyle, isComment && commentEditorStyles, isFullPage && fullPageEditorStyles],
|
|
620
|
+
"data-editor-scroll-container": isScrollable ? 'true' : undefined,
|
|
621
|
+
"data-testid": "editor-content-container"
|
|
622
|
+
}, children);
|
|
623
|
+
});
|
|
624
|
+
export default EditorContentContainer;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "206.0
|
|
2
|
+
export const version = "206.1.0";
|
|
@@ -16,7 +16,10 @@ import React, { Fragment } from 'react';
|
|
|
16
16
|
import { css, jsx } from '@emotion/react';
|
|
17
17
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
18
18
|
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
19
|
+
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
|
|
20
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
19
21
|
import { createEditorContentStyle } from '../ContentStyles';
|
|
22
|
+
import EditorContentContainer from '../EditorContentContainer';
|
|
20
23
|
import PluginSlot from '../PluginSlot';
|
|
21
24
|
import WithFlash from '../WithFlash';
|
|
22
25
|
var chromelessEditorStyles = css({
|
|
@@ -43,8 +46,12 @@ scrollbarStyles, {
|
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
});
|
|
46
|
-
var ContentArea = createEditorContentStyle();
|
|
49
|
+
export var ContentArea = createEditorContentStyle();
|
|
47
50
|
ContentArea.displayName = 'ContentArea';
|
|
51
|
+
var EditorContainer = componentWithCondition(function () {
|
|
52
|
+
return editorExperiment('platform_editor_core_static_emotion', true);
|
|
53
|
+
}, EditorContentContainer, ContentArea);
|
|
54
|
+
|
|
48
55
|
// Ignored via go/ees005
|
|
49
56
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
50
57
|
var Editor = /*#__PURE__*/function (_React$Component) {
|
|
@@ -98,12 +105,13 @@ var Editor = /*#__PURE__*/function (_React$Component) {
|
|
|
98
105
|
ref: function ref(_ref2) {
|
|
99
106
|
return _this.containerElement = _ref2;
|
|
100
107
|
}
|
|
101
|
-
}, jsx(
|
|
108
|
+
}, jsx(EditorContainer
|
|
102
109
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
103
110
|
, {
|
|
104
111
|
className: "ak-editor-content-area",
|
|
105
112
|
featureFlags: featureFlags,
|
|
106
|
-
viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
113
|
+
viewMode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
|
|
114
|
+
appearance: _this.appearance
|
|
107
115
|
}, customContentComponents && 'before' in customContentComponents ? customContentComponents.before : customContentComponents, jsx(PluginSlot, {
|
|
108
116
|
editorView: editorView,
|
|
109
117
|
editorActions: editorActions,
|