@atlaskit/editor-plugin-show-diff 6.1.1 → 6.1.3

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/pm-plugins/calculateDiffDecorations.js +17 -8
  3. package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +1 -1
  4. package/dist/cjs/pm-plugins/decorations/colorSchemes/traditional.js +39 -2
  5. package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +34 -26
  6. package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +10 -4
  7. package/dist/cjs/pm-plugins/main.js +7 -4
  8. package/dist/es2019/pm-plugins/calculateDiffDecorations.js +16 -8
  9. package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +1 -1
  10. package/dist/es2019/pm-plugins/decorations/colorSchemes/traditional.js +38 -1
  11. package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +33 -27
  12. package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +13 -6
  13. package/dist/es2019/pm-plugins/main.js +5 -2
  14. package/dist/esm/pm-plugins/calculateDiffDecorations.js +17 -8
  15. package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +1 -1
  16. package/dist/esm/pm-plugins/decorations/colorSchemes/traditional.js +38 -1
  17. package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +35 -27
  18. package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +11 -5
  19. package/dist/esm/pm-plugins/main.js +7 -4
  20. package/dist/types/pm-plugins/decorations/colorSchemes/traditional.d.ts +9 -0
  21. package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.d.ts +8 -5
  22. package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +1 -1
  23. package/dist/types-ts4.5/pm-plugins/decorations/colorSchemes/traditional.d.ts +9 -0
  24. package/dist/types-ts4.5/pm-plugins/decorations/createBlockChangedDecoration.d.ts +8 -5
  25. package/dist/types-ts4.5/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +1 -1
  26. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 6.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8c860e8e9e774`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8c860e8e9e774) -
8
+ Make active decorations more distinct
9
+
10
+ ## 6.1.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 6.1.1
4
17
 
5
18
  ### Patch Changes
@@ -31,19 +31,23 @@ var calculateNodesForBlockDecoration = function calculateNodesForBlockDecoration
31
31
  to = _ref.to,
32
32
  colorScheme = _ref.colorScheme,
33
33
  _ref$isInserted = _ref.isInserted,
34
- isInserted = _ref$isInserted === void 0 ? true : _ref$isInserted;
34
+ isInserted = _ref$isInserted === void 0 ? true : _ref$isInserted,
35
+ activeIndexPos = _ref.activeIndexPos;
35
36
  var decorations = [];
36
37
  // Iterate over the document nodes within the range
37
38
  doc.nodesBetween(from, to, function (node, pos) {
38
39
  if (node.isBlock && (!(0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) || pos + node.nodeSize <= to)) {
40
+ var nodeEnd = pos + node.nodeSize;
41
+ var isActive = activeIndexPos && pos === activeIndexPos.from && nodeEnd === activeIndexPos.to;
39
42
  var decoration = (0, _createBlockChangedDecoration.createBlockChangedDecoration)({
40
43
  change: {
41
44
  from: pos,
42
- to: pos + node.nodeSize,
45
+ to: nodeEnd,
43
46
  name: node.type.name
44
47
  },
45
48
  colorScheme: colorScheme,
46
- isInserted: isInserted
49
+ isInserted: isInserted,
50
+ isActive: isActive
47
51
  });
48
52
  if (decoration) {
49
53
  decorations.push(decoration);
@@ -147,7 +151,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref2
147
151
  var optimizedChanges = optimizeChanges(changes);
148
152
  var decorations = [];
149
153
  optimizedChanges.forEach(function (change) {
150
- var isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
154
+ var isActive = activeIndexPos && change.fromB === activeIndexPos.from && change.toB === activeIndexPos.to;
151
155
  // Our default operations are insertions, so it should match the opposite of isInverted.
152
156
  var isInserted = !isInverted;
153
157
  if (change.inserted.length > 0) {
@@ -158,17 +162,20 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref2
158
162
  }, (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) && {
159
163
  isInserted: isInserted
160
164
  })));
161
- decorations.push.apply(decorations, (0, _toConsumableArray2.default)(calculateNodesForBlockDecoration(_objectSpread({
165
+ decorations.push.apply(decorations, (0, _toConsumableArray2.default)(calculateNodesForBlockDecoration(_objectSpread(_objectSpread({
162
166
  doc: tr.doc,
163
167
  from: change.fromB,
164
168
  to: change.toB,
165
169
  colorScheme: colorScheme
166
170
  }, (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) && {
167
171
  isInserted: isInserted
172
+ }), {}, {
173
+ activeIndexPos: activeIndexPos,
174
+ intl: intl
168
175
  }))));
169
176
  }
170
177
  if (change.deleted.length > 0) {
171
- var _isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
178
+ var _isActive = activeIndexPos && change.fromB === activeIndexPos.from && change.fromB === activeIndexPos.to;
172
179
  var decoration = (0, _createNodeChangedDecorationWidget.createNodeChangedDecorationWidget)(_objectSpread({
173
180
  change: change,
174
181
  doc: originalDoc,
@@ -186,7 +193,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref2
186
193
  }
187
194
  });
188
195
  (0, _getMarkChangeRanges.getMarkChangeRanges)(steps).forEach(function (change) {
189
- var isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
196
+ var isActive = activeIndexPos && change.fromB === activeIndexPos.from && change.toB === activeIndexPos.to;
190
197
  decorations.push((0, _createInlineChangedDecoration.createInlineChangedDecoration)({
191
198
  change: change,
192
199
  colorScheme: colorScheme,
@@ -200,7 +207,9 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref2
200
207
  from: change.fromB,
201
208
  to: change.toB,
202
209
  colorScheme: colorScheme,
203
- isInserted: true
210
+ isInserted: true,
211
+ activeIndexPos: activeIndexPos,
212
+ intl: intl
204
213
  })));
205
214
  });
206
215
  return _view.DecorationSet.empty.add(tr.doc, decorations);
@@ -13,7 +13,7 @@ var editingStyle = exports.editingStyle = (0, _lazyNodeView.convertToInlineCss)(
13
13
  textDecorationColor: "var(--ds-border-accent-purple, #AF59E1)"
14
14
  });
15
15
  var editingStyleActive = exports.editingStyleActive = (0, _lazyNodeView.convertToInlineCss)({
16
- background: "var(--ds-background-accent-purple-subtler, #EED7FC)",
16
+ background: "var(--ds-background-accent-purple-subtler-pressed, #D8A0F7)",
17
17
  textDecoration: 'underline',
18
18
  textDecorationStyle: 'dotted',
19
19
  textDecorationThickness: "var(--ds-space-025, 2px)",
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.traditionalStyleRuleNode = exports.traditionalStyleQuoteNode = exports.traditionalStyleNode = exports.traditionalStyleCardBlockNode = exports.traditionalInsertStyleActive = exports.traditionalInsertStyle = exports.traditionalDecorationMarkerVariable = exports.traditionalAddedCellOverlayStyle = exports.deletedTraditionalStyleQuoteNode = exports.deletedTraditionalRowStyle = exports.deletedTraditionalContentStyleUnbounded = exports.deletedTraditionalContentStyle = exports.deletedTraditionalCellOverlayStyle = exports.deletedTraditionalBlockOutlineRounded = exports.deletedTraditionalBlockOutline = void 0;
6
+ exports.traditionalStyleRuleNodeActive = exports.traditionalStyleRuleNode = exports.traditionalStyleQuoteNodeActive = exports.traditionalStyleQuoteNode = exports.traditionalStyleNodeActive = exports.traditionalStyleNode = exports.traditionalStyleCardBlockNodeActive = exports.traditionalStyleCardBlockNode = exports.traditionalInsertStyleActive = exports.traditionalInsertStyle = exports.traditionalDecorationMarkerVariableActive = exports.traditionalDecorationMarkerVariable = exports.traditionalAddedCellOverlayStyle = exports.deletedTraditionalStyleQuoteNode = exports.deletedTraditionalRowStyle = exports.deletedTraditionalContentStyleUnboundedActive = exports.deletedTraditionalContentStyleUnbounded = exports.deletedTraditionalContentStyleActive = exports.deletedTraditionalContentStyle = exports.deletedTraditionalCellOverlayStyle = exports.deletedTraditionalBlockOutlineRounded = exports.deletedTraditionalBlockOutline = void 0;
7
7
  var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
8
8
  var traditionalInsertStyle = exports.traditionalInsertStyle = (0, _lazyNodeView.convertToInlineCss)({
9
9
  background: "var(--ds-background-accent-green-subtlest, #DCFFF1)",
@@ -13,7 +13,7 @@ var traditionalInsertStyle = exports.traditionalInsertStyle = (0, _lazyNodeView.
13
13
  textDecorationColor: "var(--ds-border-accent-green, #22A06B)"
14
14
  });
15
15
  var traditionalInsertStyleActive = exports.traditionalInsertStyleActive = (0, _lazyNodeView.convertToInlineCss)({
16
- background: "var(--ds-background-accent-green-subtler, #BAF3DB)",
16
+ background: "var(--ds-background-accent-green-subtler-pressed, #7EE2B8)",
17
17
  textDecoration: 'underline',
18
18
  textDecorationStyle: 'solid',
19
19
  textDecorationThickness: "var(--ds-space-025, 2px)",
@@ -25,6 +25,15 @@ var deletedTraditionalContentStyle = exports.deletedTraditionalContentStyle = (0
25
25
  position: 'relative',
26
26
  opacity: 1
27
27
  });
28
+
29
+ /** Emphasised (pressed) strikethrough for traditional removed text when active */
30
+ var deletedTraditionalContentStyleActive = exports.deletedTraditionalContentStyleActive = (0, _lazyNodeView.convertToInlineCss)({
31
+ textDecorationColor: "var(--ds-text-accent-red, #AE2E24)",
32
+ textDecoration: 'line-through',
33
+ backgroundColor: "var(--ds-background-accent-red-subtlest-pressed, #FFB8B2)",
34
+ position: 'relative',
35
+ opacity: 1
36
+ });
28
37
  var deletedTraditionalContentStyleUnbounded = exports.deletedTraditionalContentStyleUnbounded = (0, _lazyNodeView.convertToInlineCss)({
29
38
  position: 'absolute',
30
39
  top: '50%',
@@ -34,6 +43,17 @@ var deletedTraditionalContentStyleUnbounded = exports.deletedTraditionalContentS
34
43
  pointerEvents: 'none',
35
44
  zIndex: 1
36
45
  });
46
+
47
+ /** Emphasised (pressed) strikethrough line for traditional when active */
48
+ var deletedTraditionalContentStyleUnboundedActive = exports.deletedTraditionalContentStyleUnboundedActive = (0, _lazyNodeView.convertToInlineCss)({
49
+ position: 'absolute',
50
+ top: '50%',
51
+ width: '100%',
52
+ display: 'inline-block',
53
+ borderTop: "1px solid ".concat("var(--ds-text-accent-red-bolder, #5D1F1A)"),
54
+ pointerEvents: 'none',
55
+ zIndex: 1
56
+ });
37
57
  var deletedTraditionalStyleQuoteNode = exports.deletedTraditionalStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
38
58
  marginTop: "var(--ds-space-150, 12px)",
39
59
  paddingTop: "var(--ds-space-025, 2px)",
@@ -59,20 +79,37 @@ var deletedTraditionalRowStyle = exports.deletedTraditionalRowStyle = (0, _lazyN
59
79
  var traditionalStyleQuoteNode = exports.traditionalStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
60
80
  borderLeft: "2px solid ".concat("var(--ds-border-accent-green, #22A06B)")
61
81
  });
82
+ var traditionalStyleQuoteNodeActive = exports.traditionalStyleQuoteNodeActive = (0, _lazyNodeView.convertToInlineCss)({
83
+ borderLeft: "2px solid ".concat("var(--ds-background-accent-green-subtler-pressed, #7EE2B8)")
84
+ });
62
85
  var traditionalStyleRuleNode = exports.traditionalStyleRuleNode = (0, _lazyNodeView.convertToInlineCss)({
63
86
  backgroundColor: "var(--ds-border-accent-green, #22A06B)"
64
87
  });
88
+ var traditionalStyleRuleNodeActive = exports.traditionalStyleRuleNodeActive = (0, _lazyNodeView.convertToInlineCss)({
89
+ backgroundColor: "var(--ds-background-accent-green-subtler-pressed, #7EE2B8)"
90
+ });
65
91
  var traditionalStyleNode = exports.traditionalStyleNode = (0, _lazyNodeView.convertToInlineCss)({
66
92
  boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
67
93
  borderRadius: "var(--ds-radius-small, 4px)"
68
94
  });
95
+ var traditionalStyleNodeActive = exports.traditionalStyleNodeActive = (0, _lazyNodeView.convertToInlineCss)({
96
+ boxShadow: "0 0 0 2px ".concat("var(--ds-background-accent-green-subtler-pressed, #7EE2B8)"),
97
+ borderRadius: "var(--ds-radius-small, 4px)"
98
+ });
69
99
  var traditionalStyleCardBlockNode = exports.traditionalStyleCardBlockNode = (0, _lazyNodeView.convertToInlineCss)({
70
100
  boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
71
101
  borderRadius: "var(--ds-radius-medium, 6px)"
72
102
  });
103
+ var traditionalStyleCardBlockNodeActive = exports.traditionalStyleCardBlockNodeActive = (0, _lazyNodeView.convertToInlineCss)({
104
+ boxShadow: "0 0 0 1px ".concat("var(--ds-background-accent-green-subtler-pressed, #7EE2B8)"),
105
+ borderRadius: "var(--ds-radius-medium, 6px)"
106
+ });
73
107
  var traditionalDecorationMarkerVariable = exports.traditionalDecorationMarkerVariable = (0, _lazyNodeView.convertToInlineCss)({
74
108
  '--diff-decoration-marker-color': "var(--ds-border-accent-green, #22A06B)"
75
109
  });
110
+ var traditionalDecorationMarkerVariableActive = exports.traditionalDecorationMarkerVariableActive = (0, _lazyNodeView.convertToInlineCss)({
111
+ '--diff-decoration-marker-color': "var(--ds-text-accent-green, #216E4E)"
112
+ });
76
113
  var traditionalAddedCellOverlayStyle = exports.traditionalAddedCellOverlayStyle = (0, _lazyNodeView.convertToInlineCss)({
77
114
  position: 'absolute',
78
115
  top: 0,
@@ -21,7 +21,9 @@ var getBlockNodeStyle = function getBlockNodeStyle(_ref) {
21
21
  var nodeName = _ref.nodeName,
22
22
  colorScheme = _ref.colorScheme,
23
23
  _ref$isInserted = _ref.isInserted,
24
- isInserted = _ref$isInserted === void 0 ? true : _ref$isInserted;
24
+ isInserted = _ref$isInserted === void 0 ? true : _ref$isInserted,
25
+ _ref$isActive = _ref.isActive,
26
+ isActive = _ref$isActive === void 0 ? false : _ref$isActive;
25
27
  var isTraditional = colorScheme === 'traditional';
26
28
  if (['mediaSingle', 'mediaGroup', 'table',
27
29
  // Handle table separately to avoid border issues
@@ -34,73 +36,79 @@ var getBlockNodeStyle = function getBlockNodeStyle(_ref) {
34
36
  if (['extension', 'embedCard', 'listItem'].includes(nodeName)) {
35
37
  if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
36
38
  if (isInserted) {
37
- return isTraditional ? _traditional.traditionalDecorationMarkerVariable : _standard.standardDecorationMarkerVariable;
39
+ return isTraditional && isActive ? _traditional.traditionalDecorationMarkerVariableActive : isTraditional ? _traditional.traditionalDecorationMarkerVariable : _standard.standardDecorationMarkerVariable;
38
40
  } else {
39
41
  return isTraditional ? _traditional.deletedTraditionalContentStyle : _standard.deletedContentStyleNew;
40
42
  }
41
43
  }
42
- return isTraditional ? _traditional.traditionalDecorationMarkerVariable : _standard.standardDecorationMarkerVariable;
44
+ return isTraditional && isActive ? _traditional.traditionalDecorationMarkerVariableActive : isTraditional ? _traditional.traditionalDecorationMarkerVariable : _standard.standardDecorationMarkerVariable;
43
45
  }
44
46
  if (nodeName === 'blockquote') {
45
47
  if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
46
48
  if (isInserted) {
47
- return isTraditional ? _traditional.traditionalStyleQuoteNode : _standard.editingStyleQuoteNode;
49
+ return isTraditional ? isActive ? _traditional.traditionalStyleQuoteNodeActive : _traditional.traditionalStyleQuoteNode : _standard.editingStyleQuoteNode;
48
50
  } else {
49
51
  return isTraditional ? _traditional.deletedTraditionalStyleQuoteNode : _standard.deletedStyleQuoteNode;
50
52
  }
51
53
  }
52
- return isTraditional ? _traditional.traditionalStyleQuoteNode : _standard.editingStyleQuoteNode;
54
+ return isTraditional ? isActive ? _traditional.traditionalStyleQuoteNodeActive : _traditional.traditionalStyleQuoteNode : _standard.editingStyleQuoteNode;
53
55
  }
54
56
  if (nodeName === 'rule') {
55
57
  if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
56
58
  if (isInserted) {
57
- return isTraditional ? _traditional.traditionalStyleRuleNode : _standard.editingStyleRuleNode;
59
+ return isTraditional ? isActive ? _traditional.traditionalStyleRuleNodeActive : _traditional.traditionalStyleRuleNode : _standard.editingStyleRuleNode;
58
60
  } else {
59
61
  return isTraditional ? _traditional.deletedTraditionalContentStyle : _standard.deletedContentStyleNew;
60
62
  }
61
63
  }
62
- return isTraditional ? _traditional.traditionalStyleRuleNode : _standard.editingStyleRuleNode;
64
+ return isTraditional ? isActive ? _traditional.traditionalStyleRuleNodeActive : _traditional.traditionalStyleRuleNode : _standard.editingStyleRuleNode;
63
65
  }
64
66
  if (nodeName === 'blockCard') {
65
67
  if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
66
68
  if (isInserted) {
67
- return isTraditional ? _traditional.traditionalStyleCardBlockNode : _standard.editingStyleCardBlockNode;
69
+ return isTraditional ? isActive ? _traditional.traditionalStyleCardBlockNodeActive : _traditional.traditionalStyleCardBlockNode : _standard.editingStyleCardBlockNode;
68
70
  } else {
69
71
  return isTraditional ? _traditional.deletedTraditionalContentStyle : _standard.deletedContentStyleNew;
70
72
  }
71
73
  }
72
- return isTraditional ? _traditional.traditionalStyleCardBlockNode : _standard.editingStyleCardBlockNode;
74
+ return isTraditional ? isActive ? _traditional.traditionalStyleCardBlockNodeActive : _traditional.traditionalStyleCardBlockNode : _standard.editingStyleCardBlockNode;
73
75
  }
74
76
  if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
75
77
  if (isInserted) {
76
- return isTraditional ? _traditional.traditionalStyleNode : _standard.editingStyleNode;
78
+ return isTraditional ? isActive ? _traditional.traditionalStyleNodeActive : _traditional.traditionalStyleNode : _standard.editingStyleNode;
77
79
  } else {
78
80
  return isTraditional ? _traditional.deletedTraditionalContentStyle : _standard.deletedContentStyleNew;
79
81
  }
80
82
  }
81
- return isTraditional ? _traditional.traditionalStyleNode : _standard.editingStyleNode;
83
+ return isTraditional ? isActive ? _traditional.traditionalStyleNodeActive : _traditional.traditionalStyleNode : _standard.editingStyleNode;
82
84
  };
83
85
 
84
86
  /**
85
- * Inline decoration used for insertions as the content already exists in the document
87
+ * Node decoration used for block-level insertions. When isActive, uses emphasised (pressed) styling.
86
88
  *
87
- * @param change Changeset "change" containing information about the change content + range
88
- * @returns Prosemirror inline decoration
89
+ * @param change Node range and name
90
+ * @param colorScheme Optional color scheme
91
+ * @param isActive Whether this node is part of the currently active/focused change
92
+ * @returns Prosemirror node decoration or undefined
89
93
  */
90
94
  var createBlockChangedDecoration = exports.createBlockChangedDecoration = function createBlockChangedDecoration(_ref2) {
91
95
  var change = _ref2.change,
92
96
  colorScheme = _ref2.colorScheme,
93
97
  _ref2$isInserted = _ref2.isInserted,
94
- isInserted = _ref2$isInserted === void 0 ? true : _ref2$isInserted;
98
+ isInserted = _ref2$isInserted === void 0 ? true : _ref2$isInserted,
99
+ _ref2$isActive = _ref2.isActive,
100
+ isActive = _ref2$isActive === void 0 ? false : _ref2$isActive;
95
101
  var style = getBlockNodeStyle({
96
102
  nodeName: change.name,
97
- colorScheme: colorScheme
103
+ colorScheme: colorScheme,
104
+ isActive: isActive
98
105
  });
99
106
  if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
100
107
  style = getBlockNodeStyle({
101
108
  nodeName: change.name,
102
109
  colorScheme: colorScheme,
103
- isInserted: isInserted
110
+ isInserted: isInserted,
111
+ isActive: isActive
104
112
  });
105
113
  }
106
114
  var className = getNodeClass(change.name);
@@ -113,15 +121,15 @@ var createBlockChangedDecoration = exports.createBlockChangedDecoration = functi
113
121
  }, {
114
122
  key: 'diff-block'
115
123
  });
124
+ } else {
125
+ return undefined;
116
126
  }
117
- return undefined;
118
- } else {
119
- return _view.Decoration.node(change.from, change.to, {
120
- style: style,
121
- 'data-testid': 'show-diff-changed-decoration-node',
122
- class: className
123
- }, {
124
- key: 'diff-block'
125
- });
126
127
  }
128
+ return _view.Decoration.node(change.from, change.to, {
129
+ style: style,
130
+ 'data-testid': 'show-diff-changed-decoration-node',
131
+ class: className
132
+ }, {
133
+ key: 'diff-block'
134
+ });
127
135
  };
@@ -15,6 +15,10 @@ var _createChangedRowDecorationWidgets = require("./createChangedRowDecorationWi
15
15
  var _findSafeInsertPos = require("./utils/findSafeInsertPos");
16
16
  var _wrapBlockNodeView = require("./utils/wrapBlockNodeView");
17
17
  var getDeletedContentStyleUnbounded = function getDeletedContentStyleUnbounded(colorScheme) {
18
+ var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
19
+ if (colorScheme === 'traditional' && isActive) {
20
+ return _traditional.deletedTraditionalContentStyleUnboundedActive;
21
+ }
18
22
  return colorScheme === 'traditional' ? _traditional.deletedTraditionalContentStyleUnbounded : _standard.deletedContentStyleUnbounded;
19
23
  };
20
24
  var getInsertedContentStyle = function getInsertedContentStyle(colorScheme) {
@@ -33,7 +37,7 @@ var getInsertedContentStyle = function getInsertedContentStyle(colorScheme) {
33
37
  var getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
34
38
  var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
35
39
  if (colorScheme === 'traditional') {
36
- return _traditional.deletedTraditionalContentStyle;
40
+ return isActive ? _traditional.deletedTraditionalContentStyleActive : _traditional.deletedTraditionalContentStyle;
37
41
  }
38
42
  if (isActive) {
39
43
  return (0, _expValEquals.expValEquals)('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? _standard.deletedContentStyleNewActive : _standard.deletedContentStyleActive;
@@ -254,7 +258,9 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
254
258
  // Widget decoration used for deletions as the content is not in the document
255
259
  // and we want to display the deleted content with a style.
256
260
  var safeInsertPos = (0, _findSafeInsertPos.findSafeInsertPos)(newDoc, change.fromB, slice);
257
- return [_view.Decoration.widget(safeInsertPos, dom, {
258
- key: 'diff-widget'
259
- })];
261
+ var decorations = [];
262
+ decorations.push(_view.Decoration.widget(safeInsertPos, dom, {
263
+ key: "diff-widget-".concat(isActive ? 'active' : 'inactive')
264
+ }));
265
+ return decorations;
260
266
  };
@@ -20,10 +20,13 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
20
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; }
21
21
  var showDiffPluginKey = exports.showDiffPluginKey = new _state2.PluginKey('showDiffPlugin');
22
22
  var getScrollableDecorations = exports.getScrollableDecorations = function getScrollableDecorations(set) {
23
- var _set$find;
24
- return (_set$find = set === null || set === void 0 ? void 0 : set.find(undefined, undefined, function (spec) {
25
- return spec.key === 'diff-inline' || spec.key === 'diff-widget' || spec.key === 'diff-block';
26
- })) !== null && _set$find !== void 0 ? _set$find : [];
23
+ var _set$find$sort;
24
+ return (_set$find$sort = set === null || set === void 0 ? void 0 : set.find(undefined, undefined, function (spec) {
25
+ var _spec$key;
26
+ 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';
27
+ }).sort(function (a, b) {
28
+ return a.from - b.from;
29
+ })) !== null && _set$find$sort !== void 0 ? _set$find$sort : [];
27
30
  };
28
31
  var createPlugin = exports.createPlugin = function createPlugin(config, getIntl, api) {
29
32
  var nodeViewSerializer = new _NodeViewSerializer.NodeViewSerializer({});
@@ -16,20 +16,24 @@ const calculateNodesForBlockDecoration = ({
16
16
  from,
17
17
  to,
18
18
  colorScheme,
19
- isInserted = true
19
+ isInserted = true,
20
+ activeIndexPos
20
21
  }) => {
21
22
  const decorations = [];
22
23
  // Iterate over the document nodes within the range
23
24
  doc.nodesBetween(from, to, (node, pos) => {
24
25
  if (node.isBlock && (!expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) || pos + node.nodeSize <= to)) {
26
+ const nodeEnd = pos + node.nodeSize;
27
+ const isActive = activeIndexPos && pos === activeIndexPos.from && nodeEnd === activeIndexPos.to;
25
28
  const decoration = createBlockChangedDecoration({
26
29
  change: {
27
30
  from: pos,
28
- to: pos + node.nodeSize,
31
+ to: nodeEnd,
29
32
  name: node.type.name
30
33
  },
31
34
  colorScheme,
32
- isInserted
35
+ isInserted,
36
+ isActive
33
37
  });
34
38
  if (decoration) {
35
39
  decorations.push(decoration);
@@ -132,7 +136,7 @@ const calculateDiffDecorationsInner = ({
132
136
  const optimizedChanges = optimizeChanges(changes);
133
137
  const decorations = [];
134
138
  optimizedChanges.forEach(change => {
135
- const isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
139
+ const isActive = activeIndexPos && change.fromB === activeIndexPos.from && change.toB === activeIndexPos.to;
136
140
  // Our default operations are insertions, so it should match the opposite of isInverted.
137
141
  const isInserted = !isInverted;
138
142
  if (change.inserted.length > 0) {
@@ -151,11 +155,13 @@ const calculateDiffDecorationsInner = ({
151
155
  colorScheme,
152
156
  ...(expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) && {
153
157
  isInserted
154
- })
158
+ }),
159
+ activeIndexPos,
160
+ intl
155
161
  }));
156
162
  }
157
163
  if (change.deleted.length > 0) {
158
- const isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
164
+ const isActive = activeIndexPos && change.fromB === activeIndexPos.from && change.fromB === activeIndexPos.to;
159
165
  const decoration = createNodeChangedDecorationWidget({
160
166
  change,
161
167
  doc: originalDoc,
@@ -174,7 +180,7 @@ const calculateDiffDecorationsInner = ({
174
180
  }
175
181
  });
176
182
  getMarkChangeRanges(steps).forEach(change => {
177
- const isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
183
+ const isActive = activeIndexPos && change.fromB === activeIndexPos.from && change.toB === activeIndexPos.to;
178
184
  decorations.push(createInlineChangedDecoration({
179
185
  change,
180
186
  colorScheme,
@@ -188,7 +194,9 @@ const calculateDiffDecorationsInner = ({
188
194
  from: change.fromB,
189
195
  to: change.toB,
190
196
  colorScheme,
191
- isInserted: true
197
+ isInserted: true,
198
+ activeIndexPos,
199
+ intl
192
200
  }));
193
201
  });
194
202
  return DecorationSet.empty.add(tr.doc, decorations);
@@ -7,7 +7,7 @@ export const editingStyle = convertToInlineCss({
7
7
  textDecorationColor: "var(--ds-border-accent-purple, #AF59E1)"
8
8
  });
9
9
  export const editingStyleActive = convertToInlineCss({
10
- background: "var(--ds-background-accent-purple-subtler, #EED7FC)",
10
+ background: "var(--ds-background-accent-purple-subtler-pressed, #D8A0F7)",
11
11
  textDecoration: 'underline',
12
12
  textDecorationStyle: 'dotted',
13
13
  textDecorationThickness: "var(--ds-space-025, 2px)",
@@ -7,7 +7,7 @@ export const traditionalInsertStyle = convertToInlineCss({
7
7
  textDecorationColor: "var(--ds-border-accent-green, #22A06B)"
8
8
  });
9
9
  export const traditionalInsertStyleActive = convertToInlineCss({
10
- background: "var(--ds-background-accent-green-subtler, #BAF3DB)",
10
+ background: "var(--ds-background-accent-green-subtler-pressed, #7EE2B8)",
11
11
  textDecoration: 'underline',
12
12
  textDecorationStyle: 'solid',
13
13
  textDecorationThickness: "var(--ds-space-025, 2px)",
@@ -19,6 +19,15 @@ export const deletedTraditionalContentStyle = convertToInlineCss({
19
19
  position: 'relative',
20
20
  opacity: 1
21
21
  });
22
+
23
+ /** Emphasised (pressed) strikethrough for traditional removed text when active */
24
+ export const deletedTraditionalContentStyleActive = convertToInlineCss({
25
+ textDecorationColor: "var(--ds-text-accent-red, #AE2E24)",
26
+ textDecoration: 'line-through',
27
+ backgroundColor: "var(--ds-background-accent-red-subtlest-pressed, #FFB8B2)",
28
+ position: 'relative',
29
+ opacity: 1
30
+ });
22
31
  export const deletedTraditionalContentStyleUnbounded = convertToInlineCss({
23
32
  position: 'absolute',
24
33
  top: '50%',
@@ -28,6 +37,17 @@ export const deletedTraditionalContentStyleUnbounded = convertToInlineCss({
28
37
  pointerEvents: 'none',
29
38
  zIndex: 1
30
39
  });
40
+
41
+ /** Emphasised (pressed) strikethrough line for traditional when active */
42
+ export const deletedTraditionalContentStyleUnboundedActive = convertToInlineCss({
43
+ position: 'absolute',
44
+ top: '50%',
45
+ width: '100%',
46
+ display: 'inline-block',
47
+ borderTop: `1px solid ${"var(--ds-text-accent-red-bolder, #5D1F1A)"}`,
48
+ pointerEvents: 'none',
49
+ zIndex: 1
50
+ });
31
51
  export const deletedTraditionalStyleQuoteNode = convertToInlineCss({
32
52
  marginTop: "var(--ds-space-150, 12px)",
33
53
  paddingTop: "var(--ds-space-025, 2px)",
@@ -53,20 +73,37 @@ export const deletedTraditionalRowStyle = convertToInlineCss({
53
73
  export const traditionalStyleQuoteNode = convertToInlineCss({
54
74
  borderLeft: `2px solid ${"var(--ds-border-accent-green, #22A06B)"}`
55
75
  });
76
+ export const traditionalStyleQuoteNodeActive = convertToInlineCss({
77
+ borderLeft: `2px solid ${"var(--ds-background-accent-green-subtler-pressed, #7EE2B8)"}`
78
+ });
56
79
  export const traditionalStyleRuleNode = convertToInlineCss({
57
80
  backgroundColor: "var(--ds-border-accent-green, #22A06B)"
58
81
  });
82
+ export const traditionalStyleRuleNodeActive = convertToInlineCss({
83
+ backgroundColor: "var(--ds-background-accent-green-subtler-pressed, #7EE2B8)"
84
+ });
59
85
  export const traditionalStyleNode = convertToInlineCss({
60
86
  boxShadow: `0 0 0 1px ${"var(--ds-border-accent-green, #22A06B)"}`,
61
87
  borderRadius: "var(--ds-radius-small, 4px)"
62
88
  });
89
+ export const traditionalStyleNodeActive = convertToInlineCss({
90
+ boxShadow: `0 0 0 2px ${"var(--ds-background-accent-green-subtler-pressed, #7EE2B8)"}`,
91
+ borderRadius: "var(--ds-radius-small, 4px)"
92
+ });
63
93
  export const traditionalStyleCardBlockNode = convertToInlineCss({
64
94
  boxShadow: `0 0 0 1px ${"var(--ds-border-accent-green, #22A06B)"}`,
65
95
  borderRadius: "var(--ds-radius-medium, 6px)"
66
96
  });
97
+ export const traditionalStyleCardBlockNodeActive = convertToInlineCss({
98
+ boxShadow: `0 0 0 1px ${"var(--ds-background-accent-green-subtler-pressed, #7EE2B8)"}`,
99
+ borderRadius: "var(--ds-radius-medium, 6px)"
100
+ });
67
101
  export const traditionalDecorationMarkerVariable = convertToInlineCss({
68
102
  '--diff-decoration-marker-color': "var(--ds-border-accent-green, #22A06B)"
69
103
  });
104
+ export const traditionalDecorationMarkerVariableActive = convertToInlineCss({
105
+ '--diff-decoration-marker-color': "var(--ds-text-accent-green, #216E4E)"
106
+ });
70
107
  export const traditionalAddedCellOverlayStyle = convertToInlineCss({
71
108
  position: 'absolute',
72
109
  top: 0,