@atlaskit/editor-plugin-show-diff 19.0.3 → 19.0.4
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 +11 -0
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +57 -93
- package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +1 -1
- package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +1 -26
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +12 -24
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
- package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +8 -16
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +7 -22
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -52
- package/dist/cjs/pm-plugins/decorations/decorationKeys.js +6 -14
- package/dist/cjs/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +3 -8
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +132 -205
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +13 -20
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -10
- package/dist/cjs/pm-plugins/getDefaultDiffType.js +10 -0
- package/dist/cjs/pm-plugins/getScrollableDecorations.js +5 -15
- package/dist/cjs/pm-plugins/main.js +45 -53
- package/dist/cjs/pm-plugins/resolveDiffContributors.js +18 -4
- package/dist/cjs/showDiffPlugin.js +14 -24
- package/dist/cjs/showDiffPluginType.js +1 -1
- package/dist/cjs/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
- package/dist/cjs/ui/ContributorTag/contributorTagController.js +28 -3
- package/dist/cjs/ui/ContributorTag/contributorTagIcons.js +2 -2
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +67 -105
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +1 -1
- package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +0 -26
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +11 -23
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
- package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +8 -18
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +8 -23
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -54
- package/dist/es2019/pm-plugins/decorations/decorationKeys.js +6 -16
- package/dist/es2019/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +2 -7
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +53 -125
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +11 -12
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -7
- package/dist/es2019/pm-plugins/getDefaultDiffType.js +2 -0
- package/dist/es2019/pm-plugins/getScrollableDecorations.js +6 -19
- package/dist/es2019/pm-plugins/main.js +49 -65
- package/dist/es2019/pm-plugins/resolveDiffContributors.js +18 -3
- package/dist/es2019/showDiffPlugin.js +12 -24
- package/dist/es2019/showDiffPluginType.js +1 -1
- package/dist/es2019/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
- package/dist/es2019/ui/ContributorTag/contributorTagController.js +30 -2
- package/dist/es2019/ui/ContributorTag/contributorTagIcons.js +2 -2
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +56 -92
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +1 -1
- package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +0 -26
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +12 -24
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
- package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +8 -16
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +8 -23
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -52
- package/dist/esm/pm-plugins/decorations/decorationKeys.js +6 -14
- package/dist/esm/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +3 -8
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +132 -205
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +13 -20
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -10
- package/dist/esm/pm-plugins/getDefaultDiffType.js +4 -0
- package/dist/esm/pm-plugins/getScrollableDecorations.js +6 -16
- package/dist/esm/pm-plugins/main.js +44 -52
- package/dist/esm/pm-plugins/resolveDiffContributors.js +18 -4
- package/dist/esm/showDiffPlugin.js +14 -24
- package/dist/esm/showDiffPluginType.js +1 -1
- package/dist/esm/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
- package/dist/esm/ui/ContributorTag/contributorTagController.js +28 -3
- package/dist/esm/ui/ContributorTag/contributorTagIcons.js +2 -2
- package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/colorSchemes/standard.d.ts +0 -3
- package/dist/types/pm-plugins/decorations/colorSchemes/types.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.d.ts +1 -3
- package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/createChangedRowDecorationWidgets.d.ts +1 -3
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/decorationKeys.d.ts +5 -8
- package/dist/types/pm-plugins/decorations/utils/createDeletedLineBreakWidget.d.ts +3 -5
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +4 -6
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.d.ts +3 -4
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.d.ts +4 -4
- package/dist/types/pm-plugins/getDefaultDiffType.d.ts +2 -0
- package/dist/types/pm-plugins/getScrollableDecorations.d.ts +1 -2
- package/dist/types/pm-plugins/main.d.ts +0 -1
- package/dist/types/showDiffPluginType.d.ts +1 -3
- package/docs/smart-diff-design.md +13 -29
- package/package.json +5 -5
- package/dist/cjs/pm-plugins/isExtendedEnabled.js +0 -23
- package/dist/es2019/pm-plugins/isExtendedEnabled.js +0 -13
- package/dist/esm/pm-plugins/isExtendedEnabled.js +0 -17
- package/dist/types/pm-plugins/isExtendedEnabled.d.ts +0 -12
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.resolveCellOverlayStyleLegacy = exports.getBlockNodeStyleLegacy = void 0;
|
|
7
7
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
8
|
-
var _isExtendedEnabled = require("../isExtendedEnabled");
|
|
9
8
|
var _standard = require("./colorSchemes/standard");
|
|
10
9
|
var _traditional = require("./colorSchemes/traditional");
|
|
11
10
|
/**
|
|
@@ -35,8 +34,7 @@ var getBlockNodeStyleLegacy = exports.getBlockNodeStyleLegacy = function getBloc
|
|
|
35
34
|
_ref2$isInserted = _ref2.isInserted,
|
|
36
35
|
isInserted = _ref2$isInserted === void 0 ? true : _ref2$isInserted,
|
|
37
36
|
_ref2$isActive = _ref2.isActive,
|
|
38
|
-
isActive = _ref2$isActive === void 0 ? false : _ref2$isActive
|
|
39
|
-
diffType = _ref2.diffType;
|
|
37
|
+
isActive = _ref2$isActive === void 0 ? false : _ref2$isActive;
|
|
40
38
|
var isTraditional = colorScheme === 'traditional';
|
|
41
39
|
if (['mediaSingle', 'mediaGroup', 'table',
|
|
42
40
|
// Handle table separately to avoid border issues
|
|
@@ -48,77 +46,47 @@ var getBlockNodeStyleLegacy = exports.getBlockNodeStyleLegacy = function getBloc
|
|
|
48
46
|
}
|
|
49
47
|
// Media nodes inside mediaSingle should not get position:relative
|
|
50
48
|
// as it shifts the image outside its parent container (e.g. panel)
|
|
51
|
-
if (nodeName === 'media') {
|
|
52
|
-
if (!isInserted
|
|
49
|
+
if (nodeName === 'media' || nodeName === 'panel') {
|
|
50
|
+
if (!isInserted) {
|
|
53
51
|
return isTraditional ? (0, _traditional.getDeletedTraditionalInlineStyle)(false) : _standard.deletedDecorationMarkerVariable;
|
|
54
52
|
}
|
|
55
53
|
return isTraditional ? isActive ? _traditional.traditionalStyleNodeActive : _traditional.traditionalStyleNodeNew : _standard.editingStyleNode;
|
|
56
54
|
}
|
|
57
55
|
if (['tableCell', 'tableHeader'].includes(nodeName)) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
// When gate is off, it should return undefined as above
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
if (nodeName === 'panel') {
|
|
68
|
-
if (!isInserted && (0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
69
|
-
return isTraditional ? (0, _traditional.getDeletedTraditionalInlineStyle)(false) : _standard.deletedDecorationMarkerVariable;
|
|
70
|
-
}
|
|
71
|
-
return isTraditional ? isActive ? _traditional.traditionalStyleNodeActive : _traditional.traditionalStyleNodeNew : _standard.editingStyleNode;
|
|
56
|
+
// This is used for positioning the cell overlay widget decorations
|
|
57
|
+
return (0, _lazyNodeView.convertToInlineCss)({
|
|
58
|
+
position: 'relative'
|
|
59
|
+
});
|
|
72
60
|
}
|
|
73
61
|
if (['extension', 'embedCard', 'listItem'].includes(nodeName)) {
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
return isTraditional && isActive ? _traditional.traditionalDecorationMarkerVariableActive : isTraditional ? _traditional.traditionalDecorationMarkerVariableNew : _standard.standardDecorationMarkerVariable;
|
|
77
|
-
} else {
|
|
78
|
-
if (nodeName === 'listItem') {
|
|
79
|
-
return isTraditional && isActive ? _traditional.traditionalDeletedDecorationMarkerVariableActive : isTraditional ? _traditional.traditionalDeletedDecorationMarkerVariableNew : _standard.deletedDecorationMarkerVariable;
|
|
80
|
-
}
|
|
81
|
-
return isTraditional && isActive ? _traditional.traditionalDeletedDecorationMarkerVariableActive : isTraditional ? _traditional.traditionalDeletedDecorationMarkerVariableNew : (0, _standard.getStandardDeletedContentStyleNew)();
|
|
82
|
-
}
|
|
62
|
+
if (isInserted) {
|
|
63
|
+
return isTraditional && isActive ? _traditional.traditionalDecorationMarkerVariableActive : isTraditional ? _traditional.traditionalDecorationMarkerVariableNew : _standard.standardDecorationMarkerVariable;
|
|
83
64
|
}
|
|
84
|
-
|
|
65
|
+
if (nodeName === 'listItem') {
|
|
66
|
+
return isTraditional && isActive ? _traditional.traditionalDeletedDecorationMarkerVariableActive : isTraditional ? _traditional.traditionalDeletedDecorationMarkerVariableNew : _standard.deletedDecorationMarkerVariable;
|
|
67
|
+
}
|
|
68
|
+
return isTraditional && isActive ? _traditional.traditionalDeletedDecorationMarkerVariableActive : isTraditional ? _traditional.traditionalDeletedDecorationMarkerVariableNew : (0, _standard.getStandardDeletedContentStyleNew)();
|
|
85
69
|
}
|
|
86
70
|
if (nodeName === 'blockquote') {
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
return isTraditional ? isActive ? _traditional.traditionalStyleQuoteNodeActive : _traditional.traditionalStyleQuoteNodeNew : _standard.editingStyleQuoteNode;
|
|
90
|
-
} else {
|
|
91
|
-
return isTraditional ? _traditional.deletedTraditionalStyleQuoteNode : _standard.deletedStyleQuoteNode;
|
|
92
|
-
}
|
|
71
|
+
if (isInserted) {
|
|
72
|
+
return isTraditional ? isActive ? _traditional.traditionalStyleQuoteNodeActive : _traditional.traditionalStyleQuoteNodeNew : _standard.editingStyleQuoteNode;
|
|
93
73
|
}
|
|
94
|
-
return isTraditional ?
|
|
74
|
+
return isTraditional ? _traditional.deletedTraditionalStyleQuoteNode : _standard.deletedStyleQuoteNode;
|
|
95
75
|
}
|
|
96
76
|
if (nodeName === 'rule') {
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
return isTraditional ? isActive ? _traditional.traditionalStyleRuleNodeActive : _traditional.traditionalStyleRuleNodeNew : _standard.editingStyleRuleNode;
|
|
100
|
-
} else {
|
|
101
|
-
return isTraditional ? (0, _traditional.getDeletedTraditionalInlineStyle)(false) : (0, _standard.getStandardDeletedContentStyleNew)();
|
|
102
|
-
}
|
|
77
|
+
if (isInserted) {
|
|
78
|
+
return isTraditional ? isActive ? _traditional.traditionalStyleRuleNodeActive : _traditional.traditionalStyleRuleNodeNew : _standard.editingStyleRuleNode;
|
|
103
79
|
}
|
|
104
|
-
return isTraditional ?
|
|
80
|
+
return isTraditional ? (0, _traditional.getDeletedTraditionalInlineStyle)(false) : (0, _standard.getStandardDeletedContentStyleNew)();
|
|
105
81
|
}
|
|
106
82
|
if (nodeName === 'blockCard') {
|
|
107
|
-
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
108
|
-
if (isInserted) {
|
|
109
|
-
return isTraditional ? isActive ? _traditional.traditionalStyleCardBlockNodeActive : _traditional.traditionalStyleCardBlockNodeNew : _standard.editingStyleCardBlockNode;
|
|
110
|
-
} else {
|
|
111
|
-
return isTraditional ? (0, _traditional.getDeletedTraditionalInlineStyle)(false) : (0, _standard.getStandardDeletedContentStyleNew)();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return isTraditional ? isActive ? _traditional.traditionalStyleCardBlockNodeActive : _traditional.traditionalStyleCardBlockNodeNew : _standard.editingStyleCardBlockNode;
|
|
115
|
-
}
|
|
116
|
-
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
117
83
|
if (isInserted) {
|
|
118
|
-
return isTraditional ? isActive ? _traditional.
|
|
119
|
-
} else {
|
|
120
|
-
return isTraditional ? (0, _traditional.getDeletedTraditionalInlineStyle)(false) : (0, _standard.getStandardDeletedContentStyleNew)();
|
|
84
|
+
return isTraditional ? isActive ? _traditional.traditionalStyleCardBlockNodeActive : _traditional.traditionalStyleCardBlockNodeNew : _standard.editingStyleCardBlockNode;
|
|
121
85
|
}
|
|
86
|
+
return isTraditional ? (0, _traditional.getDeletedTraditionalInlineStyle)(false) : (0, _standard.getStandardDeletedContentStyleNew)();
|
|
87
|
+
}
|
|
88
|
+
if (isInserted) {
|
|
89
|
+
return isTraditional ? isActive ? _traditional.traditionalStyleNodeActive : _traditional.traditionalStyleNodeNew : _standard.editingStyleNode;
|
|
122
90
|
}
|
|
123
|
-
return isTraditional ?
|
|
91
|
+
return isTraditional ? (0, _traditional.getDeletedTraditionalInlineStyle)(false) : (0, _standard.getStandardDeletedContentStyleNew)();
|
|
124
92
|
};
|
|
@@ -14,7 +14,6 @@ var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
|
14
14
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
15
15
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
16
16
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
17
|
-
var _isExtendedEnabled = require("../isExtendedEnabled");
|
|
18
17
|
var _factory = require("./colorSchemes/factory");
|
|
19
18
|
var _schemes = require("./colorSchemes/schemes");
|
|
20
19
|
var _createAnchorDecorationWidgets = require("./createAnchorDecorationWidgets");
|
|
@@ -35,8 +34,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
35
34
|
var extractChangedRows = function extractChangedRows(_ref) {
|
|
36
35
|
var change = _ref.change,
|
|
37
36
|
originalDoc = _ref.originalDoc,
|
|
38
|
-
newDoc = _ref.newDoc
|
|
39
|
-
diffType = _ref.diffType;
|
|
37
|
+
newDoc = _ref.newDoc;
|
|
40
38
|
var changedRows = [];
|
|
41
39
|
|
|
42
40
|
// Find the table in the original document
|
|
@@ -74,7 +72,7 @@ var extractChangedRows = function extractChangedRows(_ref) {
|
|
|
74
72
|
// Find which rows were changed by analyzing the change range
|
|
75
73
|
var changeStartInTable = change.fromA - tableOld.pos - 1;
|
|
76
74
|
var changeEndInTable = change.toA - tableOld.pos - 1;
|
|
77
|
-
var edgeAttrsByOffset = (0,
|
|
75
|
+
var edgeAttrsByOffset = (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_table_diff_rounded_corners') ? (0, _tableCellEdgeAttrs.getTableTopAndBottomCellEdgeAttrs)(oldTableMap) : undefined;
|
|
78
76
|
var currentOffset = 0;
|
|
79
77
|
var rowIndex = 0;
|
|
80
78
|
tableOld.node.content.forEach(function (rowNode) {
|
|
@@ -83,7 +81,7 @@ var extractChangedRows = function extractChangedRows(_ref) {
|
|
|
83
81
|
|
|
84
82
|
// Check if this row overlaps with the deletion range
|
|
85
83
|
var rowOverlapsChange = rowStart >= changeStartInTable && rowStart < changeEndInTable || rowEnd > changeStartInTable && rowEnd <= changeEndInTable || rowStart < changeStartInTable && rowEnd > changeEndInTable;
|
|
86
|
-
if (rowOverlapsChange && rowNode.type.name === 'tableRow'
|
|
84
|
+
if (rowOverlapsChange && rowNode.type.name === 'tableRow') {
|
|
87
85
|
var rowLocalId = rowNode.attrs.localId;
|
|
88
86
|
var isTableRowReplacement = rowLocalId && tableNew.node.children.some(function (candidateRow) {
|
|
89
87
|
return candidateRow.type.name === 'tableRow' && candidateRow.attrs.localId === rowLocalId;
|
|
@@ -148,32 +146,6 @@ var extractChangedRows = function extractChangedRows(_ref) {
|
|
|
148
146
|
return true;
|
|
149
147
|
});
|
|
150
148
|
};
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Checks if a table row is empty (contains no meaningful content)
|
|
154
|
-
*/
|
|
155
|
-
var isEmptyRow = function isEmptyRow(rowNode) {
|
|
156
|
-
var isEmpty = true;
|
|
157
|
-
rowNode.descendants(function (node) {
|
|
158
|
-
if (!isEmpty) {
|
|
159
|
-
return false;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// If we find any inline content with size > 0, the row is not empty
|
|
163
|
-
if (node.isInline && node.nodeSize > 0) {
|
|
164
|
-
isEmpty = false;
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// If we find text content, the row is not empty
|
|
169
|
-
if (node.isText && node.text && node.text.trim() !== '') {
|
|
170
|
-
isEmpty = false;
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
return true;
|
|
174
|
-
});
|
|
175
|
-
return isEmpty;
|
|
176
|
-
};
|
|
177
149
|
/**
|
|
178
150
|
* Creates a DOM representation of a deleted table row
|
|
179
151
|
*/
|
|
@@ -184,7 +156,6 @@ var createChangedRowDOM = function createChangedRowDOM(_ref3) {
|
|
|
184
156
|
isTableRowReplacement = _ref3.isTableRowReplacement,
|
|
185
157
|
colorScheme = _ref3.colorScheme,
|
|
186
158
|
isInserted = _ref3.isInserted,
|
|
187
|
-
diffType = _ref3.diffType,
|
|
188
159
|
hasAnchoredRemovedLozenge = _ref3.hasAnchoredRemovedLozenge,
|
|
189
160
|
intl = _ref3.intl,
|
|
190
161
|
isActive = _ref3.isActive;
|
|
@@ -194,16 +165,15 @@ var createChangedRowDOM = function createChangedRowDOM(_ref3) {
|
|
|
194
165
|
}
|
|
195
166
|
var colors = _schemes.colorSchemeRegistry[colorScheme !== null && colorScheme !== void 0 ? colorScheme : 'standard'];
|
|
196
167
|
var deletedTreatment = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? (0, _factory.buildDeletedRowStyle)(colors) : (0, _createChangedRowDecorationWidgetsStyles.resolveDeletedRowStyleLegacy)((0, _schemes.getLegacyColorScheme)(colorScheme));
|
|
197
|
-
var hostsRemovedLozenge = Boolean(intl) &&
|
|
168
|
+
var hostsRemovedLozenge = Boolean(intl) && !isInserted && !hasAnchoredRemovedLozenge;
|
|
198
169
|
|
|
199
170
|
// Inserted rows keep their natural styling; the row strikethrough is deletions only.
|
|
200
|
-
if (!
|
|
171
|
+
if (!isInserted) {
|
|
201
172
|
tr.setAttribute('style', deletedTreatment);
|
|
202
173
|
}
|
|
203
|
-
// Mirrors the strikethrough condition above:
|
|
204
|
-
// is ADDED content, so it must not claim the "deleted" testid — page models match that as
|
|
174
|
+
// Mirrors the strikethrough condition above: an `isInserted` row is ADDED content, so it must not claim the "deleted" testid — page models match that as
|
|
205
175
|
// removed content (same reasoning as `createTableCellContentWidgets`).
|
|
206
|
-
tr.setAttribute('data-testid',
|
|
176
|
+
tr.setAttribute('data-testid', isInserted && (0, _fg.fg)('platform_editor_ai_show_diff_patch_1') ? 'show-diff-changed-row' : 'show-diff-deleted-row');
|
|
207
177
|
if ((0, _fg.fg)('platform_editor_ai_show_diff_patch_1')) {
|
|
208
178
|
tr.style.setProperty('scroll-margin-top', _decorationKeys.scrollMarginTopValue);
|
|
209
179
|
}
|
|
@@ -216,17 +186,15 @@ var createChangedRowDOM = function createChangedRowDOM(_ref3) {
|
|
|
216
186
|
if (nodeView) {
|
|
217
187
|
if (nodeView instanceof HTMLElement) {
|
|
218
188
|
(0, _tableCellEdgeAttrs.applyCellEdgeAttrs)(nodeView, cellEdgeAttrs === null || cellEdgeAttrs === void 0 ? void 0 : cellEdgeAttrs[cellIndex]);
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
nodeView.appendChild(overlay);
|
|
229
|
-
}
|
|
189
|
+
var overlay = document.createElement('span');
|
|
190
|
+
var isRoundedTable = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_table_diff_rounded_corners');
|
|
191
|
+
var overlayStyle = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? isInserted ? isRoundedTable ? (0, _factory.buildAddedCellOverlayRoundedStyle)(colors) : (0, _factory.buildAddedCellOverlayStyle)(colors) : isRoundedTable ? (0, _factory.buildDeletedCellOverlayRoundedStyle)(colors) : (0, _factory.buildDeletedCellOverlayStyle)(colors) : (0, _createChangedRowDecorationWidgetsStyles.resolveCellOverlayStyleLegacy)({
|
|
192
|
+
colorScheme: (0, _schemes.getLegacyColorScheme)(colorScheme),
|
|
193
|
+
isInserted: isInserted,
|
|
194
|
+
isRoundedTable: isRoundedTable
|
|
195
|
+
});
|
|
196
|
+
overlay.setAttribute('style', overlayStyle);
|
|
197
|
+
nodeView.appendChild(overlay);
|
|
230
198
|
}
|
|
231
199
|
tr.appendChild(nodeView);
|
|
232
200
|
} else {
|
|
@@ -281,8 +249,7 @@ var createAnchoredRemovedLozengeWidget = function createAnchoredRemovedLozengeWi
|
|
|
281
249
|
var expandDiffForChangedRows = function expandDiffForChangedRows(_ref5) {
|
|
282
250
|
var changes = _ref5.changes,
|
|
283
251
|
originalDoc = _ref5.originalDoc,
|
|
284
|
-
newDoc = _ref5.newDoc
|
|
285
|
-
diffType = _ref5.diffType;
|
|
252
|
+
newDoc = _ref5.newDoc;
|
|
286
253
|
var rowInfo = [];
|
|
287
254
|
var _iterator = _createForOfIteratorHelper(changes),
|
|
288
255
|
_step;
|
|
@@ -293,8 +260,7 @@ var expandDiffForChangedRows = function expandDiffForChangedRows(_ref5) {
|
|
|
293
260
|
var changedRows = extractChangedRows({
|
|
294
261
|
change: change,
|
|
295
262
|
originalDoc: originalDoc,
|
|
296
|
-
newDoc: newDoc
|
|
297
|
-
diffType: diffType
|
|
263
|
+
newDoc: newDoc
|
|
298
264
|
});
|
|
299
265
|
if (changedRows.length > 0) {
|
|
300
266
|
rowInfo.push.apply(rowInfo, (0, _toConsumableArray2.default)(changedRows));
|
|
@@ -322,7 +288,6 @@ var createChangedRowDecorationWidgets = exports.createChangedRowDecorationWidget
|
|
|
322
288
|
_ref6$isInserted = _ref6.isInserted,
|
|
323
289
|
isInserted = _ref6$isInserted === void 0 ? false : _ref6$isInserted,
|
|
324
290
|
leftAnchorId = _ref6.leftAnchorId,
|
|
325
|
-
diffType = _ref6.diffType,
|
|
326
291
|
intl = _ref6.intl,
|
|
327
292
|
_ref6$showIndicators = _ref6.showIndicators,
|
|
328
293
|
showIndicators = _ref6$showIndicators === void 0 ? false : _ref6$showIndicators,
|
|
@@ -335,13 +300,12 @@ var createChangedRowDecorationWidgets = exports.createChangedRowDecorationWidget
|
|
|
335
300
|
return change.deleted.length > 0;
|
|
336
301
|
}),
|
|
337
302
|
originalDoc: originalDoc,
|
|
338
|
-
newDoc: newDoc
|
|
339
|
-
diffType: diffType
|
|
303
|
+
newDoc: newDoc
|
|
340
304
|
});
|
|
341
305
|
return changedRows.flatMap(function (changedRow) {
|
|
342
306
|
// Keep the ID stable while contributor tags are enabled so recalculation preserves their state.
|
|
343
307
|
var diffId = showContributorTags ? "widget-row-".concat(changedRow.fromA, "-").concat(changedRow.toA) : crypto.randomUUID();
|
|
344
|
-
var hasAnchoredRemovedLozenge = Boolean(intl) &&
|
|
308
|
+
var hasAnchoredRemovedLozenge = Boolean(intl) && !isInserted && supportsAnchorPositioning();
|
|
345
309
|
var rowDOM = createChangedRowDOM({
|
|
346
310
|
rowNode: changedRow.rowNode,
|
|
347
311
|
isTableRowReplacement: changedRow.isTableRowReplacement,
|
|
@@ -349,7 +313,6 @@ var createChangedRowDecorationWidgets = exports.createChangedRowDecorationWidget
|
|
|
349
313
|
nodeViewSerializer: nodeViewSerializer,
|
|
350
314
|
colorScheme: colorScheme,
|
|
351
315
|
isInserted: isInserted,
|
|
352
|
-
diffType: diffType,
|
|
353
316
|
hasAnchoredRemovedLozenge: hasAnchoredRemovedLozenge,
|
|
354
317
|
intl: intl,
|
|
355
318
|
isActive: isActive
|
|
@@ -367,7 +330,7 @@ var createChangedRowDecorationWidgets = exports.createChangedRowDecorationWidget
|
|
|
367
330
|
// is still created but can never resolve a position, so it silently does not render and the
|
|
368
331
|
// bar covers only the row being changed. `createNodeChangedDecorationWidget` sets the same
|
|
369
332
|
// property on its own widget DOM for non-table content; this path returns before reaching it.
|
|
370
|
-
if (showIndicators && (0,
|
|
333
|
+
if (showIndicators && (0, _fg.fg)('platform_editor_ai_show_diff_patch_1')) {
|
|
371
334
|
rowAnchorNames.push((0, _decorationKeys.buildAnchorDecorationKey)({
|
|
372
335
|
diffId: diffId
|
|
373
336
|
}));
|
|
@@ -422,8 +385,7 @@ var createChangedRowDecorationWidgets = exports.createChangedRowDecorationWidget
|
|
|
422
385
|
diffId: diffId,
|
|
423
386
|
leftAnchorId: leftAnchorId,
|
|
424
387
|
isActive: isActive,
|
|
425
|
-
isInserted: isInserted
|
|
426
|
-
diffType: diffType
|
|
388
|
+
isInserted: isInserted
|
|
427
389
|
})));
|
|
428
390
|
decorations.push(rowWidget);
|
|
429
391
|
if (intl && removedLozengeAnchorName) {
|
|
@@ -12,7 +12,6 @@ var _view = require("@atlaskit/editor-prosemirror/view");
|
|
|
12
12
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
13
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
14
|
var _buildContributorTagDom = require("../../ui/ContributorTag/buildContributorTagDom");
|
|
15
|
-
var _isExtendedEnabled = require("../isExtendedEnabled");
|
|
16
15
|
var _isEmptyParagraphSlice = require("../utils/isEmptyParagraphSlice");
|
|
17
16
|
var _factory = require("./colorSchemes/factory");
|
|
18
17
|
var _schemes = require("./colorSchemes/schemes");
|
|
@@ -67,7 +66,7 @@ var getAtomicInlineNodeClassName = function getAtomicInlineNodeClassName(inlineN
|
|
|
67
66
|
return classNames.join(' ');
|
|
68
67
|
};
|
|
69
68
|
|
|
70
|
-
/** Inline style for inserted content
|
|
69
|
+
/** Inline style for inserted content. */
|
|
71
70
|
var getExtendedInsertStyle = function getExtendedInsertStyle(colors, isActive, hideAddedDiffsUnderline) {
|
|
72
71
|
if (colors.insertedInlineTreatment === 'underline') {
|
|
73
72
|
// hideAddedDiffsUnderline only targets the 'borderBottom' rule, so it does not apply here.
|
|
@@ -79,7 +78,7 @@ var getExtendedInsertStyle = function getExtendedInsertStyle(colors, isActive, h
|
|
|
79
78
|
return hideAddedDiffsUnderline ? (0, _factory.buildInsertStyleExtendedNoUnderline)(colors) : (0, _factory.buildInsertStyleExtended)(colors);
|
|
80
79
|
};
|
|
81
80
|
|
|
82
|
-
/** Inline style for deleted content
|
|
81
|
+
/** Inline style for deleted content. */
|
|
83
82
|
var getExtendedDeletedStyle = function getExtendedDeletedStyle(colors, isActive) {
|
|
84
83
|
if (colors.deletedInlineTreatment === 'strikethrough') {
|
|
85
84
|
// Identical in both states — the block decoration carries the active emphasis.
|
|
@@ -91,14 +90,10 @@ var getExtendedDeletedStyle = function getExtendedDeletedStyle(colors, isActive)
|
|
|
91
90
|
/** Registry-driven inline `style` for a changed-content decoration. */
|
|
92
91
|
var resolveInlineChangedStyleRefactored = function resolveInlineChangedStyleRefactored(_ref) {
|
|
93
92
|
var colors = _ref.colors,
|
|
94
|
-
diffType = _ref.diffType,
|
|
95
93
|
hideAddedDiffsUnderline = _ref.hideAddedDiffsUnderline,
|
|
96
94
|
isActive = _ref.isActive,
|
|
97
95
|
isInserted = _ref.isInserted;
|
|
98
|
-
|
|
99
|
-
return isInserted ? getExtendedInsertStyle(colors, isActive, hideAddedDiffsUnderline) : getExtendedDeletedStyle(colors, isActive);
|
|
100
|
-
}
|
|
101
|
-
return isActive ? (0, _factory.buildInsertStyleActive)(colors) : (0, _factory.buildInsertStyle)(colors);
|
|
96
|
+
return isInserted ? getExtendedInsertStyle(colors, isActive, hideAddedDiffsUnderline) : getExtendedDeletedStyle(colors, isActive);
|
|
102
97
|
};
|
|
103
98
|
|
|
104
99
|
/**
|
|
@@ -156,7 +151,6 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
156
151
|
_ref2$showIndicators = _ref2.showIndicators,
|
|
157
152
|
showIndicators = _ref2$showIndicators === void 0 ? false : _ref2$showIndicators,
|
|
158
153
|
doc = _ref2.doc,
|
|
159
|
-
diffType = _ref2.diffType,
|
|
160
154
|
_ref2$hideAddedDiffsU = _ref2.hideAddedDiffsUnderline,
|
|
161
155
|
hideAddedDiffsUnderline = _ref2$hideAddedDiffsU === void 0 ? false : _ref2$hideAddedDiffsU,
|
|
162
156
|
inlineNodeName = _ref2.inlineNodeName,
|
|
@@ -173,7 +167,7 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
173
167
|
|
|
174
168
|
// Match the rendered shape: whitespace text is eligible, while an empty paragraph is structural
|
|
175
169
|
// content with no tag host.
|
|
176
|
-
var canTagChange = showContributorTags && !!doc && (0,
|
|
170
|
+
var canTagChange = showContributorTags && !!doc && (0, _createContributorTagWidget.isContributorTagWidgetEnabled)() && !(0, _isEmptyParagraphSlice.isEmptyParagraphSlice)(doc.slice(change.fromB, change.toB));
|
|
177
171
|
if (shouldHideDeleted) {
|
|
178
172
|
return [_view.Decoration.inline(change.fromB, change.toB, {
|
|
179
173
|
style: displayNoneStyle
|
|
@@ -191,19 +185,17 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
191
185
|
var colors = getColorScheme(colorScheme);
|
|
192
186
|
|
|
193
187
|
// The reveal withholds the static highlight so the wipe has something to reveal, so it supplies
|
|
194
|
-
// the whole style rather than adding to the usual one.
|
|
195
|
-
|
|
196
|
-
var revealed = (0, _isExtendedEnabled.isExtendedEnabled)(diffType) ? (0, _revealStyles.resolveRevealStyle)({
|
|
188
|
+
// the whole style rather than adding to the usual one.
|
|
189
|
+
var revealed = (0, _revealStyles.resolveRevealStyle)({
|
|
197
190
|
colorScheme: colorScheme,
|
|
198
191
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
199
192
|
isActive: isActive,
|
|
200
193
|
isInserted: isInserted,
|
|
201
194
|
reveal: reveal
|
|
202
|
-
})
|
|
195
|
+
});
|
|
203
196
|
var style = (_revealed$style = revealed === null || revealed === void 0 ? void 0 : revealed.style) !== null && _revealed$style !== void 0 ? _revealed$style : resolveInlineChangedStyle({
|
|
204
197
|
colors: colors,
|
|
205
198
|
colorScheme: colorScheme,
|
|
206
|
-
diffType: diffType,
|
|
207
199
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
208
200
|
isActive: isActive,
|
|
209
201
|
isInserted: isInserted
|
|
@@ -251,7 +243,7 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
251
243
|
isActive: isActive,
|
|
252
244
|
isInserted: isInserted
|
|
253
245
|
}))];
|
|
254
|
-
if (showIndicators && doc
|
|
246
|
+
if (showIndicators && doc) {
|
|
255
247
|
// For paragraphs, fromB/toB land on the outer block
|
|
256
248
|
// boundary. Adjust anchor widgets into inline content so the indicator
|
|
257
249
|
// bar doesn't extend into the preceding block's margin.
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.resolveInlineChangedStyleLegacy = exports.getAtomicInlineNodeClassNameLegacy = void 0;
|
|
7
|
-
var _isExtendedEnabled = require("../isExtendedEnabled");
|
|
8
7
|
var _standard = require("./colorSchemes/standard");
|
|
9
8
|
var _traditional = require("./colorSchemes/traditional");
|
|
10
9
|
/**
|
|
@@ -22,33 +21,19 @@ var _traditional = require("./colorSchemes/traditional");
|
|
|
22
21
|
*/
|
|
23
22
|
var resolveInlineChangedStyleLegacy = exports.resolveInlineChangedStyleLegacy = function resolveInlineChangedStyleLegacy(_ref) {
|
|
24
23
|
var colorScheme = _ref.colorScheme,
|
|
25
|
-
diffType = _ref.diffType,
|
|
26
24
|
hideAddedDiffsUnderline = _ref.hideAddedDiffsUnderline,
|
|
27
25
|
isActive = _ref.isActive,
|
|
28
26
|
isInserted = _ref.isInserted;
|
|
29
|
-
|
|
30
|
-
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
31
|
-
if (isInserted) {
|
|
32
|
-
if (colorScheme === 'traditional') {
|
|
33
|
-
style = isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
|
|
34
|
-
} else {
|
|
35
|
-
style = isActive ? hideAddedDiffsUnderline ? _standard.editingStyleActiveExtendedNoUnderline : _standard.editingStyleActiveExtended : hideAddedDiffsUnderline ? _standard.editingStyleExtendedNoUnderline : _standard.editingStyleExtended;
|
|
36
|
-
}
|
|
37
|
-
} else {
|
|
38
|
-
if (colorScheme === 'traditional') {
|
|
39
|
-
style = (0, _traditional.getDeletedTraditionalInlineStyle)(false);
|
|
40
|
-
} else {
|
|
41
|
-
style = (isActive ? (0, _standard.getStandardDeletedContentStyleActive)() : (0, _standard.getStandardDeletedContentStyle)()) + _standard.deletedInlineContentStyleExtended;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
27
|
+
if (isInserted) {
|
|
45
28
|
if (colorScheme === 'traditional') {
|
|
46
|
-
|
|
47
|
-
} else {
|
|
48
|
-
style = isActive ? _standard.editingStyleActive : _standard.editingStyle;
|
|
29
|
+
return isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
|
|
49
30
|
}
|
|
31
|
+
return isActive ? hideAddedDiffsUnderline ? _standard.editingStyleActiveExtendedNoUnderline : _standard.editingStyleActiveExtended : hideAddedDiffsUnderline ? _standard.editingStyleExtendedNoUnderline : _standard.editingStyleExtended;
|
|
32
|
+
}
|
|
33
|
+
if (colorScheme === 'traditional') {
|
|
34
|
+
return (0, _traditional.getDeletedTraditionalInlineStyle)(false);
|
|
50
35
|
}
|
|
51
|
-
return
|
|
36
|
+
return (isActive ? (0, _standard.getStandardDeletedContentStyleActive)() : (0, _standard.getStandardDeletedContentStyle)()) + _standard.deletedInlineContentStyleExtended;
|
|
52
37
|
};
|
|
53
38
|
|
|
54
39
|
/**
|