@atlaskit/editor-plugin-show-diff 19.0.2 → 19.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 (94) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +57 -93
  3. package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +1 -1
  4. package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +1 -26
  5. package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +12 -24
  6. package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
  7. package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
  8. package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +8 -16
  9. package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +7 -22
  10. package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -52
  11. package/dist/cjs/pm-plugins/decorations/decorationKeys.js +6 -14
  12. package/dist/cjs/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +3 -8
  13. package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +132 -205
  14. package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +13 -20
  15. package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -10
  16. package/dist/cjs/pm-plugins/getDefaultDiffType.js +10 -0
  17. package/dist/cjs/pm-plugins/getScrollableDecorations.js +5 -15
  18. package/dist/cjs/pm-plugins/main.js +45 -53
  19. package/dist/cjs/pm-plugins/resolveDiffContributors.js +18 -4
  20. package/dist/cjs/showDiffPlugin.js +14 -24
  21. package/dist/cjs/showDiffPluginType.js +1 -1
  22. package/dist/cjs/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
  23. package/dist/cjs/ui/ContributorTag/contributorTagController.js +28 -3
  24. package/dist/cjs/ui/ContributorTag/contributorTagIcons.js +2 -2
  25. package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +67 -105
  26. package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +1 -1
  27. package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +0 -26
  28. package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +11 -23
  29. package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
  30. package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
  31. package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +8 -18
  32. package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +8 -23
  33. package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -54
  34. package/dist/es2019/pm-plugins/decorations/decorationKeys.js +6 -16
  35. package/dist/es2019/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +2 -7
  36. package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +53 -125
  37. package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +11 -12
  38. package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -7
  39. package/dist/es2019/pm-plugins/getDefaultDiffType.js +2 -0
  40. package/dist/es2019/pm-plugins/getScrollableDecorations.js +6 -19
  41. package/dist/es2019/pm-plugins/main.js +49 -65
  42. package/dist/es2019/pm-plugins/resolveDiffContributors.js +18 -3
  43. package/dist/es2019/showDiffPlugin.js +12 -24
  44. package/dist/es2019/showDiffPluginType.js +1 -1
  45. package/dist/es2019/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
  46. package/dist/es2019/ui/ContributorTag/contributorTagController.js +30 -2
  47. package/dist/es2019/ui/ContributorTag/contributorTagIcons.js +2 -2
  48. package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +56 -92
  49. package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +1 -1
  50. package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +0 -26
  51. package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +12 -24
  52. package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
  53. package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
  54. package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +8 -16
  55. package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +8 -23
  56. package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -52
  57. package/dist/esm/pm-plugins/decorations/decorationKeys.js +6 -14
  58. package/dist/esm/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +3 -8
  59. package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +132 -205
  60. package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +13 -20
  61. package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -10
  62. package/dist/esm/pm-plugins/getDefaultDiffType.js +4 -0
  63. package/dist/esm/pm-plugins/getScrollableDecorations.js +6 -16
  64. package/dist/esm/pm-plugins/main.js +44 -52
  65. package/dist/esm/pm-plugins/resolveDiffContributors.js +18 -4
  66. package/dist/esm/showDiffPlugin.js +14 -24
  67. package/dist/esm/showDiffPluginType.js +1 -1
  68. package/dist/esm/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
  69. package/dist/esm/ui/ContributorTag/contributorTagController.js +28 -3
  70. package/dist/esm/ui/ContributorTag/contributorTagIcons.js +2 -2
  71. package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +1 -1
  72. package/dist/types/pm-plugins/decorations/colorSchemes/standard.d.ts +0 -3
  73. package/dist/types/pm-plugins/decorations/colorSchemes/types.d.ts +1 -1
  74. package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.d.ts +1 -3
  75. package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.d.ts +2 -3
  76. package/dist/types/pm-plugins/decorations/createChangedRowDecorationWidgets.d.ts +1 -3
  77. package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.d.ts +2 -3
  78. package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.d.ts +2 -3
  79. package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +2 -3
  80. package/dist/types/pm-plugins/decorations/decorationKeys.d.ts +5 -8
  81. package/dist/types/pm-plugins/decorations/utils/createDeletedLineBreakWidget.d.ts +3 -5
  82. package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +4 -6
  83. package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.d.ts +3 -4
  84. package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.d.ts +4 -4
  85. package/dist/types/pm-plugins/getDefaultDiffType.d.ts +2 -0
  86. package/dist/types/pm-plugins/getScrollableDecorations.d.ts +1 -2
  87. package/dist/types/pm-plugins/main.d.ts +0 -1
  88. package/dist/types/showDiffPluginType.d.ts +1 -3
  89. package/docs/smart-diff-design.md +13 -29
  90. package/package.json +5 -5
  91. package/dist/cjs/pm-plugins/isExtendedEnabled.js +0 -23
  92. package/dist/es2019/pm-plugins/isExtendedEnabled.js +0 -13
  93. package/dist/esm/pm-plugins/isExtendedEnabled.js +0 -17
  94. package/dist/types/pm-plugins/isExtendedEnabled.d.ts +0 -12
@@ -1,5 +1,4 @@
1
1
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
2
- import { isExtendedEnabled } from '../../isExtendedEnabled';
3
2
  import { buildDiffDecorationSpec, scrollMarginTopValue } from '../decorationKeys';
4
3
  import { createContentWrapper } from './wrapBlockNodeView';
5
4
 
@@ -27,7 +26,6 @@ export const RETURN_GLYPH = '⤶';
27
26
  export const createDeletedLineBreakWidget = ({
28
27
  colorScheme,
29
28
  count = 1,
30
- diffType,
31
29
  isActive = false,
32
30
  reveal
33
31
  }) => {
@@ -45,7 +43,7 @@ export const createDeletedLineBreakWidget = ({
45
43
  // deleted-content wrapper is styled as an inline run.
46
44
  dom.append(dom.ownerDocument.createElement('br'));
47
45
  }
48
- const wrapper = createContentWrapper(colorScheme, isActive, false, diffType, reveal);
46
+ const wrapper = createContentWrapper(colorScheme, isActive, false, reveal);
49
47
  wrapper.append(dom.ownerDocument.createTextNode(RETURN_GLYPH));
50
48
  dom.append(wrapper);
51
49
  }
@@ -65,7 +63,6 @@ export const createDeletedLineBreakDecoration = ({
65
63
  attributionKey,
66
64
  colorScheme,
67
65
  count,
68
- diffType,
69
66
  isActive = false,
70
67
  pos,
71
68
  reveal,
@@ -73,7 +70,6 @@ export const createDeletedLineBreakDecoration = ({
73
70
  }) => Decoration.widget(pos, createDeletedLineBreakWidget({
74
71
  colorScheme,
75
72
  count,
76
- diffType,
77
73
  isActive,
78
74
  reveal
79
75
  }), {
@@ -86,8 +82,7 @@ export const createDeletedLineBreakDecoration = ({
86
82
  // The glyph always stands in for removed content, whichever side of the changeset the
87
83
  // change itself landed on.
88
84
  isInserted: false,
89
- diffType,
90
- ...(isExtendedEnabled(diffType) && side !== undefined && {
85
+ ...(side !== undefined && {
91
86
  side
92
87
  })
93
88
  }),
@@ -4,7 +4,6 @@ import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-uti
4
4
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
5
5
  import { fg } from '@atlaskit/platform-feature-flags/fg';
6
6
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
- import { isExtendedEnabled } from '../../isExtendedEnabled';
8
7
  import { getAtomicInlineChangedAttrs } from '../createInlineChangedDecoration';
9
8
  import { applyRevealToElement } from '../revealStyles';
10
9
  import { isInlineAttrChangeNodeName } from './getAttrChangeRanges';
@@ -110,14 +109,6 @@ const applyDeletedNodeMarkupNext = ({
110
109
 
111
110
  /** Single gate for the deleted-node classes and custom properties. */
112
111
  const applyDeletedNodeMarkup = args => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? applyDeletedNodeMarkupNext(args) : applyDeletedNodeMarkupLegacy(args);
113
-
114
- /**
115
- * Checks if a node should apply deleted styles directly without wrapper
116
- * to preserve natural block-level margins
117
- */
118
- const shouldApplyStylesDirectly = nodeName => {
119
- return nodeName === 'heading';
120
- };
121
112
  const applyCellOverlayStyles = ({
122
113
  element,
123
114
  colorScheme,
@@ -184,37 +175,17 @@ const createBlockNodeWrapper = () => {
184
175
  wrapper.setAttribute('style', baseStyle);
185
176
  return wrapper;
186
177
  };
187
-
188
- /**
189
- * Applies styles directly to an HTML element by merging with existing styles
190
- */
191
- const applyStylesToElement = ({
192
- element,
193
- targetNode,
194
- colorScheme,
195
- isActive,
196
- isInserted,
197
- diffType,
198
- hideAddedDiffsUnderline = false
199
- }) => {
200
- const currentStyle = element.getAttribute('style') || '';
201
- const contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
202
- const targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
203
- const nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
204
- element.setAttribute('style', `${currentStyle}${contentStyle}${nodeSpecificStyle}`);
205
- };
206
178
  const applyMultiContainerLikeStyles = ({
207
179
  element,
208
180
  targetNode,
209
181
  colorScheme,
210
182
  isActive,
211
183
  isInserted,
212
- diffType,
213
184
  hideAddedDiffsUnderline = false
214
185
  }) => {
215
186
  const currentStyle = element.getAttribute('style') || '';
216
187
  const targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
217
- const nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
188
+ const nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, hideAddedDiffsUnderline) || '';
218
189
  if (targetNode.type.name === 'decisionList') {
219
190
  const nestedInsertedNodeStyle = resolveNestedInsertedNodeStyle(colorScheme);
220
191
  element.querySelectorAll('li').forEach(listItem => {
@@ -303,16 +274,15 @@ const applyTextLikeBlockNodeStyles = ({
303
274
  colorScheme,
304
275
  isActive,
305
276
  isInserted,
306
- diffType,
307
277
  hideAddedDiffsUnderline = false,
308
278
  highlightInlineLeafNodes = false
309
279
  }) => {
310
280
  const currentStyle = element.getAttribute('style') || '';
311
- const nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
281
+ const nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive, hideAddedDiffsUnderline) || '';
312
282
  if (nodeSpecificStyle) {
313
283
  element.setAttribute('style', `${currentStyle}${nodeSpecificStyle}`);
314
284
  }
315
- const contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
285
+ const contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, hideAddedDiffsUnderline);
316
286
  const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
317
287
  const textNodesToWrap = [];
318
288
  let currentNode = walker.nextNode();
@@ -347,18 +317,17 @@ const createBlockNodeContentWrapper = ({
347
317
  colorScheme,
348
318
  isActive,
349
319
  isInserted,
350
- diffType,
351
320
  hideAddedDiffsUnderline = false
352
321
  }) => {
353
322
  const contentWrapper = document.createElement('div');
354
323
  const targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
355
- const nodeStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline);
324
+ const nodeStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, hideAddedDiffsUnderline);
356
325
 
357
326
  // When the extended experiment is enabled and the content is inserted,
358
327
  // block widget nodes that already have dedicated node-level styling (e.g. boxShadow outline)
359
328
  // should not also get the inline content style (borderBottom underline) on their container.
360
- const shouldSkipContentStyle = isExtendedEnabled(diffType) && isInserted && nodeStyle !== undefined;
361
- const contentStyle = shouldSkipContentStyle ? '' : getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
329
+ const shouldSkipContentStyle = isInserted && nodeStyle !== undefined;
330
+ const contentStyle = shouldSkipContentStyle ? '' : getChangedContentStyle(colorScheme, isActive, isInserted, hideAddedDiffsUnderline);
362
331
  contentWrapper.setAttribute('style', `${contentStyle}${nodeStyle || ''}`);
363
332
  contentWrapper.append(nodeView);
364
333
  return contentWrapper;
@@ -461,12 +430,11 @@ const wrapBlockNode = ({
461
430
  intl,
462
431
  isActive = false,
463
432
  isInserted = false,
464
- diffType,
465
433
  hideAddedDiffsUnderline = false
466
434
  }) => {
467
435
  const blockWrapper = createBlockNodeWrapper();
468
436
  const targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
469
- if (shouldShowRemovedLozenge(targetNodeName) && (!isExtendedEnabled(diffType) || !isInserted)) {
437
+ if (shouldShowRemovedLozenge(targetNodeName) && !isInserted) {
470
438
  const lozenge = createRemovedLozenge(intl, isActive, colorScheme);
471
439
  if (handleEmbedCardWithLozenge({
472
440
  dom,
@@ -496,7 +464,6 @@ const wrapBlockNode = ({
496
464
  colorScheme,
497
465
  isActive,
498
466
  isInserted,
499
- diffType,
500
467
  hideAddedDiffsUnderline
501
468
  });
502
469
  blockWrapper.append(contentWrapper);
@@ -524,95 +491,64 @@ export const wrapBlockNodeView = ({
524
491
  intl,
525
492
  isActive = false,
526
493
  isInserted = false,
527
- diffType,
528
494
  hideAddedDiffsUnderline = false,
529
495
  highlightInlineLeafNodes = false
530
496
  }) => {
531
- if (isExtendedEnabled(diffType)) {
532
- if (nodeView instanceof HTMLElement) {
533
- if (isInserted && isMultiContainerBlockNode(targetNode.type.name)) {
534
- applyMultiContainerLikeStyles({
535
- element: nodeView,
536
- targetNode,
537
- colorScheme,
538
- isActive,
539
- isInserted,
540
- diffType,
541
- hideAddedDiffsUnderline
542
- });
543
- dom.append(nodeView);
544
- return;
545
- }
546
- if (isTextLikeBlockNode(targetNode.type.name)) {
547
- applyTextLikeBlockNodeStyles({
548
- element: nodeView,
549
- targetNode,
550
- colorScheme,
551
- isActive,
552
- isInserted,
553
- diffType,
554
- hideAddedDiffsUnderline,
555
- highlightInlineLeafNodes
556
- });
557
- if (targetNode.type.name === 'blockquote' && fg('platform_editor_ai_show_diff_patch_1')) {
558
- appendStyleToElement(nodeView, quoteBlockLevelStyle);
559
- }
560
- dom.append(nodeView);
561
- return;
562
- }
563
- if (targetNode.type.name === 'table') {
564
- if (expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && isExperimentEnabled('platform_editor_table_diff_rounded_corners')) {
565
- applyTableCellEdgeAttrs({
566
- element: nodeView,
567
- tableNode: targetNode
568
- });
569
- }
570
- applyCellOverlayStyles({
571
- element: nodeView,
572
- colorScheme,
573
- isInserted
574
- });
575
- dom.append(nodeView);
576
- return;
577
- }
578
- }
579
- wrapBlockNode({
580
- dom,
581
- nodeView,
582
- targetNode,
583
- colorScheme,
584
- intl,
585
- isActive,
586
- isInserted,
587
- diffType,
588
- hideAddedDiffsUnderline
589
- });
590
- return;
591
- } else {
592
- if (shouldApplyStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
593
- // Apply deleted styles directly to preserve natural block-level margins
594
- applyStylesToElement({
497
+ if (nodeView instanceof HTMLElement) {
498
+ if (isInserted && isMultiContainerBlockNode(targetNode.type.name)) {
499
+ applyMultiContainerLikeStyles({
595
500
  element: nodeView,
596
501
  targetNode,
597
502
  colorScheme,
598
503
  isActive,
599
504
  isInserted,
600
- diffType
505
+ hideAddedDiffsUnderline
601
506
  });
602
507
  dom.append(nodeView);
603
- } else {
604
- wrapBlockNode({
605
- dom,
606
- nodeView,
508
+ return;
509
+ }
510
+ if (isTextLikeBlockNode(targetNode.type.name)) {
511
+ applyTextLikeBlockNodeStyles({
512
+ element: nodeView,
607
513
  targetNode,
608
514
  colorScheme,
609
- intl,
610
515
  isActive,
611
516
  isInserted,
612
- diffType
517
+ hideAddedDiffsUnderline,
518
+ highlightInlineLeafNodes
519
+ });
520
+ if (targetNode.type.name === 'blockquote' && fg('platform_editor_ai_show_diff_patch_1')) {
521
+ appendStyleToElement(nodeView, quoteBlockLevelStyle);
522
+ }
523
+ dom.append(nodeView);
524
+ return;
525
+ }
526
+ if (targetNode.type.name === 'table') {
527
+ if (expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && isExperimentEnabled('platform_editor_table_diff_rounded_corners')) {
528
+ applyTableCellEdgeAttrs({
529
+ element: nodeView,
530
+ tableNode: targetNode
531
+ });
532
+ }
533
+ applyCellOverlayStyles({
534
+ element: nodeView,
535
+ colorScheme,
536
+ isInserted
613
537
  });
538
+ dom.append(nodeView);
539
+ return;
614
540
  }
615
541
  }
542
+ wrapBlockNode({
543
+ dom,
544
+ nodeView,
545
+ targetNode,
546
+ colorScheme,
547
+ intl,
548
+ isActive,
549
+ isInserted,
550
+ hideAddedDiffsUnderline
551
+ });
616
552
  };
617
553
 
618
554
  /**
@@ -625,7 +561,6 @@ export const injectInnerWrapper = ({
625
561
  colorScheme,
626
562
  isActive,
627
563
  isInserted,
628
- diffType,
629
564
  reveal
630
565
  }) => {
631
566
  const wrapper = document.createElement('span');
@@ -636,7 +571,7 @@ export const injectInnerWrapper = ({
636
571
  isInserted: isInserted !== null && isInserted !== void 0 ? isInserted : false,
637
572
  reveal
638
573
  });
639
- wrapper.setAttribute('style', (isInserted ? getInsertedContentStyle(colorScheme, isActive) : getDeletedContentStyle(colorScheme, isActive, diffType, Boolean(revealStyle))) + revealStyle);
574
+ wrapper.setAttribute('style', (isInserted ? getInsertedContentStyle(colorScheme, isActive) : getDeletedContentStyle(colorScheme, isActive, Boolean(revealStyle))) + revealStyle);
640
575
  [...node.childNodes].forEach(child => {
641
576
  const removedChild = node.removeChild(child);
642
577
  wrapper.append(removedChild);
@@ -648,7 +583,7 @@ export const injectInnerWrapper = ({
648
583
  /**
649
584
  * Creates a styled span wrapper for inline content within a change decoration.
650
585
  */
651
- export const createContentWrapper = (colorScheme, isActive = false, isInserted = false, diffType, reveal) => {
586
+ export const createContentWrapper = (colorScheme, isActive = false, isInserted = false, reveal) => {
652
587
  const wrapper = document.createElement('span');
653
588
  const baseStyle = convertToInlineCss({
654
589
  position: 'relative',
@@ -663,16 +598,9 @@ export const createContentWrapper = (colorScheme, isActive = false, isInserted =
663
598
  isInserted,
664
599
  reveal
665
600
  });
666
- const deletedStyle = getDeletedContentStyle(colorScheme, isActive, diffType, Boolean(revealStyle));
667
- if (isExtendedEnabled(diffType)) {
668
- if (isInserted) {
669
- wrapper.setAttribute('style', `${baseStyle}${getInsertedContentStyle(colorScheme, isActive)}${revealStyle}`);
670
- } else {
671
- wrapper.setAttribute('style', `${baseStyle}${deletedStyle}${revealStyle}`);
672
- const strikethrough = document.createElement('span');
673
- strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colorScheme, isActive));
674
- wrapper.append(strikethrough);
675
- }
601
+ const deletedStyle = getDeletedContentStyle(colorScheme, isActive, Boolean(revealStyle));
602
+ if (isInserted) {
603
+ wrapper.setAttribute('style', `${baseStyle}${getInsertedContentStyle(colorScheme, isActive)}${revealStyle}`);
676
604
  } else {
677
605
  wrapper.setAttribute('style', `${baseStyle}${deletedStyle}${revealStyle}`);
678
606
  const strikethrough = document.createElement('span');
@@ -12,7 +12,6 @@
12
12
  */
13
13
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
14
14
  import { fg } from '@atlaskit/platform-feature-flags/fg';
15
- import { isExtendedEnabled } from '../../isExtendedEnabled';
16
15
  import { buildAddedCellOverlayRoundedStyle, buildAddedCellOverlayStyle, buildAddedCellOverlayStyleNew, buildDeletedCellOverlayRoundedStyle, buildDeletedCellOverlayStyle, buildDeletedInlineContentStyle, buildDeletedInlineContentStyleExtended, buildDeletedLozengeActiveStyle, buildDeletedLozengeStyle, buildDeletedNodeCSSVariables, buildDeletedQuoteNodeWithLozengeStyle, buildDeletedStrikethroughLine, buildDeletedWrappedBlockOutline, buildInsertedBlockNodeStyle, buildInsertedInlineStyle, buildInsertStyleInBlockExtended, buildInsertStyleInBlockExtendedNoUnderline, buildInsertStyleNode } from '../colorSchemes/factory';
17
16
  import { colorSchemeRegistry, getLegacyColorScheme, standardScheme } from '../colorSchemes/schemes';
18
17
  import { getChangedContentStyleLegacy, getChangedNodeStyleLegacy, getDeletedContentStyleLegacy, getDeletedContentStyleUnboundedLegacy, getInsertedContentStyleLegacy, hasRestingDeletedRingLegacy, resolveCellOverlayStyleLegacy, resolveNestedInsertedNodeStyleLegacy, resolveRemovedLozengeStyleLegacy } from './wrapBlockNodeViewStyles.legacy';
@@ -33,9 +32,9 @@ export const isMultiContainerBlockNode = nodeName => {
33
32
  export const isTextLikeBlockNode = nodeName => {
34
33
  return ['heading', 'bulletList', 'orderedList', 'listItem', 'taskList', 'blockquote'].includes(nodeName);
35
34
  };
36
- const getChangedContentStyleNext = (colorScheme, isActive = false, isInserted = false, diffType, hideAddedDiffsUnderline = false) => {
35
+ const getChangedContentStyleNext = (colorScheme, isActive = false, isInserted = false, hideAddedDiffsUnderline = false) => {
37
36
  const colors = getColorScheme(colorScheme);
38
- if (isExtendedEnabled(diffType) && isInserted) {
37
+ if (isInserted) {
39
38
  return buildInsertedInlineStyle(colors, isActive, hideAddedDiffsUnderline);
40
39
  }
41
40
  const base = buildDeletedInlineContentStyle(colors, isActive ? 'active' : 'new');
@@ -43,14 +42,14 @@ const getChangedContentStyleNext = (colorScheme, isActive = false, isInserted =
43
42
  // Text-like blocks (heading, lists, blockquote) render their deleted content through this
44
43
  // getter rather than `getDeletedContentStyle`, so without this they never receive the
45
44
  // glyphTint background + underline that plain deleted text already gets.
46
- if (fg('confluence_ncs_step_diffing_version_history') && colors.deletedInlineTreatment === 'glyphTint' && isExtendedEnabled(diffType)) {
45
+ if (fg('confluence_ncs_step_diffing_version_history') && colors.deletedInlineTreatment === 'glyphTint') {
47
46
  return base + buildDeletedInlineContentStyleExtended(colors, isActive);
48
47
  }
49
48
  return base;
50
49
  };
51
- const getChangedNodeStyleNext = (nodeName, colorScheme, isInserted = false, isActive = false, diffType, hideAddedDiffsUnderline = false) => {
50
+ const getChangedNodeStyleNext = (nodeName, colorScheme, isInserted = false, isActive = false, hideAddedDiffsUnderline = false) => {
52
51
  const colors = getColorScheme(colorScheme);
53
- if (isExtendedEnabled(diffType) && isInserted) {
52
+ if (isInserted) {
54
53
  if (isMultiContainerBlockNode(nodeName)) {
55
54
  return hideAddedDiffsUnderline || fg('platform_editor_ai_show_diff_patch_1') ? buildInsertStyleInBlockExtendedNoUnderline(nestedContentScheme) : buildInsertStyleInBlockExtended(nestedContentScheme);
56
55
  }
@@ -80,12 +79,12 @@ const getChangedNodeStyleNext = (nodeName, colorScheme, isInserted = false, isAc
80
79
  };
81
80
  const getDeletedContentStyleUnboundedNext = (colorScheme, isActive = false) => buildDeletedStrikethroughLine(getColorScheme(colorScheme), isActive);
82
81
  const getInsertedContentStyleNext = (colorScheme, isActive = false, hideAddedDiffsUnderline = false) => buildInsertedInlineStyle(getColorScheme(colorScheme), isActive, hideAddedDiffsUnderline);
83
- const getDeletedContentStyleNext = (colorScheme, isActive = false, diffType, omitHighlight = false) => {
82
+ const getDeletedContentStyleNext = (colorScheme, isActive = false, omitHighlight = false) => {
84
83
  const colors = getColorScheme(colorScheme);
85
84
  const base = buildDeletedInlineContentStyle(colors, isActive ? 'active' : 'new');
86
85
 
87
86
  // glyphTint adds a background highlight and border-bottom over the tint; strikethrough does not.
88
- const needsExtendedHighlight = colors.deletedInlineTreatment === 'glyphTint' && isExtendedEnabled(diffType) && !omitHighlight;
87
+ const needsExtendedHighlight = colors.deletedInlineTreatment === 'glyphTint' && !omitHighlight;
89
88
  return needsExtendedHighlight ? base + buildDeletedInlineContentStyleExtended(colors, isActive) : base;
90
89
  };
91
90
  const resolveCellOverlayStyleNext = ({
@@ -110,10 +109,10 @@ const resolveNestedInsertedNodeStyleNext = colorScheme => buildInsertStyleNode(f
110
109
  const hasRestingDeletedRingNext = colorScheme => getColorScheme(colorScheme).deletedNodeEmphasis === 'stateful';
111
110
 
112
111
  /** Inline content style for a changed (inserted or deleted) block node. */
113
- export const getChangedContentStyle = (colorScheme, isActive = false, isInserted = false, diffType, hideAddedDiffsUnderline = false) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getChangedContentStyleNext(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline) : getChangedContentStyleLegacy(getLegacyColorScheme(colorScheme), isActive, isInserted, diffType, hideAddedDiffsUnderline);
112
+ export const getChangedContentStyle = (colorScheme, isActive = false, isInserted = false, hideAddedDiffsUnderline = false) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getChangedContentStyleNext(colorScheme, isActive, isInserted, hideAddedDiffsUnderline) : getChangedContentStyleLegacy(getLegacyColorScheme(colorScheme), isActive, isInserted, hideAddedDiffsUnderline);
114
113
 
115
114
  /** Node-specific style for a changed block node, or `undefined` when the node type has none. */
116
- export const getChangedNodeStyle = (nodeName, colorScheme, isInserted = false, isActive = false, diffType, hideAddedDiffsUnderline = false) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getChangedNodeStyleNext(nodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) : getChangedNodeStyleLegacy(nodeName, getLegacyColorScheme(colorScheme), isInserted, isActive, diffType, hideAddedDiffsUnderline);
115
+ export const getChangedNodeStyle = (nodeName, colorScheme, isInserted = false, isActive = false, hideAddedDiffsUnderline = false) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getChangedNodeStyleNext(nodeName, colorScheme, isInserted, isActive, hideAddedDiffsUnderline) : getChangedNodeStyleLegacy(nodeName, getLegacyColorScheme(colorScheme), isInserted, isActive, hideAddedDiffsUnderline);
117
116
 
118
117
  /** The positioned line drawn across deleted content spanning an unbounded range. */
119
118
  export const getDeletedContentStyleUnbounded = (colorScheme, isActive = false) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getDeletedContentStyleUnboundedNext(colorScheme, isActive) : getDeletedContentStyleUnboundedLegacy(getLegacyColorScheme(colorScheme), isActive);
@@ -122,10 +121,10 @@ export const getDeletedContentStyleUnbounded = (colorScheme, isActive = false) =
122
121
  export const getInsertedContentStyle = (colorScheme, isActive = false, hideAddedDiffsUnderline = false) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getInsertedContentStyleNext(colorScheme, isActive, hideAddedDiffsUnderline) : getInsertedContentStyleLegacy(getLegacyColorScheme(colorScheme), isActive, hideAddedDiffsUnderline);
123
122
 
124
123
  /** Inline style for deleted content. */
125
- export const getDeletedContentStyle = (colorScheme, isActive = false, diffType,
124
+ export const getDeletedContentStyle = (colorScheme, isActive = false,
126
125
  // Set while the reveal animation is running: it paints the highlight itself so it can wipe it in
127
126
  // left-to-right, and a static background here would leave nothing to reveal.
128
- omitHighlight = false) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getDeletedContentStyleNext(colorScheme, isActive, diffType, omitHighlight) : getDeletedContentStyleLegacy(getLegacyColorScheme(colorScheme), isActive, diffType, omitHighlight);
127
+ omitHighlight = false) => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getDeletedContentStyleNext(colorScheme, isActive, omitHighlight) : getDeletedContentStyleLegacy(getLegacyColorScheme(colorScheme), isActive, omitHighlight);
129
128
 
130
129
  /**
131
130
  * Overlay style for one added or deleted table cell. Invariant across the cells of a table, so the
@@ -10,7 +10,6 @@
10
10
  */
11
11
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
12
12
  import { fg } from '@atlaskit/platform-feature-flags/fg';
13
- import { isExtendedEnabled } from '../../isExtendedEnabled';
14
13
  import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyleUnbounded, deletedInlineContentStyleExtended, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingContentStyleInBlockExtended, editingContentStyleInBlockExtendedNoUnderline, editingStyleExtended, editingStyleExtendedNoUnderline, editingStyleActiveExtended, editingStyleActiveExtendedNoUnderline, editingStyleNode, getStandardDeletedContentStyleActive, getStandardDeletedContentStyleNew, addedCellOverlayStyle, addedCellOverlayRoundedStyle, deletedCellOverlayStyle, deletedCellOverlayRoundedStyle } from '../colorSchemes/standard';
15
14
  import { deletedTraditionalBlockOutlineActive, deletedTraditionalBlockOutlineNew, deletedTraditionalBlockOutlineRoundedActive, deletedTraditionalBlockOutlineRoundedNew, deletedTraditionalContentStyleUnbounded, deletedTraditionalContentStyleUnboundedActive, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, deletedTraditionalStyleQuoteNodeActive, traditionalInsertStyle, traditionalInsertStyleActive, traditionalStyleNodeActive, traditionalStyleNodeNew, traditionalAddedCellOverlayRoundedStyle, traditionalAddedCellOverlayStyleNew, deletedTraditionalCellOverlayStyle, deletedTraditionalCellOverlayRoundedStyle } from '../colorSchemes/traditional';
16
15
  const lozengeStyle = convertToInlineCss({
@@ -76,8 +75,8 @@ const isTextLikeBlockNode = nodeName => {
76
75
  };
77
76
 
78
77
  /** Pre-refactor inline content style for a changed (inserted or deleted) block node. */
79
- export const getChangedContentStyleLegacy = (colorScheme, isActive = false, isInserted = false, diffType, hideAddedDiffsUnderline = false) => {
80
- if (isExtendedEnabled(diffType) && isInserted) {
78
+ export const getChangedContentStyleLegacy = (colorScheme, isActive = false, isInserted = false, hideAddedDiffsUnderline = false) => {
79
+ if (isInserted) {
81
80
  if (colorScheme === 'traditional') {
82
81
  return isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
83
82
  }
@@ -93,9 +92,9 @@ export const getChangedContentStyleLegacy = (colorScheme, isActive = false, isIn
93
92
  };
94
93
 
95
94
  /** Pre-refactor node-specific style for a changed block node. */
96
- export const getChangedNodeStyleLegacy = (nodeName, colorScheme, isInserted = false, isActive = false, diffType, hideAddedDiffsUnderline = false) => {
95
+ export const getChangedNodeStyleLegacy = (nodeName, colorScheme, isInserted = false, isActive = false, hideAddedDiffsUnderline = false) => {
97
96
  const isTraditional = colorScheme === 'traditional';
98
- if (isExtendedEnabled(diffType) && isInserted) {
97
+ if (isInserted) {
99
98
  if (isMultiContainerBlockNode(nodeName)) {
100
99
  return hideAddedDiffsUnderline || fg('platform_editor_ai_show_diff_patch_1') ? editingContentStyleInBlockExtendedNoUnderline : editingContentStyleInBlockExtended;
101
100
  }
@@ -150,14 +149,14 @@ export const getInsertedContentStyleLegacy = (colorScheme, isActive = false, hid
150
149
  };
151
150
 
152
151
  /** Pre-refactor inline style for deleted content. */
153
- export const getDeletedContentStyleLegacy = (colorScheme, isActive = false, diffType,
152
+ export const getDeletedContentStyleLegacy = (colorScheme, isActive = false,
154
153
  // The reveal animation paints the highlight itself so it can wipe it in; a static one here would
155
154
  // cover the whole span and leave nothing to reveal. Mirrors the same option on the Next variant.
156
155
  omitHighlight = false) => {
157
156
  if (colorScheme === 'traditional') {
158
157
  return getDeletedTraditionalInlineStyle(isActive);
159
158
  }
160
- if (isExtendedEnabled(diffType) && !omitHighlight) {
159
+ if (!omitHighlight) {
161
160
  return (isActive ? getStandardDeletedContentStyleActive() : getStandardDeletedContentStyleNew()) + deletedInlineContentStyleExtended;
162
161
  }
163
162
  return isActive ? getStandardDeletedContentStyleActive() : getStandardDeletedContentStyleNew();
@@ -0,0 +1,2 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
2
+ export const getDefaultDiffType = () => fg('platform_editor_ai_smart_diff') ? 'smart' : 'inline';
@@ -1,7 +1,6 @@
1
1
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
2
2
  import { fg } from '@atlaskit/platform-feature-flags/fg';
3
- import { DiffDecorationKey, isDiffDecoration, isDiffDecorationSpec } from './decorations/decorationKeys';
4
- import { isExtendedEnabled } from './isExtendedEnabled';
3
+ import { isDiffDecoration, isDiffDecorationSpec } from './decorations/decorationKeys';
5
4
 
6
5
  /**
7
6
  * True if `fragment` contains at least one inline node (text, hardBreak, emoji, mention, etc.).
@@ -36,9 +35,6 @@ export function isInlineDiffDecorationRenderableInDoc(doc, from, to) {
36
35
  function isRangeFullyInside(range1Start, range1End, range2Start, range2End) {
37
36
  return range2Start <= range1Start && range1End <= range2End;
38
37
  }
39
- function specHasDiffKeyPrefix(spec, keyPrefix) {
40
- return Boolean(spec && typeof spec === 'object' && 'key' in spec && typeof spec.key === 'string' && spec.key.startsWith(keyPrefix));
41
- }
42
38
 
43
39
  /**
44
40
  * Where a decoration paints relative to others at the same position: negative before the node at
@@ -164,24 +160,15 @@ function groupTouchingDecorations(decorations, isInlineDecoration) {
164
160
  * @param doc - Current document; when set, diff-inline ranges are validated against this doc
165
161
  * @returns Array of scrollable decorations, sorted and deduplicated
166
162
  */
167
- export const getScrollableDecorations = (set, doc, diffType) => {
163
+ export const getScrollableDecorations = (set, doc) => {
168
164
  if (!set) {
169
165
  return [];
170
166
  }
171
- const isBlockDecoration = decoration => {
172
- var _decoration$spec$key$, _decoration$spec, _decoration$spec$key;
173
- return isExtendedEnabled(diffType) ? isDiffDecoration(decoration) && decoration.spec.decorationType === 'block' : (_decoration$spec$key$ = (_decoration$spec = decoration.spec) === null || _decoration$spec === void 0 ? void 0 : (_decoration$spec$key = _decoration$spec.key) === null || _decoration$spec$key === void 0 ? void 0 : _decoration$spec$key.startsWith(DiffDecorationKey.block)) !== null && _decoration$spec$key$ !== void 0 ? _decoration$spec$key$ : false;
174
- };
175
- const isInlineDecoration = decoration => {
176
- var _decoration$spec$key$2, _decoration$spec2, _decoration$spec2$key;
177
- return isExtendedEnabled(diffType) ? isDiffDecoration(decoration) && decoration.spec.decorationType === 'inline' : (_decoration$spec$key$2 = (_decoration$spec2 = decoration.spec) === null || _decoration$spec2 === void 0 ? void 0 : (_decoration$spec2$key = _decoration$spec2.key) === null || _decoration$spec2$key === void 0 ? void 0 : _decoration$spec2$key.startsWith(DiffDecorationKey.inline)) !== null && _decoration$spec$key$2 !== void 0 ? _decoration$spec$key$2 : false;
178
- };
179
- const isWidgetDecoration = decoration => {
180
- var _decoration$spec$key$3, _decoration$spec3, _decoration$spec3$key;
181
- return isExtendedEnabled(diffType) ? isDiffDecoration(decoration) && decoration.spec.decorationType === 'widget' : (_decoration$spec$key$3 = (_decoration$spec3 = decoration.spec) === null || _decoration$spec3 === void 0 ? void 0 : (_decoration$spec3$key = _decoration$spec3.key) === null || _decoration$spec3$key === void 0 ? void 0 : _decoration$spec3$key.startsWith(DiffDecorationKey.widget)) !== null && _decoration$spec$key$3 !== void 0 ? _decoration$spec$key$3 : false;
182
- };
167
+ const isBlockDecoration = decoration => isDiffDecoration(decoration) && decoration.spec.decorationType === 'block';
168
+ const isInlineDecoration = decoration => isDiffDecoration(decoration) && decoration.spec.decorationType === 'inline';
169
+ const isWidgetDecoration = decoration => isDiffDecoration(decoration) && decoration.spec.decorationType === 'widget';
183
170
  const seenBlockKeys = new Set();
184
- const allDecorations = isExtendedEnabled(diffType) ? set.find(undefined, undefined, isDiffDecorationSpec) : set.find(undefined, undefined, spec => specHasDiffKeyPrefix(spec, DiffDecorationKey.inline) || specHasDiffKeyPrefix(spec, DiffDecorationKey.widget) || specHasDiffKeyPrefix(spec, DiffDecorationKey.block));
171
+ const allDecorations = set.find(undefined, undefined, isDiffDecorationSpec);
185
172
 
186
173
  // First pass: filter out listItem blocks and deduplicates blocks
187
174
  const filtered = allDecorations.filter(dec => {