@atlaskit/editor-plugin-show-diff 18.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 +24 -0
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +49 -60
- package/dist/cjs/pm-plugins/calculateDiff/selectTokenEncoder.js +4 -13
- package/dist/cjs/pm-plugins/decorations/colorSchemes/attributions.js +0 -1
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +7 -4
- package/dist/cjs/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +3 -2
- 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/calculateDiff/selectTokenEncoder.js +4 -13
- package/dist/es2019/pm-plugins/decorations/colorSchemes/attributions.js +0 -1
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +1 -3
- package/dist/es2019/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +1 -4
- 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/calculateDiff/selectTokenEncoder.js +4 -13
- package/dist/esm/pm-plugins/decorations/colorSchemes/attributions.js +0 -1
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +7 -4
- package/dist/esm/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +3 -2
- 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/calculateDiff/selectTokenEncoder.d.ts +4 -6
- package/dist/types/pm-plugins/decorations/utils/getAttrChangeRanges.d.ts +1 -1
- package/package.json +14 -17
- package/tsconfig.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
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
|
+
|
|
13
|
+
## 19.0.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [`9ea47a518fc7c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9ea47a518fc7c) -
|
|
18
|
+
Cleanup `feature_gate` `platform_editor_diff_inline_mark_changes`. Non-smart diffs permanently use
|
|
19
|
+
the mark-aware token encoder, so formatting-only edits produce a change, and deleted-side widgets
|
|
20
|
+
are permanently rendered with an empty mark set so they do not inherit the marks of the
|
|
21
|
+
surrounding new document.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 18.0.0
|
|
4
28
|
|
|
5
29
|
### Patch 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
|
});
|
|
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.selectTokenEncoder = void 0;
|
|
7
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
8
7
|
var _attrAwareTokenEncoder = require("./attrAwareTokenEncoder");
|
|
9
8
|
var _markAwareTokenEncoder = require("./markAwareTokenEncoder");
|
|
10
9
|
/**
|
|
11
|
-
* Single place
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
-
* With the gate off this returns what both callers computed before it existed.
|
|
10
|
+
* Single place the token encoder is chosen, shared by `calculateDiffDecorations` and
|
|
11
|
+
* `computeDiffChanges` so the two cannot drift.
|
|
15
12
|
*
|
|
16
13
|
* @param useAttrAwareEncoder Caller is running the smart classifier, which needs node attrs folded
|
|
17
14
|
* into the token.
|
|
@@ -23,14 +20,8 @@ var selectTokenEncoder = exports.selectTokenEncoder = function selectTokenEncode
|
|
|
23
20
|
shouldHideMarkOnlyDeletions: false
|
|
24
21
|
};
|
|
25
22
|
}
|
|
26
|
-
if ((0, _fg.fg)('platform_editor_diff_inline_mark_changes')) {
|
|
27
|
-
return {
|
|
28
|
-
tokenEncoder: _markAwareTokenEncoder.markAwareTokenEncoder,
|
|
29
|
-
shouldHideMarkOnlyDeletions: true
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
23
|
return {
|
|
33
|
-
tokenEncoder:
|
|
34
|
-
shouldHideMarkOnlyDeletions:
|
|
24
|
+
tokenEncoder: _markAwareTokenEncoder.markAwareTokenEncoder,
|
|
25
|
+
shouldHideMarkOnlyDeletions: true
|
|
35
26
|
};
|
|
36
27
|
};
|
|
@@ -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.
|
|
@@ -555,7 +555,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
555
555
|
decorations.push(leftAnchor);
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
-
decorations.push(_view.Decoration.widget(safeInsertPos, dom, _objectSpread(_objectSpread(
|
|
558
|
+
decorations.push(_view.Decoration.widget(safeInsertPos, dom, _objectSpread(_objectSpread({}, (0, _decorationKeys.buildDiffDecorationSpec)(_objectSpread({
|
|
559
559
|
attributionKey: canTagWidget ? attributionKey : undefined,
|
|
560
560
|
colorScheme: colorScheme,
|
|
561
561
|
decorationType: 'widget',
|
|
@@ -568,9 +568,12 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
568
568
|
// placeBelow anchors at the end of the new content, so render on the
|
|
569
569
|
// trailing side (1); otherwise render before the new content (-1).
|
|
570
570
|
side: placeBelow ? 1 : -1
|
|
571
|
-
}))),
|
|
572
|
-
marks
|
|
573
|
-
|
|
571
|
+
}))), {}, {
|
|
572
|
+
// Without an explicit mark set, prosemirror-view wraps the widget in the marks of the
|
|
573
|
+
// adjacent text in the NEW document. `dom` already carries the original marks, so a
|
|
574
|
+
// formatting change would render the deleted side wrapped in the very mark the edit
|
|
575
|
+
// introduced — unbolded text shown struck through but still bold.
|
|
576
|
+
marks: [],
|
|
574
577
|
destroy: function destroy() {
|
|
575
578
|
var _constrainMediaObserv2;
|
|
576
579
|
(_constrainMediaObserv2 = constrainMediaObserver) === null || _constrainMediaObserv2 === void 0 || _constrainMediaObserv2.disconnect();
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createDeletedLineBreakWidget = exports.createDeletedLineBreakDecoration = exports.RETURN_GLYPH = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
10
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
11
10
|
var _isExtendedEnabled = require("../../isExtendedEnabled");
|
|
12
11
|
var _decorationKeys = require("../decorationKeys");
|
|
13
12
|
var _wrapBlockNodeView = require("./wrapBlockNodeView");
|
|
@@ -100,7 +99,9 @@ var createDeletedLineBreakDecoration = exports.createDeletedLineBreakDecoration
|
|
|
100
99
|
diffType: diffType
|
|
101
100
|
}, (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && side !== undefined && {
|
|
102
101
|
side: side
|
|
103
|
-
}))),
|
|
102
|
+
}))), {}, {
|
|
103
|
+
// Without an explicit mark set, prosemirror-view wraps the widget in the marks of the
|
|
104
|
+
// adjacent text. The glyph carries its own deleted styling and must not inherit them.
|
|
104
105
|
marks: []
|
|
105
106
|
}));
|
|
106
107
|
};
|
|
@@ -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
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
1
|
import { attrAwareTokenEncoder } from './attrAwareTokenEncoder';
|
|
3
2
|
import { markAwareTokenEncoder } from './markAwareTokenEncoder';
|
|
4
3
|
/**
|
|
5
|
-
* Single place
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
8
|
-
* With the gate off this returns what both callers computed before it existed.
|
|
4
|
+
* Single place the token encoder is chosen, shared by `calculateDiffDecorations` and
|
|
5
|
+
* `computeDiffChanges` so the two cannot drift.
|
|
9
6
|
*
|
|
10
7
|
* @param useAttrAwareEncoder Caller is running the smart classifier, which needs node attrs folded
|
|
11
8
|
* into the token.
|
|
@@ -17,14 +14,8 @@ export const selectTokenEncoder = useAttrAwareEncoder => {
|
|
|
17
14
|
shouldHideMarkOnlyDeletions: false
|
|
18
15
|
};
|
|
19
16
|
}
|
|
20
|
-
if (fg('platform_editor_diff_inline_mark_changes')) {
|
|
21
|
-
return {
|
|
22
|
-
tokenEncoder: markAwareTokenEncoder,
|
|
23
|
-
shouldHideMarkOnlyDeletions: true
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
17
|
return {
|
|
27
|
-
tokenEncoder:
|
|
28
|
-
shouldHideMarkOnlyDeletions:
|
|
18
|
+
tokenEncoder: markAwareTokenEncoder,
|
|
19
|
+
shouldHideMarkOnlyDeletions: true
|
|
29
20
|
};
|
|
30
21
|
};
|
|
@@ -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.
|
|
@@ -560,9 +560,7 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
560
560
|
// adjacent text in the NEW document. `dom` already carries the original marks, so a
|
|
561
561
|
// formatting change would render the deleted side wrapped in the very mark the edit
|
|
562
562
|
// introduced — unbolded text shown struck through but still bold.
|
|
563
|
-
|
|
564
|
-
marks: []
|
|
565
|
-
}),
|
|
563
|
+
marks: [],
|
|
566
564
|
destroy: () => {
|
|
567
565
|
var _constrainMediaObserv2;
|
|
568
566
|
(_constrainMediaObserv2 = constrainMediaObserver) === null || _constrainMediaObserv2 === void 0 ? void 0 : _constrainMediaObserv2.disconnect();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
2
|
import { isExtendedEnabled } from '../../isExtendedEnabled';
|
|
4
3
|
import { buildDiffDecorationSpec, scrollMarginTopValue } from '../decorationKeys';
|
|
5
4
|
import { createContentWrapper } from './wrapBlockNodeView';
|
|
@@ -94,7 +93,5 @@ export const createDeletedLineBreakDecoration = ({
|
|
|
94
93
|
}),
|
|
95
94
|
// Without an explicit mark set, prosemirror-view wraps the widget in the marks of the
|
|
96
95
|
// adjacent text. The glyph carries its own deleted styling and must not inherit them.
|
|
97
|
-
|
|
98
|
-
marks: []
|
|
99
|
-
})
|
|
96
|
+
marks: []
|
|
100
97
|
});
|
|
@@ -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
|
});
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
1
|
import { attrAwareTokenEncoder } from './attrAwareTokenEncoder';
|
|
3
2
|
import { markAwareTokenEncoder } from './markAwareTokenEncoder';
|
|
4
3
|
/**
|
|
5
|
-
* Single place
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
8
|
-
* With the gate off this returns what both callers computed before it existed.
|
|
4
|
+
* Single place the token encoder is chosen, shared by `calculateDiffDecorations` and
|
|
5
|
+
* `computeDiffChanges` so the two cannot drift.
|
|
9
6
|
*
|
|
10
7
|
* @param useAttrAwareEncoder Caller is running the smart classifier, which needs node attrs folded
|
|
11
8
|
* into the token.
|
|
@@ -17,14 +14,8 @@ export var selectTokenEncoder = function selectTokenEncoder(useAttrAwareEncoder)
|
|
|
17
14
|
shouldHideMarkOnlyDeletions: false
|
|
18
15
|
};
|
|
19
16
|
}
|
|
20
|
-
if (fg('platform_editor_diff_inline_mark_changes')) {
|
|
21
|
-
return {
|
|
22
|
-
tokenEncoder: markAwareTokenEncoder,
|
|
23
|
-
shouldHideMarkOnlyDeletions: true
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
17
|
return {
|
|
27
|
-
tokenEncoder:
|
|
28
|
-
shouldHideMarkOnlyDeletions:
|
|
18
|
+
tokenEncoder: markAwareTokenEncoder,
|
|
19
|
+
shouldHideMarkOnlyDeletions: true
|
|
29
20
|
};
|
|
30
21
|
};
|
|
@@ -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.
|
|
@@ -548,7 +548,7 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
548
548
|
decorations.push(leftAnchor);
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
|
-
decorations.push(Decoration.widget(safeInsertPos, dom, _objectSpread(_objectSpread(
|
|
551
|
+
decorations.push(Decoration.widget(safeInsertPos, dom, _objectSpread(_objectSpread({}, buildDiffDecorationSpec(_objectSpread({
|
|
552
552
|
attributionKey: canTagWidget ? attributionKey : undefined,
|
|
553
553
|
colorScheme: colorScheme,
|
|
554
554
|
decorationType: 'widget',
|
|
@@ -561,9 +561,12 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
561
561
|
// placeBelow anchors at the end of the new content, so render on the
|
|
562
562
|
// trailing side (1); otherwise render before the new content (-1).
|
|
563
563
|
side: placeBelow ? 1 : -1
|
|
564
|
-
}))),
|
|
565
|
-
marks
|
|
566
|
-
|
|
564
|
+
}))), {}, {
|
|
565
|
+
// Without an explicit mark set, prosemirror-view wraps the widget in the marks of the
|
|
566
|
+
// adjacent text in the NEW document. `dom` already carries the original marks, so a
|
|
567
|
+
// formatting change would render the deleted side wrapped in the very mark the edit
|
|
568
|
+
// introduced — unbolded text shown struck through but still bold.
|
|
569
|
+
marks: [],
|
|
567
570
|
destroy: function destroy() {
|
|
568
571
|
var _constrainMediaObserv2;
|
|
569
572
|
(_constrainMediaObserv2 = constrainMediaObserver) === null || _constrainMediaObserv2 === void 0 || _constrainMediaObserv2.disconnect();
|
|
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
5
|
import { isExtendedEnabled } from '../../isExtendedEnabled';
|
|
7
6
|
import { buildDiffDecorationSpec, scrollMarginTopValue } from '../decorationKeys';
|
|
8
7
|
import { createContentWrapper } from './wrapBlockNodeView';
|
|
@@ -94,7 +93,9 @@ export var createDeletedLineBreakDecoration = function createDeletedLineBreakDec
|
|
|
94
93
|
diffType: diffType
|
|
95
94
|
}, isExtendedEnabled(diffType) && side !== undefined && {
|
|
96
95
|
side: side
|
|
97
|
-
}))),
|
|
96
|
+
}))), {}, {
|
|
97
|
+
// Without an explicit mark set, prosemirror-view wraps the widget in the marks of the
|
|
98
|
+
// adjacent text. The glyph carries its own deleted styling and must not inherit them.
|
|
98
99
|
marks: []
|
|
99
100
|
}));
|
|
100
101
|
};
|
|
@@ -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
|
|
@@ -2,14 +2,12 @@ import type { TokenEncoder } from 'prosemirror-changeset';
|
|
|
2
2
|
export type TokenEncoderSelection = {
|
|
3
3
|
/** Non-smart mark-aware path only; lets callers suppress a duplicate deleted side. */
|
|
4
4
|
shouldHideMarkOnlyDeletions: boolean;
|
|
5
|
-
/** Encoder to hand to `ChangeSet.create`.
|
|
6
|
-
tokenEncoder: TokenEncoder<string | number
|
|
5
|
+
/** Encoder to hand to `ChangeSet.create`. */
|
|
6
|
+
tokenEncoder: TokenEncoder<string | number>;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* Single place
|
|
10
|
-
* `
|
|
11
|
-
*
|
|
12
|
-
* With the gate off this returns what both callers computed before it existed.
|
|
9
|
+
* Single place the token encoder is chosen, shared by `calculateDiffDecorations` and
|
|
10
|
+
* `computeDiffChanges` so the two cannot drift.
|
|
13
11
|
*
|
|
14
12
|
* @param useAttrAwareEncoder Caller is running the smart classifier, which needs node attrs folded
|
|
15
13
|
* into the token.
|
|
@@ -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": "
|
|
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",
|
|
@@ -27,20 +27,20 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@atlaskit/adf-schema": "^57.6.0",
|
|
29
29
|
"@atlaskit/agent-color": "^1.0.0",
|
|
30
|
-
"@atlaskit/avatar": "^
|
|
30
|
+
"@atlaskit/avatar": "^29.0.0",
|
|
31
31
|
"@atlaskit/custom-steps": "^1.1.0",
|
|
32
|
-
"@atlaskit/editor-plugin-accessibility-utils": "^
|
|
33
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
34
|
-
"@atlaskit/editor-plugin-limited-mode": "^
|
|
35
|
-
"@atlaskit/editor-plugin-user-intent": "^
|
|
32
|
+
"@atlaskit/editor-plugin-accessibility-utils": "^21.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-analytics": "^21.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-limited-mode": "^18.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-user-intent": "^19.0.0",
|
|
36
36
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
37
37
|
"@atlaskit/editor-shared-styles": "^4.3.0",
|
|
38
38
|
"@atlaskit/editor-tables": "^3.2.0",
|
|
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": "^
|
|
43
|
-
"@atlaskit/tokens": "^
|
|
42
|
+
"@atlaskit/tmp-editor-statsig": "^206.0.0",
|
|
43
|
+
"@atlaskit/tokens": "^20.0.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@compiled/react": "^1.0.2",
|
|
46
46
|
"bind-event-listener": "^3.0.0",
|
|
@@ -53,25 +53,25 @@
|
|
|
53
53
|
"@atlaskit/button": "^25.4.0",
|
|
54
54
|
"@atlaskit/css": "^1.1.0",
|
|
55
55
|
"@atlaskit/dropdown-menu": "^18.3.0",
|
|
56
|
-
"@atlaskit/editor-core": "^
|
|
57
|
-
"@atlaskit/editor-json-transformer": "^
|
|
56
|
+
"@atlaskit/editor-core": "^231.0.0",
|
|
57
|
+
"@atlaskit/editor-json-transformer": "^10.0.0",
|
|
58
58
|
"@atlaskit/editor-plugins": "^16.1.0",
|
|
59
|
-
"@atlaskit/form": "^
|
|
59
|
+
"@atlaskit/form": "^18.0.0",
|
|
60
60
|
"@atlaskit/section-message": "^10.2.0",
|
|
61
61
|
"@atlaskit/textarea": "^10.2.0",
|
|
62
62
|
"@atlaskit/textfield": "^10.2.0",
|
|
63
63
|
"@atlaskit/util-data-test": "^19.1.0",
|
|
64
64
|
"@atlassian/confluence-presets": "workspace:^",
|
|
65
65
|
"@atlassian/content-reconciliation": "^0.1.3506",
|
|
66
|
-
"@atlassian/editor-ai-injected-editors": "^
|
|
67
|
-
"@atlassian/editor-plugin-ai": "^
|
|
66
|
+
"@atlassian/editor-ai-injected-editors": "^35.0.0",
|
|
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": "^
|
|
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,9 +99,6 @@
|
|
|
99
99
|
"confluence_ncs_step_diffing_version_history": {
|
|
100
100
|
"type": "boolean"
|
|
101
101
|
},
|
|
102
|
-
"platform_editor_reduce_diff_attr_sensitivity": {
|
|
103
|
-
"type": "boolean"
|
|
104
|
-
},
|
|
105
102
|
"platform_editor_diff_inline_mark_changes": {
|
|
106
103
|
"type": "boolean"
|
|
107
104
|
}
|
package/tsconfig.json
CHANGED