@atlaskit/editor-plugin-show-diff 27.0.0 → 27.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +3 -1
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +1 -1
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -3
- package/dist/cjs/pm-plugins/decorations/extractContributorTags.js +5 -0
- package/dist/cjs/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +27 -6
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +3 -1
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +1 -1
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -3
- package/dist/es2019/pm-plugins/decorations/extractContributorTags.js +5 -0
- package/dist/es2019/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +40 -22
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +3 -1
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +1 -1
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -3
- package/dist/esm/pm-plugins/decorations/extractContributorTags.js +5 -0
- package/dist/esm/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +27 -6
- package/dist/types/pm-plugins/decorations/utils/createDeletedLineBreakWidget.d.ts +4 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 27.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 27.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`4a8b1eae7cd41`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4a8b1eae7cd41) -
|
|
14
|
+
Show contributor tags on highlighted blank-line return glyphs behind
|
|
15
|
+
`confluence_ncs_step_diffing_version_history` and `platform_editor_ai_show_diff_patch_2`.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 27.0.0
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -657,10 +657,12 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
657
657
|
decorations.push((0, _createDeletedLineBreakWidget.createDeletedLineBreakDecoration)({
|
|
658
658
|
attributionKey: attributionKey,
|
|
659
659
|
colorScheme: changeColorScheme,
|
|
660
|
+
diffId: showContributorTags ? "blank-line-".concat(pos) : undefined,
|
|
660
661
|
isActive: isActive,
|
|
661
662
|
pos: pos,
|
|
662
663
|
reveal: reveal,
|
|
663
|
-
side: -1
|
|
664
|
+
side: -1,
|
|
665
|
+
tagMountContext: tagMountContext
|
|
664
666
|
}));
|
|
665
667
|
}
|
|
666
668
|
} catch (err) {
|
|
@@ -254,7 +254,7 @@ var createBlockChangedDecoration = exports.createBlockChangedDecoration = functi
|
|
|
254
254
|
}, (shouldTagBlock || (0, _fg.fg)('platform_editor_ai_show_diff_patch_2')) && {
|
|
255
255
|
'data-diff-id': diffId
|
|
256
256
|
}), (0, _decorationKeys.buildDiffDecorationSpec)({
|
|
257
|
-
attributionKey:
|
|
257
|
+
attributionKey: showContributorTags ? attributionKey : undefined,
|
|
258
258
|
colorScheme: colorScheme,
|
|
259
259
|
decorationType: 'block',
|
|
260
260
|
diffId: diffId,
|
|
@@ -201,15 +201,16 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
201
201
|
// The blocks have no content to serialize, so the deletion is shown as one struck-through
|
|
202
202
|
// return glyph per line the author removed. A single widget, not one per line: the lines are
|
|
203
203
|
// gone from `newDoc`, so they all resolve to the same anchor and separate widgets would stack.
|
|
204
|
-
//
|
|
205
|
-
// No attribution: the glyph is not a tag host, matching `canTagWidget` below.
|
|
206
204
|
return [(0, _createDeletedLineBreakWidget.createDeletedLineBreakDecoration)({
|
|
205
|
+
attributionKey: showContributorTags ? attributionKey : undefined,
|
|
207
206
|
colorScheme: colorScheme,
|
|
208
207
|
count: deletedBlankLineCount,
|
|
208
|
+
diffId: showContributorTags ? "widget-".concat(change.fromA, "-").concat(change.toA) : undefined,
|
|
209
209
|
isActive: isActive,
|
|
210
210
|
pos: safeInsertPos,
|
|
211
211
|
reveal: reveal,
|
|
212
|
-
side: placeBelow ? 1 : -1
|
|
212
|
+
side: placeBelow ? 1 : -1,
|
|
213
|
+
tagMountContext: tagMountContext
|
|
213
214
|
})];
|
|
214
215
|
}
|
|
215
216
|
if (shouldSkipDeletedEmptyParagraphDecoration) {
|
|
@@ -10,6 +10,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
12
12
|
var _baseNodeName = require("../utils/baseNodeName");
|
|
13
|
+
var _taggableBlockNodes = require("../utils/taggableBlockNodes");
|
|
13
14
|
var _decorationKeys = require("./decorationKeys");
|
|
14
15
|
var _excluded = ["connectedToKey"];
|
|
15
16
|
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; }
|
|
@@ -156,6 +157,10 @@ var extractContributorTags = exports.extractContributorTags = function extractCo
|
|
|
156
157
|
if (!spec.attributionKey || !TAGGABLE_DECORATION_TYPES.has(spec.decorationType)) {
|
|
157
158
|
continue;
|
|
158
159
|
}
|
|
160
|
+
// Attribution also serves navigation; only supported blocks can host a tag of their own.
|
|
161
|
+
if (spec.decorationType === 'block' && spec.nodeName !== undefined && !(0, _taggableBlockNodes.isTaggableBlockNodeName)(spec.nodeName)) {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
159
164
|
var contributor = contributors[spec.attributionKey];
|
|
160
165
|
if (!contributor) {
|
|
161
166
|
continue;
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createDeletedLineBreakWidget = exports.createDeletedLineBreakDecoration = exports.RETURN_GLYPH = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
10
|
+
var _createContributorTagWidget = require("../createContributorTagWidget");
|
|
10
11
|
var _decorationKeys = require("../decorationKeys");
|
|
11
12
|
var _wrapBlockNodeView = require("./wrapBlockNodeView");
|
|
12
13
|
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; }
|
|
@@ -73,21 +74,38 @@ var createDeletedLineBreakDecoration = exports.createDeletedLineBreakDecoration
|
|
|
73
74
|
var attributionKey = _ref2.attributionKey,
|
|
74
75
|
colorScheme = _ref2.colorScheme,
|
|
75
76
|
count = _ref2.count,
|
|
77
|
+
_ref2$diffId = _ref2.diffId,
|
|
78
|
+
diffId = _ref2$diffId === void 0 ? crypto.randomUUID() : _ref2$diffId,
|
|
76
79
|
_ref2$isActive = _ref2.isActive,
|
|
77
80
|
isActive = _ref2$isActive === void 0 ? false : _ref2$isActive,
|
|
78
81
|
pos = _ref2.pos,
|
|
79
82
|
reveal = _ref2.reveal,
|
|
80
|
-
side = _ref2.side
|
|
81
|
-
|
|
83
|
+
side = _ref2.side,
|
|
84
|
+
tagMountContext = _ref2.tagMountContext;
|
|
85
|
+
var dom = createDeletedLineBreakWidget({
|
|
82
86
|
colorScheme: colorScheme,
|
|
83
87
|
count: count,
|
|
84
88
|
isActive: isActive,
|
|
85
89
|
reveal: reveal
|
|
86
|
-
})
|
|
87
|
-
|
|
90
|
+
});
|
|
91
|
+
var tagHost = attributionKey ? (0, _createContributorTagWidget.createContributorTagHost)({
|
|
92
|
+
diffId: diffId,
|
|
93
|
+
mountContext: tagMountContext
|
|
94
|
+
}) : undefined;
|
|
95
|
+
if (tagHost) {
|
|
96
|
+
// Keep only the decorative glyph hidden; the contributor tag must remain accessible.
|
|
97
|
+
dom.removeAttribute('aria-hidden');
|
|
98
|
+
Array.from(dom.children).forEach(function (child) {
|
|
99
|
+
return child.setAttribute('aria-hidden', 'true');
|
|
100
|
+
});
|
|
101
|
+
dom.setAttribute('data-diff-id', diffId);
|
|
102
|
+
dom.prepend(tagHost.host);
|
|
103
|
+
}
|
|
104
|
+
return _view.Decoration.widget(pos, dom, _objectSpread(_objectSpread({}, (0, _decorationKeys.buildDiffDecorationSpec)(_objectSpread({
|
|
105
|
+
attributionKey: tagHost ? attributionKey : undefined,
|
|
88
106
|
colorScheme: colorScheme,
|
|
89
107
|
decorationType: 'widget',
|
|
90
|
-
diffId:
|
|
108
|
+
diffId: diffId,
|
|
91
109
|
isActive: isActive,
|
|
92
110
|
// The glyph always stands in for removed content, whichever side of the changeset the
|
|
93
111
|
// change itself landed on.
|
|
@@ -97,6 +115,9 @@ var createDeletedLineBreakDecoration = exports.createDeletedLineBreakDecoration
|
|
|
97
115
|
}))), {}, {
|
|
98
116
|
// Without an explicit mark set, prosemirror-view wraps the widget in the marks of the
|
|
99
117
|
// adjacent text. The glyph carries its own deleted styling and must not inherit them.
|
|
100
|
-
marks: []
|
|
118
|
+
marks: [],
|
|
119
|
+
destroy: function destroy() {
|
|
120
|
+
return (0, _createContributorTagWidget.unmountContributorTag)(tagHost === null || tagHost === void 0 ? void 0 : tagHost.mount);
|
|
121
|
+
}
|
|
101
122
|
}));
|
|
102
123
|
};
|
|
@@ -598,10 +598,12 @@ const calculateDiffDecorationsInner = ({
|
|
|
598
598
|
decorations.push(createDeletedLineBreakDecoration({
|
|
599
599
|
attributionKey,
|
|
600
600
|
colorScheme: changeColorScheme,
|
|
601
|
+
diffId: showContributorTags ? `blank-line-${pos}` : undefined,
|
|
601
602
|
isActive,
|
|
602
603
|
pos,
|
|
603
604
|
reveal,
|
|
604
|
-
side: -1
|
|
605
|
+
side: -1,
|
|
606
|
+
tagMountContext
|
|
605
607
|
}));
|
|
606
608
|
}
|
|
607
609
|
}
|
|
@@ -242,7 +242,7 @@ export const createBlockChangedDecoration = ({
|
|
|
242
242
|
'data-diff-id': diffId
|
|
243
243
|
})
|
|
244
244
|
}, buildDiffDecorationSpec({
|
|
245
|
-
attributionKey:
|
|
245
|
+
attributionKey: showContributorTags ? attributionKey : undefined,
|
|
246
246
|
colorScheme,
|
|
247
247
|
decorationType: 'block',
|
|
248
248
|
diffId,
|
|
@@ -193,15 +193,16 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
193
193
|
// The blocks have no content to serialize, so the deletion is shown as one struck-through
|
|
194
194
|
// return glyph per line the author removed. A single widget, not one per line: the lines are
|
|
195
195
|
// gone from `newDoc`, so they all resolve to the same anchor and separate widgets would stack.
|
|
196
|
-
//
|
|
197
|
-
// No attribution: the glyph is not a tag host, matching `canTagWidget` below.
|
|
198
196
|
return [createDeletedLineBreakDecoration({
|
|
197
|
+
attributionKey: showContributorTags ? attributionKey : undefined,
|
|
199
198
|
colorScheme,
|
|
200
199
|
count: deletedBlankLineCount,
|
|
200
|
+
diffId: showContributorTags ? `widget-${change.fromA}-${change.toA}` : undefined,
|
|
201
201
|
isActive,
|
|
202
202
|
pos: safeInsertPos,
|
|
203
203
|
reveal,
|
|
204
|
-
side: placeBelow ? 1 : -1
|
|
204
|
+
side: placeBelow ? 1 : -1,
|
|
205
|
+
tagMountContext
|
|
205
206
|
})];
|
|
206
207
|
}
|
|
207
208
|
if (shouldSkipDeletedEmptyParagraphDecoration) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
2
|
import { resolveBaseNodeName } from '../utils/baseNodeName';
|
|
3
|
+
import { isTaggableBlockNodeName } from '../utils/taggableBlockNodes';
|
|
3
4
|
import { isDiffDecoration, isDiffDecorationSpec } from './decorationKeys';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -120,6 +121,10 @@ export const extractContributorTags = (decorations, contributors, activeIndexPos
|
|
|
120
121
|
if (!spec.attributionKey || !TAGGABLE_DECORATION_TYPES.has(spec.decorationType)) {
|
|
121
122
|
continue;
|
|
122
123
|
}
|
|
124
|
+
// Attribution also serves navigation; only supported blocks can host a tag of their own.
|
|
125
|
+
if (spec.decorationType === 'block' && spec.nodeName !== undefined && !isTaggableBlockNodeName(spec.nodeName)) {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
123
128
|
const contributor = contributors[spec.attributionKey];
|
|
124
129
|
if (!contributor) {
|
|
125
130
|
continue;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
import { createContributorTagHost, unmountContributorTag } from '../createContributorTagWidget';
|
|
2
3
|
import { buildDiffDecorationSpec, scrollMarginTopValue } from '../decorationKeys';
|
|
3
4
|
import { createContentWrapper } from './wrapBlockNodeView';
|
|
4
5
|
|
|
@@ -63,30 +64,47 @@ export const createDeletedLineBreakDecoration = ({
|
|
|
63
64
|
attributionKey,
|
|
64
65
|
colorScheme,
|
|
65
66
|
count,
|
|
67
|
+
diffId = crypto.randomUUID(),
|
|
66
68
|
isActive = false,
|
|
67
69
|
pos,
|
|
68
70
|
reveal,
|
|
69
|
-
side
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
isActive,
|
|
74
|
-
reveal
|
|
75
|
-
}), {
|
|
76
|
-
...buildDiffDecorationSpec({
|
|
77
|
-
attributionKey,
|
|
71
|
+
side,
|
|
72
|
+
tagMountContext
|
|
73
|
+
}) => {
|
|
74
|
+
const dom = createDeletedLineBreakWidget({
|
|
78
75
|
colorScheme,
|
|
79
|
-
|
|
80
|
-
diffId: crypto.randomUUID(),
|
|
76
|
+
count,
|
|
81
77
|
isActive,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
78
|
+
reveal
|
|
79
|
+
});
|
|
80
|
+
const tagHost = attributionKey ? createContributorTagHost({
|
|
81
|
+
diffId,
|
|
82
|
+
mountContext: tagMountContext
|
|
83
|
+
}) : undefined;
|
|
84
|
+
if (tagHost) {
|
|
85
|
+
// Keep only the decorative glyph hidden; the contributor tag must remain accessible.
|
|
86
|
+
dom.removeAttribute('aria-hidden');
|
|
87
|
+
Array.from(dom.children).forEach(child => child.setAttribute('aria-hidden', 'true'));
|
|
88
|
+
dom.setAttribute('data-diff-id', diffId);
|
|
89
|
+
dom.prepend(tagHost.host);
|
|
90
|
+
}
|
|
91
|
+
return Decoration.widget(pos, dom, {
|
|
92
|
+
...buildDiffDecorationSpec({
|
|
93
|
+
attributionKey: tagHost ? attributionKey : undefined,
|
|
94
|
+
colorScheme,
|
|
95
|
+
decorationType: 'widget',
|
|
96
|
+
diffId,
|
|
97
|
+
isActive,
|
|
98
|
+
// The glyph always stands in for removed content, whichever side of the changeset the
|
|
99
|
+
// change itself landed on.
|
|
100
|
+
isInserted: false,
|
|
101
|
+
...(side !== undefined && {
|
|
102
|
+
side
|
|
103
|
+
})
|
|
104
|
+
}),
|
|
105
|
+
// Without an explicit mark set, prosemirror-view wraps the widget in the marks of the
|
|
106
|
+
// adjacent text. The glyph carries its own deleted styling and must not inherit them.
|
|
107
|
+
marks: [],
|
|
108
|
+
destroy: () => unmountContributorTag(tagHost === null || tagHost === void 0 ? void 0 : tagHost.mount)
|
|
109
|
+
});
|
|
110
|
+
};
|
|
@@ -650,10 +650,12 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
650
650
|
decorations.push(createDeletedLineBreakDecoration({
|
|
651
651
|
attributionKey: attributionKey,
|
|
652
652
|
colorScheme: changeColorScheme,
|
|
653
|
+
diffId: showContributorTags ? "blank-line-".concat(pos) : undefined,
|
|
653
654
|
isActive: isActive,
|
|
654
655
|
pos: pos,
|
|
655
656
|
reveal: reveal,
|
|
656
|
-
side: -1
|
|
657
|
+
side: -1,
|
|
658
|
+
tagMountContext: tagMountContext
|
|
657
659
|
}));
|
|
658
660
|
}
|
|
659
661
|
} catch (err) {
|
|
@@ -247,7 +247,7 @@ export var createBlockChangedDecoration = function createBlockChangedDecoration(
|
|
|
247
247
|
}, (shouldTagBlock || fg('platform_editor_ai_show_diff_patch_2')) && {
|
|
248
248
|
'data-diff-id': diffId
|
|
249
249
|
}), buildDiffDecorationSpec({
|
|
250
|
-
attributionKey:
|
|
250
|
+
attributionKey: showContributorTags ? attributionKey : undefined,
|
|
251
251
|
colorScheme: colorScheme,
|
|
252
252
|
decorationType: 'block',
|
|
253
253
|
diffId: diffId,
|
|
@@ -195,15 +195,16 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
195
195
|
// The blocks have no content to serialize, so the deletion is shown as one struck-through
|
|
196
196
|
// return glyph per line the author removed. A single widget, not one per line: the lines are
|
|
197
197
|
// gone from `newDoc`, so they all resolve to the same anchor and separate widgets would stack.
|
|
198
|
-
//
|
|
199
|
-
// No attribution: the glyph is not a tag host, matching `canTagWidget` below.
|
|
200
198
|
return [createDeletedLineBreakDecoration({
|
|
199
|
+
attributionKey: showContributorTags ? attributionKey : undefined,
|
|
201
200
|
colorScheme: colorScheme,
|
|
202
201
|
count: deletedBlankLineCount,
|
|
202
|
+
diffId: showContributorTags ? "widget-".concat(change.fromA, "-").concat(change.toA) : undefined,
|
|
203
203
|
isActive: isActive,
|
|
204
204
|
pos: safeInsertPos,
|
|
205
205
|
reveal: reveal,
|
|
206
|
-
side: placeBelow ? 1 : -1
|
|
206
|
+
side: placeBelow ? 1 : -1,
|
|
207
|
+
tagMountContext: tagMountContext
|
|
207
208
|
})];
|
|
208
209
|
}
|
|
209
210
|
if (shouldSkipDeletedEmptyParagraphDecoration) {
|
|
@@ -9,6 +9,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
9
9
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
11
11
|
import { resolveBaseNodeName } from '../utils/baseNodeName';
|
|
12
|
+
import { isTaggableBlockNodeName } from '../utils/taggableBlockNodes';
|
|
12
13
|
import { isDiffDecoration, isDiffDecorationSpec } from './decorationKeys';
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -150,6 +151,10 @@ export var extractContributorTags = function extractContributorTags(decorations,
|
|
|
150
151
|
if (!spec.attributionKey || !TAGGABLE_DECORATION_TYPES.has(spec.decorationType)) {
|
|
151
152
|
continue;
|
|
152
153
|
}
|
|
154
|
+
// Attribution also serves navigation; only supported blocks can host a tag of their own.
|
|
155
|
+
if (spec.decorationType === 'block' && spec.nodeName !== undefined && !isTaggableBlockNodeName(spec.nodeName)) {
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
153
158
|
var contributor = contributors[spec.attributionKey];
|
|
154
159
|
if (!contributor) {
|
|
155
160
|
continue;
|
|
@@ -2,6 +2,7 @@ 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 { createContributorTagHost, unmountContributorTag } from '../createContributorTagWidget';
|
|
5
6
|
import { buildDiffDecorationSpec, scrollMarginTopValue } from '../decorationKeys';
|
|
6
7
|
import { createContentWrapper } from './wrapBlockNodeView';
|
|
7
8
|
|
|
@@ -67,21 +68,38 @@ export var createDeletedLineBreakDecoration = function createDeletedLineBreakDec
|
|
|
67
68
|
var attributionKey = _ref2.attributionKey,
|
|
68
69
|
colorScheme = _ref2.colorScheme,
|
|
69
70
|
count = _ref2.count,
|
|
71
|
+
_ref2$diffId = _ref2.diffId,
|
|
72
|
+
diffId = _ref2$diffId === void 0 ? crypto.randomUUID() : _ref2$diffId,
|
|
70
73
|
_ref2$isActive = _ref2.isActive,
|
|
71
74
|
isActive = _ref2$isActive === void 0 ? false : _ref2$isActive,
|
|
72
75
|
pos = _ref2.pos,
|
|
73
76
|
reveal = _ref2.reveal,
|
|
74
|
-
side = _ref2.side
|
|
75
|
-
|
|
77
|
+
side = _ref2.side,
|
|
78
|
+
tagMountContext = _ref2.tagMountContext;
|
|
79
|
+
var dom = createDeletedLineBreakWidget({
|
|
76
80
|
colorScheme: colorScheme,
|
|
77
81
|
count: count,
|
|
78
82
|
isActive: isActive,
|
|
79
83
|
reveal: reveal
|
|
80
|
-
})
|
|
81
|
-
|
|
84
|
+
});
|
|
85
|
+
var tagHost = attributionKey ? createContributorTagHost({
|
|
86
|
+
diffId: diffId,
|
|
87
|
+
mountContext: tagMountContext
|
|
88
|
+
}) : undefined;
|
|
89
|
+
if (tagHost) {
|
|
90
|
+
// Keep only the decorative glyph hidden; the contributor tag must remain accessible.
|
|
91
|
+
dom.removeAttribute('aria-hidden');
|
|
92
|
+
Array.from(dom.children).forEach(function (child) {
|
|
93
|
+
return child.setAttribute('aria-hidden', 'true');
|
|
94
|
+
});
|
|
95
|
+
dom.setAttribute('data-diff-id', diffId);
|
|
96
|
+
dom.prepend(tagHost.host);
|
|
97
|
+
}
|
|
98
|
+
return Decoration.widget(pos, dom, _objectSpread(_objectSpread({}, buildDiffDecorationSpec(_objectSpread({
|
|
99
|
+
attributionKey: tagHost ? attributionKey : undefined,
|
|
82
100
|
colorScheme: colorScheme,
|
|
83
101
|
decorationType: 'widget',
|
|
84
|
-
diffId:
|
|
102
|
+
diffId: diffId,
|
|
85
103
|
isActive: isActive,
|
|
86
104
|
// The glyph always stands in for removed content, whichever side of the changeset the
|
|
87
105
|
// change itself landed on.
|
|
@@ -91,6 +109,9 @@ export var createDeletedLineBreakDecoration = function createDeletedLineBreakDec
|
|
|
91
109
|
}))), {}, {
|
|
92
110
|
// Without an explicit mark set, prosemirror-view wraps the widget in the marks of the
|
|
93
111
|
// adjacent text. The glyph carries its own deleted styling and must not inherit them.
|
|
94
|
-
marks: []
|
|
112
|
+
marks: [],
|
|
113
|
+
destroy: function destroy() {
|
|
114
|
+
return unmountContributorTag(tagHost === null || tagHost === void 0 ? void 0 : tagHost.mount);
|
|
115
|
+
}
|
|
95
116
|
}));
|
|
96
117
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
import type { RevealOptions } from '../../../showDiffPluginType';
|
|
3
3
|
import type { ColorScheme } from '../colorSchemes/types';
|
|
4
|
+
import { type ContributorTagMountContext } from '../createContributorTagWidget';
|
|
4
5
|
/**
|
|
5
6
|
* U+2936 ARROW POINTING DOWNWARDS THEN CURVING LEFTWARDS — the return-key glyph.
|
|
6
7
|
*
|
|
@@ -37,12 +38,14 @@ export declare const createDeletedLineBreakWidget: ({ colorScheme, count, isActi
|
|
|
37
38
|
* the displayed document and the change lands on the *inserted* side, so the glyph is anchored
|
|
38
39
|
* inside the surviving block, on the blank line itself.
|
|
39
40
|
*/
|
|
40
|
-
export declare const createDeletedLineBreakDecoration: ({ attributionKey, colorScheme, count, isActive, pos, reveal, side, }: {
|
|
41
|
+
export declare const createDeletedLineBreakDecoration: ({ attributionKey, colorScheme, count, diffId, isActive, pos, reveal, side, tagMountContext, }: {
|
|
41
42
|
attributionKey?: string;
|
|
42
43
|
colorScheme?: ColorScheme;
|
|
43
44
|
count?: number;
|
|
45
|
+
diffId?: string;
|
|
44
46
|
isActive?: boolean;
|
|
45
47
|
pos: number;
|
|
46
48
|
reveal?: RevealOptions;
|
|
47
49
|
side?: number;
|
|
50
|
+
tagMountContext?: ContributorTagMountContext;
|
|
48
51
|
}) => Decoration;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "27.0.
|
|
3
|
+
"version": "27.0.2",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
41
41
|
"@atlaskit/primitives": "^22.6.0",
|
|
42
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
42
|
+
"@atlaskit/tmp-editor-statsig": "^244.0.0",
|
|
43
43
|
"@atlaskit/tokens": "^20.6.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@compiled/react": "^1.0.2",
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"@atlassian/confluence-presets": "workspace:^",
|
|
65
65
|
"@atlassian/content-reconciliation": "^0.1.3506",
|
|
66
66
|
"@atlassian/editor-ai-injected-editors": "^43.0.0",
|
|
67
|
-
"@atlassian/editor-plugin-ai": "^83.
|
|
67
|
+
"@atlassian/editor-plugin-ai": "^83.2.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": "^133.
|
|
74
|
+
"@atlaskit/editor-common": "^133.1.0",
|
|
75
75
|
"react": "^18.2.0 || ^19.2.0",
|
|
76
76
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
77
77
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|