@atlaskit/editor-plugin-show-diff 30.0.7 → 30.0.9
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 +15 -0
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +5 -5
- package/dist/cjs/pm-plugins/calculateDiff/simplifyChangesWithAttribution.js +1 -1
- package/dist/cjs/pm-plugins/decorations/colorSchemes/attributions.js +3 -4
- package/dist/cjs/pm-plugins/decorations/createAnchorDecorationWidgets.js +2 -1
- package/dist/cjs/pm-plugins/decorations/createContributorTagWidget.js +2 -2
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +3 -3
- package/dist/cjs/pm-plugins/decorations/extractContributorTags.js +5 -5
- package/dist/cjs/pm-plugins/decorations/utils/diffableAttrs.js +3 -3
- package/dist/cjs/pm-plugins/decorations/utils/getAttrChangeRanges.js +3 -3
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +1 -1
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +1 -1
- package/dist/cjs/pm-plugins/getScrollableDecorations.js +9 -4
- package/dist/cjs/pm-plugins/main.js +2 -1
- package/dist/cjs/pm-plugins/utils/baseNodeName.js +2 -2
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +5 -5
- package/dist/es2019/pm-plugins/calculateDiff/simplifyChangesWithAttribution.js +1 -1
- package/dist/es2019/pm-plugins/decorations/colorSchemes/attributions.js +3 -4
- package/dist/es2019/pm-plugins/decorations/createAnchorDecorationWidgets.js +2 -1
- package/dist/es2019/pm-plugins/decorations/createContributorTagWidget.js +2 -2
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +3 -3
- package/dist/es2019/pm-plugins/decorations/extractContributorTags.js +5 -5
- package/dist/es2019/pm-plugins/decorations/utils/diffableAttrs.js +3 -3
- package/dist/es2019/pm-plugins/decorations/utils/getAttrChangeRanges.js +3 -3
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +1 -1
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +1 -1
- package/dist/es2019/pm-plugins/getScrollableDecorations.js +9 -4
- package/dist/es2019/pm-plugins/main.js +2 -1
- package/dist/es2019/pm-plugins/utils/baseNodeName.js +2 -2
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +5 -5
- package/dist/esm/pm-plugins/calculateDiff/simplifyChangesWithAttribution.js +1 -1
- package/dist/esm/pm-plugins/decorations/colorSchemes/attributions.js +3 -4
- package/dist/esm/pm-plugins/decorations/createAnchorDecorationWidgets.js +2 -1
- package/dist/esm/pm-plugins/decorations/createContributorTagWidget.js +2 -2
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +3 -3
- package/dist/esm/pm-plugins/decorations/extractContributorTags.js +5 -5
- package/dist/esm/pm-plugins/decorations/utils/diffableAttrs.js +3 -3
- package/dist/esm/pm-plugins/decorations/utils/getAttrChangeRanges.js +3 -3
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +1 -1
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +1 -1
- package/dist/esm/pm-plugins/getScrollableDecorations.js +9 -4
- package/dist/esm/pm-plugins/main.js +2 -1
- package/dist/esm/pm-plugins/utils/baseNodeName.js +2 -2
- package/dist/types/pm-plugins/calculateDiff/simplifyChangesWithAttribution.d.ts +1 -1
- package/dist/types/pm-plugins/getScrollableDecorations.d.ts +1 -1
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 30.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`202f9b8386f13`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/202f9b8386f13) -
|
|
8
|
+
Migrate attributed version history checks to the platform_editor_attributed_version_history
|
|
9
|
+
experiment.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 30.0.8
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 30.0.7
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -138,7 +138,7 @@ var isRangeActive = function isRangeActive(activeIndexPos, from, to, attribution
|
|
|
138
138
|
if (activeIndexPos === undefined) {
|
|
139
139
|
return undefined;
|
|
140
140
|
}
|
|
141
|
-
if (!(0,
|
|
141
|
+
if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history')) {
|
|
142
142
|
return from === activeIndexPos.from && to === activeIndexPos.to;
|
|
143
143
|
}
|
|
144
144
|
return from <= activeIndexPos.to && activeIndexPos.from <= to && (!('attributionKey' in activeIndexPos) || activeIndexPos.attributionKey === attributionKey);
|
|
@@ -499,7 +499,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
499
499
|
// The attribute-aware encoder is needed by the smart classifier and is gated with it.
|
|
500
500
|
// The NCS version-history path also uses it so the main diff calculation detects attribute-only
|
|
501
501
|
// node replacements, e.g. changing an emoji or mention without changing the node type.
|
|
502
|
-
var _selectTokenEncoder = (0, _selectTokenEncoder2.selectTokenEncoder)(diffType === 'smart' && (0, _fg.fg)('platform_editor_ai_smart_diff') || (0,
|
|
502
|
+
var _selectTokenEncoder = (0, _selectTokenEncoder2.selectTokenEncoder)(diffType === 'smart' && (0, _fg.fg)('platform_editor_ai_smart_diff') || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history')),
|
|
503
503
|
tokenEncoder = _selectTokenEncoder.tokenEncoder,
|
|
504
504
|
shouldHideMarkOnlyDeletions = _selectTokenEncoder.shouldHideMarkOnlyDeletions;
|
|
505
505
|
var changes;
|
|
@@ -867,12 +867,12 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
867
867
|
// The attribute-aware token encoder already reports mark-only changes as regular changes in the
|
|
868
868
|
// smart path and the NCS version-history path. For NCS version history, only skip the step-range
|
|
869
869
|
// highlight if the main diff covers it or the remaining content has unchanged formatting.
|
|
870
|
-
(0, _getMarkChangeRanges.getMarkChangeRanges)(simplifiedSteps, simplifiedStepAttributions, (0,
|
|
870
|
+
(0, _getMarkChangeRanges.getMarkChangeRanges)(simplifiedSteps, simplifiedStepAttributions, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') ? stepMaps : undefined).filter(function (_ref11) {
|
|
871
871
|
var fromB = _ref11.fromB,
|
|
872
872
|
toB = _ref11.toB;
|
|
873
873
|
return !isHandledByTable(fromB, toB);
|
|
874
874
|
}).filter(function (range) {
|
|
875
|
-
return !(0,
|
|
875
|
+
return !(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') || !changes.some(function (change) {
|
|
876
876
|
return change.fromB <= range.fromB && change.toB >= range.toB;
|
|
877
877
|
}) && hasUnhighlightedMarkChanges(range);
|
|
878
878
|
}).forEach(function (change) {
|
|
@@ -899,7 +899,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
899
899
|
var fromB = _ref13.fromB,
|
|
900
900
|
toB = _ref13.toB,
|
|
901
901
|
isInline = _ref13.isInline;
|
|
902
|
-
return !(0,
|
|
902
|
+
return !(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') || !isInline || !changes.some(function (change) {
|
|
903
903
|
return change.fromB === fromB && change.toB === toB;
|
|
904
904
|
});
|
|
905
905
|
}).forEach(function (change) {
|
|
@@ -319,7 +319,7 @@ var collapse = function collapse(changes) {
|
|
|
319
319
|
* Both leave ranges that only touch, so they survive the collapse.
|
|
320
320
|
*
|
|
321
321
|
* Carries no gate of its own: the only caller reaches it through the attributed changeset, which
|
|
322
|
-
* already requires `
|
|
322
|
+
* already requires `platform_editor_attributed_version_history`.
|
|
323
323
|
*/
|
|
324
324
|
var collapseOverlappingChanges = exports.collapseOverlappingChanges = function collapseOverlappingChanges(changes, doc) {
|
|
325
325
|
return collapse(splitContainedChanges(splitMixedIdentityChanges(changes, doc), doc));
|
|
@@ -12,7 +12,6 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
12
12
|
var _getThirdPartyAgentColor = require("@atlaskit/agent-color/get-third-party-agent-color");
|
|
13
13
|
var _utils = require("@atlaskit/editor-shared-styles/utils");
|
|
14
14
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
15
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
16
15
|
var _showDiffPluginType = require("../../../showDiffPluginType");
|
|
17
16
|
var _types = require("./types");
|
|
18
17
|
var _excluded = ["attribution", "connectedTo"];
|
|
@@ -31,7 +30,7 @@ var HASHED_PARTICIPANT_COLOR_SCHEMES = [].concat((0, _toConsumableArray2.default
|
|
|
31
30
|
/**
|
|
32
31
|
* Red means "deleted" in both public schemes, so it never identifies an actor. Reserving it here
|
|
33
32
|
* covers every path into an attribution colour; `createAttributionColorMap` is the only caller, and
|
|
34
|
-
* it is gated on `
|
|
33
|
+
* it is gated on `platform_editor_attributed_version_history` plus
|
|
35
34
|
* `platform_editor_show_diff_color_scheme_refactor`.
|
|
36
35
|
*/
|
|
37
36
|
var RESERVED_ATTRIBUTION_COLORS = new Set(['red']);
|
|
@@ -118,7 +117,7 @@ var resolveContributors = exports.resolveContributors = function resolveContribu
|
|
|
118
117
|
return Object.keys(resolved).length > 0 ? resolved : undefined;
|
|
119
118
|
};
|
|
120
119
|
var areAttributionColorGatesEnabled = exports.areAttributionColorGatesEnabled = function areAttributionColorGatesEnabled() {
|
|
121
|
-
return (0,
|
|
120
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor');
|
|
122
121
|
};
|
|
123
122
|
var isAttributionColoringEnabled = exports.isAttributionColoringEnabled = function isAttributionColoringEnabled(stepAttributions) {
|
|
124
123
|
if (!areAttributionColorGatesEnabled() || !(stepAttributions !== null && stepAttributions !== void 0 && stepAttributions.length)) {
|
|
@@ -239,7 +238,7 @@ var getAttributionKeyForChanges = function getAttributionKeyForChanges(changes)
|
|
|
239
238
|
*/
|
|
240
239
|
var getAttributionKeyForChange = exports.getAttributionKeyForChange = function getAttributionKeyForChange(change, attributedChanges) {
|
|
241
240
|
var directKey = getAttributionKeyForChanges([change]);
|
|
242
|
-
return directKey !== null && directKey !== void 0 ? directKey : (0,
|
|
241
|
+
return directKey !== null && directKey !== void 0 ? directKey : (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') ? undefined : getAttributionKeyForChanges(attributedChanges.filter(function (attributedChange) {
|
|
243
242
|
return changesOverlap(change, attributedChange);
|
|
244
243
|
}));
|
|
245
244
|
};
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createLeftAnchorWidget = exports.createInlineIndicatorAnchorWidgets = exports.createDocMarginAnchorWidget = exports.createBlockIndicatorAnchorWidgets = exports.createAnchorNameSpan = exports.clampAnchorPosIntoCell = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
10
11
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
12
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
13
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
@@ -574,7 +575,7 @@ var createInlineIndicatorAnchorWidgets = exports.createInlineIndicatorAnchorWidg
|
|
|
574
575
|
// Gated purely so the `createAnchorSpanWidget` rewrite can be rolled back independently of the
|
|
575
576
|
// contributor-tag anchors it was extracted for: both branches build the same two widgets at the
|
|
576
577
|
// same positions. Drop the fallback with the gate.
|
|
577
|
-
if ((0,
|
|
578
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history')) {
|
|
578
579
|
return [createAnchorSpanWidget({
|
|
579
580
|
pos: fromPos,
|
|
580
581
|
diffId: diffId,
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.unmountContributorTag = exports.resolveHoistedCodeBlockAnchor = exports.resolveCodeBlockStart = exports.mountContributorTag = exports.isContributorTagWidgetEnabled = exports.createContributorTagWidget = exports.createContributorTagHost = exports.CONTRIBUTOR_TAG_HOST_ATTRIBUTE = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
9
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
10
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
11
11
|
var _contributorTagController = require("../../ui/ContributorTag/contributorTagController");
|
|
12
12
|
var _baseNodeName = require("../utils/baseNodeName");
|
|
13
13
|
var _charsByOffset = require("../utils/charsByOffset");
|
|
@@ -20,7 +20,7 @@ var CONTRIBUTOR_TAG_HOST_ATTRIBUTE = exports.CONTRIBUTOR_TAG_HOST_ATTRIBUTE = 'd
|
|
|
20
20
|
|
|
21
21
|
// Contributor tags only render behind this gate — see `areAttributionColorGatesEnabled`.
|
|
22
22
|
var isContributorTagWidgetEnabled = exports.isContributorTagWidgetEnabled = function isContributorTagWidgetEnabled() {
|
|
23
|
-
return (0,
|
|
23
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history');
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -195,7 +195,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
195
195
|
// node renders beneath its replacement; otherwise anchor at the start (change.fromB).
|
|
196
196
|
var anchorPos = placeBelow ? change.toB : change.fromB;
|
|
197
197
|
var safeInsertPos = (0, _findSafeInsertPos.findSafeInsertPos)(newDoc, anchorPos, slice);
|
|
198
|
-
var isActive = activeIndexPos && ((0,
|
|
198
|
+
var isActive = activeIndexPos && ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') ? safeInsertPos >= activeIndexPos.from && safeInsertPos <= activeIndexPos.to && (!('attributionKey' in activeIndexPos) || activeIndexPos.attributionKey === attributionKey) : safeInsertPos === activeIndexPos.from && safeInsertPos === activeIndexPos.to);
|
|
199
199
|
if (deletedBlankLineCount > 0) {
|
|
200
200
|
// The blocks have no content to serialize, so the deletion is shown as one struck-through
|
|
201
201
|
// return glyph per line the author removed. A single widget, not one per line: the lines are
|
|
@@ -427,7 +427,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
427
427
|
var $sourcePos = (0, _fg.fg)('platform_editor_ai_show_diff_patch_2') ? getSourcePos(doc, $changeFromA, slice.openStart, index) : null;
|
|
428
428
|
var nodeView = serializer.tryCreateNodeView(node, 0, $sourcePos !== null && $sourcePos !== void 0 ? $sourcePos : undefined, isInserted, colorScheme);
|
|
429
429
|
if (nodeView) {
|
|
430
|
-
if (canTagWidget && contributorTagAnchorName === undefined && (0, _baseNodeName.resolveBaseNodeName)(node.type.name) === 'layoutColumn' && nodeView instanceof HTMLElement && (0,
|
|
430
|
+
if (canTagWidget && contributorTagAnchorName === undefined && (0, _baseNodeName.resolveBaseNodeName)(node.type.name) === 'layoutColumn' && nodeView instanceof HTMLElement && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history')) {
|
|
431
431
|
// The deleted column is rendered inside this widget; anchor to its box.
|
|
432
432
|
contributorTagAnchorName = (0, _decorationKeys.buildAnchorDecorationKey)({
|
|
433
433
|
diffId: diffId,
|
|
@@ -550,7 +550,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
550
550
|
})));
|
|
551
551
|
// `dom` is inline, so its box fragments across a line wrap and `anchor()` resolves to the
|
|
552
552
|
// wrong edge. The tag anchors to its own point marker instead (EDITOR-9286).
|
|
553
|
-
if ((0,
|
|
553
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') && !contributorTagAnchorName) {
|
|
554
554
|
var tagPointAnchorName = (0, _decorationKeys.buildAnchorDecorationKey)({
|
|
555
555
|
diffId: diffId,
|
|
556
556
|
anchorType: _decorationKeys.AnchorTypeKey.tag
|
|
@@ -8,7 +8,7 @@ exports.extractContributorTags = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var
|
|
11
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
12
12
|
var _baseNodeName = require("../utils/baseNodeName");
|
|
13
13
|
var _taggableBlockNodes = require("../utils/taggableBlockNodes");
|
|
14
14
|
var _decorationKeys = require("./decorationKeys");
|
|
@@ -46,7 +46,7 @@ var isSameChange = function isSameChange(widget, inline) {
|
|
|
46
46
|
* `inlineDeletedDiffPlacement: 'after'`, where the inline half leads instead.
|
|
47
47
|
*/
|
|
48
48
|
var leadsReplacement = function leadsReplacement(widget) {
|
|
49
|
-
return (0,
|
|
49
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') && widget.spec.side === -1;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -82,7 +82,7 @@ var byLeadingPosition = function byLeadingPosition(a, b) {
|
|
|
82
82
|
/** Select the first layout column only when the inline layout range starts immediately before it. */
|
|
83
83
|
var navigationLeader = function navigationLeader(members) {
|
|
84
84
|
var ordered = (0, _toConsumableArray2.default)(members).sort(byLeadingPosition);
|
|
85
|
-
var layoutColumn = (0,
|
|
85
|
+
var layoutColumn = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') ? ordered.find(function (_ref2) {
|
|
86
86
|
var _decoration$spec$node;
|
|
87
87
|
var decoration = _ref2.decoration;
|
|
88
88
|
return decoration.spec.decorationType === 'block' && (0, _baseNodeName.resolveBaseNodeName)((_decoration$spec$node = decoration.spec.nodeName) !== null && _decoration$spec$node !== void 0 ? _decoration$spec$node : '') === 'layoutColumn';
|
|
@@ -124,7 +124,7 @@ var owningStop = function owningStop(target, stops) {
|
|
|
124
124
|
*/
|
|
125
125
|
var resolveActiveTarget = function resolveActiveTarget(surviving, activeIndexPos) {
|
|
126
126
|
return containedBy(surviving, activeIndexPos).find(function (target) {
|
|
127
|
-
return !(0,
|
|
127
|
+
return !(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') || !('attributionKey' in activeIndexPos) || target.decoration.spec.attributionKey === activeIndexPos.attributionKey;
|
|
128
128
|
});
|
|
129
129
|
};
|
|
130
130
|
|
|
@@ -253,7 +253,7 @@ var extractContributorTags = exports.extractContributorTags = function extractCo
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
// A nested block folds into the outermost one of the same contributor, so nesting adds no tags.
|
|
256
|
-
if ((0,
|
|
256
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history')) {
|
|
257
257
|
var blocksByContributor = new Map();
|
|
258
258
|
var _iterator2 = _createForOfIteratorHelper(blockTargets),
|
|
259
259
|
_step2;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isDiffableAttr = exports.getRequiredIncludedDiffableAttrs = exports.getIncludedDiffableAttrs = exports.getDiffableAttrNames = exports.DIFFABLE_ATTRS_BY_NODE_TYPE = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
8
8
|
/**
|
|
9
9
|
* Single source of truth for which attributes of a node type represent a
|
|
10
10
|
* meaningful change. Shared by `attrAwareTokenEncoder` (changeset detection)
|
|
@@ -96,8 +96,8 @@ var getRequiredIncludedDiffableAttrs = exports.getRequiredIncludedDiffableAttrs
|
|
|
96
96
|
*/
|
|
97
97
|
var getDiffableAttrNames = exports.getDiffableAttrNames = function getDiffableAttrNames(nodeTypeName, attrs) {
|
|
98
98
|
// Adding a column updates existing widths, ignore this attribute change. Move this into
|
|
99
|
-
// DIFFABLE_ATTRS_BY_NODE_TYPE when cleaning up
|
|
100
|
-
var ignoreColumnWidth = nodeTypeName === 'layoutColumn' && (0,
|
|
99
|
+
// DIFFABLE_ATTRS_BY_NODE_TYPE when cleaning up platform_editor_attributed_version_history
|
|
100
|
+
var ignoreColumnWidth = nodeTypeName === 'layoutColumn' && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history');
|
|
101
101
|
var rule = DIFFABLE_ATTRS_BY_NODE_TYPE[nodeTypeName];
|
|
102
102
|
if (!rule) {
|
|
103
103
|
return Object.keys(attrs).filter(function (name) {
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.stepIsValidAttrChange = exports.isInlineAttrChangeNodeName = exports.getAttrChangeRanges = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
9
10
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
10
11
|
var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
11
12
|
var _setAttrs = require("@atlaskit/adf-schema/steps/set-attrs");
|
|
12
13
|
var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
|
|
13
14
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
14
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
15
15
|
var _diffableAttrs = require("./diffableAttrs");
|
|
16
16
|
var _excerptIncludeAttrs = require("./excerptIncludeAttrs");
|
|
17
17
|
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; }
|
|
@@ -92,7 +92,7 @@ var getAttrChangeRanges = exports.getAttrChangeRanges = function getAttrChangeRa
|
|
|
92
92
|
var originalNodeAtPos = originalPos === undefined ? null : originalDoc.nodeAt(originalPos);
|
|
93
93
|
var hasChangedAttr = function hasChangedAttr(watchedAttrs) {
|
|
94
94
|
return attrsToCheck.some(function (attr) {
|
|
95
|
-
return watchedAttrs.includes(attr) && (!(0,
|
|
95
|
+
return watchedAttrs.includes(attr) && (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') || !originalNodeAtPos || originalNodeAtPos.type !== (nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.type) || !(0, _isEqual.default)(originalNodeAtPos.attrs[attr], nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.attrs[attr]));
|
|
96
96
|
});
|
|
97
97
|
};
|
|
98
98
|
|
|
@@ -182,7 +182,7 @@ var getAttrChangeRanges = exports.getAttrChangeRanges = function getAttrChangeRa
|
|
|
182
182
|
// (e.g. setNodeAttribute(pos, 'text', ...) + setNodeAttribute(pos, 'color', ...))
|
|
183
183
|
// should produce only one decoration, not one per step.
|
|
184
184
|
.filter(function (range, i, arr) {
|
|
185
|
-
return (0,
|
|
185
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') ? !arr.some(function (r, nextIndex) {
|
|
186
186
|
return nextIndex > i && r.fromB === range.fromB;
|
|
187
187
|
}) : arr.findIndex(function (r) {
|
|
188
188
|
return r.fromB === range.fromB;
|
|
@@ -374,7 +374,7 @@ var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref9
|
|
|
374
374
|
// should not also get the inline content style (borderBottom underline) on their container.
|
|
375
375
|
var shouldSkipContentStyle = isInserted && nodeStyle !== undefined;
|
|
376
376
|
var contentStyle = shouldSkipContentStyle ? '' : (0, _wrapBlockNodeViewStyles.getChangedContentStyle)(colorScheme, isActive, isInserted, hideAddedDiffsUnderline);
|
|
377
|
-
var isEmptyDeletedLayoutColumn = !isInserted && (0, _baseNodeName.resolveBaseNodeName)(targetNode.type.name) === 'layoutColumn' && targetNode.textContent.length === 0 && (0,
|
|
377
|
+
var isEmptyDeletedLayoutColumn = !isInserted && (0, _baseNodeName.resolveBaseNodeName)(targetNode.type.name) === 'layoutColumn' && targetNode.textContent.length === 0 && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history');
|
|
378
378
|
if (isEmptyDeletedLayoutColumn && nodeView instanceof HTMLElement) {
|
|
379
379
|
var _nodeView$querySelect;
|
|
380
380
|
// Give an empty deleted column height so its diff box doesn't collapse
|
|
@@ -60,7 +60,7 @@ var getChangedContentStyleNext = function getChangedContentStyleNext(colorScheme
|
|
|
60
60
|
// Text-like blocks (heading, lists, blockquote) render their deleted content through this
|
|
61
61
|
// getter rather than `getDeletedContentStyle`, so without this they never receive the
|
|
62
62
|
// glyphTint background + underline that plain deleted text already gets.
|
|
63
|
-
if ((0,
|
|
63
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') && colors.deletedInlineTreatment === 'glyphTint') {
|
|
64
64
|
return base + (0, _factory.buildDeletedInlineContentStyleExtended)(colors, isActive);
|
|
65
65
|
}
|
|
66
66
|
return base;
|
|
@@ -8,6 +8,7 @@ exports.getScrollableDecorations = void 0;
|
|
|
8
8
|
exports.isInlineDiffDecorationRenderableInDoc = isInlineDiffDecorationRenderableInDoc;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
11
12
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
13
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
14
|
var _decorationKeys = require("./decorations/decorationKeys");
|
|
@@ -190,7 +191,7 @@ function groupTouchingDecorations(decorations, isInlineDecoration, doc) {
|
|
|
190
191
|
* 3. Deduplicates diff-block decorations with same from, to and nodeName
|
|
191
192
|
* 4. When `doc` is passed: excludes diff-inline decorations whose range has no inline content
|
|
192
193
|
* (invalid positions, or block-only slices with no text/atoms — e.g. empty blocks)
|
|
193
|
-
* 5. When `
|
|
194
|
+
* 5. When `platform_editor_attributed_version_history` is enabled, groups overlapping or
|
|
194
195
|
* directly touching ranges across decoration types into one result per contributor, using the
|
|
195
196
|
* union of all grouped ranges
|
|
196
197
|
* (zero-width widgets can join a group without extending it). Under
|
|
@@ -227,10 +228,14 @@ var getScrollableDecorations = exports.getScrollableDecorations = function getSc
|
|
|
227
228
|
if (isBlockDecoration(dec)) {
|
|
228
229
|
var _dec$spec, _dec$spec$nodeName;
|
|
229
230
|
// Skip listItem blocks as they are not scrollable
|
|
230
|
-
if (((_dec$spec = dec.spec) === null || _dec$spec === void 0 ? void 0 : _dec$spec.nodeName) === 'listItem')
|
|
231
|
+
if (((_dec$spec = dec.spec) === null || _dec$spec === void 0 ? void 0 : _dec$spec.nodeName) === 'listItem') {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
231
234
|
var key = "".concat(dec.from, "-").concat(dec.to, "-").concat((_dec$spec$nodeName = dec.spec.nodeName) !== null && _dec$spec$nodeName !== void 0 ? _dec$spec$nodeName : '');
|
|
232
235
|
// Skip blocks that have already been seen
|
|
233
|
-
if (seenBlockKeys.has(key))
|
|
236
|
+
if (seenBlockKeys.has(key)) {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
234
239
|
seenBlockKeys.add(key);
|
|
235
240
|
}
|
|
236
241
|
return true;
|
|
@@ -244,7 +249,7 @@ var getScrollableDecorations = exports.getScrollableDecorations = function getSc
|
|
|
244
249
|
}) : rawInlines;
|
|
245
250
|
var widgets = filtered.filter(isWidgetDecoration);
|
|
246
251
|
var result;
|
|
247
|
-
if ((0,
|
|
252
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history')) {
|
|
248
253
|
// Group overlapping or directly touching ranges into one customer-facing edit.
|
|
249
254
|
result = groupTouchingDecorations([].concat((0, _toConsumableArray2.default)(blocks), (0, _toConsumableArray2.default)(inlines), (0, _toConsumableArray2.default)(widgets)), isInlineDecoration, doc);
|
|
250
255
|
} else {
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.showDiffPluginKey = exports.createPlugin = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
9
10
|
var _expand = require("@atlaskit/editor-common/expand");
|
|
10
11
|
var _processRawValue = require("@atlaskit/editor-common/process-raw-value");
|
|
11
12
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
@@ -167,7 +168,7 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
|
|
|
167
168
|
activeIndexPos: activeDecoration ? _objectSpread({
|
|
168
169
|
from: activeDecoration.from,
|
|
169
170
|
to: activeDecoration.to
|
|
170
|
-
}, (0,
|
|
171
|
+
}, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') ? {
|
|
171
172
|
attributionKey: (0, _decorationKeys.isDiffDecoration)(activeDecoration) ? activeDecoration.spec.attributionKey : undefined
|
|
172
173
|
} : {}) : undefined
|
|
173
174
|
});
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.resolveBaseNodeName = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
8
8
|
/**
|
|
9
9
|
* A node type's base name, with a schema variant's suffix stripped: `panel`, `panel_c1` and
|
|
10
10
|
* `panel_c1_root_only` all resolve to `panel`.
|
|
@@ -21,5 +21,5 @@ var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
|
21
21
|
* in the styling decisions would move the legacy diff for readers who see no tags.
|
|
22
22
|
*/
|
|
23
23
|
var resolveBaseNodeName = exports.resolveBaseNodeName = function resolveBaseNodeName(name) {
|
|
24
|
-
return (0,
|
|
24
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_attributed_version_history') ? name.split('_')[0] : name;
|
|
25
25
|
};
|
|
@@ -125,7 +125,7 @@ const isRangeActive = (activeIndexPos, from, to, attributionKey) => {
|
|
|
125
125
|
if (activeIndexPos === undefined) {
|
|
126
126
|
return undefined;
|
|
127
127
|
}
|
|
128
|
-
if (!
|
|
128
|
+
if (!isExperimentEnabled('platform_editor_attributed_version_history')) {
|
|
129
129
|
return from === activeIndexPos.from && to === activeIndexPos.to;
|
|
130
130
|
}
|
|
131
131
|
return from <= activeIndexPos.to && activeIndexPos.from <= to && (!('attributionKey' in activeIndexPos) || activeIndexPos.attributionKey === attributionKey);
|
|
@@ -455,7 +455,7 @@ const calculateDiffDecorationsInner = ({
|
|
|
455
455
|
const {
|
|
456
456
|
tokenEncoder,
|
|
457
457
|
shouldHideMarkOnlyDeletions
|
|
458
|
-
} = selectTokenEncoder(diffType === 'smart' && fg('platform_editor_ai_smart_diff') ||
|
|
458
|
+
} = selectTokenEncoder(diffType === 'smart' && fg('platform_editor_ai_smart_diff') || isExperimentEnabled('platform_editor_attributed_version_history'));
|
|
459
459
|
let changes;
|
|
460
460
|
let contentChanges;
|
|
461
461
|
let attributedChanges = [];
|
|
@@ -782,10 +782,10 @@ const calculateDiffDecorationsInner = ({
|
|
|
782
782
|
// The attribute-aware token encoder already reports mark-only changes as regular changes in the
|
|
783
783
|
// smart path and the NCS version-history path. For NCS version history, only skip the step-range
|
|
784
784
|
// highlight if the main diff covers it or the remaining content has unchanged formatting.
|
|
785
|
-
getMarkChangeRanges(simplifiedSteps, simplifiedStepAttributions,
|
|
785
|
+
getMarkChangeRanges(simplifiedSteps, simplifiedStepAttributions, isExperimentEnabled('platform_editor_attributed_version_history') ? stepMaps : undefined).filter(({
|
|
786
786
|
fromB,
|
|
787
787
|
toB
|
|
788
|
-
}) => !isHandledByTable(fromB, toB)).filter(range => !
|
|
788
|
+
}) => !isHandledByTable(fromB, toB)).filter(range => !isExperimentEnabled('platform_editor_attributed_version_history') || !changes.some(change => change.fromB <= range.fromB && change.toB >= range.toB) && hasUnhighlightedMarkChanges(range)).forEach(change => {
|
|
789
789
|
var _attributionColors$ge, _attributionColors;
|
|
790
790
|
const changeColorScheme = change.attributionKey ? (_attributionColors$ge = (_attributionColors = attributionColors) === null || _attributionColors === void 0 ? void 0 : _attributionColors.get(change.attributionKey)) !== null && _attributionColors$ge !== void 0 ? _attributionColors$ge : colorScheme : colorScheme;
|
|
791
791
|
const attributionKey = showContributorTags ? change.attributionKey : undefined;
|
|
@@ -808,7 +808,7 @@ const calculateDiffDecorationsInner = ({
|
|
|
808
808
|
fromB,
|
|
809
809
|
toB,
|
|
810
810
|
isInline
|
|
811
|
-
}) => !
|
|
811
|
+
}) => !isExperimentEnabled('platform_editor_attributed_version_history') || !isInline || !changes.some(change => change.fromB === fromB && change.toB === toB)).forEach(change => {
|
|
812
812
|
var _attributionColors$ge2, _attributionColors2;
|
|
813
813
|
const changeColorScheme = change.attributionKey ? (_attributionColors$ge2 = (_attributionColors2 = attributionColors) === null || _attributionColors2 === void 0 ? void 0 : _attributionColors2.get(change.attributionKey)) !== null && _attributionColors$ge2 !== void 0 ? _attributionColors$ge2 : colorScheme : colorScheme;
|
|
814
814
|
const attributionKey = showContributorTags ? change.attributionKey : undefined;
|
|
@@ -259,7 +259,7 @@ const collapse = changes => {
|
|
|
259
259
|
* Both leave ranges that only touch, so they survive the collapse.
|
|
260
260
|
*
|
|
261
261
|
* Carries no gate of its own: the only caller reaches it through the attributed changeset, which
|
|
262
|
-
* already requires `
|
|
262
|
+
* already requires `platform_editor_attributed_version_history`.
|
|
263
263
|
*/
|
|
264
264
|
export const collapseOverlappingChanges = (changes, doc) => collapse(splitContainedChanges(splitMixedIdentityChanges(changes, doc), doc));
|
|
265
265
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getThirdPartyAgentColor } from '@atlaskit/agent-color/get-third-party-agent-color';
|
|
2
2
|
import { getParticipantColor } from '@atlaskit/editor-shared-styles/utils';
|
|
3
3
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
4
|
import { DIFF_AGENT_BRANDS } from '../../../showDiffPluginType';
|
|
6
5
|
import { PARTICIPANT_COLOR_SCHEMES } from './types';
|
|
7
6
|
|
|
@@ -15,7 +14,7 @@ const HASHED_PARTICIPANT_COLOR_SCHEMES = [...PARTICIPANT_COLOR_SCHEMES, 'blue',
|
|
|
15
14
|
/**
|
|
16
15
|
* Red means "deleted" in both public schemes, so it never identifies an actor. Reserving it here
|
|
17
16
|
* covers every path into an attribution colour; `createAttributionColorMap` is the only caller, and
|
|
18
|
-
* it is gated on `
|
|
17
|
+
* it is gated on `platform_editor_attributed_version_history` plus
|
|
19
18
|
* `platform_editor_show_diff_color_scheme_refactor`.
|
|
20
19
|
*/
|
|
21
20
|
const RESERVED_ATTRIBUTION_COLORS = new Set(['red']);
|
|
@@ -92,7 +91,7 @@ export const resolveContributors = contributors => {
|
|
|
92
91
|
}
|
|
93
92
|
return Object.keys(resolved).length > 0 ? resolved : undefined;
|
|
94
93
|
};
|
|
95
|
-
export const areAttributionColorGatesEnabled = () =>
|
|
94
|
+
export const areAttributionColorGatesEnabled = () => isExperimentEnabled('platform_editor_attributed_version_history') && isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor');
|
|
96
95
|
export const isAttributionColoringEnabled = stepAttributions => {
|
|
97
96
|
if (!areAttributionColorGatesEnabled() || !(stepAttributions !== null && stepAttributions !== void 0 && stepAttributions.length)) {
|
|
98
97
|
return false;
|
|
@@ -178,7 +177,7 @@ const getAttributionKeyForChanges = changes => getAttributionKey(getLatestAttrib
|
|
|
178
177
|
*/
|
|
179
178
|
export const getAttributionKeyForChange = (change, attributedChanges) => {
|
|
180
179
|
const directKey = getAttributionKeyForChanges([change]);
|
|
181
|
-
return directKey !== null && directKey !== void 0 ? directKey :
|
|
180
|
+
return directKey !== null && directKey !== void 0 ? directKey : isExperimentEnabled('platform_editor_attributed_version_history') ? undefined : getAttributionKeyForChanges(attributedChanges.filter(attributedChange => changesOverlap(change, attributedChange)));
|
|
182
181
|
};
|
|
183
182
|
export const getColorSchemeForChange = (change, attributedChanges, attributionColors, fallback) => {
|
|
184
183
|
var _attributionColors$ge;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
1
2
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
2
3
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
4
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
@@ -549,7 +550,7 @@ export const createInlineIndicatorAnchorWidgets = ({
|
|
|
549
550
|
// Gated purely so the `createAnchorSpanWidget` rewrite can be rolled back independently of the
|
|
550
551
|
// contributor-tag anchors it was extracted for: both branches build the same two widgets at the
|
|
551
552
|
// same positions. Drop the fallback with the gate.
|
|
552
|
-
if (
|
|
553
|
+
if (isExperimentEnabled('platform_editor_attributed_version_history')) {
|
|
553
554
|
return [createAnchorSpanWidget({
|
|
554
555
|
pos: fromPos,
|
|
555
556
|
diffId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
1
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
3
|
import { ContributorTagController } from '../../ui/ContributorTag/contributorTagController';
|
|
4
4
|
import { resolveBaseNodeName } from '../utils/baseNodeName';
|
|
5
5
|
import { buildCharsByOffset, isWhitespaceChar } from '../utils/charsByOffset';
|
|
@@ -10,7 +10,7 @@ import { AnchorTypeKey, buildAnchorDecorationKey, buildAnchorDecorationSpec, bui
|
|
|
10
10
|
export const CONTRIBUTOR_TAG_HOST_ATTRIBUTE = 'data-contributor-tag-host';
|
|
11
11
|
|
|
12
12
|
// Contributor tags only render behind this gate — see `areAttributionColorGatesEnabled`.
|
|
13
|
-
export const isContributorTagWidgetEnabled = () =>
|
|
13
|
+
export const isContributorTagWidgetEnabled = () => isExperimentEnabled('platform_editor_attributed_version_history');
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Everything a tag needs to draw itself into the document, plumbed down from the plugin. Absent in
|
|
@@ -187,7 +187,7 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
187
187
|
// node renders beneath its replacement; otherwise anchor at the start (change.fromB).
|
|
188
188
|
const anchorPos = placeBelow ? change.toB : change.fromB;
|
|
189
189
|
const safeInsertPos = findSafeInsertPos(newDoc, anchorPos, slice);
|
|
190
|
-
const isActive = activeIndexPos && (
|
|
190
|
+
const isActive = activeIndexPos && (isExperimentEnabled('platform_editor_attributed_version_history') ? safeInsertPos >= activeIndexPos.from && safeInsertPos <= activeIndexPos.to && (!('attributionKey' in activeIndexPos) || activeIndexPos.attributionKey === attributionKey) : safeInsertPos === activeIndexPos.from && safeInsertPos === activeIndexPos.to);
|
|
191
191
|
if (deletedBlankLineCount > 0) {
|
|
192
192
|
// The blocks have no content to serialize, so the deletion is shown as one struck-through
|
|
193
193
|
// return glyph per line the author removed. A single widget, not one per line: the lines are
|
|
@@ -413,7 +413,7 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
413
413
|
const $sourcePos = fg('platform_editor_ai_show_diff_patch_2') ? getSourcePos(doc, $changeFromA, slice.openStart, index) : null;
|
|
414
414
|
const nodeView = serializer.tryCreateNodeView(node, 0, $sourcePos !== null && $sourcePos !== void 0 ? $sourcePos : undefined, isInserted, colorScheme);
|
|
415
415
|
if (nodeView) {
|
|
416
|
-
if (canTagWidget && contributorTagAnchorName === undefined && resolveBaseNodeName(node.type.name) === 'layoutColumn' && nodeView instanceof HTMLElement &&
|
|
416
|
+
if (canTagWidget && contributorTagAnchorName === undefined && resolveBaseNodeName(node.type.name) === 'layoutColumn' && nodeView instanceof HTMLElement && isExperimentEnabled('platform_editor_attributed_version_history')) {
|
|
417
417
|
// The deleted column is rendered inside this widget; anchor to its box.
|
|
418
418
|
contributorTagAnchorName = buildAnchorDecorationKey({
|
|
419
419
|
diffId,
|
|
@@ -536,7 +536,7 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
536
536
|
})}`);
|
|
537
537
|
// `dom` is inline, so its box fragments across a line wrap and `anchor()` resolves to the
|
|
538
538
|
// wrong edge. The tag anchors to its own point marker instead (EDITOR-9286).
|
|
539
|
-
if (
|
|
539
|
+
if (isExperimentEnabled('platform_editor_attributed_version_history') && !contributorTagAnchorName) {
|
|
540
540
|
const tagPointAnchorName = buildAnchorDecorationKey({
|
|
541
541
|
diffId,
|
|
542
542
|
anchorType: AnchorTypeKey.tag
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
2
2
|
import { resolveBaseNodeName } from '../utils/baseNodeName';
|
|
3
3
|
import { isTaggableBlockNodeName } from '../utils/taggableBlockNodes';
|
|
4
4
|
import { isDiffDecoration, isDiffDecorationSpec } from './decorationKeys';
|
|
@@ -27,7 +27,7 @@ const isSameChange = (widget, inline) => widget.spec.attributionKey === inline.s
|
|
|
27
27
|
* the deleted content in front of the inserted text; `1` is `deletedDiffPlacement: 'bottom'` /
|
|
28
28
|
* `inlineDeletedDiffPlacement: 'after'`, where the inline half leads instead.
|
|
29
29
|
*/
|
|
30
|
-
const leadsReplacement = widget =>
|
|
30
|
+
const leadsReplacement = widget => isExperimentEnabled('platform_editor_attributed_version_history') && widget.spec.side === -1;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Whether `inner` captions the same change as the block decoration `block`, in which case only the
|
|
@@ -58,7 +58,7 @@ const byLeadingPosition = (a, b) => {
|
|
|
58
58
|
/** Select the first layout column only when the inline layout range starts immediately before it. */
|
|
59
59
|
const navigationLeader = members => {
|
|
60
60
|
const ordered = [...members].sort(byLeadingPosition);
|
|
61
|
-
const layoutColumn =
|
|
61
|
+
const layoutColumn = isExperimentEnabled('platform_editor_attributed_version_history') ? ordered.find(({
|
|
62
62
|
decoration
|
|
63
63
|
}) => {
|
|
64
64
|
var _decoration$spec$node;
|
|
@@ -92,7 +92,7 @@ const owningStop = (target, stops) => stops.reduce((narrowest, stop) => stop.fro
|
|
|
92
92
|
* group's union range touches, so several tags revealed over each other (EDITOR-8971). Hence
|
|
93
93
|
* containment, and the leading change of what it covers.
|
|
94
94
|
*/
|
|
95
|
-
const resolveActiveTarget = (surviving, activeIndexPos) => containedBy(surviving, activeIndexPos).find(target => !
|
|
95
|
+
const resolveActiveTarget = (surviving, activeIndexPos) => containedBy(surviving, activeIndexPos).find(target => !isExperimentEnabled('platform_editor_attributed_version_history') || !('attributionKey' in activeIndexPos) || target.decoration.spec.attributionKey === activeIndexPos.attributionKey);
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* One model per diff decoration whose attribution resolves to a supplied contributor; anything
|
|
@@ -202,7 +202,7 @@ export const extractContributorTags = (decorations, contributors, activeIndexPos
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
// A nested block folds into the outermost one of the same contributor, so nesting adds no tags.
|
|
205
|
-
if (
|
|
205
|
+
if (isExperimentEnabled('platform_editor_attributed_version_history')) {
|
|
206
206
|
const blocksByContributor = new Map();
|
|
207
207
|
for (const target of blockTargets) {
|
|
208
208
|
var _target$decoration$sp, _blocksByContributor$;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Single source of truth for which attributes of a node type represent a
|
|
@@ -91,8 +91,8 @@ export const getRequiredIncludedDiffableAttrs = nodeTypeName => {
|
|
|
91
91
|
*/
|
|
92
92
|
export const getDiffableAttrNames = (nodeTypeName, attrs) => {
|
|
93
93
|
// Adding a column updates existing widths, ignore this attribute change. Move this into
|
|
94
|
-
// DIFFABLE_ATTRS_BY_NODE_TYPE when cleaning up
|
|
95
|
-
const ignoreColumnWidth = nodeTypeName === 'layoutColumn' &&
|
|
94
|
+
// DIFFABLE_ATTRS_BY_NODE_TYPE when cleaning up platform_editor_attributed_version_history
|
|
95
|
+
const ignoreColumnWidth = nodeTypeName === 'layoutColumn' && isExperimentEnabled('platform_editor_attributed_version_history');
|
|
96
96
|
const rule = DIFFABLE_ATTRS_BY_NODE_TYPE[nodeTypeName];
|
|
97
97
|
if (!rule) {
|
|
98
98
|
return Object.keys(attrs).filter(name => !DEFAULT_EXCLUDED_ATTRS.includes(name) && !(ignoreColumnWidth && name === 'width')).sort();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
1
2
|
import isEqual from 'lodash/isEqual';
|
|
2
3
|
import omit from 'lodash/omit';
|
|
3
4
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps/set-attrs';
|
|
4
5
|
import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-utils';
|
|
5
6
|
import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
7
|
import { getRequiredIncludedDiffableAttrs, isDiffableAttr } from './diffableAttrs';
|
|
8
8
|
import { getComparableExcerptIncludeAttrs, getReferencedContentId, isExcerptInclude } from './excerptIncludeAttrs';
|
|
9
9
|
const filterUndefined = x => !!x;
|
|
@@ -74,7 +74,7 @@ export const getAttrChangeRanges = (doc, attrStepContexts, originalDoc) => {
|
|
|
74
74
|
const $pos = doc.resolve(finalPos);
|
|
75
75
|
const nodeAtPos = doc.nodeAt(finalPos);
|
|
76
76
|
const originalNodeAtPos = originalPos === undefined ? null : originalDoc.nodeAt(originalPos);
|
|
77
|
-
const hasChangedAttr = watchedAttrs => attrsToCheck.some(attr => watchedAttrs.includes(attr) && (!
|
|
77
|
+
const hasChangedAttr = watchedAttrs => attrsToCheck.some(attr => watchedAttrs.includes(attr) && (!isExperimentEnabled('platform_editor_attributed_version_history') || !originalNodeAtPos || originalNodeAtPos.type !== (nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.type) || !isEqual(originalNodeAtPos.attrs[attr], nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.attrs[attr])));
|
|
78
78
|
|
|
79
79
|
// The changeset path (createDecorationsForChange) handles the deletion widget via
|
|
80
80
|
// prosemirror-changeset; we only need to add the inline insertion highlight here.
|
|
@@ -162,7 +162,7 @@ export const getAttrChangeRanges = (doc, attrStepContexts, originalDoc) => {
|
|
|
162
162
|
// Deduplicate by node position: multiple AttrSteps on the same node
|
|
163
163
|
// (e.g. setNodeAttribute(pos, 'text', ...) + setNodeAttribute(pos, 'color', ...))
|
|
164
164
|
// should produce only one decoration, not one per step.
|
|
165
|
-
.filter((range, i, arr) =>
|
|
165
|
+
.filter((range, i, arr) => isExperimentEnabled('platform_editor_attributed_version_history') ? !arr.some((r, nextIndex) => nextIndex > i && r.fromB === range.fromB) : arr.findIndex(r => r.fromB === range.fromB) === i);
|
|
166
166
|
};
|
|
167
167
|
|
|
168
168
|
/**
|
|
@@ -362,7 +362,7 @@ const createBlockNodeContentWrapper = ({
|
|
|
362
362
|
// should not also get the inline content style (borderBottom underline) on their container.
|
|
363
363
|
const shouldSkipContentStyle = isInserted && nodeStyle !== undefined;
|
|
364
364
|
const contentStyle = shouldSkipContentStyle ? '' : getChangedContentStyle(colorScheme, isActive, isInserted, hideAddedDiffsUnderline);
|
|
365
|
-
const isEmptyDeletedLayoutColumn = !isInserted && resolveBaseNodeName(targetNode.type.name) === 'layoutColumn' && targetNode.textContent.length === 0 &&
|
|
365
|
+
const isEmptyDeletedLayoutColumn = !isInserted && resolveBaseNodeName(targetNode.type.name) === 'layoutColumn' && targetNode.textContent.length === 0 && isExperimentEnabled('platform_editor_attributed_version_history');
|
|
366
366
|
if (isEmptyDeletedLayoutColumn && nodeView instanceof HTMLElement) {
|
|
367
367
|
var _nodeView$querySelect;
|
|
368
368
|
// Give an empty deleted column height so its diff box doesn't collapse
|
|
@@ -46,7 +46,7 @@ const getChangedContentStyleNext = (colorScheme, isActive = false, isInserted =
|
|
|
46
46
|
// Text-like blocks (heading, lists, blockquote) render their deleted content through this
|
|
47
47
|
// getter rather than `getDeletedContentStyle`, so without this they never receive the
|
|
48
48
|
// glyphTint background + underline that plain deleted text already gets.
|
|
49
|
-
if (
|
|
49
|
+
if (isExperimentEnabled('platform_editor_attributed_version_history') && colors.deletedInlineTreatment === 'glyphTint') {
|
|
50
50
|
return base + buildDeletedInlineContentStyleExtended(colors, isActive);
|
|
51
51
|
}
|
|
52
52
|
return base;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
1
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
2
3
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
4
|
import { isDiffDecoration, isDiffDecorationSpec } from './decorations/decorationKeys';
|
|
@@ -164,7 +165,7 @@ function groupTouchingDecorations(decorations, isInlineDecoration, doc) {
|
|
|
164
165
|
* 3. Deduplicates diff-block decorations with same from, to and nodeName
|
|
165
166
|
* 4. When `doc` is passed: excludes diff-inline decorations whose range has no inline content
|
|
166
167
|
* (invalid positions, or block-only slices with no text/atoms — e.g. empty blocks)
|
|
167
|
-
* 5. When `
|
|
168
|
+
* 5. When `platform_editor_attributed_version_history` is enabled, groups overlapping or
|
|
168
169
|
* directly touching ranges across decoration types into one result per contributor, using the
|
|
169
170
|
* union of all grouped ranges
|
|
170
171
|
* (zero-width widgets can join a group without extending it). Under
|
|
@@ -195,10 +196,14 @@ export const getScrollableDecorations = (set, doc) => {
|
|
|
195
196
|
if (isBlockDecoration(dec)) {
|
|
196
197
|
var _dec$spec, _dec$spec$nodeName;
|
|
197
198
|
// Skip listItem blocks as they are not scrollable
|
|
198
|
-
if (((_dec$spec = dec.spec) === null || _dec$spec === void 0 ? void 0 : _dec$spec.nodeName) === 'listItem')
|
|
199
|
+
if (((_dec$spec = dec.spec) === null || _dec$spec === void 0 ? void 0 : _dec$spec.nodeName) === 'listItem') {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
199
202
|
const key = `${dec.from}-${dec.to}-${(_dec$spec$nodeName = dec.spec.nodeName) !== null && _dec$spec$nodeName !== void 0 ? _dec$spec$nodeName : ''}`;
|
|
200
203
|
// Skip blocks that have already been seen
|
|
201
|
-
if (seenBlockKeys.has(key))
|
|
204
|
+
if (seenBlockKeys.has(key)) {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
202
207
|
seenBlockKeys.add(key);
|
|
203
208
|
}
|
|
204
209
|
return true;
|
|
@@ -210,7 +215,7 @@ export const getScrollableDecorations = (set, doc) => {
|
|
|
210
215
|
const inlines = doc !== undefined ? rawInlines.filter(d => isInlineDiffDecorationRenderableInDoc(doc, d.from, d.to)) : rawInlines;
|
|
211
216
|
const widgets = filtered.filter(isWidgetDecoration);
|
|
212
217
|
let result;
|
|
213
|
-
if (
|
|
218
|
+
if (isExperimentEnabled('platform_editor_attributed_version_history')) {
|
|
214
219
|
// Group overlapping or directly touching ranges into one customer-facing edit.
|
|
215
220
|
result = groupTouchingDecorations([...blocks, ...inlines, ...widgets], isInlineDecoration, doc);
|
|
216
221
|
} else {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
1
2
|
import { toggleExpandRange } from '@atlaskit/editor-common/expand';
|
|
2
3
|
import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
3
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
@@ -161,7 +162,7 @@ export const createPlugin = (config, getIntl, api, onEditorView) => {
|
|
|
161
162
|
activeIndexPos: activeDecoration ? {
|
|
162
163
|
from: activeDecoration.from,
|
|
163
164
|
to: activeDecoration.to,
|
|
164
|
-
...(
|
|
165
|
+
...(isExperimentEnabled('platform_editor_attributed_version_history') ? {
|
|
165
166
|
attributionKey: isDiffDecoration(activeDecoration) ? activeDecoration.spec.attributionKey : undefined
|
|
166
167
|
} : {})
|
|
167
168
|
} : undefined
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A node type's base name, with a schema variant's suffix stripped: `panel`, `panel_c1` and
|
|
@@ -15,4 +15,4 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
|
15
15
|
* For taggability only — this gate is weaker than the ones attribution needs, so resolving a variant
|
|
16
16
|
* in the styling decisions would move the legacy diff for readers who see no tags.
|
|
17
17
|
*/
|
|
18
|
-
export const resolveBaseNodeName = name =>
|
|
18
|
+
export const resolveBaseNodeName = name => isExperimentEnabled('platform_editor_attributed_version_history') ? name.split('_')[0] : name;
|
|
@@ -131,7 +131,7 @@ var isRangeActive = function isRangeActive(activeIndexPos, from, to, attribution
|
|
|
131
131
|
if (activeIndexPos === undefined) {
|
|
132
132
|
return undefined;
|
|
133
133
|
}
|
|
134
|
-
if (!
|
|
134
|
+
if (!isExperimentEnabled('platform_editor_attributed_version_history')) {
|
|
135
135
|
return from === activeIndexPos.from && to === activeIndexPos.to;
|
|
136
136
|
}
|
|
137
137
|
return from <= activeIndexPos.to && activeIndexPos.from <= to && (!('attributionKey' in activeIndexPos) || activeIndexPos.attributionKey === attributionKey);
|
|
@@ -492,7 +492,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
492
492
|
// The attribute-aware encoder is needed by the smart classifier and is gated with it.
|
|
493
493
|
// The NCS version-history path also uses it so the main diff calculation detects attribute-only
|
|
494
494
|
// node replacements, e.g. changing an emoji or mention without changing the node type.
|
|
495
|
-
var _selectTokenEncoder = selectTokenEncoder(diffType === 'smart' && fg('platform_editor_ai_smart_diff') ||
|
|
495
|
+
var _selectTokenEncoder = selectTokenEncoder(diffType === 'smart' && fg('platform_editor_ai_smart_diff') || isExperimentEnabled('platform_editor_attributed_version_history')),
|
|
496
496
|
tokenEncoder = _selectTokenEncoder.tokenEncoder,
|
|
497
497
|
shouldHideMarkOnlyDeletions = _selectTokenEncoder.shouldHideMarkOnlyDeletions;
|
|
498
498
|
var changes;
|
|
@@ -860,12 +860,12 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
860
860
|
// The attribute-aware token encoder already reports mark-only changes as regular changes in the
|
|
861
861
|
// smart path and the NCS version-history path. For NCS version history, only skip the step-range
|
|
862
862
|
// highlight if the main diff covers it or the remaining content has unchanged formatting.
|
|
863
|
-
getMarkChangeRanges(simplifiedSteps, simplifiedStepAttributions,
|
|
863
|
+
getMarkChangeRanges(simplifiedSteps, simplifiedStepAttributions, isExperimentEnabled('platform_editor_attributed_version_history') ? stepMaps : undefined).filter(function (_ref11) {
|
|
864
864
|
var fromB = _ref11.fromB,
|
|
865
865
|
toB = _ref11.toB;
|
|
866
866
|
return !isHandledByTable(fromB, toB);
|
|
867
867
|
}).filter(function (range) {
|
|
868
|
-
return !
|
|
868
|
+
return !isExperimentEnabled('platform_editor_attributed_version_history') || !changes.some(function (change) {
|
|
869
869
|
return change.fromB <= range.fromB && change.toB >= range.toB;
|
|
870
870
|
}) && hasUnhighlightedMarkChanges(range);
|
|
871
871
|
}).forEach(function (change) {
|
|
@@ -892,7 +892,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
892
892
|
var fromB = _ref13.fromB,
|
|
893
893
|
toB = _ref13.toB,
|
|
894
894
|
isInline = _ref13.isInline;
|
|
895
|
-
return !
|
|
895
|
+
return !isExperimentEnabled('platform_editor_attributed_version_history') || !isInline || !changes.some(function (change) {
|
|
896
896
|
return change.fromB === fromB && change.toB === toB;
|
|
897
897
|
});
|
|
898
898
|
}).forEach(function (change) {
|
|
@@ -313,7 +313,7 @@ var collapse = function collapse(changes) {
|
|
|
313
313
|
* Both leave ranges that only touch, so they survive the collapse.
|
|
314
314
|
*
|
|
315
315
|
* Carries no gate of its own: the only caller reaches it through the attributed changeset, which
|
|
316
|
-
* already requires `
|
|
316
|
+
* already requires `platform_editor_attributed_version_history`.
|
|
317
317
|
*/
|
|
318
318
|
export var collapseOverlappingChanges = function collapseOverlappingChanges(changes, doc) {
|
|
319
319
|
return collapse(splitContainedChanges(splitMixedIdentityChanges(changes, doc), doc));
|
|
@@ -11,7 +11,6 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
11
11
|
import { getThirdPartyAgentColor } from '@atlaskit/agent-color/get-third-party-agent-color';
|
|
12
12
|
import { getParticipantColor } from '@atlaskit/editor-shared-styles/utils';
|
|
13
13
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
14
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
15
14
|
import { DIFF_AGENT_BRANDS } from '../../../showDiffPluginType';
|
|
16
15
|
import { PARTICIPANT_COLOR_SCHEMES } from './types';
|
|
17
16
|
|
|
@@ -25,7 +24,7 @@ var HASHED_PARTICIPANT_COLOR_SCHEMES = [].concat(_toConsumableArray(PARTICIPANT_
|
|
|
25
24
|
/**
|
|
26
25
|
* Red means "deleted" in both public schemes, so it never identifies an actor. Reserving it here
|
|
27
26
|
* covers every path into an attribution colour; `createAttributionColorMap` is the only caller, and
|
|
28
|
-
* it is gated on `
|
|
27
|
+
* it is gated on `platform_editor_attributed_version_history` plus
|
|
29
28
|
* `platform_editor_show_diff_color_scheme_refactor`.
|
|
30
29
|
*/
|
|
31
30
|
var RESERVED_ATTRIBUTION_COLORS = new Set(['red']);
|
|
@@ -112,7 +111,7 @@ export var resolveContributors = function resolveContributors(contributors) {
|
|
|
112
111
|
return Object.keys(resolved).length > 0 ? resolved : undefined;
|
|
113
112
|
};
|
|
114
113
|
export var areAttributionColorGatesEnabled = function areAttributionColorGatesEnabled() {
|
|
115
|
-
return
|
|
114
|
+
return isExperimentEnabled('platform_editor_attributed_version_history') && isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor');
|
|
116
115
|
};
|
|
117
116
|
export var isAttributionColoringEnabled = function isAttributionColoringEnabled(stepAttributions) {
|
|
118
117
|
if (!areAttributionColorGatesEnabled() || !(stepAttributions !== null && stepAttributions !== void 0 && stepAttributions.length)) {
|
|
@@ -233,7 +232,7 @@ var getAttributionKeyForChanges = function getAttributionKeyForChanges(changes)
|
|
|
233
232
|
*/
|
|
234
233
|
export var getAttributionKeyForChange = function getAttributionKeyForChange(change, attributedChanges) {
|
|
235
234
|
var directKey = getAttributionKeyForChanges([change]);
|
|
236
|
-
return directKey !== null && directKey !== void 0 ? directKey :
|
|
235
|
+
return directKey !== null && directKey !== void 0 ? directKey : isExperimentEnabled('platform_editor_attributed_version_history') ? undefined : getAttributionKeyForChanges(attributedChanges.filter(function (attributedChange) {
|
|
237
236
|
return changesOverlap(change, attributedChange);
|
|
238
237
|
}));
|
|
239
238
|
};
|
|
@@ -5,6 +5,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
5
5
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
6
|
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; }
|
|
7
7
|
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; }
|
|
8
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
9
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
10
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
10
11
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
@@ -568,7 +569,7 @@ export var createInlineIndicatorAnchorWidgets = function createInlineIndicatorAn
|
|
|
568
569
|
// Gated purely so the `createAnchorSpanWidget` rewrite can be rolled back independently of the
|
|
569
570
|
// contributor-tag anchors it was extracted for: both branches build the same two widgets at the
|
|
570
571
|
// same positions. Drop the fallback with the gate.
|
|
571
|
-
if (
|
|
572
|
+
if (isExperimentEnabled('platform_editor_attributed_version_history')) {
|
|
572
573
|
return [createAnchorSpanWidget({
|
|
573
574
|
pos: fromPos,
|
|
574
575
|
diffId: diffId,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
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
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
6
|
import { ContributorTagController } from '../../ui/ContributorTag/contributorTagController';
|
|
7
7
|
import { resolveBaseNodeName } from '../utils/baseNodeName';
|
|
8
8
|
import { buildCharsByOffset, isWhitespaceChar } from '../utils/charsByOffset';
|
|
@@ -14,7 +14,7 @@ export var CONTRIBUTOR_TAG_HOST_ATTRIBUTE = 'data-contributor-tag-host';
|
|
|
14
14
|
|
|
15
15
|
// Contributor tags only render behind this gate — see `areAttributionColorGatesEnabled`.
|
|
16
16
|
export var isContributorTagWidgetEnabled = function isContributorTagWidgetEnabled() {
|
|
17
|
-
return
|
|
17
|
+
return isExperimentEnabled('platform_editor_attributed_version_history');
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -189,7 +189,7 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
189
189
|
// node renders beneath its replacement; otherwise anchor at the start (change.fromB).
|
|
190
190
|
var anchorPos = placeBelow ? change.toB : change.fromB;
|
|
191
191
|
var safeInsertPos = findSafeInsertPos(newDoc, anchorPos, slice);
|
|
192
|
-
var isActive = activeIndexPos && (
|
|
192
|
+
var isActive = activeIndexPos && (isExperimentEnabled('platform_editor_attributed_version_history') ? safeInsertPos >= activeIndexPos.from && safeInsertPos <= activeIndexPos.to && (!('attributionKey' in activeIndexPos) || activeIndexPos.attributionKey === attributionKey) : safeInsertPos === activeIndexPos.from && safeInsertPos === activeIndexPos.to);
|
|
193
193
|
if (deletedBlankLineCount > 0) {
|
|
194
194
|
// The blocks have no content to serialize, so the deletion is shown as one struck-through
|
|
195
195
|
// return glyph per line the author removed. A single widget, not one per line: the lines are
|
|
@@ -421,7 +421,7 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
421
421
|
var $sourcePos = fg('platform_editor_ai_show_diff_patch_2') ? getSourcePos(doc, $changeFromA, slice.openStart, index) : null;
|
|
422
422
|
var nodeView = serializer.tryCreateNodeView(node, 0, $sourcePos !== null && $sourcePos !== void 0 ? $sourcePos : undefined, isInserted, colorScheme);
|
|
423
423
|
if (nodeView) {
|
|
424
|
-
if (canTagWidget && contributorTagAnchorName === undefined && resolveBaseNodeName(node.type.name) === 'layoutColumn' && nodeView instanceof HTMLElement &&
|
|
424
|
+
if (canTagWidget && contributorTagAnchorName === undefined && resolveBaseNodeName(node.type.name) === 'layoutColumn' && nodeView instanceof HTMLElement && isExperimentEnabled('platform_editor_attributed_version_history')) {
|
|
425
425
|
// The deleted column is rendered inside this widget; anchor to its box.
|
|
426
426
|
contributorTagAnchorName = buildAnchorDecorationKey({
|
|
427
427
|
diffId: diffId,
|
|
@@ -544,7 +544,7 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
544
544
|
})));
|
|
545
545
|
// `dom` is inline, so its box fragments across a line wrap and `anchor()` resolves to the
|
|
546
546
|
// wrong edge. The tag anchors to its own point marker instead (EDITOR-9286).
|
|
547
|
-
if (
|
|
547
|
+
if (isExperimentEnabled('platform_editor_attributed_version_history') && !contributorTagAnchorName) {
|
|
548
548
|
var tagPointAnchorName = buildAnchorDecorationKey({
|
|
549
549
|
diffId: diffId,
|
|
550
550
|
anchorType: AnchorTypeKey.tag
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
8
8
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
9
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
10
|
-
import {
|
|
10
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
11
11
|
import { resolveBaseNodeName } from '../utils/baseNodeName';
|
|
12
12
|
import { isTaggableBlockNodeName } from '../utils/taggableBlockNodes';
|
|
13
13
|
import { isDiffDecoration, isDiffDecorationSpec } from './decorationKeys';
|
|
@@ -40,7 +40,7 @@ var isSameChange = function isSameChange(widget, inline) {
|
|
|
40
40
|
* `inlineDeletedDiffPlacement: 'after'`, where the inline half leads instead.
|
|
41
41
|
*/
|
|
42
42
|
var leadsReplacement = function leadsReplacement(widget) {
|
|
43
|
-
return
|
|
43
|
+
return isExperimentEnabled('platform_editor_attributed_version_history') && widget.spec.side === -1;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -76,7 +76,7 @@ var byLeadingPosition = function byLeadingPosition(a, b) {
|
|
|
76
76
|
/** Select the first layout column only when the inline layout range starts immediately before it. */
|
|
77
77
|
var navigationLeader = function navigationLeader(members) {
|
|
78
78
|
var ordered = _toConsumableArray(members).sort(byLeadingPosition);
|
|
79
|
-
var layoutColumn =
|
|
79
|
+
var layoutColumn = isExperimentEnabled('platform_editor_attributed_version_history') ? ordered.find(function (_ref2) {
|
|
80
80
|
var _decoration$spec$node;
|
|
81
81
|
var decoration = _ref2.decoration;
|
|
82
82
|
return decoration.spec.decorationType === 'block' && resolveBaseNodeName((_decoration$spec$node = decoration.spec.nodeName) !== null && _decoration$spec$node !== void 0 ? _decoration$spec$node : '') === 'layoutColumn';
|
|
@@ -118,7 +118,7 @@ var owningStop = function owningStop(target, stops) {
|
|
|
118
118
|
*/
|
|
119
119
|
var resolveActiveTarget = function resolveActiveTarget(surviving, activeIndexPos) {
|
|
120
120
|
return containedBy(surviving, activeIndexPos).find(function (target) {
|
|
121
|
-
return !
|
|
121
|
+
return !isExperimentEnabled('platform_editor_attributed_version_history') || !('attributionKey' in activeIndexPos) || target.decoration.spec.attributionKey === activeIndexPos.attributionKey;
|
|
122
122
|
});
|
|
123
123
|
};
|
|
124
124
|
|
|
@@ -247,7 +247,7 @@ export var extractContributorTags = function extractContributorTags(decorations,
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
// A nested block folds into the outermost one of the same contributor, so nesting adds no tags.
|
|
250
|
-
if (
|
|
250
|
+
if (isExperimentEnabled('platform_editor_attributed_version_history')) {
|
|
251
251
|
var blocksByContributor = new Map();
|
|
252
252
|
var _iterator2 = _createForOfIteratorHelper(blockTargets),
|
|
253
253
|
_step2;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Single source of truth for which attributes of a node type represent a
|
|
@@ -91,8 +91,8 @@ export var getRequiredIncludedDiffableAttrs = function getRequiredIncludedDiffab
|
|
|
91
91
|
*/
|
|
92
92
|
export var getDiffableAttrNames = function getDiffableAttrNames(nodeTypeName, attrs) {
|
|
93
93
|
// Adding a column updates existing widths, ignore this attribute change. Move this into
|
|
94
|
-
// DIFFABLE_ATTRS_BY_NODE_TYPE when cleaning up
|
|
95
|
-
var ignoreColumnWidth = nodeTypeName === 'layoutColumn' &&
|
|
94
|
+
// DIFFABLE_ATTRS_BY_NODE_TYPE when cleaning up platform_editor_attributed_version_history
|
|
95
|
+
var ignoreColumnWidth = nodeTypeName === 'layoutColumn' && isExperimentEnabled('platform_editor_attributed_version_history');
|
|
96
96
|
var rule = DIFFABLE_ATTRS_BY_NODE_TYPE[nodeTypeName];
|
|
97
97
|
if (!rule) {
|
|
98
98
|
return Object.keys(attrs).filter(function (name) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
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
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
5
|
import isEqual from 'lodash/isEqual';
|
|
5
6
|
import omit from 'lodash/omit';
|
|
6
7
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps/set-attrs';
|
|
7
8
|
import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-utils';
|
|
8
9
|
import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
10
|
import { getRequiredIncludedDiffableAttrs, isDiffableAttr } from './diffableAttrs';
|
|
11
11
|
import { getComparableExcerptIncludeAttrs, getReferencedContentId, isExcerptInclude } from './excerptIncludeAttrs';
|
|
12
12
|
var filterUndefined = function filterUndefined(x) {
|
|
@@ -85,7 +85,7 @@ export var getAttrChangeRanges = function getAttrChangeRanges(doc, attrStepConte
|
|
|
85
85
|
var originalNodeAtPos = originalPos === undefined ? null : originalDoc.nodeAt(originalPos);
|
|
86
86
|
var hasChangedAttr = function hasChangedAttr(watchedAttrs) {
|
|
87
87
|
return attrsToCheck.some(function (attr) {
|
|
88
|
-
return watchedAttrs.includes(attr) && (!
|
|
88
|
+
return watchedAttrs.includes(attr) && (!isExperimentEnabled('platform_editor_attributed_version_history') || !originalNodeAtPos || originalNodeAtPos.type !== (nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.type) || !isEqual(originalNodeAtPos.attrs[attr], nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.attrs[attr]));
|
|
89
89
|
});
|
|
90
90
|
};
|
|
91
91
|
|
|
@@ -175,7 +175,7 @@ export var getAttrChangeRanges = function getAttrChangeRanges(doc, attrStepConte
|
|
|
175
175
|
// (e.g. setNodeAttribute(pos, 'text', ...) + setNodeAttribute(pos, 'color', ...))
|
|
176
176
|
// should produce only one decoration, not one per step.
|
|
177
177
|
.filter(function (range, i, arr) {
|
|
178
|
-
return
|
|
178
|
+
return isExperimentEnabled('platform_editor_attributed_version_history') ? !arr.some(function (r, nextIndex) {
|
|
179
179
|
return nextIndex > i && r.fromB === range.fromB;
|
|
180
180
|
}) : arr.findIndex(function (r) {
|
|
181
181
|
return r.fromB === range.fromB;
|
|
@@ -367,7 +367,7 @@ var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref9
|
|
|
367
367
|
// should not also get the inline content style (borderBottom underline) on their container.
|
|
368
368
|
var shouldSkipContentStyle = isInserted && nodeStyle !== undefined;
|
|
369
369
|
var contentStyle = shouldSkipContentStyle ? '' : getChangedContentStyle(colorScheme, isActive, isInserted, hideAddedDiffsUnderline);
|
|
370
|
-
var isEmptyDeletedLayoutColumn = !isInserted && resolveBaseNodeName(targetNode.type.name) === 'layoutColumn' && targetNode.textContent.length === 0 &&
|
|
370
|
+
var isEmptyDeletedLayoutColumn = !isInserted && resolveBaseNodeName(targetNode.type.name) === 'layoutColumn' && targetNode.textContent.length === 0 && isExperimentEnabled('platform_editor_attributed_version_history');
|
|
371
371
|
if (isEmptyDeletedLayoutColumn && nodeView instanceof HTMLElement) {
|
|
372
372
|
var _nodeView$querySelect;
|
|
373
373
|
// Give an empty deleted column height so its diff box doesn't collapse
|
|
@@ -54,7 +54,7 @@ var getChangedContentStyleNext = function getChangedContentStyleNext(colorScheme
|
|
|
54
54
|
// Text-like blocks (heading, lists, blockquote) render their deleted content through this
|
|
55
55
|
// getter rather than `getDeletedContentStyle`, so without this they never receive the
|
|
56
56
|
// glyphTint background + underline that plain deleted text already gets.
|
|
57
|
-
if (
|
|
57
|
+
if (isExperimentEnabled('platform_editor_attributed_version_history') && colors.deletedInlineTreatment === 'glyphTint') {
|
|
58
58
|
return base + buildDeletedInlineContentStyleExtended(colors, isActive);
|
|
59
59
|
}
|
|
60
60
|
return base;
|
|
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
5
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
6
7
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
8
|
import { isDiffDecoration, isDiffDecorationSpec } from './decorations/decorationKeys';
|
|
@@ -183,7 +184,7 @@ function groupTouchingDecorations(decorations, isInlineDecoration, doc) {
|
|
|
183
184
|
* 3. Deduplicates diff-block decorations with same from, to and nodeName
|
|
184
185
|
* 4. When `doc` is passed: excludes diff-inline decorations whose range has no inline content
|
|
185
186
|
* (invalid positions, or block-only slices with no text/atoms — e.g. empty blocks)
|
|
186
|
-
* 5. When `
|
|
187
|
+
* 5. When `platform_editor_attributed_version_history` is enabled, groups overlapping or
|
|
187
188
|
* directly touching ranges across decoration types into one result per contributor, using the
|
|
188
189
|
* union of all grouped ranges
|
|
189
190
|
* (zero-width widgets can join a group without extending it). Under
|
|
@@ -220,10 +221,14 @@ export var getScrollableDecorations = function getScrollableDecorations(set, doc
|
|
|
220
221
|
if (isBlockDecoration(dec)) {
|
|
221
222
|
var _dec$spec, _dec$spec$nodeName;
|
|
222
223
|
// Skip listItem blocks as they are not scrollable
|
|
223
|
-
if (((_dec$spec = dec.spec) === null || _dec$spec === void 0 ? void 0 : _dec$spec.nodeName) === 'listItem')
|
|
224
|
+
if (((_dec$spec = dec.spec) === null || _dec$spec === void 0 ? void 0 : _dec$spec.nodeName) === 'listItem') {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
224
227
|
var key = "".concat(dec.from, "-").concat(dec.to, "-").concat((_dec$spec$nodeName = dec.spec.nodeName) !== null && _dec$spec$nodeName !== void 0 ? _dec$spec$nodeName : '');
|
|
225
228
|
// Skip blocks that have already been seen
|
|
226
|
-
if (seenBlockKeys.has(key))
|
|
229
|
+
if (seenBlockKeys.has(key)) {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
227
232
|
seenBlockKeys.add(key);
|
|
228
233
|
}
|
|
229
234
|
return true;
|
|
@@ -237,7 +242,7 @@ export var getScrollableDecorations = function getScrollableDecorations(set, doc
|
|
|
237
242
|
}) : rawInlines;
|
|
238
243
|
var widgets = filtered.filter(isWidgetDecoration);
|
|
239
244
|
var result;
|
|
240
|
-
if (
|
|
245
|
+
if (isExperimentEnabled('platform_editor_attributed_version_history')) {
|
|
241
246
|
// Group overlapping or directly touching ranges into one customer-facing edit.
|
|
242
247
|
result = groupTouchingDecorations([].concat(_toConsumableArray(blocks), _toConsumableArray(inlines), _toConsumableArray(widgets)), isInlineDecoration, doc);
|
|
243
248
|
} else {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
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
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
5
|
import { toggleExpandRange } from '@atlaskit/editor-common/expand';
|
|
5
6
|
import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
6
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
@@ -160,7 +161,7 @@ export var createPlugin = function createPlugin(config, getIntl, api, onEditorVi
|
|
|
160
161
|
activeIndexPos: activeDecoration ? _objectSpread({
|
|
161
162
|
from: activeDecoration.from,
|
|
162
163
|
to: activeDecoration.to
|
|
163
|
-
},
|
|
164
|
+
}, isExperimentEnabled('platform_editor_attributed_version_history') ? {
|
|
164
165
|
attributionKey: isDiffDecoration(activeDecoration) ? activeDecoration.spec.attributionKey : undefined
|
|
165
166
|
} : {}) : undefined
|
|
166
167
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A node type's base name, with a schema variant's suffix stripped: `panel`, `panel_c1` and
|
|
@@ -16,5 +16,5 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
|
16
16
|
* in the styling decisions would move the legacy diff for readers who see no tags.
|
|
17
17
|
*/
|
|
18
18
|
export var resolveBaseNodeName = function resolveBaseNodeName(name) {
|
|
19
|
-
return
|
|
19
|
+
return isExperimentEnabled('platform_editor_attributed_version_history') ? name.split('_')[0] : name;
|
|
20
20
|
};
|
|
@@ -25,7 +25,7 @@ export type AttributedChange = Change & {
|
|
|
25
25
|
* Both leave ranges that only touch, so they survive the collapse.
|
|
26
26
|
*
|
|
27
27
|
* Carries no gate of its own: the only caller reaches it through the attributed changeset, which
|
|
28
|
-
* already requires `
|
|
28
|
+
* already requires `platform_editor_attributed_version_history`.
|
|
29
29
|
*/
|
|
30
30
|
export declare const collapseOverlappingChanges: (changes: Change[], doc?: PMNode) => AttributedChange[];
|
|
31
31
|
/**
|
|
@@ -16,7 +16,7 @@ export declare function isInlineDiffDecorationRenderableInDoc(doc: PMNode, from:
|
|
|
16
16
|
* 3. Deduplicates diff-block decorations with same from, to and nodeName
|
|
17
17
|
* 4. When `doc` is passed: excludes diff-inline decorations whose range has no inline content
|
|
18
18
|
* (invalid positions, or block-only slices with no text/atoms — e.g. empty blocks)
|
|
19
|
-
* 5. When `
|
|
19
|
+
* 5. When `platform_editor_attributed_version_history` is enabled, groups overlapping or
|
|
20
20
|
* directly touching ranges across decoration types into one result per contributor, using the
|
|
21
21
|
* union of all grouped ranges
|
|
22
22
|
* (zero-width widgets can join a group without extending it). Under
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "30.0.
|
|
3
|
+
"version": "30.0.9",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"@atlaskit/editor-plugin-limited-mode": "^27.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-user-intent": "^28.0.0",
|
|
36
36
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
37
|
-
"@atlaskit/editor-shared-styles": "^5.
|
|
37
|
+
"@atlaskit/editor-shared-styles": "^5.1.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.6.0",
|
|
42
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
42
|
+
"@atlaskit/tmp-editor-statsig": "^258.0.0",
|
|
43
43
|
"@atlaskit/tokens": "^20.9.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@compiled/react": "^1.0.2",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@atlassian/confluence-presets": "workspace:^",
|
|
66
66
|
"@atlassian/content-reconciliation": "^0.1.3506",
|
|
67
67
|
"@atlassian/editor-ai-injected-editors": "^46.0.0",
|
|
68
|
-
"@atlassian/editor-plugin-ai": "^84.
|
|
68
|
+
"@atlassian/editor-plugin-ai": "^84.6.0",
|
|
69
69
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
70
70
|
"react": "^19.2.0",
|
|
71
71
|
"react-dom": "^19.2.0",
|
|
@@ -97,9 +97,6 @@
|
|
|
97
97
|
"platform_editor_ai_suggested_edits_smart_diff": {
|
|
98
98
|
"type": "boolean",
|
|
99
99
|
"referenceOnly": true
|
|
100
|
-
},
|
|
101
|
-
"confluence_ncs_step_diffing_version_history": {
|
|
102
|
-
"type": "boolean"
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
102
|
}
|