@atlaskit/editor-plugin-show-diff 6.3.2 → 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.
Files changed (35) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +38 -24
  3. package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +7 -1
  4. package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +21 -6
  5. package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +14 -1
  6. package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +7 -2
  7. package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +159 -62
  8. package/dist/cjs/pm-plugins/main.js +10 -5
  9. package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +37 -25
  10. package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +6 -0
  11. package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +20 -6
  12. package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +13 -2
  13. package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -1
  14. package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +120 -21
  15. package/dist/es2019/pm-plugins/main.js +10 -5
  16. package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +38 -24
  17. package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +6 -0
  18. package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +21 -6
  19. package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +14 -2
  20. package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +7 -2
  21. package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +160 -63
  22. package/dist/esm/pm-plugins/main.js +10 -5
  23. package/dist/types/pm-plugins/calculateDiff/calculateDiffDecorations.d.ts +2 -1
  24. package/dist/types/pm-plugins/decorations/colorSchemes/standard.d.ts +1 -0
  25. package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.d.ts +2 -1
  26. package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.d.ts +2 -1
  27. package/dist/types/pm-plugins/main.d.ts +1 -0
  28. package/dist/types/showDiffPluginType.d.ts +1 -0
  29. package/dist/types-ts4.5/pm-plugins/calculateDiff/calculateDiffDecorations.d.ts +2 -1
  30. package/dist/types-ts4.5/pm-plugins/decorations/colorSchemes/standard.d.ts +1 -0
  31. package/dist/types-ts4.5/pm-plugins/decorations/createBlockChangedDecoration.d.ts +2 -1
  32. package/dist/types-ts4.5/pm-plugins/decorations/createInlineChangedDecoration.d.ts +2 -1
  33. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -0
  34. package/dist/types-ts4.5/showDiffPluginType.d.ts +1 -0
  35. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
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
+
11
+ ## 6.4.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`7739efec523bc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7739efec523bc) -
16
+ EDITOR-6371: Add toggle for showing / hiding deleted changes in the diff.
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 6.3.2
4
23
 
5
24
  ### Patch 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);
@@ -56,7 +57,9 @@ var calculateNodesForBlockDecoration = function calculateNodesForBlockDecoration
56
57
  colorScheme = _ref2.colorScheme,
57
58
  _ref2$isInserted = _ref2.isInserted,
58
59
  isInserted = _ref2$isInserted === void 0 ? true : _ref2$isInserted,
59
- activeIndexPos = _ref2.activeIndexPos;
60
+ activeIndexPos = _ref2.activeIndexPos,
61
+ _ref2$shouldHideDelet = _ref2.shouldHideDeleted,
62
+ shouldHideDeleted = _ref2$shouldHideDelet === void 0 ? false : _ref2$shouldHideDelet;
60
63
  var decorations = [];
61
64
  // Iterate over the document nodes within the range
62
65
  doc.nodesBetween(from, to, function (node, pos) {
@@ -71,7 +74,8 @@ var calculateNodesForBlockDecoration = function calculateNodesForBlockDecoration
71
74
  },
72
75
  colorScheme: colorScheme,
73
76
  isInserted: isInserted,
74
- isActive: isActive
77
+ isActive: isActive,
78
+ shouldHideDeleted: shouldHideDeleted
75
79
  });
76
80
  if (blockChangedDecorations.length) {
77
81
  decorations.push.apply(decorations, (0, _toConsumableArray2.default)(blockChangedDecorations));
@@ -91,7 +95,9 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref3
91
95
  _ref3$isInverted = _ref3.isInverted,
92
96
  isInverted = _ref3$isInverted === void 0 ? false : _ref3$isInverted,
93
97
  _ref3$diffType = _ref3.diffType,
94
- diffType = _ref3$diffType === void 0 ? 'inline' : _ref3$diffType;
98
+ diffType = _ref3$diffType === void 0 ? 'inline' : _ref3$diffType,
99
+ _ref3$hideDeletedDiff = _ref3.hideDeletedDiffs,
100
+ hideDeletedDiffs = _ref3$hideDeletedDiff === void 0 ? false : _ref3$hideDeletedDiff;
95
101
  var originalDoc = pluginState.originalDoc,
96
102
  steps = pluginState.steps;
97
103
  if (!originalDoc || !pluginState.isDisplayingChanges) {
@@ -162,12 +168,14 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref3
162
168
  // Our default operations are insertions, so it should match the opposite of isInverted.
163
169
  var isInserted = !isInverted;
164
170
  if (change.inserted.length > 0) {
171
+ var shouldHideDeleted = (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) ? isInverted && hideDeletedDiffs : false;
165
172
  decorations.push((0, _createInlineChangedDecoration.createInlineChangedDecoration)(_objectSpread({
166
173
  change: change,
167
174
  colorScheme: colorScheme,
168
175
  isActive: isActive
169
176
  }, (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) && {
170
- isInserted: isInserted
177
+ isInserted: isInserted,
178
+ shouldHideDeleted: shouldHideDeleted
171
179
  })));
172
180
  decorations.push.apply(decorations, (0, _toConsumableArray2.default)(calculateNodesForBlockDecoration(_objectSpread(_objectSpread({
173
181
  doc: tr.doc,
@@ -175,27 +183,31 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref3
175
183
  to: change.toB,
176
184
  colorScheme: colorScheme
177
185
  }, (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) && {
178
- isInserted: isInserted
186
+ isInserted: isInserted,
187
+ shouldHideDeleted: shouldHideDeleted
179
188
  }), {}, {
180
189
  activeIndexPos: activeIndexPos,
181
190
  intl: intl
182
191
  }))));
183
192
  }
184
193
  if (change.deleted.length > 0) {
185
- var decoration = (0, _createNodeChangedDecorationWidget.createNodeChangedDecorationWidget)(_objectSpread({
186
- change: change,
187
- doc: originalDoc,
188
- nodeViewSerializer: nodeViewSerializer,
189
- colorScheme: colorScheme,
190
- newDoc: tr.doc,
191
- intl: intl,
192
- activeIndexPos: activeIndexPos
193
- }, (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) && {
194
- isInserted: !isInserted,
195
- diffType: diffType
196
- }));
197
- if (decoration) {
198
- decorations.push.apply(decorations, (0, _toConsumableArray2.default)(decoration));
194
+ var _shouldHideDeleted = (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) ? !isInverted && hideDeletedDiffs : false;
195
+ if (!_shouldHideDeleted) {
196
+ var decoration = (0, _createNodeChangedDecorationWidget.createNodeChangedDecorationWidget)(_objectSpread({
197
+ change: change,
198
+ doc: originalDoc,
199
+ nodeViewSerializer: nodeViewSerializer,
200
+ colorScheme: colorScheme,
201
+ newDoc: tr.doc,
202
+ intl: intl,
203
+ activeIndexPos: activeIndexPos
204
+ }, (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) && {
205
+ isInserted: !isInserted,
206
+ diffType: diffType
207
+ }));
208
+ if (decoration) {
209
+ decorations.push.apply(decorations, (0, _toConsumableArray2.default)(decoration));
210
+ }
199
211
  }
200
212
  }
201
213
  });
@@ -233,7 +245,8 @@ function (_ref4, _ref5) {
233
245
  intl = _ref6$.intl,
234
246
  activeIndexPos = _ref6$.activeIndexPos,
235
247
  isInverted = _ref6$.isInverted,
236
- diffType = _ref6$.diffType;
248
+ diffType = _ref6$.diffType,
249
+ hideDeletedDiffs = _ref6$.hideDeletedDiffs;
237
250
  var _ref7 = (0, _slicedToArray2.default)(_ref5, 1),
238
251
  _ref7$ = _ref7[0],
239
252
  lastPluginState = _ref7$.pluginState,
@@ -242,11 +255,12 @@ function (_ref4, _ref5) {
242
255
  lastIntl = _ref7$.intl,
243
256
  lastActiveIndexPos = _ref7$.activeIndexPos,
244
257
  lastIsInverted = _ref7$.isInverted,
245
- lastDiffType = _ref7$.diffType;
258
+ lastDiffType = _ref7$.diffType,
259
+ lastHideDeletedDiffs = _ref7$.hideDeletedDiffs;
246
260
  var originalDocIsSame = lastPluginState.originalDoc && pluginState.originalDoc && pluginState.originalDoc.eq(lastPluginState.originalDoc);
247
261
  if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
248
262
  var _ref8;
249
- return (_ref8 = colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isInverted === lastIsInverted && diffType === lastDiffType && (0, _isEqual.default)(activeIndexPos, lastActiveIndexPos) && originalDocIsSame && (0, _isEqual.default)(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc)) !== null && _ref8 !== void 0 ? _ref8 : false;
263
+ return (_ref8 = colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isInverted === lastIsInverted && diffType === lastDiffType && (0, _isEqual.default)(activeIndexPos, lastActiveIndexPos) && originalDocIsSame && (0, _isEqual.default)(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && hideDeletedDiffs === lastHideDeletedDiffs) !== null && _ref8 !== void 0 ? _ref8 : false;
250
264
  }
251
- return (_ref9 = originalDocIsSame && (0, _isEqual.default)(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && colorScheme === lastColorScheme && intl.locale === lastIntl.locale && (0, _isEqual.default)(activeIndexPos, lastActiveIndexPos)) !== null && _ref9 !== void 0 ? _ref9 : false;
265
+ return (_ref9 = originalDocIsSame && (0, _isEqual.default)(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && colorScheme === lastColorScheme && intl.locale === lastIntl.locale && (0, _isEqual.default)(activeIndexPos, lastActiveIndexPos) && hideDeletedDiffs === lastHideDeletedDiffs) !== null && _ref9 !== void 0 ? _ref9 : false;
252
266
  });
@@ -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',
@@ -10,6 +10,9 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
10
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
11
11
  var _standard = require("./colorSchemes/standard");
12
12
  var _traditional = require("./colorSchemes/traditional");
13
+ var displayNoneStyle = (0, _lazyNodeView.convertToInlineCss)({
14
+ display: 'none'
15
+ });
13
16
  var getNodeClass = function getNodeClass(name) {
14
17
  switch (name) {
15
18
  case 'extension':
@@ -108,8 +111,19 @@ var createBlockChangedDecoration = exports.createBlockChangedDecoration = functi
108
111
  _ref2$isInserted = _ref2.isInserted,
109
112
  isInserted = _ref2$isInserted === void 0 ? true : _ref2$isInserted,
110
113
  _ref2$isActive = _ref2.isActive,
111
- isActive = _ref2$isActive === void 0 ? false : _ref2$isActive;
114
+ isActive = _ref2$isActive === void 0 ? false : _ref2$isActive,
115
+ _ref2$shouldHideDelet = _ref2.shouldHideDeleted,
116
+ shouldHideDeleted = _ref2$shouldHideDelet === void 0 ? false : _ref2$shouldHideDelet;
112
117
  var decorations = [];
118
+ if (shouldHideDeleted) {
119
+ return [_view.Decoration.node(change.from, change.to, {
120
+ style: displayNoneStyle
121
+ }, {
122
+ key: 'diff-block',
123
+ nodeName: change.name
124
+ })];
125
+ }
126
+ var style;
113
127
  if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) && ['tableCell', 'tableHeader'].includes(change.name)) {
114
128
  var cellOverlay = document.createElement('div');
115
129
  var cellOverlayStyle = isInserted ? colorScheme === 'traditional' ? _traditional.traditionalAddedCellOverlayStyle : _standard.addedCellOverlayStyle : colorScheme === 'traditional' ? _traditional.deletedTraditionalCellOverlayStyle : _standard.deletedCellOverlayStyle;
@@ -120,11 +134,6 @@ var createBlockChangedDecoration = exports.createBlockChangedDecoration = functi
120
134
  key: "diff-widget-cell-overlay-".concat(change.to)
121
135
  }));
122
136
  }
123
- var style = getBlockNodeStyle({
124
- nodeName: change.name,
125
- colorScheme: colorScheme,
126
- isActive: isActive
127
- });
128
137
  if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
129
138
  style = getBlockNodeStyle({
130
139
  nodeName: change.name,
@@ -132,6 +141,12 @@ var createBlockChangedDecoration = exports.createBlockChangedDecoration = functi
132
141
  isInserted: isInserted,
133
142
  isActive: isActive
134
143
  });
144
+ } else {
145
+ style = getBlockNodeStyle({
146
+ nodeName: change.name,
147
+ colorScheme: colorScheme,
148
+ isActive: isActive
149
+ });
135
150
  }
136
151
  var className = getNodeClass(change.name);
137
152
  if ((0, _platformFeatureFlags.fg)('platform_editor_show_diff_scroll_navigation')) {
@@ -4,10 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createInlineChangedDecoration = void 0;
7
+ var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
7
8
  var _view = require("@atlaskit/editor-prosemirror/view");
8
9
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
9
10
  var _standard = require("./colorSchemes/standard");
10
11
  var _traditional = require("./colorSchemes/traditional");
12
+ var displayNoneStyle = (0, _lazyNodeView.convertToInlineCss)({
13
+ display: 'none'
14
+ });
11
15
  /**
12
16
  * Inline decoration used for insertions as the content already exists in the document
13
17
  *
@@ -21,7 +25,16 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
21
25
  _ref$isActive = _ref.isActive,
22
26
  isActive = _ref$isActive === void 0 ? false : _ref$isActive,
23
27
  _ref$isInserted = _ref.isInserted,
24
- isInserted = _ref$isInserted === void 0 ? true : _ref$isInserted;
28
+ isInserted = _ref$isInserted === void 0 ? true : _ref$isInserted,
29
+ _ref$shouldHideDelete = _ref.shouldHideDeleted,
30
+ shouldHideDeleted = _ref$shouldHideDelete === void 0 ? false : _ref$shouldHideDelete;
31
+ if (shouldHideDeleted) {
32
+ return _view.Decoration.inline(change.fromB, change.toB, {
33
+ style: displayNoneStyle
34
+ }, {
35
+ key: 'diff-inline'
36
+ });
37
+ }
25
38
  var style;
26
39
  if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
27
40
  if (isInserted) {
@@ -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
  };
@@ -43,7 +43,8 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
43
43
  isDisplayingChanges: false
44
44
  }, (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) ? {
45
45
  isInverted: false,
46
- diffType: 'inline'
46
+ diffType: 'inline',
47
+ hideDeletedDiffs: false
47
48
  } : {});
48
49
  },
49
50
  apply: function apply(tr, currentPluginState, oldState, newState) {
@@ -51,7 +52,7 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
51
52
  var newPluginState = currentPluginState;
52
53
  if (meta) {
53
54
  if ((meta === null || meta === void 0 ? void 0 : meta.action) === 'SHOW_DIFF') {
54
- var _newPluginState, _newPluginState2;
55
+ var _newPluginState, _newPluginState2, _newPluginState3;
55
56
  // Update the plugin state with the new metadata
56
57
  newPluginState = _objectSpread(_objectSpread(_objectSpread({}, currentPluginState), meta), {}, {
57
58
  isDisplayingChanges: true,
@@ -68,7 +69,8 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
68
69
  api: api
69
70
  }, (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) ? {
70
71
  isInverted: (_newPluginState = newPluginState) === null || _newPluginState === void 0 ? void 0 : _newPluginState.isInverted,
71
- diffType: (_newPluginState2 = newPluginState) === null || _newPluginState2 === void 0 ? void 0 : _newPluginState2.diffType
72
+ diffType: (_newPluginState2 = newPluginState) === null || _newPluginState2 === void 0 ? void 0 : _newPluginState2.diffType,
73
+ hideDeletedDiffs: (_newPluginState3 = newPluginState) === null || _newPluginState3 === void 0 ? void 0 : _newPluginState3.hideDeletedDiffs
72
74
  } : {}));
73
75
  // Update the decorations
74
76
  newPluginState.decorations = decorations;
@@ -79,7 +81,8 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
79
81
  activeIndex: undefined
80
82
  }, (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) ? {
81
83
  isInverted: false,
82
- diffType: 'inline'
84
+ diffType: 'inline',
85
+ hideDeletedDiffs: false
83
86
  } : {});
84
87
  } else if (((meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_NEXT' || (meta === null || meta === void 0 ? void 0 : meta.action) === 'SCROLL_TO_PREVIOUS') && (0, _platformFeatureFlags.fg)('platform_editor_show_diff_scroll_navigation')) {
85
88
  // Update the active index in plugin state and recalculate decorations
@@ -118,7 +121,9 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
118
121
  activeIndexPos: newPluginState.activeIndexPos,
119
122
  api: api
120
123
  }, (0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true) ? {
121
- isInverted: newPluginState.isInverted
124
+ isInverted: newPluginState.isInverted,
125
+ diffType: newPluginState.diffType,
126
+ hideDeletedDiffs: newPluginState.hideDeletedDiffs
122
127
  } : {}));
123
128
  newPluginState.decorations = updatedDecorations;
124
129
  }