@atlaskit/editor-plugin-show-diff 4.1.1 → 4.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 +14 -0
- package/dist/cjs/pm-plugins/colorSchemes/standard.js +96 -0
- package/dist/cjs/pm-plugins/colorSchemes/traditional.js +76 -0
- package/dist/cjs/pm-plugins/decorations.js +35 -189
- package/dist/es2019/pm-plugins/colorSchemes/standard.js +90 -0
- package/dist/es2019/pm-plugins/colorSchemes/traditional.js +70 -0
- package/dist/es2019/pm-plugins/decorations.js +28 -183
- package/dist/esm/pm-plugins/colorSchemes/standard.js +90 -0
- package/dist/esm/pm-plugins/colorSchemes/traditional.js +70 -0
- package/dist/esm/pm-plugins/decorations.js +29 -183
- package/dist/types/pm-plugins/colorSchemes/standard.d.ts +8 -0
- package/dist/types/pm-plugins/colorSchemes/traditional.d.ts +5 -0
- package/dist/types-ts4.5/pm-plugins/colorSchemes/standard.d.ts +8 -0
- package/dist/types-ts4.5/pm-plugins/colorSchemes/traditional.d.ts +5 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 4.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ea378cb5c7a31`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ea378cb5c7a31) -
|
|
8
|
+
EDITOR-5632: no-op refactors to simplify code
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 4.1.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 4.1.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getStandardNodeStyle = exports.editingStyleActive = exports.editingStyle = exports.deletedContentStyleUnbounded = exports.deletedContentStyleNewActive = exports.deletedContentStyleNew = exports.deletedContentStyleActive = exports.deletedContentStyle = void 0;
|
|
7
|
+
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
8
|
+
var editingStyle = exports.editingStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
9
|
+
background: "var(--ds-background-accent-purple-subtlest, #F8EEFE)",
|
|
10
|
+
textDecoration: 'underline',
|
|
11
|
+
textDecorationStyle: 'dotted',
|
|
12
|
+
textDecorationThickness: "var(--ds-space-025, 2px)",
|
|
13
|
+
textDecorationColor: "var(--ds-border-accent-purple, #AF59E1)"
|
|
14
|
+
});
|
|
15
|
+
var editingStyleActive = exports.editingStyleActive = (0, _lazyNodeView.convertToInlineCss)({
|
|
16
|
+
background: "var(--ds-background-accent-purple-subtler, #EED7FC)",
|
|
17
|
+
textDecoration: 'underline',
|
|
18
|
+
textDecorationStyle: 'dotted',
|
|
19
|
+
textDecorationThickness: "var(--ds-space-025, 2px)",
|
|
20
|
+
textDecorationColor: "var(--ds-text-accent-purple, #803FA5)"
|
|
21
|
+
});
|
|
22
|
+
var deletedContentStyle = exports.deletedContentStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
23
|
+
color: "var(--ds-text-accent-gray, #505258)",
|
|
24
|
+
textDecoration: 'line-through',
|
|
25
|
+
position: 'relative',
|
|
26
|
+
opacity: 0.6
|
|
27
|
+
});
|
|
28
|
+
var deletedContentStyleActive = exports.deletedContentStyleActive = (0, _lazyNodeView.convertToInlineCss)({
|
|
29
|
+
color: "var(--ds-text, #292A2E)",
|
|
30
|
+
textDecoration: 'line-through',
|
|
31
|
+
textDecorationColor: "var(--ds-text-accent-gray, #505258)",
|
|
32
|
+
position: 'relative',
|
|
33
|
+
opacity: 1
|
|
34
|
+
});
|
|
35
|
+
var deletedContentStyleNew = exports.deletedContentStyleNew = (0, _lazyNodeView.convertToInlineCss)({
|
|
36
|
+
color: "var(--ds-text-accent-gray, #505258)",
|
|
37
|
+
textDecoration: 'line-through',
|
|
38
|
+
position: 'relative',
|
|
39
|
+
opacity: 0.8
|
|
40
|
+
});
|
|
41
|
+
var deletedContentStyleNewActive = exports.deletedContentStyleNewActive = (0, _lazyNodeView.convertToInlineCss)({
|
|
42
|
+
color: "var(--ds-text, #292A2E)",
|
|
43
|
+
textDecoration: 'line-through',
|
|
44
|
+
textDecorationColor: "var(--ds-text-accent-gray, #505258)",
|
|
45
|
+
position: 'relative',
|
|
46
|
+
opacity: 1
|
|
47
|
+
});
|
|
48
|
+
var deletedContentStyleUnbounded = exports.deletedContentStyleUnbounded = (0, _lazyNodeView.convertToInlineCss)({
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
top: '50%',
|
|
51
|
+
width: '100%',
|
|
52
|
+
display: 'inline-block',
|
|
53
|
+
borderTop: "1px solid ".concat("var(--ds-text-accent-gray, #505258)"),
|
|
54
|
+
pointerEvents: 'none',
|
|
55
|
+
zIndex: 1
|
|
56
|
+
});
|
|
57
|
+
var editingStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
58
|
+
borderLeft: "2px solid ".concat("var(--ds-border-accent-purple, #AF59E1)")
|
|
59
|
+
});
|
|
60
|
+
var editingStyleRuleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
61
|
+
backgroundColor: "var(--ds-border-accent-purple, #AF59E1)"
|
|
62
|
+
});
|
|
63
|
+
var editingStyleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
64
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
65
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
66
|
+
});
|
|
67
|
+
var editingStyleCardBlockNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
68
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
69
|
+
borderRadius: "var(--ds-radius-medium, 6px)"
|
|
70
|
+
});
|
|
71
|
+
var standardDecorationMarkerVariableName = (0, _lazyNodeView.convertToInlineCss)({
|
|
72
|
+
'--diff-decoration-marker-color': "var(--ds-border-accent-purple, #AF59E1)"
|
|
73
|
+
});
|
|
74
|
+
var getStandardNodeStyle = exports.getStandardNodeStyle = function getStandardNodeStyle(nodeName) {
|
|
75
|
+
if (['mediaSingle', 'mediaGroup', 'table',
|
|
76
|
+
// Handle table separately to avoid border issues
|
|
77
|
+
'tableRow', 'tableCell', 'tableHeader', 'paragraph',
|
|
78
|
+
// Paragraph and heading nodes do not need special styling
|
|
79
|
+
'heading', 'hardBreak', 'decisionList', 'taskList', 'taskItem', 'bulletList', 'orderedList', 'layoutSection'].includes(nodeName)) {
|
|
80
|
+
// Layout nodes do not need special styling
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
if (['extension', 'embedCard', 'listItem'].includes(nodeName)) {
|
|
84
|
+
return standardDecorationMarkerVariableName;
|
|
85
|
+
}
|
|
86
|
+
if (nodeName === 'blockquote') {
|
|
87
|
+
return editingStyleQuoteNode;
|
|
88
|
+
}
|
|
89
|
+
if (nodeName === 'rule') {
|
|
90
|
+
return editingStyleRuleNode;
|
|
91
|
+
}
|
|
92
|
+
if (nodeName === 'blockCard') {
|
|
93
|
+
return editingStyleCardBlockNode;
|
|
94
|
+
}
|
|
95
|
+
return editingStyleNode;
|
|
96
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.traditionalInsertStyleActive = exports.traditionalInsertStyle = exports.getTraditionalNodeStyle = exports.deletedTraditionalContentStyleUnbounded = exports.deletedTraditionalContentStyle = void 0;
|
|
7
|
+
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
8
|
+
var traditionalInsertStyle = exports.traditionalInsertStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
9
|
+
background: "var(--ds-background-accent-green-subtlest, #DCFFF1)",
|
|
10
|
+
textDecoration: 'underline',
|
|
11
|
+
textDecorationStyle: 'solid',
|
|
12
|
+
textDecorationThickness: "var(--ds-space-025, 2px)",
|
|
13
|
+
textDecorationColor: "var(--ds-border-accent-green, #22A06B)"
|
|
14
|
+
});
|
|
15
|
+
var traditionalInsertStyleActive = exports.traditionalInsertStyleActive = (0, _lazyNodeView.convertToInlineCss)({
|
|
16
|
+
background: "var(--ds-background-accent-green-subtler, #BAF3DB)",
|
|
17
|
+
textDecoration: 'underline',
|
|
18
|
+
textDecorationStyle: 'solid',
|
|
19
|
+
textDecorationThickness: "var(--ds-space-025, 2px)",
|
|
20
|
+
textDecorationColor: "var(--ds-text-accent-green, #216E4E)"
|
|
21
|
+
});
|
|
22
|
+
var deletedTraditionalContentStyle = exports.deletedTraditionalContentStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
23
|
+
textDecorationColor: "var(--ds-border-accent-red, #E2483D)",
|
|
24
|
+
textDecoration: 'line-through',
|
|
25
|
+
position: 'relative',
|
|
26
|
+
opacity: 1
|
|
27
|
+
});
|
|
28
|
+
var deletedTraditionalContentStyleUnbounded = exports.deletedTraditionalContentStyleUnbounded = (0, _lazyNodeView.convertToInlineCss)({
|
|
29
|
+
position: 'absolute',
|
|
30
|
+
top: '50%',
|
|
31
|
+
width: '100%',
|
|
32
|
+
display: 'inline-block',
|
|
33
|
+
borderTop: "1px solid ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
34
|
+
pointerEvents: 'none',
|
|
35
|
+
zIndex: 1
|
|
36
|
+
});
|
|
37
|
+
var traditionalStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
38
|
+
borderLeft: "2px solid ".concat("var(--ds-border-accent-green, #22A06B)")
|
|
39
|
+
});
|
|
40
|
+
var traditionalStyleRuleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
41
|
+
backgroundColor: "var(--ds-border-accent-green, #22A06B)"
|
|
42
|
+
});
|
|
43
|
+
var traditionalStyleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
44
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
|
|
45
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
46
|
+
});
|
|
47
|
+
var traditionalStyleCardBlockNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
48
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
|
|
49
|
+
borderRadius: "var(--ds-radius-medium, 6px)"
|
|
50
|
+
});
|
|
51
|
+
var traditionalDecorationMarkerVariable = (0, _lazyNodeView.convertToInlineCss)({
|
|
52
|
+
'--diff-decoration-marker-color': "var(--ds-border-accent-green, #22A06B)"
|
|
53
|
+
});
|
|
54
|
+
var getTraditionalNodeStyle = exports.getTraditionalNodeStyle = function getTraditionalNodeStyle(nodeName) {
|
|
55
|
+
if (['mediaSingle', 'mediaGroup', 'table',
|
|
56
|
+
// Handle table separately to avoid border issues
|
|
57
|
+
'tableRow', 'tableCell', 'tableHeader', 'paragraph',
|
|
58
|
+
// Paragraph and heading nodes do not need special styling
|
|
59
|
+
'heading', 'hardBreak', 'decisionList', 'taskList', 'taskItem', 'bulletList', 'orderedList', 'layoutSection'].includes(nodeName)) {
|
|
60
|
+
// Layout nodes do not need special styling
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
if (['extension', 'embedCard', 'listItem'].includes(nodeName)) {
|
|
64
|
+
return traditionalDecorationMarkerVariable;
|
|
65
|
+
}
|
|
66
|
+
if (nodeName === 'blockquote') {
|
|
67
|
+
return traditionalStyleQuoteNode;
|
|
68
|
+
}
|
|
69
|
+
if (nodeName === 'rule') {
|
|
70
|
+
return traditionalStyleRuleNode;
|
|
71
|
+
}
|
|
72
|
+
if (nodeName === 'blockCard') {
|
|
73
|
+
return traditionalStyleCardBlockNode;
|
|
74
|
+
}
|
|
75
|
+
return traditionalStyleNode;
|
|
76
|
+
};
|
|
@@ -8,38 +8,11 @@ var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
|
8
8
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
9
9
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
10
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
|
+
var _standard = require("./colorSchemes/standard");
|
|
12
|
+
var _traditional = require("./colorSchemes/traditional");
|
|
11
13
|
var _deletedBlocksHandler = require("./deletedBlocksHandler");
|
|
12
14
|
var _deletedRowsHandler = require("./deletedRowsHandler");
|
|
13
15
|
var _findSafeInsertPos = require("./findSafeInsertPos");
|
|
14
|
-
var editingStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
15
|
-
background: "var(--ds-background-accent-purple-subtlest, #F8EEFE)",
|
|
16
|
-
textDecoration: 'underline',
|
|
17
|
-
textDecorationStyle: 'dotted',
|
|
18
|
-
textDecorationThickness: "var(--ds-space-025, 2px)",
|
|
19
|
-
textDecorationColor: "var(--ds-border-accent-purple, #AF59E1)"
|
|
20
|
-
});
|
|
21
|
-
var editingStyleActive = (0, _lazyNodeView.convertToInlineCss)({
|
|
22
|
-
background: "var(--ds-background-accent-purple-subtler, #EED7FC)",
|
|
23
|
-
textDecoration: 'underline',
|
|
24
|
-
textDecorationStyle: 'dotted',
|
|
25
|
-
textDecorationThickness: "var(--ds-space-025, 2px)",
|
|
26
|
-
textDecorationColor: "var(--ds-text-accent-purple, #803FA5)"
|
|
27
|
-
});
|
|
28
|
-
var traditionalInsertStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
29
|
-
background: "var(--ds-background-accent-green-subtlest, #DCFFF1)",
|
|
30
|
-
textDecoration: 'underline',
|
|
31
|
-
textDecorationStyle: 'solid',
|
|
32
|
-
textDecorationThickness: "var(--ds-space-025, 2px)",
|
|
33
|
-
textDecorationColor: "var(--ds-border-accent-green, #22A06B)"
|
|
34
|
-
});
|
|
35
|
-
var traditionalInsertStyleActive = (0, _lazyNodeView.convertToInlineCss)({
|
|
36
|
-
background: "var(--ds-background-accent-green-subtler, #BAF3DB)",
|
|
37
|
-
textDecoration: 'underline',
|
|
38
|
-
textDecorationStyle: 'solid',
|
|
39
|
-
textDecorationThickness: "var(--ds-space-025, 2px)",
|
|
40
|
-
textDecorationColor: "var(--ds-text-accent-green, #216E4E)"
|
|
41
|
-
});
|
|
42
|
-
|
|
43
16
|
/**
|
|
44
17
|
* Inline decoration used for insertions as the content already exists in the document
|
|
45
18
|
*
|
|
@@ -50,145 +23,27 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
50
23
|
var isActive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
51
24
|
var style;
|
|
52
25
|
if (colourScheme === 'traditional') {
|
|
53
|
-
style = isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
|
|
26
|
+
style = isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
|
|
54
27
|
} else {
|
|
55
|
-
style = isActive ? editingStyleActive : editingStyle;
|
|
28
|
+
style = isActive ? _standard.editingStyleActive : _standard.editingStyle;
|
|
56
29
|
}
|
|
57
30
|
return _view.Decoration.inline(change.fromB, change.toB, {
|
|
58
31
|
style: style,
|
|
59
32
|
'data-testid': 'show-diff-changed-decoration'
|
|
60
33
|
}, {});
|
|
61
34
|
};
|
|
62
|
-
var getEditorStyleNode = function getEditorStyleNode(nodeName, colourScheme) {
|
|
63
|
-
switch (nodeName) {
|
|
64
|
-
case 'blockquote':
|
|
65
|
-
return colourScheme === 'traditional' ? traditionalStyleQuoteNode : editingStyleQuoteNode;
|
|
66
|
-
case 'mediaSingle':
|
|
67
|
-
case 'mediaGroup':
|
|
68
|
-
case 'table':
|
|
69
|
-
case 'tableRow':
|
|
70
|
-
case 'tableCell':
|
|
71
|
-
case 'tableHeader':
|
|
72
|
-
return undefined;
|
|
73
|
-
// Handle table separately to avoid border issues
|
|
74
|
-
case 'paragraph':
|
|
75
|
-
case 'heading':
|
|
76
|
-
case 'hardBreak':
|
|
77
|
-
return undefined;
|
|
78
|
-
// Paragraph and heading nodes do not need special styling
|
|
79
|
-
case 'decisionList':
|
|
80
|
-
case 'taskList':
|
|
81
|
-
case 'taskItem':
|
|
82
|
-
case 'bulletList':
|
|
83
|
-
case 'orderedList':
|
|
84
|
-
return undefined;
|
|
85
|
-
case 'extension':
|
|
86
|
-
case 'embedCard':
|
|
87
|
-
case 'listItem':
|
|
88
|
-
return (0, _lazyNodeView.convertToInlineCss)({
|
|
89
|
-
'--diff-decoration-marker-color': colourScheme === 'traditional' ? "var(--ds-border-accent-green, #22A06B)" : "var(--ds-border-accent-purple, #AF59E1)"
|
|
90
|
-
});
|
|
91
|
-
case 'layoutSection':
|
|
92
|
-
return undefined;
|
|
93
|
-
// Layout nodes do not need special styling
|
|
94
|
-
case 'rule':
|
|
95
|
-
return colourScheme === 'traditional' ? traditionalStyleRuleNode : editingStyleRuleNode;
|
|
96
|
-
case 'blockCard':
|
|
97
|
-
return colourScheme === 'traditional' ? traditionalStyleCardBlockNode : editingStyleCardBlockNode;
|
|
98
|
-
default:
|
|
99
|
-
return colourScheme === 'traditional' ? traditionalStyleNode : editingStyleNode;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
var editingStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
103
|
-
borderLeft: "2px solid ".concat("var(--ds-border-accent-purple, #AF59E1)")
|
|
104
|
-
});
|
|
105
|
-
var traditionalStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
106
|
-
borderLeft: "2px solid ".concat("var(--ds-border-accent-green, #22A06B)")
|
|
107
|
-
});
|
|
108
|
-
var editingStyleRuleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
109
|
-
backgroundColor: "var(--ds-border-accent-purple, #AF59E1)"
|
|
110
|
-
});
|
|
111
|
-
var traditionalStyleRuleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
112
|
-
backgroundColor: "var(--ds-border-accent-green, #22A06B)"
|
|
113
|
-
});
|
|
114
|
-
var editingStyleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
115
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
116
|
-
borderRadius: "var(--ds-radius-small, 4px)"
|
|
117
|
-
});
|
|
118
|
-
var traditionalStyleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
119
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
|
|
120
|
-
borderRadius: "var(--ds-radius-small, 4px)"
|
|
121
|
-
});
|
|
122
|
-
var editingStyleCardBlockNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
123
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
124
|
-
borderRadius: "var(--ds-radius-medium, 6px)"
|
|
125
|
-
});
|
|
126
|
-
var traditionalStyleCardBlockNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
127
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
|
|
128
|
-
borderRadius: "var(--ds-radius-medium, 6px)"
|
|
129
|
-
});
|
|
130
|
-
var deletedContentStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
131
|
-
color: "var(--ds-text-accent-gray, #505258)",
|
|
132
|
-
textDecoration: 'line-through',
|
|
133
|
-
position: 'relative',
|
|
134
|
-
opacity: 0.6
|
|
135
|
-
});
|
|
136
|
-
var deletedContentStyleActive = (0, _lazyNodeView.convertToInlineCss)({
|
|
137
|
-
color: "var(--ds-text, #292A2E)",
|
|
138
|
-
textDecoration: 'line-through',
|
|
139
|
-
textDecorationColor: "var(--ds-text-accent-gray, #505258)",
|
|
140
|
-
position: 'relative',
|
|
141
|
-
opacity: 1
|
|
142
|
-
});
|
|
143
|
-
var deletedContentStyleNew = (0, _lazyNodeView.convertToInlineCss)({
|
|
144
|
-
color: "var(--ds-text-accent-gray, #505258)",
|
|
145
|
-
textDecoration: 'line-through',
|
|
146
|
-
position: 'relative',
|
|
147
|
-
opacity: 0.8
|
|
148
|
-
});
|
|
149
|
-
var deletedContentStyleNewActive = (0, _lazyNodeView.convertToInlineCss)({
|
|
150
|
-
color: "var(--ds-text, #292A2E)",
|
|
151
|
-
textDecoration: 'line-through',
|
|
152
|
-
textDecorationColor: "var(--ds-text-accent-gray, #505258)",
|
|
153
|
-
position: 'relative',
|
|
154
|
-
opacity: 1
|
|
155
|
-
});
|
|
156
|
-
var deletedContentStyleUnbounded = (0, _lazyNodeView.convertToInlineCss)({
|
|
157
|
-
position: 'absolute',
|
|
158
|
-
top: '50%',
|
|
159
|
-
width: '100%',
|
|
160
|
-
display: 'inline-block',
|
|
161
|
-
borderTop: "1px solid ".concat("var(--ds-text-accent-gray, #505258)"),
|
|
162
|
-
pointerEvents: 'none',
|
|
163
|
-
zIndex: 1
|
|
164
|
-
});
|
|
165
|
-
var deletedTraditionalContentStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
166
|
-
textDecorationColor: "var(--ds-border-accent-red, #E2483D)",
|
|
167
|
-
textDecoration: 'line-through',
|
|
168
|
-
position: 'relative',
|
|
169
|
-
opacity: 1
|
|
170
|
-
});
|
|
171
|
-
var deletedTraditionalContentStyleUnbounded = (0, _lazyNodeView.convertToInlineCss)({
|
|
172
|
-
position: 'absolute',
|
|
173
|
-
top: '50%',
|
|
174
|
-
width: '100%',
|
|
175
|
-
display: 'inline-block',
|
|
176
|
-
borderTop: "1px solid ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
177
|
-
pointerEvents: 'none',
|
|
178
|
-
zIndex: 1
|
|
179
|
-
});
|
|
180
35
|
var getDeletedContentStyleUnbounded = exports.getDeletedContentStyleUnbounded = function getDeletedContentStyleUnbounded(colourScheme) {
|
|
181
|
-
return colourScheme === 'traditional' ? deletedTraditionalContentStyleUnbounded : deletedContentStyleUnbounded;
|
|
36
|
+
return colourScheme === 'traditional' ? _traditional.deletedTraditionalContentStyleUnbounded : _standard.deletedContentStyleUnbounded;
|
|
182
37
|
};
|
|
183
38
|
var getDeletedContentStyle = exports.getDeletedContentStyle = function getDeletedContentStyle(colourScheme) {
|
|
184
39
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
185
40
|
if (colourScheme === 'traditional') {
|
|
186
|
-
return deletedTraditionalContentStyle;
|
|
41
|
+
return _traditional.deletedTraditionalContentStyle;
|
|
187
42
|
}
|
|
188
43
|
if (isActive) {
|
|
189
|
-
return (0, _expValEquals.expValEquals)('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? deletedContentStyleNewActive : deletedContentStyleActive;
|
|
44
|
+
return (0, _expValEquals.expValEquals)('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? _standard.deletedContentStyleNewActive : _standard.deletedContentStyleActive;
|
|
190
45
|
}
|
|
191
|
-
return (0, _expValEquals.expValEquals)('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? deletedContentStyleNew : deletedContentStyle;
|
|
46
|
+
return (0, _expValEquals.expValEquals)('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? _standard.deletedContentStyleNew : _standard.deletedContentStyle;
|
|
192
47
|
};
|
|
193
48
|
var getNodeClass = function getNodeClass(name) {
|
|
194
49
|
switch (name) {
|
|
@@ -198,6 +53,9 @@ var getNodeClass = function getNodeClass(name) {
|
|
|
198
53
|
return undefined;
|
|
199
54
|
}
|
|
200
55
|
};
|
|
56
|
+
var getBlockNodeStyle = function getBlockNodeStyle(name, colourScheme) {
|
|
57
|
+
return colourScheme === 'traditional' ? (0, _traditional.getTraditionalNodeStyle)(name) : (0, _standard.getStandardNodeStyle)(name);
|
|
58
|
+
};
|
|
201
59
|
|
|
202
60
|
/**
|
|
203
61
|
* Inline decoration used for insertions as the content already exists in the document
|
|
@@ -207,11 +65,24 @@ var getNodeClass = function getNodeClass(name) {
|
|
|
207
65
|
*/
|
|
208
66
|
var createBlockChangedDecoration = exports.createBlockChangedDecoration = function createBlockChangedDecoration(change, colourScheme) {
|
|
209
67
|
return _view.Decoration.node(change.from, change.to, {
|
|
210
|
-
style:
|
|
68
|
+
style: getBlockNodeStyle(change.name, colourScheme),
|
|
211
69
|
'data-testid': 'show-diff-changed-decoration-node',
|
|
212
70
|
class: getNodeClass(change.name)
|
|
213
71
|
}, {});
|
|
214
72
|
};
|
|
73
|
+
var createContentWrapper = function createContentWrapper(colourScheme) {
|
|
74
|
+
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
75
|
+
var wrapper = document.createElement('span');
|
|
76
|
+
var baseStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
77
|
+
position: 'relative',
|
|
78
|
+
width: 'fit-content'
|
|
79
|
+
});
|
|
80
|
+
wrapper.setAttribute('style', "".concat(baseStyle).concat(getDeletedContentStyle(colourScheme, isActive)));
|
|
81
|
+
var strikethrough = document.createElement('span');
|
|
82
|
+
strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colourScheme));
|
|
83
|
+
wrapper.append(strikethrough);
|
|
84
|
+
return wrapper;
|
|
85
|
+
};
|
|
215
86
|
var createDeletedContentDecoration = exports.createDeletedContentDecoration = function createDeletedContentDecoration(_ref) {
|
|
216
87
|
var change = _ref.change,
|
|
217
88
|
doc = _ref.doc,
|
|
@@ -257,20 +128,6 @@ var createDeletedContentDecoration = exports.createDeletedContentDecoration = fu
|
|
|
257
128
|
* or sliced End depth is and match only the entire node.
|
|
258
129
|
*/
|
|
259
130
|
slice.content.forEach(function (node) {
|
|
260
|
-
// Create a wrapper for each node with strikethrough
|
|
261
|
-
var createWrapperWithStrikethrough = function createWrapperWithStrikethrough() {
|
|
262
|
-
var wrapper = document.createElement('span');
|
|
263
|
-
var baseStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
264
|
-
position: 'relative',
|
|
265
|
-
width: 'fit-content'
|
|
266
|
-
});
|
|
267
|
-
wrapper.setAttribute('style', "".concat(baseStyle).concat(getDeletedContentStyle(colourScheme, isActive)));
|
|
268
|
-
var strikethrough = document.createElement('span');
|
|
269
|
-
strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colourScheme));
|
|
270
|
-
wrapper.append(strikethrough);
|
|
271
|
-
return wrapper;
|
|
272
|
-
};
|
|
273
|
-
|
|
274
131
|
// Helper function to handle multiple child nodes
|
|
275
132
|
var handleMultipleChildNodes = function handleMultipleChildNodes(node) {
|
|
276
133
|
if (node.content.childCount > 1 && node.type.inlineContent) {
|
|
@@ -278,16 +135,15 @@ var createDeletedContentDecoration = exports.createDeletedContentDecoration = fu
|
|
|
278
135
|
var childNodeView = serializer.tryCreateNodeView(childNode);
|
|
279
136
|
if (childNodeView) {
|
|
280
137
|
var lineBreak = document.createElement('br');
|
|
281
|
-
targetNode = node;
|
|
282
138
|
dom.append(lineBreak);
|
|
283
|
-
var wrapper =
|
|
139
|
+
var wrapper = createContentWrapper(colourScheme, isActive);
|
|
284
140
|
wrapper.append(childNodeView);
|
|
285
141
|
dom.append(wrapper);
|
|
286
142
|
} else {
|
|
287
143
|
// Fallback to serializing the individual child node
|
|
288
144
|
var serializedChild = serializer.serializeNode(childNode);
|
|
289
145
|
if (serializedChild) {
|
|
290
|
-
var _wrapper =
|
|
146
|
+
var _wrapper = createContentWrapper(colourScheme, isActive);
|
|
291
147
|
_wrapper.append(serializedChild);
|
|
292
148
|
dom.append(_wrapper);
|
|
293
149
|
}
|
|
@@ -302,21 +158,15 @@ var createDeletedContentDecoration = exports.createDeletedContentDecoration = fu
|
|
|
302
158
|
var isFirst = slice.content.firstChild === node;
|
|
303
159
|
var isLast = slice.content.lastChild === node;
|
|
304
160
|
var hasInlineContent = node.content.childCount > 0 && node.type.inlineContent === true;
|
|
305
|
-
var targetNode;
|
|
306
161
|
var fallbackSerialization;
|
|
162
|
+
if (handleMultipleChildNodes(node)) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
307
165
|
if ((isFirst || isLast && slice.content.childCount > 2) && hasInlineContent) {
|
|
308
|
-
if (handleMultipleChildNodes(node)) {
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
targetNode = node;
|
|
312
166
|
fallbackSerialization = function fallbackSerialization() {
|
|
313
167
|
return serializer.serializeFragment(node.content);
|
|
314
168
|
};
|
|
315
169
|
} else if (isLast && slice.content.childCount === 2) {
|
|
316
|
-
if (handleMultipleChildNodes(node)) {
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
targetNode = node;
|
|
320
170
|
fallbackSerialization = function fallbackSerialization() {
|
|
321
171
|
if (node.type.name === 'text') {
|
|
322
172
|
return document.createTextNode(node.text || '');
|
|
@@ -329,27 +179,23 @@ var createDeletedContentDecoration = exports.createDeletedContentDecoration = fu
|
|
|
329
179
|
return serializer.serializeFragment(node.content);
|
|
330
180
|
};
|
|
331
181
|
} else {
|
|
332
|
-
if (handleMultipleChildNodes(node)) {
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
targetNode = node;
|
|
336
182
|
fallbackSerialization = function fallbackSerialization() {
|
|
337
183
|
return serializer.serializeNode(node);
|
|
338
184
|
};
|
|
339
185
|
}
|
|
340
186
|
|
|
341
187
|
// Try to create node view, fallback to serialization
|
|
342
|
-
var nodeView = serializer.tryCreateNodeView(
|
|
188
|
+
var nodeView = serializer.tryCreateNodeView(node);
|
|
343
189
|
if (nodeView) {
|
|
344
|
-
if (
|
|
345
|
-
var wrapper =
|
|
190
|
+
if (node.isInline) {
|
|
191
|
+
var wrapper = createContentWrapper(colourScheme, isActive);
|
|
346
192
|
wrapper.append(nodeView);
|
|
347
193
|
dom.append(wrapper);
|
|
348
194
|
} else {
|
|
349
195
|
// Handle all block nodes with unified function
|
|
350
|
-
(0, _deletedBlocksHandler.handleBlockNodeView)(dom, nodeView,
|
|
196
|
+
(0, _deletedBlocksHandler.handleBlockNodeView)(dom, nodeView, node, colourScheme, intl);
|
|
351
197
|
}
|
|
352
|
-
} else if (nodeViewSerializer.getFilteredNodeViewBlocklist(['paragraph', 'tableRow']).has(
|
|
198
|
+
} else if (nodeViewSerializer.getFilteredNodeViewBlocklist(['paragraph', 'tableRow']).has(node.type.name)) {
|
|
353
199
|
// Skip the case where the node is a paragraph or table row that way it can still be rendered and delete the entire table
|
|
354
200
|
return;
|
|
355
201
|
} else {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
|
+
export const editingStyle = convertToInlineCss({
|
|
3
|
+
background: "var(--ds-background-accent-purple-subtlest, #F8EEFE)",
|
|
4
|
+
textDecoration: 'underline',
|
|
5
|
+
textDecorationStyle: 'dotted',
|
|
6
|
+
textDecorationThickness: "var(--ds-space-025, 2px)",
|
|
7
|
+
textDecorationColor: "var(--ds-border-accent-purple, #AF59E1)"
|
|
8
|
+
});
|
|
9
|
+
export const editingStyleActive = convertToInlineCss({
|
|
10
|
+
background: "var(--ds-background-accent-purple-subtler, #EED7FC)",
|
|
11
|
+
textDecoration: 'underline',
|
|
12
|
+
textDecorationStyle: 'dotted',
|
|
13
|
+
textDecorationThickness: "var(--ds-space-025, 2px)",
|
|
14
|
+
textDecorationColor: "var(--ds-text-accent-purple, #803FA5)"
|
|
15
|
+
});
|
|
16
|
+
export const deletedContentStyle = convertToInlineCss({
|
|
17
|
+
color: "var(--ds-text-accent-gray, #505258)",
|
|
18
|
+
textDecoration: 'line-through',
|
|
19
|
+
position: 'relative',
|
|
20
|
+
opacity: 0.6
|
|
21
|
+
});
|
|
22
|
+
export const deletedContentStyleActive = convertToInlineCss({
|
|
23
|
+
color: "var(--ds-text, #292A2E)",
|
|
24
|
+
textDecoration: 'line-through',
|
|
25
|
+
textDecorationColor: "var(--ds-text-accent-gray, #505258)",
|
|
26
|
+
position: 'relative',
|
|
27
|
+
opacity: 1
|
|
28
|
+
});
|
|
29
|
+
export const deletedContentStyleNew = convertToInlineCss({
|
|
30
|
+
color: "var(--ds-text-accent-gray, #505258)",
|
|
31
|
+
textDecoration: 'line-through',
|
|
32
|
+
position: 'relative',
|
|
33
|
+
opacity: 0.8
|
|
34
|
+
});
|
|
35
|
+
export const deletedContentStyleNewActive = convertToInlineCss({
|
|
36
|
+
color: "var(--ds-text, #292A2E)",
|
|
37
|
+
textDecoration: 'line-through',
|
|
38
|
+
textDecorationColor: "var(--ds-text-accent-gray, #505258)",
|
|
39
|
+
position: 'relative',
|
|
40
|
+
opacity: 1
|
|
41
|
+
});
|
|
42
|
+
export const deletedContentStyleUnbounded = convertToInlineCss({
|
|
43
|
+
position: 'absolute',
|
|
44
|
+
top: '50%',
|
|
45
|
+
width: '100%',
|
|
46
|
+
display: 'inline-block',
|
|
47
|
+
borderTop: `1px solid ${"var(--ds-text-accent-gray, #505258)"}`,
|
|
48
|
+
pointerEvents: 'none',
|
|
49
|
+
zIndex: 1
|
|
50
|
+
});
|
|
51
|
+
const editingStyleQuoteNode = convertToInlineCss({
|
|
52
|
+
borderLeft: `2px solid ${"var(--ds-border-accent-purple, #AF59E1)"}`
|
|
53
|
+
});
|
|
54
|
+
const editingStyleRuleNode = convertToInlineCss({
|
|
55
|
+
backgroundColor: "var(--ds-border-accent-purple, #AF59E1)"
|
|
56
|
+
});
|
|
57
|
+
const editingStyleNode = convertToInlineCss({
|
|
58
|
+
boxShadow: `0 0 0 1px ${"var(--ds-border-accent-purple, #AF59E1)"}`,
|
|
59
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
60
|
+
});
|
|
61
|
+
const editingStyleCardBlockNode = convertToInlineCss({
|
|
62
|
+
boxShadow: `0 0 0 1px ${"var(--ds-border-accent-purple, #AF59E1)"}`,
|
|
63
|
+
borderRadius: "var(--ds-radius-medium, 6px)"
|
|
64
|
+
});
|
|
65
|
+
const standardDecorationMarkerVariableName = convertToInlineCss({
|
|
66
|
+
'--diff-decoration-marker-color': "var(--ds-border-accent-purple, #AF59E1)"
|
|
67
|
+
});
|
|
68
|
+
export const getStandardNodeStyle = nodeName => {
|
|
69
|
+
if (['mediaSingle', 'mediaGroup', 'table',
|
|
70
|
+
// Handle table separately to avoid border issues
|
|
71
|
+
'tableRow', 'tableCell', 'tableHeader', 'paragraph',
|
|
72
|
+
// Paragraph and heading nodes do not need special styling
|
|
73
|
+
'heading', 'hardBreak', 'decisionList', 'taskList', 'taskItem', 'bulletList', 'orderedList', 'layoutSection'].includes(nodeName)) {
|
|
74
|
+
// Layout nodes do not need special styling
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
if (['extension', 'embedCard', 'listItem'].includes(nodeName)) {
|
|
78
|
+
return standardDecorationMarkerVariableName;
|
|
79
|
+
}
|
|
80
|
+
if (nodeName === 'blockquote') {
|
|
81
|
+
return editingStyleQuoteNode;
|
|
82
|
+
}
|
|
83
|
+
if (nodeName === 'rule') {
|
|
84
|
+
return editingStyleRuleNode;
|
|
85
|
+
}
|
|
86
|
+
if (nodeName === 'blockCard') {
|
|
87
|
+
return editingStyleCardBlockNode;
|
|
88
|
+
}
|
|
89
|
+
return editingStyleNode;
|
|
90
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
|
+
export const traditionalInsertStyle = convertToInlineCss({
|
|
3
|
+
background: "var(--ds-background-accent-green-subtlest, #DCFFF1)",
|
|
4
|
+
textDecoration: 'underline',
|
|
5
|
+
textDecorationStyle: 'solid',
|
|
6
|
+
textDecorationThickness: "var(--ds-space-025, 2px)",
|
|
7
|
+
textDecorationColor: "var(--ds-border-accent-green, #22A06B)"
|
|
8
|
+
});
|
|
9
|
+
export const traditionalInsertStyleActive = convertToInlineCss({
|
|
10
|
+
background: "var(--ds-background-accent-green-subtler, #BAF3DB)",
|
|
11
|
+
textDecoration: 'underline',
|
|
12
|
+
textDecorationStyle: 'solid',
|
|
13
|
+
textDecorationThickness: "var(--ds-space-025, 2px)",
|
|
14
|
+
textDecorationColor: "var(--ds-text-accent-green, #216E4E)"
|
|
15
|
+
});
|
|
16
|
+
export const deletedTraditionalContentStyle = convertToInlineCss({
|
|
17
|
+
textDecorationColor: "var(--ds-border-accent-red, #E2483D)",
|
|
18
|
+
textDecoration: 'line-through',
|
|
19
|
+
position: 'relative',
|
|
20
|
+
opacity: 1
|
|
21
|
+
});
|
|
22
|
+
export const deletedTraditionalContentStyleUnbounded = convertToInlineCss({
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
top: '50%',
|
|
25
|
+
width: '100%',
|
|
26
|
+
display: 'inline-block',
|
|
27
|
+
borderTop: `1px solid ${"var(--ds-border-accent-red, #E2483D)"}`,
|
|
28
|
+
pointerEvents: 'none',
|
|
29
|
+
zIndex: 1
|
|
30
|
+
});
|
|
31
|
+
const traditionalStyleQuoteNode = convertToInlineCss({
|
|
32
|
+
borderLeft: `2px solid ${"var(--ds-border-accent-green, #22A06B)"}`
|
|
33
|
+
});
|
|
34
|
+
const traditionalStyleRuleNode = convertToInlineCss({
|
|
35
|
+
backgroundColor: "var(--ds-border-accent-green, #22A06B)"
|
|
36
|
+
});
|
|
37
|
+
const traditionalStyleNode = convertToInlineCss({
|
|
38
|
+
boxShadow: `0 0 0 1px ${"var(--ds-border-accent-green, #22A06B)"}`,
|
|
39
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
40
|
+
});
|
|
41
|
+
const traditionalStyleCardBlockNode = convertToInlineCss({
|
|
42
|
+
boxShadow: `0 0 0 1px ${"var(--ds-border-accent-green, #22A06B)"}`,
|
|
43
|
+
borderRadius: "var(--ds-radius-medium, 6px)"
|
|
44
|
+
});
|
|
45
|
+
const traditionalDecorationMarkerVariable = convertToInlineCss({
|
|
46
|
+
'--diff-decoration-marker-color': "var(--ds-border-accent-green, #22A06B)"
|
|
47
|
+
});
|
|
48
|
+
export const getTraditionalNodeStyle = nodeName => {
|
|
49
|
+
if (['mediaSingle', 'mediaGroup', 'table',
|
|
50
|
+
// Handle table separately to avoid border issues
|
|
51
|
+
'tableRow', 'tableCell', 'tableHeader', 'paragraph',
|
|
52
|
+
// Paragraph and heading nodes do not need special styling
|
|
53
|
+
'heading', 'hardBreak', 'decisionList', 'taskList', 'taskItem', 'bulletList', 'orderedList', 'layoutSection'].includes(nodeName)) {
|
|
54
|
+
// Layout nodes do not need special styling
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
if (['extension', 'embedCard', 'listItem'].includes(nodeName)) {
|
|
58
|
+
return traditionalDecorationMarkerVariable;
|
|
59
|
+
}
|
|
60
|
+
if (nodeName === 'blockquote') {
|
|
61
|
+
return traditionalStyleQuoteNode;
|
|
62
|
+
}
|
|
63
|
+
if (nodeName === 'rule') {
|
|
64
|
+
return traditionalStyleRuleNode;
|
|
65
|
+
}
|
|
66
|
+
if (nodeName === 'blockCard') {
|
|
67
|
+
return traditionalStyleCardBlockNode;
|
|
68
|
+
}
|
|
69
|
+
return traditionalStyleNode;
|
|
70
|
+
};
|