@atlaskit/editor-plugin-show-diff 6.1.2 → 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 +7 -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 +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
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
+
3
10
  ## 6.1.2
4
11
 
5
12
  ### 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,
@@ -2,7 +2,7 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
3
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
4
  import { standardDecorationMarkerVariable, editingStyleQuoteNode, editingStyleRuleNode, editingStyleCardBlockNode, editingStyleNode, deletedContentStyleNew, deletedStyleQuoteNode } from './colorSchemes/standard';
5
- import { traditionalDecorationMarkerVariable, traditionalStyleQuoteNode, traditionalStyleRuleNode, traditionalStyleCardBlockNode, traditionalStyleNode, deletedTraditionalContentStyle, deletedTraditionalStyleQuoteNode } from './colorSchemes/traditional';
5
+ import { traditionalDecorationMarkerVariable, traditionalDecorationMarkerVariableActive, traditionalStyleQuoteNode, traditionalStyleQuoteNodeActive, traditionalStyleRuleNode, traditionalStyleRuleNodeActive, traditionalStyleCardBlockNode, traditionalStyleCardBlockNodeActive, traditionalStyleNode, traditionalStyleNodeActive, deletedTraditionalContentStyle, deletedTraditionalStyleQuoteNode } from './colorSchemes/traditional';
6
6
  const getNodeClass = name => {
7
7
  switch (name) {
8
8
  case 'extension':
@@ -14,7 +14,8 @@ const getNodeClass = name => {
14
14
  const getBlockNodeStyle = ({
15
15
  nodeName,
16
16
  colorScheme,
17
- isInserted = true
17
+ isInserted = true,
18
+ isActive = false
18
19
  }) => {
19
20
  const isTraditional = colorScheme === 'traditional';
20
21
  if (['mediaSingle', 'mediaGroup', 'table',
@@ -28,73 +29,78 @@ const getBlockNodeStyle = ({
28
29
  if (['extension', 'embedCard', 'listItem'].includes(nodeName)) {
29
30
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
30
31
  if (isInserted) {
31
- return isTraditional ? traditionalDecorationMarkerVariable : standardDecorationMarkerVariable;
32
+ return isTraditional && isActive ? traditionalDecorationMarkerVariableActive : isTraditional ? traditionalDecorationMarkerVariable : standardDecorationMarkerVariable;
32
33
  } else {
33
34
  return isTraditional ? deletedTraditionalContentStyle : deletedContentStyleNew;
34
35
  }
35
36
  }
36
- return isTraditional ? traditionalDecorationMarkerVariable : standardDecorationMarkerVariable;
37
+ return isTraditional && isActive ? traditionalDecorationMarkerVariableActive : isTraditional ? traditionalDecorationMarkerVariable : standardDecorationMarkerVariable;
37
38
  }
38
39
  if (nodeName === 'blockquote') {
39
40
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
40
41
  if (isInserted) {
41
- return isTraditional ? traditionalStyleQuoteNode : editingStyleQuoteNode;
42
+ return isTraditional ? isActive ? traditionalStyleQuoteNodeActive : traditionalStyleQuoteNode : editingStyleQuoteNode;
42
43
  } else {
43
44
  return isTraditional ? deletedTraditionalStyleQuoteNode : deletedStyleQuoteNode;
44
45
  }
45
46
  }
46
- return isTraditional ? traditionalStyleQuoteNode : editingStyleQuoteNode;
47
+ return isTraditional ? isActive ? traditionalStyleQuoteNodeActive : traditionalStyleQuoteNode : editingStyleQuoteNode;
47
48
  }
48
49
  if (nodeName === 'rule') {
49
50
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
50
51
  if (isInserted) {
51
- return isTraditional ? traditionalStyleRuleNode : editingStyleRuleNode;
52
+ return isTraditional ? isActive ? traditionalStyleRuleNodeActive : traditionalStyleRuleNode : editingStyleRuleNode;
52
53
  } else {
53
54
  return isTraditional ? deletedTraditionalContentStyle : deletedContentStyleNew;
54
55
  }
55
56
  }
56
- return isTraditional ? traditionalStyleRuleNode : editingStyleRuleNode;
57
+ return isTraditional ? isActive ? traditionalStyleRuleNodeActive : traditionalStyleRuleNode : editingStyleRuleNode;
57
58
  }
58
59
  if (nodeName === 'blockCard') {
59
60
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
60
61
  if (isInserted) {
61
- return isTraditional ? traditionalStyleCardBlockNode : editingStyleCardBlockNode;
62
+ return isTraditional ? isActive ? traditionalStyleCardBlockNodeActive : traditionalStyleCardBlockNode : editingStyleCardBlockNode;
62
63
  } else {
63
64
  return isTraditional ? deletedTraditionalContentStyle : deletedContentStyleNew;
64
65
  }
65
66
  }
66
- return isTraditional ? traditionalStyleCardBlockNode : editingStyleCardBlockNode;
67
+ return isTraditional ? isActive ? traditionalStyleCardBlockNodeActive : traditionalStyleCardBlockNode : editingStyleCardBlockNode;
67
68
  }
68
69
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
69
70
  if (isInserted) {
70
- return isTraditional ? traditionalStyleNode : editingStyleNode;
71
+ return isTraditional ? isActive ? traditionalStyleNodeActive : traditionalStyleNode : editingStyleNode;
71
72
  } else {
72
73
  return isTraditional ? deletedTraditionalContentStyle : deletedContentStyleNew;
73
74
  }
74
75
  }
75
- return isTraditional ? traditionalStyleNode : editingStyleNode;
76
+ return isTraditional ? isActive ? traditionalStyleNodeActive : traditionalStyleNode : editingStyleNode;
76
77
  };
77
78
 
78
79
  /**
79
- * Inline decoration used for insertions as the content already exists in the document
80
+ * Node decoration used for block-level insertions. When isActive, uses emphasised (pressed) styling.
80
81
  *
81
- * @param change Changeset "change" containing information about the change content + range
82
- * @returns Prosemirror inline decoration
82
+ * @param change Node range and name
83
+ * @param colorScheme Optional color scheme
84
+ * @param isActive Whether this node is part of the currently active/focused change
85
+ * @returns Prosemirror node decoration or undefined
83
86
  */
84
87
  export const createBlockChangedDecoration = ({
85
88
  change,
86
89
  colorScheme,
87
- isInserted = true
90
+ isInserted = true,
91
+ isActive = false
88
92
  }) => {
89
93
  let style = getBlockNodeStyle({
90
94
  nodeName: change.name,
91
- colorScheme
95
+ colorScheme,
96
+ isActive
92
97
  });
93
98
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
94
99
  style = getBlockNodeStyle({
95
100
  nodeName: change.name,
96
101
  colorScheme,
97
- isInserted
102
+ isInserted,
103
+ isActive
98
104
  });
99
105
  }
100
106
  const className = getNodeClass(change.name);
@@ -107,15 +113,15 @@ export const createBlockChangedDecoration = ({
107
113
  }, {
108
114
  key: 'diff-block'
109
115
  });
116
+ } else {
117
+ return undefined;
110
118
  }
111
- return undefined;
112
- } else {
113
- return Decoration.node(change.from, change.to, {
114
- style,
115
- 'data-testid': 'show-diff-changed-decoration-node',
116
- class: className
117
- }, {
118
- key: 'diff-block'
119
- });
120
119
  }
120
+ return Decoration.node(change.from, change.to, {
121
+ style,
122
+ 'data-testid': 'show-diff-changed-decoration-node',
123
+ class: className
124
+ }, {
125
+ key: 'diff-block'
126
+ });
121
127
  };
@@ -2,11 +2,16 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
2
2
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
3
3
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
4
  import { editingStyle, editingStyleActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleNewActive, deletedContentStyleUnbounded } from './colorSchemes/standard';
5
- import { traditionalInsertStyle, traditionalInsertStyleActive, deletedTraditionalContentStyle, deletedTraditionalContentStyleUnbounded } from './colorSchemes/traditional';
5
+ import { traditionalInsertStyle, traditionalInsertStyleActive, deletedTraditionalContentStyle, deletedTraditionalContentStyleActive, deletedTraditionalContentStyleUnbounded, deletedTraditionalContentStyleUnboundedActive } from './colorSchemes/traditional';
6
6
  import { createChangedRowDecorationWidgets } from './createChangedRowDecorationWidgets';
7
7
  import { findSafeInsertPos } from './utils/findSafeInsertPos';
8
8
  import { wrapBlockNodeView } from './utils/wrapBlockNodeView';
9
- const getDeletedContentStyleUnbounded = colorScheme => colorScheme === 'traditional' ? deletedTraditionalContentStyleUnbounded : deletedContentStyleUnbounded;
9
+ const getDeletedContentStyleUnbounded = (colorScheme, isActive = false) => {
10
+ if (colorScheme === 'traditional' && isActive) {
11
+ return deletedTraditionalContentStyleUnboundedActive;
12
+ }
13
+ return colorScheme === 'traditional' ? deletedTraditionalContentStyleUnbounded : deletedContentStyleUnbounded;
14
+ };
10
15
  const getInsertedContentStyle = (colorScheme, isActive = false) => {
11
16
  if (colorScheme === 'traditional') {
12
17
  if (isActive) {
@@ -21,7 +26,7 @@ const getInsertedContentStyle = (colorScheme, isActive = false) => {
21
26
  };
22
27
  const getDeletedContentStyle = (colorScheme, isActive = false) => {
23
28
  if (colorScheme === 'traditional') {
24
- return deletedTraditionalContentStyle;
29
+ return isActive ? deletedTraditionalContentStyleActive : deletedTraditionalContentStyle;
25
30
  }
26
31
  if (isActive) {
27
32
  return expValEquals('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? deletedContentStyleNewActive : deletedContentStyleActive;
@@ -229,7 +234,9 @@ export const createNodeChangedDecorationWidget = ({
229
234
  // Widget decoration used for deletions as the content is not in the document
230
235
  // and we want to display the deleted content with a style.
231
236
  const safeInsertPos = findSafeInsertPos(newDoc, change.fromB, slice);
232
- return [Decoration.widget(safeInsertPos, dom, {
233
- key: 'diff-widget'
234
- })];
237
+ const decorations = [];
238
+ decorations.push(Decoration.widget(safeInsertPos, dom, {
239
+ key: `diff-widget-${isActive ? 'active' : 'inactive'}`
240
+ }));
241
+ return decorations;
235
242
  };
@@ -10,8 +10,11 @@ import { NodeViewSerializer } from './NodeViewSerializer';
10
10
  import { scrollToActiveDecoration } from './scrollToActiveDecoration';
11
11
  export const showDiffPluginKey = new PluginKey('showDiffPlugin');
12
12
  export const getScrollableDecorations = set => {
13
- var _set$find;
14
- return (_set$find = set === null || set === void 0 ? void 0 : set.find(undefined, undefined, spec => spec.key === 'diff-inline' || spec.key === 'diff-widget' || spec.key === 'diff-block')) !== null && _set$find !== void 0 ? _set$find : [];
13
+ var _set$find$sort;
14
+ return (_set$find$sort = set === null || set === void 0 ? void 0 : set.find(undefined, undefined, spec => {
15
+ var _spec$key;
16
+ 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';
17
+ }).sort((a, b) => a.from - b.from)) !== null && _set$find$sort !== void 0 ? _set$find$sort : [];
15
18
  };
16
19
  export const createPlugin = (config, getIntl, api) => {
17
20
  const nodeViewSerializer = new NodeViewSerializer({});
@@ -25,19 +25,23 @@ var calculateNodesForBlockDecoration = function calculateNodesForBlockDecoration
25
25
  to = _ref.to,
26
26
  colorScheme = _ref.colorScheme,
27
27
  _ref$isInserted = _ref.isInserted,
28
- isInserted = _ref$isInserted === void 0 ? true : _ref$isInserted;
28
+ isInserted = _ref$isInserted === void 0 ? true : _ref$isInserted,
29
+ activeIndexPos = _ref.activeIndexPos;
29
30
  var decorations = [];
30
31
  // Iterate over the document nodes within the range
31
32
  doc.nodesBetween(from, to, function (node, pos) {
32
33
  if (node.isBlock && (!expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) || pos + node.nodeSize <= to)) {
34
+ var nodeEnd = pos + node.nodeSize;
35
+ var isActive = activeIndexPos && pos === activeIndexPos.from && nodeEnd === activeIndexPos.to;
33
36
  var decoration = createBlockChangedDecoration({
34
37
  change: {
35
38
  from: pos,
36
- to: pos + node.nodeSize,
39
+ to: nodeEnd,
37
40
  name: node.type.name
38
41
  },
39
42
  colorScheme: colorScheme,
40
- isInserted: isInserted
43
+ isInserted: isInserted,
44
+ isActive: isActive
41
45
  });
42
46
  if (decoration) {
43
47
  decorations.push(decoration);
@@ -141,7 +145,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref2
141
145
  var optimizedChanges = optimizeChanges(changes);
142
146
  var decorations = [];
143
147
  optimizedChanges.forEach(function (change) {
144
- var isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
148
+ var isActive = activeIndexPos && change.fromB === activeIndexPos.from && change.toB === activeIndexPos.to;
145
149
  // Our default operations are insertions, so it should match the opposite of isInverted.
146
150
  var isInserted = !isInverted;
147
151
  if (change.inserted.length > 0) {
@@ -152,17 +156,20 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref2
152
156
  }, expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) && {
153
157
  isInserted: isInserted
154
158
  })));
155
- decorations.push.apply(decorations, _toConsumableArray(calculateNodesForBlockDecoration(_objectSpread({
159
+ decorations.push.apply(decorations, _toConsumableArray(calculateNodesForBlockDecoration(_objectSpread(_objectSpread({
156
160
  doc: tr.doc,
157
161
  from: change.fromB,
158
162
  to: change.toB,
159
163
  colorScheme: colorScheme
160
164
  }, expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) && {
161
165
  isInserted: isInserted
166
+ }), {}, {
167
+ activeIndexPos: activeIndexPos,
168
+ intl: intl
162
169
  }))));
163
170
  }
164
171
  if (change.deleted.length > 0) {
165
- var _isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
172
+ var _isActive = activeIndexPos && change.fromB === activeIndexPos.from && change.fromB === activeIndexPos.to;
166
173
  var decoration = createNodeChangedDecorationWidget(_objectSpread({
167
174
  change: change,
168
175
  doc: originalDoc,
@@ -180,7 +187,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref2
180
187
  }
181
188
  });
182
189
  getMarkChangeRanges(steps).forEach(function (change) {
183
- var isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
190
+ var isActive = activeIndexPos && change.fromB === activeIndexPos.from && change.toB === activeIndexPos.to;
184
191
  decorations.push(createInlineChangedDecoration({
185
192
  change: change,
186
193
  colorScheme: colorScheme,
@@ -194,7 +201,9 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref2
194
201
  from: change.fromB,
195
202
  to: change.toB,
196
203
  colorScheme: colorScheme,
197
- isInserted: true
204
+ isInserted: true,
205
+ activeIndexPos: activeIndexPos,
206
+ intl: intl
198
207
  })));
199
208
  });
200
209
  return DecorationSet.empty.add(tr.doc, decorations);
@@ -7,7 +7,7 @@ export var editingStyle = convertToInlineCss({
7
7
  textDecorationColor: "var(--ds-border-accent-purple, #AF59E1)"
8
8
  });
9
9
  export var 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 var traditionalInsertStyle = convertToInlineCss({
7
7
  textDecorationColor: "var(--ds-border-accent-green, #22A06B)"
8
8
  });
9
9
  export var 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 var 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 var 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 var deletedTraditionalContentStyleUnbounded = convertToInlineCss({
23
32
  position: 'absolute',
24
33
  top: '50%',
@@ -28,6 +37,17 @@ export var deletedTraditionalContentStyleUnbounded = convertToInlineCss({
28
37
  pointerEvents: 'none',
29
38
  zIndex: 1
30
39
  });
40
+
41
+ /** Emphasised (pressed) strikethrough line for traditional when active */
42
+ export var deletedTraditionalContentStyleUnboundedActive = convertToInlineCss({
43
+ position: 'absolute',
44
+ top: '50%',
45
+ width: '100%',
46
+ display: 'inline-block',
47
+ borderTop: "1px solid ".concat("var(--ds-text-accent-red-bolder, #5D1F1A)"),
48
+ pointerEvents: 'none',
49
+ zIndex: 1
50
+ });
31
51
  export var deletedTraditionalStyleQuoteNode = convertToInlineCss({
32
52
  marginTop: "var(--ds-space-150, 12px)",
33
53
  paddingTop: "var(--ds-space-025, 2px)",
@@ -53,20 +73,37 @@ export var deletedTraditionalRowStyle = convertToInlineCss({
53
73
  export var traditionalStyleQuoteNode = convertToInlineCss({
54
74
  borderLeft: "2px solid ".concat("var(--ds-border-accent-green, #22A06B)")
55
75
  });
76
+ export var traditionalStyleQuoteNodeActive = convertToInlineCss({
77
+ borderLeft: "2px solid ".concat("var(--ds-background-accent-green-subtler-pressed, #7EE2B8)")
78
+ });
56
79
  export var traditionalStyleRuleNode = convertToInlineCss({
57
80
  backgroundColor: "var(--ds-border-accent-green, #22A06B)"
58
81
  });
82
+ export var traditionalStyleRuleNodeActive = convertToInlineCss({
83
+ backgroundColor: "var(--ds-background-accent-green-subtler-pressed, #7EE2B8)"
84
+ });
59
85
  export var traditionalStyleNode = convertToInlineCss({
60
86
  boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
61
87
  borderRadius: "var(--ds-radius-small, 4px)"
62
88
  });
89
+ export var traditionalStyleNodeActive = convertToInlineCss({
90
+ boxShadow: "0 0 0 2px ".concat("var(--ds-background-accent-green-subtler-pressed, #7EE2B8)"),
91
+ borderRadius: "var(--ds-radius-small, 4px)"
92
+ });
63
93
  export var traditionalStyleCardBlockNode = convertToInlineCss({
64
94
  boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
65
95
  borderRadius: "var(--ds-radius-medium, 6px)"
66
96
  });
97
+ export var traditionalStyleCardBlockNodeActive = convertToInlineCss({
98
+ boxShadow: "0 0 0 1px ".concat("var(--ds-background-accent-green-subtler-pressed, #7EE2B8)"),
99
+ borderRadius: "var(--ds-radius-medium, 6px)"
100
+ });
67
101
  export var traditionalDecorationMarkerVariable = convertToInlineCss({
68
102
  '--diff-decoration-marker-color': "var(--ds-border-accent-green, #22A06B)"
69
103
  });
104
+ export var traditionalDecorationMarkerVariableActive = convertToInlineCss({
105
+ '--diff-decoration-marker-color': "var(--ds-text-accent-green, #216E4E)"
106
+ });
70
107
  export var traditionalAddedCellOverlayStyle = convertToInlineCss({
71
108
  position: 'absolute',
72
109
  top: 0,
@@ -2,7 +2,7 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
3
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
4
  import { standardDecorationMarkerVariable, editingStyleQuoteNode, editingStyleRuleNode, editingStyleCardBlockNode, editingStyleNode, deletedContentStyleNew, deletedStyleQuoteNode } from './colorSchemes/standard';
5
- import { traditionalDecorationMarkerVariable, traditionalStyleQuoteNode, traditionalStyleRuleNode, traditionalStyleCardBlockNode, traditionalStyleNode, deletedTraditionalContentStyle, deletedTraditionalStyleQuoteNode } from './colorSchemes/traditional';
5
+ import { traditionalDecorationMarkerVariable, traditionalDecorationMarkerVariableActive, traditionalStyleQuoteNode, traditionalStyleQuoteNodeActive, traditionalStyleRuleNode, traditionalStyleRuleNodeActive, traditionalStyleCardBlockNode, traditionalStyleCardBlockNodeActive, traditionalStyleNode, traditionalStyleNodeActive, deletedTraditionalContentStyle, deletedTraditionalStyleQuoteNode } from './colorSchemes/traditional';
6
6
  var getNodeClass = function getNodeClass(name) {
7
7
  switch (name) {
8
8
  case 'extension':
@@ -15,7 +15,9 @@ var getBlockNodeStyle = function getBlockNodeStyle(_ref) {
15
15
  var nodeName = _ref.nodeName,
16
16
  colorScheme = _ref.colorScheme,
17
17
  _ref$isInserted = _ref.isInserted,
18
- isInserted = _ref$isInserted === void 0 ? true : _ref$isInserted;
18
+ isInserted = _ref$isInserted === void 0 ? true : _ref$isInserted,
19
+ _ref$isActive = _ref.isActive,
20
+ isActive = _ref$isActive === void 0 ? false : _ref$isActive;
19
21
  var isTraditional = colorScheme === 'traditional';
20
22
  if (['mediaSingle', 'mediaGroup', 'table',
21
23
  // Handle table separately to avoid border issues
@@ -28,73 +30,79 @@ var getBlockNodeStyle = function getBlockNodeStyle(_ref) {
28
30
  if (['extension', 'embedCard', 'listItem'].includes(nodeName)) {
29
31
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
30
32
  if (isInserted) {
31
- return isTraditional ? traditionalDecorationMarkerVariable : standardDecorationMarkerVariable;
33
+ return isTraditional && isActive ? traditionalDecorationMarkerVariableActive : isTraditional ? traditionalDecorationMarkerVariable : standardDecorationMarkerVariable;
32
34
  } else {
33
35
  return isTraditional ? deletedTraditionalContentStyle : deletedContentStyleNew;
34
36
  }
35
37
  }
36
- return isTraditional ? traditionalDecorationMarkerVariable : standardDecorationMarkerVariable;
38
+ return isTraditional && isActive ? traditionalDecorationMarkerVariableActive : isTraditional ? traditionalDecorationMarkerVariable : standardDecorationMarkerVariable;
37
39
  }
38
40
  if (nodeName === 'blockquote') {
39
41
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
40
42
  if (isInserted) {
41
- return isTraditional ? traditionalStyleQuoteNode : editingStyleQuoteNode;
43
+ return isTraditional ? isActive ? traditionalStyleQuoteNodeActive : traditionalStyleQuoteNode : editingStyleQuoteNode;
42
44
  } else {
43
45
  return isTraditional ? deletedTraditionalStyleQuoteNode : deletedStyleQuoteNode;
44
46
  }
45
47
  }
46
- return isTraditional ? traditionalStyleQuoteNode : editingStyleQuoteNode;
48
+ return isTraditional ? isActive ? traditionalStyleQuoteNodeActive : traditionalStyleQuoteNode : editingStyleQuoteNode;
47
49
  }
48
50
  if (nodeName === 'rule') {
49
51
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
50
52
  if (isInserted) {
51
- return isTraditional ? traditionalStyleRuleNode : editingStyleRuleNode;
53
+ return isTraditional ? isActive ? traditionalStyleRuleNodeActive : traditionalStyleRuleNode : editingStyleRuleNode;
52
54
  } else {
53
55
  return isTraditional ? deletedTraditionalContentStyle : deletedContentStyleNew;
54
56
  }
55
57
  }
56
- return isTraditional ? traditionalStyleRuleNode : editingStyleRuleNode;
58
+ return isTraditional ? isActive ? traditionalStyleRuleNodeActive : traditionalStyleRuleNode : editingStyleRuleNode;
57
59
  }
58
60
  if (nodeName === 'blockCard') {
59
61
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
60
62
  if (isInserted) {
61
- return isTraditional ? traditionalStyleCardBlockNode : editingStyleCardBlockNode;
63
+ return isTraditional ? isActive ? traditionalStyleCardBlockNodeActive : traditionalStyleCardBlockNode : editingStyleCardBlockNode;
62
64
  } else {
63
65
  return isTraditional ? deletedTraditionalContentStyle : deletedContentStyleNew;
64
66
  }
65
67
  }
66
- return isTraditional ? traditionalStyleCardBlockNode : editingStyleCardBlockNode;
68
+ return isTraditional ? isActive ? traditionalStyleCardBlockNodeActive : traditionalStyleCardBlockNode : editingStyleCardBlockNode;
67
69
  }
68
70
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
69
71
  if (isInserted) {
70
- return isTraditional ? traditionalStyleNode : editingStyleNode;
72
+ return isTraditional ? isActive ? traditionalStyleNodeActive : traditionalStyleNode : editingStyleNode;
71
73
  } else {
72
74
  return isTraditional ? deletedTraditionalContentStyle : deletedContentStyleNew;
73
75
  }
74
76
  }
75
- return isTraditional ? traditionalStyleNode : editingStyleNode;
77
+ return isTraditional ? isActive ? traditionalStyleNodeActive : traditionalStyleNode : editingStyleNode;
76
78
  };
77
79
 
78
80
  /**
79
- * Inline decoration used for insertions as the content already exists in the document
81
+ * Node decoration used for block-level insertions. When isActive, uses emphasised (pressed) styling.
80
82
  *
81
- * @param change Changeset "change" containing information about the change content + range
82
- * @returns Prosemirror inline decoration
83
+ * @param change Node range and name
84
+ * @param colorScheme Optional color scheme
85
+ * @param isActive Whether this node is part of the currently active/focused change
86
+ * @returns Prosemirror node decoration or undefined
83
87
  */
84
88
  export var createBlockChangedDecoration = function createBlockChangedDecoration(_ref2) {
85
89
  var change = _ref2.change,
86
90
  colorScheme = _ref2.colorScheme,
87
91
  _ref2$isInserted = _ref2.isInserted,
88
- isInserted = _ref2$isInserted === void 0 ? true : _ref2$isInserted;
92
+ isInserted = _ref2$isInserted === void 0 ? true : _ref2$isInserted,
93
+ _ref2$isActive = _ref2.isActive,
94
+ isActive = _ref2$isActive === void 0 ? false : _ref2$isActive;
89
95
  var style = getBlockNodeStyle({
90
96
  nodeName: change.name,
91
- colorScheme: colorScheme
97
+ colorScheme: colorScheme,
98
+ isActive: isActive
92
99
  });
93
100
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
94
101
  style = getBlockNodeStyle({
95
102
  nodeName: change.name,
96
103
  colorScheme: colorScheme,
97
- isInserted: isInserted
104
+ isInserted: isInserted,
105
+ isActive: isActive
98
106
  });
99
107
  }
100
108
  var className = getNodeClass(change.name);
@@ -107,15 +115,15 @@ export var createBlockChangedDecoration = function createBlockChangedDecoration(
107
115
  }, {
108
116
  key: 'diff-block'
109
117
  });
118
+ } else {
119
+ return undefined;
110
120
  }
111
- return undefined;
112
- } else {
113
- return Decoration.node(change.from, change.to, {
114
- style: style,
115
- 'data-testid': 'show-diff-changed-decoration-node',
116
- class: className
117
- }, {
118
- key: 'diff-block'
119
- });
120
121
  }
122
+ return Decoration.node(change.from, change.to, {
123
+ style: style,
124
+ 'data-testid': 'show-diff-changed-decoration-node',
125
+ class: className
126
+ }, {
127
+ key: 'diff-block'
128
+ });
121
129
  };
@@ -3,11 +3,15 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
3
3
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
4
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
5
  import { editingStyle, editingStyleActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleNewActive, deletedContentStyleUnbounded } from './colorSchemes/standard';
6
- import { traditionalInsertStyle, traditionalInsertStyleActive, deletedTraditionalContentStyle, deletedTraditionalContentStyleUnbounded } from './colorSchemes/traditional';
6
+ import { traditionalInsertStyle, traditionalInsertStyleActive, deletedTraditionalContentStyle, deletedTraditionalContentStyleActive, deletedTraditionalContentStyleUnbounded, deletedTraditionalContentStyleUnboundedActive } from './colorSchemes/traditional';
7
7
  import { createChangedRowDecorationWidgets } from './createChangedRowDecorationWidgets';
8
8
  import { findSafeInsertPos } from './utils/findSafeInsertPos';
9
9
  import { wrapBlockNodeView } from './utils/wrapBlockNodeView';
10
10
  var getDeletedContentStyleUnbounded = function getDeletedContentStyleUnbounded(colorScheme) {
11
+ var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12
+ if (colorScheme === 'traditional' && isActive) {
13
+ return deletedTraditionalContentStyleUnboundedActive;
14
+ }
11
15
  return colorScheme === 'traditional' ? deletedTraditionalContentStyleUnbounded : deletedContentStyleUnbounded;
12
16
  };
13
17
  var getInsertedContentStyle = function getInsertedContentStyle(colorScheme) {
@@ -26,7 +30,7 @@ var getInsertedContentStyle = function getInsertedContentStyle(colorScheme) {
26
30
  var getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
27
31
  var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
28
32
  if (colorScheme === 'traditional') {
29
- return deletedTraditionalContentStyle;
33
+ return isActive ? deletedTraditionalContentStyleActive : deletedTraditionalContentStyle;
30
34
  }
31
35
  if (isActive) {
32
36
  return expValEquals('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? deletedContentStyleNewActive : deletedContentStyleActive;
@@ -247,7 +251,9 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
247
251
  // Widget decoration used for deletions as the content is not in the document
248
252
  // and we want to display the deleted content with a style.
249
253
  var safeInsertPos = findSafeInsertPos(newDoc, change.fromB, slice);
250
- return [Decoration.widget(safeInsertPos, dom, {
251
- key: 'diff-widget'
252
- })];
254
+ var decorations = [];
255
+ decorations.push(Decoration.widget(safeInsertPos, dom, {
256
+ key: "diff-widget-".concat(isActive ? 'active' : 'inactive')
257
+ }));
258
+ return decorations;
253
259
  };
@@ -13,10 +13,13 @@ import { NodeViewSerializer } from './NodeViewSerializer';
13
13
  import { scrollToActiveDecoration } from './scrollToActiveDecoration';
14
14
  export var showDiffPluginKey = new PluginKey('showDiffPlugin');
15
15
  export var getScrollableDecorations = function getScrollableDecorations(set) {
16
- var _set$find;
17
- return (_set$find = set === null || set === void 0 ? void 0 : set.find(undefined, undefined, function (spec) {
18
- return spec.key === 'diff-inline' || spec.key === 'diff-widget' || spec.key === 'diff-block';
19
- })) !== null && _set$find !== void 0 ? _set$find : [];
16
+ var _set$find$sort;
17
+ return (_set$find$sort = set === null || set === void 0 ? void 0 : set.find(undefined, undefined, function (spec) {
18
+ var _spec$key;
19
+ 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';
20
+ }).sort(function (a, b) {
21
+ return a.from - b.from;
22
+ })) !== null && _set$find$sort !== void 0 ? _set$find$sort : [];
20
23
  };
21
24
  export var createPlugin = function createPlugin(config, getIntl, api) {
22
25
  var nodeViewSerializer = new NodeViewSerializer({});
@@ -1,15 +1,24 @@
1
1
  export declare const traditionalInsertStyle: string;
2
2
  export declare const traditionalInsertStyleActive: string;
3
3
  export declare const deletedTraditionalContentStyle: string;
4
+ /** Emphasised (pressed) strikethrough for traditional removed text when active */
5
+ export declare const deletedTraditionalContentStyleActive: string;
4
6
  export declare const deletedTraditionalContentStyleUnbounded: string;
7
+ /** Emphasised (pressed) strikethrough line for traditional when active */
8
+ export declare const deletedTraditionalContentStyleUnboundedActive: string;
5
9
  export declare const deletedTraditionalStyleQuoteNode: string;
6
10
  export declare const deletedTraditionalBlockOutline: string;
7
11
  export declare const deletedTraditionalBlockOutlineRounded: string;
8
12
  export declare const deletedTraditionalRowStyle: string;
9
13
  export declare const traditionalStyleQuoteNode: string;
14
+ export declare const traditionalStyleQuoteNodeActive: string;
10
15
  export declare const traditionalStyleRuleNode: string;
16
+ export declare const traditionalStyleRuleNodeActive: string;
11
17
  export declare const traditionalStyleNode: string;
18
+ export declare const traditionalStyleNodeActive: string;
12
19
  export declare const traditionalStyleCardBlockNode: string;
20
+ export declare const traditionalStyleCardBlockNodeActive: string;
13
21
  export declare const traditionalDecorationMarkerVariable: string;
22
+ export declare const traditionalDecorationMarkerVariableActive: string;
14
23
  export declare const traditionalAddedCellOverlayStyle: string;
15
24
  export declare const deletedTraditionalCellOverlayStyle: string;
@@ -1,17 +1,20 @@
1
1
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
2
2
  import type { ColorScheme } from '../../showDiffPluginType';
3
3
  /**
4
- * Inline decoration used for insertions as the content already exists in the document
4
+ * Node decoration used for block-level insertions. When isActive, uses emphasised (pressed) styling.
5
5
  *
6
- * @param change Changeset "change" containing information about the change content + range
7
- * @returns Prosemirror inline decoration
6
+ * @param change Node range and name
7
+ * @param colorScheme Optional color scheme
8
+ * @param isActive Whether this node is part of the currently active/focused change
9
+ * @returns Prosemirror node decoration or undefined
8
10
  */
9
- export declare const createBlockChangedDecoration: ({ change, colorScheme, isInserted, }: {
11
+ export declare const createBlockChangedDecoration: ({ change, colorScheme, isInserted, isActive, }: {
10
12
  change: {
11
13
  from: number;
12
14
  name: string;
13
15
  to: number;
14
16
  };
15
17
  colorScheme?: ColorScheme;
16
- isInserted: boolean;
18
+ isActive?: boolean;
19
+ isInserted?: boolean;
17
20
  }) => Decoration | undefined;
@@ -9,7 +9,7 @@ import type { NodeViewSerializer } from '../NodeViewSerializer';
9
9
  * that is not in the current document.
10
10
  */
11
11
  export declare const createNodeChangedDecorationWidget: ({ change, doc, nodeViewSerializer, colorScheme, newDoc, intl, isActive, isInserted, }: {
12
- change: Pick<Change, "fromA" | "toA" | "fromB" | "deleted">;
12
+ change: Pick<Change, "fromA" | "toA" | "fromB" | "deleted" | "toB">;
13
13
  colorScheme?: ColorScheme;
14
14
  doc: PMNode;
15
15
  intl: IntlShape;
@@ -1,15 +1,24 @@
1
1
  export declare const traditionalInsertStyle: string;
2
2
  export declare const traditionalInsertStyleActive: string;
3
3
  export declare const deletedTraditionalContentStyle: string;
4
+ /** Emphasised (pressed) strikethrough for traditional removed text when active */
5
+ export declare const deletedTraditionalContentStyleActive: string;
4
6
  export declare const deletedTraditionalContentStyleUnbounded: string;
7
+ /** Emphasised (pressed) strikethrough line for traditional when active */
8
+ export declare const deletedTraditionalContentStyleUnboundedActive: string;
5
9
  export declare const deletedTraditionalStyleQuoteNode: string;
6
10
  export declare const deletedTraditionalBlockOutline: string;
7
11
  export declare const deletedTraditionalBlockOutlineRounded: string;
8
12
  export declare const deletedTraditionalRowStyle: string;
9
13
  export declare const traditionalStyleQuoteNode: string;
14
+ export declare const traditionalStyleQuoteNodeActive: string;
10
15
  export declare const traditionalStyleRuleNode: string;
16
+ export declare const traditionalStyleRuleNodeActive: string;
11
17
  export declare const traditionalStyleNode: string;
18
+ export declare const traditionalStyleNodeActive: string;
12
19
  export declare const traditionalStyleCardBlockNode: string;
20
+ export declare const traditionalStyleCardBlockNodeActive: string;
13
21
  export declare const traditionalDecorationMarkerVariable: string;
22
+ export declare const traditionalDecorationMarkerVariableActive: string;
14
23
  export declare const traditionalAddedCellOverlayStyle: string;
15
24
  export declare const deletedTraditionalCellOverlayStyle: string;
@@ -1,17 +1,20 @@
1
1
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
2
2
  import type { ColorScheme } from '../../showDiffPluginType';
3
3
  /**
4
- * Inline decoration used for insertions as the content already exists in the document
4
+ * Node decoration used for block-level insertions. When isActive, uses emphasised (pressed) styling.
5
5
  *
6
- * @param change Changeset "change" containing information about the change content + range
7
- * @returns Prosemirror inline decoration
6
+ * @param change Node range and name
7
+ * @param colorScheme Optional color scheme
8
+ * @param isActive Whether this node is part of the currently active/focused change
9
+ * @returns Prosemirror node decoration or undefined
8
10
  */
9
- export declare const createBlockChangedDecoration: ({ change, colorScheme, isInserted, }: {
11
+ export declare const createBlockChangedDecoration: ({ change, colorScheme, isInserted, isActive, }: {
10
12
  change: {
11
13
  from: number;
12
14
  name: string;
13
15
  to: number;
14
16
  };
15
17
  colorScheme?: ColorScheme;
16
- isInserted: boolean;
18
+ isActive?: boolean;
19
+ isInserted?: boolean;
17
20
  }) => Decoration | undefined;
@@ -9,7 +9,7 @@ import type { NodeViewSerializer } from '../NodeViewSerializer';
9
9
  * that is not in the current document.
10
10
  */
11
11
  export declare const createNodeChangedDecorationWidget: ({ change, doc, nodeViewSerializer, colorScheme, newDoc, intl, isActive, isInserted, }: {
12
- change: Pick<Change, "fromA" | "toA" | "fromB" | "deleted">;
12
+ change: Pick<Change, "fromA" | "toA" | "fromB" | "deleted" | "toB">;
13
13
  colorScheme?: ColorScheme;
14
14
  doc: PMNode;
15
15
  intl: IntlShape;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "6.1.2",
3
+ "version": "6.1.3",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",