@atlaskit/editor-core 207.0.2 → 207.0.4

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/ui/Appearance/Chromeless.js +13 -2
  3. package/dist/cjs/ui/Appearance/Comment/Comment.js +3 -1
  4. package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +3 -1
  5. package/dist/cjs/ui/ContentStyles/ai-panels.js +6 -1
  6. package/dist/cjs/ui/ContentStyles/index.js +10 -3
  7. package/dist/cjs/ui/ContentStyles/layout.js +8 -1
  8. package/dist/cjs/ui/ContentStyles/status.js +2 -2
  9. package/dist/cjs/ui/EditorContentContainer.js +227 -30
  10. package/dist/cjs/utils/extensions.js +16 -26
  11. package/dist/cjs/version-wrapper.js +1 -1
  12. package/dist/es2019/ui/Appearance/Chromeless.js +11 -1
  13. package/dist/es2019/ui/Appearance/Comment/Comment.js +3 -1
  14. package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +3 -1
  15. package/dist/es2019/ui/ContentStyles/ai-panels.js +7 -0
  16. package/dist/es2019/ui/ContentStyles/index.js +12 -5
  17. package/dist/es2019/ui/ContentStyles/layout.js +7 -0
  18. package/dist/es2019/ui/ContentStyles/status.js +2 -2
  19. package/dist/es2019/ui/EditorContentContainer.js +759 -34
  20. package/dist/es2019/utils/extensions.js +16 -26
  21. package/dist/es2019/version-wrapper.js +1 -1
  22. package/dist/esm/ui/Appearance/Chromeless.js +13 -2
  23. package/dist/esm/ui/Appearance/Comment/Comment.js +3 -1
  24. package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +3 -1
  25. package/dist/esm/ui/ContentStyles/ai-panels.js +7 -0
  26. package/dist/esm/ui/ContentStyles/index.js +10 -3
  27. package/dist/esm/ui/ContentStyles/layout.js +7 -0
  28. package/dist/esm/ui/ContentStyles/status.js +2 -2
  29. package/dist/esm/ui/EditorContentContainer.js +231 -30
  30. package/dist/esm/utils/extensions.js +16 -26
  31. package/dist/esm/version-wrapper.js +1 -1
  32. package/dist/types/ui/Appearance/Chromeless.d.ts +8 -0
  33. package/dist/types/ui/ContentStyles/ai-panels.d.ts +6 -0
  34. package/dist/types/ui/ContentStyles/layout.d.ts +6 -0
  35. package/dist/types/ui/EditorContentContainer.d.ts +0 -3
  36. package/dist/types-ts4.5/ui/Appearance/Chromeless.d.ts +8 -0
  37. package/dist/types-ts4.5/ui/ContentStyles/ai-panels.d.ts +6 -0
  38. package/dist/types-ts4.5/ui/ContentStyles/layout.d.ts +6 -0
  39. package/dist/types-ts4.5/ui/EditorContentContainer.d.ts +0 -3
  40. package/package.json +7 -7
@@ -5,38 +5,39 @@
5
5
  * @jsxRuntime classic
6
6
  * @jsx jsx
7
7
  */
8
- import React, { useMemo } from 'react';
8
+ import React from 'react';
9
9
 
10
10
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
11
- import { css, jsx, useTheme } from '@emotion/react';
11
+ import { css, jsx, keyframes, useTheme } from '@emotion/react';
12
12
  import { browser } from '@atlaskit/editor-common/browser';
13
13
  import { telepointerStyle, telepointerStyleWithInitialOnly } from '@atlaskit/editor-common/collab';
14
14
  import { EmojiSharedCssClassName, defaultEmojiHeight } from '@atlaskit/editor-common/emoji';
15
15
  import { MentionSharedCssClassName } from '@atlaskit/editor-common/mention';
16
16
  import { PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
17
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';
18
+ import { CodeBlockSharedCssClassName, GRID_GUTTER, LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN, 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
19
  import { blocktypeStyles } from '@atlaskit/editor-plugins/block-type/styles';
20
20
  import { findReplaceStyles } from '@atlaskit/editor-plugins/find-replace/styles';
21
21
  import { textHighlightStyle } from '@atlaskit/editor-plugins/paste-options-toolbar/styles';
22
22
  import { placeholderTextStyles } from '@atlaskit/editor-plugins/placeholder-text/styles';
23
+ import { TableCssClassName } from '@atlaskit/editor-plugins/table/types';
23
24
  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 { tableMarginFullWidthMode } from '@atlaskit/editor-plugins/table/ui/consts';
26
+ import { SelectionStyle, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorDefaultLayoutWidth, akEditorDeleteBackground, akEditorDeleteBackgroundWithOpacity, akEditorDeleteBorder, akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorSelectedBorderColor, akEditorSelectedBorderSize, akEditorSelectedNodeClassName, akEditorSwoopCubicBezier, akLayoutGutterOffset, blockNodesVerticalMargin, editorFontSize, getSelectionStyles, gridMediumMaxWidth } from '@atlaskit/editor-shared-styles';
25
27
  import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
26
28
  import { fg } from '@atlaskit/platform-feature-flags';
27
29
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
28
30
  import { useThemeObserver } from '@atlaskit/tokens';
29
31
  import { InlineNodeViewSharedStyles } from '../nodeviews/getInlineNodeViewProducer.styles';
30
- import { aiPanelStyles } from './ContentStyles/ai-panels';
31
32
  import { codeBlockStyles } from './ContentStyles/code-block';
32
33
  import { dateStyles, dateVanillaStyles } from './ContentStyles/date';
33
34
  import { expandStyles } from './ContentStyles/expand';
34
35
  import { extensionStyles } from './ContentStyles/extension';
35
- import { layoutStyles } from './ContentStyles/layout';
36
36
  import { mediaStyles } from './ContentStyles/media';
37
37
  import { panelStyles } from './ContentStyles/panel';
38
38
  import { statusStyles, vanillaStatusStyles } from './ContentStyles/status';
39
39
  import { taskDecisionStyles, vanillaTaskDecisionIconWithoutVisualRefresh as vanillaDecisionIconWithoutVisualRefresh, vanillaTaskDecisionIconWithVisualRefresh as vanillaDecisionIconWithVisualRefresh, vanillaTaskDecisionStyles as vanillaDecisionStyles, vanillaTaskItemStyles } from './ContentStyles/tasks-and-decisions';
40
+
40
41
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
41
42
  export const linkStyles = css`
42
43
  .ProseMirror {
@@ -286,22 +287,746 @@ const firstBlockNodeStylesNew = css`
286
287
  }
287
288
  }
288
289
  `;
289
-
290
- /**
291
- * fix layout issue of first block node
292
- */
293
290
  export const fixBlockControlStylesSSR = () => {
294
291
  if (fg('platform_editor_element_dnd_nested_fix_patch_6')) {
295
292
  return firstBlockNodeStylesNew;
296
293
  }
297
294
  return firstBlockNodeStyles;
298
295
  };
296
+ const columnLayoutSharedStyle = css({
297
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
298
+ '[data-layout-section]': {
299
+ position: 'relative',
300
+ display: 'flex',
301
+ flexDirection: 'row',
302
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
303
+ '& > *': {
304
+ flex: 1,
305
+ minWidth: 0
306
+ },
307
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
308
+ '& > .unsupportedBlockView-content-wrap': {
309
+ minWidth: 'initial'
310
+ },
311
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
312
+ [`@media screen and (max-width: ${gridMediumMaxWidth}px)`]: {
313
+ flexDirection: 'column'
314
+ }
315
+ }
316
+ });
317
+ const columnLayoutResponsiveSharedStyle = css({
318
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
319
+ '[data-layout-section]': {
320
+ display: 'flex',
321
+ flexDirection: 'row',
322
+ gap: "var(--ds-space-100, 8px)",
323
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
324
+ '& > *': {
325
+ flex: 1,
326
+ minWidth: 0
327
+ },
328
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
329
+ '& > .unsupportedBlockView-content-wrap': {
330
+ minWidth: 'initial'
331
+ }
332
+ },
333
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
334
+ '.layout-section-container': {
335
+ containerType: 'inline-size',
336
+ containerName: 'layout-area'
337
+ }
338
+ });
339
+
340
+ /**
341
+ * layout styles
342
+ * was imported from packages/editor/editor-core/src/ui/ContentStyles/layout.ts
343
+ * @example
344
+ * @returns {string}
345
+ */
346
+ const firstNodeWithNotMarginTop = () => fg('platform_editor_nested_dnd_styles_changes') ?
347
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
348
+ css`
349
+ > :nth-child(1 of :not(style, .ProseMirror-gapcursor, .ProseMirror-widget, span)) {
350
+ margin-top: 0;
351
+ }
352
+ ` :
353
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
354
+ css`
355
+ > :not(style):first-child,
356
+ > style:first-child + * {
357
+ margin-top: 0;
358
+ }
359
+
360
+ > .ProseMirror-gapcursor:first-child + *,
361
+ > style:first-child + .ProseMirror-gapcursor + * {
362
+ margin-top: 0;
363
+ }
364
+
365
+ > .ProseMirror-gapcursor:first-child + span + * {
366
+ margin-top: 0;
367
+ }
368
+ `;
369
+ const layoutColumnStyles = () => editorExperiment('advanced_layouts', true) ?
370
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
371
+ css`
372
+ > [data-layout-column] {
373
+ margin: 0 ${LAYOUT_SECTION_MARGIN / 2}px;
374
+ }
375
+
376
+ > [data-layout-column]:first-of-type {
377
+ margin-left: 0;
378
+ }
379
+
380
+ > [data-layout-column]:last-of-type {
381
+ margin-right: 0;
382
+ }
383
+
384
+ @media screen and (max-width: ${gridMediumMaxWidth}px) {
385
+ [data-layout-column] + [data-layout-column] {
386
+ margin: 0;
387
+ }
388
+ }
389
+
390
+ > [data-layout-column].${akEditorSelectedNodeClassName}:not(.danger) {
391
+ ${getSelectionStyles([SelectionStyle.Blanket])};
392
+ /* layout column selection shorter after layout border has been removed */
393
+ ::before {
394
+ width: calc(100% - 8px);
395
+ left: 4px;
396
+ border-radius: ${"var(--ds-border-radius, 3px)"};
397
+ }
398
+ }
399
+ ` :
400
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
401
+ css`
402
+ [data-layout-column] + [data-layout-column] {
403
+ margin-left: ${LAYOUT_SECTION_MARGIN}px;
404
+ }
405
+
406
+ @media screen and (max-width: ${gridMediumMaxWidth}px) {
407
+ [data-layout-column] + [data-layout-column] {
408
+ margin-left: 0;
409
+ }
410
+ }
411
+ `;
412
+ const layoutSectionStyles = () => editorExperiment('advanced_layouts', true) ?
413
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
414
+ css`
415
+ ${columnLayoutResponsiveSharedStyle};
416
+ .layout-section-container [data-layout-section] {
417
+ > .ProseMirror-widget {
418
+ flex: none;
419
+ display: contents !important;
420
+
421
+ &[data-blocks-drag-handle-container] div {
422
+ display: contents !important;
423
+ }
424
+
425
+ &[data-blocks-drop-target-container] {
426
+ display: block !important;
427
+ margin: ${"var(--ds-space-negative-050, -4px)"};
428
+
429
+ [data-drop-target-for-element] {
430
+ position: absolute;
431
+ }
432
+ }
433
+
434
+ & + [data-layout-column] {
435
+ margin: 0;
436
+ }
437
+ }
438
+
439
+ > [data-layout-column] {
440
+ margin: 0;
441
+ }
442
+ }
443
+ ` :
444
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
445
+ css`
446
+ ${columnLayoutSharedStyle}
447
+ `;
448
+
449
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
450
+ const layoutBorderBaseStyles = css`
451
+ /* TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.
452
+ This is because the default state already uses the same token and, as such, the hover style won't change anything.
453
+ https://product-fabric.atlassian.net/browse/DSP-4441 */
454
+ /* Shows the border when cursor is inside a layout */
455
+ &.selected [data-layout-column],
456
+ &:hover [data-layout-column] {
457
+ border: ${akEditorSelectedBorderSize}px solid ${"var(--ds-border, #091E4224)"};
458
+ }
459
+
460
+ &.selected.danger [data-layout-column] {
461
+ background-color: ${`var(--ds-background-danger, ${akEditorDeleteBackground})`};
462
+ border-color: ${`var(--ds-border-danger, ${akEditorDeleteBorder})`};
463
+ }
464
+
465
+ &.${akEditorSelectedNodeClassName}:not(.danger) {
466
+ [data-layout-column] {
467
+ ${getSelectionStyles([SelectionStyle.Border, SelectionStyle.Blanket])}
468
+ ::after {
469
+ background-color: transparent;
470
+ }
471
+ }
472
+ }
473
+ `;
474
+
475
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
476
+ const layoutBorderViewStyles = css`
477
+ &.selected [data-layout-column],
478
+ &:hover [data-layout-column] {
479
+ border: 0;
480
+ }
481
+ `;
482
+
483
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
484
+ const columnSeparatorBaseStyles = css`
485
+ [data-layout-content]::before {
486
+ content: '';
487
+ border-left: ${akEditorSelectedBorderSize}px solid ${"var(--ds-border, #091E4224)"};
488
+ position: absolute;
489
+ height: calc(100% - 24px);
490
+ margin-left: -25px;
491
+ }
492
+ `;
493
+
494
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
495
+ const columnSeparatorViewStyles = css`
496
+ [data-layout-content]::before {
497
+ border-left: 0;
498
+ }
499
+ `;
500
+
501
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
502
+ const rowSeparatorBaseStyles = css`
503
+ [data-layout-content]::before {
504
+ content: '';
505
+ border-top: ${akEditorSelectedBorderSize}px solid ${"var(--ds-border, #091E4224)"};
506
+ position: absolute;
507
+ width: calc(100% - 32px);
508
+ margin-top: -13px;
509
+
510
+ /* clear styles for column separator */
511
+ border-left: unset;
512
+ margin-left: unset;
513
+ height: unset;
514
+ }
515
+ `;
516
+
517
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
518
+ const rowSeparatorViewStyles = css`
519
+ [data-layout-content]::before {
520
+ border-top: 0;
521
+ }
522
+ `;
523
+
524
+ // jest warning: JSDOM version (22) doesn't support the new @container CSS rule
525
+ const layoutWithSeparatorBorderResponsiveBaseStyles = (breakpoint
526
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
527
+ ) => css`
528
+ &.selected,
529
+ &:hover,
530
+ &.selected.danger,
531
+ &.${akEditorSelectedNodeClassName}:not(.danger) {
532
+ [data-layout-column]:not(:first-of-type) {
533
+ @container editor-area (max-width:${breakpoint}px) {
534
+ ${rowSeparatorBaseStyles}
535
+ }
536
+ }
537
+ }
538
+ `;
539
+
540
+ // jest warning: JSDOM version (22) doesn't support the new @container CSS rule
541
+ const layoutWithSeparatorBorderResponsiveViewStyles = (breakpoint
542
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
543
+ ) => css`
544
+ &.selected,
545
+ &:hover,
546
+ &.selected.danger,
547
+ &.${akEditorSelectedNodeClassName}:not(.danger) {
548
+ [data-layout-column]:not(:first-of-type) {
549
+ @container editor-area (max-width:${breakpoint}px) {
550
+ ${rowSeparatorViewStyles}
551
+ }
552
+ }
553
+ }
554
+ `;
555
+
556
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
557
+ const layoutWithSeparatorBorderBaseStyles = css`
558
+ &.selected [data-layout-column]:not(:first-of-type),
559
+ [data-empty-layout='true'] [data-layout-column]:not(:first-of-type),
560
+ &:hover [data-layout-column]:not(:first-of-type) {
561
+ ${columnSeparatorBaseStyles}
562
+ }
563
+
564
+ &.selected.danger [data-layout-section] {
565
+ background-color: ${`var(--ds-background-danger, ${akEditorDeleteBackground})`};
566
+
567
+ box-shadow: 0 0 0 ${akEditorSelectedBorderSize}px ${akEditorDeleteBorder};
568
+ border-radius: 4px;
569
+ [data-layout-column]:not(:first-of-type) {
570
+ ${columnSeparatorBaseStyles}
571
+ }
572
+ }
573
+
574
+ &.${akEditorSelectedNodeClassName}:not(.danger) [data-layout-section] {
575
+ box-shadow: 0 0 0 ${akEditorSelectedBorderSize}px ${"var(--ds-border-selected, #0C66E4)"};
576
+ border-radius: 4px;
577
+ background-color: ${"var(--ds-background-selected, #E9F2FF)"};
578
+ [data-layout-column] {
579
+ ${getSelectionStyles([SelectionStyle.Blanket])}
580
+ border: 0px;
581
+ ::before {
582
+ background-color: transparent;
583
+ }
584
+ }
585
+ [data-layout-column]:not(:first-of-type) {
586
+ ${columnSeparatorBaseStyles}
587
+ }
588
+ }
589
+ `;
590
+
591
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
592
+ const layoutWithSeparatorBorderViewStyles = css`
593
+ &.selected [data-layout-column]:not(:first-of-type),
594
+ [data-empty-layout='true'] [data-layout-column]:not(:first-of-type),
595
+ &:hover [data-layout-column]:not(:first-of-type) {
596
+ ${columnSeparatorViewStyles}
597
+ }
598
+
599
+ &.selected.danger [data-layout-section] {
600
+ box-shadow: 0 0 0 0 ${akEditorDeleteBorder};
601
+ [data-layout-column]:not(:first-of-type) {
602
+ ${columnSeparatorViewStyles}
603
+ }
604
+ }
605
+
606
+ &.${akEditorSelectedNodeClassName}:not(.danger) [data-layout-section] {
607
+ box-shadow: 0 0 0 0 ${"var(--ds-border-selected, #0C66E4)"};
608
+ [data-layout-column]:not(:first-of-type) {
609
+ ${columnSeparatorViewStyles}
610
+ }
611
+ }
612
+ `;
613
+
614
+ // jest warning: JSDOM version (22) doesn't support the new @container CSS rule
615
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
616
+ const layoutResponsiveBaseStyles = css`
617
+ /* chosen breakpoints in container queries are to make sure layout responsiveness in editor aligns with renderer */
618
+ /* not resized layout in full-width editor */
619
+ .fabric-editor--full-width-mode .ProseMirror {
620
+ > .layoutSectionView-content-wrap {
621
+ [data-layout-section] {
622
+ @container editor-area (max-width:724px) {
623
+ flex-direction: column;
624
+ }
625
+ }
626
+
627
+ ${layoutWithSeparatorBorderResponsiveBaseStyles(724)}
628
+ }
629
+ }
630
+
631
+ /* not resized layout in fixed-width editor */
632
+ .ak-editor-content-area:not(.fabric-editor--full-width-mode) .ProseMirror {
633
+ > .layoutSectionView-content-wrap {
634
+ [data-layout-section] {
635
+ @container editor-area (max-width:788px) {
636
+ flex-direction: column;
637
+ }
638
+ }
639
+
640
+ ${layoutWithSeparatorBorderResponsiveBaseStyles(788)}
641
+ }
642
+ }
643
+
644
+ /* resized layout in full/fixed-width editor */
645
+ .ProseMirror .fabric-editor-breakout-mark {
646
+ .layoutSectionView-content-wrap {
647
+ [data-layout-section] {
648
+ @container editor-area (max-width:820px) {
649
+ flex-direction: column;
650
+ }
651
+ }
652
+
653
+ ${layoutWithSeparatorBorderResponsiveBaseStyles(820)}
654
+ }
655
+ }
656
+ `;
657
+
658
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
659
+ const layoutResponsiveViewStyles = css`
660
+ /* chosen breakpoints in container queries are to make sure layout responsiveness in editor aligns with renderer */
661
+ /* not resized layout in full-width editor */
662
+ .fabric-editor--full-width-mode .ProseMirror {
663
+ > .layoutSectionView-content-wrap {
664
+ ${layoutWithSeparatorBorderResponsiveViewStyles(724)}
665
+ }
666
+ }
667
+
668
+ /* not resized layout in fixed-width editor */
669
+ .ak-editor-content-area:not(.fabric-editor--full-width-mode) .ProseMirror {
670
+ > .layoutSectionView-content-wrap {
671
+ ${layoutWithSeparatorBorderResponsiveViewStyles(788)}
672
+ }
673
+ }
674
+
675
+ /* resized layout in full/fixed-width editor */
676
+ .ProseMirror .fabric-editor-breakout-mark {
677
+ .layoutSectionView-content-wrap {
678
+ ${layoutWithSeparatorBorderResponsiveViewStyles(820)}
679
+ }
680
+ }
681
+ `;
682
+
683
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
684
+ const layoutBaseStyles = () => css`
685
+ .ProseMirror {
686
+ ${layoutSectionStyles()}
687
+ [data-layout-section] {
688
+ /* Ignored via go/ees007
689
+ TODO: Migrate away from gridSize
690
+ Recommendation: Replace directly with 7px */
691
+ margin: ${"var(--ds-space-100, 8px)"} -${akLayoutGutterOffset + (fg('platform_editor_nested_dnd_styles_changes') ? 8 : 0)}px 0;
692
+ transition: border-color 0.3s ${akEditorSwoopCubicBezier};
693
+ cursor: pointer;
694
+
695
+ /* Inner cursor located 26px from left */
696
+ [data-layout-column] {
697
+ flex: 1;
698
+ position: relative;
699
+
700
+ min-width: 0;
701
+ /* disable 4 borders when in view mode and advanced layouts is on */
702
+ border: ${editorExperiment('advanced_layouts', true) ? 0 : akEditorSelectedBorderSize}px
703
+ solid ${"var(--ds-border, #091E4224)"};
704
+ border-radius: 4px;
705
+ padding: ${LAYOUT_COLUMN_PADDING}px
706
+ ${LAYOUT_COLUMN_PADDING + (fg('platform_editor_nested_dnd_styles_changes') ? 8 : 0)}px;
707
+ box-sizing: border-box;
708
+
709
+ > div {
710
+ ${firstNodeWithNotMarginTop()}
711
+
712
+ > .embedCardView-content-wrap:first-of-type .rich-media-item {
713
+ margin-top: 0;
714
+ }
715
+
716
+ > .mediaSingleView-content-wrap:first-of-type .rich-media-item {
717
+ margin-top: 0;
718
+ }
719
+
720
+ > .ProseMirror-gapcursor.-right:first-child
721
+ + .mediaSingleView-content-wrap
722
+ .rich-media-item,
723
+ > style:first-child
724
+ + .ProseMirror-gapcursor.-right
725
+ + .mediaSingleView-content-wrap
726
+ .rich-media-item,
727
+ > .ProseMirror-gapcursor.-right:first-of-type
728
+ + .embedCardView-content-wrap
729
+ .rich-media-item {
730
+ margin-top: 0;
731
+ }
732
+
733
+ > .ProseMirror-gapcursor:first-child
734
+ + span
735
+ + .mediaSingleView-content-wrap
736
+ .rich-media-item,
737
+ > style:first-child
738
+ + .ProseMirror-gapcursor
739
+ + span
740
+ + .mediaSingleView-content-wrap
741
+ .rich-media-item {
742
+ margin-top: 0;
743
+ }
744
+
745
+ /* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down
746
+ and shrinking layout's node selectable area (leniency margin) */
747
+ > [data-node-type='decisionList'] {
748
+ li:first-of-type [data-decision-wrapper] {
749
+ margin-top: 0;
750
+ }
751
+ }
752
+ }
753
+
754
+ /* Make the 'content' fill the entire height of the layout column to allow click
755
+ handler of layout section nodeview to target only data-layout-column */
756
+ [data-layout-content] {
757
+ height: 100%;
758
+ cursor: text;
759
+ .mediaGroupView-content-wrap {
760
+ clear: both;
761
+ }
762
+ }
763
+ }
764
+
765
+ ${layoutColumnStyles()}
766
+ }
767
+
768
+ /* styles to support borders for layout */
769
+ [data-layout-section],
770
+ .layoutSectionView-content-wrap {
771
+ ${editorExperiment('advanced_layouts', true) ? layoutWithSeparatorBorderBaseStyles : layoutBorderBaseStyles}
772
+ }
773
+ }
774
+
775
+ ${editorExperiment('advanced_layouts', true) && layoutResponsiveBaseStyles}
776
+
777
+ /* hide separator when element is dragging on top of a layout column */
778
+ [data-blocks-drop-target-container] ~ [data-layout-column] > [data-layout-content]::before {
779
+ display: none;
780
+ }
781
+
782
+ .fabric-editor--full-width-mode .ProseMirror {
783
+ [data-layout-section] {
784
+ .${TableCssClassName.TABLE_CONTAINER} {
785
+ margin: 0 ${tableMarginFullWidthMode}px;
786
+ }
787
+ }
788
+ }
789
+
790
+ ${editorExperiment('advanced_layouts', false) && fg('platform_editor_nested_dnd_styles_changes') && `.ak-editor-content-area.appearance-full-page .ProseMirror [data-layout-section] {
791
+ margin: ${"var(--ds-space-100, 8px)"} -${akLayoutGutterOffset + 8}px 0;
792
+ }`}
793
+ `;
794
+
795
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
796
+ const layoutViewStyles = css`
797
+ .ProseMirror {
798
+ [data-layout-section] {
799
+ cursor: default;
800
+ [data-layout-column] {
801
+ border: 0;
802
+ }
803
+ }
804
+ [data-layout-section],
805
+ .layoutSectionView-content-wrap {
806
+ ${editorExperiment('advanced_layouts', true) ? layoutWithSeparatorBorderViewStyles : layoutBorderViewStyles}
807
+ }
808
+ }
809
+
810
+ ${editorExperiment('advanced_layouts', true) && layoutResponsiveViewStyles}
811
+ `;
812
+
813
+ /**
814
+ * aiPanelStyles
815
+ * was imported from packages/editor/editor-core/src/ui/ContentStyles/ai-panels.ts
816
+ */
817
+ const isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
818
+ const rotationAnimation = keyframes({
819
+ '0%': {
820
+ '--panel-gradient-angle': '0deg',
821
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
822
+ ...(isFirefox ? {
823
+ backgroundPosition: '100%'
824
+ } : {})
825
+ },
826
+ '100%': {
827
+ '--panel-gradient-angle': '360deg',
828
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
829
+ ...(isFirefox ? {
830
+ backgroundPosition: '-100%'
831
+ } : {})
832
+ }
833
+ });
834
+ const aiPrismColor = {
835
+ ['prism.border.step.1']: {
836
+ light: '#0065FF',
837
+ dark: '#0065FF80'
838
+ },
839
+ ['prism.border.step.2']: {
840
+ light: '#0469FF',
841
+ dark: '#0469FF80'
842
+ },
843
+ ['prism.border.step.3']: {
844
+ light: '#BF63F3',
845
+ dark: '#BF63F380'
846
+ },
847
+ ['prism.border.step.4']: {
848
+ light: '#FFA900',
849
+ dark: '#FFA90080'
850
+ }
851
+ };
852
+ const prismBorderAnimationStyles = css({
853
+ '&::before, &::after': {
854
+ animationName: rotationAnimation,
855
+ animationDuration: '2s',
856
+ animationTimingFunction: 'linear',
857
+ animationIterationCount: 'infinite',
858
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
859
+ ...(isFirefox ? {
860
+ animationDirection: 'normal',
861
+ animationDuration: '1s'
862
+ } : {}),
863
+ '@media (prefers-reduced-motion)': {
864
+ animation: 'none'
865
+ }
866
+ }
867
+ });
868
+ const prismBorderBaseStyles = css({
869
+ content: "''",
870
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
871
+ position: 'absolute',
872
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
873
+ zIndex: -1,
874
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
875
+ width: `calc(100% + 2px)`,
876
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
877
+ height: `calc(100% + 2px)`,
878
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
879
+ top: `-1px`,
880
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
881
+ left: `-1px`,
882
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
883
+ borderRadius: `calc(${"var(--ds-border-radius-100, 3px)"} + 1px)`,
884
+ transform: 'translate3d(0, 0, 0)',
885
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
886
+ ...(isFirefox ? {
887
+ background: `linear-gradient(90deg,
888
+ ${aiPrismColor['prism.border.step.1']['light']} 0%,
889
+ ${aiPrismColor['prism.border.step.2']['light']} 12%,
890
+ ${aiPrismColor['prism.border.step.3']['light']} 24%,
891
+ ${aiPrismColor['prism.border.step.4']['light']} 48%,
892
+ ${aiPrismColor['prism.border.step.3']['light']} 64%,
893
+ ${aiPrismColor['prism.border.step.2']['light']} 80%,
894
+ ${aiPrismColor['prism.border.step.1']['light']} 100%
895
+ )`,
896
+ backgroundSize: '200%'
897
+ } : {
898
+ background: `conic-gradient(
899
+ from var(--panel-gradient-angle, 270deg),
900
+ ${aiPrismColor['prism.border.step.1']['light']} 0%,
901
+ ${aiPrismColor['prism.border.step.2']['light']} 20%,
902
+ ${aiPrismColor['prism.border.step.3']['light']} 50%,
903
+ ${aiPrismColor['prism.border.step.4']['light']} 56%,
904
+ ${aiPrismColor['prism.border.step.1']['light']} 100%
905
+ )`
906
+ })
907
+ });
908
+ const prismBorderDarkStyles = css({
909
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
910
+ ...(isFirefox ? {
911
+ background: `linear-gradient(90deg,
912
+ ${aiPrismColor['prism.border.step.1']['dark']} 0%,
913
+ ${aiPrismColor['prism.border.step.2']['dark']} 12%,
914
+ ${aiPrismColor['prism.border.step.3']['dark']} 24%,
915
+ ${aiPrismColor['prism.border.step.4']['dark']} 48%,
916
+ ${aiPrismColor['prism.border.step.3']['dark']} 64%,
917
+ ${aiPrismColor['prism.border.step.2']['dark']} 80%,
918
+ ${aiPrismColor['prism.border.step.1']['dark']} 100%
919
+ )`,
920
+ backgroundSize: '200%'
921
+ } : {
922
+ background: `conic-gradient(
923
+ from var(--panel-gradient-angle, 270deg),
924
+ ${aiPrismColor['prism.border.step.1']['dark']} 0%,
925
+ ${aiPrismColor['prism.border.step.2']['dark']} 20%,
926
+ ${aiPrismColor['prism.border.step.3']['dark']} 50%,
927
+ ${aiPrismColor['prism.border.step.4']['dark']} 56%,
928
+ ${aiPrismColor['prism.border.step.1']['dark']} 100%
929
+ )`
930
+ })
931
+ });
932
+ const prismBorderHoverStyles = css({
933
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
934
+ background: "var(--ds-border-input, #8590A2)"
935
+ });
936
+
937
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Ignored via go/DSP-18766
938
+ const aiPanelBaseStyles = css`
939
+ @property --panel-gradient-angle {
940
+ syntax: '<angle>';
941
+ initial-value: 270deg;
942
+ inherits: false;
943
+ }
944
+
945
+ div[extensionType='com.atlassian.ai-blocks'] {
946
+ /* This hides the label for the extension */
947
+ .extension-label {
948
+ display: none;
949
+ }
950
+
951
+ /* This styles the ai panel correctly when its just sitting on the page and there
952
+ is no user interaction */
953
+ .extension-container {
954
+ position: relative;
955
+ box-shadow: none;
956
+ overflow: unset;
957
+ background-color: ${"var(--ds-surface, #FFFFFF)"} !important;
958
+ &::before,
959
+ &::after {
960
+ ${prismBorderBaseStyles}
961
+ }
962
+ &.with-hover-border {
963
+ &::before,
964
+ &::after {
965
+ ${prismBorderHoverStyles}
966
+ }
967
+ }
968
+ & .with-margin-styles {
969
+ background-color: ${"var(--ds-surface, #FFFFFF)"} !important;
970
+ border-radius: ${"var(--ds-border-radius-100, 3px)"};
971
+ }
972
+ }
973
+ }
974
+
975
+ /* This styles the ai panel correctly when its streaming */
976
+ div[extensionType='com.atlassian.ai-blocks']:has(.streaming) {
977
+ .extension-container {
978
+ box-shadow: none;
979
+ overflow: unset;
980
+ ${prismBorderAnimationStyles}
981
+ &::before,
982
+ &::after {
983
+ ${prismBorderBaseStyles}
984
+ }
985
+ }
986
+ }
987
+
988
+ /* This styles the ai panel correctly when a user is hovering over the delete button in the floating panel */
989
+ div[extensionType='com.atlassian.ai-blocks'].danger {
990
+ .extension-container {
991
+ box-shadow: 0 0 0 1px ${"var(--ds-border-danger, #E2483D)"};
992
+ }
993
+ }
994
+
995
+ /* This removes the margin from the action list when inside an ai panel */
996
+ div[extensiontype='com.atlassian.ai-blocks'][extensionkey='ai-action-items-block:aiActionItemsBodiedExtension'] {
997
+ div[data-node-type='actionList'] {
998
+ margin: 0 !important;
999
+ }
1000
+ }
1001
+ `;
1002
+
1003
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Ignored via go/DSP-18766
1004
+ const aiPanelDarkStyles = css`
1005
+ div[extensionType='com.atlassian.ai-blocks'] {
1006
+ .extension-container {
1007
+ &::before,
1008
+ &::after {
1009
+ ${prismBorderDarkStyles}
1010
+ }
1011
+ }
1012
+ }
1013
+
1014
+ /* This styles the ai panel correctly when its streaming */
1015
+ div[extensionType='com.atlassian.ai-blocks']:has(.streaming) {
1016
+ .extension-container {
1017
+ &::before,
1018
+ &::after {
1019
+ ${prismBorderDarkStyles}
1020
+ }
1021
+ }
1022
+ }
1023
+ `;
299
1024
 
300
1025
  // The breakpoint for small devices is 1266px, copied from getBreakpoint in platform/packages/editor/editor-common/src/ui/WidthProvider/index.tsx
301
1026
  const akEditorBreakpointForSmallDevice = `1266px`;
302
1027
 
303
1028
  // jest warning: JSDOM version (22) doesn't support the new @container CSS rule
304
- const contentStyles = props => css`
1029
+ const contentStyles = () => css`
305
1030
  --ak-editor--default-gutter-padding: ${akEditorGutterPadding}px;
306
1031
  /* 52 is from akEditorGutterPaddingDynamic via editor-shared-styles */
307
1032
  --ak-editor--large-gutter-padding: ${akEditorGutterPaddingDynamic()}px;
@@ -342,11 +1067,9 @@ const contentStyles = props => css`
342
1067
 
343
1068
  .ProseMirror {
344
1069
  outline: none;
345
- font-size: ${editorFontSize({
346
- theme: props.theme
347
- })}px;
1070
+ font-size: var(--ak-editor-base-font-size);
348
1071
  ${whitespaceSharedStyles};
349
- ${paragraphSharedStyles(props.typographyTheme)};
1072
+ ${paragraphSharedStyles()};
350
1073
  ${listsSharedStyles};
351
1074
  ${indentationSharedStyles};
352
1075
  ${shadowSharedStyle};
@@ -358,7 +1081,7 @@ const contentStyles = props => css`
358
1081
  pointer-events: none;
359
1082
  opacity: 0.7;
360
1083
  }
361
- `}
1084
+ `}
362
1085
 
363
1086
  .ProseMirror-hideselection *::selection {
364
1087
  background: transparent;
@@ -379,14 +1102,14 @@ const contentStyles = props => css`
379
1102
  .ProseMirror-hideselection {
380
1103
  caret-color: transparent;
381
1104
  }
382
- ` : null}
1105
+ ` : null}
383
1106
 
384
1107
  /* This prosemirror css style: https://github.com/ProseMirror/prosemirror-view/blob/f37ebb29befdbde3cd194fe13fe17b78e743d2f2/style/prosemirror.css#L24 */
385
1108
  ${editorExperiment('platform_editor_advanced_code_blocks', true) ? css`
386
1109
  .ProseMirror-hideselection {
387
1110
  caret-color: transparent;
388
1111
  }
389
- ` : null}
1112
+ ` : null}
390
1113
 
391
1114
  .ProseMirror-selectednode {
392
1115
  outline: none;
@@ -410,14 +1133,13 @@ const contentStyles = props => css`
410
1133
 
411
1134
  ${codeBlockStyles()}
412
1135
 
413
- ${blocktypeStyles(props.typographyTheme)}
1136
+ ${blocktypeStyles()}
414
1137
  ${codeMarkSharedStyles()}
415
1138
  ${textColorStyles}
416
1139
  ${backgroundColorStyles()}
417
1140
  ${listsStyles}
418
1141
  ${ruleStyles()}
419
1142
  ${mediaStyles()}
420
- ${layoutStyles(props.viewMode)}
421
1143
  ${fg('confluence_team_presence_scroll_to_pointer') ? telepointerStyle : telepointerStyleWithInitialOnly}
422
1144
  ${gapCursorStyles};
423
1145
  ${panelStyles()}
@@ -465,7 +1187,6 @@ const contentStyles = props => css`
465
1187
  ${embedCardStyles()}
466
1188
  ${unsupportedStyles}
467
1189
  ${resizerStyles}
468
- ${aiPanelStyles(props.colorMode)}
469
1190
  ${fixBlockControlStylesSSR()}
470
1191
 
471
1192
  .panelView-content-wrap {
@@ -533,7 +1254,7 @@ const contentStyles = props => css`
533
1254
  max-width: 18px;
534
1255
  }
535
1256
  }
536
- ` : null}
1257
+ ` : null}
537
1258
  `;
538
1259
  const CommentEditorMargin = 14;
539
1260
 
@@ -571,6 +1292,13 @@ const fullPageEditorStyles = css({
571
1292
  },
572
1293
  // 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
1294
  scrollbarStyles);
1295
+ const listLayoutShiftFix = css({
1296
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
1297
+ '.ProseMirror ul, .ProseMirror ol': {
1298
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-space
1299
+ marginTop: '10px'
1300
+ }
1301
+ });
574
1302
 
575
1303
  /**
576
1304
  * EditorContentStyles is a wrapper component that applies styles to its children
@@ -593,32 +1321,29 @@ const EditorContentContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
593
1321
  const {
594
1322
  className,
595
1323
  children,
596
- featureFlags,
597
1324
  viewMode,
598
1325
  isScrollable,
599
1326
  appearance
600
1327
  } = props;
601
1328
  const theme = useTheme();
602
1329
  const {
603
- colorMode,
604
- typography
1330
+ colorMode
605
1331
  } = useThemeObserver();
606
- const memoizedStyle = useMemo(() => contentStyles({
607
- theme,
608
- colorMode,
609
- featureFlags,
610
- viewMode,
611
- typographyTheme: typography
612
- }), [theme, colorMode, featureFlags, viewMode, typography]);
613
1332
  const isFullPage = appearance === 'full-page' || appearance === 'full-width';
614
1333
  const isComment = appearance === 'comment';
615
1334
  return jsx("div", {
616
1335
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
617
1336
  className: className,
618
1337
  ref: ref,
619
- css: [memoizedStyle, isComment && commentEditorStyles, isFullPage && fullPageEditorStyles],
1338
+ css: [contentStyles(), layoutBaseStyles(), aiPanelBaseStyles, colorMode === 'dark' && aiPanelDarkStyles, viewMode === 'view' && layoutViewStyles, isComment && commentEditorStyles, isFullPage && fullPageEditorStyles, fg('platform_editor_ssr_fix_lists') && listLayoutShiftFix],
620
1339
  "data-editor-scroll-container": isScrollable ? 'true' : undefined,
621
- "data-testid": "editor-content-container"
1340
+ "data-testid": "editor-content-container",
1341
+ style: {
1342
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
1343
+ '--ak-editor-base-font-size': `${editorFontSize({
1344
+ theme
1345
+ })}px`
1346
+ }
622
1347
  }, children);
623
1348
  });
624
1349
  export default EditorContentContainer;