@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
|
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import { isExtendedEnabled } from '../../isExtendedEnabled';
|
|
6
5
|
import { buildDiffDecorationSpec, scrollMarginTopValue } from '../decorationKeys';
|
|
7
6
|
import { createContentWrapper } from './wrapBlockNodeView';
|
|
8
7
|
|
|
@@ -31,7 +30,6 @@ export var createDeletedLineBreakWidget = function createDeletedLineBreakWidget(
|
|
|
31
30
|
var colorScheme = _ref.colorScheme,
|
|
32
31
|
_ref$count = _ref.count,
|
|
33
32
|
count = _ref$count === void 0 ? 1 : _ref$count,
|
|
34
|
-
diffType = _ref.diffType,
|
|
35
33
|
_ref$isActive = _ref.isActive,
|
|
36
34
|
isActive = _ref$isActive === void 0 ? false : _ref$isActive,
|
|
37
35
|
reveal = _ref.reveal;
|
|
@@ -49,7 +47,7 @@ export var createDeletedLineBreakWidget = function createDeletedLineBreakWidget(
|
|
|
49
47
|
// deleted-content wrapper is styled as an inline run.
|
|
50
48
|
dom.append(dom.ownerDocument.createElement('br'));
|
|
51
49
|
}
|
|
52
|
-
var wrapper = createContentWrapper(colorScheme, isActive, false,
|
|
50
|
+
var wrapper = createContentWrapper(colorScheme, isActive, false, reveal);
|
|
53
51
|
wrapper.append(dom.ownerDocument.createTextNode(RETURN_GLYPH));
|
|
54
52
|
dom.append(wrapper);
|
|
55
53
|
}
|
|
@@ -69,7 +67,6 @@ export var createDeletedLineBreakDecoration = function createDeletedLineBreakDec
|
|
|
69
67
|
var attributionKey = _ref2.attributionKey,
|
|
70
68
|
colorScheme = _ref2.colorScheme,
|
|
71
69
|
count = _ref2.count,
|
|
72
|
-
diffType = _ref2.diffType,
|
|
73
70
|
_ref2$isActive = _ref2.isActive,
|
|
74
71
|
isActive = _ref2$isActive === void 0 ? false : _ref2$isActive,
|
|
75
72
|
pos = _ref2.pos,
|
|
@@ -78,7 +75,6 @@ export var createDeletedLineBreakDecoration = function createDeletedLineBreakDec
|
|
|
78
75
|
return Decoration.widget(pos, createDeletedLineBreakWidget({
|
|
79
76
|
colorScheme: colorScheme,
|
|
80
77
|
count: count,
|
|
81
|
-
diffType: diffType,
|
|
82
78
|
isActive: isActive,
|
|
83
79
|
reveal: reveal
|
|
84
80
|
}), _objectSpread(_objectSpread({}, buildDiffDecorationSpec(_objectSpread({
|
|
@@ -89,9 +85,8 @@ export var createDeletedLineBreakDecoration = function createDeletedLineBreakDec
|
|
|
89
85
|
isActive: isActive,
|
|
90
86
|
// The glyph always stands in for removed content, whichever side of the changeset the
|
|
91
87
|
// change itself landed on.
|
|
92
|
-
isInserted: false
|
|
93
|
-
|
|
94
|
-
}, isExtendedEnabled(diffType) && side !== undefined && {
|
|
88
|
+
isInserted: false
|
|
89
|
+
}, side !== undefined && {
|
|
95
90
|
side: side
|
|
96
91
|
}))), {}, {
|
|
97
92
|
// Without an explicit mark set, prosemirror-view wraps the widget in the marks of the
|
|
@@ -5,7 +5,6 @@ import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-uti
|
|
|
5
5
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
|
-
import { isExtendedEnabled } from '../../isExtendedEnabled';
|
|
9
8
|
import { getAtomicInlineChangedAttrs } from '../createInlineChangedDecoration';
|
|
10
9
|
import { applyRevealToElement } from '../revealStyles';
|
|
11
10
|
import { isInlineAttrChangeNodeName } from './getAttrChangeRanges';
|
|
@@ -113,14 +112,6 @@ var applyDeletedNodeMarkupNext = function applyDeletedNodeMarkupNext(_ref3) {
|
|
|
113
112
|
var applyDeletedNodeMarkup = function applyDeletedNodeMarkup(args) {
|
|
114
113
|
return isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? applyDeletedNodeMarkupNext(args) : applyDeletedNodeMarkupLegacy(args);
|
|
115
114
|
};
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Checks if a node should apply deleted styles directly without wrapper
|
|
119
|
-
* to preserve natural block-level margins
|
|
120
|
-
*/
|
|
121
|
-
var shouldApplyStylesDirectly = function shouldApplyStylesDirectly(nodeName) {
|
|
122
|
-
return nodeName === 'heading';
|
|
123
|
-
};
|
|
124
115
|
var applyCellOverlayStyles = function applyCellOverlayStyles(_ref4) {
|
|
125
116
|
var element = _ref4.element,
|
|
126
117
|
colorScheme = _ref4.colorScheme,
|
|
@@ -189,37 +180,17 @@ var createBlockNodeWrapper = function createBlockNodeWrapper() {
|
|
|
189
180
|
wrapper.setAttribute('style', baseStyle);
|
|
190
181
|
return wrapper;
|
|
191
182
|
};
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Applies styles directly to an HTML element by merging with existing styles
|
|
195
|
-
*/
|
|
196
|
-
var applyStylesToElement = function applyStylesToElement(_ref5) {
|
|
183
|
+
var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref5) {
|
|
197
184
|
var element = _ref5.element,
|
|
198
185
|
targetNode = _ref5.targetNode,
|
|
199
186
|
colorScheme = _ref5.colorScheme,
|
|
200
187
|
isActive = _ref5.isActive,
|
|
201
188
|
isInserted = _ref5.isInserted,
|
|
202
|
-
diffType = _ref5.diffType,
|
|
203
189
|
_ref5$hideAddedDiffsU = _ref5.hideAddedDiffsUnderline,
|
|
204
190
|
hideAddedDiffsUnderline = _ref5$hideAddedDiffsU === void 0 ? false : _ref5$hideAddedDiffsU;
|
|
205
191
|
var currentStyle = element.getAttribute('style') || '';
|
|
206
|
-
var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
207
192
|
var targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
|
|
208
|
-
var nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive,
|
|
209
|
-
element.setAttribute('style', "".concat(currentStyle).concat(contentStyle).concat(nodeSpecificStyle));
|
|
210
|
-
};
|
|
211
|
-
var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref6) {
|
|
212
|
-
var element = _ref6.element,
|
|
213
|
-
targetNode = _ref6.targetNode,
|
|
214
|
-
colorScheme = _ref6.colorScheme,
|
|
215
|
-
isActive = _ref6.isActive,
|
|
216
|
-
isInserted = _ref6.isInserted,
|
|
217
|
-
diffType = _ref6.diffType,
|
|
218
|
-
_ref6$hideAddedDiffsU = _ref6.hideAddedDiffsUnderline,
|
|
219
|
-
hideAddedDiffsUnderline = _ref6$hideAddedDiffsU === void 0 ? false : _ref6$hideAddedDiffsU;
|
|
220
|
-
var currentStyle = element.getAttribute('style') || '';
|
|
221
|
-
var targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
|
|
222
|
-
var nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
193
|
+
var nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, hideAddedDiffsUnderline) || '';
|
|
223
194
|
if (targetNode.type.name === 'decisionList') {
|
|
224
195
|
var nestedInsertedNodeStyle = resolveNestedInsertedNodeStyle(colorScheme);
|
|
225
196
|
element.querySelectorAll('li').forEach(function (listItem) {
|
|
@@ -249,21 +220,21 @@ var appendStyleToElement = function appendStyleToElement(element, style) {
|
|
|
249
220
|
var currentStyle = element.getAttribute('style') || '';
|
|
250
221
|
element.setAttribute('style', combineStyles(currentStyle, style));
|
|
251
222
|
};
|
|
252
|
-
var wrapAtomicInlineNode = function wrapAtomicInlineNode(
|
|
253
|
-
var element =
|
|
254
|
-
className =
|
|
255
|
-
style =
|
|
223
|
+
var wrapAtomicInlineNode = function wrapAtomicInlineNode(_ref6) {
|
|
224
|
+
var element = _ref6.element,
|
|
225
|
+
className = _ref6.className,
|
|
226
|
+
style = _ref6.style;
|
|
256
227
|
var wrapper = document.createElement('span');
|
|
257
228
|
wrapper.className = className;
|
|
258
229
|
wrapper.setAttribute('style', style);
|
|
259
230
|
element.replaceWith(wrapper);
|
|
260
231
|
wrapper.append(element);
|
|
261
232
|
};
|
|
262
|
-
var applyInlineLeafNodeStyles = function applyInlineLeafNodeStyles(
|
|
263
|
-
var element =
|
|
264
|
-
targetNode =
|
|
265
|
-
contentStyle =
|
|
266
|
-
colorScheme =
|
|
233
|
+
var applyInlineLeafNodeStyles = function applyInlineLeafNodeStyles(_ref7) {
|
|
234
|
+
var element = _ref7.element,
|
|
235
|
+
targetNode = _ref7.targetNode,
|
|
236
|
+
contentStyle = _ref7.contentStyle,
|
|
237
|
+
colorScheme = _ref7.colorScheme;
|
|
267
238
|
// NodeViewSerializer appends one DOM node per direct ProseMirror child, preserving order.
|
|
268
239
|
var childDomNodes = _toConsumableArray(element.childNodes);
|
|
269
240
|
targetNode.content.forEach(function (childNode, _offset, index) {
|
|
@@ -299,23 +270,22 @@ var applyInlineLeafNodeStyles = function applyInlineLeafNodeStyles(_ref8) {
|
|
|
299
270
|
var quoteBlockLevelStyle = convertToInlineCss({
|
|
300
271
|
display: 'flow-root'
|
|
301
272
|
});
|
|
302
|
-
var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(
|
|
303
|
-
var element =
|
|
304
|
-
targetNode =
|
|
305
|
-
colorScheme =
|
|
306
|
-
isActive =
|
|
307
|
-
isInserted =
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
highlightInlineLeafNodes = _ref9$highlightInline === void 0 ? false : _ref9$highlightInline;
|
|
273
|
+
var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref8) {
|
|
274
|
+
var element = _ref8.element,
|
|
275
|
+
targetNode = _ref8.targetNode,
|
|
276
|
+
colorScheme = _ref8.colorScheme,
|
|
277
|
+
isActive = _ref8.isActive,
|
|
278
|
+
isInserted = _ref8.isInserted,
|
|
279
|
+
_ref8$hideAddedDiffsU = _ref8.hideAddedDiffsUnderline,
|
|
280
|
+
hideAddedDiffsUnderline = _ref8$hideAddedDiffsU === void 0 ? false : _ref8$hideAddedDiffsU,
|
|
281
|
+
_ref8$highlightInline = _ref8.highlightInlineLeafNodes,
|
|
282
|
+
highlightInlineLeafNodes = _ref8$highlightInline === void 0 ? false : _ref8$highlightInline;
|
|
313
283
|
var currentStyle = element.getAttribute('style') || '';
|
|
314
|
-
var nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive,
|
|
284
|
+
var nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive, hideAddedDiffsUnderline) || '';
|
|
315
285
|
if (nodeSpecificStyle) {
|
|
316
286
|
element.setAttribute('style', "".concat(currentStyle).concat(nodeSpecificStyle));
|
|
317
287
|
}
|
|
318
|
-
var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted,
|
|
288
|
+
var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, hideAddedDiffsUnderline);
|
|
319
289
|
var walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
|
|
320
290
|
var textNodesToWrap = [];
|
|
321
291
|
var currentNode = walker.nextNode();
|
|
@@ -344,24 +314,23 @@ var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref9)
|
|
|
344
314
|
/**
|
|
345
315
|
* Creates a content wrapper with deleted styles for a block node
|
|
346
316
|
*/
|
|
347
|
-
var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(
|
|
348
|
-
var nodeView =
|
|
349
|
-
targetNode =
|
|
350
|
-
colorScheme =
|
|
351
|
-
isActive =
|
|
352
|
-
isInserted =
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
hideAddedDiffsUnderline = _ref0$hideAddedDiffsU === void 0 ? false : _ref0$hideAddedDiffsU;
|
|
317
|
+
var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref9) {
|
|
318
|
+
var nodeView = _ref9.nodeView,
|
|
319
|
+
targetNode = _ref9.targetNode,
|
|
320
|
+
colorScheme = _ref9.colorScheme,
|
|
321
|
+
isActive = _ref9.isActive,
|
|
322
|
+
isInserted = _ref9.isInserted,
|
|
323
|
+
_ref9$hideAddedDiffsU = _ref9.hideAddedDiffsUnderline,
|
|
324
|
+
hideAddedDiffsUnderline = _ref9$hideAddedDiffsU === void 0 ? false : _ref9$hideAddedDiffsU;
|
|
356
325
|
var contentWrapper = document.createElement('div');
|
|
357
326
|
var targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
|
|
358
|
-
var nodeStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive,
|
|
327
|
+
var nodeStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, hideAddedDiffsUnderline);
|
|
359
328
|
|
|
360
329
|
// When the extended experiment is enabled and the content is inserted,
|
|
361
330
|
// block widget nodes that already have dedicated node-level styling (e.g. boxShadow outline)
|
|
362
331
|
// should not also get the inline content style (borderBottom underline) on their container.
|
|
363
|
-
var shouldSkipContentStyle =
|
|
364
|
-
var contentStyle = shouldSkipContentStyle ? '' : getChangedContentStyle(colorScheme, isActive, isInserted,
|
|
332
|
+
var shouldSkipContentStyle = isInserted && nodeStyle !== undefined;
|
|
333
|
+
var contentStyle = shouldSkipContentStyle ? '' : getChangedContentStyle(colorScheme, isActive, isInserted, hideAddedDiffsUnderline);
|
|
365
334
|
contentWrapper.setAttribute('style', "".concat(contentStyle).concat(nodeStyle || ''));
|
|
366
335
|
contentWrapper.append(nodeView);
|
|
367
336
|
return contentWrapper;
|
|
@@ -373,14 +342,14 @@ var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref0
|
|
|
373
342
|
* to wait for the rich-media-item to appear before attaching the lozenge.
|
|
374
343
|
* @returns true if embedCard was handled
|
|
375
344
|
*/
|
|
376
|
-
var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(
|
|
377
|
-
var dom =
|
|
378
|
-
nodeView =
|
|
379
|
-
targetNode =
|
|
380
|
-
lozenge =
|
|
381
|
-
colorScheme =
|
|
382
|
-
|
|
383
|
-
isActive =
|
|
345
|
+
var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(_ref0) {
|
|
346
|
+
var dom = _ref0.dom,
|
|
347
|
+
nodeView = _ref0.nodeView,
|
|
348
|
+
targetNode = _ref0.targetNode,
|
|
349
|
+
lozenge = _ref0.lozenge,
|
|
350
|
+
colorScheme = _ref0.colorScheme,
|
|
351
|
+
_ref0$isActive = _ref0.isActive,
|
|
352
|
+
isActive = _ref0$isActive === void 0 ? false : _ref0$isActive;
|
|
384
353
|
if (targetNode.type.name !== 'embedCard' || !(nodeView instanceof HTMLElement)) {
|
|
385
354
|
return false;
|
|
386
355
|
}
|
|
@@ -416,14 +385,14 @@ var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(_ref1) {
|
|
|
416
385
|
* Handles special mediaSingle node rendering with lozenge on child media element
|
|
417
386
|
* @returns true if mediaSingle was handled, false otherwise
|
|
418
387
|
*/
|
|
419
|
-
var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(
|
|
420
|
-
var dom =
|
|
421
|
-
nodeView =
|
|
422
|
-
targetNode =
|
|
423
|
-
lozenge =
|
|
424
|
-
colorScheme =
|
|
425
|
-
|
|
426
|
-
isActive =
|
|
388
|
+
var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(_ref1) {
|
|
389
|
+
var dom = _ref1.dom,
|
|
390
|
+
nodeView = _ref1.nodeView,
|
|
391
|
+
targetNode = _ref1.targetNode,
|
|
392
|
+
lozenge = _ref1.lozenge,
|
|
393
|
+
colorScheme = _ref1.colorScheme,
|
|
394
|
+
_ref1$isActive = _ref1.isActive,
|
|
395
|
+
isActive = _ref1$isActive === void 0 ? false : _ref1$isActive;
|
|
427
396
|
if (targetNode.type.name !== 'mediaSingle' || !(nodeView instanceof HTMLElement)) {
|
|
428
397
|
return false;
|
|
429
398
|
}
|
|
@@ -456,22 +425,21 @@ var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(_ref10)
|
|
|
456
425
|
/**
|
|
457
426
|
* Appends a block node with wrapper, lozenge, and appropriate styling
|
|
458
427
|
*/
|
|
459
|
-
var wrapBlockNode = function wrapBlockNode(
|
|
460
|
-
var dom =
|
|
461
|
-
nodeView =
|
|
462
|
-
targetNode =
|
|
463
|
-
colorScheme =
|
|
464
|
-
intl =
|
|
465
|
-
|
|
466
|
-
isActive =
|
|
467
|
-
|
|
468
|
-
isInserted =
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
hideAddedDiffsUnderline = _ref11$hideAddedDiffs === void 0 ? false : _ref11$hideAddedDiffs;
|
|
428
|
+
var wrapBlockNode = function wrapBlockNode(_ref10) {
|
|
429
|
+
var dom = _ref10.dom,
|
|
430
|
+
nodeView = _ref10.nodeView,
|
|
431
|
+
targetNode = _ref10.targetNode,
|
|
432
|
+
colorScheme = _ref10.colorScheme,
|
|
433
|
+
intl = _ref10.intl,
|
|
434
|
+
_ref10$isActive = _ref10.isActive,
|
|
435
|
+
isActive = _ref10$isActive === void 0 ? false : _ref10$isActive,
|
|
436
|
+
_ref10$isInserted = _ref10.isInserted,
|
|
437
|
+
isInserted = _ref10$isInserted === void 0 ? false : _ref10$isInserted,
|
|
438
|
+
_ref10$hideAddedDiffs = _ref10.hideAddedDiffsUnderline,
|
|
439
|
+
hideAddedDiffsUnderline = _ref10$hideAddedDiffs === void 0 ? false : _ref10$hideAddedDiffs;
|
|
472
440
|
var blockWrapper = createBlockNodeWrapper();
|
|
473
441
|
var targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
|
|
474
|
-
if (shouldShowRemovedLozenge(targetNodeName) &&
|
|
442
|
+
if (shouldShowRemovedLozenge(targetNodeName) && !isInserted) {
|
|
475
443
|
var lozenge = createRemovedLozenge(intl, isActive, colorScheme);
|
|
476
444
|
if (handleEmbedCardWithLozenge({
|
|
477
445
|
dom: dom,
|
|
@@ -501,7 +469,6 @@ var wrapBlockNode = function wrapBlockNode(_ref11) {
|
|
|
501
469
|
colorScheme: colorScheme,
|
|
502
470
|
isActive: isActive,
|
|
503
471
|
isInserted: isInserted,
|
|
504
|
-
diffType: diffType,
|
|
505
472
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
506
473
|
});
|
|
507
474
|
blockWrapper.append(contentWrapper);
|
|
@@ -521,106 +488,75 @@ var wrapBlockNode = function wrapBlockNode(_ref11) {
|
|
|
521
488
|
* For heading nodes, applies styles directly to preserve natural margins.
|
|
522
489
|
* For other block nodes, uses wrapper approach with optional lozenge.
|
|
523
490
|
*/
|
|
524
|
-
export var wrapBlockNodeView = function wrapBlockNodeView(
|
|
525
|
-
var dom =
|
|
526
|
-
nodeView =
|
|
527
|
-
targetNode =
|
|
528
|
-
colorScheme =
|
|
529
|
-
intl =
|
|
530
|
-
|
|
531
|
-
isActive =
|
|
532
|
-
|
|
533
|
-
isInserted =
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
if (isInserted && isMultiContainerBlockNode(targetNode.type.name)) {
|
|
542
|
-
applyMultiContainerLikeStyles({
|
|
543
|
-
element: nodeView,
|
|
544
|
-
targetNode: targetNode,
|
|
545
|
-
colorScheme: colorScheme,
|
|
546
|
-
isActive: isActive,
|
|
547
|
-
isInserted: isInserted,
|
|
548
|
-
diffType: diffType,
|
|
549
|
-
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
550
|
-
});
|
|
551
|
-
dom.append(nodeView);
|
|
552
|
-
return;
|
|
553
|
-
}
|
|
554
|
-
if (isTextLikeBlockNode(targetNode.type.name)) {
|
|
555
|
-
applyTextLikeBlockNodeStyles({
|
|
556
|
-
element: nodeView,
|
|
557
|
-
targetNode: targetNode,
|
|
558
|
-
colorScheme: colorScheme,
|
|
559
|
-
isActive: isActive,
|
|
560
|
-
isInserted: isInserted,
|
|
561
|
-
diffType: diffType,
|
|
562
|
-
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
563
|
-
highlightInlineLeafNodes: highlightInlineLeafNodes
|
|
564
|
-
});
|
|
565
|
-
if (targetNode.type.name === 'blockquote' && fg('platform_editor_ai_show_diff_patch_1')) {
|
|
566
|
-
appendStyleToElement(nodeView, quoteBlockLevelStyle);
|
|
567
|
-
}
|
|
568
|
-
dom.append(nodeView);
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
if (targetNode.type.name === 'table') {
|
|
572
|
-
if (expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && isExperimentEnabled('platform_editor_table_diff_rounded_corners')) {
|
|
573
|
-
applyTableCellEdgeAttrs({
|
|
574
|
-
element: nodeView,
|
|
575
|
-
tableNode: targetNode
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
applyCellOverlayStyles({
|
|
579
|
-
element: nodeView,
|
|
580
|
-
colorScheme: colorScheme,
|
|
581
|
-
isInserted: isInserted
|
|
582
|
-
});
|
|
583
|
-
dom.append(nodeView);
|
|
584
|
-
return;
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
wrapBlockNode({
|
|
588
|
-
dom: dom,
|
|
589
|
-
nodeView: nodeView,
|
|
590
|
-
targetNode: targetNode,
|
|
591
|
-
colorScheme: colorScheme,
|
|
592
|
-
intl: intl,
|
|
593
|
-
isActive: isActive,
|
|
594
|
-
isInserted: isInserted,
|
|
595
|
-
diffType: diffType,
|
|
596
|
-
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
597
|
-
});
|
|
598
|
-
return;
|
|
599
|
-
} else {
|
|
600
|
-
if (shouldApplyStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
|
|
601
|
-
// Apply deleted styles directly to preserve natural block-level margins
|
|
602
|
-
applyStylesToElement({
|
|
491
|
+
export var wrapBlockNodeView = function wrapBlockNodeView(_ref11) {
|
|
492
|
+
var dom = _ref11.dom,
|
|
493
|
+
nodeView = _ref11.nodeView,
|
|
494
|
+
targetNode = _ref11.targetNode,
|
|
495
|
+
colorScheme = _ref11.colorScheme,
|
|
496
|
+
intl = _ref11.intl,
|
|
497
|
+
_ref11$isActive = _ref11.isActive,
|
|
498
|
+
isActive = _ref11$isActive === void 0 ? false : _ref11$isActive,
|
|
499
|
+
_ref11$isInserted = _ref11.isInserted,
|
|
500
|
+
isInserted = _ref11$isInserted === void 0 ? false : _ref11$isInserted,
|
|
501
|
+
_ref11$hideAddedDiffs = _ref11.hideAddedDiffsUnderline,
|
|
502
|
+
hideAddedDiffsUnderline = _ref11$hideAddedDiffs === void 0 ? false : _ref11$hideAddedDiffs,
|
|
503
|
+
_ref11$highlightInlin = _ref11.highlightInlineLeafNodes,
|
|
504
|
+
highlightInlineLeafNodes = _ref11$highlightInlin === void 0 ? false : _ref11$highlightInlin;
|
|
505
|
+
if (nodeView instanceof HTMLElement) {
|
|
506
|
+
if (isInserted && isMultiContainerBlockNode(targetNode.type.name)) {
|
|
507
|
+
applyMultiContainerLikeStyles({
|
|
603
508
|
element: nodeView,
|
|
604
509
|
targetNode: targetNode,
|
|
605
510
|
colorScheme: colorScheme,
|
|
606
511
|
isActive: isActive,
|
|
607
512
|
isInserted: isInserted,
|
|
608
|
-
|
|
513
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
609
514
|
});
|
|
610
515
|
dom.append(nodeView);
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
if (isTextLikeBlockNode(targetNode.type.name)) {
|
|
519
|
+
applyTextLikeBlockNodeStyles({
|
|
520
|
+
element: nodeView,
|
|
615
521
|
targetNode: targetNode,
|
|
616
522
|
colorScheme: colorScheme,
|
|
617
|
-
intl: intl,
|
|
618
523
|
isActive: isActive,
|
|
619
524
|
isInserted: isInserted,
|
|
620
|
-
|
|
525
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
526
|
+
highlightInlineLeafNodes: highlightInlineLeafNodes
|
|
621
527
|
});
|
|
528
|
+
if (targetNode.type.name === 'blockquote' && fg('platform_editor_ai_show_diff_patch_1')) {
|
|
529
|
+
appendStyleToElement(nodeView, quoteBlockLevelStyle);
|
|
530
|
+
}
|
|
531
|
+
dom.append(nodeView);
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
if (targetNode.type.name === 'table') {
|
|
535
|
+
if (expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && isExperimentEnabled('platform_editor_table_diff_rounded_corners')) {
|
|
536
|
+
applyTableCellEdgeAttrs({
|
|
537
|
+
element: nodeView,
|
|
538
|
+
tableNode: targetNode
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
applyCellOverlayStyles({
|
|
542
|
+
element: nodeView,
|
|
543
|
+
colorScheme: colorScheme,
|
|
544
|
+
isInserted: isInserted
|
|
545
|
+
});
|
|
546
|
+
dom.append(nodeView);
|
|
547
|
+
return;
|
|
622
548
|
}
|
|
623
549
|
}
|
|
550
|
+
wrapBlockNode({
|
|
551
|
+
dom: dom,
|
|
552
|
+
nodeView: nodeView,
|
|
553
|
+
targetNode: targetNode,
|
|
554
|
+
colorScheme: colorScheme,
|
|
555
|
+
intl: intl,
|
|
556
|
+
isActive: isActive,
|
|
557
|
+
isInserted: isInserted,
|
|
558
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
559
|
+
});
|
|
624
560
|
};
|
|
625
561
|
|
|
626
562
|
/**
|
|
@@ -628,13 +564,12 @@ export var wrapBlockNodeView = function wrapBlockNodeView(_ref12) {
|
|
|
628
564
|
* CSS backgrounds don't work when applied to a wrapper around a paragraph, so
|
|
629
565
|
* the wrapper needs to be injected inside the node around the child content.
|
|
630
566
|
*/
|
|
631
|
-
export var injectInnerWrapper = function injectInnerWrapper(
|
|
632
|
-
var node =
|
|
633
|
-
colorScheme =
|
|
634
|
-
isActive =
|
|
635
|
-
isInserted =
|
|
636
|
-
|
|
637
|
-
reveal = _ref13.reveal;
|
|
567
|
+
export var injectInnerWrapper = function injectInnerWrapper(_ref12) {
|
|
568
|
+
var node = _ref12.node,
|
|
569
|
+
colorScheme = _ref12.colorScheme,
|
|
570
|
+
isActive = _ref12.isActive,
|
|
571
|
+
isInserted = _ref12.isInserted,
|
|
572
|
+
reveal = _ref12.reveal;
|
|
638
573
|
var wrapper = document.createElement('span');
|
|
639
574
|
var revealStyle = applyRevealToElement({
|
|
640
575
|
colorScheme: colorScheme,
|
|
@@ -643,7 +578,7 @@ export var injectInnerWrapper = function injectInnerWrapper(_ref13) {
|
|
|
643
578
|
isInserted: isInserted !== null && isInserted !== void 0 ? isInserted : false,
|
|
644
579
|
reveal: reveal
|
|
645
580
|
});
|
|
646
|
-
wrapper.setAttribute('style', (isInserted ? getInsertedContentStyle(colorScheme, isActive) : getDeletedContentStyle(colorScheme, isActive,
|
|
581
|
+
wrapper.setAttribute('style', (isInserted ? getInsertedContentStyle(colorScheme, isActive) : getDeletedContentStyle(colorScheme, isActive, Boolean(revealStyle))) + revealStyle);
|
|
647
582
|
_toConsumableArray(node.childNodes).forEach(function (child) {
|
|
648
583
|
var removedChild = node.removeChild(child);
|
|
649
584
|
wrapper.append(removedChild);
|
|
@@ -658,8 +593,7 @@ export var injectInnerWrapper = function injectInnerWrapper(_ref13) {
|
|
|
658
593
|
export var createContentWrapper = function createContentWrapper(colorScheme) {
|
|
659
594
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
660
595
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
661
|
-
var
|
|
662
|
-
var reveal = arguments.length > 4 ? arguments[4] : undefined;
|
|
596
|
+
var reveal = arguments.length > 3 ? arguments[3] : undefined;
|
|
663
597
|
var wrapper = document.createElement('span');
|
|
664
598
|
var baseStyle = convertToInlineCss({
|
|
665
599
|
position: 'relative',
|
|
@@ -674,21 +608,14 @@ export var createContentWrapper = function createContentWrapper(colorScheme) {
|
|
|
674
608
|
isInserted: isInserted,
|
|
675
609
|
reveal: reveal
|
|
676
610
|
});
|
|
677
|
-
var deletedStyle = getDeletedContentStyle(colorScheme, isActive,
|
|
678
|
-
if (
|
|
679
|
-
|
|
680
|
-
wrapper.setAttribute('style', "".concat(baseStyle).concat(getInsertedContentStyle(colorScheme, isActive)).concat(revealStyle));
|
|
681
|
-
} else {
|
|
682
|
-
wrapper.setAttribute('style', "".concat(baseStyle).concat(deletedStyle).concat(revealStyle));
|
|
683
|
-
var strikethrough = document.createElement('span');
|
|
684
|
-
strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colorScheme, isActive));
|
|
685
|
-
wrapper.append(strikethrough);
|
|
686
|
-
}
|
|
611
|
+
var deletedStyle = getDeletedContentStyle(colorScheme, isActive, Boolean(revealStyle));
|
|
612
|
+
if (isInserted) {
|
|
613
|
+
wrapper.setAttribute('style', "".concat(baseStyle).concat(getInsertedContentStyle(colorScheme, isActive)).concat(revealStyle));
|
|
687
614
|
} else {
|
|
688
615
|
wrapper.setAttribute('style', "".concat(baseStyle).concat(deletedStyle).concat(revealStyle));
|
|
689
|
-
var
|
|
690
|
-
|
|
691
|
-
wrapper.append(
|
|
616
|
+
var strikethrough = document.createElement('span');
|
|
617
|
+
strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colorScheme, isActive));
|
|
618
|
+
wrapper.append(strikethrough);
|
|
692
619
|
}
|
|
693
620
|
return wrapper;
|
|
694
621
|
};
|
|
@@ -15,7 +15,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
15
15
|
*/
|
|
16
16
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
17
17
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
18
|
-
import { isExtendedEnabled } from '../../isExtendedEnabled';
|
|
19
18
|
import { buildAddedCellOverlayRoundedStyle, buildAddedCellOverlayStyle, buildAddedCellOverlayStyleNew, buildDeletedCellOverlayRoundedStyle, buildDeletedCellOverlayStyle, buildDeletedInlineContentStyle, buildDeletedInlineContentStyleExtended, buildDeletedLozengeActiveStyle, buildDeletedLozengeStyle, buildDeletedNodeCSSVariables, buildDeletedQuoteNodeWithLozengeStyle, buildDeletedStrikethroughLine, buildDeletedWrappedBlockOutline, buildInsertedBlockNodeStyle, buildInsertedInlineStyle, buildInsertStyleInBlockExtended, buildInsertStyleInBlockExtendedNoUnderline, buildInsertStyleNode } from '../colorSchemes/factory';
|
|
20
19
|
import { colorSchemeRegistry, getLegacyColorScheme, standardScheme } from '../colorSchemes/schemes';
|
|
21
20
|
import { getChangedContentStyleLegacy, getChangedNodeStyleLegacy, getDeletedContentStyleLegacy, getDeletedContentStyleUnboundedLegacy, getInsertedContentStyleLegacy, hasRestingDeletedRingLegacy, resolveCellOverlayStyleLegacy, resolveNestedInsertedNodeStyleLegacy, resolveRemovedLozengeStyleLegacy } from './wrapBlockNodeViewStyles.legacy';
|
|
@@ -41,10 +40,9 @@ export var isTextLikeBlockNode = function isTextLikeBlockNode(nodeName) {
|
|
|
41
40
|
var getChangedContentStyleNext = function getChangedContentStyleNext(colorScheme) {
|
|
42
41
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
43
42
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
44
|
-
var
|
|
45
|
-
var hideAddedDiffsUnderline = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
43
|
+
var hideAddedDiffsUnderline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
46
44
|
var colors = getColorScheme(colorScheme);
|
|
47
|
-
if (
|
|
45
|
+
if (isInserted) {
|
|
48
46
|
return buildInsertedInlineStyle(colors, isActive, hideAddedDiffsUnderline);
|
|
49
47
|
}
|
|
50
48
|
var base = buildDeletedInlineContentStyle(colors, isActive ? 'active' : 'new');
|
|
@@ -52,7 +50,7 @@ var getChangedContentStyleNext = function getChangedContentStyleNext(colorScheme
|
|
|
52
50
|
// Text-like blocks (heading, lists, blockquote) render their deleted content through this
|
|
53
51
|
// getter rather than `getDeletedContentStyle`, so without this they never receive the
|
|
54
52
|
// glyphTint background + underline that plain deleted text already gets.
|
|
55
|
-
if (fg('confluence_ncs_step_diffing_version_history') && colors.deletedInlineTreatment === 'glyphTint'
|
|
53
|
+
if (fg('confluence_ncs_step_diffing_version_history') && colors.deletedInlineTreatment === 'glyphTint') {
|
|
56
54
|
return base + buildDeletedInlineContentStyleExtended(colors, isActive);
|
|
57
55
|
}
|
|
58
56
|
return base;
|
|
@@ -60,10 +58,9 @@ var getChangedContentStyleNext = function getChangedContentStyleNext(colorScheme
|
|
|
60
58
|
var getChangedNodeStyleNext = function getChangedNodeStyleNext(nodeName, colorScheme) {
|
|
61
59
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
62
60
|
var isActive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
63
|
-
var
|
|
64
|
-
var hideAddedDiffsUnderline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
61
|
+
var hideAddedDiffsUnderline = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
65
62
|
var colors = getColorScheme(colorScheme);
|
|
66
|
-
if (
|
|
63
|
+
if (isInserted) {
|
|
67
64
|
if (isMultiContainerBlockNode(nodeName)) {
|
|
68
65
|
return hideAddedDiffsUnderline || fg('platform_editor_ai_show_diff_patch_1') ? buildInsertStyleInBlockExtendedNoUnderline(nestedContentScheme) : buildInsertStyleInBlockExtended(nestedContentScheme);
|
|
69
66
|
}
|
|
@@ -102,13 +99,12 @@ var getInsertedContentStyleNext = function getInsertedContentStyleNext(colorSche
|
|
|
102
99
|
};
|
|
103
100
|
var getDeletedContentStyleNext = function getDeletedContentStyleNext(colorScheme) {
|
|
104
101
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
105
|
-
var
|
|
106
|
-
var omitHighlight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
102
|
+
var omitHighlight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
107
103
|
var colors = getColorScheme(colorScheme);
|
|
108
104
|
var base = buildDeletedInlineContentStyle(colors, isActive ? 'active' : 'new');
|
|
109
105
|
|
|
110
106
|
// glyphTint adds a background highlight and border-bottom over the tint; strikethrough does not.
|
|
111
|
-
var needsExtendedHighlight = colors.deletedInlineTreatment === 'glyphTint' &&
|
|
107
|
+
var needsExtendedHighlight = colors.deletedInlineTreatment === 'glyphTint' && !omitHighlight;
|
|
112
108
|
return needsExtendedHighlight ? base + buildDeletedInlineContentStyleExtended(colors, isActive) : base;
|
|
113
109
|
};
|
|
114
110
|
var resolveCellOverlayStyleNext = function resolveCellOverlayStyleNext(_ref) {
|
|
@@ -139,18 +135,16 @@ var hasRestingDeletedRingNext = function hasRestingDeletedRingNext(colorScheme)
|
|
|
139
135
|
export var getChangedContentStyle = function getChangedContentStyle(colorScheme) {
|
|
140
136
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
141
137
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
142
|
-
var
|
|
143
|
-
|
|
144
|
-
return isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getChangedContentStyleNext(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline) : getChangedContentStyleLegacy(getLegacyColorScheme(colorScheme), isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
138
|
+
var hideAddedDiffsUnderline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
139
|
+
return isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getChangedContentStyleNext(colorScheme, isActive, isInserted, hideAddedDiffsUnderline) : getChangedContentStyleLegacy(getLegacyColorScheme(colorScheme), isActive, isInserted, hideAddedDiffsUnderline);
|
|
145
140
|
};
|
|
146
141
|
|
|
147
142
|
/** Node-specific style for a changed block node, or `undefined` when the node type has none. */
|
|
148
143
|
export var getChangedNodeStyle = function getChangedNodeStyle(nodeName, colorScheme) {
|
|
149
144
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
150
145
|
var isActive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
151
|
-
var
|
|
152
|
-
|
|
153
|
-
return isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getChangedNodeStyleNext(nodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) : getChangedNodeStyleLegacy(nodeName, getLegacyColorScheme(colorScheme), isInserted, isActive, diffType, hideAddedDiffsUnderline);
|
|
146
|
+
var hideAddedDiffsUnderline = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
147
|
+
return isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getChangedNodeStyleNext(nodeName, colorScheme, isInserted, isActive, hideAddedDiffsUnderline) : getChangedNodeStyleLegacy(nodeName, getLegacyColorScheme(colorScheme), isInserted, isActive, hideAddedDiffsUnderline);
|
|
154
148
|
};
|
|
155
149
|
|
|
156
150
|
/** The positioned line drawn across deleted content spanning an unbounded range. */
|
|
@@ -169,9 +163,8 @@ export var getInsertedContentStyle = function getInsertedContentStyle(colorSchem
|
|
|
169
163
|
/** Inline style for deleted content. */
|
|
170
164
|
export var getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
|
|
171
165
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
172
|
-
var
|
|
173
|
-
|
|
174
|
-
return isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getDeletedContentStyleNext(colorScheme, isActive, diffType, omitHighlight) : getDeletedContentStyleLegacy(getLegacyColorScheme(colorScheme), isActive, diffType, omitHighlight);
|
|
166
|
+
var omitHighlight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
167
|
+
return isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? getDeletedContentStyleNext(colorScheme, isActive, omitHighlight) : getDeletedContentStyleLegacy(getLegacyColorScheme(colorScheme), isActive, omitHighlight);
|
|
175
168
|
};
|
|
176
169
|
|
|
177
170
|
/**
|