@atlaskit/editor-plugin-show-diff 10.3.0 → 10.4.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 (27) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +14 -3
  3. package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +19 -1
  4. package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +4 -2
  5. package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +5 -2
  6. package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +40 -21
  7. package/dist/cjs/pm-plugins/main.js +11 -7
  8. package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +13 -3
  9. package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +18 -0
  10. package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +4 -3
  11. package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -2
  12. package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +35 -25
  13. package/dist/es2019/pm-plugins/main.js +11 -7
  14. package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +14 -3
  15. package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +18 -0
  16. package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +5 -3
  17. package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +5 -2
  18. package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +41 -22
  19. package/dist/esm/pm-plugins/main.js +11 -7
  20. package/dist/types/pm-plugins/calculateDiff/calculateDiffDecorations.d.ts +2 -1
  21. package/dist/types/pm-plugins/decorations/colorSchemes/standard.d.ts +9 -0
  22. package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.d.ts +2 -1
  23. package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +2 -1
  24. package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +2 -1
  25. package/dist/types/pm-plugins/main.d.ts +1 -0
  26. package/dist/types/showDiffPluginType.d.ts +12 -5
  27. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 10.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`0f27159a9087b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0f27159a9087b) -
8
+ Add `hideAddedDiffsUnderline` option to the `showDiff` command to disable the dark-purple
9
+ underline on added/updated diff content while keeping the purple highlight. Only affects the
10
+ extended/`smart` inserted styles, is gated behind the `platform_editor_ai_smart_diff` feature
11
+ gate, and defaults to `false`.
12
+
13
+ ```ts
14
+ editorApi.showDiff.commands.showDiff({
15
+ steps,
16
+ originalDoc,
17
+ hideAddedDiffsUnderline: true,
18
+ });
19
+ ```
20
+
3
21
  ## 10.3.0
4
22
 
5
23
  ### Minor Changes
@@ -145,6 +145,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref3
145
145
  diffType = _ref3$diffType === void 0 ? 'inline' : _ref3$diffType,
146
146
  _ref3$hideDeletedDiff = _ref3.hideDeletedDiffs,
147
147
  hideDeletedDiffs = _ref3$hideDeletedDiff === void 0 ? false : _ref3$hideDeletedDiff,
148
+ _ref3$hideAddedDiffsU = _ref3.hideAddedDiffsUnderline,
149
+ hideAddedDiffsUnderlineParam = _ref3$hideAddedDiffsU === void 0 ? false : _ref3$hideAddedDiffsU,
148
150
  _ref3$showIndicators = _ref3.showIndicators,
149
151
  showIndicators = _ref3$showIndicators === void 0 ? false : _ref3$showIndicators,
150
152
  smartThresholds = _ref3.smartThresholds,
@@ -159,6 +161,10 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref3
159
161
  diffDescriptors: []
160
162
  };
161
163
  }
164
+
165
+ // Resolve the option against its gate once here, so every downstream inline/block builder
166
+ // receives the same value. When the gate is off the option is a no-op.
167
+ var hideAddedDiffsUnderline = hideAddedDiffsUnderlineParam && (0, _platformFeatureFlags.fg)('platform_editor_ai_smart_diff');
162
168
  var tr = state.tr;
163
169
  var steppedDoc = originalDoc;
164
170
  var attrSteps = [];
@@ -267,7 +273,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref3
267
273
  }, (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && {
268
274
  isInserted: isInserted,
269
275
  shouldHideDeleted: shouldHideDeleted,
270
- showIndicators: showIndicators
276
+ showIndicators: showIndicators,
277
+ hideAddedDiffsUnderline: hideAddedDiffsUnderline
271
278
  }))));
272
279
  }
273
280
  } catch (err) {
@@ -285,7 +292,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref3
285
292
  }, (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && {
286
293
  isInserted: isInserted,
287
294
  shouldHideDeleted: shouldHideDeleted,
288
- showIndicators: showIndicators
295
+ showIndicators: showIndicators,
296
+ hideAddedDiffsUnderline: hideAddedDiffsUnderline
289
297
  }))));
290
298
  }
291
299
  decorations.push.apply(decorations, (0, _toConsumableArray2.default)(calculateNodesForBlockDecoration(_objectSpread(_objectSpread({
@@ -317,6 +325,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref3
317
325
  }, (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && {
318
326
  isInserted: !isInserted,
319
327
  diffType: diffType,
328
+ hideAddedDiffsUnderline: hideAddedDiffsUnderline,
320
329
  // For `smart` node- and paragraph-level changes, optionally render the
321
330
  // deleted content below the new content (gray + strikethrough) instead
322
331
  // of above it. Controlled by `deletedDiffPlacement` (default `'top'`).
@@ -461,6 +470,7 @@ function (_ref5, _ref6) {
461
470
  isInverted = _ref7$.isInverted,
462
471
  diffType = _ref7$.diffType,
463
472
  hideDeletedDiffs = _ref7$.hideDeletedDiffs,
473
+ hideAddedDiffsUnderline = _ref7$.hideAddedDiffsUnderline,
464
474
  showIndicators = _ref7$.showIndicators,
465
475
  smartThresholds = _ref7$.smartThresholds,
466
476
  deletedDiffPlacement = _ref7$.deletedDiffPlacement;
@@ -474,13 +484,14 @@ function (_ref5, _ref6) {
474
484
  lastIsInverted = _ref8$.isInverted,
475
485
  lastDiffType = _ref8$.diffType,
476
486
  lastHideDeletedDiffs = _ref8$.hideDeletedDiffs,
487
+ lastHideAddedDiffsUnderline = _ref8$.hideAddedDiffsUnderline,
477
488
  lastShowIndicators = _ref8$.showIndicators,
478
489
  lastSmartThresholds = _ref8$.smartThresholds,
479
490
  lastDeletedDiffPlacement = _ref8$.deletedDiffPlacement;
480
491
  var originalDocIsSame = lastPluginState.originalDoc && pluginState.originalDoc && pluginState.originalDoc.eq(lastPluginState.originalDoc);
481
492
  if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
482
493
  var _ref9;
483
- return (_ref9 = colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isInverted === lastIsInverted && diffType === lastDiffType && (0, _isEqual.default)(activeIndexPos, lastActiveIndexPos) && originalDocIsSame && (0, _isEqual.default)(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && showIndicators === lastShowIndicators && (0, _isEqual.default)(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement) !== null && _ref9 !== void 0 ? _ref9 : false;
494
+ return (_ref9 = colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isInverted === lastIsInverted && diffType === lastDiffType && (0, _isEqual.default)(activeIndexPos, lastActiveIndexPos) && originalDocIsSame && (0, _isEqual.default)(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && hideAddedDiffsUnderline === lastHideAddedDiffsUnderline && showIndicators === lastShowIndicators && (0, _isEqual.default)(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement) !== null && _ref9 !== void 0 ? _ref9 : false;
484
495
  }
485
496
  return (_ref0 = originalDocIsSame && (0, _isEqual.default)(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && colorScheme === lastColorScheme && intl.locale === lastIntl.locale && (0, _isEqual.default)(activeIndexPos, lastActiveIndexPos) && hideDeletedDiffs === lastHideDeletedDiffs) !== null && _ref0 !== void 0 ? _ref0 : false;
486
497
  });
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.standardDecorationMarkerVariable = exports.editingStyleRuleNode = exports.editingStyleQuoteNode = exports.editingStyleNode = exports.editingStyleExtended = exports.editingStyleCardBlockNode = exports.editingStyleActiveExtended = exports.editingStyleActive = exports.editingStyle = exports.editingContentStyleInBlockExtended = exports.editingContentStyleInBlock = exports.deletedStyleQuoteNodeWithLozengeActive = exports.deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNode = exports.deletedRowStyle = exports.deletedInlineContentStyleExtended = exports.deletedDecorationMarkerVariable = exports.deletedContentStyleUnbounded = exports.deletedContentStyleNew = exports.deletedContentStyleActive = exports.deletedContentStyle = exports.deletedCellOverlayStyle = exports.deletedBlockOutlineRoundedActive = exports.deletedBlockOutlineRounded = exports.deletedBlockOutlineActive = exports.deletedBlockOutline = exports.addedCellOverlayStyle = void 0;
6
+ exports.standardDecorationMarkerVariable = exports.editingStyleRuleNode = exports.editingStyleQuoteNode = exports.editingStyleNode = exports.editingStyleExtendedNoUnderline = exports.editingStyleExtended = exports.editingStyleCardBlockNode = exports.editingStyleActiveExtendedNoUnderline = exports.editingStyleActiveExtended = exports.editingStyleActive = exports.editingStyle = exports.editingContentStyleInBlockExtendedNoUnderline = exports.editingContentStyleInBlockExtended = exports.editingContentStyleInBlock = exports.deletedStyleQuoteNodeWithLozengeActive = exports.deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNode = exports.deletedRowStyle = exports.deletedInlineContentStyleExtended = exports.deletedDecorationMarkerVariable = exports.deletedContentStyleUnbounded = exports.deletedContentStyleNew = exports.deletedContentStyleActive = exports.deletedContentStyle = exports.deletedCellOverlayStyle = exports.deletedBlockOutlineRoundedActive = exports.deletedBlockOutlineRounded = exports.deletedBlockOutlineActive = exports.deletedBlockOutline = exports.addedCellOverlayStyle = void 0;
7
7
  var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
8
8
  // delete on platform_editor_diff_plugin_extended cleanup
9
9
  var editingStyle = exports.editingStyle = (0, _lazyNodeView.convertToInlineCss)({
@@ -44,6 +44,24 @@ var editingStyleActiveExtended = exports.editingStyleActiveExtended = (0, _lazyN
44
44
  borderBottom: "2px solid ".concat("var(--ds-border-accent-purple, #AF59E1)"),
45
45
  padding: "1px 0 2px"
46
46
  });
47
+
48
+ /**
49
+ * Underline-free variants of the extended inserted-content styles. Used when the `showDiff`
50
+ * command is called with `hideAddedDiffsUnderline: true` to remove ONLY the dark-purple
51
+ * `borderBottom` underline from added/updated content while keeping the purple background
52
+ * highlight and padding. See the `editing*Extended` constants above for the full versions.
53
+ */
54
+ var editingStyleExtendedNoUnderline = exports.editingStyleExtendedNoUnderline = (0, _lazyNodeView.convertToInlineCss)({
55
+ background: "var(--ds-background-accent-purple-subtlest, #F8EEFE)",
56
+ padding: "1px 0 2px"
57
+ });
58
+ var editingStyleActiveExtendedNoUnderline = exports.editingStyleActiveExtendedNoUnderline = (0, _lazyNodeView.convertToInlineCss)({
59
+ background: "var(--ds-background-accent-purple-subtler-pressed, #D8A0F7)",
60
+ padding: "1px 0 2px"
61
+ });
62
+ var editingContentStyleInBlockExtendedNoUnderline = exports.editingContentStyleInBlockExtendedNoUnderline = (0, _lazyNodeView.convertToInlineCss)({
63
+ padding: "1px 0 2px"
64
+ });
47
65
  var deletedContentStyle = exports.deletedContentStyle = (0, _lazyNodeView.convertToInlineCss)({
48
66
  color: "var(--ds-text-accent-gray, #505258)",
49
67
  textDecoration: 'line-through',
@@ -35,7 +35,9 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
35
35
  _ref$showIndicators = _ref.showIndicators,
36
36
  showIndicators = _ref$showIndicators === void 0 ? false : _ref$showIndicators,
37
37
  doc = _ref.doc,
38
- diffType = _ref.diffType;
38
+ diffType = _ref.diffType,
39
+ _ref$hideAddedDiffsUn = _ref.hideAddedDiffsUnderline,
40
+ hideAddedDiffsUnderline = _ref$hideAddedDiffsUn === void 0 ? false : _ref$hideAddedDiffsUn;
39
41
  var diffId = crypto.randomUUID();
40
42
  if (shouldHideDeleted) {
41
43
  return [_view.Decoration.inline(change.fromB, change.toB, {
@@ -52,7 +54,7 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
52
54
  if (colorScheme === 'traditional') {
53
55
  style = isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
54
56
  } else {
55
- style = isActive ? _standard.editingStyleActiveExtended : _standard.editingStyleExtended;
57
+ style = isActive ? hideAddedDiffsUnderline ? _standard.editingStyleActiveExtendedNoUnderline : _standard.editingStyleActiveExtended : hideAddedDiffsUnderline ? _standard.editingStyleExtendedNoUnderline : _standard.editingStyleExtended;
56
58
  }
57
59
  } else {
58
60
  if (colorScheme === 'traditional') {
@@ -34,7 +34,9 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
34
34
  showIndicators = _ref$showIndicators === void 0 ? false : _ref$showIndicators,
35
35
  _ref$placeBelow = _ref.placeBelow,
36
36
  placeBelow = _ref$placeBelow === void 0 ? false : _ref$placeBelow,
37
- diffType = _ref.diffType;
37
+ diffType = _ref.diffType,
38
+ _ref$hideAddedDiffsUn = _ref.hideAddedDiffsUnderline,
39
+ hideAddedDiffsUnderline = _ref$hideAddedDiffsUn === void 0 ? false : _ref$hideAddedDiffsUn;
38
40
  var slice = doc.slice(change.fromA, change.toA);
39
41
  var shouldSkipDeletedEmptyParagraphDecoration = !isInserted && (slice === null || slice === void 0 || (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.childCount) === 1 && (slice === null || slice === void 0 || (_slice$content2 = slice.content) === null || _slice$content2 === void 0 || (_slice$content2 = _slice$content2.firstChild) === null || _slice$content2 === void 0 ? void 0 : _slice$content2.type.name) === 'paragraph' && (slice === null || slice === void 0 || (_slice$content3 = slice.content) === null || _slice$content3 === void 0 || (_slice$content3 = _slice$content3.firstChild) === null || _slice$content3 === void 0 ? void 0 : _slice$content3.content.size) === 0;
40
42
  // Widget decoration used for deletions as the content is not in the document
@@ -183,7 +185,8 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
183
185
  intl: intl,
184
186
  isActive: isActive,
185
187
  isInserted: isInserted,
186
- diffType: diffType
188
+ diffType: diffType,
189
+ hideAddedDiffsUnderline: hideAddedDiffsUnderline
187
190
  });
188
191
  }
189
192
  } else if (nodeViewSerializer.getFilteredNodeViewBlocklist(['paragraph', 'tableRow']).has(node.type.name)) {
@@ -65,11 +65,12 @@ var getChangedContentStyle = function getChangedContentStyle(colorScheme) {
65
65
  var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
66
66
  var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
67
67
  var diffType = arguments.length > 3 ? arguments[3] : undefined;
68
+ var hideAddedDiffsUnderline = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
68
69
  if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType) && isInserted) {
69
70
  if (colorScheme === 'traditional') {
70
71
  return isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
71
72
  }
72
- return isActive ? _standard.editingStyleActiveExtended : _standard.editingStyleExtended;
73
+ return isActive ? hideAddedDiffsUnderline ? _standard.editingStyleActiveExtendedNoUnderline : _standard.editingStyleActiveExtended : hideAddedDiffsUnderline ? _standard.editingStyleExtendedNoUnderline : _standard.editingStyleExtended;
73
74
  }
74
75
  if (colorScheme === 'traditional') {
75
76
  return (0, _traditional.getDeletedTraditionalInlineStyle)(isActive);
@@ -83,10 +84,11 @@ var getChangedNodeStyle = function getChangedNodeStyle(nodeName, colorScheme) {
83
84
  var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
84
85
  var isActive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
85
86
  var diffType = arguments.length > 4 ? arguments[4] : undefined;
87
+ var hideAddedDiffsUnderline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
86
88
  var isTraditional = colorScheme === 'traditional';
87
89
  if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType) && isInserted) {
88
90
  if (isMultiContainerBlockNode(nodeName)) {
89
- return _standard.editingContentStyleInBlockExtended;
91
+ return hideAddedDiffsUnderline ? _standard.editingContentStyleInBlockExtendedNoUnderline : _standard.editingContentStyleInBlockExtended;
90
92
  }
91
93
  if (isTextLikeBlockNode(nodeName)) {
92
94
  return undefined;
@@ -234,11 +236,13 @@ var applyStylesToElement = function applyStylesToElement(_ref3) {
234
236
  colorScheme = _ref3.colorScheme,
235
237
  isActive = _ref3.isActive,
236
238
  isInserted = _ref3.isInserted,
237
- diffType = _ref3.diffType;
239
+ diffType = _ref3.diffType,
240
+ _ref3$hideAddedDiffsU = _ref3.hideAddedDiffsUnderline,
241
+ hideAddedDiffsUnderline = _ref3$hideAddedDiffsU === void 0 ? false : _ref3$hideAddedDiffsU;
238
242
  var currentStyle = element.getAttribute('style') || '';
239
- var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType);
243
+ var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
240
244
  var targetNodeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _nodeTypeUtils.getBaseNodeTypeName)(targetNode.type) : targetNode.type.name;
241
- var nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType) || '';
245
+ var nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
242
246
  element.setAttribute('style', "".concat(currentStyle).concat(contentStyle).concat(nodeSpecificStyle));
243
247
  };
244
248
  var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref4) {
@@ -247,10 +251,12 @@ var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref4
247
251
  colorScheme = _ref4.colorScheme,
248
252
  isActive = _ref4.isActive,
249
253
  isInserted = _ref4.isInserted,
250
- diffType = _ref4.diffType;
254
+ diffType = _ref4.diffType,
255
+ _ref4$hideAddedDiffsU = _ref4.hideAddedDiffsUnderline,
256
+ hideAddedDiffsUnderline = _ref4$hideAddedDiffsU === void 0 ? false : _ref4$hideAddedDiffsU;
251
257
  var currentStyle = element.getAttribute('style') || '';
252
258
  var targetNodeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _nodeTypeUtils.getBaseNodeTypeName)(targetNode.type) : targetNode.type.name;
253
- var nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType) || '';
259
+ var nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
254
260
  if (targetNode.type.name === 'decisionList') {
255
261
  element.querySelectorAll('li').forEach(function (listItem) {
256
262
  var currentListItemStyle = listItem.getAttribute('style') || '';
@@ -275,13 +281,15 @@ var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref5)
275
281
  colorScheme = _ref5.colorScheme,
276
282
  isActive = _ref5.isActive,
277
283
  isInserted = _ref5.isInserted,
278
- diffType = _ref5.diffType;
284
+ diffType = _ref5.diffType,
285
+ _ref5$hideAddedDiffsU = _ref5.hideAddedDiffsUnderline,
286
+ hideAddedDiffsUnderline = _ref5$hideAddedDiffsU === void 0 ? false : _ref5$hideAddedDiffsU;
279
287
  var currentStyle = element.getAttribute('style') || '';
280
- var nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive, diffType) || '';
288
+ var nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
281
289
  if (nodeSpecificStyle) {
282
290
  element.setAttribute('style', "".concat(currentStyle).concat(nodeSpecificStyle));
283
291
  }
284
- var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType);
292
+ var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
285
293
  var walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
286
294
  var textNodesToWrap = [];
287
295
  var currentNode = walker.nextNode();
@@ -308,16 +316,18 @@ var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref6
308
316
  colorScheme = _ref6.colorScheme,
309
317
  isActive = _ref6.isActive,
310
318
  isInserted = _ref6.isInserted,
311
- diffType = _ref6.diffType;
319
+ diffType = _ref6.diffType,
320
+ _ref6$hideAddedDiffsU = _ref6.hideAddedDiffsUnderline,
321
+ hideAddedDiffsUnderline = _ref6$hideAddedDiffsU === void 0 ? false : _ref6$hideAddedDiffsU;
312
322
  var contentWrapper = document.createElement('div');
313
323
  var targetNodeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _nodeTypeUtils.getBaseNodeTypeName)(targetNode.type) : targetNode.type.name;
314
- var nodeStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType);
324
+ var nodeStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline);
315
325
 
316
326
  // When the extended experiment is enabled and the content is inserted,
317
327
  // block widget nodes that already have dedicated node-level styling (e.g. boxShadow outline)
318
328
  // should not also get the inline content style (borderBottom underline) on their container.
319
329
  var shouldSkipContentStyle = (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && isInserted && nodeStyle !== undefined;
320
- var contentStyle = shouldSkipContentStyle ? '' : getChangedContentStyle(colorScheme, isActive, isInserted, diffType);
330
+ var contentStyle = shouldSkipContentStyle ? '' : getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
321
331
  contentWrapper.setAttribute('style', "".concat(contentStyle).concat(nodeStyle || ''));
322
332
  contentWrapper.append(nodeView);
323
333
  return contentWrapper;
@@ -432,7 +442,9 @@ var wrapBlockNode = function wrapBlockNode(_ref9) {
432
442
  isActive = _ref9$isActive === void 0 ? false : _ref9$isActive,
433
443
  _ref9$isInserted = _ref9.isInserted,
434
444
  isInserted = _ref9$isInserted === void 0 ? false : _ref9$isInserted,
435
- diffType = _ref9.diffType;
445
+ diffType = _ref9.diffType,
446
+ _ref9$hideAddedDiffsU = _ref9.hideAddedDiffsUnderline,
447
+ hideAddedDiffsUnderline = _ref9$hideAddedDiffsU === void 0 ? false : _ref9$hideAddedDiffsU;
436
448
  var blockWrapper = createBlockNodeWrapper();
437
449
  var targetNodeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _nodeTypeUtils.getBaseNodeTypeName)(targetNode.type) : targetNode.type.name;
438
450
  if (shouldShowRemovedLozenge(targetNodeName) && (!(0, _isExtendedEnabled.isExtendedEnabled)(diffType) || !isInserted)) {
@@ -465,7 +477,8 @@ var wrapBlockNode = function wrapBlockNode(_ref9) {
465
477
  colorScheme: colorScheme,
466
478
  isActive: isActive,
467
479
  isInserted: isInserted,
468
- diffType: diffType
480
+ diffType: diffType,
481
+ hideAddedDiffsUnderline: hideAddedDiffsUnderline
469
482
  });
470
483
  blockWrapper.append(contentWrapper);
471
484
  if (nodeView instanceof HTMLElement && shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
@@ -499,7 +512,9 @@ var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(_
499
512
  isActive = _ref0$isActive === void 0 ? false : _ref0$isActive,
500
513
  _ref0$isInserted = _ref0.isInserted,
501
514
  isInserted = _ref0$isInserted === void 0 ? false : _ref0$isInserted,
502
- diffType = _ref0.diffType;
515
+ diffType = _ref0.diffType,
516
+ _ref0$hideAddedDiffsU = _ref0.hideAddedDiffsUnderline,
517
+ hideAddedDiffsUnderline = _ref0$hideAddedDiffsU === void 0 ? false : _ref0$hideAddedDiffsU;
503
518
  if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
504
519
  if (nodeView instanceof HTMLElement) {
505
520
  if (isInserted && isMultiContainerBlockNode(targetNode.type.name)) {
@@ -509,7 +524,8 @@ var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(_
509
524
  colorScheme: colorScheme,
510
525
  isActive: isActive,
511
526
  isInserted: isInserted,
512
- diffType: diffType
527
+ diffType: diffType,
528
+ hideAddedDiffsUnderline: hideAddedDiffsUnderline
513
529
  });
514
530
  dom.append(nodeView);
515
531
  return;
@@ -521,7 +537,8 @@ var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(_
521
537
  colorScheme: colorScheme,
522
538
  isActive: isActive,
523
539
  isInserted: isInserted,
524
- diffType: diffType
540
+ diffType: diffType,
541
+ hideAddedDiffsUnderline: hideAddedDiffsUnderline
525
542
  });
526
543
  dom.append(nodeView);
527
544
  return;
@@ -544,7 +561,8 @@ var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(_
544
561
  intl: intl,
545
562
  isActive: isActive,
546
563
  isInserted: isInserted,
547
- diffType: diffType
564
+ diffType: diffType,
565
+ hideAddedDiffsUnderline: hideAddedDiffsUnderline
548
566
  });
549
567
  return;
550
568
  } else {
@@ -582,13 +600,14 @@ var getDeletedContentStyleUnbounded = function getDeletedContentStyleUnbounded(c
582
600
  };
583
601
  var getInsertedContentStyle = function getInsertedContentStyle(colorScheme) {
584
602
  var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
603
+ var hideAddedDiffsUnderline = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
585
604
  if (colorScheme === 'traditional') {
586
605
  return isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
587
606
  }
588
607
  if (isActive) {
589
- return _standard.editingStyleActiveExtended;
608
+ return hideAddedDiffsUnderline ? _standard.editingStyleActiveExtendedNoUnderline : _standard.editingStyleActiveExtended;
590
609
  }
591
- return _standard.editingStyleExtended;
610
+ return hideAddedDiffsUnderline ? _standard.editingStyleExtendedNoUnderline : _standard.editingStyleExtended;
592
611
  };
593
612
  var getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
594
613
  var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -42,6 +42,7 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
42
42
  isInverted: false,
43
43
  diffType: 'inline',
44
44
  hideDeletedDiffs: false,
45
+ hideAddedDiffsUnderline: false,
45
46
  showIndicators: false,
46
47
  diffDescriptors: []
47
48
  } : {});
@@ -51,7 +52,7 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
51
52
  var newPluginState = currentPluginState;
52
53
  if (meta) {
53
54
  if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF') {
54
- var _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8;
55
+ var _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9;
55
56
  // Update the plugin state with the new metadata
56
57
  newPluginState = _objectSpread(_objectSpread(_objectSpread({}, currentPluginState), meta), {}, {
57
58
  isDisplayingChanges: true,
@@ -70,15 +71,16 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
70
71
  isInverted: (_newPluginState2 = newPluginState) === null || _newPluginState2 === void 0 ? void 0 : _newPluginState2.isInverted,
71
72
  diffType: (_newPluginState3 = newPluginState) === null || _newPluginState3 === void 0 ? void 0 : _newPluginState3.diffType,
72
73
  hideDeletedDiffs: (_newPluginState4 = newPluginState) === null || _newPluginState4 === void 0 ? void 0 : _newPluginState4.hideDeletedDiffs,
73
- showIndicators: (_newPluginState5 = newPluginState) === null || _newPluginState5 === void 0 ? void 0 : _newPluginState5.showIndicators,
74
- smartThresholds: (_newPluginState6 = newPluginState) === null || _newPluginState6 === void 0 ? void 0 : _newPluginState6.smartThresholds,
75
- deletedDiffPlacement: (_newPluginState7 = newPluginState) === null || _newPluginState7 === void 0 ? void 0 : _newPluginState7.deletedDiffPlacement
74
+ hideAddedDiffsUnderline: (_newPluginState5 = newPluginState) === null || _newPluginState5 === void 0 ? void 0 : _newPluginState5.hideAddedDiffsUnderline,
75
+ showIndicators: (_newPluginState6 = newPluginState) === null || _newPluginState6 === void 0 ? void 0 : _newPluginState6.showIndicators,
76
+ smartThresholds: (_newPluginState7 = newPluginState) === null || _newPluginState7 === void 0 ? void 0 : _newPluginState7.smartThresholds,
77
+ deletedDiffPlacement: (_newPluginState8 = newPluginState) === null || _newPluginState8 === void 0 ? void 0 : _newPluginState8.deletedDiffPlacement
76
78
  } : {})),
77
79
  decorations = _calculateDiffDecorat.decorations,
78
80
  diffDescriptors = _calculateDiffDecorat.diffDescriptors;
79
81
  // Update the decorations and their ids
80
82
  newPluginState.decorations = decorations;
81
- if ((0, _isExtendedEnabled.isExtendedEnabled)((_newPluginState8 = newPluginState) === null || _newPluginState8 === void 0 ? void 0 : _newPluginState8.diffType)) {
83
+ if ((0, _isExtendedEnabled.isExtendedEnabled)((_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.diffType)) {
82
84
  newPluginState.diffDescriptors = diffDescriptors;
83
85
  }
84
86
  } else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'HIDE_DIFF') {
@@ -90,12 +92,13 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
90
92
  isInverted: false,
91
93
  diffType: 'inline',
92
94
  hideDeletedDiffs: false,
95
+ hideAddedDiffsUnderline: false,
93
96
  diffDescriptors: []
94
97
  } : {});
95
98
  } else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_NEXT' || (meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_PREVIOUS') {
96
- var _newPluginState9;
99
+ var _newPluginState0;
97
100
  // Update the active index in plugin state and recalculate decorations
98
- var _decorations = (0, _getScrollableDecorations.getScrollableDecorations)(currentPluginState.decorations, newState.doc, (_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.diffType);
101
+ var _decorations = (0, _getScrollableDecorations.getScrollableDecorations)(currentPluginState.decorations, newState.doc, (_newPluginState0 = newPluginState) === null || _newPluginState0 === void 0 ? void 0 : _newPluginState0.diffType);
99
102
  if (_decorations.length > 0) {
100
103
  var _currentPluginState$a;
101
104
  // Initialize to -1 if undefined so that the first "next" scroll takes us to index 0 (first change).
@@ -133,6 +136,7 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
133
136
  isInverted: newPluginState.isInverted,
134
137
  diffType: newPluginState.diffType,
135
138
  hideDeletedDiffs: newPluginState.hideDeletedDiffs,
139
+ hideAddedDiffsUnderline: newPluginState.hideAddedDiffsUnderline,
136
140
  showIndicators: newPluginState.showIndicators,
137
141
  smartThresholds: newPluginState.smartThresholds,
138
142
  deletedDiffPlacement: newPluginState.deletedDiffPlacement
@@ -127,6 +127,7 @@ const calculateDiffDecorationsInner = ({
127
127
  isInverted = false,
128
128
  diffType = 'inline',
129
129
  hideDeletedDiffs = false,
130
+ hideAddedDiffsUnderline: hideAddedDiffsUnderlineParam = false,
130
131
  showIndicators = false,
131
132
  smartThresholds,
132
133
  deletedDiffPlacement = 'top'
@@ -142,6 +143,10 @@ const calculateDiffDecorationsInner = ({
142
143
  diffDescriptors: []
143
144
  };
144
145
  }
146
+
147
+ // Resolve the option against its gate once here, so every downstream inline/block builder
148
+ // receives the same value. When the gate is off the option is a no-op.
149
+ const hideAddedDiffsUnderline = hideAddedDiffsUnderlineParam && fg('platform_editor_ai_smart_diff');
145
150
  const {
146
151
  tr
147
152
  } = state;
@@ -237,7 +242,8 @@ const calculateDiffDecorationsInner = ({
237
242
  ...(isExtendedEnabled(diffType) && {
238
243
  isInserted,
239
244
  shouldHideDeleted,
240
- showIndicators
245
+ showIndicators,
246
+ hideAddedDiffsUnderline
241
247
  })
242
248
  }));
243
249
  }
@@ -251,7 +257,8 @@ const calculateDiffDecorationsInner = ({
251
257
  ...(isExtendedEnabled(diffType) && {
252
258
  isInserted,
253
259
  shouldHideDeleted,
254
- showIndicators
260
+ showIndicators,
261
+ hideAddedDiffsUnderline
255
262
  })
256
263
  }));
257
264
  }
@@ -284,6 +291,7 @@ const calculateDiffDecorationsInner = ({
284
291
  ...(isExtendedEnabled(diffType) && {
285
292
  isInserted: !isInserted,
286
293
  diffType,
294
+ hideAddedDiffsUnderline,
287
295
  // For `smart` node- and paragraph-level changes, optionally render the
288
296
  // deleted content below the new content (gray + strikethrough) instead
289
297
  // of above it. Controlled by `deletedDiffPlacement` (default `'top'`).
@@ -422,6 +430,7 @@ export const calculateDiffDecorations = memoizeOne(calculateDiffDecorationsInner
422
430
  isInverted,
423
431
  diffType,
424
432
  hideDeletedDiffs,
433
+ hideAddedDiffsUnderline,
425
434
  showIndicators,
426
435
  smartThresholds,
427
436
  deletedDiffPlacement
@@ -434,6 +443,7 @@ export const calculateDiffDecorations = memoizeOne(calculateDiffDecorationsInner
434
443
  isInverted: lastIsInverted,
435
444
  diffType: lastDiffType,
436
445
  hideDeletedDiffs: lastHideDeletedDiffs,
446
+ hideAddedDiffsUnderline: lastHideAddedDiffsUnderline,
437
447
  showIndicators: lastShowIndicators,
438
448
  smartThresholds: lastSmartThresholds,
439
449
  deletedDiffPlacement: lastDeletedDiffPlacement
@@ -442,7 +452,7 @@ export const calculateDiffDecorations = memoizeOne(calculateDiffDecorationsInner
442
452
  const originalDocIsSame = lastPluginState.originalDoc && pluginState.originalDoc && pluginState.originalDoc.eq(lastPluginState.originalDoc);
443
453
  if (isExtendedEnabled(diffType)) {
444
454
  var _ref;
445
- return (_ref = colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isInverted === lastIsInverted && diffType === lastDiffType && isEqual(activeIndexPos, lastActiveIndexPos) && originalDocIsSame && isEqual(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && showIndicators === lastShowIndicators && isEqual(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement) !== null && _ref !== void 0 ? _ref : false;
455
+ return (_ref = colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isInverted === lastIsInverted && diffType === lastDiffType && isEqual(activeIndexPos, lastActiveIndexPos) && originalDocIsSame && isEqual(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && hideAddedDiffsUnderline === lastHideAddedDiffsUnderline && showIndicators === lastShowIndicators && isEqual(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement) !== null && _ref !== void 0 ? _ref : false;
446
456
  }
447
457
  return (_ref2 = originalDocIsSame && isEqual(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isEqual(activeIndexPos, lastActiveIndexPos) && hideDeletedDiffs === lastHideDeletedDiffs) !== null && _ref2 !== void 0 ? _ref2 : false;
448
458
  });
@@ -38,6 +38,24 @@ export const editingStyleActiveExtended = convertToInlineCss({
38
38
  borderBottom: `2px solid ${"var(--ds-border-accent-purple, #AF59E1)"}`,
39
39
  padding: `1px 0 2px`
40
40
  });
41
+
42
+ /**
43
+ * Underline-free variants of the extended inserted-content styles. Used when the `showDiff`
44
+ * command is called with `hideAddedDiffsUnderline: true` to remove ONLY the dark-purple
45
+ * `borderBottom` underline from added/updated content while keeping the purple background
46
+ * highlight and padding. See the `editing*Extended` constants above for the full versions.
47
+ */
48
+ export const editingStyleExtendedNoUnderline = convertToInlineCss({
49
+ background: "var(--ds-background-accent-purple-subtlest, #F8EEFE)",
50
+ padding: `1px 0 2px`
51
+ });
52
+ export const editingStyleActiveExtendedNoUnderline = convertToInlineCss({
53
+ background: "var(--ds-background-accent-purple-subtler-pressed, #D8A0F7)",
54
+ padding: `1px 0 2px`
55
+ });
56
+ export const editingContentStyleInBlockExtendedNoUnderline = convertToInlineCss({
57
+ padding: `1px 0 2px`
58
+ });
41
59
  export const deletedContentStyle = convertToInlineCss({
42
60
  color: "var(--ds-text-accent-gray, #505258)",
43
61
  textDecoration: 'line-through',
@@ -1,7 +1,7 @@
1
1
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
2
2
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
3
3
  import { isExtendedEnabled } from '../isExtendedEnabled';
4
- import { editingStyle, editingStyleExtended, editingStyleActive, editingStyleActiveExtended, deletedContentStyle, deletedContentStyleActive, deletedInlineContentStyleExtended } from './colorSchemes/standard';
4
+ import { editingStyle, editingStyleExtended, editingStyleExtendedNoUnderline, editingStyleActive, editingStyleActiveExtended, editingStyleActiveExtendedNoUnderline, deletedContentStyle, deletedContentStyleActive, deletedInlineContentStyleExtended } from './colorSchemes/standard';
5
5
  import { traditionalInsertStyle, traditionalInsertStyleActive, getDeletedTraditionalInlineStyle } from './colorSchemes/traditional';
6
6
  import { createInlineIndicatorAnchorWidgets } from './createAnchorDecorationWidgets';
7
7
  import { buildDiffDecorationSpec } from './decorationKeys';
@@ -23,7 +23,8 @@ export const createInlineChangedDecoration = ({
23
23
  shouldHideDeleted = false,
24
24
  showIndicators = false,
25
25
  doc,
26
- diffType
26
+ diffType,
27
+ hideAddedDiffsUnderline = false
27
28
  }) => {
28
29
  const diffId = crypto.randomUUID();
29
30
  if (shouldHideDeleted) {
@@ -41,7 +42,7 @@ export const createInlineChangedDecoration = ({
41
42
  if (colorScheme === 'traditional') {
42
43
  style = isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
43
44
  } else {
44
- style = isActive ? editingStyleActiveExtended : editingStyleExtended;
45
+ style = isActive ? hideAddedDiffsUnderline ? editingStyleActiveExtendedNoUnderline : editingStyleActiveExtended : hideAddedDiffsUnderline ? editingStyleExtendedNoUnderline : editingStyleExtended;
45
46
  }
46
47
  } else {
47
48
  if (colorScheme === 'traditional') {
@@ -25,7 +25,8 @@ export const createNodeChangedDecorationWidget = ({
25
25
  // before it. Used for `smart` node-level changes so the deleted node appears beneath
26
26
  // its replacement (gray + strikethrough).
27
27
  placeBelow = false,
28
- diffType
28
+ diffType,
29
+ hideAddedDiffsUnderline = false
29
30
  }) => {
30
31
  var _slice$content, _slice$content2, _slice$content2$first, _slice$content3, _slice$content3$first, _slice$content$firstC;
31
32
  const slice = doc.slice(change.fromA, change.toA);
@@ -164,7 +165,8 @@ export const createNodeChangedDecorationWidget = ({
164
165
  intl,
165
166
  isActive,
166
167
  isInserted,
167
- diffType
168
+ diffType,
169
+ hideAddedDiffsUnderline
168
170
  });
169
171
  }
170
172
  } else if (nodeViewSerializer.getFilteredNodeViewBlocklist(['paragraph', 'tableRow']).has(node.type.name)) {