@atlaskit/editor-plugin-show-diff 13.1.4 → 13.1.5
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
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 13.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`fd3620d4e137b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fd3620d4e137b) -
|
|
8
|
+
[CCI-18915] Surface and render formatting-only (mark) agent edits in the AI Review Moment.
|
|
9
|
+
|
|
10
|
+
Mark-only agent steps (`AddMarkStep`/`RemoveMarkStep` — e.g. making text bold, italic, or a link)
|
|
11
|
+
have an empty `StepMap`, so the agent review-segment and shimmer builders — which derived their
|
|
12
|
+
changed ranges purely from `StepMap` geometry — never produced a range for them. As a result a
|
|
13
|
+
formatting-only agent edit opened no Review Moment and showed no shimmer. Both builders now detect
|
|
14
|
+
mark steps and derive their range from `step.from`/`step.to`.
|
|
15
|
+
|
|
16
|
+
The smart-diff token encoder additionally folds each character's marks (type + attrs) into its
|
|
17
|
+
token, so once the moment opens the change renders as a real diff (e.g. a bold-only edit, or a
|
|
18
|
+
link whose `href` changes) instead of an empty one.
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 13.1.4
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -24,11 +24,33 @@ var encodeNodeWithAttrs = function encodeNodeWithAttrs(node, attrNames) {
|
|
|
24
24
|
return "".concat(node.type.name, "|").concat(parts.join('|'));
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
// Fold a character's marks (type + attrs) into its token so a formatting-only change
|
|
28
|
+
// (bold/italic/link/colour, or a link whose `href` changes) registers as a real diff.
|
|
29
|
+
// The default encoder returns just the char code, so marked and unmarked text tokenise
|
|
30
|
+
// identically. Marks and their attrs are sorted so the token is order-independent.
|
|
31
|
+
var encodeCharacterWithMarks = function encodeCharacterWithMarks(char, marks) {
|
|
32
|
+
if (marks.length === 0) {
|
|
33
|
+
// Fast path: unmarked text keeps the numeric char code (unchanged behaviour).
|
|
34
|
+
return char;
|
|
35
|
+
}
|
|
36
|
+
var markKey = marks.map(function (mark) {
|
|
37
|
+
var _mark$attrs;
|
|
38
|
+
var attrs = (_mark$attrs = mark.attrs) !== null && _mark$attrs !== void 0 ? _mark$attrs : {};
|
|
39
|
+
var attrParts = Object.keys(attrs).sort().map(function (key) {
|
|
40
|
+
var _attrs$key;
|
|
41
|
+
return "".concat(key, "=").concat(JSON.stringify((_attrs$key = attrs[key]) !== null && _attrs$key !== void 0 ? _attrs$key : null));
|
|
42
|
+
});
|
|
43
|
+
return attrParts.length > 0 ? "".concat(mark.type.name, "(").concat(attrParts.join(','), ")") : mark.type.name;
|
|
44
|
+
}).sort().join('&');
|
|
45
|
+
return "".concat(char, "\0").concat(markKey);
|
|
46
|
+
};
|
|
47
|
+
|
|
27
48
|
// Like the library default, but node types with a `diffableAttrs` rule fold their
|
|
28
|
-
// attrs into the open token
|
|
49
|
+
// attrs into the open token, and text characters fold in their marks. Node-end is
|
|
50
|
+
// unchanged, hence `string | number`.
|
|
29
51
|
var attrAwareTokenEncoder = exports.attrAwareTokenEncoder = {
|
|
30
|
-
encodeCharacter: function encodeCharacter(char,
|
|
31
|
-
return char;
|
|
52
|
+
encodeCharacter: function encodeCharacter(char, marks) {
|
|
53
|
+
return encodeCharacterWithMarks(char, marks);
|
|
32
54
|
},
|
|
33
55
|
encodeNodeStart: function encodeNodeStart(node) {
|
|
34
56
|
var _node$attrs2;
|
|
@@ -19,10 +19,32 @@ const encodeNodeWithAttrs = (node, attrNames) => {
|
|
|
19
19
|
return `${node.type.name}|${parts.join('|')}`;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
// Fold a character's marks (type + attrs) into its token so a formatting-only change
|
|
23
|
+
// (bold/italic/link/colour, or a link whose `href` changes) registers as a real diff.
|
|
24
|
+
// The default encoder returns just the char code, so marked and unmarked text tokenise
|
|
25
|
+
// identically. Marks and their attrs are sorted so the token is order-independent.
|
|
26
|
+
const encodeCharacterWithMarks = (char, marks) => {
|
|
27
|
+
if (marks.length === 0) {
|
|
28
|
+
// Fast path: unmarked text keeps the numeric char code (unchanged behaviour).
|
|
29
|
+
return char;
|
|
30
|
+
}
|
|
31
|
+
const markKey = marks.map(mark => {
|
|
32
|
+
var _mark$attrs;
|
|
33
|
+
const attrs = (_mark$attrs = mark.attrs) !== null && _mark$attrs !== void 0 ? _mark$attrs : {};
|
|
34
|
+
const attrParts = Object.keys(attrs).sort().map(key => {
|
|
35
|
+
var _attrs$key;
|
|
36
|
+
return `${key}=${JSON.stringify((_attrs$key = attrs[key]) !== null && _attrs$key !== void 0 ? _attrs$key : null)}`;
|
|
37
|
+
});
|
|
38
|
+
return attrParts.length > 0 ? `${mark.type.name}(${attrParts.join(',')})` : mark.type.name;
|
|
39
|
+
}).sort().join('&');
|
|
40
|
+
return `${char}\u0000${markKey}`;
|
|
41
|
+
};
|
|
42
|
+
|
|
22
43
|
// Like the library default, but node types with a `diffableAttrs` rule fold their
|
|
23
|
-
// attrs into the open token
|
|
44
|
+
// attrs into the open token, and text characters fold in their marks. Node-end is
|
|
45
|
+
// unchanged, hence `string | number`.
|
|
24
46
|
export const attrAwareTokenEncoder = {
|
|
25
|
-
encodeCharacter: (char,
|
|
47
|
+
encodeCharacter: (char, marks) => encodeCharacterWithMarks(char, marks),
|
|
26
48
|
encodeNodeStart: node => {
|
|
27
49
|
var _node$attrs2;
|
|
28
50
|
const attrNames = getDiffableAttrNames(node.type.name, (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 ? _node$attrs2 : {});
|
|
@@ -19,11 +19,33 @@ var encodeNodeWithAttrs = function encodeNodeWithAttrs(node, attrNames) {
|
|
|
19
19
|
return "".concat(node.type.name, "|").concat(parts.join('|'));
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
// Fold a character's marks (type + attrs) into its token so a formatting-only change
|
|
23
|
+
// (bold/italic/link/colour, or a link whose `href` changes) registers as a real diff.
|
|
24
|
+
// The default encoder returns just the char code, so marked and unmarked text tokenise
|
|
25
|
+
// identically. Marks and their attrs are sorted so the token is order-independent.
|
|
26
|
+
var encodeCharacterWithMarks = function encodeCharacterWithMarks(char, marks) {
|
|
27
|
+
if (marks.length === 0) {
|
|
28
|
+
// Fast path: unmarked text keeps the numeric char code (unchanged behaviour).
|
|
29
|
+
return char;
|
|
30
|
+
}
|
|
31
|
+
var markKey = marks.map(function (mark) {
|
|
32
|
+
var _mark$attrs;
|
|
33
|
+
var attrs = (_mark$attrs = mark.attrs) !== null && _mark$attrs !== void 0 ? _mark$attrs : {};
|
|
34
|
+
var attrParts = Object.keys(attrs).sort().map(function (key) {
|
|
35
|
+
var _attrs$key;
|
|
36
|
+
return "".concat(key, "=").concat(JSON.stringify((_attrs$key = attrs[key]) !== null && _attrs$key !== void 0 ? _attrs$key : null));
|
|
37
|
+
});
|
|
38
|
+
return attrParts.length > 0 ? "".concat(mark.type.name, "(").concat(attrParts.join(','), ")") : mark.type.name;
|
|
39
|
+
}).sort().join('&');
|
|
40
|
+
return "".concat(char, "\0").concat(markKey);
|
|
41
|
+
};
|
|
42
|
+
|
|
22
43
|
// Like the library default, but node types with a `diffableAttrs` rule fold their
|
|
23
|
-
// attrs into the open token
|
|
44
|
+
// attrs into the open token, and text characters fold in their marks. Node-end is
|
|
45
|
+
// unchanged, hence `string | number`.
|
|
24
46
|
export var attrAwareTokenEncoder = {
|
|
25
|
-
encodeCharacter: function encodeCharacter(char,
|
|
26
|
-
return char;
|
|
47
|
+
encodeCharacter: function encodeCharacter(char, marks) {
|
|
48
|
+
return encodeCharacterWithMarks(char, marks);
|
|
27
49
|
},
|
|
28
50
|
encodeNodeStart: function encodeNodeStart(node) {
|
|
29
51
|
var _node$attrs2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "13.1.
|
|
3
|
+
"version": "13.1.5",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@atlaskit/editor-tables": "^3.0.0",
|
|
29
29
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
30
30
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
31
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
31
|
+
"@atlaskit/tmp-editor-statsig": "^156.0.0",
|
|
32
32
|
"@atlaskit/tokens": "^16.7.0",
|
|
33
33
|
"@babel/runtime": "^7.0.0",
|
|
34
34
|
"@compiled/react": "^1.0.2",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@atlaskit/css": "^1.0.0",
|
|
43
43
|
"@atlaskit/dropdown-menu": "^18.1.0",
|
|
44
44
|
"@atlaskit/editor-core": "^224.2.0",
|
|
45
|
-
"@atlaskit/editor-json-transformer": "^9.
|
|
45
|
+
"@atlaskit/editor-json-transformer": "^9.5.0",
|
|
46
46
|
"@atlaskit/form": "^17.0.0",
|
|
47
47
|
"@atlaskit/primitives": "^22.3.0",
|
|
48
48
|
"@atlaskit/section-message": "^10.0.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"react-intl": "^7.0.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@atlaskit/editor-common": "^119.
|
|
57
|
+
"@atlaskit/editor-common": "^119.12.0",
|
|
58
58
|
"react": "^18.2.0 || ^19.2.0"
|
|
59
59
|
},
|
|
60
60
|
"techstack": {
|