@atlaskit/editor-plugin-show-diff 19.0.3 → 20.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +11 -11
  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
@@ -5,7 +5,6 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
5
5
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
6
6
  import { fg } from '@atlaskit/platform-feature-flags/fg';
7
7
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
- import { isExtendedEnabled } from '../isExtendedEnabled';
9
8
  import { buildAddedCellOverlayRoundedStyle, buildAddedCellOverlayStyle, buildDeletedCellOverlayRoundedStyle, buildDeletedCellOverlayStyle, buildDeletedRowStyle } from './colorSchemes/factory';
10
9
  import { colorSchemeRegistry, getLegacyColorScheme } from './colorSchemes/schemes';
11
10
  import { createLeftAnchorWidget } from './createAnchorDecorationWidgets';
@@ -21,8 +20,7 @@ import { createRemovedLozenge } from './utils/wrapBlockNodeView';
21
20
  const extractChangedRows = ({
22
21
  change,
23
22
  originalDoc,
24
- newDoc,
25
- diffType
23
+ newDoc
26
24
  }) => {
27
25
  const changedRows = [];
28
26
 
@@ -57,7 +55,7 @@ const extractChangedRows = ({
57
55
  // Find which rows were changed by analyzing the change range
58
56
  const changeStartInTable = change.fromA - tableOld.pos - 1;
59
57
  const changeEndInTable = change.toA - tableOld.pos - 1;
60
- const edgeAttrsByOffset = isExtendedEnabled(diffType) && expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && isExperimentEnabled('platform_editor_table_diff_rounded_corners') ? getTableTopAndBottomCellEdgeAttrs(oldTableMap) : undefined;
58
+ const edgeAttrsByOffset = expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && isExperimentEnabled('platform_editor_table_diff_rounded_corners') ? getTableTopAndBottomCellEdgeAttrs(oldTableMap) : undefined;
61
59
  let currentOffset = 0;
62
60
  let rowIndex = 0;
63
61
  tableOld.node.content.forEach(rowNode => {
@@ -66,7 +64,7 @@ const extractChangedRows = ({
66
64
 
67
65
  // Check if this row overlaps with the deletion range
68
66
  const rowOverlapsChange = rowStart >= changeStartInTable && rowStart < changeEndInTable || rowEnd > changeStartInTable && rowEnd <= changeEndInTable || rowStart < changeStartInTable && rowEnd > changeEndInTable;
69
- if (rowOverlapsChange && rowNode.type.name === 'tableRow' && (isExtendedEnabled(diffType) || !isEmptyRow(rowNode))) {
67
+ if (rowOverlapsChange && rowNode.type.name === 'tableRow') {
70
68
  const rowLocalId = rowNode.attrs.localId;
71
69
  const isTableRowReplacement = rowLocalId && tableNew.node.children.some(candidateRow => candidateRow.type.name === 'tableRow' && candidateRow.attrs.localId === rowLocalId);
72
70
  const cellEdgeAttrs = edgeAttrsByOffset ? getRowCellEdgeAttrs({
@@ -122,32 +120,6 @@ const extractChangedRows = ({
122
120
  return true;
123
121
  });
124
122
  };
125
-
126
- /**
127
- * Checks if a table row is empty (contains no meaningful content)
128
- */
129
- const isEmptyRow = rowNode => {
130
- let isEmpty = true;
131
- rowNode.descendants(node => {
132
- if (!isEmpty) {
133
- return false;
134
- }
135
-
136
- // If we find any inline content with size > 0, the row is not empty
137
- if (node.isInline && node.nodeSize > 0) {
138
- isEmpty = false;
139
- return false;
140
- }
141
-
142
- // If we find text content, the row is not empty
143
- if (node.isText && node.text && node.text.trim() !== '') {
144
- isEmpty = false;
145
- return false;
146
- }
147
- return true;
148
- });
149
- return isEmpty;
150
- };
151
123
  /**
152
124
  * Creates a DOM representation of a deleted table row
153
125
  */
@@ -158,7 +130,6 @@ const createChangedRowDOM = ({
158
130
  isTableRowReplacement,
159
131
  colorScheme,
160
132
  isInserted,
161
- diffType,
162
133
  hasAnchoredRemovedLozenge,
163
134
  intl,
164
135
  isActive
@@ -169,16 +140,15 @@ const createChangedRowDOM = ({
169
140
  }
170
141
  const colors = colorSchemeRegistry[colorScheme !== null && colorScheme !== void 0 ? colorScheme : 'standard'];
171
142
  const deletedTreatment = isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? buildDeletedRowStyle(colors) : resolveDeletedRowStyleLegacy(getLegacyColorScheme(colorScheme));
172
- const hostsRemovedLozenge = Boolean(intl) && isExtendedEnabled(diffType) && !isInserted && !hasAnchoredRemovedLozenge;
143
+ const hostsRemovedLozenge = Boolean(intl) && !isInserted && !hasAnchoredRemovedLozenge;
173
144
 
174
145
  // Inserted rows keep their natural styling; the row strikethrough is deletions only.
175
- if (!isExtendedEnabled(diffType) || !isInserted) {
146
+ if (!isInserted) {
176
147
  tr.setAttribute('style', deletedTreatment);
177
148
  }
178
- // Mirrors the strikethrough condition above: under the extended experience an `isInserted` row
179
- // is ADDED content, so it must not claim the "deleted" testid — page models match that as
149
+ // Mirrors the strikethrough condition above: an `isInserted` row is ADDED content, so it must not claim the "deleted" testid — page models match that as
180
150
  // removed content (same reasoning as `createTableCellContentWidgets`).
181
- tr.setAttribute('data-testid', isExtendedEnabled(diffType) && isInserted && fg('platform_editor_ai_show_diff_patch_1') ? 'show-diff-changed-row' : 'show-diff-deleted-row');
151
+ tr.setAttribute('data-testid', isInserted && fg('platform_editor_ai_show_diff_patch_1') ? 'show-diff-changed-row' : 'show-diff-deleted-row');
182
152
  if (fg('platform_editor_ai_show_diff_patch_1')) {
183
153
  tr.style.setProperty('scroll-margin-top', scrollMarginTopValue);
184
154
  }
@@ -191,17 +161,15 @@ const createChangedRowDOM = ({
191
161
  if (nodeView) {
192
162
  if (nodeView instanceof HTMLElement) {
193
163
  applyCellEdgeAttrs(nodeView, cellEdgeAttrs === null || cellEdgeAttrs === void 0 ? void 0 : cellEdgeAttrs[cellIndex]);
194
- if (isExtendedEnabled(diffType)) {
195
- const overlay = document.createElement('span');
196
- const isRoundedTable = isExperimentEnabled('platform_editor_table_diff_rounded_corners');
197
- const overlayStyle = isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? isInserted ? isRoundedTable ? buildAddedCellOverlayRoundedStyle(colors) : buildAddedCellOverlayStyle(colors) : isRoundedTable ? buildDeletedCellOverlayRoundedStyle(colors) : buildDeletedCellOverlayStyle(colors) : resolveCellOverlayStyleLegacy({
198
- colorScheme: getLegacyColorScheme(colorScheme),
199
- isInserted,
200
- isRoundedTable
201
- });
202
- overlay.setAttribute('style', overlayStyle);
203
- nodeView.appendChild(overlay);
204
- }
164
+ const overlay = document.createElement('span');
165
+ const isRoundedTable = isExperimentEnabled('platform_editor_table_diff_rounded_corners');
166
+ const overlayStyle = isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? isInserted ? isRoundedTable ? buildAddedCellOverlayRoundedStyle(colors) : buildAddedCellOverlayStyle(colors) : isRoundedTable ? buildDeletedCellOverlayRoundedStyle(colors) : buildDeletedCellOverlayStyle(colors) : resolveCellOverlayStyleLegacy({
167
+ colorScheme: getLegacyColorScheme(colorScheme),
168
+ isInserted,
169
+ isRoundedTable
170
+ });
171
+ overlay.setAttribute('style', overlayStyle);
172
+ nodeView.appendChild(overlay);
205
173
  }
206
174
  tr.appendChild(nodeView);
207
175
  } else {
@@ -255,8 +223,7 @@ const createAnchoredRemovedLozengeWidget = ({
255
223
  const expandDiffForChangedRows = ({
256
224
  changes,
257
225
  originalDoc,
258
- newDoc,
259
- diffType
226
+ newDoc
260
227
  }) => {
261
228
  const rowInfo = [];
262
229
  for (const change of changes) {
@@ -264,8 +231,7 @@ const expandDiffForChangedRows = ({
264
231
  const changedRows = extractChangedRows({
265
232
  change,
266
233
  originalDoc,
267
- newDoc,
268
- diffType
234
+ newDoc
269
235
  });
270
236
  if (changedRows.length > 0) {
271
237
  rowInfo.push(...changedRows);
@@ -287,7 +253,6 @@ export const createChangedRowDecorationWidgets = ({
287
253
  isActive,
288
254
  isInserted = false,
289
255
  leftAnchorId,
290
- diffType,
291
256
  intl,
292
257
  showIndicators = false,
293
258
  showContributorTags = false,
@@ -297,13 +262,12 @@ export const createChangedRowDecorationWidgets = ({
297
262
  const changedRows = expandDiffForChangedRows({
298
263
  changes: changes.filter(change => change.deleted.length > 0),
299
264
  originalDoc,
300
- newDoc,
301
- diffType
265
+ newDoc
302
266
  });
303
267
  return changedRows.flatMap(changedRow => {
304
268
  // Keep the ID stable while contributor tags are enabled so recalculation preserves their state.
305
269
  const diffId = showContributorTags ? `widget-row-${changedRow.fromA}-${changedRow.toA}` : crypto.randomUUID();
306
- const hasAnchoredRemovedLozenge = Boolean(intl) && isExtendedEnabled(diffType) && !isInserted && supportsAnchorPositioning();
270
+ const hasAnchoredRemovedLozenge = Boolean(intl) && !isInserted && supportsAnchorPositioning();
307
271
  const rowDOM = createChangedRowDOM({
308
272
  rowNode: changedRow.rowNode,
309
273
  isTableRowReplacement: changedRow.isTableRowReplacement,
@@ -311,7 +275,6 @@ export const createChangedRowDecorationWidgets = ({
311
275
  nodeViewSerializer,
312
276
  colorScheme,
313
277
  isInserted,
314
- diffType,
315
278
  hasAnchoredRemovedLozenge,
316
279
  intl,
317
280
  isActive
@@ -329,7 +292,7 @@ export const createChangedRowDecorationWidgets = ({
329
292
  // is still created but can never resolve a position, so it silently does not render and the
330
293
  // bar covers only the row being changed. `createNodeChangedDecorationWidget` sets the same
331
294
  // property on its own widget DOM for non-table content; this path returns before reaching it.
332
- if (showIndicators && isExtendedEnabled(diffType) && fg('platform_editor_ai_show_diff_patch_1')) {
295
+ if (showIndicators && fg('platform_editor_ai_show_diff_patch_1')) {
333
296
  rowAnchorNames.push(buildAnchorDecorationKey({
334
297
  diffId
335
298
  }));
@@ -383,8 +346,7 @@ export const createChangedRowDecorationWidgets = ({
383
346
  diffId,
384
347
  leftAnchorId,
385
348
  isActive,
386
- isInserted,
387
- diffType
349
+ isInserted
388
350
  })
389
351
  });
390
352
  decorations.push(rowWidget);
@@ -3,7 +3,6 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
3
3
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
4
4
  import { fg } from '@atlaskit/platform-feature-flags/fg';
5
5
  import { CONTRIBUTOR_TAG_Z_INDEX } from '../../ui/ContributorTag/buildContributorTagDom';
6
- import { isExtendedEnabled } from '../isExtendedEnabled';
7
6
  import { isEmptyParagraphSlice } from '../utils/isEmptyParagraphSlice';
8
7
  import { buildAtomicInlineChangedCSSVariables, buildDeletedInlineContentStyleExtended, buildDeletedInlineNodeCSSVariables, buildDeletedInlineStyle, buildDeletedInlineStyleStandard, buildInsertStyle, buildInsertStyleActive, buildInsertStyleExtended, buildInsertStyleExtendedActive, buildInsertStyleExtendedNoUnderline, buildInsertStyleExtendedNoUnderlineActive } from './colorSchemes/factory';
9
8
  import { colorSchemeRegistry, getLegacyColorScheme } from './colorSchemes/schemes';
@@ -54,7 +53,7 @@ const getAtomicInlineNodeClassName = inlineNodeName => {
54
53
  return classNames.join(' ');
55
54
  };
56
55
 
57
- /** Inline style for inserted content under the extended diff experience. */
56
+ /** Inline style for inserted content. */
58
57
  const getExtendedInsertStyle = (colors, isActive, hideAddedDiffsUnderline) => {
59
58
  if (colors.insertedInlineTreatment === 'underline') {
60
59
  // hideAddedDiffsUnderline only targets the 'borderBottom' rule, so it does not apply here.
@@ -66,7 +65,7 @@ const getExtendedInsertStyle = (colors, isActive, hideAddedDiffsUnderline) => {
66
65
  return hideAddedDiffsUnderline ? buildInsertStyleExtendedNoUnderline(colors) : buildInsertStyleExtended(colors);
67
66
  };
68
67
 
69
- /** Inline style for deleted content under the extended diff experience. */
68
+ /** Inline style for deleted content. */
70
69
  const getExtendedDeletedStyle = (colors, isActive) => {
71
70
  if (colors.deletedInlineTreatment === 'strikethrough') {
72
71
  // Identical in both states — the block decoration carries the active emphasis.
@@ -78,16 +77,10 @@ const getExtendedDeletedStyle = (colors, isActive) => {
78
77
  /** Registry-driven inline `style` for a changed-content decoration. */
79
78
  const resolveInlineChangedStyleRefactored = ({
80
79
  colors,
81
- diffType,
82
80
  hideAddedDiffsUnderline,
83
81
  isActive,
84
82
  isInserted
85
- }) => {
86
- if (isExtendedEnabled(diffType)) {
87
- return isInserted ? getExtendedInsertStyle(colors, isActive, hideAddedDiffsUnderline) : getExtendedDeletedStyle(colors, isActive);
88
- }
89
- return isActive ? buildInsertStyleActive(colors) : buildInsertStyle(colors);
90
- };
83
+ }) => isInserted ? getExtendedInsertStyle(colors, isActive, hideAddedDiffsUnderline) : getExtendedDeletedStyle(colors, isActive);
91
84
 
92
85
  /**
93
86
  * Single gate for the inline `style` string: registry + factory when the refactor is on, the
@@ -132,7 +125,6 @@ export const createInlineChangedDecoration = ({
132
125
  showContributorTags = false,
133
126
  showIndicators = false,
134
127
  doc,
135
- diffType,
136
128
  hideAddedDiffsUnderline = false,
137
129
  inlineNodeName,
138
130
  hasDeletedWidget = false,
@@ -148,7 +140,7 @@ export const createInlineChangedDecoration = ({
148
140
 
149
141
  // Match the rendered shape: whitespace text is eligible, while an empty paragraph is structural
150
142
  // content with no tag host.
151
- const canTagChange = showContributorTags && !!doc && isExtendedEnabled(diffType) && isContributorTagWidgetEnabled() && !isEmptyParagraphSlice(doc.slice(change.fromB, change.toB));
143
+ const canTagChange = showContributorTags && !!doc && isContributorTagWidgetEnabled() && !isEmptyParagraphSlice(doc.slice(change.fromB, change.toB));
152
144
  if (shouldHideDeleted) {
153
145
  return [Decoration.inline(change.fromB, change.toB, {
154
146
  style: displayNoneStyle
@@ -166,19 +158,17 @@ export const createInlineChangedDecoration = ({
166
158
  const colors = getColorScheme(colorScheme);
167
159
 
168
160
  // The reveal withholds the static highlight so the wipe has something to reveal, so it supplies
169
- // the whole style rather than adding to the usual one. Extended pipeline only — the AI review
170
- // surface is the only consumer, and the non-extended styles have no background to wipe.
171
- const revealed = isExtendedEnabled(diffType) ? resolveRevealStyle({
161
+ // the whole style rather than adding to the usual one.
162
+ const revealed = resolveRevealStyle({
172
163
  colorScheme,
173
164
  hideAddedDiffsUnderline,
174
165
  isActive,
175
166
  isInserted,
176
167
  reveal
177
- }) : undefined;
168
+ });
178
169
  const style = (_revealed$style = revealed === null || revealed === void 0 ? void 0 : revealed.style) !== null && _revealed$style !== void 0 ? _revealed$style : resolveInlineChangedStyle({
179
170
  colors,
180
171
  colorScheme,
181
- diffType,
182
172
  hideAddedDiffsUnderline,
183
173
  isActive,
184
174
  isInserted
@@ -233,7 +223,7 @@ export const createInlineChangedDecoration = ({
233
223
  isActive,
234
224
  isInserted
235
225
  }))];
236
- if (showIndicators && doc && isExtendedEnabled(diffType)) {
226
+ if (showIndicators && doc) {
237
227
  // For paragraphs, fromB/toB land on the outer block
238
228
  // boundary. Adjust anchor widgets into inline content so the indicator
239
229
  // bar doesn't extend into the preceding block's margin.
@@ -8,42 +8,27 @@
8
8
  * remains unchanged. Delete the whole file at experiment cleanup (EDITOR-8281).
9
9
  */
10
10
 
11
- import { isExtendedEnabled } from '../isExtendedEnabled';
12
- import { deletedInlineContentStyleExtended, editingStyle, editingStyleActive, editingStyleActiveExtended, editingStyleActiveExtendedNoUnderline, editingStyleExtended, editingStyleExtendedNoUnderline, getStandardDeletedContentStyle, getStandardDeletedContentStyleActive } from './colorSchemes/standard';
11
+ import { deletedInlineContentStyleExtended, editingStyleActiveExtended, editingStyleActiveExtendedNoUnderline, editingStyleExtended, editingStyleExtendedNoUnderline, getStandardDeletedContentStyle, getStandardDeletedContentStyleActive } from './colorSchemes/standard';
13
12
  import { getDeletedTraditionalInlineStyle, traditionalInsertStyle, traditionalInsertStyleActive } from './colorSchemes/traditional';
14
13
  /**
15
14
  * Pre-refactor inline `style` computation for `createInlineChangedDecoration`.
16
15
  */
17
16
  export const resolveInlineChangedStyleLegacy = ({
18
17
  colorScheme,
19
- diffType,
20
18
  hideAddedDiffsUnderline,
21
19
  isActive,
22
20
  isInserted
23
21
  }) => {
24
- let style;
25
- if (isExtendedEnabled(diffType)) {
26
- if (isInserted) {
27
- if (colorScheme === 'traditional') {
28
- style = isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
29
- } else {
30
- style = isActive ? hideAddedDiffsUnderline ? editingStyleActiveExtendedNoUnderline : editingStyleActiveExtended : hideAddedDiffsUnderline ? editingStyleExtendedNoUnderline : editingStyleExtended;
31
- }
32
- } else {
33
- if (colorScheme === 'traditional') {
34
- style = getDeletedTraditionalInlineStyle(false);
35
- } else {
36
- style = (isActive ? getStandardDeletedContentStyleActive() : getStandardDeletedContentStyle()) + deletedInlineContentStyleExtended;
37
- }
38
- }
39
- } else {
22
+ if (isInserted) {
40
23
  if (colorScheme === 'traditional') {
41
- style = isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
42
- } else {
43
- style = isActive ? editingStyleActive : editingStyle;
24
+ return isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
44
25
  }
26
+ return isActive ? hideAddedDiffsUnderline ? editingStyleActiveExtendedNoUnderline : editingStyleActiveExtended : hideAddedDiffsUnderline ? editingStyleExtendedNoUnderline : editingStyleExtended;
27
+ }
28
+ if (colorScheme === 'traditional') {
29
+ return getDeletedTraditionalInlineStyle(false);
45
30
  }
46
- return style;
31
+ return (isActive ? getStandardDeletedContentStyleActive() : getStandardDeletedContentStyle()) + deletedInlineContentStyleExtended;
47
32
  };
48
33
 
49
34
  /**
@@ -1,6 +1,5 @@
1
1
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
2
2
  import { fg } from '@atlaskit/platform-feature-flags/fg';
3
- import { isExtendedEnabled } from '../isExtendedEnabled';
4
3
  import { countEmptyTextBlockOnlySlice } from '../utils/emptyTextBlocks';
5
4
  import { isEmptyParagraphSlice } from '../utils/isEmptyParagraphSlice';
6
5
  import { clampAnchorPosIntoCell, createLeftAnchorWidget } from './createAnchorDecorationWidgets';
@@ -29,8 +28,7 @@ const createTableCellContentWidgets = ({
29
28
  nodeViewSerializer,
30
29
  colorScheme,
31
30
  isInserted,
32
- leftAnchorId,
33
- diffType
31
+ leftAnchorId
34
32
  }) => {
35
33
  // Collect the inner content position of each cell in the new document within
36
34
  // the change range. Whole-cell replacement preserves cell count/order, so the
@@ -59,7 +57,7 @@ const createTableCellContentWidgets = ({
59
57
  // so every block inside the cell is rendered.
60
58
  cellNode.content.forEach(blockNode => {
61
59
  const nodeView = nodeViewSerializer.tryCreateNodeView(blockNode);
62
- const wrapper = createContentWrapper(colorScheme, false, isInserted, diffType);
60
+ const wrapper = createContentWrapper(colorScheme, false, isInserted);
63
61
  if (nodeView) {
64
62
  wrapper.append(nodeView);
65
63
  } else {
@@ -90,10 +88,7 @@ const createTableCellContentWidgets = ({
90
88
  diffId: crypto.randomUUID(),
91
89
  leftAnchorId,
92
90
  isInserted,
93
- diffType,
94
- ...(isExtendedEnabled(diffType) && {
95
- side: -1
96
- })
91
+ side: -1
97
92
  })
98
93
  }));
99
94
  });
@@ -122,7 +117,6 @@ export const createNodeChangedDecorationWidget = ({
122
117
  // before it. Used for `smart` node-level changes so the deleted node appears beneath
123
118
  // its replacement (gray + strikethrough).
124
119
  placeBelow = false,
125
- diffType,
126
120
  hideAddedDiffsUnderline = false,
127
121
  reveal,
128
122
  tagMountContext,
@@ -155,7 +149,6 @@ export const createNodeChangedDecorationWidget = ({
155
149
  return [createDeletedLineBreakDecoration({
156
150
  colorScheme,
157
151
  count: deletedBlankLineCount,
158
- diffType,
159
152
  isActive,
160
153
  pos: safeInsertPos,
161
154
  reveal,
@@ -180,8 +173,7 @@ export const createNodeChangedDecorationWidget = ({
180
173
  nodeViewSerializer,
181
174
  colorScheme,
182
175
  isInserted,
183
- leftAnchorId,
184
- diffType
176
+ leftAnchorId
185
177
  });
186
178
  }
187
179
  if (tableDiffMode.kind === 'none') {
@@ -198,7 +190,6 @@ export const createNodeChangedDecorationWidget = ({
198
190
  isActive,
199
191
  isInserted,
200
192
  leftAnchorId,
201
- diffType,
202
193
  intl,
203
194
  // Needed for the row's own indicator anchor; this path returns before the
204
195
  // `anchor-name` assignment further down.
@@ -225,8 +216,8 @@ export const createNodeChangedDecorationWidget = ({
225
216
  const isVisuallyFirstInParent = !placeBelow && $safeInsertPos.parentOffset === 0;
226
217
  const isTopLevelInsert = $safeInsertPos.depth === 0;
227
218
  const hasPreviousBlock = ((_$safeInsertPos$nodeB = $safeInsertPos.nodeBefore) === null || _$safeInsertPos$nodeB === void 0 ? void 0 : _$safeInsertPos$nodeB.isBlock) === true;
228
- const isFirstDocHeadingReplacement = isExtendedEnabled(diffType) && !placeBelow && change.fromB === 0 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type.name) === 'heading' && ((_newDoc$firstChild = newDoc.firstChild) === null || _newDoc$firstChild === void 0 ? void 0 : _newDoc$firstChild.type.name) === 'heading';
229
- if (isExtendedEnabled(diffType) && isTopLevelInsert && hasPreviousBlock && !isFirstDocHeadingReplacement) {
219
+ const isFirstDocHeadingReplacement = !placeBelow && change.fromB === 0 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type.name) === 'heading' && ((_newDoc$firstChild = newDoc.firstChild) === null || _newDoc$firstChild === void 0 ? void 0 : _newDoc$firstChild.type.name) === 'heading';
220
+ if (isTopLevelInsert && hasPreviousBlock && !isFirstDocHeadingReplacement) {
230
221
  // Editor CSS removes the top margin from a block when it is its parent's first child.
231
222
  // Keep the serialized block as a subsequent child so each block type retains its own margin.
232
223
  dom.append(dom.ownerDocument.createElement('div'));
@@ -242,27 +233,23 @@ export const createNodeChangedDecorationWidget = ({
242
233
  // incorrectly applies because isNestedNode resolves to false (getPos returns 0).
243
234
  // Observe DOM mutations and override the transform on .rich-media-item elements
244
235
  // after React mounts to prevent the image from shifting outside its parent container.
245
- let constrainMediaObserver;
246
- if (isExtendedEnabled(diffType)) {
247
- constrainMediaObserver = new MutationObserver(() => {
248
- const richMediaItems = dom.querySelectorAll('.rich-media-item');
249
- richMediaItems.forEach(el => {
250
- if (el instanceof HTMLElement) {
251
- el.style.transform = 'none';
252
- el.style.marginLeft = '0';
253
- el.style.maxWidth = '100%';
254
- }
255
- });
256
- if (richMediaItems.length > 0) {
257
- var _constrainMediaObserv;
258
- (_constrainMediaObserv = constrainMediaObserver) === null || _constrainMediaObserv === void 0 ? void 0 : _constrainMediaObserv.disconnect();
236
+ const constrainMediaObserver = new MutationObserver(() => {
237
+ const richMediaItems = dom.querySelectorAll('.rich-media-item');
238
+ richMediaItems.forEach(el => {
239
+ if (el instanceof HTMLElement) {
240
+ el.style.transform = 'none';
241
+ el.style.marginLeft = '0';
242
+ el.style.maxWidth = '100%';
259
243
  }
260
244
  });
261
- constrainMediaObserver.observe(dom, {
262
- childList: true,
263
- subtree: true
264
- });
265
- }
245
+ if (richMediaItems.length > 0) {
246
+ constrainMediaObserver.disconnect();
247
+ }
248
+ });
249
+ constrainMediaObserver.observe(dom, {
250
+ childList: true,
251
+ subtree: true
252
+ });
266
253
  // Derived from the deleted range so it survives a recalculation — see the same reasoning in
267
254
  // `createInlineChangedDecoration`.
268
255
  const diffId = showContributorTags ? `widget-${change.fromA}-${change.toA}` : crypto.randomUUID();
@@ -315,14 +302,14 @@ export const createNodeChangedDecorationWidget = ({
315
302
  if (childNodeView) {
316
303
  const lineBreak = document.createElement('br');
317
304
  dom.append(lineBreak);
318
- const wrapper = createContentWrapper(colorScheme, isActive, isInserted, diffType);
305
+ const wrapper = createContentWrapper(colorScheme, isActive, isInserted);
319
306
  wrapper.append(childNodeView);
320
307
  dom.append(wrapper);
321
308
  } else {
322
309
  // Fallback to serializing the individual child node
323
310
  const serializedChild = serializer.serializeNode(childNode);
324
311
  if (serializedChild) {
325
- const wrapper = createContentWrapper(colorScheme, isActive, isInserted, diffType);
312
+ const wrapper = createContentWrapper(colorScheme, isActive, isInserted);
326
313
  wrapper.append(serializedChild);
327
314
  dom.append(wrapper);
328
315
  }
@@ -363,7 +350,7 @@ export const createNodeChangedDecorationWidget = ({
363
350
  const nodeView = serializer.tryCreateNodeView(node);
364
351
  if (nodeView) {
365
352
  if (node.isInline) {
366
- const wrapper = createContentWrapper(colorScheme, isActive, isInserted, diffType, reveal);
353
+ const wrapper = createContentWrapper(colorScheme, isActive, isInserted, reveal);
367
354
  wrapper.append(nodeView);
368
355
  dom.append(wrapper);
369
356
  } else {
@@ -376,7 +363,6 @@ export const createNodeChangedDecorationWidget = ({
376
363
  intl,
377
364
  isActive,
378
365
  isInserted,
379
- diffType,
380
366
  hideAddedDiffsUnderline,
381
367
  highlightInlineLeafNodes: shouldPreserveCompleteMultiInlineBlock
382
368
  });
@@ -393,12 +379,11 @@ export const createNodeChangedDecorationWidget = ({
393
379
  colorScheme,
394
380
  isActive,
395
381
  isInserted,
396
- diffType,
397
382
  reveal
398
383
  });
399
384
  dom.append(injectedNode);
400
385
  } else {
401
- const wrapper = createContentWrapper(colorScheme, isActive, isInserted, diffType, reveal);
386
+ const wrapper = createContentWrapper(colorScheme, isActive, isInserted, reveal);
402
387
  wrapper.append(fallbackNode);
403
388
  dom.append(wrapper);
404
389
  }
@@ -467,7 +452,7 @@ export const createNodeChangedDecorationWidget = ({
467
452
 
468
453
  // Needed even when the indicator bar is off, because a contributor tag also anchors against the
469
454
  // widget.
470
- if ((showIndicators || showContributorTags) && isExtendedEnabled(diffType)) {
455
+ if (showIndicators || showContributorTags) {
471
456
  dom.style.setProperty('anchor-name', `--${buildAnchorDecorationKey({
472
457
  diffId
473
458
  })}`);
@@ -523,7 +508,7 @@ export const createNodeChangedDecorationWidget = ({
523
508
  }
524
509
  }
525
510
  }
526
- if (showIndicators && isExtendedEnabled(diffType)) {
511
+ if (showIndicators) {
527
512
  const leftAnchor = createLeftAnchorWidget({
528
513
  doc: newDoc,
529
514
  from: safeInsertPos,
@@ -549,12 +534,9 @@ export const createNodeChangedDecorationWidget = ({
549
534
  leftAnchorId,
550
535
  isActive,
551
536
  isInserted,
552
- diffType,
553
- ...(isExtendedEnabled(diffType) && {
554
- // placeBelow anchors at the end of the new content, so render on the
555
- // trailing side (1); otherwise render before the new content (-1).
556
- side: placeBelow ? 1 : -1
557
- })
537
+ // placeBelow anchors at the end of the new content, so render on the
538
+ // trailing side (1); otherwise render before the new content (-1).
539
+ side: placeBelow ? 1 : -1
558
540
  }),
559
541
  // Without an explicit mark set, prosemirror-view wraps the widget in the marks of the
560
542
  // adjacent text in the NEW document. `dom` already carries the original marks, so a
@@ -562,8 +544,7 @@ export const createNodeChangedDecorationWidget = ({
562
544
  // introduced — unbolded text shown struck through but still bold.
563
545
  marks: [],
564
546
  destroy: () => {
565
- var _constrainMediaObserv2;
566
- (_constrainMediaObserv2 = constrainMediaObserver) === null || _constrainMediaObserv2 === void 0 ? void 0 : _constrainMediaObserv2.disconnect();
547
+ constrainMediaObserver.disconnect();
567
548
  unmountContributorTag(tagMount);
568
549
  tagMount = undefined;
569
550
  }
@@ -584,7 +565,7 @@ export const createNodeChangedDecorationWidget = ({
584
565
  // Away from the parent's start the node below keeps its own margin, and it is the block *inside*
585
566
  // the widget that loses one — handled by `absorbFirstChildMarginReset` above, not here.
586
567
  const nodeAfterWidget = $safeInsertPos.nodeAfter;
587
- if (fg('platform_editor_ai_show_diff_patch_2') && isExtendedEnabled(diffType) && isVisuallyFirstInParent && nodeAfterWidget) {
568
+ if (fg('platform_editor_ai_show_diff_patch_2') && isVisuallyFirstInParent && nodeAfterWidget) {
588
569
  const shapedSpacer = createNodeShapedMarginSpacer({
589
570
  node: nodeAfterWidget,
590
571
  serializer,
@@ -608,7 +589,7 @@ export const createNodeChangedDecorationWidget = ({
608
589
  }));
609
590
  }
610
591
  }
611
- if (!fg('platform_editor_ai_show_diff_patch_2') && isDiffWidgetAtStartOfDoc && isSingleBlock && isPureDeletion && isExtendedEnabled(diffType)) {
592
+ if (!fg('platform_editor_ai_show_diff_patch_2') && isDiffWidgetAtStartOfDoc && isSingleBlock && isPureDeletion) {
612
593
  const followingNode = $safeInsertPos.nodeAfter;
613
594
  const headingLevel = (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type.name) === 'heading' ? followingNode.attrs.level : undefined;
614
595
  if (isHeadingLevel(headingLevel)) {
@@ -632,8 +613,7 @@ export const createNodeChangedDecorationWidget = ({
632
613
  colorScheme,
633
614
  decorationType: 'widget',
634
615
  diffId: crypto.randomUUID(),
635
- isInserted,
636
- diffType
616
+ isInserted
637
617
  })
638
618
  }));
639
619
  }
@@ -1,4 +1,3 @@
1
- import { isExtendedEnabled } from '../isExtendedEnabled';
2
1
  /**
3
2
  * Decoration families produced by the show-diff plugin.
4
3
  * Each family owns its own key space and spec shape.
@@ -51,21 +50,14 @@ export const buildAnchorDecorationKey = ({
51
50
  };
52
51
 
53
52
  /**
54
- * Builds a diff decoration key. The extended experience includes the `diffId`
55
- * in the key so independently rendered decorations for the same type remain
56
- * distinguishable.
53
+ * Builds a diff decoration key. The key includes the `diffId` so independently
54
+ * rendered decorations for the same type remain distinguishable.
57
55
  */
58
56
  export const buildDiffDecorationKey = ({
59
57
  decorationKeyPrefix,
60
58
  isActive,
61
- diffId,
62
- diffType
63
- }) => {
64
- if (isExtendedEnabled(diffType)) {
65
- return `${decorationKeyPrefix}-${diffId}-${isActive ? 'active' : 'inactive'}`;
66
- }
67
- return isActive !== undefined ? `${decorationKeyPrefix}-${isActive ? 'active' : 'inactive'}` : decorationKeyPrefix;
68
- };
59
+ diffId
60
+ }) => `${decorationKeyPrefix}-${diffId}-${isActive ? 'active' : 'inactive'}`;
69
61
  export const buildDiffDecorationSpec = ({
70
62
  attributionKey,
71
63
  colorScheme,
@@ -75,8 +67,7 @@ export const buildDiffDecorationSpec = ({
75
67
  isInserted,
76
68
  leftAnchorId,
77
69
  nodeName,
78
- side,
79
- diffType
70
+ side
80
71
  }) => ({
81
72
  decorationFamily: DecorationFamily.diff,
82
73
  decorationType,
@@ -84,8 +75,7 @@ export const buildDiffDecorationSpec = ({
84
75
  key: buildDiffDecorationKey({
85
76
  decorationKeyPrefix: DiffDecorationKey[decorationType],
86
77
  diffId,
87
- isActive,
88
- diffType
78
+ isActive
89
79
  }),
90
80
  ...(attributionKey ? {
91
81
  attributionKey