@atlaskit/editor-plugin-show-diff 17.1.2 → 17.1.3
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 +9 -0
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +1 -1
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +1 -1
- package/dist/cjs/pm-plugins/scrollToDiff.js +8 -2
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +2 -2
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +2 -2
- package/dist/es2019/pm-plugins/scrollToDiff.js +4 -0
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +1 -1
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +1 -1
- package/dist/esm/pm-plugins/scrollToDiff.js +8 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 17.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8598d92a969fc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8598d92a969fc) -
|
|
8
|
+
EDITOR-9000 Fix suggested-edit navigation to scroll to the decorated diff when
|
|
9
|
+
`platform_editor_ai_show_diff_patch_2` is enabled.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 17.1.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -263,7 +263,7 @@ var createBlockChangedDecoration = exports.createBlockChangedDecoration = functi
|
|
|
263
263
|
style: style,
|
|
264
264
|
'data-testid': 'show-diff-changed-decoration-node',
|
|
265
265
|
class: className
|
|
266
|
-
}, shouldTagBlock && {
|
|
266
|
+
}, (shouldTagBlock || (0, _fg.fg)('platform_editor_ai_show_diff_patch_2')) && {
|
|
267
267
|
'data-diff-id': diffId
|
|
268
268
|
}), (0, _decorationKeys.buildDiffDecorationSpec)({
|
|
269
269
|
attributionKey: shouldTagBlock ? attributionKey : undefined,
|
|
@@ -223,7 +223,7 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
223
223
|
class: atomicInlineAttrs.className
|
|
224
224
|
}), revealed && (0, _defineProperty2.default)({}, _revealStyles.REVEAL_ATTR, revealed.role)), {}, {
|
|
225
225
|
'data-testid': 'show-diff-changed-decoration'
|
|
226
|
-
}, showContributorTags && {
|
|
226
|
+
}, (showContributorTags || (0, _fg.fg)('platform_editor_ai_show_diff_patch_2')) && {
|
|
227
227
|
'data-diff-id': diffId
|
|
228
228
|
}), (0, _decorationKeys.buildDiffDecorationSpec)({
|
|
229
229
|
attributionKey: canTagChange ? attributionKey : undefined,
|
|
@@ -83,10 +83,16 @@ var scrollToDecoration = exports.scrollToDecoration = function scrollToDecoratio
|
|
|
83
83
|
// @ts-expect-error - decoration.type is not typed public API
|
|
84
84
|
var widgetDom = target === null || target === void 0 || (_target$type = target.type) === null || _target$type === void 0 ? void 0 : _target$type.toDOM;
|
|
85
85
|
scrollToSelection(widgetDom);
|
|
86
|
+
} else if ((0, _decorationKeys.isDiffDecoration)(target) && (0, _fg.fg)('platform_editor_ai_show_diff_patch_2')) {
|
|
87
|
+
var _Array$from$find;
|
|
88
|
+
var targetNode = (_Array$from$find = Array.from(view.dom.querySelectorAll('[data-diff-id]')).find(function (element) {
|
|
89
|
+
return element.dataset.diffId === target.spec.diffId;
|
|
90
|
+
})) !== null && _Array$from$find !== void 0 ? _Array$from$find : view.nodeDOM(target === null || target === void 0 ? void 0 : target.from);
|
|
91
|
+
scrollToSelection(targetNode);
|
|
86
92
|
} else {
|
|
87
93
|
var _view$domAtPos;
|
|
88
|
-
var
|
|
89
|
-
var node =
|
|
94
|
+
var _targetNode = view.nodeDOM(target === null || target === void 0 ? void 0 : target.from);
|
|
95
|
+
var node = _targetNode instanceof Element ? _targetNode : (_view$domAtPos = view.domAtPos(target === null || target === void 0 ? void 0 : target.from)) === null || _view$domAtPos === void 0 ? void 0 : _view$domAtPos.node;
|
|
90
96
|
scrollToSelection(node);
|
|
91
97
|
}
|
|
92
98
|
});
|
|
@@ -245,8 +245,8 @@ export const createBlockChangedDecoration = ({
|
|
|
245
245
|
style,
|
|
246
246
|
'data-testid': 'show-diff-changed-decoration-node',
|
|
247
247
|
class: className,
|
|
248
|
-
// Lets
|
|
249
|
-
...(shouldTagBlock && {
|
|
248
|
+
// Lets navigation select this exact diff, and contributor tags find it on hover.
|
|
249
|
+
...((shouldTagBlock || fg('platform_editor_ai_show_diff_patch_2')) && {
|
|
250
250
|
'data-diff-id': diffId
|
|
251
251
|
})
|
|
252
252
|
}, buildDiffDecorationSpec({
|
|
@@ -201,8 +201,8 @@ export const createInlineChangedDecoration = ({
|
|
|
201
201
|
[REVEAL_ATTR]: revealed.role
|
|
202
202
|
}),
|
|
203
203
|
'data-testid': 'show-diff-changed-decoration',
|
|
204
|
-
// Lets
|
|
205
|
-
...(showContributorTags && {
|
|
204
|
+
// Lets navigation select this exact diff, and contributor tags find it on hover.
|
|
205
|
+
...((showContributorTags || fg('platform_editor_ai_show_diff_patch_2')) && {
|
|
206
206
|
'data-diff-id': diffId
|
|
207
207
|
})
|
|
208
208
|
}, buildDiffDecorationSpec({
|
|
@@ -76,6 +76,10 @@ export const scrollToDecoration = (view, decorations, activeIndex = 0, api) => {
|
|
|
76
76
|
// @ts-expect-error - decoration.type is not typed public API
|
|
77
77
|
const widgetDom = target === null || target === void 0 ? void 0 : (_target$type = target.type) === null || _target$type === void 0 ? void 0 : _target$type.toDOM;
|
|
78
78
|
scrollToSelection(widgetDom);
|
|
79
|
+
} else if (isDiffDecoration(target) && fg('platform_editor_ai_show_diff_patch_2')) {
|
|
80
|
+
var _Array$from$find;
|
|
81
|
+
const targetNode = (_Array$from$find = Array.from(view.dom.querySelectorAll('[data-diff-id]')).find(element => element.dataset.diffId === target.spec.diffId)) !== null && _Array$from$find !== void 0 ? _Array$from$find : view.nodeDOM(target === null || target === void 0 ? void 0 : target.from);
|
|
82
|
+
scrollToSelection(targetNode);
|
|
79
83
|
} else {
|
|
80
84
|
var _view$domAtPos;
|
|
81
85
|
const targetNode = view.nodeDOM(target === null || target === void 0 ? void 0 : target.from);
|
|
@@ -256,7 +256,7 @@ export var createBlockChangedDecoration = function createBlockChangedDecoration(
|
|
|
256
256
|
style: style,
|
|
257
257
|
'data-testid': 'show-diff-changed-decoration-node',
|
|
258
258
|
class: className
|
|
259
|
-
}, shouldTagBlock && {
|
|
259
|
+
}, (shouldTagBlock || fg('platform_editor_ai_show_diff_patch_2')) && {
|
|
260
260
|
'data-diff-id': diffId
|
|
261
261
|
}), buildDiffDecorationSpec({
|
|
262
262
|
attributionKey: shouldTagBlock ? attributionKey : undefined,
|
|
@@ -216,7 +216,7 @@ export var createInlineChangedDecoration = function createInlineChangedDecoratio
|
|
|
216
216
|
class: atomicInlineAttrs.className
|
|
217
217
|
}), revealed && _defineProperty({}, REVEAL_ATTR, revealed.role)), {}, {
|
|
218
218
|
'data-testid': 'show-diff-changed-decoration'
|
|
219
|
-
}, showContributorTags && {
|
|
219
|
+
}, (showContributorTags || fg('platform_editor_ai_show_diff_patch_2')) && {
|
|
220
220
|
'data-diff-id': diffId
|
|
221
221
|
}), buildDiffDecorationSpec({
|
|
222
222
|
attributionKey: canTagChange ? attributionKey : undefined,
|
|
@@ -78,10 +78,16 @@ export var scrollToDecoration = function scrollToDecoration(view, decorations) {
|
|
|
78
78
|
// @ts-expect-error - decoration.type is not typed public API
|
|
79
79
|
var widgetDom = target === null || target === void 0 || (_target$type = target.type) === null || _target$type === void 0 ? void 0 : _target$type.toDOM;
|
|
80
80
|
scrollToSelection(widgetDom);
|
|
81
|
+
} else if (isDiffDecoration(target) && fg('platform_editor_ai_show_diff_patch_2')) {
|
|
82
|
+
var _Array$from$find;
|
|
83
|
+
var targetNode = (_Array$from$find = Array.from(view.dom.querySelectorAll('[data-diff-id]')).find(function (element) {
|
|
84
|
+
return element.dataset.diffId === target.spec.diffId;
|
|
85
|
+
})) !== null && _Array$from$find !== void 0 ? _Array$from$find : view.nodeDOM(target === null || target === void 0 ? void 0 : target.from);
|
|
86
|
+
scrollToSelection(targetNode);
|
|
81
87
|
} else {
|
|
82
88
|
var _view$domAtPos;
|
|
83
|
-
var
|
|
84
|
-
var node =
|
|
89
|
+
var _targetNode = view.nodeDOM(target === null || target === void 0 ? void 0 : target.from);
|
|
90
|
+
var node = _targetNode instanceof Element ? _targetNode : (_view$domAtPos = view.domAtPos(target === null || target === void 0 ? void 0 : target.from)) === null || _view$domAtPos === void 0 ? void 0 : _view$domAtPos.node;
|
|
85
91
|
scrollToSelection(node);
|
|
86
92
|
}
|
|
87
93
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "17.1.
|
|
3
|
+
"version": "17.1.3",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.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": "^33.0.0",
|
|
67
|
-
"@atlassian/editor-plugin-ai": "^73.
|
|
67
|
+
"@atlassian/editor-plugin-ai": "^73.4.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": "^123.
|
|
74
|
+
"@atlaskit/editor-common": "^123.4.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"
|