@atlaskit/editor-plugin-show-diff 14.0.0 → 14.0.2

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.resolveRemovedLozengeStyle = exports.resolveNestedInsertedNodeStyle = exports.resolveCellOverlayStyle = exports.isTextLikeBlockNode = exports.isMultiContainerBlockNode = exports.hasRestingDeletedRing = exports.getInsertedContentStyle = exports.getDeletedContentStyleUnbounded = exports.getDeletedContentStyle = exports.getChangedNodeStyle = exports.getChangedContentStyle = void 0;
6
+ exports.resolveRemovedLozengeStyle = exports.resolveNestedInsertedNodeStyle = exports.resolveDeletedNodeCSSVariables = exports.resolveCellOverlayStyle = exports.isTextLikeBlockNode = exports.isMultiContainerBlockNode = exports.hasRestingDeletedRing = exports.getInsertedContentStyle = exports.getDeletedContentStyleUnbounded = exports.getDeletedContentStyle = exports.getChangedNodeStyle = exports.getChangedContentStyle = void 0;
7
7
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
8
8
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
9
9
  var _isExtendedEnabled = require("../../isExtendedEnabled");
@@ -34,7 +34,6 @@ var getColorScheme = function getColorScheme(colorScheme) {
34
34
  * Preserved as-is; see EDITOR-8281.
35
35
  */
36
36
  var nestedContentScheme = _schemes.standardScheme;
37
- var lozengeStyle = (0, _factory.buildDeletedLozengeStyle)();
38
37
 
39
38
  /**
40
39
  * Node-name classification shared by the style resolvers below and by the routing in
@@ -125,7 +124,8 @@ var resolveCellOverlayStyleNext = function resolveCellOverlayStyleNext(_ref) {
125
124
  return isInserted ? addedCellStyle : deletedCellStyle;
126
125
  };
127
126
  var resolveRemovedLozengeStyleNext = function resolveRemovedLozengeStyleNext(colorScheme, isActive) {
128
- return isActive ? (0, _factory.buildDeletedLozengeActiveStyle)(getColorScheme(colorScheme)) : lozengeStyle;
127
+ var colors = getColorScheme(colorScheme);
128
+ return isActive ? (0, _factory.buildDeletedLozengeActiveStyle)(colors) : (0, _factory.buildDeletedLozengeStyle)(colors);
129
129
  };
130
130
  var resolveNestedInsertedNodeStyleNext = function resolveNestedInsertedNodeStyleNext() {
131
131
  return (0, _factory.buildInsertStyleNode)(nestedContentScheme);
@@ -202,4 +202,14 @@ var resolveNestedInsertedNodeStyle = exports.resolveNestedInsertedNodeStyle = fu
202
202
  */
203
203
  var hasRestingDeletedRing = exports.hasRestingDeletedRing = function hasRestingDeletedRing(colorScheme) {
204
204
  return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? hasRestingDeletedRingNext(colorScheme) : (0, _wrapBlockNodeViewStyles.hasRestingDeletedRingLegacy)(colorScheme);
205
+ };
206
+
207
+ /**
208
+ * Custom properties consumed by the `show-diff-deleted-node-vars` selectors in editor-core.
209
+ *
210
+ * No `*Legacy` counterpart: the OFF cohort emits no properties at all and takes its colours from the
211
+ * per-scheme selectors instead, so the gate lives at the single caller in `wrapBlockNodeView`.
212
+ */
213
+ var resolveDeletedNodeCSSVariables = exports.resolveDeletedNodeCSSVariables = function resolveDeletedNodeCSSVariables(colorScheme) {
214
+ return (0, _factory.buildDeletedNodeCSSVariables)(getColorScheme(colorScheme));
205
215
  };
@@ -1,3 +1,4 @@
1
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
1
2
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
2
3
 
3
4
  /**
@@ -86,11 +87,29 @@ export class NodeViewSerializer {
86
87
  return null;
87
88
  }
88
89
  const constructor = (_this$nodeViews = this.nodeViews) === null || _this$nodeViews === void 0 ? void 0 : _this$nodeViews[targetNode.type.name];
89
- if (this.nodeViewBlocklist.has(targetNode.type.name)) {
90
+ const isBlocklisted = this.nodeViewBlocklist.has(targetNode.type.name);
91
+
92
+ // Do not bail out a blocklisted container when it holds an atomic inline node
93
+ // (e.g. date, status) whose schema toDOM is lossy. Text keeps bailing so the caller
94
+ // renders it inline
95
+ const hasAtomicInlineChild = node => {
96
+ let found = false;
97
+ node.forEach(child => {
98
+ if (child.isLeaf && !child.isText) {
99
+ found = true;
100
+ }
101
+ });
102
+ return found;
103
+ };
104
+ const serializeAtomicContainer = isExperimentEnabled('platform_editor_show_diff_deleted_nodeview_content') && !targetNode.isInline && hasAtomicInlineChild(targetNode);
105
+ if (isBlocklisted && !serializeAtomicContainer) {
90
106
  return null;
91
107
  }
92
108
  try {
93
- if (!constructor) {
109
+ // No constructor, or (gated) the node's own view is blocklisted: render the toDOM
110
+ // shell and recurse via appendChildNodes so nested atomic inline nodes render via
111
+ // their node views instead of their lossy schema toDOM.
112
+ if (!constructor || isExperimentEnabled('platform_editor_show_diff_deleted_nodeview_content') && isBlocklisted) {
94
113
  var _targetNode$type$spec, _targetNode$type$spec2;
95
114
  if (targetNode.isInline) {
96
115
  return null;
@@ -104,11 +123,12 @@ export class NodeViewSerializer {
104
123
  contentDOM
105
124
  } = DOMSerializer.renderSpec(document, toDOMResult);
106
125
  if (dom instanceof HTMLElement) {
107
- if (targetNode.type.name === 'paragraph' && targetNode.children.length === 1) {
126
+ // Legacy shortcut: a single-child paragraph serializes its inline content
127
+ // directly (no <p> wrapper). Applies only to a non-blocklisted paragraph with
128
+ // no node view
129
+ if (!isExperimentEnabled('platform_editor_show_diff_deleted_nodeview_content') && targetNode.type.name === 'paragraph' && targetNode.children.length === 1) {
108
130
  return this.serializeFragment(targetNode.content);
109
131
  }
110
-
111
- // Iteratively populate children
112
132
  this.appendChildNodes(targetNode.children, contentDOM);
113
133
  }
114
134
  return dom;
@@ -24,6 +24,17 @@ const bgSubtlestPressedMap = {
24
24
  magenta: "var(--ds-background-accent-magenta-subtlest-pressed, #FCB6E1)",
25
25
  gray: "var(--ds-background-accent-gray-subtlest-pressed, #B7B9BE)"
26
26
  };
27
+ const bgSubtlerMap = {
28
+ green: "var(--ds-background-accent-green-subtler, #BAF3DB)",
29
+ teal: "var(--ds-background-accent-teal-subtler, #C6EDFB)",
30
+ blue: "var(--ds-background-accent-blue-subtler, #CFE1FD)",
31
+ purple: "var(--ds-background-accent-purple-subtler, #EED7FC)",
32
+ red: "var(--ds-background-accent-red-subtler, #FFD5D2)",
33
+ orange: "var(--ds-background-accent-orange-subtler, #FCE4A6)",
34
+ yellow: "var(--ds-background-accent-yellow-subtler, #F5E989)",
35
+ magenta: "var(--ds-background-accent-magenta-subtler, #FDD0EC)",
36
+ gray: "var(--ds-background-accent-gray-subtler, #DDDEE1)"
37
+ };
27
38
  const bgSubtlerPressedMap = {
28
39
  green: "var(--ds-background-accent-green-subtler-pressed, #7EE2B8)",
29
40
  teal: "var(--ds-background-accent-teal-subtler-pressed, #9DD9EE)",
@@ -63,6 +74,9 @@ function bgSubtlest(color) {
63
74
  function bgSubtlestPressed(color) {
64
75
  return bgSubtlestPressedMap[color];
65
76
  }
77
+ function bgSubtler(color) {
78
+ return bgSubtlerMap[color];
79
+ }
66
80
  function bgSubtlerPressed(color) {
67
81
  return bgSubtlerPressedMap[color];
68
82
  }
@@ -605,7 +619,7 @@ export function buildDeletedCellOverlayStyle(colors) {
605
619
  left: 0,
606
620
  width: '100%',
607
621
  height: '100%',
608
- backgroundColor: `rgba(from ${bgSubtlest(colors.deletedCellColor)} r g b / 0.5)`,
622
+ backgroundColor: `rgba(from ${bgSubtlest(colors.deletedCellColor)} r g b / ${colors.deletedCellOpacity})`,
609
623
  zIndex: 1,
610
624
  outline: `1px solid ${deletedCellOutline(colors)}`,
611
625
  pointerEvents: 'none'
@@ -620,7 +634,7 @@ export function buildDeletedCellOverlayRoundedStyle(colors) {
620
634
  left: 0,
621
635
  width: '100%',
622
636
  height: '100%',
623
- backgroundColor: `rgba(from ${bgSubtlest(colors.deletedCellColor)} r g b / 0.5)`,
637
+ backgroundColor: `rgba(from ${bgSubtlest(colors.deletedCellColor)} r g b / ${colors.deletedCellOpacity})`,
624
638
  zIndex: 2,
625
639
  outline: `1px solid ${deletedCellOutline(colors)}`,
626
640
  pointerEvents: 'none',
@@ -677,7 +691,7 @@ export function buildDeletedStrikethroughLine(colors, isActive) {
677
691
 
678
692
  // --- Deleted-content "REMOVED" lozenge ---
679
693
 
680
- /** Structural CSS shared by both lozenge states — everything except the background tint. */
694
+ /** Structural CSS shared by both lozenge states — everything except the tint and the label colour. */
681
695
  const deletedLozengeBase = {
682
696
  display: 'inline-flex',
683
697
  boxSizing: 'border-box',
@@ -690,18 +704,24 @@ const deletedLozengeBase = {
690
704
  font: "var(--ds-font-body-small, normal 400 12px/16px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
691
705
  fontWeight: "var(--ds-font-weight-bold, 653)",
692
706
  textOverflow: 'ellipsis',
693
- whiteSpace: 'nowrap',
694
- color: "var(--ds-text-warning-inverse, #292A2E)"
707
+ whiteSpace: 'nowrap'
695
708
  };
696
709
 
697
710
  /**
698
- * The "REMOVED" lozenge on a deleted block node — resting state. Neutral gray in every scheme,
699
- * so it takes no DiffColorScheme; only the active state is tinted.
711
+ * Label colour for both lozenge states. `inverse` is a fixed tone that reads on any tint, which is
712
+ * why the resting lozenge could get away with a hardcoded gray background; a scheme that tints the
713
+ * lozenge itself needs `accent` instead.
700
714
  */
701
- export function buildDeletedLozengeStyle() {
715
+ function deletedLozengeTextColor(colors) {
716
+ return colors.deletedLozengeTextTone === 'accent' ? textAccent(colors.deletedLozengeColor) : "var(--ds-text-warning-inverse, #292A2E)";
717
+ }
718
+
719
+ /** The "REMOVED" lozenge on a deleted block node — resting state, tinted with deletedLozengeColor. */
720
+ export function buildDeletedLozengeStyle(colors) {
702
721
  return convertToInlineCss({
703
722
  ...deletedLozengeBase,
704
- backgroundColor: "var(--ds-background-accent-gray-subtler, #DDDEE1)"
723
+ color: deletedLozengeTextColor(colors),
724
+ backgroundColor: bgSubtler(colors.deletedLozengeColor)
705
725
  });
706
726
  }
707
727
 
@@ -709,6 +729,7 @@ export function buildDeletedLozengeStyle() {
709
729
  export function buildDeletedLozengeActiveStyle(colors) {
710
730
  return convertToInlineCss({
711
731
  ...deletedLozengeBase,
732
+ color: deletedLozengeTextColor(colors),
712
733
  backgroundColor: bgSubtlerPressed(colors.deleteActiveColor)
713
734
  });
714
735
  }
@@ -838,18 +859,39 @@ export function buildAtomicInlineChangedCSSVariables(colors) {
838
859
  }
839
860
 
840
861
  /**
841
- * Deleted-node wrapper variables, one per visual role in editor-core's `showDiffDeletedNodeStyles`:
842
- * resting ring, `-outline-new` ring, `-active` ring, and the blockquote/embedCard strike colour.
862
+ * Deleted-node wrapper variables, one per visual role in editor-core's `showDiffDeletedNodeStyles`.
863
+ * Emitted by `wrapBlockNodeView` alongside `show-diff-deleted-node-vars` — the class is named for
864
+ * these properties — so one set of selectors in editor-core covers both schemes.
865
+ *
866
+ * The three `stateful`-only variables are omitted for `static` (standard) so editor-core's fallback
867
+ * wins, which is what standard rendered before:
868
+ * - `--diff-delete-opacity` — the fallback is 0.6 or 0.8 depending on
869
+ * `platform_editor_enghealth_a11y_jan_fixes`, a split the scheme must not flatten.
870
+ * - `--diff-delete-ring-width` — traditional's deleted media ring tracks the inherited marker ring
871
+ * width instead of a fixed 1px.
872
+ * - `--diff-delete-text-decoration-color` — standard's blockquote strike must stay `currentColor`.
873
+ *
874
+ * `--diff-delete-media-ring-color` is emitted for every scheme: the a11y-fixes treatment rings
875
+ * deleted media red even where `deleteColor` is gray, so it needs its own role.
876
+ *
877
+ * `--diff-delete-embed-strike-line` carries the *presence* of the deleted-embedCard strike, not its
878
+ * colour — standard draws none. Encoding it as `line-through`/`none` is what lets the ON cohort drop
879
+ * the `-traditional` class entirely.
843
880
  *
844
- * Not yet called — those selectors carry `var(…, <today's token>)` fallbacks until
845
- * `wrapBlockNodeView` emits these under the refactor gate. No opacity variable: that opacity is
846
- * driven by `platform_editor_enghealth_a11y_jan_fixes`, not by the scheme.
881
+ * Only reached when `platform_editor_show_diff_color_scheme_refactor` is on; the OFF cohort takes
882
+ * its values from the per-scheme selectors in editor-core instead.
847
883
  */
848
884
  export function buildDeletedNodeCSSVariables(colors) {
849
885
  return convertToInlineCss({
850
886
  '--diff-delete-color': borderAccent(colors.deleteColor),
851
887
  '--diff-delete-color-new': bgSubtlest(colors.deleteColor),
852
888
  '--diff-delete-color-active': bgSubtlerPressed(colors.deleteActiveColor),
853
- '--diff-delete-text-decoration-color': borderAccent(colors.deleteColor)
889
+ '--diff-delete-media-ring-color': borderAccent(colors.deletedMediaRingColor),
890
+ '--diff-delete-embed-strike-line': colors.strikesDeletedEmbedCard ? 'line-through' : 'none',
891
+ ...(colors.deletedNodeEmphasis === 'stateful' ? {
892
+ '--diff-delete-opacity': '1',
893
+ '--diff-delete-ring-width': 'var(--diff-decoration-marker-ring-width, 1px)',
894
+ '--diff-delete-text-decoration-color': borderAccent(colors.deleteColor)
895
+ } : {})
854
896
  });
855
897
  }
@@ -6,6 +6,10 @@ export const traditionalScheme = {
6
6
  deleteColor: 'red',
7
7
  deleteActiveColor: 'red',
8
8
  deletedCellColor: 'gray',
9
+ deletedCellOpacity: 0.5,
10
+ deletedLozengeColor: 'gray',
11
+ deletedLozengeTextTone: 'inverse',
12
+ deletedMediaRingColor: 'red',
9
13
  deletedRowTreatment: 'strikeColor',
10
14
  insertedCellOpacity: 0.5,
11
15
  deletedQuoteNodeShape: 'ring',
@@ -17,7 +21,8 @@ export const traditionalScheme = {
17
21
  deletedInlineTreatment: 'strikethrough',
18
22
  insertedNodeEmphasis: 'stateful',
19
23
  deletedNodeEmphasis: 'stateful',
20
- deletedQuoteNodeActiveTone: 'backgroundPressed'
24
+ deletedQuoteNodeActiveTone: 'backgroundPressed',
25
+ strikesDeletedEmbedCard: true
21
26
  };
22
27
 
23
28
  /** Purple insertions, gray deletions (red on active). */
@@ -28,6 +33,11 @@ export const standardScheme = {
28
33
  deleteColor: 'gray',
29
34
  deleteActiveColor: 'red',
30
35
  deletedCellColor: 'gray',
36
+ deletedCellOpacity: 0.5,
37
+ deletedLozengeColor: 'gray',
38
+ deletedLozengeTextTone: 'inverse',
39
+ // Red, not `deleteColor`'s gray: a11y-fixes rings deleted media red in both schemes.
40
+ deletedMediaRingColor: 'red',
31
41
  deletedRowTreatment: 'textTint',
32
42
  insertedCellOpacity: 0.2,
33
43
  deletedQuoteNodeShape: 'borderLeft',
@@ -39,7 +49,8 @@ export const standardScheme = {
39
49
  deletedInlineTreatment: 'glyphTint',
40
50
  insertedNodeEmphasis: 'static',
41
51
  deletedNodeEmphasis: 'static',
42
- deletedQuoteNodeActiveTone: 'borderAccent'
52
+ deletedQuoteNodeActiveTone: 'borderAccent',
53
+ strikesDeletedEmbedCard: false
43
54
  };
44
55
 
45
56
  /** Maps the public ColorScheme string to its data object. Adding a scheme = one entry here. */
@@ -1,10 +1,11 @@
1
1
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
2
2
  import { trackChangesMessages } from '@atlaskit/editor-common/messages';
3
3
  import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-utils';
4
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
4
5
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
6
  import { isExtendedEnabled } from '../../isExtendedEnabled';
6
7
  import { applyTableCellEdgeAttrs } from './tableCellEdgeAttrs';
7
- import { getChangedContentStyle, getChangedNodeStyle, getDeletedContentStyle, getDeletedContentStyleUnbounded, getInsertedContentStyle, hasRestingDeletedRing, isMultiContainerBlockNode, isTextLikeBlockNode, resolveCellOverlayStyle, resolveNestedInsertedNodeStyle, resolveRemovedLozengeStyle } from './wrapBlockNodeViewStyles';
8
+ import { getChangedContentStyle, getChangedNodeStyle, getDeletedContentStyle, getDeletedContentStyleUnbounded, getInsertedContentStyle, hasRestingDeletedRing, isMultiContainerBlockNode, isTextLikeBlockNode, resolveCellOverlayStyle, resolveDeletedNodeCSSVariables, resolveNestedInsertedNodeStyle, resolveRemovedLozengeStyle } from './wrapBlockNodeViewStyles';
8
9
  const shouldShowRemovedLozenge = nodeName => {
9
10
  switch (nodeName) {
10
11
  case 'expand':
@@ -46,6 +47,65 @@ const maybeAddDeletedOutlineNewClass = ({
46
47
  nodeView.classList.add('show-diff-deleted-outline-new');
47
48
  }
48
49
  };
50
+ /**
51
+ * Pre-refactor markup for a deleted media/embed/blockquote nodeview: one class per scheme, and no
52
+ * custom properties — the colours come from the matching per-scheme selectors in editor-core.
53
+ *
54
+ * Delete this together with those selectors at experiment cleanup (EDITOR-8281).
55
+ */
56
+ const applyDeletedNodeMarkupLegacy = ({
57
+ nodeView,
58
+ targetNode,
59
+ colorScheme,
60
+ isActive = false
61
+ }) => {
62
+ nodeView.classList.add(colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node');
63
+ if (isActive) {
64
+ nodeView.classList.add('show-diff-deleted-active');
65
+ }
66
+ maybeAddDeletedOutlineNewClass({
67
+ nodeView,
68
+ targetNode,
69
+ colorScheme,
70
+ isActive
71
+ });
72
+ };
73
+
74
+ /**
75
+ * Registry-driven markup: one scheme-agnostic class, plus the scheme's colours as custom properties,
76
+ * so editor-core needs one selector per visual role instead of one per scheme.
77
+ *
78
+ * `show-diff-deleted-node-vars` *replaces* the legacy classes rather than joining them. Both sets of
79
+ * selectors live in editor-core for the life of the experiment, and they have equal specificity, so
80
+ * a shared base class would leave the winner up to source order.
81
+ *
82
+ * The `-vars` suffix names what the class means — this node carries its scheme colours as
83
+ * `--diff-delete-*` custom properties — rather than when it arrived, so it still reads correctly
84
+ * once the legacy classes are gone.
85
+ */
86
+ const applyDeletedNodeMarkupNext = ({
87
+ nodeView,
88
+ targetNode,
89
+ colorScheme,
90
+ isActive = false
91
+ }) => {
92
+ nodeView.classList.add('show-diff-deleted-node-vars');
93
+ if (isActive) {
94
+ nodeView.classList.add('show-diff-deleted-active');
95
+ }
96
+ maybeAddDeletedOutlineNewClass({
97
+ nodeView,
98
+ targetNode,
99
+ colorScheme,
100
+ isActive
101
+ });
102
+ const currentStyle = nodeView.getAttribute('style') || '';
103
+ const separator = currentStyle && !currentStyle.trimEnd().endsWith(';') ? ';' : '';
104
+ nodeView.setAttribute('style', `${currentStyle}${separator}${resolveDeletedNodeCSSVariables(colorScheme)}`);
105
+ };
106
+
107
+ /** Single gate for the deleted-node classes and custom properties. */
108
+ const applyDeletedNodeMarkup = args => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? applyDeletedNodeMarkupNext(args) : applyDeletedNodeMarkupLegacy(args);
49
109
 
50
110
  /**
51
111
  * Checks if a node should apply deleted styles directly without wrapper
@@ -254,12 +314,7 @@ const handleEmbedCardWithLozenge = ({
254
314
  });
255
315
  }
256
316
  if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
257
- const showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
258
- nodeView.classList.add(showDiffDeletedNodeClass);
259
- if (isActive) {
260
- nodeView.classList.add('show-diff-deleted-active');
261
- }
262
- maybeAddDeletedOutlineNewClass({
317
+ applyDeletedNodeMarkup({
263
318
  nodeView,
264
319
  targetNode,
265
320
  colorScheme,
@@ -300,12 +355,7 @@ const handleMediaSingleWithLozenge = ({
300
355
 
301
356
  // Add deleted node class if needed
302
357
  if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
303
- const showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
304
- nodeView.classList.add(showDiffDeletedNodeClass);
305
- if (isActive) {
306
- nodeView.classList.add('show-diff-deleted-active');
307
- }
308
- maybeAddDeletedOutlineNewClass({
358
+ applyDeletedNodeMarkup({
309
359
  nodeView,
310
360
  targetNode,
311
361
  colorScheme,
@@ -367,12 +417,7 @@ const wrapBlockNode = ({
367
417
  });
368
418
  blockWrapper.append(contentWrapper);
369
419
  if (nodeView instanceof HTMLElement && shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
370
- const showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
371
- nodeView.classList.add(showDiffDeletedNodeClass);
372
- if (isActive) {
373
- nodeView.classList.add('show-diff-deleted-active');
374
- }
375
- maybeAddDeletedOutlineNewClass({
420
+ applyDeletedNodeMarkup({
376
421
  nodeView,
377
422
  targetNode,
378
423
  colorScheme,
@@ -13,7 +13,7 @@
13
13
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
14
14
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
15
15
  import { isExtendedEnabled } from '../../isExtendedEnabled';
16
- import { buildAddedCellOverlayRoundedStyle, buildAddedCellOverlayStyle, buildAddedCellOverlayStyleNew, buildDeletedCellOverlayRoundedStyle, buildDeletedCellOverlayStyle, buildDeletedInlineContentStyle, buildDeletedInlineContentStyleExtended, buildDeletedLozengeActiveStyle, buildDeletedLozengeStyle, buildDeletedQuoteNodeWithLozengeStyle, buildDeletedStrikethroughLine, buildDeletedWrappedBlockOutline, buildInsertedBlockNodeStyle, buildInsertedInlineStyle, buildInsertStyleInBlockExtended, buildInsertStyleInBlockExtendedNoUnderline, buildInsertStyleNode } from '../colorSchemes/factory';
16
+ import { buildAddedCellOverlayRoundedStyle, buildAddedCellOverlayStyle, buildAddedCellOverlayStyleNew, buildDeletedCellOverlayRoundedStyle, buildDeletedCellOverlayStyle, buildDeletedInlineContentStyle, buildDeletedInlineContentStyleExtended, buildDeletedLozengeActiveStyle, buildDeletedLozengeStyle, buildDeletedNodeCSSVariables, buildDeletedQuoteNodeWithLozengeStyle, buildDeletedStrikethroughLine, buildDeletedWrappedBlockOutline, buildInsertedBlockNodeStyle, buildInsertedInlineStyle, buildInsertStyleInBlockExtended, buildInsertStyleInBlockExtendedNoUnderline, buildInsertStyleNode } from '../colorSchemes/factory';
17
17
  import { colorSchemeRegistry, standardScheme } from '../colorSchemes/schemes';
18
18
  import { getChangedContentStyleLegacy, getChangedNodeStyleLegacy, getDeletedContentStyleLegacy, getDeletedContentStyleUnboundedLegacy, getInsertedContentStyleLegacy, hasRestingDeletedRingLegacy, resolveCellOverlayStyleLegacy, resolveNestedInsertedNodeStyleLegacy, resolveRemovedLozengeStyleLegacy } from './wrapBlockNodeViewStyles.legacy';
19
19
  const DEFAULT_COLOR_SCHEME = 'standard';
@@ -25,7 +25,6 @@ const getColorScheme = colorScheme => colorSchemeRegistry[colorScheme !== null &
25
25
  * Preserved as-is; see EDITOR-8281.
26
26
  */
27
27
  const nestedContentScheme = standardScheme;
28
- const lozengeStyle = buildDeletedLozengeStyle();
29
28
 
30
29
  /**
31
30
  * Node-name classification shared by the style resolvers below and by the routing in
@@ -99,7 +98,10 @@ const resolveCellOverlayStyleNext = ({
99
98
  const deletedCellStyle = isRoundedTable ? buildDeletedCellOverlayRoundedStyle(colors) : buildDeletedCellOverlayStyle(colors);
100
99
  return isInserted ? addedCellStyle : deletedCellStyle;
101
100
  };
102
- const resolveRemovedLozengeStyleNext = (colorScheme, isActive) => isActive ? buildDeletedLozengeActiveStyle(getColorScheme(colorScheme)) : lozengeStyle;
101
+ const resolveRemovedLozengeStyleNext = (colorScheme, isActive) => {
102
+ const colors = getColorScheme(colorScheme);
103
+ return isActive ? buildDeletedLozengeActiveStyle(colors) : buildDeletedLozengeStyle(colors);
104
+ };
103
105
  const resolveNestedInsertedNodeStyleNext = () => buildInsertStyleNode(nestedContentScheme);
104
106
 
105
107
  // Only 'stateful' schemes have a resting ring.
@@ -140,4 +142,12 @@ export const resolveNestedInsertedNodeStyle = () => isExperimentEnabled('platfor
140
142
  * Whether the colour scheme draws a resting (non-active) ring on a deleted media/embed node, which
141
143
  * is what the `show-diff-deleted-outline-new` class styles in editor-core's smartCardStyles.
142
144
  */
143
- export const hasRestingDeletedRing = colorScheme => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? hasRestingDeletedRingNext(colorScheme) : hasRestingDeletedRingLegacy(colorScheme);
145
+ export const hasRestingDeletedRing = colorScheme => isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? hasRestingDeletedRingNext(colorScheme) : hasRestingDeletedRingLegacy(colorScheme);
146
+
147
+ /**
148
+ * Custom properties consumed by the `show-diff-deleted-node-vars` selectors in editor-core.
149
+ *
150
+ * No `*Legacy` counterpart: the OFF cohort emits no properties at all and takes its colours from the
151
+ * per-scheme selectors instead, so the gate lives at the single caller in `wrapBlockNodeView`.
152
+ */
153
+ export const resolveDeletedNodeCSSVariables = colorScheme => buildDeletedNodeCSSVariables(getColorScheme(colorScheme));
@@ -1,5 +1,6 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
3
4
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
4
5
 
5
6
  /**
@@ -96,11 +97,29 @@ export var NodeViewSerializer = /*#__PURE__*/function () {
96
97
  return null;
97
98
  }
98
99
  var constructor = (_this$nodeViews = this.nodeViews) === null || _this$nodeViews === void 0 ? void 0 : _this$nodeViews[targetNode.type.name];
99
- if (this.nodeViewBlocklist.has(targetNode.type.name)) {
100
+ var isBlocklisted = this.nodeViewBlocklist.has(targetNode.type.name);
101
+
102
+ // Do not bail out a blocklisted container when it holds an atomic inline node
103
+ // (e.g. date, status) whose schema toDOM is lossy. Text keeps bailing so the caller
104
+ // renders it inline
105
+ var hasAtomicInlineChild = function hasAtomicInlineChild(node) {
106
+ var found = false;
107
+ node.forEach(function (child) {
108
+ if (child.isLeaf && !child.isText) {
109
+ found = true;
110
+ }
111
+ });
112
+ return found;
113
+ };
114
+ var serializeAtomicContainer = isExperimentEnabled('platform_editor_show_diff_deleted_nodeview_content') && !targetNode.isInline && hasAtomicInlineChild(targetNode);
115
+ if (isBlocklisted && !serializeAtomicContainer) {
100
116
  return null;
101
117
  }
102
118
  try {
103
- if (!constructor) {
119
+ // No constructor, or (gated) the node's own view is blocklisted: render the toDOM
120
+ // shell and recurse via appendChildNodes so nested atomic inline nodes render via
121
+ // their node views instead of their lossy schema toDOM.
122
+ if (!constructor || isExperimentEnabled('platform_editor_show_diff_deleted_nodeview_content') && isBlocklisted) {
104
123
  var _targetNode$type$spec, _targetNode$type$spec2;
105
124
  if (targetNode.isInline) {
106
125
  return null;
@@ -113,11 +132,12 @@ export var NodeViewSerializer = /*#__PURE__*/function () {
113
132
  _dom = _DOMSerializer$render.dom,
114
133
  _contentDOM = _DOMSerializer$render.contentDOM;
115
134
  if (_dom instanceof HTMLElement) {
116
- if (targetNode.type.name === 'paragraph' && targetNode.children.length === 1) {
135
+ // Legacy shortcut: a single-child paragraph serializes its inline content
136
+ // directly (no <p> wrapper). Applies only to a non-blocklisted paragraph with
137
+ // no node view
138
+ if (!isExperimentEnabled('platform_editor_show_diff_deleted_nodeview_content') && targetNode.type.name === 'paragraph' && targetNode.children.length === 1) {
117
139
  return this.serializeFragment(targetNode.content);
118
140
  }
119
-
120
- // Iteratively populate children
121
141
  this.appendChildNodes(targetNode.children, _contentDOM);
122
142
  }
123
143
  return _dom;
@@ -27,6 +27,17 @@ var bgSubtlestPressedMap = {
27
27
  magenta: "var(--ds-background-accent-magenta-subtlest-pressed, #FCB6E1)",
28
28
  gray: "var(--ds-background-accent-gray-subtlest-pressed, #B7B9BE)"
29
29
  };
30
+ var bgSubtlerMap = {
31
+ green: "var(--ds-background-accent-green-subtler, #BAF3DB)",
32
+ teal: "var(--ds-background-accent-teal-subtler, #C6EDFB)",
33
+ blue: "var(--ds-background-accent-blue-subtler, #CFE1FD)",
34
+ purple: "var(--ds-background-accent-purple-subtler, #EED7FC)",
35
+ red: "var(--ds-background-accent-red-subtler, #FFD5D2)",
36
+ orange: "var(--ds-background-accent-orange-subtler, #FCE4A6)",
37
+ yellow: "var(--ds-background-accent-yellow-subtler, #F5E989)",
38
+ magenta: "var(--ds-background-accent-magenta-subtler, #FDD0EC)",
39
+ gray: "var(--ds-background-accent-gray-subtler, #DDDEE1)"
40
+ };
30
41
  var bgSubtlerPressedMap = {
31
42
  green: "var(--ds-background-accent-green-subtler-pressed, #7EE2B8)",
32
43
  teal: "var(--ds-background-accent-teal-subtler-pressed, #9DD9EE)",
@@ -66,6 +77,9 @@ function bgSubtlest(color) {
66
77
  function bgSubtlestPressed(color) {
67
78
  return bgSubtlestPressedMap[color];
68
79
  }
80
+ function bgSubtler(color) {
81
+ return bgSubtlerMap[color];
82
+ }
69
83
  function bgSubtlerPressed(color) {
70
84
  return bgSubtlerPressedMap[color];
71
85
  }
@@ -604,7 +618,7 @@ export function buildDeletedCellOverlayStyle(colors) {
604
618
  left: 0,
605
619
  width: '100%',
606
620
  height: '100%',
607
- backgroundColor: "rgba(from ".concat(bgSubtlest(colors.deletedCellColor), " r g b / 0.5)"),
621
+ backgroundColor: "rgba(from ".concat(bgSubtlest(colors.deletedCellColor), " r g b / ").concat(colors.deletedCellOpacity, ")"),
608
622
  zIndex: 1,
609
623
  outline: "1px solid ".concat(deletedCellOutline(colors)),
610
624
  pointerEvents: 'none'
@@ -619,7 +633,7 @@ export function buildDeletedCellOverlayRoundedStyle(colors) {
619
633
  left: 0,
620
634
  width: '100%',
621
635
  height: '100%',
622
- backgroundColor: "rgba(from ".concat(bgSubtlest(colors.deletedCellColor), " r g b / 0.5)"),
636
+ backgroundColor: "rgba(from ".concat(bgSubtlest(colors.deletedCellColor), " r g b / ").concat(colors.deletedCellOpacity, ")"),
623
637
  zIndex: 2,
624
638
  outline: "1px solid ".concat(deletedCellOutline(colors)),
625
639
  pointerEvents: 'none',
@@ -676,7 +690,7 @@ export function buildDeletedStrikethroughLine(colors, isActive) {
676
690
 
677
691
  // --- Deleted-content "REMOVED" lozenge ---
678
692
 
679
- /** Structural CSS shared by both lozenge states — everything except the background tint. */
693
+ /** Structural CSS shared by both lozenge states — everything except the tint and the label colour. */
680
694
  var deletedLozengeBase = {
681
695
  display: 'inline-flex',
682
696
  boxSizing: 'border-box',
@@ -689,23 +703,30 @@ var deletedLozengeBase = {
689
703
  font: "var(--ds-font-body-small, normal 400 12px/16px \"Atlassian Sans\", ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
690
704
  fontWeight: "var(--ds-font-weight-bold, 653)",
691
705
  textOverflow: 'ellipsis',
692
- whiteSpace: 'nowrap',
693
- color: "var(--ds-text-warning-inverse, #292A2E)"
706
+ whiteSpace: 'nowrap'
694
707
  };
695
708
 
696
709
  /**
697
- * The "REMOVED" lozenge on a deleted block node — resting state. Neutral gray in every scheme,
698
- * so it takes no DiffColorScheme; only the active state is tinted.
710
+ * Label colour for both lozenge states. `inverse` is a fixed tone that reads on any tint, which is
711
+ * why the resting lozenge could get away with a hardcoded gray background; a scheme that tints the
712
+ * lozenge itself needs `accent` instead.
699
713
  */
700
- export function buildDeletedLozengeStyle() {
714
+ function deletedLozengeTextColor(colors) {
715
+ return colors.deletedLozengeTextTone === 'accent' ? textAccent(colors.deletedLozengeColor) : "var(--ds-text-warning-inverse, #292A2E)";
716
+ }
717
+
718
+ /** The "REMOVED" lozenge on a deleted block node — resting state, tinted with deletedLozengeColor. */
719
+ export function buildDeletedLozengeStyle(colors) {
701
720
  return convertToInlineCss(_objectSpread(_objectSpread({}, deletedLozengeBase), {}, {
702
- backgroundColor: "var(--ds-background-accent-gray-subtler, #DDDEE1)"
721
+ color: deletedLozengeTextColor(colors),
722
+ backgroundColor: bgSubtler(colors.deletedLozengeColor)
703
723
  }));
704
724
  }
705
725
 
706
726
  /** The "REMOVED" lozenge — active state, tinted with the scheme's deleteActiveColor. */
707
727
  export function buildDeletedLozengeActiveStyle(colors) {
708
728
  return convertToInlineCss(_objectSpread(_objectSpread({}, deletedLozengeBase), {}, {
729
+ color: deletedLozengeTextColor(colors),
709
730
  backgroundColor: bgSubtlerPressed(colors.deleteActiveColor)
710
731
  }));
711
732
  }
@@ -836,18 +857,38 @@ export function buildAtomicInlineChangedCSSVariables(colors) {
836
857
  }
837
858
 
838
859
  /**
839
- * Deleted-node wrapper variables, one per visual role in editor-core's `showDiffDeletedNodeStyles`:
840
- * resting ring, `-outline-new` ring, `-active` ring, and the blockquote/embedCard strike colour.
860
+ * Deleted-node wrapper variables, one per visual role in editor-core's `showDiffDeletedNodeStyles`.
861
+ * Emitted by `wrapBlockNodeView` alongside `show-diff-deleted-node-vars` — the class is named for
862
+ * these properties — so one set of selectors in editor-core covers both schemes.
863
+ *
864
+ * The three `stateful`-only variables are omitted for `static` (standard) so editor-core's fallback
865
+ * wins, which is what standard rendered before:
866
+ * - `--diff-delete-opacity` — the fallback is 0.6 or 0.8 depending on
867
+ * `platform_editor_enghealth_a11y_jan_fixes`, a split the scheme must not flatten.
868
+ * - `--diff-delete-ring-width` — traditional's deleted media ring tracks the inherited marker ring
869
+ * width instead of a fixed 1px.
870
+ * - `--diff-delete-text-decoration-color` — standard's blockquote strike must stay `currentColor`.
841
871
  *
842
- * Not yet called — those selectors carry `var(…, <today's token>)` fallbacks until
843
- * `wrapBlockNodeView` emits these under the refactor gate. No opacity variable: that opacity is
844
- * driven by `platform_editor_enghealth_a11y_jan_fixes`, not by the scheme.
872
+ * `--diff-delete-media-ring-color` is emitted for every scheme: the a11y-fixes treatment rings
873
+ * deleted media red even where `deleteColor` is gray, so it needs its own role.
874
+ *
875
+ * `--diff-delete-embed-strike-line` carries the *presence* of the deleted-embedCard strike, not its
876
+ * colour — standard draws none. Encoding it as `line-through`/`none` is what lets the ON cohort drop
877
+ * the `-traditional` class entirely.
878
+ *
879
+ * Only reached when `platform_editor_show_diff_color_scheme_refactor` is on; the OFF cohort takes
880
+ * its values from the per-scheme selectors in editor-core instead.
845
881
  */
846
882
  export function buildDeletedNodeCSSVariables(colors) {
847
- return convertToInlineCss({
883
+ return convertToInlineCss(_objectSpread({
848
884
  '--diff-delete-color': borderAccent(colors.deleteColor),
849
885
  '--diff-delete-color-new': bgSubtlest(colors.deleteColor),
850
886
  '--diff-delete-color-active': bgSubtlerPressed(colors.deleteActiveColor),
887
+ '--diff-delete-media-ring-color': borderAccent(colors.deletedMediaRingColor),
888
+ '--diff-delete-embed-strike-line': colors.strikesDeletedEmbedCard ? 'line-through' : 'none'
889
+ }, colors.deletedNodeEmphasis === 'stateful' ? {
890
+ '--diff-delete-opacity': '1',
891
+ '--diff-delete-ring-width': 'var(--diff-decoration-marker-ring-width, 1px)',
851
892
  '--diff-delete-text-decoration-color': borderAccent(colors.deleteColor)
852
- });
893
+ } : {}));
853
894
  }