@atlaskit/editor-plugin-show-diff 19.0.0 → 19.0.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 +10 -0
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +49 -60
- package/dist/cjs/pm-plugins/decorations/colorSchemes/attributions.js +0 -1
- package/dist/cjs/pm-plugins/decorations/utils/getAttrChangeRanges.js +7 -8
- package/dist/cjs/ui/ContributorTag/contributorTagController.js +6 -1
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +4 -14
- package/dist/es2019/pm-plugins/decorations/colorSchemes/attributions.js +0 -1
- package/dist/es2019/pm-plugins/decorations/utils/getAttrChangeRanges.js +7 -8
- package/dist/es2019/ui/ContributorTag/contributorTagController.js +4 -0
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +49 -60
- package/dist/esm/pm-plugins/decorations/colorSchemes/attributions.js +0 -1
- package/dist/esm/pm-plugins/decorations/utils/getAttrChangeRanges.js +7 -8
- package/dist/esm/ui/ContributorTag/contributorTagController.js +6 -1
- package/dist/types/pm-plugins/decorations/utils/getAttrChangeRanges.d.ts +1 -1
- package/package.json +5 -5
- package/tsconfig.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 19.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`27d5e74498554`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/27d5e74498554) -
|
|
8
|
+
Clean up feature gate `platform_editor_reduce_diff_attr_sensitivity`
|
|
9
|
+
- [`6fc3ffdbe2bf3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6fc3ffdbe2bf3) -
|
|
10
|
+
Use Rovo's registered brand colour in its fixed participant palette slot.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 19.0.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -419,14 +419,14 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
419
419
|
steppedDoc = result.doc;
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
//
|
|
423
|
-
//
|
|
422
|
+
// Mapped positions and step-time nodes are used together so an attr change is attributed to the
|
|
423
|
+
// node it actually happened on, even when later steps move it.
|
|
424
424
|
} catch (err) {
|
|
425
425
|
_iterator2.e(err);
|
|
426
426
|
} finally {
|
|
427
427
|
_iterator2.f();
|
|
428
428
|
}
|
|
429
|
-
var attrStepContexts =
|
|
429
|
+
var attrStepContexts = pendingAttrSteps.flatMap(function (_ref1) {
|
|
430
430
|
var afterNode = _ref1.afterNode,
|
|
431
431
|
attributionKey = _ref1.attributionKey,
|
|
432
432
|
beforeNode = _ref1.beforeNode,
|
|
@@ -447,17 +447,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
447
447
|
}), {}, {
|
|
448
448
|
step: step
|
|
449
449
|
})];
|
|
450
|
-
}) : pendingAttrSteps.map(function (_ref10) {
|
|
451
|
-
var attributionKey = _ref10.attributionKey,
|
|
452
|
-
step = _ref10.step;
|
|
453
|
-
return {
|
|
454
|
-
attributionKey: attributionKey,
|
|
455
|
-
afterNode: tr.doc.nodeAt(step.pos),
|
|
456
|
-
beforeNode: originalDoc.nodeAt(step.pos),
|
|
457
|
-
finalPos: step.pos,
|
|
458
|
-
originalPos: step.pos,
|
|
459
|
-
step: step
|
|
460
|
-
};
|
|
461
450
|
});
|
|
462
451
|
|
|
463
452
|
// Rather than using .eq() we use a custom function that only checks for structural
|
|
@@ -800,13 +789,13 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
800
789
|
// smart path. Only add the legacy step-range decoration when no equivalent changeset range was
|
|
801
790
|
// produced; otherwise the same content receives two inline decorations (and two navigation
|
|
802
791
|
// changes), usually one attribution colour and one default purple decoration.
|
|
803
|
-
(0, _getMarkChangeRanges.getMarkChangeRanges)(simplifiedSteps, simplifiedStepAttributions, (0, _fg.fg)('confluence_ncs_step_diffing_version_history') ? stepMaps : undefined).filter(function (
|
|
792
|
+
(0, _getMarkChangeRanges.getMarkChangeRanges)(simplifiedSteps, simplifiedStepAttributions, (0, _fg.fg)('confluence_ncs_step_diffing_version_history') ? stepMaps : undefined).filter(function (_ref10) {
|
|
793
|
+
var fromB = _ref10.fromB,
|
|
794
|
+
toB = _ref10.toB;
|
|
795
|
+
return !isHandledByTable(fromB, toB);
|
|
796
|
+
}).filter(function (_ref11) {
|
|
804
797
|
var fromB = _ref11.fromB,
|
|
805
798
|
toB = _ref11.toB;
|
|
806
|
-
return !isHandledByTable(fromB, toB);
|
|
807
|
-
}).filter(function (_ref12) {
|
|
808
|
-
var fromB = _ref12.fromB,
|
|
809
|
-
toB = _ref12.toB;
|
|
810
799
|
return !(0, _fg.fg)('confluence_ncs_step_diffing_version_history') || !changes.some(function (change) {
|
|
811
800
|
return change.fromB === fromB && change.toB === toB;
|
|
812
801
|
});
|
|
@@ -828,13 +817,13 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
828
817
|
tagMountContext: tagMountContext
|
|
829
818
|
})));
|
|
830
819
|
});
|
|
831
|
-
(0, _getAttrChangeRanges.getAttrChangeRanges)(tr.doc, attrStepContexts, originalDoc).filter(function (
|
|
820
|
+
(0, _getAttrChangeRanges.getAttrChangeRanges)(tr.doc, attrStepContexts, originalDoc).filter(function (_ref12) {
|
|
821
|
+
var fromB = _ref12.fromB,
|
|
822
|
+
toB = _ref12.toB;
|
|
823
|
+
return !isHandledByTable(fromB, toB);
|
|
824
|
+
}).filter(function (_ref13) {
|
|
832
825
|
var fromB = _ref13.fromB,
|
|
833
826
|
toB = _ref13.toB;
|
|
834
|
-
return !isHandledByTable(fromB, toB);
|
|
835
|
-
}).filter(function (_ref14) {
|
|
836
|
-
var fromB = _ref14.fromB,
|
|
837
|
-
toB = _ref14.toB;
|
|
838
827
|
return !(0, _fg.fg)('confluence_ncs_step_diffing_version_history') || !changes.some(function (change) {
|
|
839
828
|
return change.fromB === fromB && change.toB === toB;
|
|
840
829
|
});
|
|
@@ -944,49 +933,49 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
944
933
|
var calculateDiffDecorations = exports.calculateDiffDecorations = (0, _memoizeOne.default)(calculateDiffDecorationsInner,
|
|
945
934
|
// Cache results unless relevant inputs change. `tagMountContext` is deliberately absent: it is
|
|
946
935
|
// built once per plugin instance, so it can never be the reason a diff needs recalculating.
|
|
947
|
-
function (
|
|
948
|
-
var
|
|
936
|
+
function (_ref14, _ref15) {
|
|
937
|
+
var _ref19;
|
|
938
|
+
var _ref16 = (0, _slicedToArray2.default)(_ref14, 1),
|
|
939
|
+
_ref16$ = _ref16[0],
|
|
940
|
+
pluginState = _ref16$.pluginState,
|
|
941
|
+
state = _ref16$.state,
|
|
942
|
+
colorScheme = _ref16$.colorScheme,
|
|
943
|
+
intl = _ref16$.intl,
|
|
944
|
+
activeIndexPos = _ref16$.activeIndexPos,
|
|
945
|
+
isInverted = _ref16$.isInverted,
|
|
946
|
+
diffType = _ref16$.diffType,
|
|
947
|
+
hideDeletedDiffs = _ref16$.hideDeletedDiffs,
|
|
948
|
+
hideAddedDiffsUnderline = _ref16$.hideAddedDiffsUnderline,
|
|
949
|
+
showIndicators = _ref16$.showIndicators,
|
|
950
|
+
smartThresholds = _ref16$.smartThresholds,
|
|
951
|
+
deletedDiffPlacement = _ref16$.deletedDiffPlacement,
|
|
952
|
+
inlineDeletedDiffPlacement = _ref16$.inlineDeletedDiffPlacement,
|
|
953
|
+
reveal = _ref16$.reveal;
|
|
949
954
|
var _ref17 = (0, _slicedToArray2.default)(_ref15, 1),
|
|
950
955
|
_ref17$ = _ref17[0],
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
var _ref18 = (0, _slicedToArray2.default)(_ref16, 1),
|
|
966
|
-
_ref18$ = _ref18[0],
|
|
967
|
-
lastPluginState = _ref18$.pluginState,
|
|
968
|
-
lastState = _ref18$.state,
|
|
969
|
-
lastColorScheme = _ref18$.colorScheme,
|
|
970
|
-
lastIntl = _ref18$.intl,
|
|
971
|
-
lastActiveIndexPos = _ref18$.activeIndexPos,
|
|
972
|
-
lastIsInverted = _ref18$.isInverted,
|
|
973
|
-
lastDiffType = _ref18$.diffType,
|
|
974
|
-
lastHideDeletedDiffs = _ref18$.hideDeletedDiffs,
|
|
975
|
-
lastHideAddedDiffsUnderline = _ref18$.hideAddedDiffsUnderline,
|
|
976
|
-
lastShowIndicators = _ref18$.showIndicators,
|
|
977
|
-
lastSmartThresholds = _ref18$.smartThresholds,
|
|
978
|
-
lastDeletedDiffPlacement = _ref18$.deletedDiffPlacement,
|
|
979
|
-
lastInlineDeletedDiffPlacement = _ref18$.inlineDeletedDiffPlacement,
|
|
980
|
-
lastReveal = _ref18$.reveal;
|
|
956
|
+
lastPluginState = _ref17$.pluginState,
|
|
957
|
+
lastState = _ref17$.state,
|
|
958
|
+
lastColorScheme = _ref17$.colorScheme,
|
|
959
|
+
lastIntl = _ref17$.intl,
|
|
960
|
+
lastActiveIndexPos = _ref17$.activeIndexPos,
|
|
961
|
+
lastIsInverted = _ref17$.isInverted,
|
|
962
|
+
lastDiffType = _ref17$.diffType,
|
|
963
|
+
lastHideDeletedDiffs = _ref17$.hideDeletedDiffs,
|
|
964
|
+
lastHideAddedDiffsUnderline = _ref17$.hideAddedDiffsUnderline,
|
|
965
|
+
lastShowIndicators = _ref17$.showIndicators,
|
|
966
|
+
lastSmartThresholds = _ref17$.smartThresholds,
|
|
967
|
+
lastDeletedDiffPlacement = _ref17$.deletedDiffPlacement,
|
|
968
|
+
lastInlineDeletedDiffPlacement = _ref17$.inlineDeletedDiffPlacement,
|
|
969
|
+
lastReveal = _ref17$.reveal;
|
|
981
970
|
var originalDocIsSame = lastPluginState.originalDoc && pluginState.originalDoc && pluginState.originalDoc.eq(lastPluginState.originalDoc);
|
|
982
971
|
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
983
|
-
var
|
|
984
|
-
return (
|
|
972
|
+
var _ref18;
|
|
973
|
+
return (_ref18 = colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isInverted === lastIsInverted && diffType === lastDiffType && (0, _isEqual.default)(activeIndexPos, lastActiveIndexPos) && originalDocIsSame && (0, _isEqual.default)(pluginState.steps, lastPluginState.steps) && (0, _isEqual.default)(pluginState.stepAttributions, lastPluginState.stepAttributions) &&
|
|
985
974
|
// Contributors can arrive after the first calculation; without this, tags never appear.
|
|
986
975
|
(0, _isEqual.default)(pluginState.contributors, lastPluginState.contributors) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && hideAddedDiffsUnderline === lastHideAddedDiffsUnderline && showIndicators === lastShowIndicators && (0, _isEqual.default)(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement && inlineDeletedDiffPlacement === lastInlineDeletedDiffPlacement &&
|
|
987
976
|
// Turning the reveal on or off changes the emitted styles, so a cached result from the
|
|
988
977
|
// other setting would leave the diff painted in the wrong resting state.
|
|
989
|
-
(0, _isEqual.default)(reveal, lastReveal)) !== null &&
|
|
978
|
+
(0, _isEqual.default)(reveal, lastReveal)) !== null && _ref18 !== void 0 ? _ref18 : false;
|
|
990
979
|
}
|
|
991
|
-
return (
|
|
980
|
+
return (_ref19 = originalDocIsSame && (0, _isEqual.default)(pluginState.steps, lastPluginState.steps) && (0, _isEqual.default)(pluginState.stepAttributions, lastPluginState.stepAttributions) && (0, _isEqual.default)(pluginState.contributors, lastPluginState.contributors) && state.doc.eq(lastState.doc) && colorScheme === lastColorScheme && intl.locale === lastIntl.locale && (0, _isEqual.default)(activeIndexPos, lastActiveIndexPos) && hideDeletedDiffs === lastHideDeletedDiffs) !== null && _ref19 !== void 0 ? _ref19 : false;
|
|
992
981
|
});
|
|
@@ -106,7 +106,6 @@ var getAgentBrandForColor = function getAgentBrandForColor(attribution, contribu
|
|
|
106
106
|
var agentBrand = contributors === null || contributors === void 0 || (_contributors = contributors[(_getAttributionKey = getAttributionKey(attribution)) !== null && _getAttributionKey !== void 0 ? _getAttributionKey : '']) === null || _contributors === void 0 ? void 0 : _contributors.agentKind;
|
|
107
107
|
return isDiffAgentBrand(agentBrand) ? agentBrand : attribution === null || attribution === void 0 ? void 0 : attribution.agentType;
|
|
108
108
|
};
|
|
109
|
-
|
|
110
109
|
/**
|
|
111
110
|
* Public contributor list to internal key-addressed record. A contributor whose attribution carries
|
|
112
111
|
* no identity is dropped, since it could never match a step. Later entries win.
|
|
@@ -11,7 +11,6 @@ var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
|
11
11
|
var _setAttrs = require("@atlaskit/adf-schema/steps/set-attrs");
|
|
12
12
|
var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
|
|
13
13
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
14
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
15
14
|
var _diffableAttrs = require("./diffableAttrs");
|
|
16
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -75,10 +74,10 @@ var getAttrChangeRanges = exports.getAttrChangeRanges = function getAttrChangeRa
|
|
|
75
74
|
return undefined;
|
|
76
75
|
}
|
|
77
76
|
var stepAttrs = getStepAttrs(step);
|
|
78
|
-
// SetAttrsStep contains the complete replacement attrs, not only the attrs that changed
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
var attrsToCheck =
|
|
77
|
+
// SetAttrsStep contains the complete replacement attrs, not only the attrs that changed,
|
|
78
|
+
// so narrow it to the attrs whose values actually differ. Fall back to the full step
|
|
79
|
+
// payload if either step-time node is unavailable.
|
|
80
|
+
var attrsToCheck = beforeNode && afterNode ? stepAttrs.filter(function (attrName) {
|
|
82
81
|
return !(0, _isEqual.default)(beforeNode.attrs[attrName], afterNode.attrs[attrName]);
|
|
83
82
|
}) : stepAttrs;
|
|
84
83
|
var $pos = doc.resolve(finalPos);
|
|
@@ -139,12 +138,12 @@ var getAttrChangeRanges = exports.getAttrChangeRanges = function getAttrChangeRa
|
|
|
139
138
|
});
|
|
140
139
|
}
|
|
141
140
|
|
|
142
|
-
// Extension nodes: highlight changes to user-visible configuration.
|
|
143
|
-
//
|
|
141
|
+
// Extension nodes: highlight changes to user-visible configuration. Transient extension
|
|
142
|
+
// metadata is ignored by the comparison below.
|
|
144
143
|
if (nodeAtPos && extensionNodeNames.includes(nodeAtPos.type.name) && attrsToCheck.some(function (v) {
|
|
145
144
|
return (0, _diffableAttrs.isDiffableAttr)(nodeAtPos.type.name, v);
|
|
146
145
|
})) {
|
|
147
|
-
if (
|
|
146
|
+
if (beforeNode && afterNode && beforeNode.type === afterNode.type && haveSameRelevantExtensionAttrs(beforeNode, afterNode)) {
|
|
148
147
|
return undefined;
|
|
149
148
|
}
|
|
150
149
|
var isInline = nodeAtPos.type.name === 'inlineExtension';
|
|
@@ -38,7 +38,12 @@ var chatgptBrandColor = (0, _getThirdPartyAgentColor.getThirdPartyAgentColor)({
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
/** Brand accents for agent kinds with no ADS token match. New agents opt in by adding an entry. */
|
|
41
|
-
var AGENT_KIND_ACCENT_OVERRIDES = _objectSpread({
|
|
41
|
+
var AGENT_KIND_ACCENT_OVERRIDES = _objectSpread({
|
|
42
|
+
rovo: {
|
|
43
|
+
background: "var(--ds-background-neutral-bold, #292A2E)",
|
|
44
|
+
text: "var(--ds-text-inverse, #FFFFFF)"
|
|
45
|
+
}
|
|
46
|
+
}, chatgptBrandColor ? {
|
|
42
47
|
chatgpt: {
|
|
43
48
|
background: chatgptBrandColor.bold,
|
|
44
49
|
text: chatgptBrandColor.boldText
|
|
@@ -377,9 +377,9 @@ const calculateDiffDecorationsInner = ({
|
|
|
377
377
|
steppedDoc = result.doc;
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
//
|
|
381
|
-
//
|
|
382
|
-
const attrStepContexts =
|
|
380
|
+
// Mapped positions and step-time nodes are used together so an attr change is attributed to the
|
|
381
|
+
// node it actually happened on, even when later steps move it.
|
|
382
|
+
const attrStepContexts = pendingAttrSteps.flatMap(({
|
|
383
383
|
afterNode,
|
|
384
384
|
attributionKey,
|
|
385
385
|
beforeNode,
|
|
@@ -401,17 +401,7 @@ const calculateDiffDecorationsInner = ({
|
|
|
401
401
|
}),
|
|
402
402
|
step
|
|
403
403
|
}];
|
|
404
|
-
})
|
|
405
|
-
attributionKey,
|
|
406
|
-
step
|
|
407
|
-
}) => ({
|
|
408
|
-
attributionKey,
|
|
409
|
-
afterNode: tr.doc.nodeAt(step.pos),
|
|
410
|
-
beforeNode: originalDoc.nodeAt(step.pos),
|
|
411
|
-
finalPos: step.pos,
|
|
412
|
-
originalPos: step.pos,
|
|
413
|
-
step
|
|
414
|
-
}));
|
|
404
|
+
});
|
|
415
405
|
|
|
416
406
|
// Rather than using .eq() we use a custom function that only checks for structural
|
|
417
407
|
// changes and ignores differences in attributes which don't affect decoration positions
|
|
@@ -86,7 +86,6 @@ const getAgentBrandForColor = (attribution, contributors) => {
|
|
|
86
86
|
const agentBrand = contributors === null || contributors === void 0 ? void 0 : (_contributors = contributors[(_getAttributionKey = getAttributionKey(attribution)) !== null && _getAttributionKey !== void 0 ? _getAttributionKey : '']) === null || _contributors === void 0 ? void 0 : _contributors.agentKind;
|
|
87
87
|
return isDiffAgentBrand(agentBrand) ? agentBrand : attribution === null || attribution === void 0 ? void 0 : attribution.agentType;
|
|
88
88
|
};
|
|
89
|
-
|
|
90
89
|
/**
|
|
91
90
|
* Public contributor list to internal key-addressed record. A contributor whose attribution carries
|
|
92
91
|
* no identity is dropped, since it could never match a step. Later entries win.
|
|
@@ -3,7 +3,6 @@ import omit from 'lodash/omit';
|
|
|
3
3
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps/set-attrs';
|
|
4
4
|
import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-utils';
|
|
5
5
|
import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
6
|
import { getRequiredIncludedDiffableAttrs, isDiffableAttr } from './diffableAttrs';
|
|
8
7
|
const filterUndefined = x => !!x;
|
|
9
8
|
|
|
@@ -59,10 +58,10 @@ export const getAttrChangeRanges = (doc, attrStepContexts, originalDoc) => {
|
|
|
59
58
|
return undefined;
|
|
60
59
|
}
|
|
61
60
|
const stepAttrs = getStepAttrs(step);
|
|
62
|
-
// SetAttrsStep contains the complete replacement attrs, not only the attrs that changed
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
const attrsToCheck =
|
|
61
|
+
// SetAttrsStep contains the complete replacement attrs, not only the attrs that changed,
|
|
62
|
+
// so narrow it to the attrs whose values actually differ. Fall back to the full step
|
|
63
|
+
// payload if either step-time node is unavailable.
|
|
64
|
+
const attrsToCheck = beforeNode && afterNode ? stepAttrs.filter(attrName => !isEqual(beforeNode.attrs[attrName], afterNode.attrs[attrName])) : stepAttrs;
|
|
66
65
|
const $pos = doc.resolve(finalPos);
|
|
67
66
|
const nodeAtPos = doc.nodeAt(finalPos);
|
|
68
67
|
const originalNodeAtPos = originalPos === undefined ? null : originalDoc.nodeAt(originalPos);
|
|
@@ -120,10 +119,10 @@ export const getAttrChangeRanges = (doc, attrStepContexts, originalDoc) => {
|
|
|
120
119
|
};
|
|
121
120
|
}
|
|
122
121
|
|
|
123
|
-
// Extension nodes: highlight changes to user-visible configuration.
|
|
124
|
-
//
|
|
122
|
+
// Extension nodes: highlight changes to user-visible configuration. Transient extension
|
|
123
|
+
// metadata is ignored by the comparison below.
|
|
125
124
|
if (nodeAtPos && extensionNodeNames.includes(nodeAtPos.type.name) && attrsToCheck.some(v => isDiffableAttr(nodeAtPos.type.name, v))) {
|
|
126
|
-
if (
|
|
125
|
+
if (beforeNode && afterNode && beforeNode.type === afterNode.type && haveSameRelevantExtensionAttrs(beforeNode, afterNode)) {
|
|
127
126
|
return undefined;
|
|
128
127
|
}
|
|
129
128
|
const isInline = nodeAtPos.type.name === 'inlineExtension';
|
|
@@ -28,6 +28,10 @@ const chatgptBrandColor = getThirdPartyAgentColor({
|
|
|
28
28
|
|
|
29
29
|
/** Brand accents for agent kinds with no ADS token match. New agents opt in by adding an entry. */
|
|
30
30
|
const AGENT_KIND_ACCENT_OVERRIDES = {
|
|
31
|
+
rovo: {
|
|
32
|
+
background: "var(--ds-background-neutral-bold, #292A2E)",
|
|
33
|
+
text: "var(--ds-text-inverse, #FFFFFF)"
|
|
34
|
+
},
|
|
31
35
|
...(chatgptBrandColor ? {
|
|
32
36
|
chatgpt: {
|
|
33
37
|
background: chatgptBrandColor.bold,
|
|
@@ -412,14 +412,14 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
412
412
|
steppedDoc = result.doc;
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
|
-
//
|
|
416
|
-
//
|
|
415
|
+
// Mapped positions and step-time nodes are used together so an attr change is attributed to the
|
|
416
|
+
// node it actually happened on, even when later steps move it.
|
|
417
417
|
} catch (err) {
|
|
418
418
|
_iterator2.e(err);
|
|
419
419
|
} finally {
|
|
420
420
|
_iterator2.f();
|
|
421
421
|
}
|
|
422
|
-
var attrStepContexts =
|
|
422
|
+
var attrStepContexts = pendingAttrSteps.flatMap(function (_ref1) {
|
|
423
423
|
var afterNode = _ref1.afterNode,
|
|
424
424
|
attributionKey = _ref1.attributionKey,
|
|
425
425
|
beforeNode = _ref1.beforeNode,
|
|
@@ -440,17 +440,6 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
440
440
|
}), {}, {
|
|
441
441
|
step: step
|
|
442
442
|
})];
|
|
443
|
-
}) : pendingAttrSteps.map(function (_ref10) {
|
|
444
|
-
var attributionKey = _ref10.attributionKey,
|
|
445
|
-
step = _ref10.step;
|
|
446
|
-
return {
|
|
447
|
-
attributionKey: attributionKey,
|
|
448
|
-
afterNode: tr.doc.nodeAt(step.pos),
|
|
449
|
-
beforeNode: originalDoc.nodeAt(step.pos),
|
|
450
|
-
finalPos: step.pos,
|
|
451
|
-
originalPos: step.pos,
|
|
452
|
-
step: step
|
|
453
|
-
};
|
|
454
443
|
});
|
|
455
444
|
|
|
456
445
|
// Rather than using .eq() we use a custom function that only checks for structural
|
|
@@ -793,13 +782,13 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
793
782
|
// smart path. Only add the legacy step-range decoration when no equivalent changeset range was
|
|
794
783
|
// produced; otherwise the same content receives two inline decorations (and two navigation
|
|
795
784
|
// changes), usually one attribution colour and one default purple decoration.
|
|
796
|
-
getMarkChangeRanges(simplifiedSteps, simplifiedStepAttributions, fg('confluence_ncs_step_diffing_version_history') ? stepMaps : undefined).filter(function (
|
|
785
|
+
getMarkChangeRanges(simplifiedSteps, simplifiedStepAttributions, fg('confluence_ncs_step_diffing_version_history') ? stepMaps : undefined).filter(function (_ref10) {
|
|
786
|
+
var fromB = _ref10.fromB,
|
|
787
|
+
toB = _ref10.toB;
|
|
788
|
+
return !isHandledByTable(fromB, toB);
|
|
789
|
+
}).filter(function (_ref11) {
|
|
797
790
|
var fromB = _ref11.fromB,
|
|
798
791
|
toB = _ref11.toB;
|
|
799
|
-
return !isHandledByTable(fromB, toB);
|
|
800
|
-
}).filter(function (_ref12) {
|
|
801
|
-
var fromB = _ref12.fromB,
|
|
802
|
-
toB = _ref12.toB;
|
|
803
792
|
return !fg('confluence_ncs_step_diffing_version_history') || !changes.some(function (change) {
|
|
804
793
|
return change.fromB === fromB && change.toB === toB;
|
|
805
794
|
});
|
|
@@ -821,13 +810,13 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
821
810
|
tagMountContext: tagMountContext
|
|
822
811
|
})));
|
|
823
812
|
});
|
|
824
|
-
getAttrChangeRanges(tr.doc, attrStepContexts, originalDoc).filter(function (
|
|
813
|
+
getAttrChangeRanges(tr.doc, attrStepContexts, originalDoc).filter(function (_ref12) {
|
|
814
|
+
var fromB = _ref12.fromB,
|
|
815
|
+
toB = _ref12.toB;
|
|
816
|
+
return !isHandledByTable(fromB, toB);
|
|
817
|
+
}).filter(function (_ref13) {
|
|
825
818
|
var fromB = _ref13.fromB,
|
|
826
819
|
toB = _ref13.toB;
|
|
827
|
-
return !isHandledByTable(fromB, toB);
|
|
828
|
-
}).filter(function (_ref14) {
|
|
829
|
-
var fromB = _ref14.fromB,
|
|
830
|
-
toB = _ref14.toB;
|
|
831
820
|
return !fg('confluence_ncs_step_diffing_version_history') || !changes.some(function (change) {
|
|
832
821
|
return change.fromB === fromB && change.toB === toB;
|
|
833
822
|
});
|
|
@@ -937,49 +926,49 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
937
926
|
export var calculateDiffDecorations = memoizeOne(calculateDiffDecorationsInner,
|
|
938
927
|
// Cache results unless relevant inputs change. `tagMountContext` is deliberately absent: it is
|
|
939
928
|
// built once per plugin instance, so it can never be the reason a diff needs recalculating.
|
|
940
|
-
function (
|
|
941
|
-
var
|
|
929
|
+
function (_ref14, _ref15) {
|
|
930
|
+
var _ref19;
|
|
931
|
+
var _ref16 = _slicedToArray(_ref14, 1),
|
|
932
|
+
_ref16$ = _ref16[0],
|
|
933
|
+
pluginState = _ref16$.pluginState,
|
|
934
|
+
state = _ref16$.state,
|
|
935
|
+
colorScheme = _ref16$.colorScheme,
|
|
936
|
+
intl = _ref16$.intl,
|
|
937
|
+
activeIndexPos = _ref16$.activeIndexPos,
|
|
938
|
+
isInverted = _ref16$.isInverted,
|
|
939
|
+
diffType = _ref16$.diffType,
|
|
940
|
+
hideDeletedDiffs = _ref16$.hideDeletedDiffs,
|
|
941
|
+
hideAddedDiffsUnderline = _ref16$.hideAddedDiffsUnderline,
|
|
942
|
+
showIndicators = _ref16$.showIndicators,
|
|
943
|
+
smartThresholds = _ref16$.smartThresholds,
|
|
944
|
+
deletedDiffPlacement = _ref16$.deletedDiffPlacement,
|
|
945
|
+
inlineDeletedDiffPlacement = _ref16$.inlineDeletedDiffPlacement,
|
|
946
|
+
reveal = _ref16$.reveal;
|
|
942
947
|
var _ref17 = _slicedToArray(_ref15, 1),
|
|
943
948
|
_ref17$ = _ref17[0],
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
var _ref18 = _slicedToArray(_ref16, 1),
|
|
959
|
-
_ref18$ = _ref18[0],
|
|
960
|
-
lastPluginState = _ref18$.pluginState,
|
|
961
|
-
lastState = _ref18$.state,
|
|
962
|
-
lastColorScheme = _ref18$.colorScheme,
|
|
963
|
-
lastIntl = _ref18$.intl,
|
|
964
|
-
lastActiveIndexPos = _ref18$.activeIndexPos,
|
|
965
|
-
lastIsInverted = _ref18$.isInverted,
|
|
966
|
-
lastDiffType = _ref18$.diffType,
|
|
967
|
-
lastHideDeletedDiffs = _ref18$.hideDeletedDiffs,
|
|
968
|
-
lastHideAddedDiffsUnderline = _ref18$.hideAddedDiffsUnderline,
|
|
969
|
-
lastShowIndicators = _ref18$.showIndicators,
|
|
970
|
-
lastSmartThresholds = _ref18$.smartThresholds,
|
|
971
|
-
lastDeletedDiffPlacement = _ref18$.deletedDiffPlacement,
|
|
972
|
-
lastInlineDeletedDiffPlacement = _ref18$.inlineDeletedDiffPlacement,
|
|
973
|
-
lastReveal = _ref18$.reveal;
|
|
949
|
+
lastPluginState = _ref17$.pluginState,
|
|
950
|
+
lastState = _ref17$.state,
|
|
951
|
+
lastColorScheme = _ref17$.colorScheme,
|
|
952
|
+
lastIntl = _ref17$.intl,
|
|
953
|
+
lastActiveIndexPos = _ref17$.activeIndexPos,
|
|
954
|
+
lastIsInverted = _ref17$.isInverted,
|
|
955
|
+
lastDiffType = _ref17$.diffType,
|
|
956
|
+
lastHideDeletedDiffs = _ref17$.hideDeletedDiffs,
|
|
957
|
+
lastHideAddedDiffsUnderline = _ref17$.hideAddedDiffsUnderline,
|
|
958
|
+
lastShowIndicators = _ref17$.showIndicators,
|
|
959
|
+
lastSmartThresholds = _ref17$.smartThresholds,
|
|
960
|
+
lastDeletedDiffPlacement = _ref17$.deletedDiffPlacement,
|
|
961
|
+
lastInlineDeletedDiffPlacement = _ref17$.inlineDeletedDiffPlacement,
|
|
962
|
+
lastReveal = _ref17$.reveal;
|
|
974
963
|
var originalDocIsSame = lastPluginState.originalDoc && pluginState.originalDoc && pluginState.originalDoc.eq(lastPluginState.originalDoc);
|
|
975
964
|
if (isExtendedEnabled(diffType)) {
|
|
976
|
-
var
|
|
977
|
-
return (
|
|
965
|
+
var _ref18;
|
|
966
|
+
return (_ref18 = colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isInverted === lastIsInverted && diffType === lastDiffType && isEqual(activeIndexPos, lastActiveIndexPos) && originalDocIsSame && isEqual(pluginState.steps, lastPluginState.steps) && isEqual(pluginState.stepAttributions, lastPluginState.stepAttributions) &&
|
|
978
967
|
// Contributors can arrive after the first calculation; without this, tags never appear.
|
|
979
968
|
isEqual(pluginState.contributors, lastPluginState.contributors) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && hideAddedDiffsUnderline === lastHideAddedDiffsUnderline && showIndicators === lastShowIndicators && isEqual(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement && inlineDeletedDiffPlacement === lastInlineDeletedDiffPlacement &&
|
|
980
969
|
// Turning the reveal on or off changes the emitted styles, so a cached result from the
|
|
981
970
|
// other setting would leave the diff painted in the wrong resting state.
|
|
982
|
-
isEqual(reveal, lastReveal)) !== null &&
|
|
971
|
+
isEqual(reveal, lastReveal)) !== null && _ref18 !== void 0 ? _ref18 : false;
|
|
983
972
|
}
|
|
984
|
-
return (
|
|
973
|
+
return (_ref19 = originalDocIsSame && isEqual(pluginState.steps, lastPluginState.steps) && isEqual(pluginState.stepAttributions, lastPluginState.stepAttributions) && isEqual(pluginState.contributors, lastPluginState.contributors) && state.doc.eq(lastState.doc) && colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isEqual(activeIndexPos, lastActiveIndexPos) && hideDeletedDiffs === lastHideDeletedDiffs) !== null && _ref19 !== void 0 ? _ref19 : false;
|
|
985
974
|
});
|
|
@@ -100,7 +100,6 @@ var getAgentBrandForColor = function getAgentBrandForColor(attribution, contribu
|
|
|
100
100
|
var agentBrand = contributors === null || contributors === void 0 || (_contributors = contributors[(_getAttributionKey = getAttributionKey(attribution)) !== null && _getAttributionKey !== void 0 ? _getAttributionKey : '']) === null || _contributors === void 0 ? void 0 : _contributors.agentKind;
|
|
101
101
|
return isDiffAgentBrand(agentBrand) ? agentBrand : attribution === null || attribution === void 0 ? void 0 : attribution.agentType;
|
|
102
102
|
};
|
|
103
|
-
|
|
104
103
|
/**
|
|
105
104
|
* Public contributor list to internal key-addressed record. A contributor whose attribution carries
|
|
106
105
|
* no identity is dropped, since it could never match a step. Later entries win.
|
|
@@ -6,7 +6,6 @@ import omit from 'lodash/omit';
|
|
|
6
6
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps/set-attrs';
|
|
7
7
|
import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-utils';
|
|
8
8
|
import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
9
|
import { getRequiredIncludedDiffableAttrs, isDiffableAttr } from './diffableAttrs';
|
|
11
10
|
var filterUndefined = function filterUndefined(x) {
|
|
12
11
|
return !!x;
|
|
@@ -68,10 +67,10 @@ export var getAttrChangeRanges = function getAttrChangeRanges(doc, attrStepConte
|
|
|
68
67
|
return undefined;
|
|
69
68
|
}
|
|
70
69
|
var stepAttrs = getStepAttrs(step);
|
|
71
|
-
// SetAttrsStep contains the complete replacement attrs, not only the attrs that changed
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
var attrsToCheck =
|
|
70
|
+
// SetAttrsStep contains the complete replacement attrs, not only the attrs that changed,
|
|
71
|
+
// so narrow it to the attrs whose values actually differ. Fall back to the full step
|
|
72
|
+
// payload if either step-time node is unavailable.
|
|
73
|
+
var attrsToCheck = beforeNode && afterNode ? stepAttrs.filter(function (attrName) {
|
|
75
74
|
return !isEqual(beforeNode.attrs[attrName], afterNode.attrs[attrName]);
|
|
76
75
|
}) : stepAttrs;
|
|
77
76
|
var $pos = doc.resolve(finalPos);
|
|
@@ -132,12 +131,12 @@ export var getAttrChangeRanges = function getAttrChangeRanges(doc, attrStepConte
|
|
|
132
131
|
});
|
|
133
132
|
}
|
|
134
133
|
|
|
135
|
-
// Extension nodes: highlight changes to user-visible configuration.
|
|
136
|
-
//
|
|
134
|
+
// Extension nodes: highlight changes to user-visible configuration. Transient extension
|
|
135
|
+
// metadata is ignored by the comparison below.
|
|
137
136
|
if (nodeAtPos && extensionNodeNames.includes(nodeAtPos.type.name) && attrsToCheck.some(function (v) {
|
|
138
137
|
return isDiffableAttr(nodeAtPos.type.name, v);
|
|
139
138
|
})) {
|
|
140
|
-
if (
|
|
139
|
+
if (beforeNode && afterNode && beforeNode.type === afterNode.type && haveSameRelevantExtensionAttrs(beforeNode, afterNode)) {
|
|
141
140
|
return undefined;
|
|
142
141
|
}
|
|
143
142
|
var isInline = nodeAtPos.type.name === 'inlineExtension';
|
|
@@ -31,7 +31,12 @@ var chatgptBrandColor = getThirdPartyAgentColor({
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
/** Brand accents for agent kinds with no ADS token match. New agents opt in by adding an entry. */
|
|
34
|
-
var AGENT_KIND_ACCENT_OVERRIDES = _objectSpread({
|
|
34
|
+
var AGENT_KIND_ACCENT_OVERRIDES = _objectSpread({
|
|
35
|
+
rovo: {
|
|
36
|
+
background: "var(--ds-background-neutral-bold, #292A2E)",
|
|
37
|
+
text: "var(--ds-text-inverse, #FFFFFF)"
|
|
38
|
+
}
|
|
39
|
+
}, chatgptBrandColor ? {
|
|
35
40
|
chatgpt: {
|
|
36
41
|
background: chatgptBrandColor.bold,
|
|
37
42
|
text: chatgptBrandColor.boldText
|
|
@@ -5,8 +5,8 @@ import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/trans
|
|
|
5
5
|
export type InlineAttrChangeNodeName = 'date' | 'emoji' | 'mention' | 'status';
|
|
6
6
|
type AttrChangeStep = AttrStep | SetAttrsStep;
|
|
7
7
|
export type AttrStepContext = {
|
|
8
|
-
attributionKey?: string;
|
|
9
8
|
afterNode: PMNode | null;
|
|
9
|
+
attributionKey?: string;
|
|
10
10
|
beforeNode: PMNode | null;
|
|
11
11
|
finalPos: number;
|
|
12
12
|
originalPos?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "19.0.
|
|
3
|
+
"version": "19.0.1",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
41
41
|
"@atlaskit/primitives": "^22.5.0",
|
|
42
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
42
|
+
"@atlaskit/tmp-editor-statsig": "^206.0.0",
|
|
43
43
|
"@atlaskit/tokens": "^20.0.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@compiled/react": "^1.0.2",
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"@atlassian/confluence-presets": "workspace:^",
|
|
65
65
|
"@atlassian/content-reconciliation": "^0.1.3506",
|
|
66
66
|
"@atlassian/editor-ai-injected-editors": "^35.0.0",
|
|
67
|
-
"@atlassian/editor-plugin-ai": "^75.
|
|
67
|
+
"@atlassian/editor-plugin-ai": "^75.1.0",
|
|
68
68
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
69
69
|
"react": "^19.2.0",
|
|
70
70
|
"react-dom": "^19.2.0",
|
|
71
71
|
"react-intl": "^7.0.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@atlaskit/editor-common": "^125.
|
|
74
|
+
"@atlaskit/editor-common": "^125.1.0",
|
|
75
75
|
"react": "^18.2.0 || ^19.2.0",
|
|
76
76
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
77
77
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"confluence_ncs_step_diffing_version_history": {
|
|
100
100
|
"type": "boolean"
|
|
101
101
|
},
|
|
102
|
-
"
|
|
102
|
+
"platform_editor_diff_inline_mark_changes": {
|
|
103
103
|
"type": "boolean"
|
|
104
104
|
}
|
|
105
105
|
}
|
package/tsconfig.json
CHANGED