@atlaskit/editor-plugin-show-diff 5.0.3 → 5.0.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 +14 -0
- package/dist/cjs/pm-plugins/calculateDiffDecorations.js +56 -31
- package/dist/cjs/pm-plugins/colorSchemes/standard.js +32 -30
- package/dist/cjs/pm-plugins/colorSchemes/traditional.js +29 -30
- package/dist/cjs/pm-plugins/decorations.js +57 -16
- package/dist/cjs/pm-plugins/deletedBlocksHandler.js +15 -57
- package/dist/cjs/pm-plugins/deletedRowsHandler.js +9 -15
- package/dist/es2019/pm-plugins/calculateDiffDecorations.js +35 -9
- package/dist/es2019/pm-plugins/colorSchemes/standard.js +31 -29
- package/dist/es2019/pm-plugins/colorSchemes/traditional.js +28 -29
- package/dist/es2019/pm-plugins/decorations.js +51 -8
- package/dist/es2019/pm-plugins/deletedBlocksHandler.js +11 -53
- package/dist/es2019/pm-plugins/deletedRowsHandler.js +9 -14
- package/dist/esm/pm-plugins/calculateDiffDecorations.js +56 -31
- package/dist/esm/pm-plugins/colorSchemes/standard.js +31 -29
- package/dist/esm/pm-plugins/colorSchemes/traditional.js +28 -29
- package/dist/esm/pm-plugins/decorations.js +59 -18
- package/dist/esm/pm-plugins/deletedBlocksHandler.js +11 -53
- package/dist/esm/pm-plugins/deletedRowsHandler.js +8 -14
- package/dist/types/pm-plugins/colorSchemes/standard.d.ts +10 -1
- package/dist/types/pm-plugins/colorSchemes/traditional.d.ts +9 -1
- package/dist/types/pm-plugins/decorations.d.ts +16 -9
- package/dist/types/pm-plugins/deletedBlocksHandler.d.ts +0 -45
- package/dist/types/pm-plugins/deletedRowsHandler.d.ts +7 -1
- package/dist/types-ts4.5/pm-plugins/colorSchemes/standard.d.ts +10 -1
- package/dist/types-ts4.5/pm-plugins/colorSchemes/traditional.d.ts +9 -1
- package/dist/types-ts4.5/pm-plugins/decorations.d.ts +16 -9
- package/dist/types-ts4.5/pm-plugins/deletedBlocksHandler.d.ts +0 -45
- package/dist/types-ts4.5/pm-plugins/deletedRowsHandler.d.ts +7 -1
- package/package.json +3 -3
|
@@ -48,43 +48,45 @@ export var deletedContentStyleUnbounded = convertToInlineCss({
|
|
|
48
48
|
pointerEvents: 'none',
|
|
49
49
|
zIndex: 1
|
|
50
50
|
});
|
|
51
|
-
var
|
|
51
|
+
export var deletedStyleQuoteNode = convertToInlineCss({
|
|
52
|
+
borderLeft: "2px solid ".concat("var(--ds-border-accent-gray, #7D818A)")
|
|
53
|
+
});
|
|
54
|
+
export var deletedStyleQuoteNodeWithLozenge = convertToInlineCss({
|
|
55
|
+
marginTop: "var(--ds-space-150, 12px)",
|
|
56
|
+
paddingTop: "var(--ds-space-025, 2px)",
|
|
57
|
+
paddingBottom: "var(--ds-space-025, 2px)",
|
|
58
|
+
paddingLeft: "var(--ds-space-025, 2px)",
|
|
59
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
60
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
61
|
+
});
|
|
62
|
+
export var deletedBlockOutline = convertToInlineCss({
|
|
63
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
64
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
65
|
+
});
|
|
66
|
+
export var deletedBlockOutlineRounded = convertToInlineCss({
|
|
67
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
68
|
+
borderRadius: "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)")
|
|
69
|
+
});
|
|
70
|
+
export var deletedRowStyle = convertToInlineCss({
|
|
71
|
+
color: "var(--ds-text-accent-gray, #505258)",
|
|
72
|
+
textDecoration: 'line-through',
|
|
73
|
+
opacity: 0.6,
|
|
74
|
+
display: 'table-row'
|
|
75
|
+
});
|
|
76
|
+
export var editingStyleQuoteNode = convertToInlineCss({
|
|
52
77
|
borderLeft: "2px solid ".concat("var(--ds-border-accent-purple, #AF59E1)")
|
|
53
78
|
});
|
|
54
|
-
var editingStyleRuleNode = convertToInlineCss({
|
|
79
|
+
export var editingStyleRuleNode = convertToInlineCss({
|
|
55
80
|
backgroundColor: "var(--ds-border-accent-purple, #AF59E1)"
|
|
56
81
|
});
|
|
57
|
-
var editingStyleNode = convertToInlineCss({
|
|
82
|
+
export var editingStyleNode = convertToInlineCss({
|
|
58
83
|
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
59
84
|
borderRadius: "var(--ds-radius-small, 4px)"
|
|
60
85
|
});
|
|
61
|
-
var editingStyleCardBlockNode = convertToInlineCss({
|
|
86
|
+
export var editingStyleCardBlockNode = convertToInlineCss({
|
|
62
87
|
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
63
88
|
borderRadius: "var(--ds-radius-medium, 6px)"
|
|
64
89
|
});
|
|
65
|
-
var
|
|
90
|
+
export var standardDecorationMarkerVariable = convertToInlineCss({
|
|
66
91
|
'--diff-decoration-marker-color': "var(--ds-border-accent-purple, #AF59E1)"
|
|
67
|
-
});
|
|
68
|
-
export var getStandardNodeStyle = function 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
|
-
};
|
|
92
|
+
});
|
|
@@ -28,43 +28,42 @@ export var deletedTraditionalContentStyleUnbounded = convertToInlineCss({
|
|
|
28
28
|
pointerEvents: 'none',
|
|
29
29
|
zIndex: 1
|
|
30
30
|
});
|
|
31
|
-
var
|
|
31
|
+
export var deletedTraditionalStyleQuoteNode = convertToInlineCss({
|
|
32
|
+
marginTop: "var(--ds-space-150, 12px)",
|
|
33
|
+
paddingTop: "var(--ds-space-025, 2px)",
|
|
34
|
+
paddingBottom: "var(--ds-space-025, 2px)",
|
|
35
|
+
paddingLeft: "var(--ds-space-025, 2px)",
|
|
36
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
37
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
38
|
+
});
|
|
39
|
+
export var deletedTraditionalBlockOutline = convertToInlineCss({
|
|
40
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
41
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
42
|
+
});
|
|
43
|
+
export var deletedTraditionalBlockOutlineRounded = convertToInlineCss({
|
|
44
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
45
|
+
borderRadius: "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)")
|
|
46
|
+
});
|
|
47
|
+
export var deletedTraditionalRowStyle = convertToInlineCss({
|
|
48
|
+
textDecorationColor: "var(--ds-border-accent-red, #E2483D)",
|
|
49
|
+
textDecoration: 'line-through',
|
|
50
|
+
opacity: 0.6,
|
|
51
|
+
display: 'table-row'
|
|
52
|
+
});
|
|
53
|
+
export var traditionalStyleQuoteNode = convertToInlineCss({
|
|
32
54
|
borderLeft: "2px solid ".concat("var(--ds-border-accent-green, #22A06B)")
|
|
33
55
|
});
|
|
34
|
-
var traditionalStyleRuleNode = convertToInlineCss({
|
|
56
|
+
export var traditionalStyleRuleNode = convertToInlineCss({
|
|
35
57
|
backgroundColor: "var(--ds-border-accent-green, #22A06B)"
|
|
36
58
|
});
|
|
37
|
-
var traditionalStyleNode = convertToInlineCss({
|
|
59
|
+
export var traditionalStyleNode = convertToInlineCss({
|
|
38
60
|
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
|
|
39
61
|
borderRadius: "var(--ds-radius-small, 4px)"
|
|
40
62
|
});
|
|
41
|
-
var traditionalStyleCardBlockNode = convertToInlineCss({
|
|
63
|
+
export var traditionalStyleCardBlockNode = convertToInlineCss({
|
|
42
64
|
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
|
|
43
65
|
borderRadius: "var(--ds-radius-medium, 6px)"
|
|
44
66
|
});
|
|
45
|
-
var traditionalDecorationMarkerVariable = convertToInlineCss({
|
|
67
|
+
export var traditionalDecorationMarkerVariable = convertToInlineCss({
|
|
46
68
|
'--diff-decoration-marker-color': "var(--ds-border-accent-green, #22A06B)"
|
|
47
|
-
});
|
|
48
|
-
export var getTraditionalNodeStyle = function 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
|
-
};
|
|
69
|
+
});
|
|
@@ -2,9 +2,9 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
|
2
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleNewActive, editingStyle, editingStyleActive, deletedContentStyleUnbounded, standardDecorationMarkerVariable, editingStyleQuoteNode, editingStyleRuleNode, editingStyleCardBlockNode, editingStyleNode } from './colorSchemes/standard';
|
|
6
|
+
import { deletedTraditionalContentStyle, deletedTraditionalContentStyleUnbounded, traditionalInsertStyle, traditionalInsertStyleActive, traditionalDecorationMarkerVariable, traditionalStyleQuoteNode, traditionalStyleRuleNode, traditionalStyleCardBlockNode, traditionalStyleNode } from './colorSchemes/traditional';
|
|
7
|
+
import { handleBlockNodeView } from './deletedBlocksHandler';
|
|
8
8
|
import { handleDeletedRows } from './deletedRowsHandler';
|
|
9
9
|
import { findSafeInsertPos } from './findSafeInsertPos';
|
|
10
10
|
/**
|
|
@@ -13,8 +13,11 @@ import { findSafeInsertPos } from './findSafeInsertPos';
|
|
|
13
13
|
* @param change Changeset "change" containing information about the change content + range
|
|
14
14
|
* @returns Prosemirror inline decoration
|
|
15
15
|
*/
|
|
16
|
-
export var createInlineChangedDecoration = function createInlineChangedDecoration(
|
|
17
|
-
var
|
|
16
|
+
export var createInlineChangedDecoration = function createInlineChangedDecoration(_ref) {
|
|
17
|
+
var change = _ref.change,
|
|
18
|
+
colorScheme = _ref.colorScheme,
|
|
19
|
+
_ref$isActive = _ref.isActive,
|
|
20
|
+
isActive = _ref$isActive === void 0 ? false : _ref$isActive;
|
|
18
21
|
var style;
|
|
19
22
|
if (colorScheme === 'traditional') {
|
|
20
23
|
style = isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
|
|
@@ -49,8 +52,38 @@ var getNodeClass = function getNodeClass(name) {
|
|
|
49
52
|
return undefined;
|
|
50
53
|
}
|
|
51
54
|
};
|
|
52
|
-
var getBlockNodeStyle = function getBlockNodeStyle(
|
|
53
|
-
|
|
55
|
+
var getBlockNodeStyle = function getBlockNodeStyle(nodeName, colorScheme) {
|
|
56
|
+
var isTraditional = colorScheme === 'traditional';
|
|
57
|
+
if (['mediaSingle', 'mediaGroup', 'table',
|
|
58
|
+
// Handle table separately to avoid border issues
|
|
59
|
+
'tableRow', 'tableCell', 'tableHeader', 'paragraph',
|
|
60
|
+
// Paragraph and heading nodes do not need special styling
|
|
61
|
+
'heading', 'hardBreak', 'decisionList', 'taskList', 'taskItem', 'bulletList', 'orderedList', 'layoutSection'].includes(nodeName)) {
|
|
62
|
+
// Layout nodes do not need special styling
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
if (['extension', 'embedCard', 'listItem'].includes(nodeName)) {
|
|
66
|
+
return isTraditional ? traditionalDecorationMarkerVariable : standardDecorationMarkerVariable;
|
|
67
|
+
}
|
|
68
|
+
if (nodeName === 'blockquote') {
|
|
69
|
+
return isTraditional ? traditionalStyleQuoteNode : editingStyleQuoteNode;
|
|
70
|
+
}
|
|
71
|
+
if (nodeName === 'rule') {
|
|
72
|
+
return isTraditional ? traditionalStyleRuleNode : editingStyleRuleNode;
|
|
73
|
+
}
|
|
74
|
+
if (nodeName === 'blockCard') {
|
|
75
|
+
return isTraditional ? traditionalStyleCardBlockNode : editingStyleCardBlockNode;
|
|
76
|
+
}
|
|
77
|
+
return isTraditional ? traditionalStyleNode : editingStyleNode;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Wraps content with deleted styling without opacity (for use when content is a direct child of dom)
|
|
82
|
+
*/
|
|
83
|
+
var createDeletedStyleWrapperWithoutOpacity = function createDeletedStyleWrapperWithoutOpacity(colorScheme, isActive) {
|
|
84
|
+
var wrapper = document.createElement('span');
|
|
85
|
+
wrapper.setAttribute('style', getDeletedContentStyle(colorScheme, isActive));
|
|
86
|
+
return wrapper;
|
|
54
87
|
};
|
|
55
88
|
|
|
56
89
|
/**
|
|
@@ -59,7 +92,9 @@ var getBlockNodeStyle = function getBlockNodeStyle(name, colorScheme) {
|
|
|
59
92
|
* @param change Changeset "change" containing information about the change content + range
|
|
60
93
|
* @returns Prosemirror inline decoration
|
|
61
94
|
*/
|
|
62
|
-
export var createBlockChangedDecoration = function createBlockChangedDecoration(
|
|
95
|
+
export var createBlockChangedDecoration = function createBlockChangedDecoration(_ref2) {
|
|
96
|
+
var change = _ref2.change,
|
|
97
|
+
colorScheme = _ref2.colorScheme;
|
|
63
98
|
if (fg('platform_editor_show_diff_scroll_navigation')) {
|
|
64
99
|
var style = getBlockNodeStyle(change.name, colorScheme);
|
|
65
100
|
var className = getNodeClass(change.name);
|
|
@@ -96,15 +131,15 @@ var createContentWrapper = function createContentWrapper(colorScheme) {
|
|
|
96
131
|
wrapper.append(strikethrough);
|
|
97
132
|
return wrapper;
|
|
98
133
|
};
|
|
99
|
-
export var createDeletedContentDecoration = function createDeletedContentDecoration(
|
|
100
|
-
var change =
|
|
101
|
-
doc =
|
|
102
|
-
nodeViewSerializer =
|
|
103
|
-
colorScheme =
|
|
104
|
-
newDoc =
|
|
105
|
-
intl =
|
|
106
|
-
|
|
107
|
-
isActive =
|
|
134
|
+
export var createDeletedContentDecoration = function createDeletedContentDecoration(_ref3) {
|
|
135
|
+
var change = _ref3.change,
|
|
136
|
+
doc = _ref3.doc,
|
|
137
|
+
nodeViewSerializer = _ref3.nodeViewSerializer,
|
|
138
|
+
colorScheme = _ref3.colorScheme,
|
|
139
|
+
newDoc = _ref3.newDoc,
|
|
140
|
+
intl = _ref3.intl,
|
|
141
|
+
_ref3$isActive = _ref3.isActive,
|
|
142
|
+
isActive = _ref3$isActive === void 0 ? false : _ref3$isActive;
|
|
108
143
|
var slice = doc.slice(change.fromA, change.toA);
|
|
109
144
|
if (slice.content.content.length === 0) {
|
|
110
145
|
return;
|
|
@@ -126,7 +161,13 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
|
|
|
126
161
|
if (!fg('platform_editor_ai_aifc_patch_ga')) {
|
|
127
162
|
return;
|
|
128
163
|
}
|
|
129
|
-
var _handleDeletedRows = handleDeletedRows(
|
|
164
|
+
var _handleDeletedRows = handleDeletedRows({
|
|
165
|
+
changes: [change],
|
|
166
|
+
originalDoc: doc,
|
|
167
|
+
newDoc: newDoc,
|
|
168
|
+
nodeViewSerializer: nodeViewSerializer,
|
|
169
|
+
colorScheme: colorScheme
|
|
170
|
+
}),
|
|
130
171
|
decorations = _handleDeletedRows.decorations;
|
|
131
172
|
return decorations;
|
|
132
173
|
}
|
|
@@ -4,42 +4,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
5
5
|
import { trackChangesMessages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { deletedStyleQuoteNode, deletedStyleQuoteNodeWithLozenge, deletedBlockOutline, deletedBlockOutlineRounded } from './colorSchemes/standard';
|
|
8
|
+
import { deletedTraditionalStyleQuoteNode, deletedTraditionalBlockOutline, deletedTraditionalBlockOutlineRounded } from './colorSchemes/traditional';
|
|
7
9
|
import { getDeletedContentStyle } from './decorations';
|
|
8
|
-
export var deletedStyleQuoteNode = convertToInlineCss({
|
|
9
|
-
borderLeft: "2px solid ".concat("var(--ds-border-accent-gray, #7D818A)")
|
|
10
|
-
});
|
|
11
|
-
export var deletedStyleQuoteNodeWithLozenge = convertToInlineCss({
|
|
12
|
-
marginTop: "var(--ds-space-150, 12px)",
|
|
13
|
-
paddingTop: "var(--ds-space-025, 2px)",
|
|
14
|
-
paddingBottom: "var(--ds-space-025, 2px)",
|
|
15
|
-
paddingLeft: "var(--ds-space-025, 2px)",
|
|
16
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
17
|
-
borderRadius: "var(--ds-radius-small, 4px)"
|
|
18
|
-
});
|
|
19
|
-
export var deletedTraditionalStyleQuoteNode = convertToInlineCss({
|
|
20
|
-
marginTop: "var(--ds-space-150, 12px)",
|
|
21
|
-
paddingTop: "var(--ds-space-025, 2px)",
|
|
22
|
-
paddingBottom: "var(--ds-space-025, 2px)",
|
|
23
|
-
paddingLeft: "var(--ds-space-025, 2px)",
|
|
24
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
25
|
-
borderRadius: "var(--ds-radius-small, 4px)"
|
|
26
|
-
});
|
|
27
|
-
export var deletedBlockOutline = convertToInlineCss({
|
|
28
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
29
|
-
borderRadius: "var(--ds-radius-small, 4px)"
|
|
30
|
-
});
|
|
31
|
-
export var deletedTraditionalBlockOutline = convertToInlineCss({
|
|
32
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
33
|
-
borderRadius: "var(--ds-radius-small, 4px)"
|
|
34
|
-
});
|
|
35
|
-
export var deletedBlockOutlineRounded = convertToInlineCss({
|
|
36
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
37
|
-
borderRadius: "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)")
|
|
38
|
-
});
|
|
39
|
-
export var deletedTraditionalBlockOutlineRounded = convertToInlineCss({
|
|
40
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
41
|
-
borderRadius: "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)")
|
|
42
|
-
});
|
|
43
10
|
var lozengeStyle = convertToInlineCss({
|
|
44
11
|
display: 'inline-flex',
|
|
45
12
|
boxSizing: 'border-box',
|
|
@@ -71,7 +38,7 @@ export var getDeletedStyleNode = function getDeletedStyleNode(nodeName, colorSch
|
|
|
71
38
|
return undefined;
|
|
72
39
|
}
|
|
73
40
|
};
|
|
74
|
-
|
|
41
|
+
var shouldShowRemovedLozenge = function shouldShowRemovedLozenge(nodeName) {
|
|
75
42
|
switch (nodeName) {
|
|
76
43
|
case 'expand':
|
|
77
44
|
case 'codeBlock':
|
|
@@ -86,7 +53,7 @@ export var shouldShowRemovedLozenge = function shouldShowRemovedLozenge(nodeName
|
|
|
86
53
|
return false;
|
|
87
54
|
}
|
|
88
55
|
};
|
|
89
|
-
|
|
56
|
+
var shouldAddShowDiffDeletedNodeClass = function shouldAddShowDiffDeletedNodeClass(nodeName) {
|
|
90
57
|
switch (nodeName) {
|
|
91
58
|
case 'mediaSingle':
|
|
92
59
|
case 'embedCard':
|
|
@@ -102,14 +69,14 @@ export var shouldAddShowDiffDeletedNodeClass = function shouldAddShowDiffDeleted
|
|
|
102
69
|
* Checks if a node should apply deleted styles directly without wrapper
|
|
103
70
|
* to preserve natural block-level margins
|
|
104
71
|
*/
|
|
105
|
-
|
|
72
|
+
var shouldApplyDeletedStylesDirectly = function shouldApplyDeletedStylesDirectly(nodeName) {
|
|
106
73
|
return nodeName === 'heading' || nodeName === 'blockquote' && !fg('platform_editor_ai_aifc_patch_ga_blockers');
|
|
107
74
|
};
|
|
108
75
|
|
|
109
76
|
/**
|
|
110
77
|
* Creates a "Removed" lozenge to be displayed at the top right corner of deleted block nodes
|
|
111
78
|
*/
|
|
112
|
-
|
|
79
|
+
var createRemovedLozenge = function createRemovedLozenge(intl, nodeName) {
|
|
113
80
|
var container = document.createElement('span');
|
|
114
81
|
var borderTopRightRadius;
|
|
115
82
|
if (['expand', 'decisionList'].includes(nodeName || '')) {
|
|
@@ -142,7 +109,7 @@ export var createRemovedLozenge = function createRemovedLozenge(intl, nodeName)
|
|
|
142
109
|
/**
|
|
143
110
|
* Wraps a block node in a container with relative positioning to support absolute positioned lozenge
|
|
144
111
|
*/
|
|
145
|
-
|
|
112
|
+
var createBlockNodeWrapper = function createBlockNodeWrapper() {
|
|
146
113
|
var wrapper = document.createElement('div');
|
|
147
114
|
var baseStyle = convertToInlineCss({
|
|
148
115
|
position: 'relative',
|
|
@@ -153,19 +120,10 @@ export var createBlockNodeWrapper = function createBlockNodeWrapper() {
|
|
|
153
120
|
return wrapper;
|
|
154
121
|
};
|
|
155
122
|
|
|
156
|
-
/**
|
|
157
|
-
* Wraps content with deleted styling without opacity (for use when content is a direct child of dom)
|
|
158
|
-
*/
|
|
159
|
-
export var createDeletedStyleWrapperWithoutOpacity = function createDeletedStyleWrapperWithoutOpacity(colorScheme, isActive) {
|
|
160
|
-
var wrapper = document.createElement('span');
|
|
161
|
-
wrapper.setAttribute('style', getDeletedContentStyle(colorScheme, isActive));
|
|
162
|
-
return wrapper;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
123
|
/**
|
|
166
124
|
* Applies deleted styles directly to an HTML element by merging with existing styles
|
|
167
125
|
*/
|
|
168
|
-
|
|
126
|
+
var applyDeletedStylesToElement = function applyDeletedStylesToElement(element, targetNode, colorScheme) {
|
|
169
127
|
var currentStyle = element.getAttribute('style') || '';
|
|
170
128
|
var deletedContentStyle = getDeletedContentStyle(colorScheme);
|
|
171
129
|
var nodeSpecificStyle = getDeletedStyleNode(targetNode.type.name, colorScheme) || '';
|
|
@@ -175,7 +133,7 @@ export var applyDeletedStylesToElement = function applyDeletedStylesToElement(el
|
|
|
175
133
|
/**
|
|
176
134
|
* Creates a content wrapper with deleted styles for a block node
|
|
177
135
|
*/
|
|
178
|
-
|
|
136
|
+
var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(nodeView, targetNode, colorScheme) {
|
|
179
137
|
var contentWrapper = document.createElement('div');
|
|
180
138
|
var nodeStyle = getDeletedStyleNode(targetNode.type.name, colorScheme);
|
|
181
139
|
contentWrapper.setAttribute('style', "".concat(getDeletedContentStyle(colorScheme)).concat(nodeStyle || ''));
|
|
@@ -189,7 +147,7 @@ export var createBlockNodeContentWrapper = function createBlockNodeContentWrappe
|
|
|
189
147
|
* to wait for the rich-media-item to appear before attaching the lozenge.
|
|
190
148
|
* @returns true if embedCard was handled
|
|
191
149
|
*/
|
|
192
|
-
|
|
150
|
+
var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(dom, nodeView, targetNode, lozenge, colorScheme) {
|
|
193
151
|
if (targetNode.type.name !== 'embedCard' || !(nodeView instanceof HTMLElement)) {
|
|
194
152
|
return false;
|
|
195
153
|
}
|
|
@@ -250,7 +208,7 @@ export var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(
|
|
|
250
208
|
/**
|
|
251
209
|
* Appends a block node with wrapper, lozenge, and appropriate styling
|
|
252
210
|
*/
|
|
253
|
-
|
|
211
|
+
var appendBlockNodeWithWrapper = function appendBlockNodeWithWrapper(dom, nodeView, targetNode, colorScheme, intl) {
|
|
254
212
|
var blockWrapper = createBlockNodeWrapper();
|
|
255
213
|
if (shouldShowRemovedLozenge(targetNode.type.name)) {
|
|
256
214
|
var lozenge = createRemovedLozenge(intl);
|
|
@@ -2,24 +2,13 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
3
3
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
4
|
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; }
|
|
5
|
-
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
6
5
|
import { areNodesEqualIgnoreAttrs } from '@atlaskit/editor-common/utils/document';
|
|
7
6
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
8
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
9
8
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
9
|
+
import { deletedRowStyle } from './colorSchemes/standard';
|
|
10
|
+
import { deletedTraditionalRowStyle } from './colorSchemes/traditional';
|
|
10
11
|
import { findSafeInsertPos } from './findSafeInsertPos';
|
|
11
|
-
var deletedRowStyle = convertToInlineCss({
|
|
12
|
-
color: "var(--ds-text-accent-gray, #505258)",
|
|
13
|
-
textDecoration: 'line-through',
|
|
14
|
-
opacity: 0.6,
|
|
15
|
-
display: 'table-row'
|
|
16
|
-
});
|
|
17
|
-
var deletedTraditionalRowStyle = convertToInlineCss({
|
|
18
|
-
textDecorationColor: "var(--ds-border-accent-red, #E2483D)",
|
|
19
|
-
textDecoration: 'line-through',
|
|
20
|
-
opacity: 0.6,
|
|
21
|
-
display: 'table-row'
|
|
22
|
-
});
|
|
23
12
|
/**
|
|
24
13
|
* Extracts information about deleted table rows from a change
|
|
25
14
|
*/
|
|
@@ -189,7 +178,12 @@ export var createDeletedRowsDecorations = function createDeletedRowsDecorations(
|
|
|
189
178
|
/**
|
|
190
179
|
* Main function to handle deleted rows - computes diff and creates decorations
|
|
191
180
|
*/
|
|
192
|
-
export var handleDeletedRows = function handleDeletedRows(
|
|
181
|
+
export var handleDeletedRows = function handleDeletedRows(_ref2) {
|
|
182
|
+
var changes = _ref2.changes,
|
|
183
|
+
originalDoc = _ref2.originalDoc,
|
|
184
|
+
newDoc = _ref2.newDoc,
|
|
185
|
+
nodeViewSerializer = _ref2.nodeViewSerializer,
|
|
186
|
+
colorScheme = _ref2.colorScheme;
|
|
193
187
|
// First, expand the changes to include complete deleted rows
|
|
194
188
|
var deletedRows = expandDiffForDeletedRows(changes.filter(function (change) {
|
|
195
189
|
return change.deleted.length > 0;
|
|
@@ -5,4 +5,13 @@ export declare const deletedContentStyleActive: string;
|
|
|
5
5
|
export declare const deletedContentStyleNew: string;
|
|
6
6
|
export declare const deletedContentStyleNewActive: string;
|
|
7
7
|
export declare const deletedContentStyleUnbounded: string;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const deletedStyleQuoteNode: string;
|
|
9
|
+
export declare const deletedStyleQuoteNodeWithLozenge: string;
|
|
10
|
+
export declare const deletedBlockOutline: string;
|
|
11
|
+
export declare const deletedBlockOutlineRounded: string;
|
|
12
|
+
export declare const deletedRowStyle: string;
|
|
13
|
+
export declare const editingStyleQuoteNode: string;
|
|
14
|
+
export declare const editingStyleRuleNode: string;
|
|
15
|
+
export declare const editingStyleNode: string;
|
|
16
|
+
export declare const editingStyleCardBlockNode: string;
|
|
17
|
+
export declare const standardDecorationMarkerVariable: string;
|
|
@@ -2,4 +2,12 @@ export declare const traditionalInsertStyle: string;
|
|
|
2
2
|
export declare const traditionalInsertStyleActive: string;
|
|
3
3
|
export declare const deletedTraditionalContentStyle: string;
|
|
4
4
|
export declare const deletedTraditionalContentStyleUnbounded: string;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const deletedTraditionalStyleQuoteNode: string;
|
|
6
|
+
export declare const deletedTraditionalBlockOutline: string;
|
|
7
|
+
export declare const deletedTraditionalBlockOutlineRounded: string;
|
|
8
|
+
export declare const deletedTraditionalRowStyle: string;
|
|
9
|
+
export declare const traditionalStyleQuoteNode: string;
|
|
10
|
+
export declare const traditionalStyleRuleNode: string;
|
|
11
|
+
export declare const traditionalStyleNode: string;
|
|
12
|
+
export declare const traditionalStyleCardBlockNode: string;
|
|
13
|
+
export declare const traditionalDecorationMarkerVariable: string;
|
|
@@ -9,10 +9,14 @@ import type { NodeViewSerializer } from './NodeViewSerializer';
|
|
|
9
9
|
* @param change Changeset "change" containing information about the change content + range
|
|
10
10
|
* @returns Prosemirror inline decoration
|
|
11
11
|
*/
|
|
12
|
-
export declare const createInlineChangedDecoration: (change: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export declare const createInlineChangedDecoration: ({ change, colorScheme, isActive, }: {
|
|
13
|
+
change: {
|
|
14
|
+
fromB: number;
|
|
15
|
+
toB: number;
|
|
16
|
+
};
|
|
17
|
+
colorScheme?: "standard" | "traditional";
|
|
18
|
+
isActive?: boolean;
|
|
19
|
+
}) => Decoration;
|
|
16
20
|
export declare const getDeletedContentStyleUnbounded: (colorScheme?: "standard" | "traditional") => string;
|
|
17
21
|
export declare const getDeletedContentStyle: (colorScheme?: "standard" | "traditional", isActive?: boolean) => string;
|
|
18
22
|
/**
|
|
@@ -21,11 +25,14 @@ export declare const getDeletedContentStyle: (colorScheme?: "standard" | "tradit
|
|
|
21
25
|
* @param change Changeset "change" containing information about the change content + range
|
|
22
26
|
* @returns Prosemirror inline decoration
|
|
23
27
|
*/
|
|
24
|
-
export declare const createBlockChangedDecoration: (change: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
export declare const createBlockChangedDecoration: ({ change, colorScheme, }: {
|
|
29
|
+
change: {
|
|
30
|
+
from: number;
|
|
31
|
+
name: string;
|
|
32
|
+
to: number;
|
|
33
|
+
};
|
|
34
|
+
colorScheme?: "standard" | "traditional";
|
|
35
|
+
}) => Decoration | undefined;
|
|
29
36
|
interface DeletedContentDecorationProps {
|
|
30
37
|
change: Pick<Change, 'fromA' | 'toA' | 'fromB' | 'deleted'>;
|
|
31
38
|
colorScheme?: 'standard' | 'traditional';
|
|
@@ -1,56 +1,11 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
export declare const deletedStyleQuoteNode: string;
|
|
4
|
-
export declare const deletedStyleQuoteNodeWithLozenge: string;
|
|
5
|
-
export declare const deletedTraditionalStyleQuoteNode: string;
|
|
6
|
-
export declare const deletedBlockOutline: string;
|
|
7
|
-
export declare const deletedTraditionalBlockOutline: string;
|
|
8
|
-
export declare const deletedBlockOutlineRounded: string;
|
|
9
|
-
export declare const deletedTraditionalBlockOutlineRounded: string;
|
|
10
3
|
export declare const getDeletedStyleNode: (nodeName: string, colorScheme?: "standard" | "traditional") => string | undefined;
|
|
11
|
-
export declare const shouldShowRemovedLozenge: (nodeName: string) => boolean;
|
|
12
|
-
export declare const shouldAddShowDiffDeletedNodeClass: (nodeName: string) => boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Checks if a node should apply deleted styles directly without wrapper
|
|
15
|
-
* to preserve natural block-level margins
|
|
16
|
-
*/
|
|
17
|
-
export declare const shouldApplyDeletedStylesDirectly: (nodeName: string) => boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a "Removed" lozenge to be displayed at the top right corner of deleted block nodes
|
|
20
|
-
*/
|
|
21
|
-
export declare const createRemovedLozenge: (intl: IntlShape, nodeName?: string) => HTMLElement;
|
|
22
|
-
/**
|
|
23
|
-
* Wraps a block node in a container with relative positioning to support absolute positioned lozenge
|
|
24
|
-
*/
|
|
25
|
-
export declare const createBlockNodeWrapper: () => HTMLDivElement;
|
|
26
|
-
/**
|
|
27
|
-
* Wraps content with deleted styling without opacity (for use when content is a direct child of dom)
|
|
28
|
-
*/
|
|
29
|
-
export declare const createDeletedStyleWrapperWithoutOpacity: (colorScheme?: "standard" | "traditional", isActive?: boolean) => HTMLSpanElement;
|
|
30
|
-
/**
|
|
31
|
-
* Applies deleted styles directly to an HTML element by merging with existing styles
|
|
32
|
-
*/
|
|
33
|
-
export declare const applyDeletedStylesToElement: (element: HTMLElement, targetNode: PMNode, colorScheme: "standard" | "traditional" | undefined) => void;
|
|
34
|
-
/**
|
|
35
|
-
* Creates a content wrapper with deleted styles for a block node
|
|
36
|
-
*/
|
|
37
|
-
export declare const createBlockNodeContentWrapper: (nodeView: Node, targetNode: PMNode, colorScheme: "standard" | "traditional" | undefined) => HTMLElement;
|
|
38
|
-
/**
|
|
39
|
-
* Handles embedCard node rendering with lozenge attached to the rich-media-item container.
|
|
40
|
-
* Since embedCard content loads asynchronously, we use a MutationObserver
|
|
41
|
-
* to wait for the rich-media-item to appear before attaching the lozenge.
|
|
42
|
-
* @returns true if embedCard was handled
|
|
43
|
-
*/
|
|
44
|
-
export declare const handleEmbedCardWithLozenge: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, lozenge: HTMLElement, colorScheme: "standard" | "traditional" | undefined) => boolean;
|
|
45
4
|
/**
|
|
46
5
|
* Handles special mediaSingle node rendering with lozenge on child media element
|
|
47
6
|
* @returns true if mediaSingle was handled, false otherwise
|
|
48
7
|
*/
|
|
49
8
|
export declare const handleMediaSingleWithLozenge: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, lozenge: HTMLElement, colorScheme: "standard" | "traditional" | undefined) => boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Appends a block node with wrapper, lozenge, and appropriate styling
|
|
52
|
-
*/
|
|
53
|
-
export declare const appendBlockNodeWithWrapper: (dom: HTMLElement, nodeView: Node, targetNode: PMNode, colorScheme: "standard" | "traditional" | undefined, intl: IntlShape) => void;
|
|
54
9
|
/**
|
|
55
10
|
* Handles all block node rendering with appropriate deleted styling.
|
|
56
11
|
* For heading nodes, applies styles directly to preserve natural margins.
|
|
@@ -24,7 +24,13 @@ export declare const createDeletedRowsDecorations: ({ deletedRows, originalDoc,
|
|
|
24
24
|
/**
|
|
25
25
|
* Main function to handle deleted rows - computes diff and creates decorations
|
|
26
26
|
*/
|
|
27
|
-
export declare const handleDeletedRows: (changes
|
|
27
|
+
export declare const handleDeletedRows: ({ changes, originalDoc, newDoc, nodeViewSerializer, colorScheme, }: {
|
|
28
|
+
changes: SimpleChange[];
|
|
29
|
+
colorScheme?: "standard" | "traditional";
|
|
30
|
+
newDoc: PMNode;
|
|
31
|
+
nodeViewSerializer: NodeViewSerializer;
|
|
32
|
+
originalDoc: PMNode;
|
|
33
|
+
}) => {
|
|
28
34
|
decorations: Decoration[];
|
|
29
35
|
};
|
|
30
36
|
export {};
|
|
@@ -5,4 +5,13 @@ export declare const deletedContentStyleActive: string;
|
|
|
5
5
|
export declare const deletedContentStyleNew: string;
|
|
6
6
|
export declare const deletedContentStyleNewActive: string;
|
|
7
7
|
export declare const deletedContentStyleUnbounded: string;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const deletedStyleQuoteNode: string;
|
|
9
|
+
export declare const deletedStyleQuoteNodeWithLozenge: string;
|
|
10
|
+
export declare const deletedBlockOutline: string;
|
|
11
|
+
export declare const deletedBlockOutlineRounded: string;
|
|
12
|
+
export declare const deletedRowStyle: string;
|
|
13
|
+
export declare const editingStyleQuoteNode: string;
|
|
14
|
+
export declare const editingStyleRuleNode: string;
|
|
15
|
+
export declare const editingStyleNode: string;
|
|
16
|
+
export declare const editingStyleCardBlockNode: string;
|
|
17
|
+
export declare const standardDecorationMarkerVariable: string;
|
|
@@ -2,4 +2,12 @@ export declare const traditionalInsertStyle: string;
|
|
|
2
2
|
export declare const traditionalInsertStyleActive: string;
|
|
3
3
|
export declare const deletedTraditionalContentStyle: string;
|
|
4
4
|
export declare const deletedTraditionalContentStyleUnbounded: string;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const deletedTraditionalStyleQuoteNode: string;
|
|
6
|
+
export declare const deletedTraditionalBlockOutline: string;
|
|
7
|
+
export declare const deletedTraditionalBlockOutlineRounded: string;
|
|
8
|
+
export declare const deletedTraditionalRowStyle: string;
|
|
9
|
+
export declare const traditionalStyleQuoteNode: string;
|
|
10
|
+
export declare const traditionalStyleRuleNode: string;
|
|
11
|
+
export declare const traditionalStyleNode: string;
|
|
12
|
+
export declare const traditionalStyleCardBlockNode: string;
|
|
13
|
+
export declare const traditionalDecorationMarkerVariable: string;
|