@atlaskit/editor-plugin-show-diff 3.2.3 → 3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 3.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0b00861d972cd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0b00861d972cd) -
8
+ [EDITOR-2668] refactored deleted mediaSingle decorations to maintain alignment/wrap on diff view
9
+ - Updated dependencies
10
+
3
11
  ## 3.2.3
4
12
 
5
13
  ### Patch Changes
@@ -3,19 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createInlineChangedDecoration = exports.createDeletedContentDecoration = exports.createBlockChangedDecoration = void 0;
6
+ exports.getDeletedContentStyleUnbounded = exports.getDeletedContentStyle = exports.createInlineChangedDecoration = exports.createDeletedContentDecoration = exports.createBlockChangedDecoration = void 0;
7
7
  var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
8
- var _messages = require("@atlaskit/editor-common/messages");
9
8
  var _view = require("@atlaskit/editor-prosemirror/view");
10
9
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
+ var _deletedBlocksHandler = require("./deletedBlocksHandler");
11
11
  var _deletedRowsHandler = require("./deletedRowsHandler");
12
12
  var _findSafeInsertPos = require("./findSafeInsertPos");
13
13
  var editingStyle = (0, _lazyNodeView.convertToInlineCss)({
14
- background: "var(--ds-background-accent-purple-subtlest, #F3F0FF)",
14
+ background: "var(--ds-background-accent-purple-subtlest, #F8EEFE)",
15
15
  textDecoration: 'underline',
16
16
  textDecorationStyle: 'dotted',
17
17
  textDecorationThickness: "var(--ds-space-025, 2px)",
18
- textDecorationColor: "var(--ds-border-accent-purple, #8270DB)"
18
+ textDecorationColor: "var(--ds-border-accent-purple, #AF59E1)"
19
19
  });
20
20
  var traditionalInsertStyle = (0, _lazyNodeView.convertToInlineCss)({
21
21
  background: "var(--ds-background-accent-green-subtlest, #DCFFF1)",
@@ -51,7 +51,7 @@ var getEditorStyleNode = function getEditorStyleNode(nodeName, colourScheme) {
51
51
  // Handle table separately to avoid border issues
52
52
  case 'embedCard':
53
53
  return (0, _lazyNodeView.convertToInlineCss)({
54
- '--diff-decoration-marker-color': colourScheme === 'traditional' ? "var(--ds-border-accent-green, #22A06B)" : "var(--ds-border-accent-purple, #8270DB)"
54
+ '--diff-decoration-marker-color': colourScheme === 'traditional' ? "var(--ds-border-accent-green, #22A06B)" : "var(--ds-border-accent-purple, #AF59E1)"
55
55
  });
56
56
  case 'paragraph':
57
57
  case 'heading':
@@ -66,7 +66,7 @@ var getEditorStyleNode = function getEditorStyleNode(nodeName, colourScheme) {
66
66
  return undefined;
67
67
  case 'listItem':
68
68
  return (0, _lazyNodeView.convertToInlineCss)({
69
- '--diff-decoration-marker-color': colourScheme === 'traditional' ? "var(--ds-border-accent-green, #22A06B)" : "var(--ds-border-accent-purple, #8270DB)"
69
+ '--diff-decoration-marker-color': colourScheme === 'traditional' ? "var(--ds-border-accent-green, #22A06B)" : "var(--ds-border-accent-purple, #AF59E1)"
70
70
  });
71
71
  case 'layoutSection':
72
72
  return undefined;
@@ -79,73 +79,20 @@ var getEditorStyleNode = function getEditorStyleNode(nodeName, colourScheme) {
79
79
  return colourScheme === 'traditional' ? traditionalStyleNode : editingStyleNode;
80
80
  }
81
81
  };
82
- var getDeletedStyleNode = function getDeletedStyleNode(nodeName) {
83
- switch (nodeName) {
84
- case 'blockquote':
85
- return deletedStyleQuoteNode;
86
- case 'expand':
87
- case 'decisionList':
88
- return deletedBlockOutline;
89
- case 'panel':
90
- case 'codeBlock':
91
- return deletedBlockOutlineRounded;
92
- default:
93
- return undefined;
94
- }
95
- };
96
- var shouldShowRemovedLozenge = function shouldShowRemovedLozenge(nodeName) {
97
- switch (nodeName) {
98
- case 'expand':
99
- case 'codeBlock':
100
- case 'mediaSingle':
101
- case 'panel':
102
- case 'decisionList':
103
- return true;
104
- default:
105
- return false;
106
- }
107
- };
108
- var shouldFitContentWidth = function shouldFitContentWidth(nodeName) {
109
- switch (nodeName) {
110
- case 'mediaSingle':
111
- case 'embedCard':
112
- case 'blockCard':
113
- return true;
114
- default:
115
- return false;
116
- }
117
- };
118
- var shouldAddShowDiffDeletedNodeClass = function shouldAddShowDiffDeletedNodeClass(nodeName) {
119
- switch (nodeName) {
120
- case 'mediaSingle':
121
- case 'embedCard':
122
- return true;
123
- default:
124
- return false;
125
- }
126
- };
127
-
128
- /**
129
- * Checks if a node should apply deleted styles directly without wrapper
130
- * to preserve natural block-level margins
131
- */
132
- var shouldApplyDeletedStylesDirectly = function shouldApplyDeletedStylesDirectly(nodeName) {
133
- return nodeName === 'blockquote' || nodeName === 'heading';
134
- };
135
82
  var editingStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
136
- borderLeft: "2px solid ".concat("var(--ds-border-accent-purple, #8270DB)")
83
+ borderLeft: "2px solid ".concat("var(--ds-border-accent-purple, #AF59E1)")
137
84
  });
138
85
  var traditionalStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
139
86
  borderLeft: "2px solid ".concat("var(--ds-border-accent-green, #22A06B)")
140
87
  });
141
88
  var editingStyleRuleNode = (0, _lazyNodeView.convertToInlineCss)({
142
- backgroundColor: "var(--ds-border-accent-purple, #8270DB)"
89
+ backgroundColor: "var(--ds-border-accent-purple, #AF59E1)"
143
90
  });
144
91
  var traditionalStyleRuleNode = (0, _lazyNodeView.convertToInlineCss)({
145
92
  backgroundColor: "var(--ds-border-accent-green, #22A06B)"
146
93
  });
147
94
  var editingStyleNode = (0, _lazyNodeView.convertToInlineCss)({
148
- boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-purple, #8270DB)"),
95
+ boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-purple, #AF59E1)"),
149
96
  borderRadius: "var(--ds-radius-small, 4px)"
150
97
  });
151
98
  var traditionalStyleNode = (0, _lazyNodeView.convertToInlineCss)({
@@ -153,39 +100,15 @@ var traditionalStyleNode = (0, _lazyNodeView.convertToInlineCss)({
153
100
  borderRadius: "var(--ds-radius-small, 4px)"
154
101
  });
155
102
  var editingStyleCardBlockNode = (0, _lazyNodeView.convertToInlineCss)({
156
- boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-purple, #8270DB)"),
103
+ boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-purple, #AF59E1)"),
157
104
  borderRadius: "var(--ds-radius-medium, 6px)"
158
105
  });
159
106
  var traditionalStyleCardBlockNode = (0, _lazyNodeView.convertToInlineCss)({
160
107
  boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
161
108
  borderRadius: "var(--ds-radius-medium, 6px)"
162
109
  });
163
- var deletedStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
164
- borderLeft: "2px solid ".concat("var(--ds-border-accent-gray, #758195)")
165
- });
166
- var deletedBlockOutline = (0, _lazyNodeView.convertToInlineCss)({
167
- boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #758195)"),
168
- borderRadius: "var(--ds-radius-small, 4px)"
169
- });
170
- var deletedBlockOutlineRounded = (0, _lazyNodeView.convertToInlineCss)({
171
- boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #758195)"),
172
- borderRadius: "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)")
173
- });
174
-
175
- /**
176
- * Inline decoration used for insertions as the content already exists in the document
177
- *
178
- * @param change Changeset "change" containing information about the change content + range
179
- * @returns Prosemirror inline decoration
180
- */
181
- var createBlockChangedDecoration = exports.createBlockChangedDecoration = function createBlockChangedDecoration(change, colourScheme) {
182
- return _view.Decoration.node(change.from, change.to, {
183
- style: getEditorStyleNode(change.name, colourScheme),
184
- 'data-testid': 'show-diff-changed-decoration-node'
185
- }, {});
186
- };
187
110
  var deletedContentStyle = (0, _lazyNodeView.convertToInlineCss)({
188
- color: "var(--ds-text-accent-gray, #44546F)",
111
+ color: "var(--ds-text-accent-gray, #505258)",
189
112
  textDecoration: 'line-through',
190
113
  position: 'relative',
191
114
  opacity: 0.6
@@ -195,7 +118,7 @@ var deletedContentStyleUnbounded = (0, _lazyNodeView.convertToInlineCss)({
195
118
  top: '50%',
196
119
  width: '100%',
197
120
  display: 'inline-block',
198
- borderTop: "1px solid ".concat("var(--ds-text-accent-gray, #44546F)"),
121
+ borderTop: "1px solid ".concat("var(--ds-text-accent-gray, #505258)"),
199
122
  pointerEvents: 'none',
200
123
  zIndex: 1
201
124
  });
@@ -214,141 +137,24 @@ var deletedTraditionalContentStyleUnbounded = (0, _lazyNodeView.convertToInlineC
214
137
  pointerEvents: 'none',
215
138
  zIndex: 1
216
139
  });
217
- var lozengeStyle = (0, _lazyNodeView.convertToInlineCss)({
218
- display: 'inline-flex',
219
- boxSizing: 'border-box',
220
- position: 'static',
221
- blockSize: 'min-content',
222
- borderRadius: "var(--ds-radius-small, 4px)",
223
- overflow: 'hidden',
224
- paddingInlineStart: "var(--ds-space-050, 4px)",
225
- paddingInlineEnd: "var(--ds-space-050, 4px)",
226
- backgroundColor: "var(--ds-background-accent-gray-subtler, #DCDFE4)",
227
- font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
228
- fontWeight: "var(--ds-font-weight-bold, 700)",
229
- textOverflow: 'ellipsis',
230
- whiteSpace: 'nowrap',
231
- color: "var(--ds-text-warning-inverse, #172B4D)"
232
- });
233
- var getDeletedContentStyleUnbounded = function getDeletedContentStyleUnbounded(colourScheme) {
140
+ var getDeletedContentStyleUnbounded = exports.getDeletedContentStyleUnbounded = function getDeletedContentStyleUnbounded(colourScheme) {
234
141
  return colourScheme === 'traditional' ? deletedTraditionalContentStyleUnbounded : deletedContentStyleUnbounded;
235
142
  };
236
- var getDeletedContentStyle = function getDeletedContentStyle(colourScheme) {
143
+ var getDeletedContentStyle = exports.getDeletedContentStyle = function getDeletedContentStyle(colourScheme) {
237
144
  return colourScheme === 'traditional' ? deletedTraditionalContentStyle : deletedContentStyle;
238
145
  };
239
146
 
240
147
  /**
241
- * Creates a "Removed" lozenge to be displayed at the top right corner of deleted block nodes
242
- */
243
- var createRemovedLozenge = function createRemovedLozenge(intl, nodeName) {
244
- var container = document.createElement('span');
245
- var borderTopRightRadius;
246
- var borderTopLeftRadius;
247
- if (['expand', 'decisionList'].includes(nodeName || '')) {
248
- borderTopRightRadius = "var(--ds-radius-small, 4px)";
249
- } else if (['panel', 'codeBlock'].includes(nodeName || '')) {
250
- borderTopRightRadius = "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)");
251
- } else if (nodeName === 'mediaSingle') {
252
- borderTopLeftRadius = "var(--ds-radius-small, 4px)";
253
- }
254
- var containerStyle = (0, _lazyNodeView.convertToInlineCss)({
255
- position: 'absolute',
256
- top: nodeName === 'mediaSingle' ? "var(--ds-space-300, 24px)" : "var(--ds-space-0, 0px)",
257
- right: nodeName === 'mediaSingle' ? undefined : "var(--ds-space-0, 0px)",
258
- left: nodeName === 'mediaSingle' ? "var(--ds-space-0, 0px)" : undefined,
259
- zIndex: 2,
260
- pointerEvents: 'none',
261
- display: 'flex',
262
- overflow: 'hidden',
263
- borderTopRightRadius: borderTopRightRadius,
264
- borderTopLeftRadius: borderTopLeftRadius
265
- });
266
- container.setAttribute('style', containerStyle);
267
- container.setAttribute('data-testid', 'show-diff-removed-lozenge');
268
-
269
- // Create vanilla HTML lozenge element with Atlaskit Lozenge styling (visual refresh)
270
- var lozengeElement = document.createElement('span');
271
- lozengeElement.setAttribute('style', lozengeStyle);
272
- lozengeElement.textContent = intl.formatMessage(_messages.trackChangesMessages.removed).toUpperCase();
273
- container.appendChild(lozengeElement);
274
- return container;
275
- };
276
-
277
- /**
278
- * Wraps a block node in a container with relative positioning to support absolute positioned lozenge
279
- */
280
- var createBlockNodeWrapper = function createBlockNodeWrapper(nodeName) {
281
- var wrapper = document.createElement('div');
282
- var fitContent = shouldFitContentWidth(nodeName);
283
- var baseStyle = (0, _lazyNodeView.convertToInlineCss)({
284
- position: 'relative',
285
- display: fitContent ? 'inline-block' : 'block',
286
- width: fitContent ? 'fit-content' : undefined,
287
- height: fitContent ? 'fit-content' : undefined,
288
- opacity: 1
289
- });
290
- wrapper.setAttribute('style', baseStyle);
291
- return wrapper;
292
- };
293
-
294
- /**
295
- * Wraps content with deleted styling without opacity (for use when content is a direct child of dom)
296
- */
297
- var createDeletedStyleWrapperWithoutOpacity = function createDeletedStyleWrapperWithoutOpacity(colourScheme) {
298
- var wrapper = document.createElement('span');
299
- wrapper.setAttribute('style', getDeletedContentStyle(colourScheme));
300
- return wrapper;
301
- };
302
-
303
- /**
304
- * Applies deleted styles directly to an HTML element by merging with existing styles
305
- */
306
- var applyDeletedStylesToElement = function applyDeletedStylesToElement(element, targetNode, colourScheme) {
307
- var currentStyle = element.getAttribute('style') || '';
308
- var deletedContentStyle = getDeletedContentStyle(colourScheme);
309
- var nodeSpecificStyle = getDeletedStyleNode(targetNode.type.name) || '';
310
- element.setAttribute('style', "".concat(currentStyle).concat(deletedContentStyle).concat(nodeSpecificStyle));
311
- };
312
-
313
- /**
314
- * Appends a block node with wrapper, lozenge, and appropriate styling
315
- */
316
- var appendBlockNodeWithWrapper = function appendBlockNodeWithWrapper(dom, nodeView, targetNode, colourScheme, intl) {
317
- var blockWrapper = createBlockNodeWrapper(targetNode.type.name);
318
- if (shouldShowRemovedLozenge(targetNode.type.name)) {
319
- var lozenge = createRemovedLozenge(intl, targetNode.type.name);
320
- blockWrapper.append(lozenge);
321
- }
322
-
323
- // Wrap the nodeView in a content wrapper that has the opacity style AND the box-shadow
324
- // This keeps the lozenge at full opacity while the content AND border are faded
325
- var contentWrapper = document.createElement('div');
326
- var nodeStyle = getDeletedStyleNode(targetNode.type.name);
327
- contentWrapper.setAttribute('style', "".concat(getDeletedContentStyle(colourScheme)).concat(nodeStyle || ''));
328
- contentWrapper.append(nodeView);
329
- blockWrapper.append(contentWrapper);
330
- if (nodeView instanceof HTMLElement) {
331
- if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
332
- nodeView.classList.add('show-diff-deleted-node');
333
- }
334
- }
335
- dom.append(blockWrapper);
336
- };
337
-
338
- /**
339
- * Handles all block node rendering with appropriate deleted styling.
340
- * For blockquote and heading nodes, applies styles directly to preserve natural margins.
341
- * For other block nodes, uses wrapper approach with optional lozenge.
148
+ * Inline decoration used for insertions as the content already exists in the document
149
+ *
150
+ * @param change Changeset "change" containing information about the change content + range
151
+ * @returns Prosemirror inline decoration
342
152
  */
343
- var handleBlockNodeView = function handleBlockNodeView(dom, nodeView, targetNode, colourScheme, intl) {
344
- if (shouldApplyDeletedStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
345
- // Apply deleted styles directly to preserve natural block-level margins
346
- applyDeletedStylesToElement(nodeView, targetNode, colourScheme);
347
- dom.append(nodeView);
348
- } else {
349
- // Use wrapper approach for other block nodes
350
- appendBlockNodeWithWrapper(dom, nodeView, targetNode, colourScheme, intl);
351
- }
153
+ var createBlockChangedDecoration = exports.createBlockChangedDecoration = function createBlockChangedDecoration(change, colourScheme) {
154
+ return _view.Decoration.node(change.from, change.to, {
155
+ style: getEditorStyleNode(change.name, colourScheme),
156
+ 'data-testid': 'show-diff-changed-decoration-node'
157
+ }, {});
352
158
  };
353
159
  var createDeletedContentDecoration = exports.createDeletedContentDecoration = function createDeletedContentDecoration(_ref) {
354
160
  var change = _ref.change,
@@ -491,7 +297,7 @@ var createDeletedContentDecoration = exports.createDeletedContentDecoration = fu
491
297
  dom.append(wrapper);
492
298
  } else if ((0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_beta_2')) {
493
299
  // Handle all block nodes with unified function
494
- handleBlockNodeView(dom, nodeView, targetNode, colourScheme, intl);
300
+ (0, _deletedBlocksHandler.handleBlockNodeView)(dom, nodeView, targetNode, colourScheme, intl);
495
301
  } else {
496
302
  dom.append(nodeView);
497
303
  }
@@ -502,7 +308,7 @@ var createDeletedContentDecoration = exports.createDeletedContentDecoration = fu
502
308
  var fallbackNode = fallbackSerialization();
503
309
  if (fallbackNode) {
504
310
  if ((0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_beta_2')) {
505
- var _wrapper2 = createDeletedStyleWrapperWithoutOpacity(colourScheme);
311
+ var _wrapper2 = (0, _deletedBlocksHandler.createDeletedStyleWrapperWithoutOpacity)(colourScheme);
506
312
  _wrapper2.append(fallbackNode);
507
313
  dom.append(_wrapper2);
508
314
  } else {
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.shouldShowRemovedLozenge = exports.shouldApplyDeletedStylesDirectly = exports.shouldAddShowDiffDeletedNodeClass = exports.handleMediaSingleWithLozenge = exports.handleBlockNodeView = exports.getDeletedStyleNode = exports.deletedStyleQuoteNode = exports.deletedBlockOutlineRounded = exports.deletedBlockOutline = exports.createRemovedLozenge = exports.createDeletedStyleWrapperWithoutOpacity = exports.createBlockNodeWrapper = exports.createBlockNodeContentWrapper = exports.applyDeletedStylesToElement = exports.appendBlockNodeWithWrapper = void 0;
7
+ var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
8
+ var _messages = require("@atlaskit/editor-common/messages");
9
+ var _decorations = require("./decorations");
10
+ var deletedStyleQuoteNode = exports.deletedStyleQuoteNode = (0, _lazyNodeView.convertToInlineCss)({
11
+ borderLeft: "2px solid ".concat("var(--ds-border-accent-gray, #7D818A)")
12
+ });
13
+ var deletedBlockOutline = exports.deletedBlockOutline = (0, _lazyNodeView.convertToInlineCss)({
14
+ boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
15
+ borderRadius: "var(--ds-radius-small, 4px)"
16
+ });
17
+ var deletedBlockOutlineRounded = exports.deletedBlockOutlineRounded = (0, _lazyNodeView.convertToInlineCss)({
18
+ boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #7D818A)"),
19
+ borderRadius: "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)")
20
+ });
21
+ var lozengeStyle = (0, _lazyNodeView.convertToInlineCss)({
22
+ display: 'inline-flex',
23
+ boxSizing: 'border-box',
24
+ position: 'static',
25
+ blockSize: 'min-content',
26
+ borderRadius: "var(--ds-radius-small, 4px)",
27
+ overflow: 'hidden',
28
+ paddingInlineStart: "var(--ds-space-050, 4px)",
29
+ paddingInlineEnd: "var(--ds-space-050, 4px)",
30
+ backgroundColor: "var(--ds-background-accent-gray-subtler, #DDDEE1)",
31
+ font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
32
+ fontWeight: "var(--ds-font-weight-bold, 700)",
33
+ textOverflow: 'ellipsis',
34
+ whiteSpace: 'nowrap',
35
+ color: "var(--ds-text-warning-inverse, #292A2E)"
36
+ });
37
+ var getDeletedStyleNode = exports.getDeletedStyleNode = function getDeletedStyleNode(nodeName) {
38
+ switch (nodeName) {
39
+ case 'blockquote':
40
+ return deletedStyleQuoteNode;
41
+ case 'expand':
42
+ case 'decisionList':
43
+ return deletedBlockOutline;
44
+ case 'panel':
45
+ case 'codeBlock':
46
+ return deletedBlockOutlineRounded;
47
+ default:
48
+ return undefined;
49
+ }
50
+ };
51
+ var shouldShowRemovedLozenge = exports.shouldShowRemovedLozenge = function shouldShowRemovedLozenge(nodeName) {
52
+ switch (nodeName) {
53
+ case 'expand':
54
+ case 'codeBlock':
55
+ case 'mediaSingle':
56
+ case 'panel':
57
+ case 'decisionList':
58
+ return true;
59
+ default:
60
+ return false;
61
+ }
62
+ };
63
+ var shouldAddShowDiffDeletedNodeClass = exports.shouldAddShowDiffDeletedNodeClass = function shouldAddShowDiffDeletedNodeClass(nodeName) {
64
+ switch (nodeName) {
65
+ case 'mediaSingle':
66
+ case 'embedCard':
67
+ return true;
68
+ default:
69
+ return false;
70
+ }
71
+ };
72
+
73
+ /**
74
+ * Checks if a node should apply deleted styles directly without wrapper
75
+ * to preserve natural block-level margins
76
+ */
77
+ var shouldApplyDeletedStylesDirectly = exports.shouldApplyDeletedStylesDirectly = function shouldApplyDeletedStylesDirectly(nodeName) {
78
+ return nodeName === 'blockquote' || nodeName === 'heading';
79
+ };
80
+
81
+ /**
82
+ * Creates a "Removed" lozenge to be displayed at the top right corner of deleted block nodes
83
+ */
84
+ var createRemovedLozenge = exports.createRemovedLozenge = function createRemovedLozenge(intl, nodeName) {
85
+ var container = document.createElement('span');
86
+ var borderTopRightRadius;
87
+ if (['expand', 'decisionList'].includes(nodeName || '')) {
88
+ borderTopRightRadius = "var(--ds-radius-small, 4px)";
89
+ } else if (['panel', 'codeBlock', 'mediaSingle'].includes(nodeName || '')) {
90
+ borderTopRightRadius = "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)");
91
+ }
92
+ var containerStyle = (0, _lazyNodeView.convertToInlineCss)({
93
+ position: 'absolute',
94
+ top: "var(--ds-space-0, 0px)",
95
+ right: "var(--ds-space-0, 0px)",
96
+ zIndex: 2,
97
+ pointerEvents: 'none',
98
+ display: 'flex',
99
+ overflow: 'hidden',
100
+ borderTopRightRadius: borderTopRightRadius
101
+ });
102
+ container.setAttribute('style', containerStyle);
103
+ container.setAttribute('data-testid', 'show-diff-removed-lozenge');
104
+
105
+ // Create vanilla HTML lozenge element with Atlaskit Lozenge styling (visual refresh)
106
+ var lozengeElement = document.createElement('span');
107
+ lozengeElement.setAttribute('style', lozengeStyle);
108
+ lozengeElement.textContent = intl.formatMessage(_messages.trackChangesMessages.removed).toUpperCase();
109
+ container.appendChild(lozengeElement);
110
+ return container;
111
+ };
112
+
113
+ /**
114
+ * Wraps a block node in a container with relative positioning to support absolute positioned lozenge
115
+ */
116
+ var createBlockNodeWrapper = exports.createBlockNodeWrapper = function createBlockNodeWrapper(nodeName) {
117
+ var wrapper = document.createElement('div');
118
+ var baseStyle = (0, _lazyNodeView.convertToInlineCss)({
119
+ position: 'relative',
120
+ display: 'block',
121
+ opacity: 1
122
+ });
123
+ wrapper.setAttribute('style', baseStyle);
124
+ return wrapper;
125
+ };
126
+
127
+ /**
128
+ * Wraps content with deleted styling without opacity (for use when content is a direct child of dom)
129
+ */
130
+ var createDeletedStyleWrapperWithoutOpacity = exports.createDeletedStyleWrapperWithoutOpacity = function createDeletedStyleWrapperWithoutOpacity(colourScheme) {
131
+ var wrapper = document.createElement('span');
132
+ wrapper.setAttribute('style', (0, _decorations.getDeletedContentStyle)(colourScheme));
133
+ return wrapper;
134
+ };
135
+
136
+ /**
137
+ * Applies deleted styles directly to an HTML element by merging with existing styles
138
+ */
139
+ var applyDeletedStylesToElement = exports.applyDeletedStylesToElement = function applyDeletedStylesToElement(element, targetNode, colourScheme) {
140
+ var currentStyle = element.getAttribute('style') || '';
141
+ var deletedContentStyle = (0, _decorations.getDeletedContentStyle)(colourScheme);
142
+ var nodeSpecificStyle = getDeletedStyleNode(targetNode.type.name) || '';
143
+ element.setAttribute('style', "".concat(currentStyle).concat(deletedContentStyle).concat(nodeSpecificStyle));
144
+ };
145
+
146
+ /**
147
+ * Creates a content wrapper with deleted styles for a block node
148
+ */
149
+ var createBlockNodeContentWrapper = exports.createBlockNodeContentWrapper = function createBlockNodeContentWrapper(nodeView, targetNode, colourScheme) {
150
+ var contentWrapper = document.createElement('div');
151
+ var nodeStyle = getDeletedStyleNode(targetNode.type.name);
152
+ contentWrapper.setAttribute('style', "".concat((0, _decorations.getDeletedContentStyle)(colourScheme)).concat(nodeStyle || ''));
153
+ contentWrapper.append(nodeView);
154
+ return contentWrapper;
155
+ };
156
+
157
+ /**
158
+ * Handles special mediaSingle node rendering with lozenge on child media element
159
+ * @returns true if mediaSingle was handled, false otherwise
160
+ */
161
+ var handleMediaSingleWithLozenge = exports.handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(dom, nodeView, targetNode, lozenge) {
162
+ if (targetNode.type.name !== 'mediaSingle' || !(nodeView instanceof HTMLElement)) {
163
+ return false;
164
+ }
165
+ var mediaNode = nodeView.querySelector('[data-prosemirror-node-name="media"]');
166
+ if (!mediaNode || !(mediaNode instanceof HTMLElement)) {
167
+ return false;
168
+ }
169
+
170
+ // Add relative positioning to media node to anchor lozenge
171
+ var currentStyle = mediaNode.getAttribute('style') || '';
172
+ var relativePositionStyle = (0, _lazyNodeView.convertToInlineCss)({
173
+ position: 'relative'
174
+ });
175
+ mediaNode.setAttribute('style', "".concat(currentStyle).concat(relativePositionStyle));
176
+ mediaNode.append(lozenge);
177
+
178
+ // Add deleted node class if needed
179
+ if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
180
+ nodeView.classList.add('show-diff-deleted-node');
181
+ }
182
+ dom.append(nodeView);
183
+ return true;
184
+ };
185
+
186
+ /**
187
+ * Appends a block node with wrapper, lozenge, and appropriate styling
188
+ */
189
+ var appendBlockNodeWithWrapper = exports.appendBlockNodeWithWrapper = function appendBlockNodeWithWrapper(dom, nodeView, targetNode, colourScheme, intl) {
190
+ var blockWrapper = createBlockNodeWrapper(targetNode.type.name);
191
+ if (shouldShowRemovedLozenge(targetNode.type.name)) {
192
+ var lozenge = createRemovedLozenge(intl, targetNode.type.name);
193
+ if (handleMediaSingleWithLozenge(dom, nodeView, targetNode, lozenge)) {
194
+ return;
195
+ }
196
+ blockWrapper.append(lozenge);
197
+ }
198
+ var contentWrapper = createBlockNodeContentWrapper(nodeView, targetNode, colourScheme);
199
+ blockWrapper.append(contentWrapper);
200
+ if (nodeView instanceof HTMLElement && shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
201
+ nodeView.classList.add('show-diff-deleted-node');
202
+ }
203
+ dom.append(blockWrapper);
204
+ };
205
+
206
+ /**
207
+ * Handles all block node rendering with appropriate deleted styling.
208
+ * For blockquote and heading nodes, applies styles directly to preserve natural margins.
209
+ * For other block nodes, uses wrapper approach with optional lozenge.
210
+ */
211
+ var handleBlockNodeView = exports.handleBlockNodeView = function handleBlockNodeView(dom, nodeView, targetNode, colourScheme, intl) {
212
+ if (shouldApplyDeletedStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
213
+ // Apply deleted styles directly to preserve natural block-level margins
214
+ applyDeletedStylesToElement(nodeView, targetNode, colourScheme);
215
+ dom.append(nodeView);
216
+ } else {
217
+ // Use wrapper approach for other block nodes
218
+ appendBlockNodeWithWrapper(dom, nodeView, targetNode, colourScheme, intl);
219
+ }
220
+ };
@@ -16,7 +16,7 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
16
16
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
17
17
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
18
18
  var deletedRowStyle = (0, _lazyNodeView.convertToInlineCss)({
19
- color: "var(--ds-text-accent-gray, #44546F)",
19
+ color: "var(--ds-text-accent-gray, #505258)",
20
20
  textDecoration: 'line-through',
21
21
  opacity: 0.6,
22
22
  display: 'table-row'