@atlaskit/editor-plugin-show-diff 6.2.5 → 6.2.7
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 +14 -0
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +1 -2
- package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +19 -1
- package/dist/cjs/pm-plugins/decorations/colorSchemes/traditional.js +18 -2
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +13 -10
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +83 -14
- package/dist/cjs/pm-plugins/getScrollableDecorations.js +132 -0
- package/dist/cjs/pm-plugins/main.js +12 -25
- package/dist/cjs/pm-plugins/scrollToActiveDecoration.js +50 -9
- package/dist/cjs/showDiffPlugin.js +2 -1
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +1 -2
- package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +18 -0
- package/dist/es2019/pm-plugins/decorations/colorSchemes/traditional.js +17 -1
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +13 -9
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +80 -18
- package/dist/es2019/pm-plugins/getScrollableDecorations.js +117 -0
- package/dist/es2019/pm-plugins/main.js +11 -22
- package/dist/es2019/pm-plugins/scrollToActiveDecoration.js +50 -10
- package/dist/es2019/showDiffPlugin.js +3 -2
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +1 -2
- package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +18 -0
- package/dist/esm/pm-plugins/decorations/colorSchemes/traditional.js +17 -1
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +13 -10
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +85 -16
- package/dist/esm/pm-plugins/getScrollableDecorations.js +124 -0
- package/dist/esm/pm-plugins/main.js +11 -24
- package/dist/esm/pm-plugins/scrollToActiveDecoration.js +50 -9
- package/dist/esm/showDiffPlugin.js +3 -2
- package/dist/types/pm-plugins/decorations/colorSchemes/standard.d.ts +4 -0
- package/dist/types/pm-plugins/decorations/colorSchemes/traditional.d.ts +3 -0
- package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +5 -2
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +2 -1
- package/dist/types/pm-plugins/getScrollableDecorations.d.ts +27 -0
- package/dist/types/pm-plugins/main.d.ts +0 -2
- package/dist/types/pm-plugins/scrollToActiveDecoration.d.ts +4 -2
- package/dist/types-ts4.5/pm-plugins/decorations/colorSchemes/standard.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/decorations/colorSchemes/traditional.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +5 -2
- package/dist/types-ts4.5/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/getScrollableDecorations.d.ts +27 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -2
- package/dist/types-ts4.5/pm-plugins/scrollToActiveDecoration.d.ts +4 -2
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.showDiffPluginKey = exports.
|
|
7
|
+
exports.showDiffPluginKey = exports.createPlugin = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _processRawValue = require("@atlaskit/editor-common/process-raw-value");
|
|
10
10
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
@@ -15,33 +15,12 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
15
15
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
16
|
var _calculateDiffDecorations = require("./calculateDiff/calculateDiffDecorations");
|
|
17
17
|
var _enforceCustomStepRegisters = require("./enforceCustomStepRegisters");
|
|
18
|
+
var _getScrollableDecorations = require("./getScrollableDecorations");
|
|
18
19
|
var _NodeViewSerializer = require("./NodeViewSerializer");
|
|
19
20
|
var _scrollToActiveDecoration = require("./scrollToActiveDecoration");
|
|
20
21
|
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; }
|
|
21
22
|
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; }
|
|
22
23
|
var showDiffPluginKey = exports.showDiffPluginKey = new _state2.PluginKey('showDiffPlugin');
|
|
23
|
-
var getScrollableDecorations = exports.getScrollableDecorations = function getScrollableDecorations(set) {
|
|
24
|
-
var _set$find;
|
|
25
|
-
var seenBlockKeys = new Set();
|
|
26
|
-
return ((_set$find = set === null || set === void 0 ? void 0 : set.find(undefined, undefined, function (spec) {
|
|
27
|
-
var _spec$key;
|
|
28
|
-
return spec.key === 'diff-inline' || ((_spec$key = spec.key) === null || _spec$key === void 0 ? void 0 : _spec$key.startsWith('diff-widget')) || spec.key === 'diff-block';
|
|
29
|
-
})) !== null && _set$find !== void 0 ? _set$find : []).filter(function (dec) {
|
|
30
|
-
var _dec$spec;
|
|
31
|
-
if (((_dec$spec = dec.spec) === null || _dec$spec === void 0 ? void 0 : _dec$spec.key) === 'diff-block') {
|
|
32
|
-
var _dec$spec2, _dec$spec$nodeName, _dec$spec3;
|
|
33
|
-
// Skip listItem blocks as they are not scrollable
|
|
34
|
-
if (((_dec$spec2 = dec.spec) === null || _dec$spec2 === void 0 ? void 0 : _dec$spec2.nodeName) === 'listItem') return false;
|
|
35
|
-
var key = "".concat(dec.from, "-").concat(dec.to, "-").concat((_dec$spec$nodeName = (_dec$spec3 = dec.spec) === null || _dec$spec3 === void 0 ? void 0 : _dec$spec3.nodeName) !== null && _dec$spec$nodeName !== void 0 ? _dec$spec$nodeName : '');
|
|
36
|
-
// Skip blocks that have already been seen
|
|
37
|
-
if (seenBlockKeys.has(key)) return false;
|
|
38
|
-
seenBlockKeys.add(key);
|
|
39
|
-
}
|
|
40
|
-
return true;
|
|
41
|
-
}).sort(function (a, b) {
|
|
42
|
-
return a.from === b.from ? a.to - b.to : a.from - b.from;
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
24
|
var createPlugin = exports.createPlugin = function createPlugin(config, getIntl, api) {
|
|
46
25
|
if ((0, _platformFeatureFlags.fg)('platform_editor_show_diff_equality_fallback')) {
|
|
47
26
|
(0, _enforceCustomStepRegisters.enforceCustomStepRegisters)();
|
|
@@ -104,7 +83,7 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
|
|
|
104
83
|
} : {});
|
|
105
84
|
} 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') && (0, _platformFeatureFlags.fg)('platform_editor_show_diff_scroll_navigation')) {
|
|
106
85
|
// Update the active index in plugin state and recalculate decorations
|
|
107
|
-
var _decorations = getScrollableDecorations(currentPluginState.decorations);
|
|
86
|
+
var _decorations = (0, _getScrollableDecorations.getScrollableDecorations)(currentPluginState.decorations, newState.doc);
|
|
108
87
|
if (_decorations.length > 0) {
|
|
109
88
|
var _currentPluginState$a;
|
|
110
89
|
// Initialize to -1 if undefined so that the first "next" scroll takes us to index 0 (first change).
|
|
@@ -156,6 +135,7 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
|
|
|
156
135
|
setNodeViewSerializer(editorView);
|
|
157
136
|
var isFirst = true;
|
|
158
137
|
var previousActiveIndex;
|
|
138
|
+
var cancelPendingScrollToDecoration = null;
|
|
159
139
|
return {
|
|
160
140
|
update: function update(view) {
|
|
161
141
|
// If we're using configuration to show diffs we initialise here once we setup the editor view
|
|
@@ -176,9 +156,16 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
|
|
|
176
156
|
var activeIndexChanged = (pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && pluginState.activeIndex !== previousActiveIndex;
|
|
177
157
|
previousActiveIndex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex;
|
|
178
158
|
if ((pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && activeIndexChanged) {
|
|
179
|
-
|
|
159
|
+
var _cancelPendingScrollT;
|
|
160
|
+
(_cancelPendingScrollT = cancelPendingScrollToDecoration) === null || _cancelPendingScrollT === void 0 || _cancelPendingScrollT();
|
|
161
|
+
cancelPendingScrollToDecoration = (0, _scrollToActiveDecoration.scrollToActiveDecoration)(view, (0, _getScrollableDecorations.getScrollableDecorations)(pluginState.decorations, view.state.doc), pluginState.activeIndex);
|
|
180
162
|
}
|
|
181
163
|
}
|
|
164
|
+
},
|
|
165
|
+
destroy: function destroy() {
|
|
166
|
+
var _cancelPendingScrollT2;
|
|
167
|
+
(_cancelPendingScrollT2 = cancelPendingScrollToDecoration) === null || _cancelPendingScrollT2 === void 0 || _cancelPendingScrollT2();
|
|
168
|
+
cancelPendingScrollToDecoration = null;
|
|
182
169
|
}
|
|
183
170
|
};
|
|
184
171
|
},
|
|
@@ -4,28 +4,69 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.scrollToActiveDecoration = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Extra space above the scrolled-to element so it does not sit flush under the
|
|
9
|
+
* viewport edge (helps with sticky table headers, toolbars, etc.).
|
|
10
|
+
*
|
|
11
|
+
* Implemented with `scroll-margin-top` so we still use the browser’s native
|
|
12
|
+
* `scrollIntoView`, which scrolls every relevant scrollport (nested containers
|
|
13
|
+
* and the window). A single manual `scrollTop` on one ancestor often misses
|
|
14
|
+
* outer scroll or mis-identifies the active scroll container.
|
|
15
|
+
*/
|
|
16
|
+
var SCROLL_TOP_MARGIN_PX = 100;
|
|
17
|
+
|
|
7
18
|
/**
|
|
8
19
|
* Scrolls to the current position/selection of the document. It does the same as scrollIntoView()
|
|
9
20
|
* but without requiring the focus on the editor, thus it can be called at any time.
|
|
10
21
|
*/
|
|
11
|
-
function scrollToSelection(
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
function scrollToSelection(node) {
|
|
23
|
+
var element = node instanceof Element ? node : (node === null || node === void 0 ? void 0 : node.parentElement) instanceof Element ? node.parentElement : null;
|
|
24
|
+
if (!(element instanceof HTMLElement)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// scroll-margin is included in scroll-into-view math; it does not change layout.
|
|
29
|
+
var previousScrollMarginTop = element.style.scrollMarginTop;
|
|
30
|
+
element.style.scrollMarginTop = "".concat(SCROLL_TOP_MARGIN_PX, "px");
|
|
31
|
+
try {
|
|
32
|
+
element.scrollIntoView({
|
|
16
33
|
behavior: 'smooth',
|
|
17
|
-
block: '
|
|
34
|
+
block: 'start'
|
|
18
35
|
});
|
|
36
|
+
} finally {
|
|
37
|
+
element.style.scrollMarginTop = previousScrollMarginTop;
|
|
19
38
|
}
|
|
20
39
|
}
|
|
21
40
|
|
|
22
41
|
/**
|
|
23
|
-
*
|
|
42
|
+
* Schedules scrolling to the decoration at the given index after the next frame.
|
|
43
|
+
*
|
|
44
|
+
* @returns A function that cancels the scheduled `requestAnimationFrame` if it has not run yet.
|
|
24
45
|
*/
|
|
25
46
|
var scrollToActiveDecoration = exports.scrollToActiveDecoration = function scrollToActiveDecoration(view, decorations, activeIndex) {
|
|
26
47
|
var decoration = decorations[activeIndex];
|
|
27
48
|
if (!decoration) {
|
|
28
|
-
return;
|
|
49
|
+
return function () {};
|
|
29
50
|
}
|
|
30
|
-
|
|
51
|
+
var rafId = requestAnimationFrame(function () {
|
|
52
|
+
var _decoration$spec;
|
|
53
|
+
rafId = null;
|
|
54
|
+
if (((_decoration$spec = decoration.spec) === null || _decoration$spec === void 0 ? void 0 : _decoration$spec.key) === 'diff-widget-active') {
|
|
55
|
+
var _decoration$type;
|
|
56
|
+
// @ts-expect-error - decoration.type is not typed public API
|
|
57
|
+
var widgetDom = decoration === null || decoration === void 0 || (_decoration$type = decoration.type) === null || _decoration$type === void 0 ? void 0 : _decoration$type.toDOM;
|
|
58
|
+
scrollToSelection(widgetDom);
|
|
59
|
+
} else {
|
|
60
|
+
var _view$domAtPos;
|
|
61
|
+
var targetNode = view.nodeDOM(decoration === null || decoration === void 0 ? void 0 : decoration.from);
|
|
62
|
+
var node = targetNode instanceof Element ? targetNode : (_view$domAtPos = view.domAtPos(decoration === null || decoration === void 0 ? void 0 : decoration.from)) === null || _view$domAtPos === void 0 ? void 0 : _view$domAtPos.node;
|
|
63
|
+
scrollToSelection(node);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return function () {
|
|
67
|
+
if (rafId !== null) {
|
|
68
|
+
cancelAnimationFrame(rafId);
|
|
69
|
+
rafId = null;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
31
72
|
};
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.showDiffPlugin = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
+
var _getScrollableDecorations = require("./pm-plugins/getScrollableDecorations");
|
|
10
11
|
var _main = require("./pm-plugins/main");
|
|
11
12
|
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; }
|
|
12
13
|
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; }
|
|
@@ -62,7 +63,7 @@ var showDiffPlugin = exports.showDiffPlugin = function showDiffPlugin(_ref) {
|
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
65
|
var pluginState = _main.showDiffPluginKey.getState(editorState);
|
|
65
|
-
var decorationCount = (0, _platformFeatureFlags.fg)('platform_editor_show_diff_scroll_navigation') ? (0,
|
|
66
|
+
var decorationCount = (0, _platformFeatureFlags.fg)('platform_editor_show_diff_scroll_navigation') ? (0, _getScrollableDecorations.getScrollableDecorations)(pluginState === null || pluginState === void 0 ? void 0 : pluginState.decorations, editorState.doc) : (pluginState === null || pluginState === void 0 || (_pluginState$decorati = pluginState.decorations) === null || _pluginState$decorati === void 0 ? void 0 : _pluginState$decorati.find()) || [];
|
|
66
67
|
return {
|
|
67
68
|
isDisplayingChanges: decorationCount.length > 0,
|
|
68
69
|
activeIndex: pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex,
|
|
@@ -155,7 +155,6 @@ const calculateDiffDecorationsInner = ({
|
|
|
155
155
|
}));
|
|
156
156
|
}
|
|
157
157
|
if (change.deleted.length > 0) {
|
|
158
|
-
const isActive = activeIndexPos && change.fromB === activeIndexPos.from && change.fromB === activeIndexPos.to;
|
|
159
158
|
const decoration = createNodeChangedDecorationWidget({
|
|
160
159
|
change,
|
|
161
160
|
doc: originalDoc,
|
|
@@ -163,7 +162,7 @@ const calculateDiffDecorationsInner = ({
|
|
|
163
162
|
colorScheme,
|
|
164
163
|
newDoc: tr.doc,
|
|
165
164
|
intl,
|
|
166
|
-
|
|
165
|
+
activeIndexPos,
|
|
167
166
|
...(expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) && {
|
|
168
167
|
isInserted: !isInserted
|
|
169
168
|
})
|
|
@@ -59,14 +59,32 @@ export const deletedStyleQuoteNodeWithLozenge = convertToInlineCss({
|
|
|
59
59
|
boxShadow: `0 0 0 1px ${"var(--ds-border-accent-gray, #7D818A)"}`,
|
|
60
60
|
borderRadius: "var(--ds-radius-small, 4px)"
|
|
61
61
|
});
|
|
62
|
+
|
|
63
|
+
/** Stronger outline when this deleted block decoration is the active scroll target */
|
|
64
|
+
export const deletedStyleQuoteNodeWithLozengeActive = convertToInlineCss({
|
|
65
|
+
marginTop: "var(--ds-space-150, 12px)",
|
|
66
|
+
paddingTop: "var(--ds-space-025, 2px)",
|
|
67
|
+
paddingBottom: "var(--ds-space-025, 2px)",
|
|
68
|
+
paddingLeft: "var(--ds-space-025, 2px)",
|
|
69
|
+
boxShadow: `0 0 0 2px ${"var(--ds-border-accent-red, #E2483D)"}`,
|
|
70
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
71
|
+
});
|
|
62
72
|
export const deletedBlockOutline = convertToInlineCss({
|
|
63
73
|
boxShadow: `0 0 0 1px ${"var(--ds-border-accent-gray, #7D818A)"}`,
|
|
64
74
|
borderRadius: "var(--ds-radius-small, 4px)"
|
|
65
75
|
});
|
|
76
|
+
export const deletedBlockOutlineActive = convertToInlineCss({
|
|
77
|
+
boxShadow: `0 0 0 2px ${"var(--ds-border-accent-red, #E2483D)"}`,
|
|
78
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
79
|
+
});
|
|
66
80
|
export const deletedBlockOutlineRounded = convertToInlineCss({
|
|
67
81
|
boxShadow: `0 0 0 1px ${"var(--ds-border-accent-gray, #7D818A)"}`,
|
|
68
82
|
borderRadius: `calc(${"var(--ds-radius-xsmall, 2px)"} + 1px)`
|
|
69
83
|
});
|
|
84
|
+
export const deletedBlockOutlineRoundedActive = convertToInlineCss({
|
|
85
|
+
boxShadow: `0 0 0 2px ${"var(--ds-border-accent-red, #E2483D)"}`,
|
|
86
|
+
borderRadius: `calc(${"var(--ds-radius-xsmall, 2px)"} + 1px)`
|
|
87
|
+
});
|
|
70
88
|
export const deletedRowStyle = convertToInlineCss({
|
|
71
89
|
color: "var(--ds-text-accent-gray, #505258)",
|
|
72
90
|
textDecoration: 'line-through',
|
|
@@ -44,7 +44,7 @@ export const deletedTraditionalContentStyleUnboundedActive = convertToInlineCss(
|
|
|
44
44
|
top: '50%',
|
|
45
45
|
width: '100%',
|
|
46
46
|
display: 'inline-block',
|
|
47
|
-
borderTop: `
|
|
47
|
+
borderTop: `2px solid ${"var(--ds-border-accent-red, #E2483D)"}`,
|
|
48
48
|
pointerEvents: 'none',
|
|
49
49
|
zIndex: 1
|
|
50
50
|
});
|
|
@@ -56,14 +56,30 @@ export const deletedTraditionalStyleQuoteNode = convertToInlineCss({
|
|
|
56
56
|
boxShadow: `0 0 0 1px ${"var(--ds-border-accent-red, #E2483D)"}`,
|
|
57
57
|
borderRadius: "var(--ds-radius-small, 4px)"
|
|
58
58
|
});
|
|
59
|
+
export const deletedTraditionalStyleQuoteNodeActive = convertToInlineCss({
|
|
60
|
+
marginTop: "var(--ds-space-150, 12px)",
|
|
61
|
+
paddingTop: "var(--ds-space-025, 2px)",
|
|
62
|
+
paddingBottom: "var(--ds-space-025, 2px)",
|
|
63
|
+
paddingLeft: "var(--ds-space-025, 2px)",
|
|
64
|
+
boxShadow: `0 0 0 2px ${"var(--ds-border-accent-red, #E2483D)"}`,
|
|
65
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
66
|
+
});
|
|
59
67
|
export const deletedTraditionalBlockOutline = convertToInlineCss({
|
|
60
68
|
boxShadow: `0 0 0 1px ${"var(--ds-border-accent-red, #E2483D)"}`,
|
|
61
69
|
borderRadius: "var(--ds-radius-small, 4px)"
|
|
62
70
|
});
|
|
71
|
+
export const deletedTraditionalBlockOutlineActive = convertToInlineCss({
|
|
72
|
+
boxShadow: `0 0 0 2px ${"var(--ds-border-accent-red, #E2483D)"}`,
|
|
73
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
74
|
+
});
|
|
63
75
|
export const deletedTraditionalBlockOutlineRounded = convertToInlineCss({
|
|
64
76
|
boxShadow: `0 0 0 1px ${"var(--ds-border-accent-red, #E2483D)"}`,
|
|
65
77
|
borderRadius: `calc(${"var(--ds-radius-xsmall, 2px)"} + 1px)`
|
|
66
78
|
});
|
|
79
|
+
export const deletedTraditionalBlockOutlineRoundedActive = convertToInlineCss({
|
|
80
|
+
boxShadow: `0 0 0 2px ${"var(--ds-border-accent-red, #E2483D)"}`,
|
|
81
|
+
borderRadius: `calc(${"var(--ds-radius-xsmall, 2px)"} + 1px)`
|
|
82
|
+
});
|
|
67
83
|
export const deletedTraditionalRowStyle = convertToInlineCss({
|
|
68
84
|
textDecorationColor: "var(--ds-border-accent-red, #E2483D)",
|
|
69
85
|
textDecoration: 'line-through',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
import { editingStyle, editingStyleActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleNewActive, deletedContentStyleUnbounded } from './colorSchemes/standard';
|
|
5
6
|
import { traditionalInsertStyle, traditionalInsertStyleActive, deletedTraditionalContentStyle, deletedTraditionalContentStyleActive, deletedTraditionalContentStyleUnbounded, deletedTraditionalContentStyleUnboundedActive } from './colorSchemes/traditional';
|
|
@@ -74,13 +75,13 @@ const createContentWrapper = (colorScheme, isActive = false, isInserted = false)
|
|
|
74
75
|
} else {
|
|
75
76
|
wrapper.setAttribute('style', `${baseStyle}${getDeletedContentStyle(colorScheme, isActive)}`);
|
|
76
77
|
const strikethrough = document.createElement('span');
|
|
77
|
-
strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colorScheme));
|
|
78
|
+
strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colorScheme, isActive));
|
|
78
79
|
wrapper.append(strikethrough);
|
|
79
80
|
}
|
|
80
81
|
} else {
|
|
81
82
|
wrapper.setAttribute('style', `${baseStyle}${getDeletedContentStyle(colorScheme, isActive)}`);
|
|
82
83
|
const strikethrough = document.createElement('span');
|
|
83
|
-
strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colorScheme));
|
|
84
|
+
strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colorScheme, isActive));
|
|
84
85
|
wrapper.append(strikethrough);
|
|
85
86
|
}
|
|
86
87
|
return wrapper;
|
|
@@ -97,12 +98,18 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
97
98
|
colorScheme,
|
|
98
99
|
newDoc,
|
|
99
100
|
intl,
|
|
100
|
-
|
|
101
|
+
activeIndexPos,
|
|
101
102
|
// This is false by default as this is generally used to show deleted content
|
|
102
103
|
isInserted = false
|
|
103
104
|
}) => {
|
|
105
|
+
var _slice$content, _slice$content2, _slice$content2$first, _slice$content3, _slice$content3$first;
|
|
104
106
|
const slice = doc.slice(change.fromA, change.toA);
|
|
105
|
-
|
|
107
|
+
const shouldSkipDeletedEmptyParagraphDecoration = !isInserted && (slice === null || slice === void 0 ? void 0 : (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.childCount) === 1 && (slice === null || slice === void 0 ? void 0 : (_slice$content2 = slice.content) === null || _slice$content2 === void 0 ? void 0 : (_slice$content2$first = _slice$content2.firstChild) === null || _slice$content2$first === void 0 ? void 0 : _slice$content2$first.type.name) === 'paragraph' && (slice === null || slice === void 0 ? void 0 : (_slice$content3 = slice.content) === null || _slice$content3 === void 0 ? void 0 : (_slice$content3$first = _slice$content3.firstChild) === null || _slice$content3$first === void 0 ? void 0 : _slice$content3$first.content.size) === 0 && fg('platform_editor_show_diff_scroll_navigation');
|
|
108
|
+
// Widget decoration used for deletions as the content is not in the document
|
|
109
|
+
// and we want to display the deleted content with a style.
|
|
110
|
+
const safeInsertPos = findSafeInsertPos(newDoc, change.fromB, slice);
|
|
111
|
+
const isActive = activeIndexPos && safeInsertPos === activeIndexPos.from && safeInsertPos === activeIndexPos.to;
|
|
112
|
+
if (slice.content.content.length === 0 || shouldSkipDeletedEmptyParagraphDecoration) {
|
|
106
113
|
return;
|
|
107
114
|
}
|
|
108
115
|
const isTableCellContent = slice.content.content.some(() => slice.content.content.some(siblingNode => ['tableHeader', 'tableCell'].includes(siblingNode.type.name)));
|
|
@@ -198,6 +205,7 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
198
205
|
targetNode: node,
|
|
199
206
|
colorScheme,
|
|
200
207
|
intl,
|
|
208
|
+
isActive,
|
|
201
209
|
isInserted
|
|
202
210
|
});
|
|
203
211
|
}
|
|
@@ -207,7 +215,7 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
207
215
|
} else {
|
|
208
216
|
const fallbackNode = fallbackSerialization();
|
|
209
217
|
if (fallbackNode) {
|
|
210
|
-
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
218
|
+
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) || fg('platform_editor_show_diff_scroll_navigation')) {
|
|
211
219
|
if (fallbackNode instanceof HTMLElement) {
|
|
212
220
|
const injectedNode = injectInnerWrapper({
|
|
213
221
|
node: fallbackNode,
|
|
@@ -230,10 +238,6 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
230
238
|
}
|
|
231
239
|
});
|
|
232
240
|
dom.setAttribute('data-testid', 'show-diff-deleted-decoration');
|
|
233
|
-
|
|
234
|
-
// Widget decoration used for deletions as the content is not in the document
|
|
235
|
-
// and we want to display the deleted content with a style.
|
|
236
|
-
const safeInsertPos = findSafeInsertPos(newDoc, change.fromB, slice);
|
|
237
241
|
const decorations = [];
|
|
238
242
|
decorations.push(Decoration.widget(safeInsertPos, dom, {
|
|
239
243
|
key: `diff-widget-${isActive ? 'active' : 'inactive'}`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
2
|
import { trackChangesMessages } from '@atlaskit/editor-common/messages';
|
|
3
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
-
import { deletedBlockOutline, deletedBlockOutlineRounded, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleNewActive, deletedStyleQuoteNodeWithLozenge, editingStyle, editingStyleActive, editingStyleNode, addedCellOverlayStyle, deletedCellOverlayStyle } from '../colorSchemes/standard';
|
|
5
|
-
import { deletedTraditionalBlockOutline, deletedTraditionalBlockOutlineRounded, deletedTraditionalContentStyle, deletedTraditionalStyleQuoteNode, traditionalInsertStyle, traditionalInsertStyleActive, traditionalStyleNode, traditionalAddedCellOverlayStyle, deletedTraditionalCellOverlayStyle } from '../colorSchemes/traditional';
|
|
4
|
+
import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleNewActive, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingStyle, editingStyleActive, editingStyleNode, addedCellOverlayStyle, deletedCellOverlayStyle } from '../colorSchemes/standard';
|
|
5
|
+
import { deletedTraditionalBlockOutline, deletedTraditionalBlockOutlineActive, deletedTraditionalBlockOutlineRounded, deletedTraditionalBlockOutlineRoundedActive, deletedTraditionalContentStyle, deletedTraditionalContentStyleActive, deletedTraditionalStyleQuoteNode, deletedTraditionalStyleQuoteNodeActive, traditionalInsertStyle, traditionalInsertStyleActive, traditionalStyleNode, traditionalAddedCellOverlayStyle, deletedTraditionalCellOverlayStyle } from '../colorSchemes/traditional';
|
|
6
6
|
const lozengeStyle = convertToInlineCss({
|
|
7
7
|
display: 'inline-flex',
|
|
8
8
|
boxSizing: 'border-box',
|
|
@@ -19,6 +19,38 @@ const lozengeStyle = convertToInlineCss({
|
|
|
19
19
|
whiteSpace: 'nowrap',
|
|
20
20
|
color: "var(--ds-text-warning-inverse, #292A2E)"
|
|
21
21
|
});
|
|
22
|
+
const lozengeStyleActiveStandard = convertToInlineCss({
|
|
23
|
+
display: 'inline-flex',
|
|
24
|
+
boxSizing: 'border-box',
|
|
25
|
+
position: 'static',
|
|
26
|
+
blockSize: 'min-content',
|
|
27
|
+
borderRadius: "var(--ds-radius-small, 4px)",
|
|
28
|
+
overflow: 'hidden',
|
|
29
|
+
paddingInlineStart: "var(--ds-space-050, 4px)",
|
|
30
|
+
paddingInlineEnd: "var(--ds-space-050, 4px)",
|
|
31
|
+
backgroundColor: "var(--ds-background-accent-red-subtler-pressed, #FD9891)",
|
|
32
|
+
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)",
|
|
33
|
+
fontWeight: "var(--ds-font-weight-bold, 653)",
|
|
34
|
+
textOverflow: 'ellipsis',
|
|
35
|
+
whiteSpace: 'nowrap',
|
|
36
|
+
color: "var(--ds-text-warning-inverse, #292A2E)"
|
|
37
|
+
});
|
|
38
|
+
const lozengeStyleActiveTraditional = convertToInlineCss({
|
|
39
|
+
display: 'inline-flex',
|
|
40
|
+
boxSizing: 'border-box',
|
|
41
|
+
position: 'static',
|
|
42
|
+
blockSize: 'min-content',
|
|
43
|
+
borderRadius: "var(--ds-radius-small, 4px)",
|
|
44
|
+
overflow: 'hidden',
|
|
45
|
+
paddingInlineStart: "var(--ds-space-050, 4px)",
|
|
46
|
+
paddingInlineEnd: "var(--ds-space-050, 4px)",
|
|
47
|
+
backgroundColor: "var(--ds-background-accent-red-subtler-pressed, #FD9891)",
|
|
48
|
+
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)",
|
|
49
|
+
fontWeight: "var(--ds-font-weight-bold, 653)",
|
|
50
|
+
textOverflow: 'ellipsis',
|
|
51
|
+
whiteSpace: 'nowrap',
|
|
52
|
+
color: "var(--ds-text-warning-inverse, #292A2E)"
|
|
53
|
+
});
|
|
22
54
|
const getChangedContentStyle = (colorScheme, isActive = false, isInserted = false) => {
|
|
23
55
|
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) && isInserted) {
|
|
24
56
|
if (colorScheme === 'traditional') {
|
|
@@ -27,14 +59,14 @@ const getChangedContentStyle = (colorScheme, isActive = false, isInserted = fals
|
|
|
27
59
|
return isActive ? editingStyleActive : editingStyle;
|
|
28
60
|
}
|
|
29
61
|
if (colorScheme === 'traditional') {
|
|
30
|
-
return deletedTraditionalContentStyle;
|
|
62
|
+
return isActive ? deletedTraditionalContentStyleActive : deletedTraditionalContentStyle;
|
|
31
63
|
}
|
|
32
64
|
if (isActive) {
|
|
33
65
|
return expValEquals('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? deletedContentStyleNewActive : deletedContentStyleActive;
|
|
34
66
|
}
|
|
35
67
|
return expValEquals('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? deletedContentStyleNew : deletedContentStyle;
|
|
36
68
|
};
|
|
37
|
-
const getChangedNodeStyle = (nodeName, colorScheme, isInserted = false) => {
|
|
69
|
+
const getChangedNodeStyle = (nodeName, colorScheme, isInserted = false, isActive = false) => {
|
|
38
70
|
const isTraditional = colorScheme === 'traditional';
|
|
39
71
|
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) && isInserted) {
|
|
40
72
|
if (shouldApplyStylesDirectly(nodeName)) {
|
|
@@ -47,13 +79,22 @@ const getChangedNodeStyle = (nodeName, colorScheme, isInserted = false) => {
|
|
|
47
79
|
}
|
|
48
80
|
switch (nodeName) {
|
|
49
81
|
case 'blockquote':
|
|
50
|
-
|
|
82
|
+
if (isTraditional) {
|
|
83
|
+
return isActive ? deletedTraditionalStyleQuoteNodeActive : deletedTraditionalStyleQuoteNode;
|
|
84
|
+
}
|
|
85
|
+
return isActive ? deletedStyleQuoteNodeWithLozengeActive : deletedStyleQuoteNodeWithLozenge;
|
|
51
86
|
case 'expand':
|
|
52
87
|
case 'decisionList':
|
|
53
|
-
|
|
88
|
+
if (isTraditional) {
|
|
89
|
+
return isActive ? deletedTraditionalBlockOutlineActive : deletedTraditionalBlockOutline;
|
|
90
|
+
}
|
|
91
|
+
return isActive ? deletedBlockOutlineActive : deletedBlockOutline;
|
|
54
92
|
case 'panel':
|
|
55
93
|
case 'codeBlock':
|
|
56
|
-
|
|
94
|
+
if (isTraditional) {
|
|
95
|
+
return isActive ? deletedTraditionalBlockOutlineRoundedActive : deletedTraditionalBlockOutlineRounded;
|
|
96
|
+
}
|
|
97
|
+
return isActive ? deletedBlockOutlineRoundedActive : deletedBlockOutlineRounded;
|
|
57
98
|
default:
|
|
58
99
|
return undefined;
|
|
59
100
|
}
|
|
@@ -106,7 +147,7 @@ const applyCellOverlayStyles = ({
|
|
|
106
147
|
/**
|
|
107
148
|
* Creates a "Removed" lozenge to be displayed at the top right corner of deleted block nodes
|
|
108
149
|
*/
|
|
109
|
-
const createRemovedLozenge = intl => {
|
|
150
|
+
const createRemovedLozenge = (intl, isActive = false, colorScheme) => {
|
|
110
151
|
const container = document.createElement('span');
|
|
111
152
|
const containerStyle = convertToInlineCss({
|
|
112
153
|
position: 'absolute',
|
|
@@ -121,7 +162,8 @@ const createRemovedLozenge = intl => {
|
|
|
121
162
|
|
|
122
163
|
// Create vanilla HTML lozenge element with Atlaskit Lozenge styling (visual refresh)
|
|
123
164
|
const lozengeElement = document.createElement('span');
|
|
124
|
-
|
|
165
|
+
const lozengeInnerStyle = isActive && colorScheme === 'traditional' ? lozengeStyleActiveTraditional : isActive ? lozengeStyleActiveStandard : lozengeStyle;
|
|
166
|
+
lozengeElement.setAttribute('style', lozengeInnerStyle);
|
|
125
167
|
lozengeElement.textContent = intl.formatMessage(trackChangesMessages.removed).toUpperCase();
|
|
126
168
|
container.appendChild(lozengeElement);
|
|
127
169
|
return container;
|
|
@@ -148,11 +190,12 @@ const applyStylesToElement = ({
|
|
|
148
190
|
element,
|
|
149
191
|
targetNode,
|
|
150
192
|
colorScheme,
|
|
193
|
+
isActive,
|
|
151
194
|
isInserted
|
|
152
195
|
}) => {
|
|
153
196
|
const currentStyle = element.getAttribute('style') || '';
|
|
154
|
-
const contentStyle = getChangedContentStyle(colorScheme,
|
|
155
|
-
const nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted) || '';
|
|
197
|
+
const contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted);
|
|
198
|
+
const nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive) || '';
|
|
156
199
|
element.setAttribute('style', `${currentStyle}${contentStyle}${nodeSpecificStyle}`);
|
|
157
200
|
};
|
|
158
201
|
|
|
@@ -163,11 +206,12 @@ const createBlockNodeContentWrapper = ({
|
|
|
163
206
|
nodeView,
|
|
164
207
|
targetNode,
|
|
165
208
|
colorScheme,
|
|
209
|
+
isActive,
|
|
166
210
|
isInserted
|
|
167
211
|
}) => {
|
|
168
212
|
const contentWrapper = document.createElement('div');
|
|
169
|
-
const nodeStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted);
|
|
170
|
-
contentWrapper.setAttribute('style', `${getChangedContentStyle(colorScheme,
|
|
213
|
+
const nodeStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive);
|
|
214
|
+
contentWrapper.setAttribute('style', `${getChangedContentStyle(colorScheme, isActive, isInserted)}${nodeStyle || ''}`);
|
|
171
215
|
contentWrapper.append(nodeView);
|
|
172
216
|
return contentWrapper;
|
|
173
217
|
};
|
|
@@ -183,7 +227,8 @@ const handleEmbedCardWithLozenge = ({
|
|
|
183
227
|
nodeView,
|
|
184
228
|
targetNode,
|
|
185
229
|
lozenge,
|
|
186
|
-
colorScheme
|
|
230
|
+
colorScheme,
|
|
231
|
+
isActive = false
|
|
187
232
|
}) => {
|
|
188
233
|
if (targetNode.type.name !== 'embedCard' || !(nodeView instanceof HTMLElement)) {
|
|
189
234
|
return false;
|
|
@@ -207,6 +252,9 @@ const handleEmbedCardWithLozenge = ({
|
|
|
207
252
|
if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
|
|
208
253
|
const showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
|
|
209
254
|
nodeView.classList.add(showDiffDeletedNodeClass);
|
|
255
|
+
if (isActive) {
|
|
256
|
+
nodeView.classList.add('show-diff-deleted-active');
|
|
257
|
+
}
|
|
210
258
|
}
|
|
211
259
|
dom.append(nodeView);
|
|
212
260
|
return true;
|
|
@@ -221,7 +269,8 @@ const handleMediaSingleWithLozenge = ({
|
|
|
221
269
|
nodeView,
|
|
222
270
|
targetNode,
|
|
223
271
|
lozenge,
|
|
224
|
-
colorScheme
|
|
272
|
+
colorScheme,
|
|
273
|
+
isActive = false
|
|
225
274
|
}) => {
|
|
226
275
|
if (targetNode.type.name !== 'mediaSingle' || !(nodeView instanceof HTMLElement)) {
|
|
227
276
|
return false;
|
|
@@ -243,6 +292,9 @@ const handleMediaSingleWithLozenge = ({
|
|
|
243
292
|
if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
|
|
244
293
|
const showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
|
|
245
294
|
nodeView.classList.add(showDiffDeletedNodeClass);
|
|
295
|
+
if (isActive) {
|
|
296
|
+
nodeView.classList.add('show-diff-deleted-active');
|
|
297
|
+
}
|
|
246
298
|
}
|
|
247
299
|
dom.append(nodeView);
|
|
248
300
|
return true;
|
|
@@ -257,17 +309,19 @@ const wrapBlockNode = ({
|
|
|
257
309
|
targetNode,
|
|
258
310
|
colorScheme,
|
|
259
311
|
intl,
|
|
312
|
+
isActive = false,
|
|
260
313
|
isInserted = false
|
|
261
314
|
}) => {
|
|
262
315
|
const blockWrapper = createBlockNodeWrapper();
|
|
263
316
|
if (shouldShowRemovedLozenge(targetNode.type.name) && (!expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) || !isInserted)) {
|
|
264
|
-
const lozenge = createRemovedLozenge(intl);
|
|
317
|
+
const lozenge = createRemovedLozenge(intl, isActive, colorScheme);
|
|
265
318
|
if (handleEmbedCardWithLozenge({
|
|
266
319
|
dom,
|
|
267
320
|
nodeView,
|
|
268
321
|
targetNode,
|
|
269
322
|
lozenge,
|
|
270
|
-
colorScheme
|
|
323
|
+
colorScheme,
|
|
324
|
+
isActive
|
|
271
325
|
})) {
|
|
272
326
|
return;
|
|
273
327
|
}
|
|
@@ -276,7 +330,8 @@ const wrapBlockNode = ({
|
|
|
276
330
|
nodeView,
|
|
277
331
|
targetNode,
|
|
278
332
|
lozenge,
|
|
279
|
-
colorScheme
|
|
333
|
+
colorScheme,
|
|
334
|
+
isActive
|
|
280
335
|
})) {
|
|
281
336
|
return;
|
|
282
337
|
}
|
|
@@ -286,12 +341,16 @@ const wrapBlockNode = ({
|
|
|
286
341
|
nodeView,
|
|
287
342
|
targetNode,
|
|
288
343
|
colorScheme,
|
|
344
|
+
isActive,
|
|
289
345
|
isInserted
|
|
290
346
|
});
|
|
291
347
|
blockWrapper.append(contentWrapper);
|
|
292
348
|
if (nodeView instanceof HTMLElement && shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
|
|
293
349
|
const showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
|
|
294
350
|
nodeView.classList.add(showDiffDeletedNodeClass);
|
|
351
|
+
if (isActive) {
|
|
352
|
+
nodeView.classList.add('show-diff-deleted-active');
|
|
353
|
+
}
|
|
295
354
|
}
|
|
296
355
|
dom.append(blockWrapper);
|
|
297
356
|
};
|
|
@@ -307,6 +366,7 @@ export const wrapBlockNodeView = ({
|
|
|
307
366
|
targetNode,
|
|
308
367
|
colorScheme,
|
|
309
368
|
intl,
|
|
369
|
+
isActive = false,
|
|
310
370
|
isInserted = false
|
|
311
371
|
}) => {
|
|
312
372
|
if (shouldApplyStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
|
|
@@ -315,6 +375,7 @@ export const wrapBlockNodeView = ({
|
|
|
315
375
|
element: nodeView,
|
|
316
376
|
targetNode,
|
|
317
377
|
colorScheme,
|
|
378
|
+
isActive,
|
|
318
379
|
isInserted
|
|
319
380
|
});
|
|
320
381
|
dom.append(nodeView);
|
|
@@ -333,6 +394,7 @@ export const wrapBlockNodeView = ({
|
|
|
333
394
|
targetNode,
|
|
334
395
|
colorScheme,
|
|
335
396
|
intl,
|
|
397
|
+
isActive,
|
|
336
398
|
isInserted
|
|
337
399
|
});
|
|
338
400
|
}
|