@atlaskit/editor-plugin-show-diff 6.4.0 → 6.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 6.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d1d3089a12aff`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d1d3089a12aff) -
8
+ EDITOR-6431: Improve diff styles to support text-like diffs better when inverted.
9
+ - Updated dependencies
10
+
3
11
  ## 6.4.0
4
12
 
5
13
  ### Minor Changes
@@ -44,7 +44,8 @@ var getChanges = function getChanges(_ref) {
44
44
  if (diffType === 'block') {
45
45
  return (0, _groupChangesByBlock.groupChangesByBlock)(changeset.changes, originalDoc, steppedDoc);
46
46
  }
47
- return (0, _prosemirrorChangeset.simplifyChanges)(changeset.changes, tr.doc);
47
+ var _changes = (0, _prosemirrorChangeset.simplifyChanges)(changeset.changes, tr.doc);
48
+ return (0, _optimizeChanges.optimizeChanges)(_changes);
48
49
  }
49
50
  var changes = (0, _prosemirrorChangeset.simplifyChanges)(changeset.changes, tr.doc);
50
51
  return (0, _optimizeChanges.optimizeChanges)(changes);
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.standardDecorationMarkerVariable = exports.editingStyleRuleNode = exports.editingStyleQuoteNode = exports.editingStyleNode = exports.editingStyleCardBlockNode = exports.editingStyleActive = exports.editingStyle = exports.deletedStyleQuoteNodeWithLozengeActive = exports.deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNode = exports.deletedRowStyle = exports.deletedContentStyleUnbounded = exports.deletedContentStyleNew = exports.deletedContentStyleActive = exports.deletedContentStyle = exports.deletedCellOverlayStyle = exports.deletedBlockOutlineRoundedActive = exports.deletedBlockOutlineRounded = exports.deletedBlockOutlineActive = exports.deletedBlockOutline = exports.addedCellOverlayStyle = void 0;
6
+ exports.standardDecorationMarkerVariable = exports.editingStyleRuleNode = exports.editingStyleQuoteNode = exports.editingStyleNode = exports.editingStyleCardBlockNode = exports.editingStyleActive = exports.editingStyle = exports.editingContentStyleInBlock = exports.deletedStyleQuoteNodeWithLozengeActive = exports.deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNode = exports.deletedRowStyle = exports.deletedContentStyleUnbounded = exports.deletedContentStyleNew = exports.deletedContentStyleActive = exports.deletedContentStyle = exports.deletedCellOverlayStyle = exports.deletedBlockOutlineRoundedActive = exports.deletedBlockOutlineRounded = exports.deletedBlockOutlineActive = exports.deletedBlockOutline = exports.addedCellOverlayStyle = void 0;
7
7
  var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
8
8
  var editingStyle = exports.editingStyle = (0, _lazyNodeView.convertToInlineCss)({
9
9
  background: "var(--ds-background-accent-purple-subtlest, #F8EEFE)",
@@ -12,6 +12,12 @@ var editingStyle = exports.editingStyle = (0, _lazyNodeView.convertToInlineCss)(
12
12
  textDecorationThickness: "var(--ds-space-025, 2px)",
13
13
  textDecorationColor: "var(--ds-border-accent-purple, #AF59E1)"
14
14
  });
15
+ var editingContentStyleInBlock = exports.editingContentStyleInBlock = (0, _lazyNodeView.convertToInlineCss)({
16
+ textDecoration: 'underline',
17
+ textDecorationStyle: 'dotted',
18
+ textDecorationThickness: "var(--ds-space-025, 2px)",
19
+ textDecorationColor: "var(--ds-border-accent-purple, #AF59E1)"
20
+ });
15
21
  var editingStyleActive = exports.editingStyleActive = (0, _lazyNodeView.convertToInlineCss)({
16
22
  background: "var(--ds-background-accent-purple-subtler-pressed, #D8A0F7)",
17
23
  textDecoration: 'underline',
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.createNodeChangedDecorationWidget = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
10
  var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
10
11
  var _view = require("@atlaskit/editor-prosemirror/view");
@@ -15,6 +16,8 @@ var _traditional = require("./colorSchemes/traditional");
15
16
  var _createChangedRowDecorationWidgets = require("./createChangedRowDecorationWidgets");
16
17
  var _findSafeInsertPos = require("./utils/findSafeInsertPos");
17
18
  var _wrapBlockNodeView = require("./utils/wrapBlockNodeView");
19
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
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; }
18
21
  var getDeletedContentStyleUnbounded = function getDeletedContentStyleUnbounded(colorScheme) {
19
22
  var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
20
23
  if (colorScheme === 'traditional' && isActive) {
@@ -262,8 +265,10 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
262
265
  });
263
266
  dom.setAttribute('data-testid', 'show-diff-deleted-decoration');
264
267
  var decorations = [];
265
- decorations.push(_view.Decoration.widget(safeInsertPos, dom, {
268
+ decorations.push(_view.Decoration.widget(safeInsertPos, dom, _objectSpread({
266
269
  key: "diff-widget-".concat(isActive ? 'active' : 'inactive')
267
- }));
270
+ }, (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) && {
271
+ side: -1
272
+ })));
268
273
  return decorations;
269
274
  };
@@ -80,7 +80,10 @@ var getChangedNodeStyle = function getChangedNodeStyle(nodeName, colorScheme) {
80
80
  var isActive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
81
81
  var isTraditional = colorScheme === 'traditional';
82
82
  if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) && isInserted) {
83
- if (shouldApplyStylesDirectly(nodeName)) {
83
+ if (isMultiContainerBlockNode(nodeName)) {
84
+ return _standard.editingContentStyleInBlock;
85
+ }
86
+ if (isTextLikeBlockNode(nodeName)) {
84
87
  return undefined;
85
88
  }
86
89
  if (isTraditional) {
@@ -161,6 +164,12 @@ var maybeAddDeletedOutlineNewClass = function maybeAddDeletedOutlineNewClass(_re
161
164
  var shouldApplyStylesDirectly = function shouldApplyStylesDirectly(nodeName) {
162
165
  return nodeName === 'heading';
163
166
  };
167
+ var isMultiContainerBlockNode = function isMultiContainerBlockNode(nodeName) {
168
+ return ['decisionList', 'layoutSection'].includes(nodeName);
169
+ };
170
+ var isTextLikeBlockNode = function isTextLikeBlockNode(nodeName) {
171
+ return ['heading', 'bulletList', 'orderedList', 'listItem', 'taskList', 'blockquote'].includes(nodeName);
172
+ };
164
173
  var applyCellOverlayStyles = function applyCellOverlayStyles(_ref2) {
165
174
  var element = _ref2.element,
166
175
  colorScheme = _ref2.colorScheme,
@@ -228,16 +237,66 @@ var applyStylesToElement = function applyStylesToElement(_ref3) {
228
237
  var nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive) || '';
229
238
  element.setAttribute('style', "".concat(currentStyle).concat(contentStyle).concat(nodeSpecificStyle));
230
239
  };
231
-
232
- /**
233
- * Creates a content wrapper with deleted styles for a block node
234
- */
235
- var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref4) {
236
- var nodeView = _ref4.nodeView,
240
+ var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref4) {
241
+ var element = _ref4.element,
237
242
  targetNode = _ref4.targetNode,
238
243
  colorScheme = _ref4.colorScheme,
239
244
  isActive = _ref4.isActive,
240
245
  isInserted = _ref4.isInserted;
246
+ var currentStyle = element.getAttribute('style') || '';
247
+ var nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive) || '';
248
+ if (targetNode.type.name === 'decisionList') {
249
+ element.querySelectorAll('li').forEach(function (listItem) {
250
+ var currentListItemStyle = listItem.getAttribute('style') || '';
251
+ listItem.setAttribute('style', "".concat(currentListItemStyle).concat(_standard.editingStyleNode));
252
+ });
253
+ } else if (targetNode.type.name === 'layoutSection') {
254
+ element.querySelectorAll('[data-layout-column="true"]').forEach(function (section) {
255
+ var currentSectionStyle = section.getAttribute('style') || '';
256
+ section.setAttribute('style', "".concat(currentSectionStyle).concat(_standard.editingStyleNode));
257
+ });
258
+ } else if (targetNode.type.name === 'taskList') {
259
+ element.querySelectorAll('li').forEach(function (listItem) {
260
+ var currentListItemStyle = listItem.getAttribute('style') || '';
261
+ listItem.setAttribute('style', "".concat(currentListItemStyle).concat(_standard.editingStyleNode));
262
+ });
263
+ }
264
+ element.setAttribute('style', "".concat(currentStyle, ";").concat(nodeSpecificStyle));
265
+ };
266
+ var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref5) {
267
+ var element = _ref5.element,
268
+ targetNode = _ref5.targetNode,
269
+ colorScheme = _ref5.colorScheme,
270
+ isActive = _ref5.isActive,
271
+ isInserted = _ref5.isInserted;
272
+ getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive) || '';
273
+ var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted);
274
+ var walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
275
+ var textNodesToWrap = [];
276
+ var currentNode = walker.nextNode();
277
+ while (currentNode) {
278
+ if (currentNode instanceof Text && currentNode.textContent !== '' && currentNode.parentElement) {
279
+ textNodesToWrap.push(currentNode);
280
+ }
281
+ currentNode = walker.nextNode();
282
+ }
283
+ textNodesToWrap.forEach(function (textNode) {
284
+ var contentWrapper = document.createElement('span');
285
+ contentWrapper.setAttribute('style', contentStyle);
286
+ textNode.replaceWith(contentWrapper);
287
+ contentWrapper.append(textNode);
288
+ });
289
+ };
290
+
291
+ /**
292
+ * Creates a content wrapper with deleted styles for a block node
293
+ */
294
+ var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref6) {
295
+ var nodeView = _ref6.nodeView,
296
+ targetNode = _ref6.targetNode,
297
+ colorScheme = _ref6.colorScheme,
298
+ isActive = _ref6.isActive,
299
+ isInserted = _ref6.isInserted;
241
300
  var contentWrapper = document.createElement('div');
242
301
  var nodeStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive);
243
302
  contentWrapper.setAttribute('style', "".concat(getChangedContentStyle(colorScheme, isActive, isInserted)).concat(nodeStyle || ''));
@@ -251,14 +310,14 @@ var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref4
251
310
  * to wait for the rich-media-item to appear before attaching the lozenge.
252
311
  * @returns true if embedCard was handled
253
312
  */
254
- var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(_ref5) {
255
- var dom = _ref5.dom,
256
- nodeView = _ref5.nodeView,
257
- targetNode = _ref5.targetNode,
258
- lozenge = _ref5.lozenge,
259
- colorScheme = _ref5.colorScheme,
260
- _ref5$isActive = _ref5.isActive,
261
- isActive = _ref5$isActive === void 0 ? false : _ref5$isActive;
313
+ var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(_ref7) {
314
+ var dom = _ref7.dom,
315
+ nodeView = _ref7.nodeView,
316
+ targetNode = _ref7.targetNode,
317
+ lozenge = _ref7.lozenge,
318
+ colorScheme = _ref7.colorScheme,
319
+ _ref7$isActive = _ref7.isActive,
320
+ isActive = _ref7$isActive === void 0 ? false : _ref7$isActive;
262
321
  if (targetNode.type.name !== 'embedCard' || !(nodeView instanceof HTMLElement)) {
263
322
  return false;
264
323
  }
@@ -299,14 +358,14 @@ var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(_ref5) {
299
358
  * Handles special mediaSingle node rendering with lozenge on child media element
300
359
  * @returns true if mediaSingle was handled, false otherwise
301
360
  */
302
- var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(_ref6) {
303
- var dom = _ref6.dom,
304
- nodeView = _ref6.nodeView,
305
- targetNode = _ref6.targetNode,
306
- lozenge = _ref6.lozenge,
307
- colorScheme = _ref6.colorScheme,
308
- _ref6$isActive = _ref6.isActive,
309
- isActive = _ref6$isActive === void 0 ? false : _ref6$isActive;
361
+ var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(_ref8) {
362
+ var dom = _ref8.dom,
363
+ nodeView = _ref8.nodeView,
364
+ targetNode = _ref8.targetNode,
365
+ lozenge = _ref8.lozenge,
366
+ colorScheme = _ref8.colorScheme,
367
+ _ref8$isActive = _ref8.isActive,
368
+ isActive = _ref8$isActive === void 0 ? false : _ref8$isActive;
310
369
  if (targetNode.type.name !== 'mediaSingle' || !(nodeView instanceof HTMLElement)) {
311
370
  return false;
312
371
  }
@@ -344,16 +403,16 @@ var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(_ref6)
344
403
  /**
345
404
  * Appends a block node with wrapper, lozenge, and appropriate styling
346
405
  */
347
- var wrapBlockNode = function wrapBlockNode(_ref7) {
348
- var dom = _ref7.dom,
349
- nodeView = _ref7.nodeView,
350
- targetNode = _ref7.targetNode,
351
- colorScheme = _ref7.colorScheme,
352
- intl = _ref7.intl,
353
- _ref7$isActive = _ref7.isActive,
354
- isActive = _ref7$isActive === void 0 ? false : _ref7$isActive,
355
- _ref7$isInserted = _ref7.isInserted,
356
- isInserted = _ref7$isInserted === void 0 ? false : _ref7$isInserted;
406
+ var wrapBlockNode = function wrapBlockNode(_ref9) {
407
+ var dom = _ref9.dom,
408
+ nodeView = _ref9.nodeView,
409
+ targetNode = _ref9.targetNode,
410
+ colorScheme = _ref9.colorScheme,
411
+ intl = _ref9.intl,
412
+ _ref9$isActive = _ref9.isActive,
413
+ isActive = _ref9$isActive === void 0 ? false : _ref9$isActive,
414
+ _ref9$isInserted = _ref9.isInserted,
415
+ isInserted = _ref9$isInserted === void 0 ? false : _ref9$isInserted;
357
416
  var blockWrapper = createBlockNodeWrapper();
358
417
  if (shouldShowRemovedLozenge(targetNode.type.name) && (!(0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) || !isInserted)) {
359
418
  var lozenge = createRemovedLozenge(intl, isActive, colorScheme);
@@ -408,35 +467,50 @@ var wrapBlockNode = function wrapBlockNode(_ref7) {
408
467
  * For heading nodes, applies styles directly to preserve natural margins.
409
468
  * For other block nodes, uses wrapper approach with optional lozenge.
410
469
  */
411
- var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(_ref8) {
412
- var dom = _ref8.dom,
413
- nodeView = _ref8.nodeView,
414
- targetNode = _ref8.targetNode,
415
- colorScheme = _ref8.colorScheme,
416
- intl = _ref8.intl,
417
- _ref8$isActive = _ref8.isActive,
418
- isActive = _ref8$isActive === void 0 ? false : _ref8$isActive,
419
- _ref8$isInserted = _ref8.isInserted,
420
- isInserted = _ref8$isInserted === void 0 ? false : _ref8$isInserted;
421
- if (shouldApplyStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
422
- // Apply deleted styles directly to preserve natural block-level margins
423
- applyStylesToElement({
424
- element: nodeView,
425
- targetNode: targetNode,
426
- colorScheme: colorScheme,
427
- isActive: isActive,
428
- isInserted: isInserted
429
- });
430
- dom.append(nodeView);
431
- } else if (targetNode.type.name === 'table' && nodeView instanceof HTMLElement && (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
432
- applyCellOverlayStyles({
433
- element: nodeView,
434
- colorScheme: colorScheme,
435
- isInserted: isInserted
436
- });
437
- dom.append(nodeView);
438
- } else {
439
- // Use wrapper approach for other block nodes
470
+ var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(_ref0) {
471
+ var dom = _ref0.dom,
472
+ nodeView = _ref0.nodeView,
473
+ targetNode = _ref0.targetNode,
474
+ colorScheme = _ref0.colorScheme,
475
+ intl = _ref0.intl,
476
+ _ref0$isActive = _ref0.isActive,
477
+ isActive = _ref0$isActive === void 0 ? false : _ref0$isActive,
478
+ _ref0$isInserted = _ref0.isInserted,
479
+ isInserted = _ref0$isInserted === void 0 ? false : _ref0$isInserted;
480
+ if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
481
+ if (nodeView instanceof HTMLElement) {
482
+ if (isInserted && isMultiContainerBlockNode(targetNode.type.name)) {
483
+ applyMultiContainerLikeStyles({
484
+ element: nodeView,
485
+ targetNode: targetNode,
486
+ colorScheme: colorScheme,
487
+ isActive: isActive,
488
+ isInserted: isInserted
489
+ });
490
+ dom.append(nodeView);
491
+ return;
492
+ }
493
+ if (isTextLikeBlockNode(targetNode.type.name)) {
494
+ applyTextLikeBlockNodeStyles({
495
+ element: nodeView,
496
+ targetNode: targetNode,
497
+ colorScheme: colorScheme,
498
+ isActive: isActive,
499
+ isInserted: isInserted
500
+ });
501
+ dom.append(nodeView);
502
+ return;
503
+ }
504
+ if (targetNode.type.name === 'table') {
505
+ applyCellOverlayStyles({
506
+ element: nodeView,
507
+ colorScheme: colorScheme,
508
+ isInserted: isInserted
509
+ });
510
+ dom.append(nodeView);
511
+ return;
512
+ }
513
+ }
440
514
  wrapBlockNode({
441
515
  dom: dom,
442
516
  nodeView: nodeView,
@@ -446,5 +520,28 @@ var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(_
446
520
  isActive: isActive,
447
521
  isInserted: isInserted
448
522
  });
523
+ return;
524
+ } else {
525
+ if (shouldApplyStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
526
+ // Apply deleted styles directly to preserve natural block-level margins
527
+ applyStylesToElement({
528
+ element: nodeView,
529
+ targetNode: targetNode,
530
+ colorScheme: colorScheme,
531
+ isActive: isActive,
532
+ isInserted: isInserted
533
+ });
534
+ dom.append(nodeView);
535
+ } else {
536
+ wrapBlockNode({
537
+ dom: dom,
538
+ nodeView: nodeView,
539
+ targetNode: targetNode,
540
+ colorScheme: colorScheme,
541
+ intl: intl,
542
+ isActive: isActive,
543
+ isInserted: isInserted
544
+ });
545
+ }
449
546
  }
450
547
  };
@@ -31,7 +31,8 @@ const getChanges = ({
31
31
  if (diffType === 'block') {
32
32
  return groupChangesByBlock(changeset.changes, originalDoc, steppedDoc);
33
33
  }
34
- return simplifyChanges(changeset.changes, tr.doc);
34
+ const changes = simplifyChanges(changeset.changes, tr.doc);
35
+ return optimizeChanges(changes);
35
36
  }
36
37
  const changes = simplifyChanges(changeset.changes, tr.doc);
37
38
  return optimizeChanges(changes);
@@ -6,6 +6,12 @@ export const editingStyle = convertToInlineCss({
6
6
  textDecorationThickness: "var(--ds-space-025, 2px)",
7
7
  textDecorationColor: "var(--ds-border-accent-purple, #AF59E1)"
8
8
  });
9
+ export const editingContentStyleInBlock = convertToInlineCss({
10
+ textDecoration: 'underline',
11
+ textDecorationStyle: 'dotted',
12
+ textDecorationThickness: "var(--ds-space-025, 2px)",
13
+ textDecorationColor: "var(--ds-border-accent-purple, #AF59E1)"
14
+ });
9
15
  export const editingStyleActive = convertToInlineCss({
10
16
  background: "var(--ds-background-accent-purple-subtler-pressed, #D8A0F7)",
11
17
  textDecoration: 'underline',
@@ -240,7 +240,10 @@ export const createNodeChangedDecorationWidget = ({
240
240
  dom.setAttribute('data-testid', 'show-diff-deleted-decoration');
241
241
  const decorations = [];
242
242
  decorations.push(Decoration.widget(safeInsertPos, dom, {
243
- key: `diff-widget-${isActive ? 'active' : 'inactive'}`
243
+ key: `diff-widget-${isActive ? 'active' : 'inactive'}`,
244
+ ...(expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) && {
245
+ side: -1
246
+ })
244
247
  }));
245
248
  return decorations;
246
249
  };
@@ -2,7 +2,7 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
2
2
  import { trackChangesMessages } from '@atlaskit/editor-common/messages';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
- import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingStyle, editingStyleActive, editingStyleNode, addedCellOverlayStyle, deletedCellOverlayStyle } from '../colorSchemes/standard';
5
+ import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingContentStyleInBlock, editingStyle, editingStyleActive, editingStyleNode, addedCellOverlayStyle, deletedCellOverlayStyle } from '../colorSchemes/standard';
6
6
  import { deletedTraditionalBlockOutline, deletedTraditionalBlockOutlineActive, deletedTraditionalBlockOutlineNew, deletedTraditionalBlockOutlineRounded, deletedTraditionalBlockOutlineRoundedActive, deletedTraditionalBlockOutlineRoundedNew, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, deletedTraditionalStyleQuoteNodeActive, traditionalInsertStyle, traditionalInsertStyleActive, traditionalStyleNode, traditionalStyleNodeActive, traditionalStyleNodeNew, traditionalAddedCellOverlayStyle, traditionalAddedCellOverlayStyleNew, deletedTraditionalCellOverlayStyle } from '../colorSchemes/traditional';
7
7
  const lozengeStyle = convertToInlineCss({
8
8
  display: 'inline-flex',
@@ -70,7 +70,10 @@ const getChangedContentStyle = (colorScheme, isActive = false, isInserted = fals
70
70
  const getChangedNodeStyle = (nodeName, colorScheme, isInserted = false, isActive = false) => {
71
71
  const isTraditional = colorScheme === 'traditional';
72
72
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) && isInserted) {
73
- if (shouldApplyStylesDirectly(nodeName)) {
73
+ if (isMultiContainerBlockNode(nodeName)) {
74
+ return editingContentStyleInBlock;
75
+ }
76
+ if (isTextLikeBlockNode(nodeName)) {
74
77
  return undefined;
75
78
  }
76
79
  if (isTraditional) {
@@ -151,6 +154,12 @@ const maybeAddDeletedOutlineNewClass = ({
151
154
  const shouldApplyStylesDirectly = nodeName => {
152
155
  return nodeName === 'heading';
153
156
  };
157
+ const isMultiContainerBlockNode = nodeName => {
158
+ return ['decisionList', 'layoutSection'].includes(nodeName);
159
+ };
160
+ const isTextLikeBlockNode = nodeName => {
161
+ return ['heading', 'bulletList', 'orderedList', 'listItem', 'taskList', 'blockquote'].includes(nodeName);
162
+ };
154
163
  const applyCellOverlayStyles = ({
155
164
  element,
156
165
  colorScheme,
@@ -218,6 +227,58 @@ const applyStylesToElement = ({
218
227
  const nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive) || '';
219
228
  element.setAttribute('style', `${currentStyle}${contentStyle}${nodeSpecificStyle}`);
220
229
  };
230
+ const applyMultiContainerLikeStyles = ({
231
+ element,
232
+ targetNode,
233
+ colorScheme,
234
+ isActive,
235
+ isInserted
236
+ }) => {
237
+ const currentStyle = element.getAttribute('style') || '';
238
+ const nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive) || '';
239
+ if (targetNode.type.name === 'decisionList') {
240
+ element.querySelectorAll('li').forEach(listItem => {
241
+ const currentListItemStyle = listItem.getAttribute('style') || '';
242
+ listItem.setAttribute('style', `${currentListItemStyle}${editingStyleNode}`);
243
+ });
244
+ } else if (targetNode.type.name === 'layoutSection') {
245
+ element.querySelectorAll('[data-layout-column="true"]').forEach(section => {
246
+ const currentSectionStyle = section.getAttribute('style') || '';
247
+ section.setAttribute('style', `${currentSectionStyle}${editingStyleNode}`);
248
+ });
249
+ } else if (targetNode.type.name === 'taskList') {
250
+ element.querySelectorAll('li').forEach(listItem => {
251
+ const currentListItemStyle = listItem.getAttribute('style') || '';
252
+ listItem.setAttribute('style', `${currentListItemStyle}${editingStyleNode}`);
253
+ });
254
+ }
255
+ element.setAttribute('style', `${currentStyle};${nodeSpecificStyle}`);
256
+ };
257
+ const applyTextLikeBlockNodeStyles = ({
258
+ element,
259
+ targetNode,
260
+ colorScheme,
261
+ isActive,
262
+ isInserted
263
+ }) => {
264
+ getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive) || '';
265
+ const contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted);
266
+ const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
267
+ const textNodesToWrap = [];
268
+ let currentNode = walker.nextNode();
269
+ while (currentNode) {
270
+ if (currentNode instanceof Text && currentNode.textContent !== '' && currentNode.parentElement) {
271
+ textNodesToWrap.push(currentNode);
272
+ }
273
+ currentNode = walker.nextNode();
274
+ }
275
+ textNodesToWrap.forEach(textNode => {
276
+ const contentWrapper = document.createElement('span');
277
+ contentWrapper.setAttribute('style', contentStyle);
278
+ textNode.replaceWith(contentWrapper);
279
+ contentWrapper.append(textNode);
280
+ });
281
+ };
221
282
 
222
283
  /**
223
284
  * Creates a content wrapper with deleted styles for a block node
@@ -407,25 +468,40 @@ export const wrapBlockNodeView = ({
407
468
  isActive = false,
408
469
  isInserted = false
409
470
  }) => {
410
- if (shouldApplyStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
411
- // Apply deleted styles directly to preserve natural block-level margins
412
- applyStylesToElement({
413
- element: nodeView,
414
- targetNode,
415
- colorScheme,
416
- isActive,
417
- isInserted
418
- });
419
- dom.append(nodeView);
420
- } else if (targetNode.type.name === 'table' && nodeView instanceof HTMLElement && expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
421
- applyCellOverlayStyles({
422
- element: nodeView,
423
- colorScheme,
424
- isInserted
425
- });
426
- dom.append(nodeView);
427
- } else {
428
- // Use wrapper approach for other block nodes
471
+ if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
472
+ if (nodeView instanceof HTMLElement) {
473
+ if (isInserted && isMultiContainerBlockNode(targetNode.type.name)) {
474
+ applyMultiContainerLikeStyles({
475
+ element: nodeView,
476
+ targetNode,
477
+ colorScheme,
478
+ isActive,
479
+ isInserted
480
+ });
481
+ dom.append(nodeView);
482
+ return;
483
+ }
484
+ if (isTextLikeBlockNode(targetNode.type.name)) {
485
+ applyTextLikeBlockNodeStyles({
486
+ element: nodeView,
487
+ targetNode,
488
+ colorScheme,
489
+ isActive,
490
+ isInserted
491
+ });
492
+ dom.append(nodeView);
493
+ return;
494
+ }
495
+ if (targetNode.type.name === 'table') {
496
+ applyCellOverlayStyles({
497
+ element: nodeView,
498
+ colorScheme,
499
+ isInserted
500
+ });
501
+ dom.append(nodeView);
502
+ return;
503
+ }
504
+ }
429
505
  wrapBlockNode({
430
506
  dom,
431
507
  nodeView,
@@ -435,5 +511,28 @@ export const wrapBlockNodeView = ({
435
511
  isActive,
436
512
  isInserted
437
513
  });
514
+ return;
515
+ } else {
516
+ if (shouldApplyStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
517
+ // Apply deleted styles directly to preserve natural block-level margins
518
+ applyStylesToElement({
519
+ element: nodeView,
520
+ targetNode,
521
+ colorScheme,
522
+ isActive,
523
+ isInserted
524
+ });
525
+ dom.append(nodeView);
526
+ } else {
527
+ wrapBlockNode({
528
+ dom,
529
+ nodeView,
530
+ targetNode,
531
+ colorScheme,
532
+ intl,
533
+ isActive,
534
+ isInserted
535
+ });
536
+ }
438
537
  }
439
538
  };
@@ -38,7 +38,8 @@ var getChanges = function getChanges(_ref) {
38
38
  if (diffType === 'block') {
39
39
  return groupChangesByBlock(changeset.changes, originalDoc, steppedDoc);
40
40
  }
41
- return simplifyChanges(changeset.changes, tr.doc);
41
+ var _changes = simplifyChanges(changeset.changes, tr.doc);
42
+ return optimizeChanges(_changes);
42
43
  }
43
44
  var changes = simplifyChanges(changeset.changes, tr.doc);
44
45
  return optimizeChanges(changes);
@@ -6,6 +6,12 @@ export var editingStyle = convertToInlineCss({
6
6
  textDecorationThickness: "var(--ds-space-025, 2px)",
7
7
  textDecorationColor: "var(--ds-border-accent-purple, #AF59E1)"
8
8
  });
9
+ export var editingContentStyleInBlock = convertToInlineCss({
10
+ textDecoration: 'underline',
11
+ textDecorationStyle: 'dotted',
12
+ textDecorationThickness: "var(--ds-space-025, 2px)",
13
+ textDecorationColor: "var(--ds-border-accent-purple, #AF59E1)"
14
+ });
9
15
  export var editingStyleActive = convertToInlineCss({
10
16
  background: "var(--ds-background-accent-purple-subtler-pressed, #D8A0F7)",
11
17
  textDecoration: 'underline',
@@ -1,4 +1,7 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ 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) { _defineProperty(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; }
2
5
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
3
6
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
4
7
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -255,8 +258,10 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
255
258
  });
256
259
  dom.setAttribute('data-testid', 'show-diff-deleted-decoration');
257
260
  var decorations = [];
258
- decorations.push(Decoration.widget(safeInsertPos, dom, {
261
+ decorations.push(Decoration.widget(safeInsertPos, dom, _objectSpread({
259
262
  key: "diff-widget-".concat(isActive ? 'active' : 'inactive')
260
- }));
263
+ }, expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) && {
264
+ side: -1
265
+ })));
261
266
  return decorations;
262
267
  };
@@ -2,7 +2,7 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
2
2
  import { trackChangesMessages } from '@atlaskit/editor-common/messages';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
- import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingStyle, editingStyleActive, editingStyleNode, addedCellOverlayStyle, deletedCellOverlayStyle } from '../colorSchemes/standard';
5
+ import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingContentStyleInBlock, editingStyle, editingStyleActive, editingStyleNode, addedCellOverlayStyle, deletedCellOverlayStyle } from '../colorSchemes/standard';
6
6
  import { deletedTraditionalBlockOutline, deletedTraditionalBlockOutlineActive, deletedTraditionalBlockOutlineNew, deletedTraditionalBlockOutlineRounded, deletedTraditionalBlockOutlineRoundedActive, deletedTraditionalBlockOutlineRoundedNew, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, deletedTraditionalStyleQuoteNodeActive, traditionalInsertStyle, traditionalInsertStyleActive, traditionalStyleNode, traditionalStyleNodeActive, traditionalStyleNodeNew, traditionalAddedCellOverlayStyle, traditionalAddedCellOverlayStyleNew, deletedTraditionalCellOverlayStyle } from '../colorSchemes/traditional';
7
7
  var lozengeStyle = convertToInlineCss({
8
8
  display: 'inline-flex',
@@ -74,7 +74,10 @@ var getChangedNodeStyle = function getChangedNodeStyle(nodeName, colorScheme) {
74
74
  var isActive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
75
75
  var isTraditional = colorScheme === 'traditional';
76
76
  if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) && isInserted) {
77
- if (shouldApplyStylesDirectly(nodeName)) {
77
+ if (isMultiContainerBlockNode(nodeName)) {
78
+ return editingContentStyleInBlock;
79
+ }
80
+ if (isTextLikeBlockNode(nodeName)) {
78
81
  return undefined;
79
82
  }
80
83
  if (isTraditional) {
@@ -155,6 +158,12 @@ var maybeAddDeletedOutlineNewClass = function maybeAddDeletedOutlineNewClass(_re
155
158
  var shouldApplyStylesDirectly = function shouldApplyStylesDirectly(nodeName) {
156
159
  return nodeName === 'heading';
157
160
  };
161
+ var isMultiContainerBlockNode = function isMultiContainerBlockNode(nodeName) {
162
+ return ['decisionList', 'layoutSection'].includes(nodeName);
163
+ };
164
+ var isTextLikeBlockNode = function isTextLikeBlockNode(nodeName) {
165
+ return ['heading', 'bulletList', 'orderedList', 'listItem', 'taskList', 'blockquote'].includes(nodeName);
166
+ };
158
167
  var applyCellOverlayStyles = function applyCellOverlayStyles(_ref2) {
159
168
  var element = _ref2.element,
160
169
  colorScheme = _ref2.colorScheme,
@@ -222,16 +231,66 @@ var applyStylesToElement = function applyStylesToElement(_ref3) {
222
231
  var nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive) || '';
223
232
  element.setAttribute('style', "".concat(currentStyle).concat(contentStyle).concat(nodeSpecificStyle));
224
233
  };
225
-
226
- /**
227
- * Creates a content wrapper with deleted styles for a block node
228
- */
229
- var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref4) {
230
- var nodeView = _ref4.nodeView,
234
+ var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref4) {
235
+ var element = _ref4.element,
231
236
  targetNode = _ref4.targetNode,
232
237
  colorScheme = _ref4.colorScheme,
233
238
  isActive = _ref4.isActive,
234
239
  isInserted = _ref4.isInserted;
240
+ var currentStyle = element.getAttribute('style') || '';
241
+ var nodeSpecificStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive) || '';
242
+ if (targetNode.type.name === 'decisionList') {
243
+ element.querySelectorAll('li').forEach(function (listItem) {
244
+ var currentListItemStyle = listItem.getAttribute('style') || '';
245
+ listItem.setAttribute('style', "".concat(currentListItemStyle).concat(editingStyleNode));
246
+ });
247
+ } else if (targetNode.type.name === 'layoutSection') {
248
+ element.querySelectorAll('[data-layout-column="true"]').forEach(function (section) {
249
+ var currentSectionStyle = section.getAttribute('style') || '';
250
+ section.setAttribute('style', "".concat(currentSectionStyle).concat(editingStyleNode));
251
+ });
252
+ } else if (targetNode.type.name === 'taskList') {
253
+ element.querySelectorAll('li').forEach(function (listItem) {
254
+ var currentListItemStyle = listItem.getAttribute('style') || '';
255
+ listItem.setAttribute('style', "".concat(currentListItemStyle).concat(editingStyleNode));
256
+ });
257
+ }
258
+ element.setAttribute('style', "".concat(currentStyle, ";").concat(nodeSpecificStyle));
259
+ };
260
+ var applyTextLikeBlockNodeStyles = function applyTextLikeBlockNodeStyles(_ref5) {
261
+ var element = _ref5.element,
262
+ targetNode = _ref5.targetNode,
263
+ colorScheme = _ref5.colorScheme,
264
+ isActive = _ref5.isActive,
265
+ isInserted = _ref5.isInserted;
266
+ getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive) || '';
267
+ var contentStyle = getChangedContentStyle(colorScheme, isActive, isInserted);
268
+ var walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
269
+ var textNodesToWrap = [];
270
+ var currentNode = walker.nextNode();
271
+ while (currentNode) {
272
+ if (currentNode instanceof Text && currentNode.textContent !== '' && currentNode.parentElement) {
273
+ textNodesToWrap.push(currentNode);
274
+ }
275
+ currentNode = walker.nextNode();
276
+ }
277
+ textNodesToWrap.forEach(function (textNode) {
278
+ var contentWrapper = document.createElement('span');
279
+ contentWrapper.setAttribute('style', contentStyle);
280
+ textNode.replaceWith(contentWrapper);
281
+ contentWrapper.append(textNode);
282
+ });
283
+ };
284
+
285
+ /**
286
+ * Creates a content wrapper with deleted styles for a block node
287
+ */
288
+ var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref6) {
289
+ var nodeView = _ref6.nodeView,
290
+ targetNode = _ref6.targetNode,
291
+ colorScheme = _ref6.colorScheme,
292
+ isActive = _ref6.isActive,
293
+ isInserted = _ref6.isInserted;
235
294
  var contentWrapper = document.createElement('div');
236
295
  var nodeStyle = getChangedNodeStyle(targetNode.type.name, colorScheme, isInserted, isActive);
237
296
  contentWrapper.setAttribute('style', "".concat(getChangedContentStyle(colorScheme, isActive, isInserted)).concat(nodeStyle || ''));
@@ -245,14 +304,14 @@ var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(_ref4
245
304
  * to wait for the rich-media-item to appear before attaching the lozenge.
246
305
  * @returns true if embedCard was handled
247
306
  */
248
- var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(_ref5) {
249
- var dom = _ref5.dom,
250
- nodeView = _ref5.nodeView,
251
- targetNode = _ref5.targetNode,
252
- lozenge = _ref5.lozenge,
253
- colorScheme = _ref5.colorScheme,
254
- _ref5$isActive = _ref5.isActive,
255
- isActive = _ref5$isActive === void 0 ? false : _ref5$isActive;
307
+ var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(_ref7) {
308
+ var dom = _ref7.dom,
309
+ nodeView = _ref7.nodeView,
310
+ targetNode = _ref7.targetNode,
311
+ lozenge = _ref7.lozenge,
312
+ colorScheme = _ref7.colorScheme,
313
+ _ref7$isActive = _ref7.isActive,
314
+ isActive = _ref7$isActive === void 0 ? false : _ref7$isActive;
256
315
  if (targetNode.type.name !== 'embedCard' || !(nodeView instanceof HTMLElement)) {
257
316
  return false;
258
317
  }
@@ -293,14 +352,14 @@ var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(_ref5) {
293
352
  * Handles special mediaSingle node rendering with lozenge on child media element
294
353
  * @returns true if mediaSingle was handled, false otherwise
295
354
  */
296
- var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(_ref6) {
297
- var dom = _ref6.dom,
298
- nodeView = _ref6.nodeView,
299
- targetNode = _ref6.targetNode,
300
- lozenge = _ref6.lozenge,
301
- colorScheme = _ref6.colorScheme,
302
- _ref6$isActive = _ref6.isActive,
303
- isActive = _ref6$isActive === void 0 ? false : _ref6$isActive;
355
+ var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(_ref8) {
356
+ var dom = _ref8.dom,
357
+ nodeView = _ref8.nodeView,
358
+ targetNode = _ref8.targetNode,
359
+ lozenge = _ref8.lozenge,
360
+ colorScheme = _ref8.colorScheme,
361
+ _ref8$isActive = _ref8.isActive,
362
+ isActive = _ref8$isActive === void 0 ? false : _ref8$isActive;
304
363
  if (targetNode.type.name !== 'mediaSingle' || !(nodeView instanceof HTMLElement)) {
305
364
  return false;
306
365
  }
@@ -338,16 +397,16 @@ var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(_ref6)
338
397
  /**
339
398
  * Appends a block node with wrapper, lozenge, and appropriate styling
340
399
  */
341
- var wrapBlockNode = function wrapBlockNode(_ref7) {
342
- var dom = _ref7.dom,
343
- nodeView = _ref7.nodeView,
344
- targetNode = _ref7.targetNode,
345
- colorScheme = _ref7.colorScheme,
346
- intl = _ref7.intl,
347
- _ref7$isActive = _ref7.isActive,
348
- isActive = _ref7$isActive === void 0 ? false : _ref7$isActive,
349
- _ref7$isInserted = _ref7.isInserted,
350
- isInserted = _ref7$isInserted === void 0 ? false : _ref7$isInserted;
400
+ var wrapBlockNode = function wrapBlockNode(_ref9) {
401
+ var dom = _ref9.dom,
402
+ nodeView = _ref9.nodeView,
403
+ targetNode = _ref9.targetNode,
404
+ colorScheme = _ref9.colorScheme,
405
+ intl = _ref9.intl,
406
+ _ref9$isActive = _ref9.isActive,
407
+ isActive = _ref9$isActive === void 0 ? false : _ref9$isActive,
408
+ _ref9$isInserted = _ref9.isInserted,
409
+ isInserted = _ref9$isInserted === void 0 ? false : _ref9$isInserted;
351
410
  var blockWrapper = createBlockNodeWrapper();
352
411
  if (shouldShowRemovedLozenge(targetNode.type.name) && (!expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true) || !isInserted)) {
353
412
  var lozenge = createRemovedLozenge(intl, isActive, colorScheme);
@@ -402,35 +461,50 @@ var wrapBlockNode = function wrapBlockNode(_ref7) {
402
461
  * For heading nodes, applies styles directly to preserve natural margins.
403
462
  * For other block nodes, uses wrapper approach with optional lozenge.
404
463
  */
405
- export var wrapBlockNodeView = function wrapBlockNodeView(_ref8) {
406
- var dom = _ref8.dom,
407
- nodeView = _ref8.nodeView,
408
- targetNode = _ref8.targetNode,
409
- colorScheme = _ref8.colorScheme,
410
- intl = _ref8.intl,
411
- _ref8$isActive = _ref8.isActive,
412
- isActive = _ref8$isActive === void 0 ? false : _ref8$isActive,
413
- _ref8$isInserted = _ref8.isInserted,
414
- isInserted = _ref8$isInserted === void 0 ? false : _ref8$isInserted;
415
- if (shouldApplyStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
416
- // Apply deleted styles directly to preserve natural block-level margins
417
- applyStylesToElement({
418
- element: nodeView,
419
- targetNode: targetNode,
420
- colorScheme: colorScheme,
421
- isActive: isActive,
422
- isInserted: isInserted
423
- });
424
- dom.append(nodeView);
425
- } else if (targetNode.type.name === 'table' && nodeView instanceof HTMLElement && expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
426
- applyCellOverlayStyles({
427
- element: nodeView,
428
- colorScheme: colorScheme,
429
- isInserted: isInserted
430
- });
431
- dom.append(nodeView);
432
- } else {
433
- // Use wrapper approach for other block nodes
464
+ export var wrapBlockNodeView = function wrapBlockNodeView(_ref0) {
465
+ var dom = _ref0.dom,
466
+ nodeView = _ref0.nodeView,
467
+ targetNode = _ref0.targetNode,
468
+ colorScheme = _ref0.colorScheme,
469
+ intl = _ref0.intl,
470
+ _ref0$isActive = _ref0.isActive,
471
+ isActive = _ref0$isActive === void 0 ? false : _ref0$isActive,
472
+ _ref0$isInserted = _ref0.isInserted,
473
+ isInserted = _ref0$isInserted === void 0 ? false : _ref0$isInserted;
474
+ if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
475
+ if (nodeView instanceof HTMLElement) {
476
+ if (isInserted && isMultiContainerBlockNode(targetNode.type.name)) {
477
+ applyMultiContainerLikeStyles({
478
+ element: nodeView,
479
+ targetNode: targetNode,
480
+ colorScheme: colorScheme,
481
+ isActive: isActive,
482
+ isInserted: isInserted
483
+ });
484
+ dom.append(nodeView);
485
+ return;
486
+ }
487
+ if (isTextLikeBlockNode(targetNode.type.name)) {
488
+ applyTextLikeBlockNodeStyles({
489
+ element: nodeView,
490
+ targetNode: targetNode,
491
+ colorScheme: colorScheme,
492
+ isActive: isActive,
493
+ isInserted: isInserted
494
+ });
495
+ dom.append(nodeView);
496
+ return;
497
+ }
498
+ if (targetNode.type.name === 'table') {
499
+ applyCellOverlayStyles({
500
+ element: nodeView,
501
+ colorScheme: colorScheme,
502
+ isInserted: isInserted
503
+ });
504
+ dom.append(nodeView);
505
+ return;
506
+ }
507
+ }
434
508
  wrapBlockNode({
435
509
  dom: dom,
436
510
  nodeView: nodeView,
@@ -440,5 +514,28 @@ export var wrapBlockNodeView = function wrapBlockNodeView(_ref8) {
440
514
  isActive: isActive,
441
515
  isInserted: isInserted
442
516
  });
517
+ return;
518
+ } else {
519
+ if (shouldApplyStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
520
+ // Apply deleted styles directly to preserve natural block-level margins
521
+ applyStylesToElement({
522
+ element: nodeView,
523
+ targetNode: targetNode,
524
+ colorScheme: colorScheme,
525
+ isActive: isActive,
526
+ isInserted: isInserted
527
+ });
528
+ dom.append(nodeView);
529
+ } else {
530
+ wrapBlockNode({
531
+ dom: dom,
532
+ nodeView: nodeView,
533
+ targetNode: targetNode,
534
+ colorScheme: colorScheme,
535
+ intl: intl,
536
+ isActive: isActive,
537
+ isInserted: isInserted
538
+ });
539
+ }
443
540
  }
444
541
  };
@@ -1,4 +1,5 @@
1
1
  export declare const editingStyle: string;
2
+ export declare const editingContentStyleInBlock: string;
2
3
  export declare const editingStyleActive: string;
3
4
  export declare const deletedContentStyle: string;
4
5
  export declare const deletedContentStyleActive: string;
@@ -1,4 +1,5 @@
1
1
  export declare const editingStyle: string;
2
+ export declare const editingContentStyleInBlock: string;
2
3
  export declare const editingStyleActive: string;
3
4
  export declare const deletedContentStyle: string;
4
5
  export declare const deletedContentStyleActive: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "6.4.0",
3
+ "version": "6.4.1",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,13 +28,13 @@
28
28
  "sideEffects": false,
29
29
  "atlaskit:src": "src/index.ts",
30
30
  "dependencies": {
31
- "@atlaskit/adf-schema": "^52.4.0",
31
+ "@atlaskit/adf-schema": "^52.5.0",
32
32
  "@atlaskit/custom-steps": "^0.16.0",
33
33
  "@atlaskit/editor-plugin-analytics": "^8.0.0",
34
34
  "@atlaskit/editor-prosemirror": "^7.3.0",
35
35
  "@atlaskit/editor-tables": "^2.9.0",
36
36
  "@atlaskit/platform-feature-flags": "^1.1.0",
37
- "@atlaskit/tmp-editor-statsig": "^62.3.0",
37
+ "@atlaskit/tmp-editor-statsig": "^62.4.0",
38
38
  "@atlaskit/tokens": "^13.0.0",
39
39
  "@babel/runtime": "^7.0.0",
40
40
  "lodash": "^4.17.21",