@atlaskit/editor-core 207.0.2 → 207.0.3

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 (37) hide show
  1. package/CHANGELOG.md +9 -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 +2 -2
  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 +220 -30
  10. package/dist/cjs/version-wrapper.js +1 -1
  11. package/dist/es2019/ui/Appearance/Chromeless.js +11 -1
  12. package/dist/es2019/ui/Appearance/Comment/Comment.js +3 -1
  13. package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +3 -1
  14. package/dist/es2019/ui/ContentStyles/ai-panels.js +7 -0
  15. package/dist/es2019/ui/ContentStyles/index.js +4 -4
  16. package/dist/es2019/ui/ContentStyles/layout.js +7 -0
  17. package/dist/es2019/ui/ContentStyles/status.js +2 -2
  18. package/dist/es2019/ui/EditorContentContainer.js +753 -34
  19. package/dist/es2019/version-wrapper.js +1 -1
  20. package/dist/esm/ui/Appearance/Chromeless.js +13 -2
  21. package/dist/esm/ui/Appearance/Comment/Comment.js +3 -1
  22. package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +3 -1
  23. package/dist/esm/ui/ContentStyles/ai-panels.js +7 -0
  24. package/dist/esm/ui/ContentStyles/index.js +2 -2
  25. package/dist/esm/ui/ContentStyles/layout.js +7 -0
  26. package/dist/esm/ui/ContentStyles/status.js +2 -2
  27. package/dist/esm/ui/EditorContentContainer.js +224 -30
  28. package/dist/esm/version-wrapper.js +1 -1
  29. package/dist/types/ui/Appearance/Chromeless.d.ts +8 -0
  30. package/dist/types/ui/ContentStyles/ai-panels.d.ts +6 -0
  31. package/dist/types/ui/ContentStyles/layout.d.ts +6 -0
  32. package/dist/types/ui/EditorContentContainer.d.ts +0 -3
  33. package/dist/types-ts4.5/ui/Appearance/Chromeless.d.ts +8 -0
  34. package/dist/types-ts4.5/ui/ContentStyles/ai-panels.d.ts +6 -0
  35. package/dist/types-ts4.5/ui/ContentStyles/layout.d.ts +6 -0
  36. package/dist/types-ts4.5/ui/EditorContentContainer.d.ts +0 -3
  37. package/package.json +2 -2
@@ -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,747 @@ 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
692
+ 0;
693
+ transition: border-color 0.3s ${akEditorSwoopCubicBezier};
694
+ cursor: pointer;
695
+
696
+ /* Inner cursor located 26px from left */
697
+ [data-layout-column] {
698
+ flex: 1;
699
+ position: relative;
700
+
701
+ min-width: 0;
702
+ /* disable 4 borders when in view mode and advanced layouts is on */
703
+ border: ${editorExperiment('advanced_layouts', true) ? 0 : akEditorSelectedBorderSize}px
704
+ solid ${"var(--ds-border, #091E4224)"};
705
+ border-radius: 4px;
706
+ padding: ${LAYOUT_COLUMN_PADDING}px
707
+ ${LAYOUT_COLUMN_PADDING + (fg('platform_editor_nested_dnd_styles_changes') ? 8 : 0)}px;
708
+ box-sizing: border-box;
709
+
710
+ > div {
711
+ ${firstNodeWithNotMarginTop()}
712
+
713
+ > .embedCardView-content-wrap:first-of-type .rich-media-item {
714
+ margin-top: 0;
715
+ }
716
+
717
+ > .mediaSingleView-content-wrap:first-of-type .rich-media-item {
718
+ margin-top: 0;
719
+ }
720
+
721
+ > .ProseMirror-gapcursor.-right:first-child
722
+ + .mediaSingleView-content-wrap
723
+ .rich-media-item,
724
+ > style:first-child
725
+ + .ProseMirror-gapcursor.-right
726
+ + .mediaSingleView-content-wrap
727
+ .rich-media-item,
728
+ > .ProseMirror-gapcursor.-right:first-of-type
729
+ + .embedCardView-content-wrap
730
+ .rich-media-item {
731
+ margin-top: 0;
732
+ }
733
+
734
+ > .ProseMirror-gapcursor:first-child
735
+ + span
736
+ + .mediaSingleView-content-wrap
737
+ .rich-media-item,
738
+ > style:first-child
739
+ + .ProseMirror-gapcursor
740
+ + span
741
+ + .mediaSingleView-content-wrap
742
+ .rich-media-item {
743
+ margin-top: 0;
744
+ }
745
+
746
+ /* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down
747
+ and shrinking layout's node selectable area (leniency margin) */
748
+ > [data-node-type='decisionList'] {
749
+ li:first-of-type [data-decision-wrapper] {
750
+ margin-top: 0;
751
+ }
752
+ }
753
+ }
754
+
755
+ /* Make the 'content' fill the entire height of the layout column to allow click
756
+ handler of layout section nodeview to target only data-layout-column */
757
+ [data-layout-content] {
758
+ height: 100%;
759
+ cursor: text;
760
+ .mediaGroupView-content-wrap {
761
+ clear: both;
762
+ }
763
+ }
764
+ }
765
+
766
+ ${layoutColumnStyles()}
767
+ }
768
+
769
+ /* styles to support borders for layout */
770
+ [data-layout-section],
771
+ .layoutSectionView-content-wrap {
772
+ ${editorExperiment('advanced_layouts', true) ? layoutWithSeparatorBorderBaseStyles : layoutBorderBaseStyles}
773
+ }
774
+ }
775
+
776
+ ${editorExperiment('advanced_layouts', true) && layoutResponsiveBaseStyles}
777
+
778
+ /* hide separator when element is dragging on top of a layout column */
779
+ [data-blocks-drop-target-container] ~ [data-layout-column] > [data-layout-content]::before {
780
+ display: none;
781
+ }
782
+
783
+ .fabric-editor--full-width-mode .ProseMirror {
784
+ [data-layout-section] {
785
+ .${TableCssClassName.TABLE_CONTAINER} {
786
+ margin: 0 ${tableMarginFullWidthMode}px;
787
+ }
788
+ }
789
+ }
790
+
791
+ ${editorExperiment('advanced_layouts', false) && fg('platform_editor_nested_dnd_styles_changes') && `.ak-editor-content-area.appearance-full-page .ProseMirror [data-layout-section] {
792
+ margin: ${"var(--ds-space-100, 8px)"} -${akLayoutGutterOffset + 8}px 0;
793
+ }`}
794
+ `;
795
+
796
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
797
+ const layoutViewStyles = css`
798
+ .ProseMirror {
799
+ [data-layout-section] {
800
+ cursor: default;
801
+ [data-layout-column] {
802
+ border: 0;
803
+ }
804
+ }
805
+ [data-layout-section],
806
+ .layoutSectionView-content-wrap {
807
+ ${editorExperiment('advanced_layouts', true) ? layoutWithSeparatorBorderViewStyles : layoutBorderViewStyles}
808
+ }
809
+ }
810
+
811
+ ${editorExperiment('advanced_layouts', true) && layoutResponsiveViewStyles}
812
+ `;
813
+
814
+ /**
815
+ * aiPanelStyles
816
+ * was imported from packages/editor/editor-core/src/ui/ContentStyles/ai-panels.ts
817
+ */
818
+ const isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
819
+ const rotationAnimation = keyframes({
820
+ '0%': {
821
+ '--panel-gradient-angle': '0deg',
822
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
823
+ ...(isFirefox ? {
824
+ backgroundPosition: '100%'
825
+ } : {})
826
+ },
827
+ '100%': {
828
+ '--panel-gradient-angle': '360deg',
829
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
830
+ ...(isFirefox ? {
831
+ backgroundPosition: '-100%'
832
+ } : {})
833
+ }
834
+ });
835
+ const aiPrismColor = {
836
+ ['prism.border.step.1']: {
837
+ light: '#0065FF',
838
+ dark: '#0065FF80'
839
+ },
840
+ ['prism.border.step.2']: {
841
+ light: '#0469FF',
842
+ dark: '#0469FF80'
843
+ },
844
+ ['prism.border.step.3']: {
845
+ light: '#BF63F3',
846
+ dark: '#BF63F380'
847
+ },
848
+ ['prism.border.step.4']: {
849
+ light: '#FFA900',
850
+ dark: '#FFA90080'
851
+ }
852
+ };
853
+ const prismBorderAnimationStyles = css({
854
+ '&::before, &::after': {
855
+ animationName: rotationAnimation,
856
+ animationDuration: '2s',
857
+ animationTimingFunction: 'linear',
858
+ animationIterationCount: 'infinite',
859
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
860
+ ...(isFirefox ? {
861
+ animationDirection: 'normal',
862
+ animationDuration: '1s'
863
+ } : {}),
864
+ '@media (prefers-reduced-motion)': {
865
+ animation: 'none'
866
+ }
867
+ }
868
+ });
869
+ const prismBorderBaseStyles = css({
870
+ content: "''",
871
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
872
+ position: 'absolute',
873
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
874
+ zIndex: -1,
875
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
876
+ width: `calc(100% + 2px)`,
877
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
878
+ height: `calc(100% + 2px)`,
879
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
880
+ top: `-1px`,
881
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
882
+ left: `-1px`,
883
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
884
+ borderRadius: `calc(${"var(--ds-border-radius-100, 3px)"} + 1px)`,
885
+ transform: 'translate3d(0, 0, 0)',
886
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
887
+ ...(isFirefox ? {
888
+ background: `linear-gradient(90deg,
889
+ ${aiPrismColor['prism.border.step.1']['light']} 0%,
890
+ ${aiPrismColor['prism.border.step.2']['light']} 12%,
891
+ ${aiPrismColor['prism.border.step.3']['light']} 24%,
892
+ ${aiPrismColor['prism.border.step.4']['light']} 48%,
893
+ ${aiPrismColor['prism.border.step.3']['light']} 64%,
894
+ ${aiPrismColor['prism.border.step.2']['light']} 80%,
895
+ ${aiPrismColor['prism.border.step.1']['light']} 100%
896
+ )`,
897
+ backgroundSize: '200%'
898
+ } : {
899
+ background: `conic-gradient(
900
+ from var(--panel-gradient-angle, 270deg),
901
+ ${aiPrismColor['prism.border.step.1']['light']} 0%,
902
+ ${aiPrismColor['prism.border.step.2']['light']} 20%,
903
+ ${aiPrismColor['prism.border.step.3']['light']} 50%,
904
+ ${aiPrismColor['prism.border.step.4']['light']} 56%,
905
+ ${aiPrismColor['prism.border.step.1']['light']} 100%
906
+ )`
907
+ })
908
+ });
909
+ const prismBorderDarkStyles = css({
910
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
911
+ ...(isFirefox ? {
912
+ background: `linear-gradient(90deg,
913
+ ${aiPrismColor['prism.border.step.1']['dark']} 0%,
914
+ ${aiPrismColor['prism.border.step.2']['dark']} 12%,
915
+ ${aiPrismColor['prism.border.step.3']['dark']} 24%,
916
+ ${aiPrismColor['prism.border.step.4']['dark']} 48%,
917
+ ${aiPrismColor['prism.border.step.3']['dark']} 64%,
918
+ ${aiPrismColor['prism.border.step.2']['dark']} 80%,
919
+ ${aiPrismColor['prism.border.step.1']['dark']} 100%
920
+ )`,
921
+ backgroundSize: '200%'
922
+ } : {
923
+ background: `conic-gradient(
924
+ from var(--panel-gradient-angle, 270deg),
925
+ ${aiPrismColor['prism.border.step.1']['dark']} 0%,
926
+ ${aiPrismColor['prism.border.step.2']['dark']} 20%,
927
+ ${aiPrismColor['prism.border.step.3']['dark']} 50%,
928
+ ${aiPrismColor['prism.border.step.4']['dark']} 56%,
929
+ ${aiPrismColor['prism.border.step.1']['dark']} 100%
930
+ )`
931
+ })
932
+ });
933
+ const prismBorderHoverStyles = css({
934
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
935
+ background: "var(--ds-border-input, #8590A2)"
936
+ });
937
+
938
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Ignored via go/DSP-18766
939
+ const aiPanelBaseStyles = css`
940
+ @property --panel-gradient-angle {
941
+ syntax: '<angle>';
942
+ initial-value: 270deg;
943
+ inherits: false;
944
+ }
945
+
946
+ div[extensionType='com.atlassian.ai-blocks'] {
947
+ /* This hides the label for the extension */
948
+ .extension-label {
949
+ display: none;
950
+ }
951
+
952
+ /* This styles the ai panel correctly when its just sitting on the page and there
953
+ is no user interaction */
954
+ .extension-container {
955
+ position: relative;
956
+ box-shadow: none;
957
+ overflow: unset;
958
+ background-color: ${"var(--ds-surface, #FFFFFF)"} !important;
959
+ &::before,
960
+ &::after {
961
+ ${prismBorderBaseStyles}
962
+ }
963
+ &.with-hover-border {
964
+ &::before,
965
+ &::after {
966
+ ${prismBorderHoverStyles}
967
+ }
968
+ }
969
+ & .with-margin-styles {
970
+ background-color: ${"var(--ds-surface, #FFFFFF)"} !important;
971
+ border-radius: ${"var(--ds-border-radius-100, 3px)"};
972
+ }
973
+ }
974
+ }
975
+
976
+ /* This styles the ai panel correctly when its streaming */
977
+ div[extensionType='com.atlassian.ai-blocks']:has(.streaming) {
978
+ .extension-container {
979
+ box-shadow: none;
980
+ overflow: unset;
981
+ ${prismBorderAnimationStyles}
982
+ &::before,
983
+ &::after {
984
+ ${prismBorderBaseStyles}
985
+ }
986
+ }
987
+ }
988
+
989
+ /* This styles the ai panel correctly when a user is hovering over the delete button in the floating panel */
990
+ div[extensionType='com.atlassian.ai-blocks'].danger {
991
+ .extension-container {
992
+ box-shadow: 0 0 0 1px ${"var(--ds-border-danger, #E2483D)"};
993
+ }
994
+ }
995
+
996
+ /* This removes the margin from the action list when inside an ai panel */
997
+ div[extensiontype='com.atlassian.ai-blocks'][extensionkey='ai-action-items-block:aiActionItemsBodiedExtension'] {
998
+ div[data-node-type='actionList'] {
999
+ margin: 0 !important;
1000
+ }
1001
+ }
1002
+ `;
1003
+
1004
+ // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Ignored via go/DSP-18766
1005
+ const aiPanelDarkStyles = css`
1006
+ div[extensionType='com.atlassian.ai-blocks'] {
1007
+ .extension-container {
1008
+ &::before,
1009
+ &::after {
1010
+ ${prismBorderDarkStyles}
1011
+ }
1012
+ }
1013
+ }
1014
+
1015
+ /* This styles the ai panel correctly when its streaming */
1016
+ div[extensionType='com.atlassian.ai-blocks']:has(.streaming) {
1017
+ .extension-container {
1018
+ &::before,
1019
+ &::after {
1020
+ ${prismBorderDarkStyles}
1021
+ }
1022
+ }
1023
+ }
1024
+ `;
299
1025
 
300
1026
  // The breakpoint for small devices is 1266px, copied from getBreakpoint in platform/packages/editor/editor-common/src/ui/WidthProvider/index.tsx
301
1027
  const akEditorBreakpointForSmallDevice = `1266px`;
302
1028
 
303
1029
  // jest warning: JSDOM version (22) doesn't support the new @container CSS rule
304
- const contentStyles = props => css`
1030
+ const contentStyles = () => css`
305
1031
  --ak-editor--default-gutter-padding: ${akEditorGutterPadding}px;
306
1032
  /* 52 is from akEditorGutterPaddingDynamic via editor-shared-styles */
307
1033
  --ak-editor--large-gutter-padding: ${akEditorGutterPaddingDynamic()}px;
@@ -342,11 +1068,9 @@ const contentStyles = props => css`
342
1068
 
343
1069
  .ProseMirror {
344
1070
  outline: none;
345
- font-size: ${editorFontSize({
346
- theme: props.theme
347
- })}px;
1071
+ font-size: var(--ak-editor-base-font-size);
348
1072
  ${whitespaceSharedStyles};
349
- ${paragraphSharedStyles(props.typographyTheme)};
1073
+ ${paragraphSharedStyles()};
350
1074
  ${listsSharedStyles};
351
1075
  ${indentationSharedStyles};
352
1076
  ${shadowSharedStyle};
@@ -358,7 +1082,7 @@ const contentStyles = props => css`
358
1082
  pointer-events: none;
359
1083
  opacity: 0.7;
360
1084
  }
361
- `}
1085
+ `}
362
1086
 
363
1087
  .ProseMirror-hideselection *::selection {
364
1088
  background: transparent;
@@ -379,14 +1103,14 @@ const contentStyles = props => css`
379
1103
  .ProseMirror-hideselection {
380
1104
  caret-color: transparent;
381
1105
  }
382
- ` : null}
1106
+ ` : null}
383
1107
 
384
1108
  /* This prosemirror css style: https://github.com/ProseMirror/prosemirror-view/blob/f37ebb29befdbde3cd194fe13fe17b78e743d2f2/style/prosemirror.css#L24 */
385
1109
  ${editorExperiment('platform_editor_advanced_code_blocks', true) ? css`
386
1110
  .ProseMirror-hideselection {
387
1111
  caret-color: transparent;
388
1112
  }
389
- ` : null}
1113
+ ` : null}
390
1114
 
391
1115
  .ProseMirror-selectednode {
392
1116
  outline: none;
@@ -410,14 +1134,13 @@ const contentStyles = props => css`
410
1134
 
411
1135
  ${codeBlockStyles()}
412
1136
 
413
- ${blocktypeStyles(props.typographyTheme)}
1137
+ ${blocktypeStyles()}
414
1138
  ${codeMarkSharedStyles()}
415
1139
  ${textColorStyles}
416
1140
  ${backgroundColorStyles()}
417
1141
  ${listsStyles}
418
1142
  ${ruleStyles()}
419
1143
  ${mediaStyles()}
420
- ${layoutStyles(props.viewMode)}
421
1144
  ${fg('confluence_team_presence_scroll_to_pointer') ? telepointerStyle : telepointerStyleWithInitialOnly}
422
1145
  ${gapCursorStyles};
423
1146
  ${panelStyles()}
@@ -465,7 +1188,6 @@ const contentStyles = props => css`
465
1188
  ${embedCardStyles()}
466
1189
  ${unsupportedStyles}
467
1190
  ${resizerStyles}
468
- ${aiPanelStyles(props.colorMode)}
469
1191
  ${fixBlockControlStylesSSR()}
470
1192
 
471
1193
  .panelView-content-wrap {
@@ -533,7 +1255,7 @@ const contentStyles = props => css`
533
1255
  max-width: 18px;
534
1256
  }
535
1257
  }
536
- ` : null}
1258
+ ` : null}
537
1259
  `;
538
1260
  const CommentEditorMargin = 14;
539
1261
 
@@ -593,32 +1315,29 @@ const EditorContentContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
593
1315
  const {
594
1316
  className,
595
1317
  children,
596
- featureFlags,
597
1318
  viewMode,
598
1319
  isScrollable,
599
1320
  appearance
600
1321
  } = props;
601
1322
  const theme = useTheme();
602
1323
  const {
603
- colorMode,
604
- typography
1324
+ colorMode
605
1325
  } = useThemeObserver();
606
- const memoizedStyle = useMemo(() => contentStyles({
607
- theme,
608
- colorMode,
609
- featureFlags,
610
- viewMode,
611
- typographyTheme: typography
612
- }), [theme, colorMode, featureFlags, viewMode, typography]);
613
1326
  const isFullPage = appearance === 'full-page' || appearance === 'full-width';
614
1327
  const isComment = appearance === 'comment';
615
1328
  return jsx("div", {
616
1329
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
617
1330
  className: className,
618
1331
  ref: ref,
619
- css: [memoizedStyle, isComment && commentEditorStyles, isFullPage && fullPageEditorStyles],
1332
+ css: [contentStyles(), layoutBaseStyles(), aiPanelBaseStyles, colorMode === 'dark' && aiPanelDarkStyles, viewMode === 'view' && layoutViewStyles, isComment && commentEditorStyles, isFullPage && fullPageEditorStyles],
620
1333
  "data-editor-scroll-container": isScrollable ? 'true' : undefined,
621
- "data-testid": "editor-content-container"
1334
+ "data-testid": "editor-content-container",
1335
+ style: {
1336
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
1337
+ '--ak-editor-base-font-size': `${editorFontSize({
1338
+ theme
1339
+ })}px`
1340
+ }
622
1341
  }, children);
623
1342
  });
624
1343
  export default EditorContentContainer;