@atlaskit/editor-plugin-show-diff 25.0.5 → 25.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/cjs/pm-plugins/NodeViewSerializer.js +2 -1
- package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +17 -3
- package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +5 -1
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +2 -1
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +42 -3
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +26 -5
- package/dist/cjs/pm-plugins/getScrollableDecorations.js +23 -1
- package/dist/cjs/pm-plugins/resolveDiffContributors.js +5 -5
- package/dist/cjs/showDiffPluginType.js +1 -1
- package/dist/cjs/ui/ContributorTag/buildContributorTagDom.js +2 -2
- package/dist/es2019/pm-plugins/NodeViewSerializer.js +2 -1
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +16 -2
- package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +4 -0
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +3 -2
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +42 -3
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +26 -5
- package/dist/es2019/pm-plugins/getScrollableDecorations.js +16 -1
- package/dist/es2019/pm-plugins/resolveDiffContributors.js +5 -5
- package/dist/es2019/showDiffPluginType.js +1 -1
- package/dist/es2019/ui/ContributorTag/buildContributorTagDom.js +2 -2
- package/dist/esm/pm-plugins/NodeViewSerializer.js +2 -1
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +16 -3
- package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +4 -0
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +3 -2
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +42 -3
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +26 -5
- package/dist/esm/pm-plugins/getScrollableDecorations.js +23 -1
- package/dist/esm/pm-plugins/resolveDiffContributors.js +5 -5
- package/dist/esm/showDiffPluginType.js +1 -1
- package/dist/esm/ui/ContributorTag/buildContributorTagDom.js +2 -2
- package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +5 -0
- package/dist/types/pm-plugins/decorations/colorSchemes/standard.d.ts +1 -0
- package/dist/types/showDiffPluginType.d.ts +1 -1
- package/dist/types/ui/ContributorTag/buildContributorTagDom.d.ts +2 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 25.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`4704b3ac83f88`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4704b3ac83f88) -
|
|
8
|
+
Treat Antigravity and Copilot as third-party agent brands in show-diff contributor tags, sharing
|
|
9
|
+
the fixed third-party participant colour slot, and render their profile avatar when one is
|
|
10
|
+
available (falling back to the generic agent icon). Shorten the contributor tag fade in and out
|
|
11
|
+
from 600ms to 500ms.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`ef028efae290d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ef028efae290d) -
|
|
16
|
+
Prevent nested deleted list content from accumulating opacity while preserving its 0.8 treatment
|
|
17
|
+
behind the `platform_editor_ai_show_diff_patch_2` feature gate.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
20
|
+
## 25.0.6
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [`8843fc489d5a6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8843fc489d5a6) -
|
|
25
|
+
EDITOR-9591 Behind platform_editor_ai_show_diff_patch_2, highlight inserted inline nodes as a
|
|
26
|
+
whole instead of the text inside them, and only outline an inserted atomic inline node (date,
|
|
27
|
+
emoji, mention, status) when its attributes are the only change
|
|
28
|
+
(platform_editor_show_diff_deleted_nodeview_content)
|
|
29
|
+
- Updated dependencies
|
|
30
|
+
|
|
3
31
|
## 25.0.5
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -112,7 +112,8 @@ var NodeViewSerializer = exports.NodeViewSerializer = /*#__PURE__*/function () {
|
|
|
112
112
|
if (childNode) {
|
|
113
113
|
// Give inserted atomic children the same box-shadow
|
|
114
114
|
// highlight an in-place attribute change already gets (`getAtomicInlineChangedAttrs`).
|
|
115
|
-
|
|
115
|
+
// Disabled under patch_2: the outline also landed on atomic children inserted alongside text.
|
|
116
|
+
if (isInserted && !(0, _fg.fg)('platform_editor_ai_show_diff_patch_2') && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_deleted_nodeview_content') && (0, _getAttrChangeRanges.isInlineAttrChangeNodeName)(child.type.name) && childNode instanceof HTMLElement) {
|
|
116
117
|
var _getAtomicInlineChang = (0, _createInlineChangedDecoration.getAtomicInlineChangedAttrs)(child.type.name, colorScheme),
|
|
117
118
|
className = _getAtomicInlineChang.className,
|
|
118
119
|
styleSuffix = _getAtomicInlineChang.styleSuffix;
|
|
@@ -33,6 +33,7 @@ exports.buildDeletedInlineNodeCSSVariables = buildDeletedInlineNodeCSSVariables;
|
|
|
33
33
|
exports.buildDeletedInlineStyle = buildDeletedInlineStyle;
|
|
34
34
|
exports.buildDeletedInlineStyleStandard = buildDeletedInlineStyleStandard;
|
|
35
35
|
exports.buildDeletedInlineStyleUnbounded = buildDeletedInlineStyleUnbounded;
|
|
36
|
+
exports.buildDeletedListItemMarkerVariable = buildDeletedListItemMarkerVariable;
|
|
36
37
|
exports.buildDeletedLozengeActiveStyle = buildDeletedLozengeActiveStyle;
|
|
37
38
|
exports.buildDeletedLozengeStyle = buildDeletedLozengeStyle;
|
|
38
39
|
exports.buildDeletedNodeCSSVariables = buildDeletedNodeCSSVariables;
|
|
@@ -732,6 +733,14 @@ function buildDeletedDecorationMarkerVariableSimple(colors) {
|
|
|
732
733
|
});
|
|
733
734
|
}
|
|
734
735
|
|
|
736
|
+
/** Marker and direct-content variables for deleted list items. */
|
|
737
|
+
function buildDeletedListItemMarkerVariable(colors) {
|
|
738
|
+
return (0, _cssHelper.convertToInlineCss)({
|
|
739
|
+
'--diff-decoration-content-opacity': '0.8',
|
|
740
|
+
'--diff-decoration-marker-color': borderAccent(colors.deleteColor)
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
|
|
735
744
|
/** Whether the emphasised state is stated in the bottom border rather than a deeper highlight. */
|
|
736
745
|
function usesUnderlineEmphasis(colors) {
|
|
737
746
|
return colors.deletedInlineActiveEmphasis === 'underline';
|
|
@@ -1121,7 +1130,7 @@ function buildDeletedBlockNodeStyle(colors, category, isActive) {
|
|
|
1121
1130
|
case 'container':
|
|
1122
1131
|
return isStrikethrough ? buildDeletedInlineStyle(colors, false) : buildDeletedDecorationMarkerVariableSimple(colors);
|
|
1123
1132
|
case 'listItem':
|
|
1124
|
-
return colors.deletedNodeEmphasis === 'stateful' ? statefulMarker() : buildDeletedDecorationMarkerVariableSimple(colors);
|
|
1133
|
+
return colors.deletedNodeEmphasis === 'stateful' ? statefulMarker() : (0, _fg.fg)('platform_editor_ai_show_diff_patch_2') ? buildDeletedListItemMarkerVariable(colors) : buildDeletedDecorationMarkerVariableSimple(colors);
|
|
1125
1134
|
case 'marker':
|
|
1126
1135
|
return colors.deletedNodeEmphasis === 'stateful' ? statefulMarker() : buildDeletedInlineStyleStandard(colors, 'new');
|
|
1127
1136
|
case 'generic':
|
|
@@ -1164,11 +1173,16 @@ function buildDeletedWrappedBlockOutline(colors, _ref) {
|
|
|
1164
1173
|
* decoration span and read by the `.show-diff-atomic-inline-changed-*` selectors in
|
|
1165
1174
|
* EditorContentContainer, on the decorated element or a descendant, so it must inherit. Being
|
|
1166
1175
|
* inline it beats the stylesheet's fallback, making the plugin the only source of the colour.
|
|
1176
|
+
*
|
|
1177
|
+
* Under patch_2 it also reserves the 2px ring either side, since the ring takes up no space and
|
|
1178
|
+
* otherwise paints over an adjacent inline diff.
|
|
1167
1179
|
*/
|
|
1168
1180
|
function buildAtomicInlineChangedCSSVariables(colors) {
|
|
1169
|
-
return (0, _cssHelper.convertToInlineCss)({
|
|
1181
|
+
return (0, _cssHelper.convertToInlineCss)(_objectSpread({
|
|
1170
1182
|
'--show-diff-atomic-inline-changed-border-color': borderAccent(colors.insertColor)
|
|
1171
|
-
})
|
|
1183
|
+
}, (0, _fg.fg)('platform_editor_ai_show_diff_patch_2') && {
|
|
1184
|
+
marginInline: "var(--ds-space-025, 2px)"
|
|
1185
|
+
}));
|
|
1172
1186
|
}
|
|
1173
1187
|
|
|
1174
1188
|
/** Hands editor-core the same strike line the widget path uses, via a custom property. */
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.standardDecorationMarkerVariable = exports.getStandardDeletedRowStyle = exports.getStandardDeletedContentStyleNew = exports.getStandardDeletedContentStyleActive = exports.getStandardDeletedContentStyle = exports.editingStyleRuleNode = exports.editingStyleQuoteNode = exports.editingStyleNode = exports.editingStyleExtendedNoUnderline = exports.editingStyleExtended = exports.editingStyleCardBlockNode = exports.editingStyleActiveExtendedNoUnderline = exports.editingStyleActiveExtended = exports.editingContentStyleInBlockExtendedNoUnderline = exports.editingContentStyleInBlockExtended = exports.deletedStyleQuoteNodeWithLozengeActive = exports.deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNode = exports.deletedInlineContentStyleExtended = exports.deletedDecorationMarkerVariable = exports.deletedContentStyleUnbounded = exports.deletedCellOverlayStyle = exports.deletedCellOverlayRoundedStyle = exports.deletedBlockOutlineRoundedActive = exports.deletedBlockOutlineRounded = exports.deletedBlockOutlineActive = exports.deletedBlockOutline = exports.addedCellOverlayStyle = exports.addedCellOverlayRoundedStyle = void 0;
|
|
7
|
+
exports.standardDecorationMarkerVariable = exports.getStandardDeletedRowStyle = exports.getStandardDeletedContentStyleNew = exports.getStandardDeletedContentStyleActive = exports.getStandardDeletedContentStyle = exports.editingStyleRuleNode = exports.editingStyleQuoteNode = exports.editingStyleNode = exports.editingStyleExtendedNoUnderline = exports.editingStyleExtended = exports.editingStyleCardBlockNode = exports.editingStyleActiveExtendedNoUnderline = exports.editingStyleActiveExtended = exports.editingContentStyleInBlockExtendedNoUnderline = exports.editingContentStyleInBlockExtended = exports.deletedStyleQuoteNodeWithLozengeActive = exports.deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNode = exports.deletedListItemMarkerVariable = exports.deletedInlineContentStyleExtended = exports.deletedDecorationMarkerVariable = exports.deletedContentStyleUnbounded = exports.deletedCellOverlayStyle = exports.deletedCellOverlayRoundedStyle = exports.deletedBlockOutlineRoundedActive = exports.deletedBlockOutlineRounded = exports.deletedBlockOutlineActive = exports.deletedBlockOutline = exports.addedCellOverlayStyle = exports.addedCellOverlayRoundedStyle = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _cssHelper = require("@atlaskit/editor-common/css-helper");
|
|
10
10
|
var _getStandardDeletedTextDecorationStyle = require("./getStandardDeletedTextDecorationStyle");
|
|
@@ -153,6 +153,10 @@ var deletedDecorationMarkerVariable = exports.deletedDecorationMarkerVariable =
|
|
|
153
153
|
'--diff-decoration-marker-ring-width': '1px',
|
|
154
154
|
opacity: 0.8
|
|
155
155
|
});
|
|
156
|
+
var deletedListItemMarkerVariable = exports.deletedListItemMarkerVariable = (0, _cssHelper.convertToInlineCss)({
|
|
157
|
+
'--diff-decoration-content-opacity': '0.8',
|
|
158
|
+
'--diff-decoration-marker-color': "var(--ds-border-accent-gray, #7D818A)"
|
|
159
|
+
});
|
|
156
160
|
var addedCellOverlayStyle = exports.addedCellOverlayStyle = (0, _cssHelper.convertToInlineCss)({
|
|
157
161
|
position: 'absolute',
|
|
158
162
|
top: 0,
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.resolveCellOverlayStyleLegacy = exports.getBlockNodeStyleLegacy = void 0;
|
|
7
7
|
var _cssHelper = require("@atlaskit/editor-common/css-helper");
|
|
8
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
8
9
|
var _standard = require("./colorSchemes/standard");
|
|
9
10
|
var _traditional = require("./colorSchemes/traditional");
|
|
10
11
|
/**
|
|
@@ -63,7 +64,7 @@ var getBlockNodeStyleLegacy = exports.getBlockNodeStyleLegacy = function getBloc
|
|
|
63
64
|
return isTraditional && isActive ? _traditional.traditionalDecorationMarkerVariableActive : isTraditional ? _traditional.traditionalDecorationMarkerVariableNew : _standard.standardDecorationMarkerVariable;
|
|
64
65
|
}
|
|
65
66
|
if (nodeName === 'listItem') {
|
|
66
|
-
return isTraditional && isActive ? _traditional.traditionalDeletedDecorationMarkerVariableActive : isTraditional ? _traditional.traditionalDeletedDecorationMarkerVariableNew : _standard.deletedDecorationMarkerVariable;
|
|
67
|
+
return isTraditional && isActive ? _traditional.traditionalDeletedDecorationMarkerVariableActive : isTraditional ? _traditional.traditionalDeletedDecorationMarkerVariableNew : (0, _fg.fg)('platform_editor_ai_show_diff_patch_2') ? _standard.deletedListItemMarkerVariable : _standard.deletedDecorationMarkerVariable;
|
|
67
68
|
}
|
|
68
69
|
return isTraditional && isActive ? _traditional.traditionalDeletedDecorationMarkerVariableActive : isTraditional ? _traditional.traditionalDeletedDecorationMarkerVariableNew : (0, _standard.getStandardDeletedContentStyleNew)();
|
|
69
70
|
}
|
|
@@ -7,19 +7,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createNodeChangedDecorationWidget = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
10
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
10
11
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
11
12
|
var _baseNodeName = require("../utils/baseNodeName");
|
|
12
13
|
var _emptyTextBlocks = require("../utils/emptyTextBlocks");
|
|
13
14
|
var _isEmptyParagraphSlice = require("../utils/isEmptyParagraphSlice");
|
|
15
|
+
var _factory = require("./colorSchemes/factory");
|
|
16
|
+
var _schemes = require("./colorSchemes/schemes");
|
|
14
17
|
var _createAnchorDecorationWidgets = require("./createAnchorDecorationWidgets");
|
|
15
18
|
var _createChangedRowDecorationWidgets = require("./createChangedRowDecorationWidgets");
|
|
16
19
|
var _createContributorTagWidget = require("./createContributorTagWidget");
|
|
20
|
+
var _createInlineChangedDecoration = require("./createInlineChangedDecoration");
|
|
17
21
|
var _decorationKeys = require("./decorationKeys");
|
|
18
22
|
var _absorbFirstChildMarginReset = require("./utils/absorbFirstChildMarginReset");
|
|
19
23
|
var _createDeletedLineBreakWidget = require("./utils/createDeletedLineBreakWidget");
|
|
20
24
|
var _createMarginAbsorber = require("./utils/createMarginAbsorber");
|
|
21
25
|
var _createNodeShapedMarginSpacer = require("./utils/createNodeShapedMarginSpacer");
|
|
22
26
|
var _findSafeInsertPos = require("./utils/findSafeInsertPos");
|
|
27
|
+
var _getAttrChangeRanges = require("./utils/getAttrChangeRanges");
|
|
23
28
|
var _safeResolve = require("./utils/safeResolve");
|
|
24
29
|
var _tableDiffMode = require("./utils/tableDiffMode");
|
|
25
30
|
var _wrapBlockNodeView = require("./utils/wrapBlockNodeView");
|
|
@@ -120,6 +125,32 @@ var createTableCellContentWidgets = function createTableCellContentWidgets(_ref)
|
|
|
120
125
|
return decorations;
|
|
121
126
|
};
|
|
122
127
|
|
|
128
|
+
/**
|
|
129
|
+
* The node name when `change` only swapped one atomic inline node (date, emoji, mention, status)
|
|
130
|
+
* for another of the same type, i.e. an attribute change rather than content added or removed
|
|
131
|
+
* around it.
|
|
132
|
+
*/
|
|
133
|
+
var getAtomicInlineAttrOnlyNodeName = function getAtomicInlineAttrOnlyNodeName(change, doc, newDoc) {
|
|
134
|
+
var nodeA = doc.nodeAt(change.fromA);
|
|
135
|
+
var nodeB = newDoc.nodeAt(change.fromB);
|
|
136
|
+
if (!nodeA || !nodeB || nodeA.type !== nodeB.type || nodeA.nodeSize !== change.toA - change.fromA || nodeB.nodeSize !== change.toB - change.fromB) {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
var nodeName = nodeA.type.name;
|
|
140
|
+
return (0, _getAttrChangeRanges.isInlineAttrChangeNodeName)(nodeName) ? nodeName : undefined;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/** Wraps an inserted atomic inline node view in the outline an in-place attribute change gets. */
|
|
144
|
+
var createAtomicInlineOutline = function createAtomicInlineOutline(nodeName, nodeView, colorScheme) {
|
|
145
|
+
var outlineWrapper = document.createElement('span');
|
|
146
|
+
outlineWrapper.className = (0, _createInlineChangedDecoration.getAtomicInlineChangedAttrs)(nodeName, colorScheme).className;
|
|
147
|
+
// Set in both cohorts of `platform_editor_show_diff_color_scheme_refactor`: being inline it beats
|
|
148
|
+
// the stylesheet's purple/green table, so editor-core's rings follow the change's scheme too.
|
|
149
|
+
outlineWrapper.setAttribute('style', (0, _factory.buildAtomicInlineChangedCSSVariables)(_schemes.colorSchemeRegistry[colorScheme !== null && colorScheme !== void 0 ? colorScheme : 'standard']));
|
|
150
|
+
outlineWrapper.append(nodeView);
|
|
151
|
+
return outlineWrapper;
|
|
152
|
+
};
|
|
153
|
+
|
|
123
154
|
/**
|
|
124
155
|
* This function is used to create a decoration widget to show content
|
|
125
156
|
* that is not in the current document.
|
|
@@ -391,9 +422,17 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
391
422
|
nodeView.style.setProperty('anchor-name', "--".concat(contributorTagAnchorName));
|
|
392
423
|
}
|
|
393
424
|
if (node.isInline) {
|
|
394
|
-
var
|
|
395
|
-
|
|
396
|
-
|
|
425
|
+
var attrOnlyNodeName = isInserted && (0, _fg.fg)('platform_editor_ai_show_diff_patch_2') && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_deleted_nodeview_content') ? getAtomicInlineAttrOnlyNodeName(change, doc, newDoc) : undefined;
|
|
426
|
+
if (attrOnlyNodeName) {
|
|
427
|
+
// Only the node's attributes changed, so outline it as an in-place attribute change
|
|
428
|
+
// does, in place of the highlight. Its own wrapper keeps the outline clear of the node
|
|
429
|
+
// view's styles.
|
|
430
|
+
dom.append(createAtomicInlineOutline(attrOnlyNodeName, nodeView, colorScheme));
|
|
431
|
+
} else {
|
|
432
|
+
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted, reveal);
|
|
433
|
+
wrapper.append(nodeView);
|
|
434
|
+
dom.append(wrapper);
|
|
435
|
+
}
|
|
397
436
|
} else {
|
|
398
437
|
// Handle all block nodes with unified function
|
|
399
438
|
(0, _wrapBlockNodeView.wrapBlockNodeView)({
|
|
@@ -294,7 +294,28 @@ var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref8)
|
|
|
294
294
|
element.setAttribute('style', "".concat(currentStyle).concat(nodeSpecificStyle));
|
|
295
295
|
}
|
|
296
296
|
var contentStyle = (0, _wrapBlockNodeViewStyles.getChangedContentStyle)(colorScheme, isActive, isInserted, hideAddedDiffsUnderline);
|
|
297
|
-
|
|
297
|
+
|
|
298
|
+
// Under patch_2, an inserted inline node view (a date, a status lozenge) is highlighted as a whole
|
|
299
|
+
// rather than the text inside it, so the highlight sits behind the node. Rejecting it skips its
|
|
300
|
+
// subtree, so this stays a single walk.
|
|
301
|
+
var highlightInlineNodesWhole = isInserted && (0, _fg.fg)('platform_editor_ai_show_diff_patch_2');
|
|
302
|
+
// `applyInlineLeafNodeStyles` styles the block's direct inline children itself.
|
|
303
|
+
var handlesDirectInlineChildren = highlightInlineLeafNodes && targetNode.type.inlineContent;
|
|
304
|
+
var inlineNodesToWrap = [];
|
|
305
|
+
var walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT, {
|
|
306
|
+
acceptNode: function acceptNode(node) {
|
|
307
|
+
if (node instanceof Text) {
|
|
308
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
309
|
+
}
|
|
310
|
+
if (highlightInlineNodesWhole && node instanceof HTMLElement && node.dataset.prosemirrorNodeInline === 'true') {
|
|
311
|
+
if (!(handlesDirectInlineChildren && node.parentElement === element)) {
|
|
312
|
+
inlineNodesToWrap.push(node);
|
|
313
|
+
}
|
|
314
|
+
return NodeFilter.FILTER_REJECT;
|
|
315
|
+
}
|
|
316
|
+
return NodeFilter.FILTER_SKIP;
|
|
317
|
+
}
|
|
318
|
+
});
|
|
298
319
|
var textNodesToWrap = [];
|
|
299
320
|
var currentNode = walker.nextNode();
|
|
300
321
|
while (currentNode) {
|
|
@@ -303,13 +324,13 @@ var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref8)
|
|
|
303
324
|
}
|
|
304
325
|
currentNode = walker.nextNode();
|
|
305
326
|
}
|
|
306
|
-
textNodesToWrap.forEach(function (
|
|
327
|
+
[].concat(textNodesToWrap, inlineNodesToWrap).forEach(function (node) {
|
|
307
328
|
var contentWrapper = document.createElement('span');
|
|
308
329
|
contentWrapper.setAttribute('style', contentStyle);
|
|
309
|
-
|
|
310
|
-
contentWrapper.append(
|
|
330
|
+
node.replaceWith(contentWrapper);
|
|
331
|
+
contentWrapper.append(node);
|
|
311
332
|
});
|
|
312
|
-
if (
|
|
333
|
+
if (handlesDirectInlineChildren) {
|
|
313
334
|
applyInlineLeafNodeStyles({
|
|
314
335
|
element: element,
|
|
315
336
|
targetNode: targetNode,
|
|
@@ -115,7 +115,29 @@ function groupTouchingDecorations(decorations, isInlineDecoration) {
|
|
|
115
115
|
// A zero-width decoration must not extend the run and bridge a gap.
|
|
116
116
|
clusterTo = Math.max(clusterTo, decoration.to);
|
|
117
117
|
});
|
|
118
|
-
|
|
118
|
+
|
|
119
|
+
// A deleted-content widget is left unattributed so it carries no tag of its own, and spans no
|
|
120
|
+
// range, so it is never a change in its own right. On its own it becomes a stop that reveals
|
|
121
|
+
// nothing, ahead of the stop for the change it belongs to — so it joins the attributed group
|
|
122
|
+
// that contains it. Only the stop list changes: the widget keeps its own decoration and, having
|
|
123
|
+
// no tag, stays no hover target.
|
|
124
|
+
var attributedGroups = groups.filter(function (group) {
|
|
125
|
+
return group.contributor !== '';
|
|
126
|
+
});
|
|
127
|
+
var stops = groups.filter(function (group) {
|
|
128
|
+
var _host$decorations;
|
|
129
|
+
if (group.contributor !== '' || group.decorations.some(function (dec) {
|
|
130
|
+
return dec.from !== dec.to;
|
|
131
|
+
})) {
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
var host = attributedGroups.find(function (attributed) {
|
|
135
|
+
return attributed.from <= group.from && group.to <= attributed.to;
|
|
136
|
+
});
|
|
137
|
+
host === null || host === void 0 || (_host$decorations = host.decorations).push.apply(_host$decorations, (0, _toConsumableArray2.default)(group.decorations));
|
|
138
|
+
return host === undefined;
|
|
139
|
+
});
|
|
140
|
+
return stops.map(function (_ref) {
|
|
119
141
|
var _ref2, _group$find;
|
|
120
142
|
var group = _ref.decorations,
|
|
121
143
|
from = _ref.from,
|
|
@@ -31,16 +31,17 @@ var SHOW_DIFF_AGENT_BRANDS = {
|
|
|
31
31
|
'agent-brand-databricks': 'databricks',
|
|
32
32
|
'agent-brand-gemini': 'gemini',
|
|
33
33
|
'agent-brand-manus': 'manus',
|
|
34
|
-
'agent-brand-slack': 'slack'
|
|
34
|
+
'agent-brand-slack': 'slack',
|
|
35
|
+
'agent-brand-antigravity': 'antigravity',
|
|
36
|
+
'agent-brand-copilot': 'copilot'
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
40
|
* Brands that prefer the account's real avatar over their fixed glyph when the invoking profile
|
|
39
41
|
* has one. Brands with a fixed glyph (Claude, ChatGPT, Amplitude, Cortex, Databricks, Gemini, Manus,
|
|
40
|
-
* Slack) intentionally keep it always (see `AGENT_KIND_ICONS` in
|
|
41
|
-
* `contributorAvatarRenderer.ts`).
|
|
42
|
+
* Slack) intentionally keep it always (see `AGENT_KIND_ICONS` in `contributorAvatarRenderer.ts`).
|
|
42
43
|
*/
|
|
43
|
-
var AVATAR_ELIGIBLE_BRANDS = new Set(['figma', 'lovable', 'replit', 'rovo']);
|
|
44
|
+
var AVATAR_ELIGIBLE_BRANDS = new Set(['antigravity', 'copilot', 'figma', 'lovable', 'replit', 'rovo']);
|
|
44
45
|
|
|
45
46
|
/** Known external agent types emitted by Confluence's agent identification service that carry
|
|
46
47
|
* no `@atlaskit/agent-color` brand — a generic labelled fallback. */
|
|
@@ -50,7 +51,6 @@ var EXTERNAL_AGENT_NAMES = {
|
|
|
50
51
|
runlayer: 'Runlayer',
|
|
51
52
|
zed: 'Zed',
|
|
52
53
|
ampcode: 'Ampcode',
|
|
53
|
-
antigravity: 'Antigravity',
|
|
54
54
|
devin_cli: 'Devin CLI',
|
|
55
55
|
pi_agent: 'Pi Agent'
|
|
56
56
|
};
|
|
@@ -25,7 +25,7 @@ exports.DIFF_AGENT_BRANDS = exports.ASSERT_DIFF_AGENT_BRANDS_ARE_REGISTERED = vo
|
|
|
25
25
|
|
|
26
26
|
/** Branded agent presentations supported by contributor tags. */
|
|
27
27
|
|
|
28
|
-
var DIFF_AGENT_BRANDS = exports.DIFF_AGENT_BRANDS = new Set(['rovo', 'claude', 'chatgpt', 'figma', 'lovable', 'replit', 'amplitude', 'cortex', 'databricks', 'gemini', 'manus', 'slack']);
|
|
28
|
+
var DIFF_AGENT_BRANDS = exports.DIFF_AGENT_BRANDS = new Set(['rovo', 'claude', 'chatgpt', 'figma', 'lovable', 'replit', 'amplitude', 'cortex', 'databricks', 'gemini', 'manus', 'slack', 'antigravity', 'copilot']);
|
|
29
29
|
|
|
30
30
|
/** The brand id `@atlaskit/agent-color` registers each `AgentBrandColorScheme` under. */
|
|
31
31
|
|
|
@@ -45,10 +45,10 @@ var CONTRIBUTOR_TAG_REVEALED_ATTRIBUTE = exports.CONTRIBUTOR_TAG_REVEALED_ATTRIB
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Backstop for removing a fading-out tag: a cancelled transition fires no `transitionend`. Must stay
|
|
48
|
-
* above the fade's
|
|
48
|
+
* above the fade's 500ms, which lives in another package's stylesheet and cannot be read back as a
|
|
49
49
|
* number — hence the wide margin. Raise in step with that duration.
|
|
50
50
|
*/
|
|
51
|
-
var TAG_EXIT_FALLBACK_MS = exports.TAG_EXIT_FALLBACK_MS =
|
|
51
|
+
var TAG_EXIT_FALLBACK_MS = exports.TAG_EXIT_FALLBACK_MS = 800;
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* The tooltip's look, inline rather than through `VANILLA_TOOLTIP_DEFAULT_CLASS`: this tooltip is
|
|
@@ -95,7 +95,8 @@ export class NodeViewSerializer {
|
|
|
95
95
|
if (childNode) {
|
|
96
96
|
// Give inserted atomic children the same box-shadow
|
|
97
97
|
// highlight an in-place attribute change already gets (`getAtomicInlineChangedAttrs`).
|
|
98
|
-
|
|
98
|
+
// Disabled under patch_2: the outline also landed on atomic children inserted alongside text.
|
|
99
|
+
if (isInserted && !fg('platform_editor_ai_show_diff_patch_2') && isExperimentEnabled('platform_editor_show_diff_deleted_nodeview_content') && isInlineAttrChangeNodeName(child.type.name) && childNode instanceof HTMLElement) {
|
|
99
100
|
const {
|
|
100
101
|
className,
|
|
101
102
|
styleSuffix
|
|
@@ -651,6 +651,14 @@ export function buildDeletedDecorationMarkerVariableSimple(colors) {
|
|
|
651
651
|
});
|
|
652
652
|
}
|
|
653
653
|
|
|
654
|
+
/** Marker and direct-content variables for deleted list items. */
|
|
655
|
+
export function buildDeletedListItemMarkerVariable(colors) {
|
|
656
|
+
return convertToInlineCss({
|
|
657
|
+
'--diff-decoration-content-opacity': '0.8',
|
|
658
|
+
'--diff-decoration-marker-color': borderAccent(colors.deleteColor)
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
|
|
654
662
|
/** Whether the emphasised state is stated in the bottom border rather than a deeper highlight. */
|
|
655
663
|
function usesUnderlineEmphasis(colors) {
|
|
656
664
|
return colors.deletedInlineActiveEmphasis === 'underline';
|
|
@@ -1041,7 +1049,7 @@ export function buildDeletedBlockNodeStyle(colors, category, isActive) {
|
|
|
1041
1049
|
case 'container':
|
|
1042
1050
|
return isStrikethrough ? buildDeletedInlineStyle(colors, false) : buildDeletedDecorationMarkerVariableSimple(colors);
|
|
1043
1051
|
case 'listItem':
|
|
1044
|
-
return colors.deletedNodeEmphasis === 'stateful' ? statefulMarker() : buildDeletedDecorationMarkerVariableSimple(colors);
|
|
1052
|
+
return colors.deletedNodeEmphasis === 'stateful' ? statefulMarker() : fg('platform_editor_ai_show_diff_patch_2') ? buildDeletedListItemMarkerVariable(colors) : buildDeletedDecorationMarkerVariableSimple(colors);
|
|
1045
1053
|
case 'marker':
|
|
1046
1054
|
return colors.deletedNodeEmphasis === 'stateful' ? statefulMarker() : buildDeletedInlineStyleStandard(colors, 'new');
|
|
1047
1055
|
case 'generic':
|
|
@@ -1085,10 +1093,16 @@ export function buildDeletedWrappedBlockOutline(colors, {
|
|
|
1085
1093
|
* decoration span and read by the `.show-diff-atomic-inline-changed-*` selectors in
|
|
1086
1094
|
* EditorContentContainer, on the decorated element or a descendant, so it must inherit. Being
|
|
1087
1095
|
* inline it beats the stylesheet's fallback, making the plugin the only source of the colour.
|
|
1096
|
+
*
|
|
1097
|
+
* Under patch_2 it also reserves the 2px ring either side, since the ring takes up no space and
|
|
1098
|
+
* otherwise paints over an adjacent inline diff.
|
|
1088
1099
|
*/
|
|
1089
1100
|
export function buildAtomicInlineChangedCSSVariables(colors) {
|
|
1090
1101
|
return convertToInlineCss({
|
|
1091
|
-
'--show-diff-atomic-inline-changed-border-color': borderAccent(colors.insertColor)
|
|
1102
|
+
'--show-diff-atomic-inline-changed-border-color': borderAccent(colors.insertColor),
|
|
1103
|
+
...(fg('platform_editor_ai_show_diff_patch_2') && {
|
|
1104
|
+
marginInline: "var(--ds-space-025, 2px)"
|
|
1105
|
+
})
|
|
1092
1106
|
});
|
|
1093
1107
|
}
|
|
1094
1108
|
|
|
@@ -135,6 +135,10 @@ export const deletedDecorationMarkerVariable = convertToInlineCss({
|
|
|
135
135
|
'--diff-decoration-marker-ring-width': '1px',
|
|
136
136
|
opacity: 0.8
|
|
137
137
|
});
|
|
138
|
+
export const deletedListItemMarkerVariable = convertToInlineCss({
|
|
139
|
+
'--diff-decoration-content-opacity': '0.8',
|
|
140
|
+
'--diff-decoration-marker-color': "var(--ds-border-accent-gray, #7D818A)"
|
|
141
|
+
});
|
|
138
142
|
export const addedCellOverlayStyle = convertToInlineCss({
|
|
139
143
|
position: 'absolute',
|
|
140
144
|
top: 0,
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* cleanup, together with `colorSchemes/standard.ts`, `colorSchemes/traditional.ts` (EDITOR-8281).
|
|
10
10
|
*/
|
|
11
11
|
import { convertToInlineCss } from '@atlaskit/editor-common/css-helper';
|
|
12
|
-
import {
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
13
|
+
import { standardDecorationMarkerVariable, deletedDecorationMarkerVariable, deletedListItemMarkerVariable, editingStyleQuoteNode, editingStyleRuleNode, editingStyleCardBlockNode, editingStyleNode, getStandardDeletedContentStyleNew, deletedStyleQuoteNode, addedCellOverlayStyle, addedCellOverlayRoundedStyle, deletedCellOverlayStyle, deletedCellOverlayRoundedStyle } from './colorSchemes/standard';
|
|
13
14
|
import { traditionalDecorationMarkerVariableActive, traditionalDecorationMarkerVariableNew, traditionalDeletedDecorationMarkerVariableActive, traditionalDeletedDecorationMarkerVariableNew, traditionalStyleQuoteNodeActive, traditionalStyleQuoteNodeNew, traditionalStyleRuleNodeActive, traditionalStyleRuleNodeNew, traditionalStyleCardBlockNodeActive, traditionalStyleCardBlockNodeNew, traditionalStyleNodeActive, traditionalStyleNodeNew, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, traditionalAddedCellOverlayStyle, traditionalAddedCellOverlayRoundedStyle, deletedTraditionalCellOverlayStyle, deletedTraditionalCellOverlayRoundedStyle } from './colorSchemes/traditional';
|
|
14
15
|
|
|
15
16
|
/** Verbatim copy of the pre-refactor cell-overlay style selection. */
|
|
@@ -57,7 +58,7 @@ export const getBlockNodeStyleLegacy = ({
|
|
|
57
58
|
return isTraditional && isActive ? traditionalDecorationMarkerVariableActive : isTraditional ? traditionalDecorationMarkerVariableNew : standardDecorationMarkerVariable;
|
|
58
59
|
}
|
|
59
60
|
if (nodeName === 'listItem') {
|
|
60
|
-
return isTraditional && isActive ? traditionalDeletedDecorationMarkerVariableActive : isTraditional ? traditionalDeletedDecorationMarkerVariableNew : deletedDecorationMarkerVariable;
|
|
61
|
+
return isTraditional && isActive ? traditionalDeletedDecorationMarkerVariableActive : isTraditional ? traditionalDeletedDecorationMarkerVariableNew : fg('platform_editor_ai_show_diff_patch_2') ? deletedListItemMarkerVariable : deletedDecorationMarkerVariable;
|
|
61
62
|
}
|
|
62
63
|
return isTraditional && isActive ? traditionalDeletedDecorationMarkerVariableActive : isTraditional ? traditionalDeletedDecorationMarkerVariableNew : getStandardDeletedContentStyleNew();
|
|
63
64
|
}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
2
3
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
4
|
import { resolveBaseNodeName } from '../utils/baseNodeName';
|
|
4
5
|
import { countEmptyTextBlockOnlySlice } from '../utils/emptyTextBlocks';
|
|
5
6
|
import { isEmptyParagraphSlice } from '../utils/isEmptyParagraphSlice';
|
|
7
|
+
import { buildAtomicInlineChangedCSSVariables } from './colorSchemes/factory';
|
|
8
|
+
import { colorSchemeRegistry } from './colorSchemes/schemes';
|
|
6
9
|
import { clampAnchorPosIntoCell, createAnchorNameSpan, createLeftAnchorWidget } from './createAnchorDecorationWidgets';
|
|
7
10
|
import { createChangedRowDecorationWidgets } from './createChangedRowDecorationWidgets';
|
|
8
11
|
import { createContributorTagHost, resolveHoistedCodeBlockAnchor, unmountContributorTag } from './createContributorTagWidget';
|
|
12
|
+
import { getAtomicInlineChangedAttrs } from './createInlineChangedDecoration';
|
|
9
13
|
import { AnchorTypeKey, buildContributorTagDecorationSpec, buildDiffDecorationSpec, buildAnchorDecorationKey, scrollMarginTopValue } from './decorationKeys';
|
|
10
14
|
import { absorbFirstChildMarginReset } from './utils/absorbFirstChildMarginReset';
|
|
11
15
|
import { createDeletedLineBreakDecoration } from './utils/createDeletedLineBreakWidget';
|
|
12
16
|
import { createMarginAbsorber } from './utils/createMarginAbsorber';
|
|
13
17
|
import { createNodeShapedMarginSpacer } from './utils/createNodeShapedMarginSpacer';
|
|
14
18
|
import { findSafeInsertPos } from './utils/findSafeInsertPos';
|
|
19
|
+
import { isInlineAttrChangeNodeName } from './utils/getAttrChangeRanges';
|
|
15
20
|
import { safeResolve } from './utils/safeResolve';
|
|
16
21
|
import { getTableDiffMode } from './utils/tableDiffMode';
|
|
17
22
|
import { wrapBlockNodeView, createRemovedLozenge, injectInnerWrapper, createContentWrapper } from './utils/wrapBlockNodeView';
|
|
@@ -112,6 +117,32 @@ const createTableCellContentWidgets = ({
|
|
|
112
117
|
return decorations;
|
|
113
118
|
};
|
|
114
119
|
|
|
120
|
+
/**
|
|
121
|
+
* The node name when `change` only swapped one atomic inline node (date, emoji, mention, status)
|
|
122
|
+
* for another of the same type, i.e. an attribute change rather than content added or removed
|
|
123
|
+
* around it.
|
|
124
|
+
*/
|
|
125
|
+
const getAtomicInlineAttrOnlyNodeName = (change, doc, newDoc) => {
|
|
126
|
+
const nodeA = doc.nodeAt(change.fromA);
|
|
127
|
+
const nodeB = newDoc.nodeAt(change.fromB);
|
|
128
|
+
if (!nodeA || !nodeB || nodeA.type !== nodeB.type || nodeA.nodeSize !== change.toA - change.fromA || nodeB.nodeSize !== change.toB - change.fromB) {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
const nodeName = nodeA.type.name;
|
|
132
|
+
return isInlineAttrChangeNodeName(nodeName) ? nodeName : undefined;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/** Wraps an inserted atomic inline node view in the outline an in-place attribute change gets. */
|
|
136
|
+
const createAtomicInlineOutline = (nodeName, nodeView, colorScheme) => {
|
|
137
|
+
const outlineWrapper = document.createElement('span');
|
|
138
|
+
outlineWrapper.className = getAtomicInlineChangedAttrs(nodeName, colorScheme).className;
|
|
139
|
+
// Set in both cohorts of `platform_editor_show_diff_color_scheme_refactor`: being inline it beats
|
|
140
|
+
// the stylesheet's purple/green table, so editor-core's rings follow the change's scheme too.
|
|
141
|
+
outlineWrapper.setAttribute('style', buildAtomicInlineChangedCSSVariables(colorSchemeRegistry[colorScheme !== null && colorScheme !== void 0 ? colorScheme : 'standard']));
|
|
142
|
+
outlineWrapper.append(nodeView);
|
|
143
|
+
return outlineWrapper;
|
|
144
|
+
};
|
|
145
|
+
|
|
115
146
|
/**
|
|
116
147
|
* This function is used to create a decoration widget to show content
|
|
117
148
|
* that is not in the current document.
|
|
@@ -377,9 +408,17 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
377
408
|
nodeView.style.setProperty('anchor-name', `--${contributorTagAnchorName}`);
|
|
378
409
|
}
|
|
379
410
|
if (node.isInline) {
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
|
|
411
|
+
const attrOnlyNodeName = isInserted && fg('platform_editor_ai_show_diff_patch_2') && isExperimentEnabled('platform_editor_show_diff_deleted_nodeview_content') ? getAtomicInlineAttrOnlyNodeName(change, doc, newDoc) : undefined;
|
|
412
|
+
if (attrOnlyNodeName) {
|
|
413
|
+
// Only the node's attributes changed, so outline it as an in-place attribute change
|
|
414
|
+
// does, in place of the highlight. Its own wrapper keeps the outline clear of the node
|
|
415
|
+
// view's styles.
|
|
416
|
+
dom.append(createAtomicInlineOutline(attrOnlyNodeName, nodeView, colorScheme));
|
|
417
|
+
} else {
|
|
418
|
+
const wrapper = createContentWrapper(colorScheme, isActive, isInserted, reveal);
|
|
419
|
+
wrapper.append(nodeView);
|
|
420
|
+
dom.append(wrapper);
|
|
421
|
+
}
|
|
383
422
|
} else {
|
|
384
423
|
// Handle all block nodes with unified function
|
|
385
424
|
wrapBlockNodeView({
|
|
@@ -284,7 +284,28 @@ const applyTextLikeBlockNodeStyles = ({
|
|
|
284
284
|
element.setAttribute('style', `${currentStyle}${nodeSpecificStyle}`);
|
|
285
285
|
}
|
|
286
286
|
const contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, hideAddedDiffsUnderline);
|
|
287
|
-
|
|
287
|
+
|
|
288
|
+
// Under patch_2, an inserted inline node view (a date, a status lozenge) is highlighted as a whole
|
|
289
|
+
// rather than the text inside it, so the highlight sits behind the node. Rejecting it skips its
|
|
290
|
+
// subtree, so this stays a single walk.
|
|
291
|
+
const highlightInlineNodesWhole = isInserted && fg('platform_editor_ai_show_diff_patch_2');
|
|
292
|
+
// `applyInlineLeafNodeStyles` styles the block's direct inline children itself.
|
|
293
|
+
const handlesDirectInlineChildren = highlightInlineLeafNodes && targetNode.type.inlineContent;
|
|
294
|
+
const inlineNodesToWrap = [];
|
|
295
|
+
const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT, {
|
|
296
|
+
acceptNode: node => {
|
|
297
|
+
if (node instanceof Text) {
|
|
298
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
299
|
+
}
|
|
300
|
+
if (highlightInlineNodesWhole && node instanceof HTMLElement && node.dataset.prosemirrorNodeInline === 'true') {
|
|
301
|
+
if (!(handlesDirectInlineChildren && node.parentElement === element)) {
|
|
302
|
+
inlineNodesToWrap.push(node);
|
|
303
|
+
}
|
|
304
|
+
return NodeFilter.FILTER_REJECT;
|
|
305
|
+
}
|
|
306
|
+
return NodeFilter.FILTER_SKIP;
|
|
307
|
+
}
|
|
308
|
+
});
|
|
288
309
|
const textNodesToWrap = [];
|
|
289
310
|
let currentNode = walker.nextNode();
|
|
290
311
|
while (currentNode) {
|
|
@@ -293,13 +314,13 @@ const applyTextLikeBlockNodeStyles = ({
|
|
|
293
314
|
}
|
|
294
315
|
currentNode = walker.nextNode();
|
|
295
316
|
}
|
|
296
|
-
textNodesToWrap.forEach(
|
|
317
|
+
[...textNodesToWrap, ...inlineNodesToWrap].forEach(node => {
|
|
297
318
|
const contentWrapper = document.createElement('span');
|
|
298
319
|
contentWrapper.setAttribute('style', contentStyle);
|
|
299
|
-
|
|
300
|
-
contentWrapper.append(
|
|
320
|
+
node.replaceWith(contentWrapper);
|
|
321
|
+
contentWrapper.append(node);
|
|
301
322
|
});
|
|
302
|
-
if (
|
|
323
|
+
if (handlesDirectInlineChildren) {
|
|
303
324
|
applyInlineLeafNodeStyles({
|
|
304
325
|
element,
|
|
305
326
|
targetNode,
|
|
@@ -100,7 +100,22 @@ function groupTouchingDecorations(decorations, isInlineDecoration) {
|
|
|
100
100
|
// A zero-width decoration must not extend the run and bridge a gap.
|
|
101
101
|
clusterTo = Math.max(clusterTo, decoration.to);
|
|
102
102
|
});
|
|
103
|
-
|
|
103
|
+
|
|
104
|
+
// A deleted-content widget is left unattributed so it carries no tag of its own, and spans no
|
|
105
|
+
// range, so it is never a change in its own right. On its own it becomes a stop that reveals
|
|
106
|
+
// nothing, ahead of the stop for the change it belongs to — so it joins the attributed group
|
|
107
|
+
// that contains it. Only the stop list changes: the widget keeps its own decoration and, having
|
|
108
|
+
// no tag, stays no hover target.
|
|
109
|
+
const attributedGroups = groups.filter(group => group.contributor !== '');
|
|
110
|
+
const stops = groups.filter(group => {
|
|
111
|
+
if (group.contributor !== '' || group.decorations.some(dec => dec.from !== dec.to)) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
const host = attributedGroups.find(attributed => attributed.from <= group.from && group.to <= attributed.to);
|
|
115
|
+
host === null || host === void 0 ? void 0 : host.decorations.push(...group.decorations);
|
|
116
|
+
return host === undefined;
|
|
117
|
+
});
|
|
118
|
+
return stops.map(({
|
|
104
119
|
decorations: group,
|
|
105
120
|
from,
|
|
106
121
|
to
|
|
@@ -19,16 +19,17 @@ const SHOW_DIFF_AGENT_BRANDS = {
|
|
|
19
19
|
'agent-brand-databricks': 'databricks',
|
|
20
20
|
'agent-brand-gemini': 'gemini',
|
|
21
21
|
'agent-brand-manus': 'manus',
|
|
22
|
-
'agent-brand-slack': 'slack'
|
|
22
|
+
'agent-brand-slack': 'slack',
|
|
23
|
+
'agent-brand-antigravity': 'antigravity',
|
|
24
|
+
'agent-brand-copilot': 'copilot'
|
|
23
25
|
};
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* Brands that prefer the account's real avatar over their fixed glyph when the invoking profile
|
|
27
29
|
* has one. Brands with a fixed glyph (Claude, ChatGPT, Amplitude, Cortex, Databricks, Gemini, Manus,
|
|
28
|
-
* Slack) intentionally keep it always (see `AGENT_KIND_ICONS` in
|
|
29
|
-
* `contributorAvatarRenderer.ts`).
|
|
30
|
+
* Slack) intentionally keep it always (see `AGENT_KIND_ICONS` in `contributorAvatarRenderer.ts`).
|
|
30
31
|
*/
|
|
31
|
-
const AVATAR_ELIGIBLE_BRANDS = new Set(['figma', 'lovable', 'replit', 'rovo']);
|
|
32
|
+
const AVATAR_ELIGIBLE_BRANDS = new Set(['antigravity', 'copilot', 'figma', 'lovable', 'replit', 'rovo']);
|
|
32
33
|
|
|
33
34
|
/** Known external agent types emitted by Confluence's agent identification service that carry
|
|
34
35
|
* no `@atlaskit/agent-color` brand — a generic labelled fallback. */
|
|
@@ -38,7 +39,6 @@ const EXTERNAL_AGENT_NAMES = {
|
|
|
38
39
|
runlayer: 'Runlayer',
|
|
39
40
|
zed: 'Zed',
|
|
40
41
|
ampcode: 'Ampcode',
|
|
41
|
-
antigravity: 'Antigravity',
|
|
42
42
|
devin_cli: 'Devin CLI',
|
|
43
43
|
pi_agent: 'Pi Agent'
|
|
44
44
|
};
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
/** Branded agent presentations supported by contributor tags. */
|
|
21
21
|
|
|
22
|
-
export const DIFF_AGENT_BRANDS = new Set(['rovo', 'claude', 'chatgpt', 'figma', 'lovable', 'replit', 'amplitude', 'cortex', 'databricks', 'gemini', 'manus', 'slack']);
|
|
22
|
+
export const DIFF_AGENT_BRANDS = new Set(['rovo', 'claude', 'chatgpt', 'figma', 'lovable', 'replit', 'amplitude', 'cortex', 'databricks', 'gemini', 'manus', 'slack', 'antigravity', 'copilot']);
|
|
23
23
|
|
|
24
24
|
/** The brand id `@atlaskit/agent-color` registers each `AgentBrandColorScheme` under. */
|
|
25
25
|
|
|
@@ -37,10 +37,10 @@ export const CONTRIBUTOR_TAG_REVEALED_ATTRIBUTE = 'data-revealed';
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Backstop for removing a fading-out tag: a cancelled transition fires no `transitionend`. Must stay
|
|
40
|
-
* above the fade's
|
|
40
|
+
* above the fade's 500ms, which lives in another package's stylesheet and cannot be read back as a
|
|
41
41
|
* number — hence the wide margin. Raise in step with that duration.
|
|
42
42
|
*/
|
|
43
|
-
export const TAG_EXIT_FALLBACK_MS =
|
|
43
|
+
export const TAG_EXIT_FALLBACK_MS = 800;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* The tooltip's look, inline rather than through `VANILLA_TOOLTIP_DEFAULT_CLASS`: this tooltip is
|
|
@@ -105,7 +105,8 @@ export var NodeViewSerializer = /*#__PURE__*/function () {
|
|
|
105
105
|
if (childNode) {
|
|
106
106
|
// Give inserted atomic children the same box-shadow
|
|
107
107
|
// highlight an in-place attribute change already gets (`getAtomicInlineChangedAttrs`).
|
|
108
|
-
|
|
108
|
+
// Disabled under patch_2: the outline also landed on atomic children inserted alongside text.
|
|
109
|
+
if (isInserted && !fg('platform_editor_ai_show_diff_patch_2') && isExperimentEnabled('platform_editor_show_diff_deleted_nodeview_content') && isInlineAttrChangeNodeName(child.type.name) && childNode instanceof HTMLElement) {
|
|
109
110
|
var _getAtomicInlineChang = getAtomicInlineChangedAttrs(child.type.name, colorScheme),
|
|
110
111
|
className = _getAtomicInlineChang.className,
|
|
111
112
|
styleSuffix = _getAtomicInlineChang.styleSuffix;
|
|
@@ -656,6 +656,14 @@ export function buildDeletedDecorationMarkerVariableSimple(colors) {
|
|
|
656
656
|
});
|
|
657
657
|
}
|
|
658
658
|
|
|
659
|
+
/** Marker and direct-content variables for deleted list items. */
|
|
660
|
+
export function buildDeletedListItemMarkerVariable(colors) {
|
|
661
|
+
return convertToInlineCss({
|
|
662
|
+
'--diff-decoration-content-opacity': '0.8',
|
|
663
|
+
'--diff-decoration-marker-color': borderAccent(colors.deleteColor)
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
|
|
659
667
|
/** Whether the emphasised state is stated in the bottom border rather than a deeper highlight. */
|
|
660
668
|
function usesUnderlineEmphasis(colors) {
|
|
661
669
|
return colors.deletedInlineActiveEmphasis === 'underline';
|
|
@@ -1045,7 +1053,7 @@ export function buildDeletedBlockNodeStyle(colors, category, isActive) {
|
|
|
1045
1053
|
case 'container':
|
|
1046
1054
|
return isStrikethrough ? buildDeletedInlineStyle(colors, false) : buildDeletedDecorationMarkerVariableSimple(colors);
|
|
1047
1055
|
case 'listItem':
|
|
1048
|
-
return colors.deletedNodeEmphasis === 'stateful' ? statefulMarker() : buildDeletedDecorationMarkerVariableSimple(colors);
|
|
1056
|
+
return colors.deletedNodeEmphasis === 'stateful' ? statefulMarker() : fg('platform_editor_ai_show_diff_patch_2') ? buildDeletedListItemMarkerVariable(colors) : buildDeletedDecorationMarkerVariableSimple(colors);
|
|
1049
1057
|
case 'marker':
|
|
1050
1058
|
return colors.deletedNodeEmphasis === 'stateful' ? statefulMarker() : buildDeletedInlineStyleStandard(colors, 'new');
|
|
1051
1059
|
case 'generic':
|
|
@@ -1088,11 +1096,16 @@ export function buildDeletedWrappedBlockOutline(colors, _ref) {
|
|
|
1088
1096
|
* decoration span and read by the `.show-diff-atomic-inline-changed-*` selectors in
|
|
1089
1097
|
* EditorContentContainer, on the decorated element or a descendant, so it must inherit. Being
|
|
1090
1098
|
* inline it beats the stylesheet's fallback, making the plugin the only source of the colour.
|
|
1099
|
+
*
|
|
1100
|
+
* Under patch_2 it also reserves the 2px ring either side, since the ring takes up no space and
|
|
1101
|
+
* otherwise paints over an adjacent inline diff.
|
|
1091
1102
|
*/
|
|
1092
1103
|
export function buildAtomicInlineChangedCSSVariables(colors) {
|
|
1093
|
-
return convertToInlineCss({
|
|
1104
|
+
return convertToInlineCss(_objectSpread({
|
|
1094
1105
|
'--show-diff-atomic-inline-changed-border-color': borderAccent(colors.insertColor)
|
|
1095
|
-
})
|
|
1106
|
+
}, fg('platform_editor_ai_show_diff_patch_2') && {
|
|
1107
|
+
marginInline: "var(--ds-space-025, 2px)"
|
|
1108
|
+
}));
|
|
1096
1109
|
}
|
|
1097
1110
|
|
|
1098
1111
|
/** Hands editor-core the same strike line the widget path uses, via a custom property. */
|
|
@@ -146,6 +146,10 @@ export var deletedDecorationMarkerVariable = convertToInlineCss({
|
|
|
146
146
|
'--diff-decoration-marker-ring-width': '1px',
|
|
147
147
|
opacity: 0.8
|
|
148
148
|
});
|
|
149
|
+
export var deletedListItemMarkerVariable = convertToInlineCss({
|
|
150
|
+
'--diff-decoration-content-opacity': '0.8',
|
|
151
|
+
'--diff-decoration-marker-color': "var(--ds-border-accent-gray, #7D818A)"
|
|
152
|
+
});
|
|
149
153
|
export var addedCellOverlayStyle = convertToInlineCss({
|
|
150
154
|
position: 'absolute',
|
|
151
155
|
top: 0,
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* cleanup, together with `colorSchemes/standard.ts`, `colorSchemes/traditional.ts` (EDITOR-8281).
|
|
10
10
|
*/
|
|
11
11
|
import { convertToInlineCss } from '@atlaskit/editor-common/css-helper';
|
|
12
|
-
import {
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
13
|
+
import { standardDecorationMarkerVariable, deletedDecorationMarkerVariable, deletedListItemMarkerVariable, editingStyleQuoteNode, editingStyleRuleNode, editingStyleCardBlockNode, editingStyleNode, getStandardDeletedContentStyleNew, deletedStyleQuoteNode, addedCellOverlayStyle, addedCellOverlayRoundedStyle, deletedCellOverlayStyle, deletedCellOverlayRoundedStyle } from './colorSchemes/standard';
|
|
13
14
|
import { traditionalDecorationMarkerVariableActive, traditionalDecorationMarkerVariableNew, traditionalDeletedDecorationMarkerVariableActive, traditionalDeletedDecorationMarkerVariableNew, traditionalStyleQuoteNodeActive, traditionalStyleQuoteNodeNew, traditionalStyleRuleNodeActive, traditionalStyleRuleNodeNew, traditionalStyleCardBlockNodeActive, traditionalStyleCardBlockNodeNew, traditionalStyleNodeActive, traditionalStyleNodeNew, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, traditionalAddedCellOverlayStyle, traditionalAddedCellOverlayRoundedStyle, deletedTraditionalCellOverlayStyle, deletedTraditionalCellOverlayRoundedStyle } from './colorSchemes/traditional';
|
|
14
15
|
|
|
15
16
|
/** Verbatim copy of the pre-refactor cell-overlay style selection. */
|
|
@@ -57,7 +58,7 @@ export var getBlockNodeStyleLegacy = function getBlockNodeStyleLegacy(_ref2) {
|
|
|
57
58
|
return isTraditional && isActive ? traditionalDecorationMarkerVariableActive : isTraditional ? traditionalDecorationMarkerVariableNew : standardDecorationMarkerVariable;
|
|
58
59
|
}
|
|
59
60
|
if (nodeName === 'listItem') {
|
|
60
|
-
return isTraditional && isActive ? traditionalDeletedDecorationMarkerVariableActive : isTraditional ? traditionalDeletedDecorationMarkerVariableNew : deletedDecorationMarkerVariable;
|
|
61
|
+
return isTraditional && isActive ? traditionalDeletedDecorationMarkerVariableActive : isTraditional ? traditionalDeletedDecorationMarkerVariableNew : fg('platform_editor_ai_show_diff_patch_2') ? deletedListItemMarkerVariable : deletedDecorationMarkerVariable;
|
|
61
62
|
}
|
|
62
63
|
return isTraditional && isActive ? traditionalDeletedDecorationMarkerVariableActive : isTraditional ? traditionalDeletedDecorationMarkerVariableNew : getStandardDeletedContentStyleNew();
|
|
63
64
|
}
|
|
@@ -2,19 +2,24 @@ 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 { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
5
6
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
7
|
import { resolveBaseNodeName } from '../utils/baseNodeName';
|
|
7
8
|
import { countEmptyTextBlockOnlySlice } from '../utils/emptyTextBlocks';
|
|
8
9
|
import { isEmptyParagraphSlice } from '../utils/isEmptyParagraphSlice';
|
|
10
|
+
import { buildAtomicInlineChangedCSSVariables } from './colorSchemes/factory';
|
|
11
|
+
import { colorSchemeRegistry } from './colorSchemes/schemes';
|
|
9
12
|
import { clampAnchorPosIntoCell, createAnchorNameSpan, createLeftAnchorWidget } from './createAnchorDecorationWidgets';
|
|
10
13
|
import { createChangedRowDecorationWidgets } from './createChangedRowDecorationWidgets';
|
|
11
14
|
import { createContributorTagHost, resolveHoistedCodeBlockAnchor, unmountContributorTag } from './createContributorTagWidget';
|
|
15
|
+
import { getAtomicInlineChangedAttrs } from './createInlineChangedDecoration';
|
|
12
16
|
import { AnchorTypeKey, buildContributorTagDecorationSpec, buildDiffDecorationSpec, buildAnchorDecorationKey, scrollMarginTopValue } from './decorationKeys';
|
|
13
17
|
import { absorbFirstChildMarginReset } from './utils/absorbFirstChildMarginReset';
|
|
14
18
|
import { createDeletedLineBreakDecoration } from './utils/createDeletedLineBreakWidget';
|
|
15
19
|
import { createMarginAbsorber } from './utils/createMarginAbsorber';
|
|
16
20
|
import { createNodeShapedMarginSpacer } from './utils/createNodeShapedMarginSpacer';
|
|
17
21
|
import { findSafeInsertPos } from './utils/findSafeInsertPos';
|
|
22
|
+
import { isInlineAttrChangeNodeName } from './utils/getAttrChangeRanges';
|
|
18
23
|
import { safeResolve } from './utils/safeResolve';
|
|
19
24
|
import { getTableDiffMode } from './utils/tableDiffMode';
|
|
20
25
|
import { wrapBlockNodeView, createRemovedLozenge, injectInnerWrapper, createContentWrapper } from './utils/wrapBlockNodeView';
|
|
@@ -114,6 +119,32 @@ var createTableCellContentWidgets = function createTableCellContentWidgets(_ref)
|
|
|
114
119
|
return decorations;
|
|
115
120
|
};
|
|
116
121
|
|
|
122
|
+
/**
|
|
123
|
+
* The node name when `change` only swapped one atomic inline node (date, emoji, mention, status)
|
|
124
|
+
* for another of the same type, i.e. an attribute change rather than content added or removed
|
|
125
|
+
* around it.
|
|
126
|
+
*/
|
|
127
|
+
var getAtomicInlineAttrOnlyNodeName = function getAtomicInlineAttrOnlyNodeName(change, doc, newDoc) {
|
|
128
|
+
var nodeA = doc.nodeAt(change.fromA);
|
|
129
|
+
var nodeB = newDoc.nodeAt(change.fromB);
|
|
130
|
+
if (!nodeA || !nodeB || nodeA.type !== nodeB.type || nodeA.nodeSize !== change.toA - change.fromA || nodeB.nodeSize !== change.toB - change.fromB) {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
var nodeName = nodeA.type.name;
|
|
134
|
+
return isInlineAttrChangeNodeName(nodeName) ? nodeName : undefined;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/** Wraps an inserted atomic inline node view in the outline an in-place attribute change gets. */
|
|
138
|
+
var createAtomicInlineOutline = function createAtomicInlineOutline(nodeName, nodeView, colorScheme) {
|
|
139
|
+
var outlineWrapper = document.createElement('span');
|
|
140
|
+
outlineWrapper.className = getAtomicInlineChangedAttrs(nodeName, colorScheme).className;
|
|
141
|
+
// Set in both cohorts of `platform_editor_show_diff_color_scheme_refactor`: being inline it beats
|
|
142
|
+
// the stylesheet's purple/green table, so editor-core's rings follow the change's scheme too.
|
|
143
|
+
outlineWrapper.setAttribute('style', buildAtomicInlineChangedCSSVariables(colorSchemeRegistry[colorScheme !== null && colorScheme !== void 0 ? colorScheme : 'standard']));
|
|
144
|
+
outlineWrapper.append(nodeView);
|
|
145
|
+
return outlineWrapper;
|
|
146
|
+
};
|
|
147
|
+
|
|
117
148
|
/**
|
|
118
149
|
* This function is used to create a decoration widget to show content
|
|
119
150
|
* that is not in the current document.
|
|
@@ -385,9 +416,17 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
385
416
|
nodeView.style.setProperty('anchor-name', "--".concat(contributorTagAnchorName));
|
|
386
417
|
}
|
|
387
418
|
if (node.isInline) {
|
|
388
|
-
var
|
|
389
|
-
|
|
390
|
-
|
|
419
|
+
var attrOnlyNodeName = isInserted && fg('platform_editor_ai_show_diff_patch_2') && isExperimentEnabled('platform_editor_show_diff_deleted_nodeview_content') ? getAtomicInlineAttrOnlyNodeName(change, doc, newDoc) : undefined;
|
|
420
|
+
if (attrOnlyNodeName) {
|
|
421
|
+
// Only the node's attributes changed, so outline it as an in-place attribute change
|
|
422
|
+
// does, in place of the highlight. Its own wrapper keeps the outline clear of the node
|
|
423
|
+
// view's styles.
|
|
424
|
+
dom.append(createAtomicInlineOutline(attrOnlyNodeName, nodeView, colorScheme));
|
|
425
|
+
} else {
|
|
426
|
+
var wrapper = createContentWrapper(colorScheme, isActive, isInserted, reveal);
|
|
427
|
+
wrapper.append(nodeView);
|
|
428
|
+
dom.append(wrapper);
|
|
429
|
+
}
|
|
391
430
|
} else {
|
|
392
431
|
// Handle all block nodes with unified function
|
|
393
432
|
wrapBlockNodeView({
|
|
@@ -287,7 +287,28 @@ var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref8)
|
|
|
287
287
|
element.setAttribute('style', "".concat(currentStyle).concat(nodeSpecificStyle));
|
|
288
288
|
}
|
|
289
289
|
var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, hideAddedDiffsUnderline);
|
|
290
|
-
|
|
290
|
+
|
|
291
|
+
// Under patch_2, an inserted inline node view (a date, a status lozenge) is highlighted as a whole
|
|
292
|
+
// rather than the text inside it, so the highlight sits behind the node. Rejecting it skips its
|
|
293
|
+
// subtree, so this stays a single walk.
|
|
294
|
+
var highlightInlineNodesWhole = isInserted && fg('platform_editor_ai_show_diff_patch_2');
|
|
295
|
+
// `applyInlineLeafNodeStyles` styles the block's direct inline children itself.
|
|
296
|
+
var handlesDirectInlineChildren = highlightInlineLeafNodes && targetNode.type.inlineContent;
|
|
297
|
+
var inlineNodesToWrap = [];
|
|
298
|
+
var walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT, {
|
|
299
|
+
acceptNode: function acceptNode(node) {
|
|
300
|
+
if (node instanceof Text) {
|
|
301
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
302
|
+
}
|
|
303
|
+
if (highlightInlineNodesWhole && node instanceof HTMLElement && node.dataset.prosemirrorNodeInline === 'true') {
|
|
304
|
+
if (!(handlesDirectInlineChildren && node.parentElement === element)) {
|
|
305
|
+
inlineNodesToWrap.push(node);
|
|
306
|
+
}
|
|
307
|
+
return NodeFilter.FILTER_REJECT;
|
|
308
|
+
}
|
|
309
|
+
return NodeFilter.FILTER_SKIP;
|
|
310
|
+
}
|
|
311
|
+
});
|
|
291
312
|
var textNodesToWrap = [];
|
|
292
313
|
var currentNode = walker.nextNode();
|
|
293
314
|
while (currentNode) {
|
|
@@ -296,13 +317,13 @@ var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref8)
|
|
|
296
317
|
}
|
|
297
318
|
currentNode = walker.nextNode();
|
|
298
319
|
}
|
|
299
|
-
textNodesToWrap.forEach(function (
|
|
320
|
+
[].concat(textNodesToWrap, inlineNodesToWrap).forEach(function (node) {
|
|
300
321
|
var contentWrapper = document.createElement('span');
|
|
301
322
|
contentWrapper.setAttribute('style', contentStyle);
|
|
302
|
-
|
|
303
|
-
contentWrapper.append(
|
|
323
|
+
node.replaceWith(contentWrapper);
|
|
324
|
+
contentWrapper.append(node);
|
|
304
325
|
});
|
|
305
|
-
if (
|
|
326
|
+
if (handlesDirectInlineChildren) {
|
|
306
327
|
applyInlineLeafNodeStyles({
|
|
307
328
|
element: element,
|
|
308
329
|
targetNode: targetNode,
|
|
@@ -108,7 +108,29 @@ function groupTouchingDecorations(decorations, isInlineDecoration) {
|
|
|
108
108
|
// A zero-width decoration must not extend the run and bridge a gap.
|
|
109
109
|
clusterTo = Math.max(clusterTo, decoration.to);
|
|
110
110
|
});
|
|
111
|
-
|
|
111
|
+
|
|
112
|
+
// A deleted-content widget is left unattributed so it carries no tag of its own, and spans no
|
|
113
|
+
// range, so it is never a change in its own right. On its own it becomes a stop that reveals
|
|
114
|
+
// nothing, ahead of the stop for the change it belongs to — so it joins the attributed group
|
|
115
|
+
// that contains it. Only the stop list changes: the widget keeps its own decoration and, having
|
|
116
|
+
// no tag, stays no hover target.
|
|
117
|
+
var attributedGroups = groups.filter(function (group) {
|
|
118
|
+
return group.contributor !== '';
|
|
119
|
+
});
|
|
120
|
+
var stops = groups.filter(function (group) {
|
|
121
|
+
var _host$decorations;
|
|
122
|
+
if (group.contributor !== '' || group.decorations.some(function (dec) {
|
|
123
|
+
return dec.from !== dec.to;
|
|
124
|
+
})) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
var host = attributedGroups.find(function (attributed) {
|
|
128
|
+
return attributed.from <= group.from && group.to <= attributed.to;
|
|
129
|
+
});
|
|
130
|
+
host === null || host === void 0 || (_host$decorations = host.decorations).push.apply(_host$decorations, _toConsumableArray(group.decorations));
|
|
131
|
+
return host === undefined;
|
|
132
|
+
});
|
|
133
|
+
return stops.map(function (_ref) {
|
|
112
134
|
var _ref2, _group$find;
|
|
113
135
|
var group = _ref.decorations,
|
|
114
136
|
from = _ref.from,
|
|
@@ -25,16 +25,17 @@ var SHOW_DIFF_AGENT_BRANDS = {
|
|
|
25
25
|
'agent-brand-databricks': 'databricks',
|
|
26
26
|
'agent-brand-gemini': 'gemini',
|
|
27
27
|
'agent-brand-manus': 'manus',
|
|
28
|
-
'agent-brand-slack': 'slack'
|
|
28
|
+
'agent-brand-slack': 'slack',
|
|
29
|
+
'agent-brand-antigravity': 'antigravity',
|
|
30
|
+
'agent-brand-copilot': 'copilot'
|
|
29
31
|
};
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
* Brands that prefer the account's real avatar over their fixed glyph when the invoking profile
|
|
33
35
|
* has one. Brands with a fixed glyph (Claude, ChatGPT, Amplitude, Cortex, Databricks, Gemini, Manus,
|
|
34
|
-
* Slack) intentionally keep it always (see `AGENT_KIND_ICONS` in
|
|
35
|
-
* `contributorAvatarRenderer.ts`).
|
|
36
|
+
* Slack) intentionally keep it always (see `AGENT_KIND_ICONS` in `contributorAvatarRenderer.ts`).
|
|
36
37
|
*/
|
|
37
|
-
var AVATAR_ELIGIBLE_BRANDS = new Set(['figma', 'lovable', 'replit', 'rovo']);
|
|
38
|
+
var AVATAR_ELIGIBLE_BRANDS = new Set(['antigravity', 'copilot', 'figma', 'lovable', 'replit', 'rovo']);
|
|
38
39
|
|
|
39
40
|
/** Known external agent types emitted by Confluence's agent identification service that carry
|
|
40
41
|
* no `@atlaskit/agent-color` brand — a generic labelled fallback. */
|
|
@@ -44,7 +45,6 @@ var EXTERNAL_AGENT_NAMES = {
|
|
|
44
45
|
runlayer: 'Runlayer',
|
|
45
46
|
zed: 'Zed',
|
|
46
47
|
ampcode: 'Ampcode',
|
|
47
|
-
antigravity: 'Antigravity',
|
|
48
48
|
devin_cli: 'Devin CLI',
|
|
49
49
|
pi_agent: 'Pi Agent'
|
|
50
50
|
};
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
/** Branded agent presentations supported by contributor tags. */
|
|
21
21
|
|
|
22
|
-
export var DIFF_AGENT_BRANDS = new Set(['rovo', 'claude', 'chatgpt', 'figma', 'lovable', 'replit', 'amplitude', 'cortex', 'databricks', 'gemini', 'manus', 'slack']);
|
|
22
|
+
export var DIFF_AGENT_BRANDS = new Set(['rovo', 'claude', 'chatgpt', 'figma', 'lovable', 'replit', 'amplitude', 'cortex', 'databricks', 'gemini', 'manus', 'slack', 'antigravity', 'copilot']);
|
|
23
23
|
|
|
24
24
|
/** The brand id `@atlaskit/agent-color` registers each `AgentBrandColorScheme` under. */
|
|
25
25
|
|
|
@@ -38,10 +38,10 @@ export var CONTRIBUTOR_TAG_REVEALED_ATTRIBUTE = 'data-revealed';
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Backstop for removing a fading-out tag: a cancelled transition fires no `transitionend`. Must stay
|
|
41
|
-
* above the fade's
|
|
41
|
+
* above the fade's 500ms, which lives in another package's stylesheet and cannot be read back as a
|
|
42
42
|
* number — hence the wide margin. Raise in step with that duration.
|
|
43
43
|
*/
|
|
44
|
-
export var TAG_EXIT_FALLBACK_MS =
|
|
44
|
+
export var TAG_EXIT_FALLBACK_MS = 800;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* The tooltip's look, inline rather than through `VANILLA_TOOLTIP_DEFAULT_CLASS`: this tooltip is
|
|
@@ -111,6 +111,8 @@ export declare function buildDecorationMarkerVariableActive(colors: DiffColorSch
|
|
|
111
111
|
export declare function buildDeletedDecorationMarkerVariable(colors: DiffColorScheme): string;
|
|
112
112
|
/** Opacity only, no position or strikethrough. Used by 'static' schemes. */
|
|
113
113
|
export declare function buildDeletedDecorationMarkerVariableSimple(colors: DiffColorScheme): string;
|
|
114
|
+
/** Marker and direct-content variables for deleted list items. */
|
|
115
|
+
export declare function buildDeletedListItemMarkerVariable(colors: DiffColorScheme): string;
|
|
114
116
|
/** Extended deleted inline style — background highlight with an accent or background-matched bottom border. */
|
|
115
117
|
export declare function buildDeletedInlineContentStyleExtended(colors: DiffColorScheme, isActive?: boolean): string;
|
|
116
118
|
/** 'glyphTint' deleted inline style — tints the glyph itself via `color:`. */
|
|
@@ -227,6 +229,9 @@ export declare function buildDeletedWrappedBlockOutline(colors: DiffColorScheme,
|
|
|
227
229
|
* decoration span and read by the `.show-diff-atomic-inline-changed-*` selectors in
|
|
228
230
|
* EditorContentContainer, on the decorated element or a descendant, so it must inherit. Being
|
|
229
231
|
* inline it beats the stylesheet's fallback, making the plugin the only source of the colour.
|
|
232
|
+
*
|
|
233
|
+
* Under patch_2 it also reserves the 2px ring either side, since the ring takes up no space and
|
|
234
|
+
* otherwise paints over an adjacent inline diff.
|
|
230
235
|
*/
|
|
231
236
|
export declare function buildAtomicInlineChangedCSSVariables(colors: DiffColorScheme): string;
|
|
232
237
|
/** Hands editor-core the same strike line the widget path uses, via a custom property. */
|
|
@@ -33,6 +33,7 @@ export declare const editingStyleNode: string;
|
|
|
33
33
|
export declare const editingStyleCardBlockNode: string;
|
|
34
34
|
export declare const standardDecorationMarkerVariable: string;
|
|
35
35
|
export declare const deletedDecorationMarkerVariable: string;
|
|
36
|
+
export declare const deletedListItemMarkerVariable: string;
|
|
36
37
|
export declare const addedCellOverlayStyle: string;
|
|
37
38
|
export declare const addedCellOverlayRoundedStyle: string;
|
|
38
39
|
export declare const deletedCellOverlayStyle: string;
|
|
@@ -40,7 +40,7 @@ export type StepWithAttribution<TStep> = {
|
|
|
40
40
|
stepAttribution?: DiffStepAttribution;
|
|
41
41
|
};
|
|
42
42
|
/** Branded agent presentations supported by contributor tags. */
|
|
43
|
-
export type DiffAgentBrand = 'rovo' | 'claude' | 'chatgpt' | 'figma' | 'lovable' | 'replit' | 'amplitude' | 'cortex' | 'databricks' | 'gemini' | 'manus' | 'slack';
|
|
43
|
+
export type DiffAgentBrand = 'rovo' | 'claude' | 'chatgpt' | 'figma' | 'lovable' | 'replit' | 'amplitude' | 'cortex' | 'databricks' | 'gemini' | 'manus' | 'slack' | 'antigravity' | 'copilot';
|
|
44
44
|
export declare const DIFF_AGENT_BRANDS: ReadonlySet<DiffAgentBrand>;
|
|
45
45
|
/** The brand id `@atlaskit/agent-color` registers each `AgentBrandColorScheme` under. */
|
|
46
46
|
type AgentColorBrandId = AgentBrandColorScheme extends `agent-brand-${infer BrandId}` ? BrandId : never;
|
|
@@ -30,10 +30,10 @@ export declare const CONTRIBUTOR_TAG_CLASS = "ak-editor-diff-contributor-tag";
|
|
|
30
30
|
export declare const CONTRIBUTOR_TAG_REVEALED_ATTRIBUTE = "data-revealed";
|
|
31
31
|
/**
|
|
32
32
|
* Backstop for removing a fading-out tag: a cancelled transition fires no `transitionend`. Must stay
|
|
33
|
-
* above the fade's
|
|
33
|
+
* above the fade's 500ms, which lives in another package's stylesheet and cannot be read back as a
|
|
34
34
|
* number — hence the wide margin. Raise in step with that duration.
|
|
35
35
|
*/
|
|
36
|
-
export declare const TAG_EXIT_FALLBACK_MS =
|
|
36
|
+
export declare const TAG_EXIT_FALLBACK_MS = 800;
|
|
37
37
|
/**
|
|
38
38
|
* The tooltip's look, inline rather than through `VANILLA_TOOLTIP_DEFAULT_CLASS`: this tooltip is
|
|
39
39
|
* hoisted out of the tag, and that class's rule is scoped under `.ProseMirror` — see
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "25.0
|
|
3
|
+
"version": "25.1.0",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"@atlaskit/editor-plugin-limited-mode": "^24.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-user-intent": "^25.0.0",
|
|
36
36
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
37
|
-
"@atlaskit/editor-shared-styles": "^4.
|
|
37
|
+
"@atlaskit/editor-shared-styles": "^4.5.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
|
-
"@atlaskit/primitives": "^22.
|
|
41
|
+
"@atlaskit/primitives": "^22.6.0",
|
|
42
42
|
"@atlaskit/tmp-editor-statsig": "^240.0.0",
|
|
43
43
|
"@atlaskit/tokens": "^20.6.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"@atlassian/confluence-presets": "workspace:^",
|
|
65
65
|
"@atlassian/content-reconciliation": "^0.1.3506",
|
|
66
66
|
"@atlassian/editor-ai-injected-editors": "^41.0.0",
|
|
67
|
-
"@atlassian/editor-plugin-ai": "^81.
|
|
67
|
+
"@atlassian/editor-plugin-ai": "^81.3.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": "^131.
|
|
74
|
+
"@atlaskit/editor-common": "^131.6.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"
|