@atlaskit/editor-plugin-show-diff 5.0.4 → 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 +8 -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 +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 5.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8865b5e8a708a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8865b5e8a708a) -
|
|
8
|
+
EDITOR-5632: Refactor diff plugin to make functions more generic.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 5.0.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -22,16 +22,23 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
22
22
|
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; }
|
|
23
23
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
24
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
25
|
-
var calculateNodesForBlockDecoration = function calculateNodesForBlockDecoration(
|
|
25
|
+
var calculateNodesForBlockDecoration = function calculateNodesForBlockDecoration(_ref) {
|
|
26
|
+
var doc = _ref.doc,
|
|
27
|
+
from = _ref.from,
|
|
28
|
+
to = _ref.to,
|
|
29
|
+
colorScheme = _ref.colorScheme;
|
|
26
30
|
var decorations = [];
|
|
27
31
|
// Iterate over the document nodes within the range
|
|
28
32
|
doc.nodesBetween(from, to, function (node, pos) {
|
|
29
33
|
if (node.isBlock) {
|
|
30
34
|
var decoration = (0, _decorations.createBlockChangedDecoration)({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
change: {
|
|
36
|
+
from: pos,
|
|
37
|
+
to: pos + node.nodeSize,
|
|
38
|
+
name: node.type.name
|
|
39
|
+
},
|
|
40
|
+
colorScheme: colorScheme
|
|
41
|
+
});
|
|
35
42
|
if (decoration) {
|
|
36
43
|
decorations.push(decoration);
|
|
37
44
|
}
|
|
@@ -72,13 +79,13 @@ function optimizeChanges(changes) {
|
|
|
72
79
|
optimized.push(current);
|
|
73
80
|
return optimized;
|
|
74
81
|
}
|
|
75
|
-
var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(
|
|
76
|
-
var state =
|
|
77
|
-
pluginState =
|
|
78
|
-
nodeViewSerializer =
|
|
79
|
-
colorScheme =
|
|
80
|
-
intl =
|
|
81
|
-
activeIndexPos =
|
|
82
|
+
var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref2) {
|
|
83
|
+
var state = _ref2.state,
|
|
84
|
+
pluginState = _ref2.pluginState,
|
|
85
|
+
nodeViewSerializer = _ref2.nodeViewSerializer,
|
|
86
|
+
colorScheme = _ref2.colorScheme,
|
|
87
|
+
intl = _ref2.intl,
|
|
88
|
+
activeIndexPos = _ref2.activeIndexPos;
|
|
82
89
|
var originalDoc = pluginState.originalDoc,
|
|
83
90
|
steps = pluginState.steps;
|
|
84
91
|
if (!originalDoc || !pluginState.isDisplayingChanges) {
|
|
@@ -121,8 +128,17 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref)
|
|
|
121
128
|
optimizedChanges.forEach(function (change) {
|
|
122
129
|
var isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
|
|
123
130
|
if (change.inserted.length > 0) {
|
|
124
|
-
decorations.push((0, _decorations.createInlineChangedDecoration)(
|
|
125
|
-
|
|
131
|
+
decorations.push((0, _decorations.createInlineChangedDecoration)({
|
|
132
|
+
change: change,
|
|
133
|
+
colorScheme: colorScheme,
|
|
134
|
+
isActive: isActive
|
|
135
|
+
}));
|
|
136
|
+
decorations.push.apply(decorations, (0, _toConsumableArray2.default)(calculateNodesForBlockDecoration({
|
|
137
|
+
doc: tr.doc,
|
|
138
|
+
from: change.fromB,
|
|
139
|
+
to: change.toB,
|
|
140
|
+
colorScheme: colorScheme
|
|
141
|
+
})));
|
|
126
142
|
}
|
|
127
143
|
if (change.deleted.length > 0) {
|
|
128
144
|
var _isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
|
|
@@ -142,31 +158,40 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref)
|
|
|
142
158
|
});
|
|
143
159
|
(0, _markDecorations.getMarkChangeRanges)(steps).forEach(function (change) {
|
|
144
160
|
var isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
|
|
145
|
-
decorations.push((0, _decorations.createInlineChangedDecoration)(
|
|
161
|
+
decorations.push((0, _decorations.createInlineChangedDecoration)({
|
|
162
|
+
change: change,
|
|
163
|
+
colorScheme: colorScheme,
|
|
164
|
+
isActive: isActive
|
|
165
|
+
}));
|
|
146
166
|
});
|
|
147
167
|
(0, _attributeDecorations.getAttrChangeRanges)(tr.doc, attrSteps).forEach(function (change) {
|
|
148
|
-
decorations.push.apply(decorations, (0, _toConsumableArray2.default)(calculateNodesForBlockDecoration(
|
|
168
|
+
decorations.push.apply(decorations, (0, _toConsumableArray2.default)(calculateNodesForBlockDecoration({
|
|
169
|
+
doc: tr.doc,
|
|
170
|
+
from: change.fromB,
|
|
171
|
+
to: change.toB,
|
|
172
|
+
colorScheme: colorScheme
|
|
173
|
+
})));
|
|
149
174
|
});
|
|
150
175
|
return _view.DecorationSet.empty.add(tr.doc, decorations);
|
|
151
176
|
};
|
|
152
177
|
var calculateDiffDecorations = exports.calculateDiffDecorations = (0, _memoizeOne.default)(calculateDiffDecorationsInner,
|
|
153
178
|
// Cache results unless relevant inputs change
|
|
154
|
-
function (
|
|
155
|
-
var
|
|
156
|
-
var _ref4 = (0, _slicedToArray2.default)(_ref2, 1),
|
|
157
|
-
_ref4$ = _ref4[0],
|
|
158
|
-
pluginState = _ref4$.pluginState,
|
|
159
|
-
state = _ref4$.state,
|
|
160
|
-
colorScheme = _ref4$.colorScheme,
|
|
161
|
-
intl = _ref4$.intl,
|
|
162
|
-
activeIndexPos = _ref4$.activeIndexPos;
|
|
179
|
+
function (_ref3, _ref4) {
|
|
180
|
+
var _ref7;
|
|
163
181
|
var _ref5 = (0, _slicedToArray2.default)(_ref3, 1),
|
|
164
182
|
_ref5$ = _ref5[0],
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
183
|
+
pluginState = _ref5$.pluginState,
|
|
184
|
+
state = _ref5$.state,
|
|
185
|
+
colorScheme = _ref5$.colorScheme,
|
|
186
|
+
intl = _ref5$.intl,
|
|
187
|
+
activeIndexPos = _ref5$.activeIndexPos;
|
|
188
|
+
var _ref6 = (0, _slicedToArray2.default)(_ref4, 1),
|
|
189
|
+
_ref6$ = _ref6[0],
|
|
190
|
+
lastPluginState = _ref6$.pluginState,
|
|
191
|
+
lastState = _ref6$.state,
|
|
192
|
+
lastColorScheme = _ref6$.colorScheme,
|
|
193
|
+
lastIntl = _ref6$.intl,
|
|
194
|
+
lastActiveIndexPos = _ref6$.activeIndexPos;
|
|
170
195
|
var originalDocIsSame = lastPluginState.originalDoc && pluginState.originalDoc && pluginState.originalDoc.eq(lastPluginState.originalDoc);
|
|
171
|
-
return (
|
|
196
|
+
return (_ref7 = originalDocIsSame && (0, _isEqual.default)(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && colorScheme === lastColorScheme && intl.locale === lastIntl.locale && (0, _isEqual.default)(activeIndexPos, lastActiveIndexPos)) !== null && _ref7 !== void 0 ? _ref7 : false;
|
|
172
197
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.standardDecorationMarkerVariable = exports.editingStyleRuleNode = exports.editingStyleQuoteNode = exports.editingStyleNode = exports.editingStyleCardBlockNode = exports.editingStyleActive = exports.editingStyle = exports.deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNode = exports.deletedRowStyle = exports.deletedContentStyleUnbounded = exports.deletedContentStyleNewActive = exports.deletedContentStyleNew = exports.deletedContentStyleActive = exports.deletedContentStyle = exports.deletedBlockOutlineRounded = exports.deletedBlockOutline = void 0;
|
|
7
7
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
8
8
|
var editingStyle = exports.editingStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
9
9
|
background: "var(--ds-background-accent-purple-subtlest, #F8EEFE)",
|
|
@@ -54,43 +54,45 @@ var deletedContentStyleUnbounded = exports.deletedContentStyleUnbounded = (0, _l
|
|
|
54
54
|
pointerEvents: 'none',
|
|
55
55
|
zIndex: 1
|
|
56
56
|
});
|
|
57
|
-
var
|
|
57
|
+
var deletedStyleQuoteNode = exports.deletedStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
58
|
+
borderLeft: "2px solid ".concat("var(--ds-border-accent-gray, #7D818A)")
|
|
59
|
+
});
|
|
60
|
+
var deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNodeWithLozenge = (0, _lazyNodeView.convertToInlineCss)({
|
|
61
|
+
marginTop: "var(--ds-space-150, 12px)",
|
|
62
|
+
paddingTop: "var(--ds-space-025, 2px)",
|
|
63
|
+
paddingBottom: "var(--ds-space-025, 2px)",
|
|
64
|
+
paddingLeft: "var(--ds-space-025, 2px)",
|
|
65
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
66
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
67
|
+
});
|
|
68
|
+
var deletedBlockOutline = exports.deletedBlockOutline = (0, _lazyNodeView.convertToInlineCss)({
|
|
69
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
70
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
71
|
+
});
|
|
72
|
+
var deletedBlockOutlineRounded = exports.deletedBlockOutlineRounded = (0, _lazyNodeView.convertToInlineCss)({
|
|
73
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
74
|
+
borderRadius: "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)")
|
|
75
|
+
});
|
|
76
|
+
var deletedRowStyle = exports.deletedRowStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
77
|
+
color: "var(--ds-text-accent-gray, #505258)",
|
|
78
|
+
textDecoration: 'line-through',
|
|
79
|
+
opacity: 0.6,
|
|
80
|
+
display: 'table-row'
|
|
81
|
+
});
|
|
82
|
+
var editingStyleQuoteNode = exports.editingStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
58
83
|
borderLeft: "2px solid ".concat("var(--ds-border-accent-purple, #AF59E1)")
|
|
59
84
|
});
|
|
60
|
-
var editingStyleRuleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
85
|
+
var editingStyleRuleNode = exports.editingStyleRuleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
61
86
|
backgroundColor: "var(--ds-border-accent-purple, #AF59E1)"
|
|
62
87
|
});
|
|
63
|
-
var editingStyleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
88
|
+
var editingStyleNode = exports.editingStyleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
64
89
|
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
65
90
|
borderRadius: "var(--ds-radius-small, 4px)"
|
|
66
91
|
});
|
|
67
|
-
var editingStyleCardBlockNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
92
|
+
var editingStyleCardBlockNode = exports.editingStyleCardBlockNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
68
93
|
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
69
94
|
borderRadius: "var(--ds-radius-medium, 6px)"
|
|
70
95
|
});
|
|
71
|
-
var
|
|
96
|
+
var standardDecorationMarkerVariable = exports.standardDecorationMarkerVariable = (0, _lazyNodeView.convertToInlineCss)({
|
|
72
97
|
'--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
|
-
};
|
|
98
|
+
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.traditionalInsertStyleActive = exports.traditionalInsertStyle = exports.
|
|
6
|
+
exports.traditionalStyleRuleNode = exports.traditionalStyleQuoteNode = exports.traditionalStyleNode = exports.traditionalStyleCardBlockNode = exports.traditionalInsertStyleActive = exports.traditionalInsertStyle = exports.traditionalDecorationMarkerVariable = exports.deletedTraditionalStyleQuoteNode = exports.deletedTraditionalRowStyle = exports.deletedTraditionalContentStyleUnbounded = exports.deletedTraditionalContentStyle = exports.deletedTraditionalBlockOutlineRounded = exports.deletedTraditionalBlockOutline = void 0;
|
|
7
7
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
8
8
|
var traditionalInsertStyle = exports.traditionalInsertStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
9
9
|
background: "var(--ds-background-accent-green-subtlest, #DCFFF1)",
|
|
@@ -34,43 +34,42 @@ var deletedTraditionalContentStyleUnbounded = exports.deletedTraditionalContentS
|
|
|
34
34
|
pointerEvents: 'none',
|
|
35
35
|
zIndex: 1
|
|
36
36
|
});
|
|
37
|
-
var
|
|
37
|
+
var deletedTraditionalStyleQuoteNode = exports.deletedTraditionalStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
38
|
+
marginTop: "var(--ds-space-150, 12px)",
|
|
39
|
+
paddingTop: "var(--ds-space-025, 2px)",
|
|
40
|
+
paddingBottom: "var(--ds-space-025, 2px)",
|
|
41
|
+
paddingLeft: "var(--ds-space-025, 2px)",
|
|
42
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
43
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
44
|
+
});
|
|
45
|
+
var deletedTraditionalBlockOutline = exports.deletedTraditionalBlockOutline = (0, _lazyNodeView.convertToInlineCss)({
|
|
46
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
47
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
48
|
+
});
|
|
49
|
+
var deletedTraditionalBlockOutlineRounded = exports.deletedTraditionalBlockOutlineRounded = (0, _lazyNodeView.convertToInlineCss)({
|
|
50
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
51
|
+
borderRadius: "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)")
|
|
52
|
+
});
|
|
53
|
+
var deletedTraditionalRowStyle = exports.deletedTraditionalRowStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
54
|
+
textDecorationColor: "var(--ds-border-accent-red, #E2483D)",
|
|
55
|
+
textDecoration: 'line-through',
|
|
56
|
+
opacity: 0.6,
|
|
57
|
+
display: 'table-row'
|
|
58
|
+
});
|
|
59
|
+
var traditionalStyleQuoteNode = exports.traditionalStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
38
60
|
borderLeft: "2px solid ".concat("var(--ds-border-accent-green, #22A06B)")
|
|
39
61
|
});
|
|
40
|
-
var traditionalStyleRuleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
62
|
+
var traditionalStyleRuleNode = exports.traditionalStyleRuleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
41
63
|
backgroundColor: "var(--ds-border-accent-green, #22A06B)"
|
|
42
64
|
});
|
|
43
|
-
var traditionalStyleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
65
|
+
var traditionalStyleNode = exports.traditionalStyleNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
44
66
|
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
|
|
45
67
|
borderRadius: "var(--ds-radius-small, 4px)"
|
|
46
68
|
});
|
|
47
|
-
var traditionalStyleCardBlockNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
69
|
+
var traditionalStyleCardBlockNode = exports.traditionalStyleCardBlockNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
48
70
|
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
|
|
49
71
|
borderRadius: "var(--ds-radius-medium, 6px)"
|
|
50
72
|
});
|
|
51
|
-
var traditionalDecorationMarkerVariable = (0, _lazyNodeView.convertToInlineCss)({
|
|
73
|
+
var traditionalDecorationMarkerVariable = exports.traditionalDecorationMarkerVariable = (0, _lazyNodeView.convertToInlineCss)({
|
|
52
74
|
'--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
|
-
};
|
|
75
|
+
});
|
|
@@ -19,8 +19,11 @@ var _findSafeInsertPos = require("./findSafeInsertPos");
|
|
|
19
19
|
* @param change Changeset "change" containing information about the change content + range
|
|
20
20
|
* @returns Prosemirror inline decoration
|
|
21
21
|
*/
|
|
22
|
-
var createInlineChangedDecoration = exports.createInlineChangedDecoration = function createInlineChangedDecoration(
|
|
23
|
-
var
|
|
22
|
+
var createInlineChangedDecoration = exports.createInlineChangedDecoration = function createInlineChangedDecoration(_ref) {
|
|
23
|
+
var change = _ref.change,
|
|
24
|
+
colorScheme = _ref.colorScheme,
|
|
25
|
+
_ref$isActive = _ref.isActive,
|
|
26
|
+
isActive = _ref$isActive === void 0 ? false : _ref$isActive;
|
|
24
27
|
var style;
|
|
25
28
|
if (colorScheme === 'traditional') {
|
|
26
29
|
style = isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
|
|
@@ -55,8 +58,38 @@ var getNodeClass = function getNodeClass(name) {
|
|
|
55
58
|
return undefined;
|
|
56
59
|
}
|
|
57
60
|
};
|
|
58
|
-
var getBlockNodeStyle = function getBlockNodeStyle(
|
|
59
|
-
|
|
61
|
+
var getBlockNodeStyle = function getBlockNodeStyle(nodeName, colorScheme) {
|
|
62
|
+
var isTraditional = colorScheme === 'traditional';
|
|
63
|
+
if (['mediaSingle', 'mediaGroup', 'table',
|
|
64
|
+
// Handle table separately to avoid border issues
|
|
65
|
+
'tableRow', 'tableCell', 'tableHeader', 'paragraph',
|
|
66
|
+
// Paragraph and heading nodes do not need special styling
|
|
67
|
+
'heading', 'hardBreak', 'decisionList', 'taskList', 'taskItem', 'bulletList', 'orderedList', 'layoutSection'].includes(nodeName)) {
|
|
68
|
+
// Layout nodes do not need special styling
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
if (['extension', 'embedCard', 'listItem'].includes(nodeName)) {
|
|
72
|
+
return isTraditional ? _traditional.traditionalDecorationMarkerVariable : _standard.standardDecorationMarkerVariable;
|
|
73
|
+
}
|
|
74
|
+
if (nodeName === 'blockquote') {
|
|
75
|
+
return isTraditional ? _traditional.traditionalStyleQuoteNode : _standard.editingStyleQuoteNode;
|
|
76
|
+
}
|
|
77
|
+
if (nodeName === 'rule') {
|
|
78
|
+
return isTraditional ? _traditional.traditionalStyleRuleNode : _standard.editingStyleRuleNode;
|
|
79
|
+
}
|
|
80
|
+
if (nodeName === 'blockCard') {
|
|
81
|
+
return isTraditional ? _traditional.traditionalStyleCardBlockNode : _standard.editingStyleCardBlockNode;
|
|
82
|
+
}
|
|
83
|
+
return isTraditional ? _traditional.traditionalStyleNode : _standard.editingStyleNode;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Wraps content with deleted styling without opacity (for use when content is a direct child of dom)
|
|
88
|
+
*/
|
|
89
|
+
var createDeletedStyleWrapperWithoutOpacity = function createDeletedStyleWrapperWithoutOpacity(colorScheme, isActive) {
|
|
90
|
+
var wrapper = document.createElement('span');
|
|
91
|
+
wrapper.setAttribute('style', getDeletedContentStyle(colorScheme, isActive));
|
|
92
|
+
return wrapper;
|
|
60
93
|
};
|
|
61
94
|
|
|
62
95
|
/**
|
|
@@ -65,7 +98,9 @@ var getBlockNodeStyle = function getBlockNodeStyle(name, colorScheme) {
|
|
|
65
98
|
* @param change Changeset "change" containing information about the change content + range
|
|
66
99
|
* @returns Prosemirror inline decoration
|
|
67
100
|
*/
|
|
68
|
-
var createBlockChangedDecoration = exports.createBlockChangedDecoration = function createBlockChangedDecoration(
|
|
101
|
+
var createBlockChangedDecoration = exports.createBlockChangedDecoration = function createBlockChangedDecoration(_ref2) {
|
|
102
|
+
var change = _ref2.change,
|
|
103
|
+
colorScheme = _ref2.colorScheme;
|
|
69
104
|
if ((0, _platformFeatureFlags.fg)('platform_editor_show_diff_scroll_navigation')) {
|
|
70
105
|
var style = getBlockNodeStyle(change.name, colorScheme);
|
|
71
106
|
var className = getNodeClass(change.name);
|
|
@@ -102,15 +137,15 @@ var createContentWrapper = function createContentWrapper(colorScheme) {
|
|
|
102
137
|
wrapper.append(strikethrough);
|
|
103
138
|
return wrapper;
|
|
104
139
|
};
|
|
105
|
-
var createDeletedContentDecoration = exports.createDeletedContentDecoration = function createDeletedContentDecoration(
|
|
106
|
-
var change =
|
|
107
|
-
doc =
|
|
108
|
-
nodeViewSerializer =
|
|
109
|
-
colorScheme =
|
|
110
|
-
newDoc =
|
|
111
|
-
intl =
|
|
112
|
-
|
|
113
|
-
isActive =
|
|
140
|
+
var createDeletedContentDecoration = exports.createDeletedContentDecoration = function createDeletedContentDecoration(_ref3) {
|
|
141
|
+
var change = _ref3.change,
|
|
142
|
+
doc = _ref3.doc,
|
|
143
|
+
nodeViewSerializer = _ref3.nodeViewSerializer,
|
|
144
|
+
colorScheme = _ref3.colorScheme,
|
|
145
|
+
newDoc = _ref3.newDoc,
|
|
146
|
+
intl = _ref3.intl,
|
|
147
|
+
_ref3$isActive = _ref3.isActive,
|
|
148
|
+
isActive = _ref3$isActive === void 0 ? false : _ref3$isActive;
|
|
114
149
|
var slice = doc.slice(change.fromA, change.toA);
|
|
115
150
|
if (slice.content.content.length === 0) {
|
|
116
151
|
return;
|
|
@@ -132,7 +167,13 @@ var createDeletedContentDecoration = exports.createDeletedContentDecoration = fu
|
|
|
132
167
|
if (!(0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga')) {
|
|
133
168
|
return;
|
|
134
169
|
}
|
|
135
|
-
var _handleDeletedRows = (0, _deletedRowsHandler.handleDeletedRows)(
|
|
170
|
+
var _handleDeletedRows = (0, _deletedRowsHandler.handleDeletedRows)({
|
|
171
|
+
changes: [change],
|
|
172
|
+
originalDoc: doc,
|
|
173
|
+
newDoc: newDoc,
|
|
174
|
+
nodeViewSerializer: nodeViewSerializer,
|
|
175
|
+
colorScheme: colorScheme
|
|
176
|
+
}),
|
|
136
177
|
decorations = _handleDeletedRows.decorations;
|
|
137
178
|
return decorations;
|
|
138
179
|
}
|
|
@@ -220,7 +261,7 @@ var createDeletedContentDecoration = exports.createDeletedContentDecoration = fu
|
|
|
220
261
|
} else {
|
|
221
262
|
var fallbackNode = fallbackSerialization();
|
|
222
263
|
if (fallbackNode) {
|
|
223
|
-
var _wrapper2 =
|
|
264
|
+
var _wrapper2 = createDeletedStyleWrapperWithoutOpacity(colorScheme, isActive);
|
|
224
265
|
_wrapper2.append(fallbackNode);
|
|
225
266
|
dom.append(_wrapper2);
|
|
226
267
|
}
|
|
@@ -4,49 +4,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.handleMediaSingleWithLozenge = exports.handleBlockNodeView = exports.getDeletedStyleNode = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
10
10
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
|
+
var _standard = require("./colorSchemes/standard");
|
|
13
|
+
var _traditional = require("./colorSchemes/traditional");
|
|
12
14
|
var _decorations = require("./decorations");
|
|
13
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
-
var deletedStyleQuoteNode = exports.deletedStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
16
|
-
borderLeft: "2px solid ".concat("var(--ds-border-accent-gray, #7D818A)")
|
|
17
|
-
});
|
|
18
|
-
var deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNodeWithLozenge = (0, _lazyNodeView.convertToInlineCss)({
|
|
19
|
-
marginTop: "var(--ds-space-150, 12px)",
|
|
20
|
-
paddingTop: "var(--ds-space-025, 2px)",
|
|
21
|
-
paddingBottom: "var(--ds-space-025, 2px)",
|
|
22
|
-
paddingLeft: "var(--ds-space-025, 2px)",
|
|
23
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
24
|
-
borderRadius: "var(--ds-radius-small, 4px)"
|
|
25
|
-
});
|
|
26
|
-
var deletedTraditionalStyleQuoteNode = exports.deletedTraditionalStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
|
|
27
|
-
marginTop: "var(--ds-space-150, 12px)",
|
|
28
|
-
paddingTop: "var(--ds-space-025, 2px)",
|
|
29
|
-
paddingBottom: "var(--ds-space-025, 2px)",
|
|
30
|
-
paddingLeft: "var(--ds-space-025, 2px)",
|
|
31
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
32
|
-
borderRadius: "var(--ds-radius-small, 4px)"
|
|
33
|
-
});
|
|
34
|
-
var deletedBlockOutline = exports.deletedBlockOutline = (0, _lazyNodeView.convertToInlineCss)({
|
|
35
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
36
|
-
borderRadius: "var(--ds-radius-small, 4px)"
|
|
37
|
-
});
|
|
38
|
-
var deletedTraditionalBlockOutline = exports.deletedTraditionalBlockOutline = (0, _lazyNodeView.convertToInlineCss)({
|
|
39
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
40
|
-
borderRadius: "var(--ds-radius-small, 4px)"
|
|
41
|
-
});
|
|
42
|
-
var deletedBlockOutlineRounded = exports.deletedBlockOutlineRounded = (0, _lazyNodeView.convertToInlineCss)({
|
|
43
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
|
|
44
|
-
borderRadius: "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)")
|
|
45
|
-
});
|
|
46
|
-
var deletedTraditionalBlockOutlineRounded = exports.deletedTraditionalBlockOutlineRounded = (0, _lazyNodeView.convertToInlineCss)({
|
|
47
|
-
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-red, #E2483D)"),
|
|
48
|
-
borderRadius: "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)")
|
|
49
|
-
});
|
|
50
17
|
var lozengeStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
51
18
|
display: 'inline-flex',
|
|
52
19
|
boxSizing: 'border-box',
|
|
@@ -67,18 +34,18 @@ var getDeletedStyleNode = exports.getDeletedStyleNode = function getDeletedStyle
|
|
|
67
34
|
var isTraditional = colorScheme === 'traditional';
|
|
68
35
|
switch (nodeName) {
|
|
69
36
|
case 'blockquote':
|
|
70
|
-
return (0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga_blockers') ? isTraditional ? deletedTraditionalStyleQuoteNode : deletedStyleQuoteNodeWithLozenge : deletedStyleQuoteNode;
|
|
37
|
+
return (0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga_blockers') ? isTraditional ? _traditional.deletedTraditionalStyleQuoteNode : _standard.deletedStyleQuoteNodeWithLozenge : _standard.deletedStyleQuoteNode;
|
|
71
38
|
case 'expand':
|
|
72
39
|
case 'decisionList':
|
|
73
|
-
return isTraditional && (0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga_blockers') ? deletedTraditionalBlockOutline : deletedBlockOutline;
|
|
40
|
+
return isTraditional && (0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga_blockers') ? _traditional.deletedTraditionalBlockOutline : _standard.deletedBlockOutline;
|
|
74
41
|
case 'panel':
|
|
75
42
|
case 'codeBlock':
|
|
76
|
-
return isTraditional && (0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga_blockers') ? deletedTraditionalBlockOutlineRounded : deletedBlockOutlineRounded;
|
|
43
|
+
return isTraditional && (0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga_blockers') ? _traditional.deletedTraditionalBlockOutlineRounded : _standard.deletedBlockOutlineRounded;
|
|
77
44
|
default:
|
|
78
45
|
return undefined;
|
|
79
46
|
}
|
|
80
47
|
};
|
|
81
|
-
var shouldShowRemovedLozenge =
|
|
48
|
+
var shouldShowRemovedLozenge = function shouldShowRemovedLozenge(nodeName) {
|
|
82
49
|
switch (nodeName) {
|
|
83
50
|
case 'expand':
|
|
84
51
|
case 'codeBlock':
|
|
@@ -93,7 +60,7 @@ var shouldShowRemovedLozenge = exports.shouldShowRemovedLozenge = function shoul
|
|
|
93
60
|
return false;
|
|
94
61
|
}
|
|
95
62
|
};
|
|
96
|
-
var shouldAddShowDiffDeletedNodeClass =
|
|
63
|
+
var shouldAddShowDiffDeletedNodeClass = function shouldAddShowDiffDeletedNodeClass(nodeName) {
|
|
97
64
|
switch (nodeName) {
|
|
98
65
|
case 'mediaSingle':
|
|
99
66
|
case 'embedCard':
|
|
@@ -109,14 +76,14 @@ var shouldAddShowDiffDeletedNodeClass = exports.shouldAddShowDiffDeletedNodeClas
|
|
|
109
76
|
* Checks if a node should apply deleted styles directly without wrapper
|
|
110
77
|
* to preserve natural block-level margins
|
|
111
78
|
*/
|
|
112
|
-
var shouldApplyDeletedStylesDirectly =
|
|
79
|
+
var shouldApplyDeletedStylesDirectly = function shouldApplyDeletedStylesDirectly(nodeName) {
|
|
113
80
|
return nodeName === 'heading' || nodeName === 'blockquote' && !(0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_ga_blockers');
|
|
114
81
|
};
|
|
115
82
|
|
|
116
83
|
/**
|
|
117
84
|
* Creates a "Removed" lozenge to be displayed at the top right corner of deleted block nodes
|
|
118
85
|
*/
|
|
119
|
-
var createRemovedLozenge =
|
|
86
|
+
var createRemovedLozenge = function createRemovedLozenge(intl, nodeName) {
|
|
120
87
|
var container = document.createElement('span');
|
|
121
88
|
var borderTopRightRadius;
|
|
122
89
|
if (['expand', 'decisionList'].includes(nodeName || '')) {
|
|
@@ -149,7 +116,7 @@ var createRemovedLozenge = exports.createRemovedLozenge = function createRemoved
|
|
|
149
116
|
/**
|
|
150
117
|
* Wraps a block node in a container with relative positioning to support absolute positioned lozenge
|
|
151
118
|
*/
|
|
152
|
-
var createBlockNodeWrapper =
|
|
119
|
+
var createBlockNodeWrapper = function createBlockNodeWrapper() {
|
|
153
120
|
var wrapper = document.createElement('div');
|
|
154
121
|
var baseStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
155
122
|
position: 'relative',
|
|
@@ -160,19 +127,10 @@ var createBlockNodeWrapper = exports.createBlockNodeWrapper = function createBlo
|
|
|
160
127
|
return wrapper;
|
|
161
128
|
};
|
|
162
129
|
|
|
163
|
-
/**
|
|
164
|
-
* Wraps content with deleted styling without opacity (for use when content is a direct child of dom)
|
|
165
|
-
*/
|
|
166
|
-
var createDeletedStyleWrapperWithoutOpacity = exports.createDeletedStyleWrapperWithoutOpacity = function createDeletedStyleWrapperWithoutOpacity(colorScheme, isActive) {
|
|
167
|
-
var wrapper = document.createElement('span');
|
|
168
|
-
wrapper.setAttribute('style', (0, _decorations.getDeletedContentStyle)(colorScheme, isActive));
|
|
169
|
-
return wrapper;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
130
|
/**
|
|
173
131
|
* Applies deleted styles directly to an HTML element by merging with existing styles
|
|
174
132
|
*/
|
|
175
|
-
var applyDeletedStylesToElement =
|
|
133
|
+
var applyDeletedStylesToElement = function applyDeletedStylesToElement(element, targetNode, colorScheme) {
|
|
176
134
|
var currentStyle = element.getAttribute('style') || '';
|
|
177
135
|
var deletedContentStyle = (0, _decorations.getDeletedContentStyle)(colorScheme);
|
|
178
136
|
var nodeSpecificStyle = getDeletedStyleNode(targetNode.type.name, colorScheme) || '';
|
|
@@ -182,7 +140,7 @@ var applyDeletedStylesToElement = exports.applyDeletedStylesToElement = function
|
|
|
182
140
|
/**
|
|
183
141
|
* Creates a content wrapper with deleted styles for a block node
|
|
184
142
|
*/
|
|
185
|
-
var createBlockNodeContentWrapper =
|
|
143
|
+
var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(nodeView, targetNode, colorScheme) {
|
|
186
144
|
var contentWrapper = document.createElement('div');
|
|
187
145
|
var nodeStyle = getDeletedStyleNode(targetNode.type.name, colorScheme);
|
|
188
146
|
contentWrapper.setAttribute('style', "".concat((0, _decorations.getDeletedContentStyle)(colorScheme)).concat(nodeStyle || ''));
|
|
@@ -196,7 +154,7 @@ var createBlockNodeContentWrapper = exports.createBlockNodeContentWrapper = func
|
|
|
196
154
|
* to wait for the rich-media-item to appear before attaching the lozenge.
|
|
197
155
|
* @returns true if embedCard was handled
|
|
198
156
|
*/
|
|
199
|
-
var handleEmbedCardWithLozenge =
|
|
157
|
+
var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(dom, nodeView, targetNode, lozenge, colorScheme) {
|
|
200
158
|
if (targetNode.type.name !== 'embedCard' || !(nodeView instanceof HTMLElement)) {
|
|
201
159
|
return false;
|
|
202
160
|
}
|
|
@@ -257,7 +215,7 @@ var handleMediaSingleWithLozenge = exports.handleMediaSingleWithLozenge = functi
|
|
|
257
215
|
/**
|
|
258
216
|
* Appends a block node with wrapper, lozenge, and appropriate styling
|
|
259
217
|
*/
|
|
260
|
-
var appendBlockNodeWithWrapper =
|
|
218
|
+
var appendBlockNodeWithWrapper = function appendBlockNodeWithWrapper(dom, nodeView, targetNode, colorScheme, intl) {
|
|
261
219
|
var blockWrapper = createBlockNodeWrapper();
|
|
262
220
|
if (shouldShowRemovedLozenge(targetNode.type.name)) {
|
|
263
221
|
var lozenge = createRemovedLozenge(intl);
|
|
@@ -6,27 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.handleDeletedRows = exports.createDeletedRowsDecorations = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
-
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
10
9
|
var _document = require("@atlaskit/editor-common/utils/document");
|
|
11
10
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
13
12
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
13
|
+
var _standard = require("./colorSchemes/standard");
|
|
14
|
+
var _traditional = require("./colorSchemes/traditional");
|
|
14
15
|
var _findSafeInsertPos = require("./findSafeInsertPos");
|
|
15
16
|
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; } } }; }
|
|
16
17
|
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; } }
|
|
17
18
|
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; }
|
|
18
|
-
var deletedRowStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
19
|
-
color: "var(--ds-text-accent-gray, #505258)",
|
|
20
|
-
textDecoration: 'line-through',
|
|
21
|
-
opacity: 0.6,
|
|
22
|
-
display: 'table-row'
|
|
23
|
-
});
|
|
24
|
-
var deletedTraditionalRowStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
25
|
-
textDecorationColor: "var(--ds-border-accent-red, #E2483D)",
|
|
26
|
-
textDecoration: 'line-through',
|
|
27
|
-
opacity: 0.6,
|
|
28
|
-
display: 'table-row'
|
|
29
|
-
});
|
|
30
19
|
/**
|
|
31
20
|
* Extracts information about deleted table rows from a change
|
|
32
21
|
*/
|
|
@@ -128,7 +117,7 @@ var isEmptyRow = function isEmptyRow(rowNode) {
|
|
|
128
117
|
*/
|
|
129
118
|
var createDeletedRowDOM = function createDeletedRowDOM(rowNode, nodeViewSerializer, colorScheme) {
|
|
130
119
|
var tr = document.createElement('tr');
|
|
131
|
-
tr.setAttribute('style', colorScheme === 'traditional' ? deletedTraditionalRowStyle : deletedRowStyle);
|
|
120
|
+
tr.setAttribute('style', colorScheme === 'traditional' ? _traditional.deletedTraditionalRowStyle : _standard.deletedRowStyle);
|
|
132
121
|
tr.setAttribute('data-testid', 'show-diff-deleted-row');
|
|
133
122
|
|
|
134
123
|
// Serialize each cell in the row
|
|
@@ -196,7 +185,12 @@ var createDeletedRowsDecorations = exports.createDeletedRowsDecorations = functi
|
|
|
196
185
|
/**
|
|
197
186
|
* Main function to handle deleted rows - computes diff and creates decorations
|
|
198
187
|
*/
|
|
199
|
-
var handleDeletedRows = exports.handleDeletedRows = function handleDeletedRows(
|
|
188
|
+
var handleDeletedRows = exports.handleDeletedRows = function handleDeletedRows(_ref2) {
|
|
189
|
+
var changes = _ref2.changes,
|
|
190
|
+
originalDoc = _ref2.originalDoc,
|
|
191
|
+
newDoc = _ref2.newDoc,
|
|
192
|
+
nodeViewSerializer = _ref2.nodeViewSerializer,
|
|
193
|
+
colorScheme = _ref2.colorScheme;
|
|
200
194
|
// First, expand the changes to include complete deleted rows
|
|
201
195
|
var deletedRows = expandDiffForDeletedRows(changes.filter(function (change) {
|
|
202
196
|
return change.deleted.length > 0;
|