@atlaskit/editor-plugin-show-diff 15.0.0 → 15.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/afm-cc/tsconfig.json +0 -12
- package/afm-products/tsconfig.json +0 -12
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +131 -79
- package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +32 -0
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +87 -25
- package/dist/cjs/pm-plugins/decorations/createContributorTagWidget.js +27 -4
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +17 -3
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +5 -3
- package/dist/cjs/pm-plugins/decorations/extractContributorTags.js +43 -14
- package/dist/cjs/pm-plugins/decorations/revealStyles.js +156 -0
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +25 -5
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +4 -2
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +2 -1
- package/dist/cjs/pm-plugins/main.js +28 -10
- package/dist/cjs/pm-plugins/resolveDiffContributors.js +4 -0
- package/dist/cjs/pm-plugins/revealAnimation.js +524 -0
- package/dist/cjs/showDiffPlugin.js +42 -7
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +59 -9
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +30 -0
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +62 -4
- package/dist/es2019/pm-plugins/decorations/createContributorTagWidget.js +25 -3
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +18 -1
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +5 -3
- package/dist/es2019/pm-plugins/decorations/extractContributorTags.js +36 -9
- package/dist/es2019/pm-plugins/decorations/revealStyles.js +139 -0
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +25 -6
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +6 -3
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +5 -2
- package/dist/es2019/pm-plugins/main.js +28 -9
- package/dist/es2019/pm-plugins/resolveDiffContributors.js +4 -0
- package/dist/es2019/pm-plugins/revealAnimation.js +495 -0
- package/dist/es2019/showDiffPlugin.js +37 -7
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +131 -79
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +30 -0
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +87 -25
- package/dist/esm/pm-plugins/decorations/createContributorTagWidget.js +27 -4
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +17 -3
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +5 -3
- package/dist/esm/pm-plugins/decorations/extractContributorTags.js +43 -14
- package/dist/esm/pm-plugins/decorations/revealStyles.js +149 -0
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +25 -5
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +4 -2
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +2 -1
- package/dist/esm/pm-plugins/main.js +28 -10
- package/dist/esm/pm-plugins/resolveDiffContributors.js +4 -0
- package/dist/esm/pm-plugins/revealAnimation.js +518 -0
- package/dist/esm/showDiffPlugin.js +42 -7
- package/dist/types/entry-points/show-diff-plugin-type.d.ts +1 -1
- package/dist/types/pm-plugins/calculateDiff/calculateDiffDecorations.d.ts +2 -1
- package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +24 -0
- package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.d.ts +5 -1
- package/dist/types/pm-plugins/decorations/createContributorTagWidget.d.ts +9 -3
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.d.ts +3 -2
- package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +3 -2
- package/dist/types/pm-plugins/decorations/revealStyles.d.ts +49 -0
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +4 -3
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +6 -1
- package/dist/types/pm-plugins/revealAnimation.d.ts +33 -0
- package/dist/types/showDiffPluginType.d.ts +29 -1
- package/package.json +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 15.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`857fbb1c07b89`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/857fbb1c07b89) -
|
|
8
|
+
[ux] Show a contributor tag at the top left of changed block nodes (panel, quote, expand, media,
|
|
9
|
+
rule, block card, embed card, code block, extension, bodied extension, multi bodied extension),
|
|
10
|
+
behind `confluence_ncs_step_diffing_version_history`. One tag per block: a highlight inside a
|
|
11
|
+
changed block folds into the block's tag, and a change confined to a code block is tagged outside
|
|
12
|
+
the block so it is not clipped. Tables are excluded.
|
|
13
|
+
- [`236af9e62ab32`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/236af9e62ab32) -
|
|
14
|
+
[ux] Suppress contributor tags when contributorProfiles is omitted, preserving attribution colours
|
|
15
|
+
behind confluence_ncs_step_diffing_version_history and
|
|
16
|
+
platform_editor_show_diff_color_scheme_refactor.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
19
|
+
## 15.1.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- [`d678fef8a856c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d678fef8a856c) -
|
|
24
|
+
Hide pure deletions in the clean diff view behind platform_editor_diff_hide_pure_deletions
|
|
25
|
+
- [`d678fef8a856c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d678fef8a856c) -
|
|
26
|
+
Animate the transition into the diff view behind platform_editor_diff_reveal_animation
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies
|
|
31
|
+
|
|
32
|
+
## 15.0.1
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Updated dependencies
|
|
37
|
+
|
|
3
38
|
## 15.0.0
|
|
4
39
|
|
|
5
40
|
### Minor Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -41,12 +41,6 @@
|
|
|
41
41
|
{
|
|
42
42
|
"path": "../../editor-tables/afm-cc/tsconfig.json"
|
|
43
43
|
},
|
|
44
|
-
{
|
|
45
|
-
"path": "../../../design-system/icon-lab/afm-cc/tsconfig.json"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"path": "../../../design-system/logo/afm-cc/tsconfig.json"
|
|
49
|
-
},
|
|
50
44
|
{
|
|
51
45
|
"path": "../../../platform/feature-experiments/afm-cc/tsconfig.json"
|
|
52
46
|
},
|
|
@@ -62,12 +56,6 @@
|
|
|
62
56
|
{
|
|
63
57
|
"path": "../../../design-system/tokens/afm-cc/tsconfig.json"
|
|
64
58
|
},
|
|
65
|
-
{
|
|
66
|
-
"path": "../../../design-system/tooltip/afm-cc/tsconfig.json"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"path": "../../../design-system/visually-hidden/afm-cc/tsconfig.json"
|
|
70
|
-
},
|
|
71
59
|
{
|
|
72
60
|
"path": "../../editor-common/afm-cc/tsconfig.json"
|
|
73
61
|
}
|
|
@@ -41,12 +41,6 @@
|
|
|
41
41
|
{
|
|
42
42
|
"path": "../../editor-tables/afm-products/tsconfig.json"
|
|
43
43
|
},
|
|
44
|
-
{
|
|
45
|
-
"path": "../../../design-system/icon-lab/afm-products/tsconfig.json"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"path": "../../../design-system/logo/afm-products/tsconfig.json"
|
|
49
|
-
},
|
|
50
44
|
{
|
|
51
45
|
"path": "../../../platform/feature-experiments/afm-products/tsconfig.json"
|
|
52
46
|
},
|
|
@@ -62,12 +56,6 @@
|
|
|
62
56
|
{
|
|
63
57
|
"path": "../../../design-system/tokens/afm-products/tsconfig.json"
|
|
64
58
|
},
|
|
65
|
-
{
|
|
66
|
-
"path": "../../../design-system/tooltip/afm-products/tsconfig.json"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"path": "../../../design-system/visually-hidden/afm-products/tsconfig.json"
|
|
70
|
-
},
|
|
71
59
|
{
|
|
72
60
|
"path": "../../editor-common/afm-products/tsconfig.json"
|
|
73
61
|
}
|
|
@@ -177,7 +177,8 @@ var isInsideTable = function isInsideTable(tables, pos) {
|
|
|
177
177
|
});
|
|
178
178
|
};
|
|
179
179
|
var calculateNodesForBlockDecoration = function calculateNodesForBlockDecoration(_ref5) {
|
|
180
|
-
var
|
|
180
|
+
var attributionKey = _ref5.attributionKey,
|
|
181
|
+
doc = _ref5.doc,
|
|
181
182
|
from = _ref5.from,
|
|
182
183
|
to = _ref5.to,
|
|
183
184
|
colorScheme = _ref5.colorScheme,
|
|
@@ -186,11 +187,14 @@ var calculateNodesForBlockDecoration = function calculateNodesForBlockDecoration
|
|
|
186
187
|
activeIndexPos = _ref5.activeIndexPos,
|
|
187
188
|
_ref5$shouldHideDelet = _ref5.shouldHideDeleted,
|
|
188
189
|
shouldHideDeleted = _ref5$shouldHideDelet === void 0 ? false : _ref5$shouldHideDelet,
|
|
190
|
+
_ref5$showContributor = _ref5.showContributorTags,
|
|
191
|
+
showContributorTags = _ref5$showContributor === void 0 ? false : _ref5$showContributor,
|
|
189
192
|
_ref5$showIndicators = _ref5.showIndicators,
|
|
190
193
|
showIndicators = _ref5$showIndicators === void 0 ? false : _ref5$showIndicators,
|
|
191
194
|
diffType = _ref5.diffType,
|
|
192
195
|
_ref5$coarseTableCell = _ref5.coarseTableCellsOnly,
|
|
193
|
-
coarseTableCellsOnly = _ref5$coarseTableCell === void 0 ? false : _ref5$coarseTableCell
|
|
196
|
+
coarseTableCellsOnly = _ref5$coarseTableCell === void 0 ? false : _ref5$coarseTableCell,
|
|
197
|
+
tagMountContext = _ref5.tagMountContext;
|
|
194
198
|
var decorations = [];
|
|
195
199
|
// Coarse path: inside the large table, only cell/header overlays are kept — the
|
|
196
200
|
// table/row/paragraph decorations there are redundant and cause expensive per-cell
|
|
@@ -208,6 +212,7 @@ var calculateNodesForBlockDecoration = function calculateNodesForBlockDecoration
|
|
|
208
212
|
var nodeEnd = pos + node.nodeSize;
|
|
209
213
|
var isActive = isRangeActive(activeIndexPos, pos, nodeEnd);
|
|
210
214
|
decorations.push.apply(decorations, (0, _toConsumableArray2.default)((0, _createBlockChangedDecoration.createBlockChangedDecoration)({
|
|
215
|
+
attributionKey: attributionKey,
|
|
211
216
|
change: {
|
|
212
217
|
from: pos,
|
|
213
218
|
to: nodeEnd,
|
|
@@ -217,9 +222,11 @@ var calculateNodesForBlockDecoration = function calculateNodesForBlockDecoration
|
|
|
217
222
|
isInserted: isInserted,
|
|
218
223
|
isActive: isActive,
|
|
219
224
|
shouldHideDeleted: shouldHideDeleted,
|
|
225
|
+
showContributorTags: showContributorTags,
|
|
220
226
|
showIndicators: showIndicators,
|
|
221
227
|
doc: doc,
|
|
222
|
-
diffType: diffType
|
|
228
|
+
diffType: diffType,
|
|
229
|
+
tagMountContext: tagMountContext
|
|
223
230
|
})));
|
|
224
231
|
}
|
|
225
232
|
});
|
|
@@ -248,30 +255,51 @@ var isDeletedContentPlacedBelow = exports.isDeletedContentPlacedBelow = function
|
|
|
248
255
|
// Inline-level (undefined) and sentence-level changes.
|
|
249
256
|
return inlineDeletedDiffPlacement === 'after';
|
|
250
257
|
};
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Single place `platform_editor_diff_hide_pure_deletions` is read, shared by the widget-anchor
|
|
261
|
+
* calculation and the decoration push below so the two cannot drift.
|
|
262
|
+
*
|
|
263
|
+
* The clean view ("new state") historically only suppressed a deleted side when the same change
|
|
264
|
+
* also carried an insertion. A PURE deletion — text removed with nothing put in its place — fell
|
|
265
|
+
* through and leaked struck-through text into a view that is supposed to show none. `smart` never
|
|
266
|
+
* showed this because it pairs a rewrite into a single change that always carries an insertion;
|
|
267
|
+
* `inline` emits delete-only changes, so it did.
|
|
268
|
+
*
|
|
269
|
+
* With the gate off this returns exactly what both callers computed before it existed.
|
|
270
|
+
*/
|
|
271
|
+
var shouldHideDeletedSide = function shouldHideDeletedSide(_ref7) {
|
|
272
|
+
var change = _ref7.change,
|
|
273
|
+
diffType = _ref7.diffType,
|
|
274
|
+
hideDeletedDiffs = _ref7.hideDeletedDiffs,
|
|
275
|
+
isInverted = _ref7.isInverted;
|
|
276
|
+
return (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && !isInverted && !!hideDeletedDiffs && (change.inserted.length > 0 || (0, _fg.fg)('platform_editor_diff_hide_pure_deletions'));
|
|
277
|
+
};
|
|
278
|
+
var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8) {
|
|
279
|
+
var state = _ref8.state,
|
|
280
|
+
pluginState = _ref8.pluginState,
|
|
281
|
+
nodeViewSerializer = _ref8.nodeViewSerializer,
|
|
282
|
+
colorScheme = _ref8.colorScheme,
|
|
283
|
+
intl = _ref8.intl,
|
|
284
|
+
activeIndexPos = _ref8.activeIndexPos,
|
|
285
|
+
api = _ref8.api,
|
|
286
|
+
_ref8$isInverted = _ref8.isInverted,
|
|
287
|
+
isInverted = _ref8$isInverted === void 0 ? false : _ref8$isInverted,
|
|
288
|
+
_ref8$diffType = _ref8.diffType,
|
|
289
|
+
diffType = _ref8$diffType === void 0 ? (0, _isExtendedEnabled.getDefaultDiffType)() : _ref8$diffType,
|
|
290
|
+
_ref8$hideDeletedDiff = _ref8.hideDeletedDiffs,
|
|
291
|
+
hideDeletedDiffs = _ref8$hideDeletedDiff === void 0 ? false : _ref8$hideDeletedDiff,
|
|
292
|
+
_ref8$hideAddedDiffsU = _ref8.hideAddedDiffsUnderline,
|
|
293
|
+
hideAddedDiffsUnderlineParam = _ref8$hideAddedDiffsU === void 0 ? false : _ref8$hideAddedDiffsU,
|
|
294
|
+
_ref8$showIndicators = _ref8.showIndicators,
|
|
295
|
+
showIndicators = _ref8$showIndicators === void 0 ? false : _ref8$showIndicators,
|
|
296
|
+
smartThresholds = _ref8.smartThresholds,
|
|
297
|
+
_ref8$deletedDiffPlac = _ref8.deletedDiffPlacement,
|
|
298
|
+
deletedDiffPlacement = _ref8$deletedDiffPlac === void 0 ? 'top' : _ref8$deletedDiffPlac,
|
|
299
|
+
_ref8$inlineDeletedDi = _ref8.inlineDeletedDiffPlacement,
|
|
300
|
+
inlineDeletedDiffPlacement = _ref8$inlineDeletedDi === void 0 ? 'before' : _ref8$inlineDeletedDi,
|
|
301
|
+
reveal = _ref8.reveal,
|
|
302
|
+
tagMountContext = _ref8.tagMountContext;
|
|
275
303
|
var originalDoc = pluginState.originalDoc,
|
|
276
304
|
steps = pluginState.steps,
|
|
277
305
|
stepAttributions = pluginState.stepAttributions,
|
|
@@ -298,12 +326,12 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref7
|
|
|
298
326
|
var simplifiedStepAttributions = [];
|
|
299
327
|
if (attributedChangesetEnabled) {
|
|
300
328
|
var simplifiedStepsWithAttribution = (0, _simplifySteps.simplifyStepsWithAttribution)(steps, stepAttributions !== null && stepAttributions !== void 0 ? stepAttributions : [], originalDoc);
|
|
301
|
-
simplifiedSteps = simplifiedStepsWithAttribution.map(function (
|
|
302
|
-
var step =
|
|
329
|
+
simplifiedSteps = simplifiedStepsWithAttribution.map(function (_ref9) {
|
|
330
|
+
var step = _ref9.step;
|
|
303
331
|
return step;
|
|
304
332
|
});
|
|
305
|
-
simplifiedStepAttributions = simplifiedStepsWithAttribution.map(function (
|
|
306
|
-
var stepAttribution =
|
|
333
|
+
simplifiedStepAttributions = simplifiedStepsWithAttribution.map(function (_ref0) {
|
|
334
|
+
var stepAttribution = _ref0.stepAttribution;
|
|
307
335
|
return stepAttribution;
|
|
308
336
|
});
|
|
309
337
|
} else {
|
|
@@ -337,11 +365,11 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref7
|
|
|
337
365
|
} finally {
|
|
338
366
|
_iterator.f();
|
|
339
367
|
}
|
|
340
|
-
var attrStepContexts = (0, _fg.fg)('platform_editor_reduce_diff_attr_sensitivity') ? pendingAttrSteps.flatMap(function (
|
|
341
|
-
var afterNode =
|
|
342
|
-
beforeNode =
|
|
343
|
-
mapIndex =
|
|
344
|
-
step =
|
|
368
|
+
var attrStepContexts = (0, _fg.fg)('platform_editor_reduce_diff_attr_sensitivity') ? pendingAttrSteps.flatMap(function (_ref1) {
|
|
369
|
+
var afterNode = _ref1.afterNode,
|
|
370
|
+
beforeNode = _ref1.beforeNode,
|
|
371
|
+
mapIndex = _ref1.mapIndex,
|
|
372
|
+
step = _ref1.step;
|
|
345
373
|
var finalPosition = new _transform.Mapping(stepMaps.slice(mapIndex + 1)).mapResult(step.pos);
|
|
346
374
|
if (finalPosition.deleted) {
|
|
347
375
|
return [];
|
|
@@ -356,8 +384,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref7
|
|
|
356
384
|
}), {}, {
|
|
357
385
|
step: step
|
|
358
386
|
})];
|
|
359
|
-
}) : pendingAttrSteps.map(function (
|
|
360
|
-
var step =
|
|
387
|
+
}) : pendingAttrSteps.map(function (_ref10) {
|
|
388
|
+
var step = _ref10.step;
|
|
361
389
|
return {
|
|
362
390
|
afterNode: tr.doc.nodeAt(step.pos),
|
|
363
391
|
beforeNode: originalDoc.nodeAt(step.pos),
|
|
@@ -494,7 +522,12 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref7
|
|
|
494
522
|
// change. Used to decide if indicator anchor positions should be adjusted
|
|
495
523
|
// inward — when the widget is present the anchor must stay at the block
|
|
496
524
|
// boundary to keep the indicator bar continuous with the deleted content.
|
|
497
|
-
var willRenderDeletedWidget = change.deleted.length > 0 && !isMarkOnly && !(
|
|
525
|
+
var willRenderDeletedWidget = change.deleted.length > 0 && !isMarkOnly && !shouldHideDeletedSide({
|
|
526
|
+
change: change,
|
|
527
|
+
diffType: diffType,
|
|
528
|
+
hideDeletedDiffs: hideDeletedDiffs,
|
|
529
|
+
isInverted: isInverted
|
|
530
|
+
});
|
|
498
531
|
if (isSmartNodeLevel) {
|
|
499
532
|
// For a large inserted table, skip the O(cells) inline decorations inside the
|
|
500
533
|
// table (the cell overlays added below provide the highlight without the
|
|
@@ -528,6 +561,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref7
|
|
|
528
561
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
529
562
|
hasDeletedWidget: willRenderDeletedWidget,
|
|
530
563
|
isDeletedWidgetBelow: isDeletedWidgetBelow,
|
|
564
|
+
reveal: reveal,
|
|
531
565
|
tagMountContext: tagMountContext
|
|
532
566
|
}))));
|
|
533
567
|
}
|
|
@@ -552,10 +586,12 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref7
|
|
|
552
586
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
553
587
|
hasDeletedWidget: willRenderDeletedWidget,
|
|
554
588
|
isDeletedWidgetBelow: isDeletedWidgetBelow,
|
|
589
|
+
reveal: reveal,
|
|
555
590
|
tagMountContext: tagMountContext
|
|
556
591
|
}))));
|
|
557
592
|
}
|
|
558
593
|
decorations.push.apply(decorations, (0, _toConsumableArray2.default)(calculateNodesForBlockDecoration(_objectSpread(_objectSpread({
|
|
594
|
+
attributionKey: attributionKey,
|
|
559
595
|
doc: tr.doc,
|
|
560
596
|
from: change.fromB,
|
|
561
597
|
to: change.toB,
|
|
@@ -563,7 +599,9 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref7
|
|
|
563
599
|
}, (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && {
|
|
564
600
|
isInserted: isInserted,
|
|
565
601
|
shouldHideDeleted: shouldHideDeleted,
|
|
566
|
-
|
|
602
|
+
showContributorTags: showContributorTags,
|
|
603
|
+
showIndicators: showIndicators,
|
|
604
|
+
tagMountContext: tagMountContext
|
|
567
605
|
}), {}, {
|
|
568
606
|
activeIndexPos: activeIndexPos,
|
|
569
607
|
intl: intl,
|
|
@@ -572,11 +610,19 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref7
|
|
|
572
610
|
}))));
|
|
573
611
|
}
|
|
574
612
|
if (change.deleted.length > 0 && !isMarkOnly) {
|
|
575
|
-
var _shouldHideDeleted = (
|
|
613
|
+
var _shouldHideDeleted = shouldHideDeletedSide({
|
|
614
|
+
change: change,
|
|
615
|
+
diffType: diffType,
|
|
616
|
+
hideDeletedDiffs: hideDeletedDiffs,
|
|
617
|
+
isInverted: isInverted
|
|
618
|
+
});
|
|
576
619
|
if (!_shouldHideDeleted) {
|
|
577
620
|
decorations.push.apply(decorations, (0, _toConsumableArray2.default)((0, _createNodeChangedDecorationWidget.createNodeChangedDecorationWidget)(_objectSpread(_objectSpread({
|
|
578
621
|
// The deleted side has no inline decoration, so the widget carries the actor.
|
|
579
622
|
attributionKey: attributionKey,
|
|
623
|
+
// Extended pipeline only, matching the inline path: the non-extended styles have no
|
|
624
|
+
// background for the wipe to act on.
|
|
625
|
+
reveal: (0, _isExtendedEnabled.isExtendedEnabled)(diffType) ? reveal : undefined,
|
|
580
626
|
change: change,
|
|
581
627
|
doc: originalDoc,
|
|
582
628
|
nodeViewSerializer: nodeViewSerializer,
|
|
@@ -604,9 +650,9 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref7
|
|
|
604
650
|
// smart path. Only add the legacy step-range decoration when no equivalent changeset range was
|
|
605
651
|
// produced; otherwise the same content receives two inline decorations (and two navigation
|
|
606
652
|
// changes), usually one attribution colour and one default purple decoration.
|
|
607
|
-
(0, _getMarkChangeRanges.getMarkChangeRanges)(steps).filter(function (
|
|
608
|
-
var fromB =
|
|
609
|
-
toB =
|
|
653
|
+
(0, _getMarkChangeRanges.getMarkChangeRanges)(steps).filter(function (_ref11) {
|
|
654
|
+
var fromB = _ref11.fromB,
|
|
655
|
+
toB = _ref11.toB;
|
|
610
656
|
return !(0, _fg.fg)('confluence_ncs_step_diffing_version_history') || !changes.some(function (change) {
|
|
611
657
|
return change.fromB === fromB && change.toB === toB;
|
|
612
658
|
});
|
|
@@ -617,7 +663,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref7
|
|
|
617
663
|
colorScheme: colorScheme,
|
|
618
664
|
diffType: diffType,
|
|
619
665
|
isActive: isActive,
|
|
620
|
-
isInserted: true
|
|
666
|
+
isInserted: true,
|
|
667
|
+
reveal: reveal
|
|
621
668
|
})));
|
|
622
669
|
});
|
|
623
670
|
(0, _getAttrChangeRanges.getAttrChangeRanges)(tr.doc, attrStepContexts, originalDoc).forEach(function (change) {
|
|
@@ -707,44 +754,49 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref7
|
|
|
707
754
|
var calculateDiffDecorations = exports.calculateDiffDecorations = (0, _memoizeOne.default)(calculateDiffDecorationsInner,
|
|
708
755
|
// Cache results unless relevant inputs change. `tagMountContext` is deliberately absent: it is
|
|
709
756
|
// built once per plugin instance, so it can never be the reason a diff needs recalculating.
|
|
710
|
-
function (
|
|
711
|
-
var
|
|
712
|
-
var _ref13 = (0, _slicedToArray2.default)(_ref11, 1),
|
|
713
|
-
_ref13$ = _ref13[0],
|
|
714
|
-
pluginState = _ref13$.pluginState,
|
|
715
|
-
state = _ref13$.state,
|
|
716
|
-
colorScheme = _ref13$.colorScheme,
|
|
717
|
-
intl = _ref13$.intl,
|
|
718
|
-
activeIndexPos = _ref13$.activeIndexPos,
|
|
719
|
-
isInverted = _ref13$.isInverted,
|
|
720
|
-
diffType = _ref13$.diffType,
|
|
721
|
-
hideDeletedDiffs = _ref13$.hideDeletedDiffs,
|
|
722
|
-
hideAddedDiffsUnderline = _ref13$.hideAddedDiffsUnderline,
|
|
723
|
-
showIndicators = _ref13$.showIndicators,
|
|
724
|
-
smartThresholds = _ref13$.smartThresholds,
|
|
725
|
-
deletedDiffPlacement = _ref13$.deletedDiffPlacement,
|
|
726
|
-
inlineDeletedDiffPlacement = _ref13$.inlineDeletedDiffPlacement;
|
|
757
|
+
function (_ref12, _ref13) {
|
|
758
|
+
var _ref17;
|
|
727
759
|
var _ref14 = (0, _slicedToArray2.default)(_ref12, 1),
|
|
728
760
|
_ref14$ = _ref14[0],
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
761
|
+
pluginState = _ref14$.pluginState,
|
|
762
|
+
state = _ref14$.state,
|
|
763
|
+
colorScheme = _ref14$.colorScheme,
|
|
764
|
+
intl = _ref14$.intl,
|
|
765
|
+
activeIndexPos = _ref14$.activeIndexPos,
|
|
766
|
+
isInverted = _ref14$.isInverted,
|
|
767
|
+
diffType = _ref14$.diffType,
|
|
768
|
+
hideDeletedDiffs = _ref14$.hideDeletedDiffs,
|
|
769
|
+
hideAddedDiffsUnderline = _ref14$.hideAddedDiffsUnderline,
|
|
770
|
+
showIndicators = _ref14$.showIndicators,
|
|
771
|
+
smartThresholds = _ref14$.smartThresholds,
|
|
772
|
+
deletedDiffPlacement = _ref14$.deletedDiffPlacement,
|
|
773
|
+
inlineDeletedDiffPlacement = _ref14$.inlineDeletedDiffPlacement,
|
|
774
|
+
reveal = _ref14$.reveal;
|
|
775
|
+
var _ref15 = (0, _slicedToArray2.default)(_ref13, 1),
|
|
776
|
+
_ref15$ = _ref15[0],
|
|
777
|
+
lastPluginState = _ref15$.pluginState,
|
|
778
|
+
lastState = _ref15$.state,
|
|
779
|
+
lastColorScheme = _ref15$.colorScheme,
|
|
780
|
+
lastIntl = _ref15$.intl,
|
|
781
|
+
lastActiveIndexPos = _ref15$.activeIndexPos,
|
|
782
|
+
lastIsInverted = _ref15$.isInverted,
|
|
783
|
+
lastDiffType = _ref15$.diffType,
|
|
784
|
+
lastHideDeletedDiffs = _ref15$.hideDeletedDiffs,
|
|
785
|
+
lastHideAddedDiffsUnderline = _ref15$.hideAddedDiffsUnderline,
|
|
786
|
+
lastShowIndicators = _ref15$.showIndicators,
|
|
787
|
+
lastSmartThresholds = _ref15$.smartThresholds,
|
|
788
|
+
lastDeletedDiffPlacement = _ref15$.deletedDiffPlacement,
|
|
789
|
+
lastInlineDeletedDiffPlacement = _ref15$.inlineDeletedDiffPlacement,
|
|
790
|
+
lastReveal = _ref15$.reveal;
|
|
742
791
|
var originalDocIsSame = lastPluginState.originalDoc && pluginState.originalDoc && pluginState.originalDoc.eq(lastPluginState.originalDoc);
|
|
743
792
|
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
744
|
-
var
|
|
745
|
-
return (
|
|
793
|
+
var _ref16;
|
|
794
|
+
return (_ref16 = colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isInverted === lastIsInverted && diffType === lastDiffType && (0, _isEqual.default)(activeIndexPos, lastActiveIndexPos) && originalDocIsSame && (0, _isEqual.default)(pluginState.steps, lastPluginState.steps) && (0, _isEqual.default)(pluginState.stepAttributions, lastPluginState.stepAttributions) &&
|
|
746
795
|
// Contributors can arrive after the first calculation; without this, tags never appear.
|
|
747
|
-
(0, _isEqual.default)(pluginState.contributors, lastPluginState.contributors) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && hideAddedDiffsUnderline === lastHideAddedDiffsUnderline && showIndicators === lastShowIndicators && (0, _isEqual.default)(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement && inlineDeletedDiffPlacement === lastInlineDeletedDiffPlacement
|
|
796
|
+
(0, _isEqual.default)(pluginState.contributors, lastPluginState.contributors) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && hideAddedDiffsUnderline === lastHideAddedDiffsUnderline && showIndicators === lastShowIndicators && (0, _isEqual.default)(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement && inlineDeletedDiffPlacement === lastInlineDeletedDiffPlacement &&
|
|
797
|
+
// Turning the reveal on or off changes the emitted styles, so a cached result from the
|
|
798
|
+
// other setting would leave the diff painted in the wrong resting state.
|
|
799
|
+
(0, _isEqual.default)(reveal, lastReveal)) !== null && _ref16 !== void 0 ? _ref16 : false;
|
|
748
800
|
}
|
|
749
|
-
return (
|
|
801
|
+
return (_ref17 = originalDocIsSame && (0, _isEqual.default)(pluginState.steps, lastPluginState.steps) && (0, _isEqual.default)(pluginState.stepAttributions, lastPluginState.stepAttributions) && (0, _isEqual.default)(pluginState.contributors, lastPluginState.contributors) && state.doc.eq(lastState.doc) && colorScheme === lastColorScheme && intl.locale === lastIntl.locale && (0, _isEqual.default)(activeIndexPos, lastActiveIndexPos) && hideDeletedDiffs === lastHideDeletedDiffs) !== null && _ref17 !== void 0 ? _ref17 : false;
|
|
750
802
|
});
|
|
@@ -66,6 +66,8 @@ exports.buildInsertStyleRuleNodeNew = buildInsertStyleRuleNodeNew;
|
|
|
66
66
|
exports.buildInsertedBlockNodeStyle = buildInsertedBlockNodeStyle;
|
|
67
67
|
exports.buildInsertedInlineStyle = buildInsertedInlineStyle;
|
|
68
68
|
exports.getAccentTokens = getAccentTokens;
|
|
69
|
+
exports.getDeletedInlineRevealColors = getDeletedInlineRevealColors;
|
|
70
|
+
exports.getInsertedInlineRevealColors = getInsertedInlineRevealColors;
|
|
69
71
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
70
72
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
71
73
|
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; }
|
|
@@ -750,6 +752,36 @@ function buildInsertedInlineStyle(colors, isActive, hideAddedDiffsUnderline) {
|
|
|
750
752
|
return hideAddedDiffsUnderline ? buildInsertStyleExtendedNoUnderline(colors) : buildInsertStyleExtended(colors);
|
|
751
753
|
}
|
|
752
754
|
|
|
755
|
+
/**
|
|
756
|
+
* The colours `buildInsertedInlineStyle()` above would paint, for the reveal to animate towards.
|
|
757
|
+
*
|
|
758
|
+
* MUST mirror that function: the reveal replaces the flat highlight with a sized gradient, so a
|
|
759
|
+
* divergence here means the animation settles on a different colour than a static render produces.
|
|
760
|
+
* `revealStyles.ts` in the test package asserts the two agree across the isActive /
|
|
761
|
+
* hideAddedDiffsUnderline matrix.
|
|
762
|
+
*
|
|
763
|
+
* A transparent border is how "no underline" is expressed: the box still reserves the 2px so the
|
|
764
|
+
* text does not shift when the underline arrives.
|
|
765
|
+
*/
|
|
766
|
+
function getInsertedInlineRevealColors(colors, isActive, hideAddedDiffsUnderline) {
|
|
767
|
+
return {
|
|
768
|
+
background: isActive ? bgSubtlerPressed(colors.insertActiveColor) : bgSubtlest(colors.insertColor),
|
|
769
|
+
border: hideAddedDiffsUnderline ? 'transparent' : borderAccent(colors.insertColor)
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* The colours `buildDeletedInlineContentStyleExtended()` paints, for the reveal to animate towards.
|
|
775
|
+
* Deleted content's highlight does not vary with the active state — only its text does, which the
|
|
776
|
+
* reveal keeps as-is.
|
|
777
|
+
*/
|
|
778
|
+
function getDeletedInlineRevealColors(colors) {
|
|
779
|
+
return {
|
|
780
|
+
background: bgSubtlest(colors.deleteColor),
|
|
781
|
+
border: borderAccent(colors.deleteColor)
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
|
|
753
785
|
/** The three visual states deleted inline content can be in. */
|
|
754
786
|
|
|
755
787
|
/**
|
|
@@ -8,12 +8,14 @@ exports.createBlockChangedDecoration = void 0;
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
11
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
12
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
13
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
14
|
var _isExtendedEnabled = require("../isExtendedEnabled");
|
|
14
15
|
var _factory = require("./colorSchemes/factory");
|
|
15
16
|
var _schemes = require("./colorSchemes/schemes");
|
|
16
17
|
var _createAnchorDecorationWidgets = require("./createAnchorDecorationWidgets");
|
|
18
|
+
var _createContributorTagWidget = require("./createContributorTagWidget");
|
|
17
19
|
var _decorationKeys = require("./decorationKeys");
|
|
18
20
|
var _createBlockChangedDecorationStyles = require("./createBlockChangedDecoration.styles.legacy");
|
|
19
21
|
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; }
|
|
@@ -31,6 +33,29 @@ var UNSTYLED_NODES = ['mediaSingle', 'mediaGroup', 'table',
|
|
|
31
33
|
'heading', 'hardBreak', 'decisionList', 'taskList', 'bulletList', 'orderedList', 'layoutSection'];
|
|
32
34
|
var CELL_NODES = ['tableCell', 'tableHeader'];
|
|
33
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Block nodes that host a contributor tag of their own — those whose whole box reads as one change.
|
|
38
|
+
* Lists and tables are excluded: they decorate per item and per cell, with no one-tag-per-block
|
|
39
|
+
* design yet. `blockCard` covers the datasource variant, which is the same node type.
|
|
40
|
+
*/
|
|
41
|
+
var TAGGABLE_BLOCK_NODES = new Set(['blockCard', 'blockquote', 'bodiedExtension', 'codeBlock', 'embedCard', 'expand', 'extension', 'media', 'multiBodiedExtension', 'panel', 'rule']);
|
|
42
|
+
|
|
43
|
+
/** Panels, rules and media can also sit in a table cell, which is out of scope for block tags. */
|
|
44
|
+
var isInsideTable = function isInsideTable(doc, pos) {
|
|
45
|
+
return (0, _utils.findParentNodeClosestToPos)(doc.resolve(pos), function (node) {
|
|
46
|
+
return node.type.name === 'table';
|
|
47
|
+
}) !== undefined;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** Whether this block can host a contributor tag of its own. */
|
|
51
|
+
var canTagBlock = function canTagBlock(_ref) {
|
|
52
|
+
var diffType = _ref.diffType,
|
|
53
|
+
doc = _ref.doc,
|
|
54
|
+
from = _ref.from,
|
|
55
|
+
name = _ref.name;
|
|
56
|
+
return doc !== undefined && (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && TAGGABLE_BLOCK_NODES.has(name) && !isInsideTable(doc, from);
|
|
57
|
+
};
|
|
58
|
+
|
|
34
59
|
/** Positioning context for the cell overlay widget decorations. */
|
|
35
60
|
var cellPositionStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
36
61
|
position: 'relative'
|
|
@@ -77,14 +102,14 @@ var getNodeClass = function getNodeClass(name) {
|
|
|
77
102
|
return undefined;
|
|
78
103
|
}
|
|
79
104
|
};
|
|
80
|
-
var getBlockNodeStyleNext = function getBlockNodeStyleNext(
|
|
81
|
-
var nodeName =
|
|
82
|
-
colorScheme =
|
|
83
|
-
|
|
84
|
-
isInserted =
|
|
85
|
-
|
|
86
|
-
isActive =
|
|
87
|
-
diffType =
|
|
105
|
+
var getBlockNodeStyleNext = function getBlockNodeStyleNext(_ref2) {
|
|
106
|
+
var nodeName = _ref2.nodeName,
|
|
107
|
+
colorScheme = _ref2.colorScheme,
|
|
108
|
+
_ref2$isInserted = _ref2.isInserted,
|
|
109
|
+
isInserted = _ref2$isInserted === void 0 ? true : _ref2$isInserted,
|
|
110
|
+
_ref2$isActive = _ref2.isActive,
|
|
111
|
+
isActive = _ref2$isActive === void 0 ? false : _ref2$isActive,
|
|
112
|
+
diffType = _ref2.diffType;
|
|
88
113
|
if (UNSTYLED_NODES.includes(nodeName)) {
|
|
89
114
|
return undefined;
|
|
90
115
|
}
|
|
@@ -146,21 +171,33 @@ var isCellEmpty = function isCellEmpty(cellNode) {
|
|
|
146
171
|
* @param isActive Whether this node is part of the currently active/focused change
|
|
147
172
|
* @returns Prosemirror node decoration or undefined
|
|
148
173
|
*/
|
|
149
|
-
var createBlockChangedDecoration = exports.createBlockChangedDecoration = function createBlockChangedDecoration(
|
|
150
|
-
var
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
isInserted =
|
|
154
|
-
|
|
155
|
-
isActive =
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
174
|
+
var createBlockChangedDecoration = exports.createBlockChangedDecoration = function createBlockChangedDecoration(_ref3) {
|
|
175
|
+
var attributionKey = _ref3.attributionKey,
|
|
176
|
+
change = _ref3.change,
|
|
177
|
+
colorScheme = _ref3.colorScheme,
|
|
178
|
+
_ref3$isInserted = _ref3.isInserted,
|
|
179
|
+
isInserted = _ref3$isInserted === void 0 ? true : _ref3$isInserted,
|
|
180
|
+
_ref3$isActive = _ref3.isActive,
|
|
181
|
+
isActive = _ref3$isActive === void 0 ? false : _ref3$isActive,
|
|
182
|
+
_ref3$shouldHideDelet = _ref3.shouldHideDeleted,
|
|
183
|
+
shouldHideDeleted = _ref3$shouldHideDelet === void 0 ? false : _ref3$shouldHideDelet,
|
|
184
|
+
_ref3$showContributor = _ref3.showContributorTags,
|
|
185
|
+
showContributorTags = _ref3$showContributor === void 0 ? false : _ref3$showContributor,
|
|
186
|
+
_ref3$showIndicators = _ref3.showIndicators,
|
|
187
|
+
showIndicators = _ref3$showIndicators === void 0 ? false : _ref3$showIndicators,
|
|
188
|
+
doc = _ref3.doc,
|
|
189
|
+
diffType = _ref3.diffType,
|
|
190
|
+
tagMountContext = _ref3.tagMountContext;
|
|
162
191
|
var decorations = [];
|
|
163
|
-
|
|
192
|
+
// Derived from the node range so it survives a recalculation, as in
|
|
193
|
+
// `createInlineChangedDecoration`. Changes are disjoint, so no two of them decorate one node.
|
|
194
|
+
var diffId = showContributorTags ? "block-".concat(change.from, "-").concat(change.to) : crypto.randomUUID();
|
|
195
|
+
var shouldTagBlock = showContributorTags && canTagBlock({
|
|
196
|
+
diffType: diffType,
|
|
197
|
+
doc: doc,
|
|
198
|
+
from: change.from,
|
|
199
|
+
name: change.name
|
|
200
|
+
});
|
|
164
201
|
if (shouldHideDeleted) {
|
|
165
202
|
return [_view.Decoration.node(change.from, change.to, {
|
|
166
203
|
style: displayNoneStyle
|
|
@@ -206,19 +243,27 @@ var createBlockChangedDecoration = exports.createBlockChangedDecoration = functi
|
|
|
206
243
|
});
|
|
207
244
|
var className = getNodeClass(change.name);
|
|
208
245
|
if (style || className) {
|
|
209
|
-
decorations.push(_view.Decoration.node(change.from, change.to, {
|
|
246
|
+
decorations.push(_view.Decoration.node(change.from, change.to, _objectSpread({
|
|
210
247
|
style: style,
|
|
211
248
|
'data-testid': 'show-diff-changed-decoration-node',
|
|
212
249
|
class: className
|
|
213
|
-
},
|
|
250
|
+
}, shouldTagBlock && {
|
|
251
|
+
'data-diff-id': diffId
|
|
252
|
+
}), (0, _decorationKeys.buildDiffDecorationSpec)({
|
|
253
|
+
attributionKey: shouldTagBlock ? attributionKey : undefined,
|
|
254
|
+
colorScheme: colorScheme,
|
|
214
255
|
decorationType: 'block',
|
|
215
256
|
diffId: diffId,
|
|
216
257
|
isActive: isActive,
|
|
258
|
+
isInserted: isInserted,
|
|
217
259
|
nodeName: change.name,
|
|
218
260
|
diffType: diffType
|
|
219
261
|
})));
|
|
220
262
|
}
|
|
221
|
-
if (decorations.length
|
|
263
|
+
if (decorations.length === 0) {
|
|
264
|
+
return decorations;
|
|
265
|
+
}
|
|
266
|
+
if (showIndicators && doc && (0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
222
267
|
decorations.push.apply(decorations, (0, _toConsumableArray2.default)((0, _createAnchorDecorationWidgets.createBlockIndicatorAnchorWidgets)({
|
|
223
268
|
doc: doc,
|
|
224
269
|
from: change.from,
|
|
@@ -226,5 +271,22 @@ var createBlockChangedDecoration = exports.createBlockChangedDecoration = functi
|
|
|
226
271
|
diffId: diffId
|
|
227
272
|
})));
|
|
228
273
|
}
|
|
274
|
+
|
|
275
|
+
// `change.from` is just before the node, so the host sits outside it and the tag renders on the
|
|
276
|
+
// block's own top-left corner. Resolving inline content instead would put the host inside a
|
|
277
|
+
// container block's content DOM (panel, expand, blockquote).
|
|
278
|
+
if (shouldTagBlock && doc) {
|
|
279
|
+
var tagWidget = (0, _createContributorTagWidget.createContributorTagWidget)({
|
|
280
|
+
anchorAtRangeStart: true,
|
|
281
|
+
doc: doc,
|
|
282
|
+
from: change.from,
|
|
283
|
+
to: change.to,
|
|
284
|
+
diffId: diffId,
|
|
285
|
+
mountContext: tagMountContext
|
|
286
|
+
});
|
|
287
|
+
if (tagWidget) {
|
|
288
|
+
decorations.push(tagWidget);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
229
291
|
return decorations;
|
|
230
292
|
};
|