@atlaskit/editor-plugin-show-diff 13.0.11 → 13.1.1
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 +32 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-products/tsconfig.json +3 -0
- package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +259 -23
- package/dist/cjs/pm-plugins/decorations/colorSchemes/schemes.js +21 -5
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +87 -105
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +124 -0
- package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.js +15 -12
- package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.styles.legacy.js +37 -0
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +109 -59
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +67 -0
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +30 -168
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +205 -0
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +225 -0
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +247 -23
- package/dist/es2019/pm-plugins/decorations/colorSchemes/schemes.js +20 -4
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +85 -105
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +118 -0
- package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.js +15 -12
- package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.styles.legacy.js +33 -0
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +82 -37
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +62 -0
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +15 -140
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +143 -0
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +200 -0
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +248 -23
- package/dist/esm/pm-plugins/decorations/colorSchemes/schemes.js +20 -4
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +87 -105
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +118 -0
- package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.js +15 -12
- package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.styles.legacy.js +32 -0
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +109 -59
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +61 -0
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +15 -153
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +198 -0
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +218 -0
- package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +78 -6
- package/dist/types/pm-plugins/decorations/colorSchemes/schemes.d.ts +3 -0
- package/dist/types/pm-plugins/decorations/colorSchemes/types.d.ts +13 -3
- package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.d.ts +14 -0
- package/dist/types/pm-plugins/decorations/createChangedRowDecorationWidgets.styles.legacy.d.ts +22 -0
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.d.ts +26 -0
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.d.ts +39 -0
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.d.ts +40 -0
- package/package.json +4 -3
|
@@ -9,26 +9,93 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
11
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
12
13
|
var _isExtendedEnabled = require("../isExtendedEnabled");
|
|
13
|
-
var
|
|
14
|
-
var
|
|
14
|
+
var _factory = require("./colorSchemes/factory");
|
|
15
|
+
var _schemes = require("./colorSchemes/schemes");
|
|
15
16
|
var _createAnchorDecorationWidgets = require("./createAnchorDecorationWidgets");
|
|
17
|
+
var _createInlineChangedDecorationStyles = require("./createInlineChangedDecoration.styles.legacy");
|
|
16
18
|
var _decorationKeys = require("./decorationKeys");
|
|
17
19
|
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; }
|
|
18
20
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
21
|
var displayNoneStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
20
22
|
display: 'none'
|
|
21
23
|
});
|
|
22
|
-
var
|
|
24
|
+
var DEFAULT_COLOR_SCHEME = 'standard';
|
|
25
|
+
var getColorScheme = function getColorScheme(colorScheme) {
|
|
26
|
+
return _schemes.colorSchemeRegistry[colorScheme !== null && colorScheme !== void 0 ? colorScheme : DEFAULT_COLOR_SCHEME];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Class names for an atomic inline node decoration (date, emoji, mention, status). Scheme-agnostic
|
|
31
|
+
* — `buildAtomicInlineChangedCSSVariables()` supplies the colour inline on the same element.
|
|
32
|
+
*/
|
|
33
|
+
var getAtomicInlineNodeClassName = function getAtomicInlineNodeClassName(inlineNodeName) {
|
|
23
34
|
var classNames = ['show-diff-atomic-inline-changed'];
|
|
24
35
|
if (inlineNodeName) {
|
|
25
36
|
classNames.push("show-diff-atomic-inline-changed-".concat(inlineNodeName));
|
|
26
37
|
}
|
|
27
|
-
if (colorScheme === 'traditional') {
|
|
28
|
-
classNames.push('show-diff-atomic-inline-changed-traditional');
|
|
29
|
-
}
|
|
30
38
|
return classNames.join(' ');
|
|
31
39
|
};
|
|
40
|
+
|
|
41
|
+
/** Inline style for inserted content under the extended diff experience. */
|
|
42
|
+
var getExtendedInsertStyle = function getExtendedInsertStyle(colors, isActive, hideAddedDiffsUnderline) {
|
|
43
|
+
if (colors.insertedInlineTreatment === 'underline') {
|
|
44
|
+
// hideAddedDiffsUnderline only targets the 'borderBottom' rule, so it does not apply here.
|
|
45
|
+
return isActive ? (0, _factory.buildInsertStyleActive)(colors) : (0, _factory.buildInsertStyle)(colors);
|
|
46
|
+
}
|
|
47
|
+
if (isActive) {
|
|
48
|
+
return hideAddedDiffsUnderline ? (0, _factory.buildInsertStyleExtendedNoUnderlineActive)(colors) : (0, _factory.buildInsertStyleExtendedActive)(colors);
|
|
49
|
+
}
|
|
50
|
+
return hideAddedDiffsUnderline ? (0, _factory.buildInsertStyleExtendedNoUnderline)(colors) : (0, _factory.buildInsertStyleExtended)(colors);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** Inline style for deleted content under the extended diff experience. */
|
|
54
|
+
var getExtendedDeletedStyle = function getExtendedDeletedStyle(colors, isActive) {
|
|
55
|
+
if (colors.deletedInlineTreatment === 'strikethrough') {
|
|
56
|
+
// Identical in both states — the block decoration carries the active emphasis.
|
|
57
|
+
return (0, _factory.buildDeletedInlineStyle)(colors, false);
|
|
58
|
+
}
|
|
59
|
+
return (0, _factory.buildDeletedInlineStyleStandard)(colors, isActive ? 'active' : 'default') + (0, _factory.buildDeletedInlineContentStyleExtended)(colors);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** Registry-driven inline `style` for a changed-content decoration. */
|
|
63
|
+
var resolveInlineChangedStyleRefactored = function resolveInlineChangedStyleRefactored(_ref) {
|
|
64
|
+
var colors = _ref.colors,
|
|
65
|
+
diffType = _ref.diffType,
|
|
66
|
+
hideAddedDiffsUnderline = _ref.hideAddedDiffsUnderline,
|
|
67
|
+
isActive = _ref.isActive,
|
|
68
|
+
isInserted = _ref.isInserted;
|
|
69
|
+
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
70
|
+
return isInserted ? getExtendedInsertStyle(colors, isActive, hideAddedDiffsUnderline) : getExtendedDeletedStyle(colors, isActive);
|
|
71
|
+
}
|
|
72
|
+
return isActive ? (0, _factory.buildInsertStyleActive)(colors) : (0, _factory.buildInsertStyle)(colors);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Single gate for the inline `style` string: registry + factory when the refactor is on, the
|
|
77
|
+
* verbatim pre-refactor per-scheme constants when it is off.
|
|
78
|
+
*/
|
|
79
|
+
var resolveInlineChangedStyle = function resolveInlineChangedStyle(args) {
|
|
80
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? resolveInlineChangedStyleRefactored(args) : (0, _createInlineChangedDecorationStyles.resolveInlineChangedStyleLegacy)(args);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Single gate for the atomic-inline-node decoration attributes. The two cohorts differ in the DOM:
|
|
85
|
+
* on, the colour rides on an inline CSS variable and the class list is scheme-agnostic; off, the
|
|
86
|
+
* colour comes from a `-traditional` class and no variable is emitted. Returned together so the
|
|
87
|
+
* class list and style suffix can never be mixed across cohorts.
|
|
88
|
+
*/
|
|
89
|
+
var resolveAtomicInlineAttrs = function resolveAtomicInlineAttrs(inlineNodeName, colorScheme, colors) {
|
|
90
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? {
|
|
91
|
+
className: getAtomicInlineNodeClassName(inlineNodeName),
|
|
92
|
+
styleSuffix: (0, _factory.buildAtomicInlineChangedCSSVariables)(colors)
|
|
93
|
+
} : {
|
|
94
|
+
className: (0, _createInlineChangedDecorationStyles.getAtomicInlineNodeClassNameLegacy)(inlineNodeName, colorScheme),
|
|
95
|
+
styleSuffix: ''
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
32
99
|
/**
|
|
33
100
|
* Inline decoration used for insertions as the content already exists in the document
|
|
34
101
|
*
|
|
@@ -36,28 +103,28 @@ var getAtomicInlineNodeClassName = function getAtomicInlineNodeClassName(inlineN
|
|
|
36
103
|
* @returns Prosemirror inline decoration
|
|
37
104
|
*/
|
|
38
105
|
|
|
39
|
-
var createInlineChangedDecoration = exports.createInlineChangedDecoration = function createInlineChangedDecoration(
|
|
40
|
-
var change =
|
|
41
|
-
colorScheme =
|
|
42
|
-
|
|
43
|
-
isActive =
|
|
44
|
-
|
|
45
|
-
isInserted =
|
|
46
|
-
|
|
47
|
-
isAtomicInlineNode =
|
|
48
|
-
|
|
49
|
-
shouldHideDeleted =
|
|
50
|
-
|
|
51
|
-
showIndicators =
|
|
52
|
-
doc =
|
|
53
|
-
diffType =
|
|
54
|
-
|
|
55
|
-
hideAddedDiffsUnderline =
|
|
56
|
-
inlineNodeName =
|
|
57
|
-
|
|
58
|
-
hasDeletedWidget =
|
|
59
|
-
|
|
60
|
-
isDeletedWidgetBelow =
|
|
106
|
+
var createInlineChangedDecoration = exports.createInlineChangedDecoration = function createInlineChangedDecoration(_ref2) {
|
|
107
|
+
var change = _ref2.change,
|
|
108
|
+
colorScheme = _ref2.colorScheme,
|
|
109
|
+
_ref2$isActive = _ref2.isActive,
|
|
110
|
+
isActive = _ref2$isActive === void 0 ? false : _ref2$isActive,
|
|
111
|
+
_ref2$isInserted = _ref2.isInserted,
|
|
112
|
+
isInserted = _ref2$isInserted === void 0 ? true : _ref2$isInserted,
|
|
113
|
+
_ref2$isAtomicInlineN = _ref2.isAtomicInlineNode,
|
|
114
|
+
isAtomicInlineNode = _ref2$isAtomicInlineN === void 0 ? false : _ref2$isAtomicInlineN,
|
|
115
|
+
_ref2$shouldHideDelet = _ref2.shouldHideDeleted,
|
|
116
|
+
shouldHideDeleted = _ref2$shouldHideDelet === void 0 ? false : _ref2$shouldHideDelet,
|
|
117
|
+
_ref2$showIndicators = _ref2.showIndicators,
|
|
118
|
+
showIndicators = _ref2$showIndicators === void 0 ? false : _ref2$showIndicators,
|
|
119
|
+
doc = _ref2.doc,
|
|
120
|
+
diffType = _ref2.diffType,
|
|
121
|
+
_ref2$hideAddedDiffsU = _ref2.hideAddedDiffsUnderline,
|
|
122
|
+
hideAddedDiffsUnderline = _ref2$hideAddedDiffsU === void 0 ? false : _ref2$hideAddedDiffsU,
|
|
123
|
+
inlineNodeName = _ref2.inlineNodeName,
|
|
124
|
+
_ref2$hasDeletedWidge = _ref2.hasDeletedWidget,
|
|
125
|
+
hasDeletedWidget = _ref2$hasDeletedWidge === void 0 ? false : _ref2$hasDeletedWidge,
|
|
126
|
+
_ref2$isDeletedWidget = _ref2.isDeletedWidgetBelow,
|
|
127
|
+
isDeletedWidgetBelow = _ref2$isDeletedWidget === void 0 ? false : _ref2$isDeletedWidget;
|
|
61
128
|
var diffId = crypto.randomUUID();
|
|
62
129
|
if (shouldHideDeleted) {
|
|
63
130
|
return [_view.Decoration.inline(change.fromB, change.toB, {
|
|
@@ -68,38 +135,21 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
68
135
|
isActive: isActive
|
|
69
136
|
}))];
|
|
70
137
|
}
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
} else {
|
|
83
|
-
style = isActive ? _standard.deletedContentStyleActive : _standard.deletedContentStyle;
|
|
84
|
-
/**
|
|
85
|
-
* Merge into existing styles when cleaning up
|
|
86
|
-
*/
|
|
87
|
-
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
88
|
-
style += _standard.deletedInlineContentStyleExtended;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
if (colorScheme === 'traditional') {
|
|
94
|
-
style = isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
|
|
95
|
-
} else {
|
|
96
|
-
style = isActive ? _standard.editingStyleActive : _standard.editingStyle;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
138
|
+
var colors = getColorScheme(colorScheme);
|
|
139
|
+
var style = resolveInlineChangedStyle({
|
|
140
|
+
colors: colors,
|
|
141
|
+
colorScheme: colorScheme,
|
|
142
|
+
diffType: diffType,
|
|
143
|
+
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
144
|
+
isActive: isActive,
|
|
145
|
+
isInserted: isInserted
|
|
146
|
+
});
|
|
147
|
+
var isAtomicInlineInsertion = isAtomicInlineNode && isInserted;
|
|
148
|
+
var atomicInlineAttrs = isAtomicInlineInsertion ? resolveAtomicInlineAttrs(inlineNodeName, colorScheme, colors) : undefined;
|
|
99
149
|
var decorations = [_view.Decoration.inline(change.fromB, change.toB, _objectSpread(_objectSpread({
|
|
100
|
-
style: style
|
|
101
|
-
},
|
|
102
|
-
class:
|
|
150
|
+
style: atomicInlineAttrs ? "".concat(style).concat(atomicInlineAttrs.styleSuffix) : style
|
|
151
|
+
}, atomicInlineAttrs && {
|
|
152
|
+
class: atomicInlineAttrs.className
|
|
103
153
|
}), {}, {
|
|
104
154
|
'data-testid': 'show-diff-changed-decoration'
|
|
105
155
|
}), (0, _decorationKeys.buildDiffDecorationSpec)({
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.resolveInlineChangedStyleLegacy = exports.getAtomicInlineNodeClassNameLegacy = void 0;
|
|
7
|
+
var _isExtendedEnabled = require("../isExtendedEnabled");
|
|
8
|
+
var _standard = require("./colorSchemes/standard");
|
|
9
|
+
var _traditional = require("./colorSchemes/traditional");
|
|
10
|
+
/**
|
|
11
|
+
* Pre-refactor `createInlineChangedDecoration` styling code, preserved verbatim for the OFF cohort
|
|
12
|
+
* of `platform_editor_show_diff_color_scheme_refactor`.
|
|
13
|
+
*
|
|
14
|
+
* Do not modify — this module exists purely so the OFF cohort keeps running the exact code that
|
|
15
|
+
* shipped before the `colorSchemeRegistry` + `factory.ts` migration. Delete the whole file at
|
|
16
|
+
* experiment cleanup (EDITOR-8281).
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Pre-refactor inline `style` computation for `createInlineChangedDecoration`.
|
|
21
|
+
*/
|
|
22
|
+
var resolveInlineChangedStyleLegacy = exports.resolveInlineChangedStyleLegacy = function resolveInlineChangedStyleLegacy(_ref) {
|
|
23
|
+
var colorScheme = _ref.colorScheme,
|
|
24
|
+
diffType = _ref.diffType,
|
|
25
|
+
hideAddedDiffsUnderline = _ref.hideAddedDiffsUnderline,
|
|
26
|
+
isActive = _ref.isActive,
|
|
27
|
+
isInserted = _ref.isInserted;
|
|
28
|
+
var style;
|
|
29
|
+
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
30
|
+
if (isInserted) {
|
|
31
|
+
if (colorScheme === 'traditional') {
|
|
32
|
+
style = isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
|
|
33
|
+
} else {
|
|
34
|
+
style = isActive ? hideAddedDiffsUnderline ? _standard.editingStyleActiveExtendedNoUnderline : _standard.editingStyleActiveExtended : hideAddedDiffsUnderline ? _standard.editingStyleExtendedNoUnderline : _standard.editingStyleExtended;
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
if (colorScheme === 'traditional') {
|
|
38
|
+
style = (0, _traditional.getDeletedTraditionalInlineStyle)(false);
|
|
39
|
+
} else {
|
|
40
|
+
style = (isActive ? _standard.deletedContentStyleActive : _standard.deletedContentStyle) + _standard.deletedInlineContentStyleExtended;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
if (colorScheme === 'traditional') {
|
|
45
|
+
style = isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
|
|
46
|
+
} else {
|
|
47
|
+
style = isActive ? _standard.editingStyleActive : _standard.editingStyle;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return style;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Pre-refactor class names for an atomic inline node decoration (date, emoji, mention, status).
|
|
55
|
+
* The colour was carried by the per-scheme `-traditional` class rather than by an inline CSS
|
|
56
|
+
* variable on the same element.
|
|
57
|
+
*/
|
|
58
|
+
var getAtomicInlineNodeClassNameLegacy = exports.getAtomicInlineNodeClassNameLegacy = function getAtomicInlineNodeClassNameLegacy(inlineNodeName, colorScheme) {
|
|
59
|
+
var classNames = ['show-diff-atomic-inline-changed'];
|
|
60
|
+
if (inlineNodeName) {
|
|
61
|
+
classNames.push("show-diff-atomic-inline-changed-".concat(inlineNodeName));
|
|
62
|
+
}
|
|
63
|
+
if (colorScheme === 'traditional') {
|
|
64
|
+
classNames.push('show-diff-atomic-inline-changed-traditional');
|
|
65
|
+
}
|
|
66
|
+
return classNames.join(' ');
|
|
67
|
+
};
|
|
@@ -11,116 +11,8 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
11
11
|
var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
|
|
12
12
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
13
|
var _isExtendedEnabled = require("../../isExtendedEnabled");
|
|
14
|
-
var _standard = require("../colorSchemes/standard");
|
|
15
|
-
var _traditional = require("../colorSchemes/traditional");
|
|
16
14
|
var _tableCellEdgeAttrs = require("./tableCellEdgeAttrs");
|
|
17
|
-
var
|
|
18
|
-
display: 'inline-flex',
|
|
19
|
-
boxSizing: 'border-box',
|
|
20
|
-
position: 'static',
|
|
21
|
-
blockSize: 'min-content',
|
|
22
|
-
borderRadius: "var(--ds-radius-small, 4px)",
|
|
23
|
-
overflow: 'hidden',
|
|
24
|
-
paddingInlineStart: "var(--ds-space-050, 4px)",
|
|
25
|
-
paddingInlineEnd: "var(--ds-space-050, 4px)",
|
|
26
|
-
backgroundColor: "var(--ds-background-accent-gray-subtler, #DDDEE1)",
|
|
27
|
-
font: "var(--ds-font-body-small, normal 400 12px/16px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
28
|
-
fontWeight: "var(--ds-font-weight-bold, 653)",
|
|
29
|
-
textOverflow: 'ellipsis',
|
|
30
|
-
whiteSpace: 'nowrap',
|
|
31
|
-
color: "var(--ds-text-warning-inverse, #292A2E)"
|
|
32
|
-
});
|
|
33
|
-
var lozengeStyleActiveStandard = (0, _lazyNodeView.convertToInlineCss)({
|
|
34
|
-
display: 'inline-flex',
|
|
35
|
-
boxSizing: 'border-box',
|
|
36
|
-
position: 'static',
|
|
37
|
-
blockSize: 'min-content',
|
|
38
|
-
borderRadius: "var(--ds-radius-small, 4px)",
|
|
39
|
-
overflow: 'hidden',
|
|
40
|
-
paddingInlineStart: "var(--ds-space-050, 4px)",
|
|
41
|
-
paddingInlineEnd: "var(--ds-space-050, 4px)",
|
|
42
|
-
backgroundColor: "var(--ds-background-accent-red-subtler-pressed, #FD9891)",
|
|
43
|
-
font: "var(--ds-font-body-small, normal 400 12px/16px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
44
|
-
fontWeight: "var(--ds-font-weight-bold, 653)",
|
|
45
|
-
textOverflow: 'ellipsis',
|
|
46
|
-
whiteSpace: 'nowrap',
|
|
47
|
-
color: "var(--ds-text-warning-inverse, #292A2E)"
|
|
48
|
-
});
|
|
49
|
-
var lozengeStyleActiveTraditional = (0, _lazyNodeView.convertToInlineCss)({
|
|
50
|
-
display: 'inline-flex',
|
|
51
|
-
boxSizing: 'border-box',
|
|
52
|
-
position: 'static',
|
|
53
|
-
blockSize: 'min-content',
|
|
54
|
-
borderRadius: "var(--ds-radius-small, 4px)",
|
|
55
|
-
overflow: 'hidden',
|
|
56
|
-
paddingInlineStart: "var(--ds-space-050, 4px)",
|
|
57
|
-
paddingInlineEnd: "var(--ds-space-050, 4px)",
|
|
58
|
-
backgroundColor: "var(--ds-background-accent-red-subtler-pressed, #FD9891)",
|
|
59
|
-
font: "var(--ds-font-body-small, normal 400 12px/16px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
60
|
-
fontWeight: "var(--ds-font-weight-bold, 653)",
|
|
61
|
-
textOverflow: 'ellipsis',
|
|
62
|
-
whiteSpace: 'nowrap',
|
|
63
|
-
color: "var(--ds-text-warning-inverse, #292A2E)"
|
|
64
|
-
});
|
|
65
|
-
var getChangedContentStyle = function getChangedContentStyle(colorScheme) {
|
|
66
|
-
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
67
|
-
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
68
|
-
var diffType = arguments.length > 3 ? arguments[3] : undefined;
|
|
69
|
-
var hideAddedDiffsUnderline = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
70
|
-
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType) && isInserted) {
|
|
71
|
-
if (colorScheme === 'traditional') {
|
|
72
|
-
return isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
|
|
73
|
-
}
|
|
74
|
-
return isActive ? hideAddedDiffsUnderline ? _standard.editingStyleActiveExtendedNoUnderline : _standard.editingStyleActiveExtended : hideAddedDiffsUnderline ? _standard.editingStyleExtendedNoUnderline : _standard.editingStyleExtended;
|
|
75
|
-
}
|
|
76
|
-
if (colorScheme === 'traditional') {
|
|
77
|
-
return (0, _traditional.getDeletedTraditionalInlineStyle)(isActive);
|
|
78
|
-
}
|
|
79
|
-
if (isActive) {
|
|
80
|
-
return _standard.deletedContentStyleActive;
|
|
81
|
-
}
|
|
82
|
-
return (0, _expValEquals.expValEquals)('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? _standard.deletedContentStyleNew : _standard.deletedContentStyle;
|
|
83
|
-
};
|
|
84
|
-
var getChangedNodeStyle = function getChangedNodeStyle(nodeName, colorScheme) {
|
|
85
|
-
var isInserted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
86
|
-
var isActive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
87
|
-
var diffType = arguments.length > 4 ? arguments[4] : undefined;
|
|
88
|
-
var hideAddedDiffsUnderline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
89
|
-
var isTraditional = colorScheme === 'traditional';
|
|
90
|
-
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType) && isInserted) {
|
|
91
|
-
if (isMultiContainerBlockNode(nodeName)) {
|
|
92
|
-
return hideAddedDiffsUnderline ? _standard.editingContentStyleInBlockExtendedNoUnderline : _standard.editingContentStyleInBlockExtended;
|
|
93
|
-
}
|
|
94
|
-
if (isTextLikeBlockNode(nodeName)) {
|
|
95
|
-
return undefined;
|
|
96
|
-
}
|
|
97
|
-
if (isTraditional) {
|
|
98
|
-
return isActive ? _traditional.traditionalStyleNodeActive : _traditional.traditionalStyleNodeNew;
|
|
99
|
-
}
|
|
100
|
-
return _standard.editingStyleNode;
|
|
101
|
-
}
|
|
102
|
-
switch (nodeName) {
|
|
103
|
-
case 'blockquote':
|
|
104
|
-
if (isTraditional) {
|
|
105
|
-
return isActive ? _traditional.deletedTraditionalStyleQuoteNodeActive : _traditional.deletedTraditionalStyleQuoteNode;
|
|
106
|
-
}
|
|
107
|
-
return isActive ? _standard.deletedStyleQuoteNodeWithLozengeActive : _standard.deletedStyleQuoteNodeWithLozenge;
|
|
108
|
-
case 'expand':
|
|
109
|
-
case 'decisionList':
|
|
110
|
-
if (isTraditional) {
|
|
111
|
-
return isActive ? _traditional.deletedTraditionalBlockOutlineActive : _traditional.deletedTraditionalBlockOutlineNew;
|
|
112
|
-
}
|
|
113
|
-
return isActive ? _standard.deletedBlockOutlineActive : _standard.deletedBlockOutline;
|
|
114
|
-
case 'panel':
|
|
115
|
-
case 'codeBlock':
|
|
116
|
-
if (isTraditional) {
|
|
117
|
-
return isActive ? _traditional.deletedTraditionalBlockOutlineRoundedActive : _traditional.deletedTraditionalBlockOutlineRoundedNew;
|
|
118
|
-
}
|
|
119
|
-
return isActive ? _standard.deletedBlockOutlineRoundedActive : _standard.deletedBlockOutlineRounded;
|
|
120
|
-
default:
|
|
121
|
-
return undefined;
|
|
122
|
-
}
|
|
123
|
-
};
|
|
15
|
+
var _wrapBlockNodeViewStyles = require("./wrapBlockNodeViewStyles");
|
|
124
16
|
var shouldShowRemovedLozenge = function shouldShowRemovedLozenge(nodeName) {
|
|
125
17
|
switch (nodeName) {
|
|
126
18
|
case 'expand':
|
|
@@ -157,7 +49,8 @@ var maybeAddDeletedOutlineNewClass = function maybeAddDeletedOutlineNewClass(_re
|
|
|
157
49
|
if (name !== 'mediaSingle' && name !== 'embedCard') {
|
|
158
50
|
return;
|
|
159
51
|
}
|
|
160
|
-
|
|
52
|
+
// Only schemes with a resting ring get the class.
|
|
53
|
+
if ((0, _wrapBlockNodeViewStyles.hasRestingDeletedRing)(colorScheme) && !isActive) {
|
|
161
54
|
nodeView.classList.add('show-diff-deleted-outline-new');
|
|
162
55
|
}
|
|
163
56
|
};
|
|
@@ -169,23 +62,18 @@ var maybeAddDeletedOutlineNewClass = function maybeAddDeletedOutlineNewClass(_re
|
|
|
169
62
|
var shouldApplyStylesDirectly = function shouldApplyStylesDirectly(nodeName) {
|
|
170
63
|
return nodeName === 'heading';
|
|
171
64
|
};
|
|
172
|
-
var isMultiContainerBlockNode = function isMultiContainerBlockNode(nodeName) {
|
|
173
|
-
return ['decisionList', 'layoutSection'].includes(nodeName);
|
|
174
|
-
};
|
|
175
|
-
var isTextLikeBlockNode = function isTextLikeBlockNode(nodeName) {
|
|
176
|
-
return ['heading', 'bulletList', 'orderedList', 'listItem', 'taskList', 'blockquote'].includes(nodeName);
|
|
177
|
-
};
|
|
178
65
|
var applyCellOverlayStyles = function applyCellOverlayStyles(_ref2) {
|
|
179
66
|
var element = _ref2.element,
|
|
180
67
|
colorScheme = _ref2.colorScheme,
|
|
181
68
|
isInserted = _ref2.isInserted;
|
|
182
69
|
var isRoundedTable = (0, _expValEquals.expValEquals)('platform_editor_table_diff_rounded_corners', 'isEnabled', true);
|
|
70
|
+
var overlayStyle = (0, _wrapBlockNodeViewStyles.resolveCellOverlayStyle)({
|
|
71
|
+
colorScheme: colorScheme,
|
|
72
|
+
isInserted: isInserted,
|
|
73
|
+
isRoundedTable: isRoundedTable
|
|
74
|
+
});
|
|
183
75
|
element.querySelectorAll('td, th').forEach(function (cell) {
|
|
184
76
|
var overlay = document.createElement('span');
|
|
185
|
-
var isTraditional = colorScheme === 'traditional';
|
|
186
|
-
var deletedCellStyle = isTraditional ? isRoundedTable ? _traditional.deletedTraditionalCellOverlayRoundedStyle : _traditional.deletedTraditionalCellOverlayStyle : isRoundedTable ? _standard.deletedCellOverlayRoundedStyle : _standard.deletedCellOverlayStyle;
|
|
187
|
-
var addedCellStyle = isTraditional ? isRoundedTable ? _traditional.traditionalAddedCellOverlayRoundedStyle : _traditional.traditionalAddedCellOverlayStyleNew : isRoundedTable ? _standard.addedCellOverlayRoundedStyle : _standard.addedCellOverlayStyle;
|
|
188
|
-
var overlayStyle = isInserted ? addedCellStyle : deletedCellStyle;
|
|
189
77
|
overlay.setAttribute('style', overlayStyle);
|
|
190
78
|
cell.appendChild(overlay);
|
|
191
79
|
});
|
|
@@ -211,7 +99,7 @@ var createRemovedLozenge = function createRemovedLozenge(intl) {
|
|
|
211
99
|
|
|
212
100
|
// Create vanilla HTML lozenge element with Atlaskit Lozenge styling (visual refresh)
|
|
213
101
|
var lozengeElement = document.createElement('span');
|
|
214
|
-
var lozengeInnerStyle =
|
|
102
|
+
var lozengeInnerStyle = (0, _wrapBlockNodeViewStyles.resolveRemovedLozengeStyle)(colorScheme, isActive);
|
|
215
103
|
lozengeElement.setAttribute('style', lozengeInnerStyle);
|
|
216
104
|
lozengeElement.textContent = intl.formatMessage(_messages.trackChangesMessages.removed).toUpperCase();
|
|
217
105
|
container.appendChild(lozengeElement);
|
|
@@ -245,9 +133,9 @@ var applyStylesToElement = function applyStylesToElement(_ref3) {
|
|
|
245
133
|
_ref3$hideAddedDiffsU = _ref3.hideAddedDiffsUnderline,
|
|
246
134
|
hideAddedDiffsUnderline = _ref3$hideAddedDiffsU === void 0 ? false : _ref3$hideAddedDiffsU;
|
|
247
135
|
var currentStyle = element.getAttribute('style') || '';
|
|
248
|
-
var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
136
|
+
var contentStyle = (0, _wrapBlockNodeViewStyles.getChangedContentStyle)(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
249
137
|
var targetNodeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _nodeTypeUtils.getBaseNodeTypeName)(targetNode.type) : targetNode.type.name;
|
|
250
|
-
var nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
138
|
+
var nodeSpecificStyle = (0, _wrapBlockNodeViewStyles.getChangedNodeStyle)(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
251
139
|
element.setAttribute('style', "".concat(currentStyle).concat(contentStyle).concat(nodeSpecificStyle));
|
|
252
140
|
};
|
|
253
141
|
var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref4) {
|
|
@@ -261,21 +149,24 @@ var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref4
|
|
|
261
149
|
hideAddedDiffsUnderline = _ref4$hideAddedDiffsU === void 0 ? false : _ref4$hideAddedDiffsU;
|
|
262
150
|
var currentStyle = element.getAttribute('style') || '';
|
|
263
151
|
var targetNodeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _nodeTypeUtils.getBaseNodeTypeName)(targetNode.type) : targetNode.type.name;
|
|
264
|
-
var nodeSpecificStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
152
|
+
var nodeSpecificStyle = (0, _wrapBlockNodeViewStyles.getChangedNodeStyle)(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
265
153
|
if (targetNode.type.name === 'decisionList') {
|
|
154
|
+
var nestedInsertedNodeStyle = (0, _wrapBlockNodeViewStyles.resolveNestedInsertedNodeStyle)();
|
|
266
155
|
element.querySelectorAll('li').forEach(function (listItem) {
|
|
267
156
|
var currentListItemStyle = listItem.getAttribute('style') || '';
|
|
268
|
-
listItem.setAttribute('style', "".concat(currentListItemStyle).concat(
|
|
157
|
+
listItem.setAttribute('style', "".concat(currentListItemStyle).concat(nestedInsertedNodeStyle));
|
|
269
158
|
});
|
|
270
159
|
} else if (targetNode.type.name === 'layoutSection') {
|
|
160
|
+
var _nestedInsertedNodeStyle = (0, _wrapBlockNodeViewStyles.resolveNestedInsertedNodeStyle)();
|
|
271
161
|
element.querySelectorAll('[data-layout-column="true"]').forEach(function (section) {
|
|
272
162
|
var currentSectionStyle = section.getAttribute('style') || '';
|
|
273
|
-
section.setAttribute('style', "".concat(currentSectionStyle).concat(
|
|
163
|
+
section.setAttribute('style', "".concat(currentSectionStyle).concat(_nestedInsertedNodeStyle));
|
|
274
164
|
});
|
|
275
165
|
} else if (targetNode.type.name === 'taskList') {
|
|
166
|
+
var _nestedInsertedNodeStyle2 = (0, _wrapBlockNodeViewStyles.resolveNestedInsertedNodeStyle)();
|
|
276
167
|
element.querySelectorAll('li').forEach(function (listItem) {
|
|
277
168
|
var currentListItemStyle = listItem.getAttribute('style') || '';
|
|
278
|
-
listItem.setAttribute('style', "".concat(currentListItemStyle).concat(
|
|
169
|
+
listItem.setAttribute('style', "".concat(currentListItemStyle).concat(_nestedInsertedNodeStyle2));
|
|
279
170
|
});
|
|
280
171
|
}
|
|
281
172
|
element.setAttribute('style', "".concat(currentStyle, ";").concat(nodeSpecificStyle));
|
|
@@ -290,11 +181,11 @@ var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref5)
|
|
|
290
181
|
_ref5$hideAddedDiffsU = _ref5.hideAddedDiffsUnderline,
|
|
291
182
|
hideAddedDiffsUnderline = _ref5$hideAddedDiffsU === void 0 ? false : _ref5$hideAddedDiffsU;
|
|
292
183
|
var currentStyle = element.getAttribute('style') || '';
|
|
293
|
-
var nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
184
|
+
var nodeSpecificStyle = (0, _wrapBlockNodeViewStyles.getChangedNodeStyle)(targetNode.type.name, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline) || '';
|
|
294
185
|
if (nodeSpecificStyle) {
|
|
295
186
|
element.setAttribute('style', "".concat(currentStyle).concat(nodeSpecificStyle));
|
|
296
187
|
}
|
|
297
|
-
var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
188
|
+
var contentStyle = (0, _wrapBlockNodeViewStyles.getChangedContentStyle)(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
298
189
|
var walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
|
|
299
190
|
var textNodesToWrap = [];
|
|
300
191
|
var currentNode = walker.nextNode();
|
|
@@ -326,13 +217,13 @@ var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref6
|
|
|
326
217
|
hideAddedDiffsUnderline = _ref6$hideAddedDiffsU === void 0 ? false : _ref6$hideAddedDiffsU;
|
|
327
218
|
var contentWrapper = document.createElement('div');
|
|
328
219
|
var targetNodeName = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _nodeTypeUtils.getBaseNodeTypeName)(targetNode.type) : targetNode.type.name;
|
|
329
|
-
var nodeStyle = getChangedNodeStyle(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline);
|
|
220
|
+
var nodeStyle = (0, _wrapBlockNodeViewStyles.getChangedNodeStyle)(targetNodeName, colorScheme, isInserted, isActive, diffType, hideAddedDiffsUnderline);
|
|
330
221
|
|
|
331
222
|
// When the extended experiment is enabled and the content is inserted,
|
|
332
223
|
// block widget nodes that already have dedicated node-level styling (e.g. boxShadow outline)
|
|
333
224
|
// should not also get the inline content style (borderBottom underline) on their container.
|
|
334
225
|
var shouldSkipContentStyle = (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && isInserted && nodeStyle !== undefined;
|
|
335
|
-
var contentStyle = shouldSkipContentStyle ? '' : getChangedContentStyle(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
226
|
+
var contentStyle = shouldSkipContentStyle ? '' : (0, _wrapBlockNodeViewStyles.getChangedContentStyle)(colorScheme, isActive, isInserted, diffType, hideAddedDiffsUnderline);
|
|
336
227
|
contentWrapper.setAttribute('style', "".concat(contentStyle).concat(nodeStyle || ''));
|
|
337
228
|
contentWrapper.append(nodeView);
|
|
338
229
|
return contentWrapper;
|
|
@@ -522,7 +413,7 @@ var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(_
|
|
|
522
413
|
hideAddedDiffsUnderline = _ref0$hideAddedDiffsU === void 0 ? false : _ref0$hideAddedDiffsU;
|
|
523
414
|
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
524
415
|
if (nodeView instanceof HTMLElement) {
|
|
525
|
-
if (isInserted && isMultiContainerBlockNode(targetNode.type.name)) {
|
|
416
|
+
if (isInserted && (0, _wrapBlockNodeViewStyles.isMultiContainerBlockNode)(targetNode.type.name)) {
|
|
526
417
|
applyMultiContainerLikeStyles({
|
|
527
418
|
element: nodeView,
|
|
528
419
|
targetNode: targetNode,
|
|
@@ -535,7 +426,7 @@ var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(_
|
|
|
535
426
|
dom.append(nodeView);
|
|
536
427
|
return;
|
|
537
428
|
}
|
|
538
|
-
if (isTextLikeBlockNode(targetNode.type.name)) {
|
|
429
|
+
if ((0, _wrapBlockNodeViewStyles.isTextLikeBlockNode)(targetNode.type.name)) {
|
|
539
430
|
applyTextLikeBlockNodeStyles({
|
|
540
431
|
element: nodeView,
|
|
541
432
|
targetNode: targetNode,
|
|
@@ -602,35 +493,6 @@ var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(_
|
|
|
602
493
|
}
|
|
603
494
|
}
|
|
604
495
|
};
|
|
605
|
-
var getDeletedContentStyleUnbounded = function getDeletedContentStyleUnbounded(colorScheme) {
|
|
606
|
-
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
607
|
-
if (colorScheme === 'traditional' && isActive) {
|
|
608
|
-
return _traditional.deletedTraditionalContentStyleUnboundedActive;
|
|
609
|
-
}
|
|
610
|
-
return colorScheme === 'traditional' ? _traditional.deletedTraditionalContentStyleUnbounded : _standard.deletedContentStyleUnbounded;
|
|
611
|
-
};
|
|
612
|
-
var getInsertedContentStyle = function getInsertedContentStyle(colorScheme) {
|
|
613
|
-
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
614
|
-
var hideAddedDiffsUnderline = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
615
|
-
if (colorScheme === 'traditional') {
|
|
616
|
-
return isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
|
|
617
|
-
}
|
|
618
|
-
if (isActive) {
|
|
619
|
-
return hideAddedDiffsUnderline ? _standard.editingStyleActiveExtendedNoUnderline : _standard.editingStyleActiveExtended;
|
|
620
|
-
}
|
|
621
|
-
return hideAddedDiffsUnderline ? _standard.editingStyleExtendedNoUnderline : _standard.editingStyleExtended;
|
|
622
|
-
};
|
|
623
|
-
var getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
|
|
624
|
-
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
625
|
-
var diffType = arguments.length > 2 ? arguments[2] : undefined;
|
|
626
|
-
if (colorScheme === 'traditional') {
|
|
627
|
-
return (0, _traditional.getDeletedTraditionalInlineStyle)(isActive);
|
|
628
|
-
}
|
|
629
|
-
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
630
|
-
return (isActive ? _standard.deletedContentStyleActive : _standard.deletedContentStyleNew) + _standard.deletedInlineContentStyleExtended;
|
|
631
|
-
}
|
|
632
|
-
return isActive ? _standard.deletedContentStyleActive : _standard.deletedContentStyleNew;
|
|
633
|
-
};
|
|
634
496
|
|
|
635
497
|
/**
|
|
636
498
|
* Injects a styled inner wrapper span around the children of a block node element.
|
|
@@ -644,7 +506,7 @@ var injectInnerWrapper = exports.injectInnerWrapper = function injectInnerWrappe
|
|
|
644
506
|
isInserted = _ref1.isInserted,
|
|
645
507
|
diffType = _ref1.diffType;
|
|
646
508
|
var wrapper = document.createElement('span');
|
|
647
|
-
wrapper.setAttribute('style', isInserted ? getInsertedContentStyle(colorScheme, isActive) : getDeletedContentStyle(colorScheme, isActive, diffType));
|
|
509
|
+
wrapper.setAttribute('style', isInserted ? (0, _wrapBlockNodeViewStyles.getInsertedContentStyle)(colorScheme, isActive) : (0, _wrapBlockNodeViewStyles.getDeletedContentStyle)(colorScheme, isActive, diffType));
|
|
648
510
|
(0, _toConsumableArray2.default)(node.childNodes).forEach(function (child) {
|
|
649
511
|
var removedChild = node.removeChild(child);
|
|
650
512
|
wrapper.append(removedChild);
|
|
@@ -667,17 +529,17 @@ var createContentWrapper = exports.createContentWrapper = function createContent
|
|
|
667
529
|
});
|
|
668
530
|
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
669
531
|
if (isInserted) {
|
|
670
|
-
wrapper.setAttribute('style', "".concat(baseStyle).concat(getInsertedContentStyle(colorScheme, isActive)));
|
|
532
|
+
wrapper.setAttribute('style', "".concat(baseStyle).concat((0, _wrapBlockNodeViewStyles.getInsertedContentStyle)(colorScheme, isActive)));
|
|
671
533
|
} else {
|
|
672
|
-
wrapper.setAttribute('style', "".concat(baseStyle).concat(getDeletedContentStyle(colorScheme, isActive, diffType)));
|
|
534
|
+
wrapper.setAttribute('style', "".concat(baseStyle).concat((0, _wrapBlockNodeViewStyles.getDeletedContentStyle)(colorScheme, isActive, diffType)));
|
|
673
535
|
var strikethrough = document.createElement('span');
|
|
674
|
-
strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colorScheme, isActive));
|
|
536
|
+
strikethrough.setAttribute('style', (0, _wrapBlockNodeViewStyles.getDeletedContentStyleUnbounded)(colorScheme, isActive));
|
|
675
537
|
wrapper.append(strikethrough);
|
|
676
538
|
}
|
|
677
539
|
} else {
|
|
678
|
-
wrapper.setAttribute('style', "".concat(baseStyle).concat(getDeletedContentStyle(colorScheme, isActive, diffType)));
|
|
540
|
+
wrapper.setAttribute('style', "".concat(baseStyle).concat((0, _wrapBlockNodeViewStyles.getDeletedContentStyle)(colorScheme, isActive, diffType)));
|
|
679
541
|
var _strikethrough = document.createElement('span');
|
|
680
|
-
_strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colorScheme, isActive));
|
|
542
|
+
_strikethrough.setAttribute('style', (0, _wrapBlockNodeViewStyles.getDeletedContentStyleUnbounded)(colorScheme, isActive));
|
|
681
543
|
wrapper.append(_strikethrough);
|
|
682
544
|
}
|
|
683
545
|
return wrapper;
|