@atlaskit/editor-plugin-show-diff 14.4.3 → 14.5.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 14.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0417aa8001bf1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0417aa8001bf1) -
8
+ Fix attributed changes not using agreed step type
9
+
10
+ ## 14.5.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`a47ac4819a984`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a47ac4819a984) -
15
+ Attribution colouring now applies to single-actor diffs. Previously colouring required two or more
16
+ distinct actors to be worth distinguishing; it now surfaces the participant colour as soon as
17
+ there is an identifiable actor, while still respecting the attribution-colour gates.
18
+
3
19
  ## 14.4.3
4
20
 
5
21
  ### Patch Changes
@@ -409,7 +409,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref7
409
409
  stepIndex: stepIndex
410
410
  });
411
411
  }));
412
- attributedChanges = (0, _diffBySteps.diffBySteps)(originalDoc, simplifiedSteps, simplifiedStepAttributions);
412
+ attributedChanges = (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && diffType === 'step' ? (0, _diffBySteps.diffBySteps)(originalDoc, simplifiedSteps, simplifiedStepAttributions) : (0, _toConsumableArray2.default)(changeset.changes);
413
413
  // The attributed pipeline gives no guarantee that its output ranges are disjoint — see
414
414
  // `collapseOverlappingChanges`.
415
415
  var uncollapsedChanges = getAttributedChanges({
@@ -98,10 +98,13 @@ var isAttributionColoringEnabled = exports.isAttributionColoringEnabled = functi
98
98
  if (!areAttributionColorGatesEnabled() || !(stepAttributions !== null && stepAttributions !== void 0 && stepAttributions.length)) {
99
99
  return false;
100
100
  }
101
- var attributionKeys = new Set(stepAttributions.map(getAttributionKey).filter(function (key) {
102
- return key !== undefined;
103
- }));
104
- return attributionKeys.size > 1;
101
+
102
+ // Colour whenever a step names an identifiable actor; a single actor still surfaces its
103
+ // participant colour. Only bail when nothing is attributable, so the attributed changeset is
104
+ // not built for a diff with no identities to colour.
105
+ return stepAttributions.some(function (attribution) {
106
+ return getAttributionKey(attribution) !== undefined;
107
+ });
105
108
  };
106
109
 
107
110
  /**
@@ -372,7 +372,7 @@ const calculateDiffDecorationsInner = ({
372
372
  ...attribution,
373
373
  stepIndex
374
374
  })));
375
- attributedChanges = diffBySteps(originalDoc, simplifiedSteps, simplifiedStepAttributions);
375
+ attributedChanges = isExtendedEnabled(diffType) && diffType === 'step' ? diffBySteps(originalDoc, simplifiedSteps, simplifiedStepAttributions) : [...changeset.changes];
376
376
  // The attributed pipeline gives no guarantee that its output ranges are disjoint — see
377
377
  // `collapseOverlappingChanges`.
378
378
  const uncollapsedChanges = getAttributedChanges({
@@ -75,8 +75,11 @@ export const isAttributionColoringEnabled = stepAttributions => {
75
75
  if (!areAttributionColorGatesEnabled() || !(stepAttributions !== null && stepAttributions !== void 0 && stepAttributions.length)) {
76
76
  return false;
77
77
  }
78
- const attributionKeys = new Set(stepAttributions.map(getAttributionKey).filter(key => key !== undefined));
79
- return attributionKeys.size > 1;
78
+
79
+ // Colour whenever a step names an identifiable actor; a single actor still surfaces its
80
+ // participant colour. Only bail when nothing is attributable, so the attributed changeset is
81
+ // not built for a diff with no identities to colour.
82
+ return stepAttributions.some(attribution => getAttributionKey(attribution) !== undefined);
80
83
  };
81
84
 
82
85
  /**
@@ -402,7 +402,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref7
402
402
  stepIndex: stepIndex
403
403
  });
404
404
  }));
405
- attributedChanges = diffBySteps(originalDoc, simplifiedSteps, simplifiedStepAttributions);
405
+ attributedChanges = isExtendedEnabled(diffType) && diffType === 'step' ? diffBySteps(originalDoc, simplifiedSteps, simplifiedStepAttributions) : _toConsumableArray(changeset.changes);
406
406
  // The attributed pipeline gives no guarantee that its output ranges are disjoint — see
407
407
  // `collapseOverlappingChanges`.
408
408
  var uncollapsedChanges = getAttributedChanges({
@@ -92,10 +92,13 @@ export var isAttributionColoringEnabled = function isAttributionColoringEnabled(
92
92
  if (!areAttributionColorGatesEnabled() || !(stepAttributions !== null && stepAttributions !== void 0 && stepAttributions.length)) {
93
93
  return false;
94
94
  }
95
- var attributionKeys = new Set(stepAttributions.map(getAttributionKey).filter(function (key) {
96
- return key !== undefined;
97
- }));
98
- return attributionKeys.size > 1;
95
+
96
+ // Colour whenever a step names an identifiable actor; a single actor still surfaces its
97
+ // participant colour. Only bail when nothing is attributable, so the attributed changeset is
98
+ // not built for a diff with no identities to colour.
99
+ return stepAttributions.some(function (attribution) {
100
+ return getAttributionKey(attribution) !== undefined;
101
+ });
99
102
  };
100
103
 
101
104
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "14.4.3",
3
+ "version": "14.5.1",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",