@atlaskit/editor-plugin-show-diff 10.3.0 → 10.4.0
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 +18 -0
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +14 -3
- package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +19 -1
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +4 -2
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +5 -2
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +40 -21
- package/dist/cjs/pm-plugins/main.js +11 -7
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +13 -3
- package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +18 -0
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +4 -3
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -2
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +35 -25
- package/dist/es2019/pm-plugins/main.js +11 -7
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +14 -3
- package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +18 -0
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +5 -3
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +5 -2
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +41 -22
- package/dist/esm/pm-plugins/main.js +11 -7
- package/dist/types/pm-plugins/calculateDiff/calculateDiffDecorations.d.ts +2 -1
- package/dist/types/pm-plugins/decorations/colorSchemes/standard.d.ts +9 -0
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.d.ts +2 -1
- package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +2 -1
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +2 -1
- package/dist/types/pm-plugins/main.d.ts +1 -0
- package/dist/types/showDiffPluginType.d.ts +12 -5
- package/package.json +5 -5
|
@@ -3,7 +3,7 @@ import { trackChangesMessages } from '@atlaskit/editor-common/messages';
|
|
|
3
3
|
import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-utils';
|
|
4
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
5
|
import { isExtendedEnabled } from '../../isExtendedEnabled';
|
|
6
|
-
import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleUnbounded, deletedInlineContentStyleExtended, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingContentStyleInBlockExtended, editingStyleExtended, editingStyleActiveExtended, editingStyleNode, addedCellOverlayStyle, deletedCellOverlayStyle } from '../colorSchemes/standard';
|
|
6
|
+
import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleUnbounded, deletedInlineContentStyleExtended, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingContentStyleInBlockExtended, editingContentStyleInBlockExtendedNoUnderline, editingStyleExtended, editingStyleExtendedNoUnderline, editingStyleActiveExtended, editingStyleActiveExtendedNoUnderline, editingStyleNode, addedCellOverlayStyle, deletedCellOverlayStyle } from '../colorSchemes/standard';
|
|
7
7
|
import { deletedTraditionalBlockOutlineActive, deletedTraditionalBlockOutlineNew, deletedTraditionalBlockOutlineRoundedActive, deletedTraditionalBlockOutlineRoundedNew, deletedTraditionalContentStyleUnbounded, deletedTraditionalContentStyleUnboundedActive, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, deletedTraditionalStyleQuoteNodeActive, traditionalInsertStyle, traditionalInsertStyleActive, traditionalStyleNodeActive, traditionalStyleNodeNew, traditionalAddedCellOverlayStyleNew, deletedTraditionalCellOverlayStyle } from '../colorSchemes/traditional';
|
|
8
8
|
const lozengeStyle = convertToInlineCss({
|
|
9
9
|
display: 'inline-flex',
|
|
@@ -53,12 +53,12 @@ const lozengeStyleActiveTraditional = convertToInlineCss({
|
|
|
53
53
|
whiteSpace: 'nowrap',
|
|
54
54
|
color: "var(--ds-text-warning-inverse, #292A2E)"
|
|
55
55
|
});
|
|
56
|
-
const getChangedContentStyle = (colorScheme, isActive = false, isInserted = false, diffType) => {
|
|
56
|
+
const getChangedContentStyle = (colorScheme, isActive = false, isInserted = false, diffType, hideAddedDiffsUnderline = false) => {
|
|
57
57
|
if (isExtendedEnabled(diffType) && isInserted) {
|
|
58
58
|
if (colorScheme === 'traditional') {
|
|
59
59
|
return isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
|
|
60
60
|
}
|
|
61
|
-
return isActive ? editingStyleActiveExtended : editingStyleExtended;
|
|
61
|
+
return isActive ? hideAddedDiffsUnderline ? editingStyleActiveExtendedNoUnderline : editingStyleActiveExtended : hideAddedDiffsUnderline ? editingStyleExtendedNoUnderline : editingStyleExtended;
|
|
62
62
|
}
|
|
63
63
|
if (colorScheme === 'traditional') {
|
|
64
64
|
return getDeletedTraditionalInlineStyle(isActive);
|
|
@@ -68,11 +68,11 @@ const getChangedContentStyle = (colorScheme, isActive = false, isInserted = fals
|
|
|
68
68
|
}
|
|
69
69
|
return expValEquals('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? deletedContentStyleNew : deletedContentStyle;
|
|
70
70
|
};
|
|
71
|
-
const getChangedNodeStyle = (nodeName, colorScheme, isInserted = false, isActive = false, diffType) => {
|
|
71
|
+
const getChangedNodeStyle = (nodeName, colorScheme, isInserted = false, isActive = false, diffType, hideAddedDiffsUnderline = false) => {
|
|
72
72
|
const isTraditional = colorScheme === 'traditional';
|
|
73
73
|
if (isExtendedEnabled(diffType) && isInserted) {
|
|
74
74
|
if (isMultiContainerBlockNode(nodeName)) {
|
|
75
|
-
return editingContentStyleInBlockExtended;
|
|
75
|
+
return hideAddedDiffsUnderline ? editingContentStyleInBlockExtendedNoUnderline : editingContentStyleInBlockExtended;
|
|
76
76
|
}
|
|
77
77
|
if (isTextLikeBlockNode(nodeName)) {
|
|
78
78
|
return undefined;
|
|
@@ -219,12 +219,13 @@ const applyStylesToElement = ({
|
|
|
219
219
|
colorScheme,
|
|
220
220
|
isActive,
|
|
221
221
|
isInserted,
|
|
222
|
-
diffType
|
|
222
|
+
diffType,
|
|
223
|
+
hideAddedDiffsUnderline = false
|
|
223
224
|
}) => {
|
|
224
225
|
const currentStyle = element.getAttribute('style') || '';
|
|
225
|
-
const contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType);
|
|
226
|
+
const contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
226
227
|
const targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
|
|
227
|
-
const nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType) || '';
|
|
228
|
+
const nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
228
229
|
element.setAttribute('style', `${currentStyle}${contentStyle}${nodeSpecificStyle}`);
|
|
229
230
|
};
|
|
230
231
|
const applyMultiContainerLikeStyles = ({
|
|
@@ -233,11 +234,12 @@ const applyMultiContainerLikeStyles = ({
|
|
|
233
234
|
colorScheme,
|
|
234
235
|
isActive,
|
|
235
236
|
isInserted,
|
|
236
|
-
diffType
|
|
237
|
+
diffType,
|
|
238
|
+
hideAddedDiffsUnderline = false
|
|
237
239
|
}) => {
|
|
238
240
|
const currentStyle = element.getAttribute('style') || '';
|
|
239
241
|
const targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
|
|
240
|
-
const nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType) || '';
|
|
242
|
+
const nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
241
243
|
if (targetNode.type.name === 'decisionList') {
|
|
242
244
|
element.querySelectorAll('li').forEach(listItem => {
|
|
243
245
|
const currentListItemStyle = listItem.getAttribute('style') || '';
|
|
@@ -262,14 +264,15 @@ const applyTextLikeBlockNodeStyles = ({
|
|
|
262
264
|
colorScheme,
|
|
263
265
|
isActive,
|
|
264
266
|
isInserted,
|
|
265
|
-
diffType
|
|
267
|
+
diffType,
|
|
268
|
+
hideAddedDiffsUnderline = false
|
|
266
269
|
}) => {
|
|
267
270
|
const currentStyle = element.getAttribute('style') || '';
|
|
268
|
-
const nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive, diffType) || '';
|
|
271
|
+
const nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
269
272
|
if (nodeSpecificStyle) {
|
|
270
273
|
element.setAttribute('style', `${currentStyle}${nodeSpecificStyle}`);
|
|
271
274
|
}
|
|
272
|
-
const contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType);
|
|
275
|
+
const contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
273
276
|
const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
|
|
274
277
|
const textNodesToWrap = [];
|
|
275
278
|
let currentNode = walker.nextNode();
|
|
@@ -296,17 +299,18 @@ const createBlockNodeContentWrapper = ({
|
|
|
296
299
|
colorScheme,
|
|
297
300
|
isActive,
|
|
298
301
|
isInserted,
|
|
299
|
-
diffType
|
|
302
|
+
diffType,
|
|
303
|
+
hideAddedDiffsUnderline = false
|
|
300
304
|
}) => {
|
|
301
305
|
const contentWrapper = document.createElement('div');
|
|
302
306
|
const targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
|
|
303
|
-
const nodeStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType);
|
|
307
|
+
const nodeStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline);
|
|
304
308
|
|
|
305
309
|
// When the extended experiment is enabled and the content is inserted,
|
|
306
310
|
// block widget nodes that already have dedicated node-level styling (e.g. boxShadow outline)
|
|
307
311
|
// should not also get the inline content style (borderBottom underline) on their container.
|
|
308
312
|
const shouldSkipContentStyle = isExtendedEnabled(diffType) && isInserted && nodeStyle !== undefined;
|
|
309
|
-
const contentStyle = shouldSkipContentStyle ? '' : getChangedContentStyle(colorScheme, isActive, isInserted, diffType);
|
|
313
|
+
const contentStyle = shouldSkipContentStyle ? '' : getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
310
314
|
contentWrapper.setAttribute('style', `${contentStyle}${nodeStyle || ''}`);
|
|
311
315
|
contentWrapper.append(nodeView);
|
|
312
316
|
return contentWrapper;
|
|
@@ -419,7 +423,8 @@ const wrapBlockNode = ({
|
|
|
419
423
|
intl,
|
|
420
424
|
isActive = false,
|
|
421
425
|
isInserted = false,
|
|
422
|
-
diffType
|
|
426
|
+
diffType,
|
|
427
|
+
hideAddedDiffsUnderline = false
|
|
423
428
|
}) => {
|
|
424
429
|
const blockWrapper = createBlockNodeWrapper();
|
|
425
430
|
const targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
|
|
@@ -453,7 +458,8 @@ const wrapBlockNode = ({
|
|
|
453
458
|
colorScheme,
|
|
454
459
|
isActive,
|
|
455
460
|
isInserted,
|
|
456
|
-
diffType
|
|
461
|
+
diffType,
|
|
462
|
+
hideAddedDiffsUnderline
|
|
457
463
|
});
|
|
458
464
|
blockWrapper.append(contentWrapper);
|
|
459
465
|
if (nodeView instanceof HTMLElement && shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
|
|
@@ -485,7 +491,8 @@ export const wrapBlockNodeView = ({
|
|
|
485
491
|
intl,
|
|
486
492
|
isActive = false,
|
|
487
493
|
isInserted = false,
|
|
488
|
-
diffType
|
|
494
|
+
diffType,
|
|
495
|
+
hideAddedDiffsUnderline = false
|
|
489
496
|
}) => {
|
|
490
497
|
if (isExtendedEnabled(diffType)) {
|
|
491
498
|
if (nodeView instanceof HTMLElement) {
|
|
@@ -496,7 +503,8 @@ export const wrapBlockNodeView = ({
|
|
|
496
503
|
colorScheme,
|
|
497
504
|
isActive,
|
|
498
505
|
isInserted,
|
|
499
|
-
diffType
|
|
506
|
+
diffType,
|
|
507
|
+
hideAddedDiffsUnderline
|
|
500
508
|
});
|
|
501
509
|
dom.append(nodeView);
|
|
502
510
|
return;
|
|
@@ -508,7 +516,8 @@ export const wrapBlockNodeView = ({
|
|
|
508
516
|
colorScheme,
|
|
509
517
|
isActive,
|
|
510
518
|
isInserted,
|
|
511
|
-
diffType
|
|
519
|
+
diffType,
|
|
520
|
+
hideAddedDiffsUnderline
|
|
512
521
|
});
|
|
513
522
|
dom.append(nodeView);
|
|
514
523
|
return;
|
|
@@ -531,7 +540,8 @@ export const wrapBlockNodeView = ({
|
|
|
531
540
|
intl,
|
|
532
541
|
isActive,
|
|
533
542
|
isInserted,
|
|
534
|
-
diffType
|
|
543
|
+
diffType,
|
|
544
|
+
hideAddedDiffsUnderline
|
|
535
545
|
});
|
|
536
546
|
return;
|
|
537
547
|
} else {
|
|
@@ -566,14 +576,14 @@ const getDeletedContentStyleUnbounded = (colorScheme, isActive = false) => {
|
|
|
566
576
|
}
|
|
567
577
|
return colorScheme === 'traditional' ? deletedTraditionalContentStyleUnbounded : deletedContentStyleUnbounded;
|
|
568
578
|
};
|
|
569
|
-
const getInsertedContentStyle = (colorScheme, isActive = false) => {
|
|
579
|
+
const getInsertedContentStyle = (colorScheme, isActive = false, hideAddedDiffsUnderline = false) => {
|
|
570
580
|
if (colorScheme === 'traditional') {
|
|
571
581
|
return isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
|
|
572
582
|
}
|
|
573
583
|
if (isActive) {
|
|
574
|
-
return editingStyleActiveExtended;
|
|
584
|
+
return hideAddedDiffsUnderline ? editingStyleActiveExtendedNoUnderline : editingStyleActiveExtended;
|
|
575
585
|
}
|
|
576
|
-
return editingStyleExtended;
|
|
586
|
+
return hideAddedDiffsUnderline ? editingStyleExtendedNoUnderline : editingStyleExtended;
|
|
577
587
|
};
|
|
578
588
|
const getDeletedContentStyle = (colorScheme, isActive = false, diffType) => {
|
|
579
589
|
if (colorScheme === 'traditional') {
|
|
@@ -32,6 +32,7 @@ export const createPlugin = (config, getIntl, api) => {
|
|
|
32
32
|
isInverted: false,
|
|
33
33
|
diffType: 'inline',
|
|
34
34
|
hideDeletedDiffs: false,
|
|
35
|
+
hideAddedDiffsUnderline: false,
|
|
35
36
|
showIndicators: false,
|
|
36
37
|
diffDescriptors: []
|
|
37
38
|
} : {})
|
|
@@ -42,7 +43,7 @@ export const createPlugin = (config, getIntl, api) => {
|
|
|
42
43
|
let newPluginState = currentPluginState;
|
|
43
44
|
if (meta) {
|
|
44
45
|
if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF') {
|
|
45
|
-
var _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8;
|
|
46
|
+
var _newPluginState, _newPluginState2, _newPluginState3, _newPluginState4, _newPluginState5, _newPluginState6, _newPluginState7, _newPluginState8, _newPluginState9;
|
|
46
47
|
// Update the plugin state with the new metadata
|
|
47
48
|
newPluginState = {
|
|
48
49
|
...currentPluginState,
|
|
@@ -66,14 +67,15 @@ export const createPlugin = (config, getIntl, api) => {
|
|
|
66
67
|
isInverted: (_newPluginState2 = newPluginState) === null || _newPluginState2 === void 0 ? void 0 : _newPluginState2.isInverted,
|
|
67
68
|
diffType: (_newPluginState3 = newPluginState) === null || _newPluginState3 === void 0 ? void 0 : _newPluginState3.diffType,
|
|
68
69
|
hideDeletedDiffs: (_newPluginState4 = newPluginState) === null || _newPluginState4 === void 0 ? void 0 : _newPluginState4.hideDeletedDiffs,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
hideAddedDiffsUnderline: (_newPluginState5 = newPluginState) === null || _newPluginState5 === void 0 ? void 0 : _newPluginState5.hideAddedDiffsUnderline,
|
|
71
|
+
showIndicators: (_newPluginState6 = newPluginState) === null || _newPluginState6 === void 0 ? void 0 : _newPluginState6.showIndicators,
|
|
72
|
+
smartThresholds: (_newPluginState7 = newPluginState) === null || _newPluginState7 === void 0 ? void 0 : _newPluginState7.smartThresholds,
|
|
73
|
+
deletedDiffPlacement: (_newPluginState8 = newPluginState) === null || _newPluginState8 === void 0 ? void 0 : _newPluginState8.deletedDiffPlacement
|
|
72
74
|
} : {})
|
|
73
75
|
});
|
|
74
76
|
// Update the decorations and their ids
|
|
75
77
|
newPluginState.decorations = decorations;
|
|
76
|
-
if (isExtendedEnabled((
|
|
78
|
+
if (isExtendedEnabled((_newPluginState9 = newPluginState) === null || _newPluginState9 === void 0 ? void 0 : _newPluginState9.diffType)) {
|
|
77
79
|
newPluginState.diffDescriptors = diffDescriptors;
|
|
78
80
|
}
|
|
79
81
|
} else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'HIDE_DIFF') {
|
|
@@ -91,13 +93,14 @@ export const createPlugin = (config, getIntl, api) => {
|
|
|
91
93
|
isInverted: false,
|
|
92
94
|
diffType: 'inline',
|
|
93
95
|
hideDeletedDiffs: false,
|
|
96
|
+
hideAddedDiffsUnderline: false,
|
|
94
97
|
diffDescriptors: []
|
|
95
98
|
} : {})
|
|
96
99
|
};
|
|
97
100
|
} else if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_NEXT' || (meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_PREVIOUS') {
|
|
98
|
-
var
|
|
101
|
+
var _newPluginState0;
|
|
99
102
|
// Update the active index in plugin state and recalculate decorations
|
|
100
|
-
const decorations = getScrollableDecorations(currentPluginState.decorations, newState.doc, (
|
|
103
|
+
const decorations = getScrollableDecorations(currentPluginState.decorations, newState.doc, (_newPluginState0 = newPluginState) === null || _newPluginState0 === void 0 ? void 0 : _newPluginState0.diffType);
|
|
101
104
|
if (decorations.length > 0) {
|
|
102
105
|
var _currentPluginState$a;
|
|
103
106
|
// Initialize to -1 if undefined so that the first "next" scroll takes us to index 0 (first change).
|
|
@@ -139,6 +142,7 @@ export const createPlugin = (config, getIntl, api) => {
|
|
|
139
142
|
isInverted: newPluginState.isInverted,
|
|
140
143
|
diffType: newPluginState.diffType,
|
|
141
144
|
hideDeletedDiffs: newPluginState.hideDeletedDiffs,
|
|
145
|
+
hideAddedDiffsUnderline: newPluginState.hideAddedDiffsUnderline,
|
|
142
146
|
showIndicators: newPluginState.showIndicators,
|
|
143
147
|
smartThresholds: newPluginState.smartThresholds,
|
|
144
148
|
deletedDiffPlacement: newPluginState.deletedDiffPlacement
|
|
@@ -139,6 +139,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref3
|
|
|
139
139
|
diffType = _ref3$diffType === void 0 ? 'inline' : _ref3$diffType,
|
|
140
140
|
_ref3$hideDeletedDiff = _ref3.hideDeletedDiffs,
|
|
141
141
|
hideDeletedDiffs = _ref3$hideDeletedDiff === void 0 ? false : _ref3$hideDeletedDiff,
|
|
142
|
+
_ref3$hideAddedDiffsU = _ref3.hideAddedDiffsUnderline,
|
|
143
|
+
hideAddedDiffsUnderlineParam = _ref3$hideAddedDiffsU === void 0 ? false : _ref3$hideAddedDiffsU,
|
|
142
144
|
_ref3$showIndicators = _ref3.showIndicators,
|
|
143
145
|
showIndicators = _ref3$showIndicators === void 0 ? false : _ref3$showIndicators,
|
|
144
146
|
smartThresholds = _ref3.smartThresholds,
|
|
@@ -153,6 +155,10 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref3
|
|
|
153
155
|
diffDescriptors: []
|
|
154
156
|
};
|
|
155
157
|
}
|
|
158
|
+
|
|
159
|
+
// Resolve the option against its gate once here, so every downstream inline/block builder
|
|
160
|
+
// receives the same value. When the gate is off the option is a no-op.
|
|
161
|
+
var hideAddedDiffsUnderline = hideAddedDiffsUnderlineParam && fg('platform_editor_ai_smart_diff');
|
|
156
162
|
var tr = state.tr;
|
|
157
163
|
var steppedDoc = originalDoc;
|
|
158
164
|
var attrSteps = [];
|
|
@@ -261,7 +267,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref3
|
|
|
261
267
|
}, isExtendedEnabled(diffType) && {
|
|
262
268
|
isInserted: isInserted,
|
|
263
269
|
shouldHideDeleted: shouldHideDeleted,
|
|
264
|
-
showIndicators: showIndicators
|
|
270
|
+
showIndicators: showIndicators,
|
|
271
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
265
272
|
}))));
|
|
266
273
|
}
|
|
267
274
|
} catch (err) {
|
|
@@ -279,7 +286,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref3
|
|
|
279
286
|
}, isExtendedEnabled(diffType) && {
|
|
280
287
|
isInserted: isInserted,
|
|
281
288
|
shouldHideDeleted: shouldHideDeleted,
|
|
282
|
-
showIndicators: showIndicators
|
|
289
|
+
showIndicators: showIndicators,
|
|
290
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
283
291
|
}))));
|
|
284
292
|
}
|
|
285
293
|
decorations.push.apply(decorations, _toConsumableArray(calculateNodesForBlockDecoration(_objectSpread(_objectSpread({
|
|
@@ -311,6 +319,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref3
|
|
|
311
319
|
}, isExtendedEnabled(diffType) && {
|
|
312
320
|
isInserted: !isInserted,
|
|
313
321
|
diffType: diffType,
|
|
322
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
314
323
|
// For `smart` node- and paragraph-level changes, optionally render the
|
|
315
324
|
// deleted content below the new content (gray + strikethrough) instead
|
|
316
325
|
// of above it. Controlled by `deletedDiffPlacement` (default `'top'`).
|
|
@@ -455,6 +464,7 @@ function (_ref5, _ref6) {
|
|
|
455
464
|
isInverted = _ref7$.isInverted,
|
|
456
465
|
diffType = _ref7$.diffType,
|
|
457
466
|
hideDeletedDiffs = _ref7$.hideDeletedDiffs,
|
|
467
|
+
hideAddedDiffsUnderline = _ref7$.hideAddedDiffsUnderline,
|
|
458
468
|
showIndicators = _ref7$.showIndicators,
|
|
459
469
|
smartThresholds = _ref7$.smartThresholds,
|
|
460
470
|
deletedDiffPlacement = _ref7$.deletedDiffPlacement;
|
|
@@ -468,13 +478,14 @@ function (_ref5, _ref6) {
|
|
|
468
478
|
lastIsInverted = _ref8$.isInverted,
|
|
469
479
|
lastDiffType = _ref8$.diffType,
|
|
470
480
|
lastHideDeletedDiffs = _ref8$.hideDeletedDiffs,
|
|
481
|
+
lastHideAddedDiffsUnderline = _ref8$.hideAddedDiffsUnderline,
|
|
471
482
|
lastShowIndicators = _ref8$.showIndicators,
|
|
472
483
|
lastSmartThresholds = _ref8$.smartThresholds,
|
|
473
484
|
lastDeletedDiffPlacement = _ref8$.deletedDiffPlacement;
|
|
474
485
|
var originalDocIsSame = lastPluginState.originalDoc && pluginState.originalDoc && pluginState.originalDoc.eq(lastPluginState.originalDoc);
|
|
475
486
|
if (isExtendedEnabled(diffType)) {
|
|
476
487
|
var _ref9;
|
|
477
|
-
return (_ref9 = colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isInverted === lastIsInverted && diffType === lastDiffType && isEqual(activeIndexPos, lastActiveIndexPos) && originalDocIsSame && isEqual(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && showIndicators === lastShowIndicators && isEqual(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement) !== null && _ref9 !== void 0 ? _ref9 : false;
|
|
488
|
+
return (_ref9 = colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isInverted === lastIsInverted && diffType === lastDiffType && isEqual(activeIndexPos, lastActiveIndexPos) && originalDocIsSame && isEqual(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs && hideAddedDiffsUnderline === lastHideAddedDiffsUnderline && showIndicators === lastShowIndicators && isEqual(smartThresholds, lastSmartThresholds) && deletedDiffPlacement === lastDeletedDiffPlacement) !== null && _ref9 !== void 0 ? _ref9 : false;
|
|
478
489
|
}
|
|
479
490
|
return (_ref0 = originalDocIsSame && isEqual(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isEqual(activeIndexPos, lastActiveIndexPos) && hideDeletedDiffs === lastHideDeletedDiffs) !== null && _ref0 !== void 0 ? _ref0 : false;
|
|
480
491
|
});
|
|
@@ -38,6 +38,24 @@ export var editingStyleActiveExtended = convertToInlineCss({
|
|
|
38
38
|
borderBottom: "2px solid ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
39
39
|
padding: "1px 0 2px"
|
|
40
40
|
});
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Underline-free variants of the extended inserted-content styles. Used when the `showDiff`
|
|
44
|
+
* command is called with `hideAddedDiffsUnderline: true` to remove ONLY the dark-purple
|
|
45
|
+
* `borderBottom` underline from added/updated content while keeping the purple background
|
|
46
|
+
* highlight and padding. See the `editing*Extended` constants above for the full versions.
|
|
47
|
+
*/
|
|
48
|
+
export var editingStyleExtendedNoUnderline = convertToInlineCss({
|
|
49
|
+
background: "var(--ds-background-accent-purple-subtlest, #F8EEFE)",
|
|
50
|
+
padding: "1px 0 2px"
|
|
51
|
+
});
|
|
52
|
+
export var editingStyleActiveExtendedNoUnderline = convertToInlineCss({
|
|
53
|
+
background: "var(--ds-background-accent-purple-subtler-pressed, #D8A0F7)",
|
|
54
|
+
padding: "1px 0 2px"
|
|
55
|
+
});
|
|
56
|
+
export var editingContentStyleInBlockExtendedNoUnderline = convertToInlineCss({
|
|
57
|
+
padding: "1px 0 2px"
|
|
58
|
+
});
|
|
41
59
|
export var deletedContentStyle = convertToInlineCss({
|
|
42
60
|
color: "var(--ds-text-accent-gray, #505258)",
|
|
43
61
|
textDecoration: 'line-through',
|
|
@@ -2,7 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
3
3
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import { isExtendedEnabled } from '../isExtendedEnabled';
|
|
5
|
-
import { editingStyle, editingStyleExtended, editingStyleActive, editingStyleActiveExtended, deletedContentStyle, deletedContentStyleActive, deletedInlineContentStyleExtended } from './colorSchemes/standard';
|
|
5
|
+
import { editingStyle, editingStyleExtended, editingStyleExtendedNoUnderline, editingStyleActive, editingStyleActiveExtended, editingStyleActiveExtendedNoUnderline, deletedContentStyle, deletedContentStyleActive, deletedInlineContentStyleExtended } from './colorSchemes/standard';
|
|
6
6
|
import { traditionalInsertStyle, traditionalInsertStyleActive, getDeletedTraditionalInlineStyle } from './colorSchemes/traditional';
|
|
7
7
|
import { createInlineIndicatorAnchorWidgets } from './createAnchorDecorationWidgets';
|
|
8
8
|
import { buildDiffDecorationSpec } from './decorationKeys';
|
|
@@ -28,7 +28,9 @@ export var createInlineChangedDecoration = function createInlineChangedDecoratio
|
|
|
28
28
|
_ref$showIndicators = _ref.showIndicators,
|
|
29
29
|
showIndicators = _ref$showIndicators === void 0 ? false : _ref$showIndicators,
|
|
30
30
|
doc = _ref.doc,
|
|
31
|
-
diffType = _ref.diffType
|
|
31
|
+
diffType = _ref.diffType,
|
|
32
|
+
_ref$hideAddedDiffsUn = _ref.hideAddedDiffsUnderline,
|
|
33
|
+
hideAddedDiffsUnderline = _ref$hideAddedDiffsUn === void 0 ? false : _ref$hideAddedDiffsUn;
|
|
32
34
|
var diffId = crypto.randomUUID();
|
|
33
35
|
if (shouldHideDeleted) {
|
|
34
36
|
return [Decoration.inline(change.fromB, change.toB, {
|
|
@@ -45,7 +47,7 @@ export var createInlineChangedDecoration = function createInlineChangedDecoratio
|
|
|
45
47
|
if (colorScheme === 'traditional') {
|
|
46
48
|
style = isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
|
|
47
49
|
} else {
|
|
48
|
-
style = isActive ? editingStyleActiveExtended : editingStyleExtended;
|
|
50
|
+
style = isActive ? hideAddedDiffsUnderline ? editingStyleActiveExtendedNoUnderline : editingStyleActiveExtended : hideAddedDiffsUnderline ? editingStyleExtendedNoUnderline : editingStyleExtended;
|
|
49
51
|
}
|
|
50
52
|
} else {
|
|
51
53
|
if (colorScheme === 'traditional') {
|
|
@@ -28,7 +28,9 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
28
28
|
showIndicators = _ref$showIndicators === void 0 ? false : _ref$showIndicators,
|
|
29
29
|
_ref$placeBelow = _ref.placeBelow,
|
|
30
30
|
placeBelow = _ref$placeBelow === void 0 ? false : _ref$placeBelow,
|
|
31
|
-
diffType = _ref.diffType
|
|
31
|
+
diffType = _ref.diffType,
|
|
32
|
+
_ref$hideAddedDiffsUn = _ref.hideAddedDiffsUnderline,
|
|
33
|
+
hideAddedDiffsUnderline = _ref$hideAddedDiffsUn === void 0 ? false : _ref$hideAddedDiffsUn;
|
|
32
34
|
var slice = doc.slice(change.fromA, change.toA);
|
|
33
35
|
var shouldSkipDeletedEmptyParagraphDecoration = !isInserted && (slice === null || slice === void 0 || (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.childCount) === 1 && (slice === null || slice === void 0 || (_slice$content2 = slice.content) === null || _slice$content2 === void 0 || (_slice$content2 = _slice$content2.firstChild) === null || _slice$content2 === void 0 ? void 0 : _slice$content2.type.name) === 'paragraph' && (slice === null || slice === void 0 || (_slice$content3 = slice.content) === null || _slice$content3 === void 0 || (_slice$content3 = _slice$content3.firstChild) === null || _slice$content3 === void 0 ? void 0 : _slice$content3.content.size) === 0;
|
|
34
36
|
// Widget decoration used for deletions as the content is not in the document
|
|
@@ -177,7 +179,8 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
177
179
|
intl: intl,
|
|
178
180
|
isActive: isActive,
|
|
179
181
|
isInserted: isInserted,
|
|
180
|
-
diffType: diffType
|
|
182
|
+
diffType: diffType,
|
|
183
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
181
184
|
});
|
|
182
185
|
}
|
|
183
186
|
} else if (nodeViewSerializer.getFilteredNodeViewBlocklist(['paragraph', 'tableRow']).has(node.type.name)) {
|
|
@@ -4,7 +4,7 @@ import { trackChangesMessages } from '@atlaskit/editor-common/messages';
|
|
|
4
4
|
import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-utils';
|
|
5
5
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
6
|
import { isExtendedEnabled } from '../../isExtendedEnabled';
|
|
7
|
-
import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleUnbounded, deletedInlineContentStyleExtended, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingContentStyleInBlockExtended, editingStyleExtended, editingStyleActiveExtended, editingStyleNode, addedCellOverlayStyle, deletedCellOverlayStyle } from '../colorSchemes/standard';
|
|
7
|
+
import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleUnbounded, deletedInlineContentStyleExtended, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingContentStyleInBlockExtended, editingContentStyleInBlockExtendedNoUnderline, editingStyleExtended, editingStyleExtendedNoUnderline, editingStyleActiveExtended, editingStyleActiveExtendedNoUnderline, editingStyleNode, addedCellOverlayStyle, deletedCellOverlayStyle } from '../colorSchemes/standard';
|
|
8
8
|
import { deletedTraditionalBlockOutlineActive, deletedTraditionalBlockOutlineNew, deletedTraditionalBlockOutlineRoundedActive, deletedTraditionalBlockOutlineRoundedNew, deletedTraditionalContentStyleUnbounded, deletedTraditionalContentStyleUnboundedActive, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, deletedTraditionalStyleQuoteNodeActive, traditionalInsertStyle, traditionalInsertStyleActive, traditionalStyleNodeActive, traditionalStyleNodeNew, traditionalAddedCellOverlayStyleNew, deletedTraditionalCellOverlayStyle } from '../colorSchemes/traditional';
|
|
9
9
|
var lozengeStyle = convertToInlineCss({
|
|
10
10
|
display: 'inline-flex',
|
|
@@ -58,11 +58,12 @@ var getChangedContentStyle = function getChangedContentStyle(colorScheme) {
|
|
|
58
58
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
59
59
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
60
60
|
var diffType = arguments.length > 3 ? arguments[3] : undefined;
|
|
61
|
+
var hideAddedDiffsUnderline = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
61
62
|
if (isExtendedEnabled(diffType) && isInserted) {
|
|
62
63
|
if (colorScheme === 'traditional') {
|
|
63
64
|
return isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
|
|
64
65
|
}
|
|
65
|
-
return isActive ? editingStyleActiveExtended : editingStyleExtended;
|
|
66
|
+
return isActive ? hideAddedDiffsUnderline ? editingStyleActiveExtendedNoUnderline : editingStyleActiveExtended : hideAddedDiffsUnderline ? editingStyleExtendedNoUnderline : editingStyleExtended;
|
|
66
67
|
}
|
|
67
68
|
if (colorScheme === 'traditional') {
|
|
68
69
|
return getDeletedTraditionalInlineStyle(isActive);
|
|
@@ -76,10 +77,11 @@ var getChangedNodeStyle = function getChangedNodeStyle(nodeName, colorScheme) {
|
|
|
76
77
|
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
77
78
|
var isActive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
78
79
|
var diffType = arguments.length > 4 ? arguments[4] : undefined;
|
|
80
|
+
var hideAddedDiffsUnderline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
79
81
|
var isTraditional = colorScheme === 'traditional';
|
|
80
82
|
if (isExtendedEnabled(diffType) && isInserted) {
|
|
81
83
|
if (isMultiContainerBlockNode(nodeName)) {
|
|
82
|
-
return editingContentStyleInBlockExtended;
|
|
84
|
+
return hideAddedDiffsUnderline ? editingContentStyleInBlockExtendedNoUnderline : editingContentStyleInBlockExtended;
|
|
83
85
|
}
|
|
84
86
|
if (isTextLikeBlockNode(nodeName)) {
|
|
85
87
|
return undefined;
|
|
@@ -227,11 +229,13 @@ var applyStylesToElement = function applyStylesToElement(_ref3) {
|
|
|
227
229
|
colorScheme = _ref3.colorScheme,
|
|
228
230
|
isActive = _ref3.isActive,
|
|
229
231
|
isInserted = _ref3.isInserted,
|
|
230
|
-
diffType = _ref3.diffType
|
|
232
|
+
diffType = _ref3.diffType,
|
|
233
|
+
_ref3$hideAddedDiffsU = _ref3.hideAddedDiffsUnderline,
|
|
234
|
+
hideAddedDiffsUnderline = _ref3$hideAddedDiffsU === void 0 ? false : _ref3$hideAddedDiffsU;
|
|
231
235
|
var currentStyle = element.getAttribute('style') || '';
|
|
232
|
-
var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType);
|
|
236
|
+
var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
233
237
|
var targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
|
|
234
|
-
var nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType) || '';
|
|
238
|
+
var nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
235
239
|
element.setAttribute('style', "".concat(currentStyle).concat(contentStyle).concat(nodeSpecificStyle));
|
|
236
240
|
};
|
|
237
241
|
var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref4) {
|
|
@@ -240,10 +244,12 @@ var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref4
|
|
|
240
244
|
colorScheme = _ref4.colorScheme,
|
|
241
245
|
isActive = _ref4.isActive,
|
|
242
246
|
isInserted = _ref4.isInserted,
|
|
243
|
-
diffType = _ref4.diffType
|
|
247
|
+
diffType = _ref4.diffType,
|
|
248
|
+
_ref4$hideAddedDiffsU = _ref4.hideAddedDiffsUnderline,
|
|
249
|
+
hideAddedDiffsUnderline = _ref4$hideAddedDiffsU === void 0 ? false : _ref4$hideAddedDiffsU;
|
|
244
250
|
var currentStyle = element.getAttribute('style') || '';
|
|
245
251
|
var targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
|
|
246
|
-
var nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType) || '';
|
|
252
|
+
var nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
247
253
|
if (targetNode.type.name === 'decisionList') {
|
|
248
254
|
element.querySelectorAll('li').forEach(function (listItem) {
|
|
249
255
|
var currentListItemStyle = listItem.getAttribute('style') || '';
|
|
@@ -268,13 +274,15 @@ var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref5)
|
|
|
268
274
|
colorScheme = _ref5.colorScheme,
|
|
269
275
|
isActive = _ref5.isActive,
|
|
270
276
|
isInserted = _ref5.isInserted,
|
|
271
|
-
diffType = _ref5.diffType
|
|
277
|
+
diffType = _ref5.diffType,
|
|
278
|
+
_ref5$hideAddedDiffsU = _ref5.hideAddedDiffsUnderline,
|
|
279
|
+
hideAddedDiffsUnderline = _ref5$hideAddedDiffsU === void 0 ? false : _ref5$hideAddedDiffsU;
|
|
272
280
|
var currentStyle = element.getAttribute('style') || '';
|
|
273
|
-
var nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive, diffType) || '';
|
|
281
|
+
var nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
274
282
|
if (nodeSpecificStyle) {
|
|
275
283
|
element.setAttribute('style', "".concat(currentStyle).concat(nodeSpecificStyle));
|
|
276
284
|
}
|
|
277
|
-
var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType);
|
|
285
|
+
var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
278
286
|
var walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
|
|
279
287
|
var textNodesToWrap = [];
|
|
280
288
|
var currentNode = walker.nextNode();
|
|
@@ -301,16 +309,18 @@ var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref6
|
|
|
301
309
|
colorScheme = _ref6.colorScheme,
|
|
302
310
|
isActive = _ref6.isActive,
|
|
303
311
|
isInserted = _ref6.isInserted,
|
|
304
|
-
diffType = _ref6.diffType
|
|
312
|
+
diffType = _ref6.diffType,
|
|
313
|
+
_ref6$hideAddedDiffsU = _ref6.hideAddedDiffsUnderline,
|
|
314
|
+
hideAddedDiffsUnderline = _ref6$hideAddedDiffsU === void 0 ? false : _ref6$hideAddedDiffsU;
|
|
305
315
|
var contentWrapper = document.createElement('div');
|
|
306
316
|
var targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
|
|
307
|
-
var nodeStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType);
|
|
317
|
+
var nodeStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline);
|
|
308
318
|
|
|
309
319
|
// When the extended experiment is enabled and the content is inserted,
|
|
310
320
|
// block widget nodes that already have dedicated node-level styling (e.g. boxShadow outline)
|
|
311
321
|
// should not also get the inline content style (borderBottom underline) on their container.
|
|
312
322
|
var shouldSkipContentStyle = isExtendedEnabled(diffType) && isInserted && nodeStyle !== undefined;
|
|
313
|
-
var contentStyle = shouldSkipContentStyle ? '' : getChangedContentStyle(colorScheme, isActive, isInserted, diffType);
|
|
323
|
+
var contentStyle = shouldSkipContentStyle ? '' : getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
314
324
|
contentWrapper.setAttribute('style', "".concat(contentStyle).concat(nodeStyle || ''));
|
|
315
325
|
contentWrapper.append(nodeView);
|
|
316
326
|
return contentWrapper;
|
|
@@ -425,7 +435,9 @@ var wrapBlockNode = function wrapBlockNode(_ref9) {
|
|
|
425
435
|
isActive = _ref9$isActive === void 0 ? false : _ref9$isActive,
|
|
426
436
|
_ref9$isInserted = _ref9.isInserted,
|
|
427
437
|
isInserted = _ref9$isInserted === void 0 ? false : _ref9$isInserted,
|
|
428
|
-
diffType = _ref9.diffType
|
|
438
|
+
diffType = _ref9.diffType,
|
|
439
|
+
_ref9$hideAddedDiffsU = _ref9.hideAddedDiffsUnderline,
|
|
440
|
+
hideAddedDiffsUnderline = _ref9$hideAddedDiffsU === void 0 ? false : _ref9$hideAddedDiffsU;
|
|
429
441
|
var blockWrapper = createBlockNodeWrapper();
|
|
430
442
|
var targetNodeName = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? getBaseNodeTypeName(targetNode.type) : targetNode.type.name;
|
|
431
443
|
if (shouldShowRemovedLozenge(targetNodeName) && (!isExtendedEnabled(diffType) || !isInserted)) {
|
|
@@ -458,7 +470,8 @@ var wrapBlockNode = function wrapBlockNode(_ref9) {
|
|
|
458
470
|
colorScheme: colorScheme,
|
|
459
471
|
isActive: isActive,
|
|
460
472
|
isInserted: isInserted,
|
|
461
|
-
diffType: diffType
|
|
473
|
+
diffType: diffType,
|
|
474
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
462
475
|
});
|
|
463
476
|
blockWrapper.append(contentWrapper);
|
|
464
477
|
if (nodeView instanceof HTMLElement && shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
|
|
@@ -492,7 +505,9 @@ export var wrapBlockNodeView = function wrapBlockNodeView(_ref0) {
|
|
|
492
505
|
isActive = _ref0$isActive === void 0 ? false : _ref0$isActive,
|
|
493
506
|
_ref0$isInserted = _ref0.isInserted,
|
|
494
507
|
isInserted = _ref0$isInserted === void 0 ? false : _ref0$isInserted,
|
|
495
|
-
diffType = _ref0.diffType
|
|
508
|
+
diffType = _ref0.diffType,
|
|
509
|
+
_ref0$hideAddedDiffsU = _ref0.hideAddedDiffsUnderline,
|
|
510
|
+
hideAddedDiffsUnderline = _ref0$hideAddedDiffsU === void 0 ? false : _ref0$hideAddedDiffsU;
|
|
496
511
|
if (isExtendedEnabled(diffType)) {
|
|
497
512
|
if (nodeView instanceof HTMLElement) {
|
|
498
513
|
if (isInserted && isMultiContainerBlockNode(targetNode.type.name)) {
|
|
@@ -502,7 +517,8 @@ export var wrapBlockNodeView = function wrapBlockNodeView(_ref0) {
|
|
|
502
517
|
colorScheme: colorScheme,
|
|
503
518
|
isActive: isActive,
|
|
504
519
|
isInserted: isInserted,
|
|
505
|
-
diffType: diffType
|
|
520
|
+
diffType: diffType,
|
|
521
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
506
522
|
});
|
|
507
523
|
dom.append(nodeView);
|
|
508
524
|
return;
|
|
@@ -514,7 +530,8 @@ export var wrapBlockNodeView = function wrapBlockNodeView(_ref0) {
|
|
|
514
530
|
colorScheme: colorScheme,
|
|
515
531
|
isActive: isActive,
|
|
516
532
|
isInserted: isInserted,
|
|
517
|
-
diffType: diffType
|
|
533
|
+
diffType: diffType,
|
|
534
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
518
535
|
});
|
|
519
536
|
dom.append(nodeView);
|
|
520
537
|
return;
|
|
@@ -537,7 +554,8 @@ export var wrapBlockNodeView = function wrapBlockNodeView(_ref0) {
|
|
|
537
554
|
intl: intl,
|
|
538
555
|
isActive: isActive,
|
|
539
556
|
isInserted: isInserted,
|
|
540
|
-
diffType: diffType
|
|
557
|
+
diffType: diffType,
|
|
558
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline
|
|
541
559
|
});
|
|
542
560
|
return;
|
|
543
561
|
} else {
|
|
@@ -575,13 +593,14 @@ var getDeletedContentStyleUnbounded = function getDeletedContentStyleUnbounded(c
|
|
|
575
593
|
};
|
|
576
594
|
var getInsertedContentStyle = function getInsertedContentStyle(colorScheme) {
|
|
577
595
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
596
|
+
var hideAddedDiffsUnderline = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
578
597
|
if (colorScheme === 'traditional') {
|
|
579
598
|
return isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
|
|
580
599
|
}
|
|
581
600
|
if (isActive) {
|
|
582
|
-
return editingStyleActiveExtended;
|
|
601
|
+
return hideAddedDiffsUnderline ? editingStyleActiveExtendedNoUnderline : editingStyleActiveExtended;
|
|
583
602
|
}
|
|
584
|
-
return editingStyleExtended;
|
|
603
|
+
return hideAddedDiffsUnderline ? editingStyleExtendedNoUnderline : editingStyleExtended;
|
|
585
604
|
};
|
|
586
605
|
var getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
|
|
587
606
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|