@atlaskit/editor-plugin-show-diff 12.1.0 → 12.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 12.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3d45d0ef1fb3f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3d45d0ef1fb3f) -
8
+ Prevent block diff content from overlapping preceding editor nodes
9
+
10
+ ## 12.1.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [`3a38a59a355f5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3a38a59a355f5) -
15
+ Add a feature-gated platform experiments strangler entry point and migrate the inline-diffs
16
+ experiment as its first consumer.
17
+
18
+ ```ts
19
+ import { isExperimentEnabled } from '@atlaskit/editor-common/deprecated-platform-feature-experiments';
20
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
21
+
22
+ const isEnabled = isExperimentEnabled('platform_editor_example', () =>
23
+ expValEquals('platform_editor_example', 'isEnabled', true),
24
+ );
25
+ ```
26
+
27
+ - Updated dependencies
28
+
3
29
  ## 12.1.0
4
30
 
5
31
  ### Minor Changes
@@ -11,6 +11,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
11
11
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
12
12
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
13
13
  var _prosemirrorChangeset = require("prosemirror-changeset");
14
+ var _deprecatedPlatformFeatureExperiments = require("@atlaskit/editor-common/deprecated-platform-feature-experiments");
14
15
  var _document = require("@atlaskit/editor-common/utils/document");
15
16
  var _view = require("@atlaskit/editor-prosemirror/view");
16
17
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
@@ -471,7 +472,9 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref4
471
472
  if (change.isInline) {
472
473
  // Inline nodes (e.g. date, emoji, mention, status) need an inline decoration rather than a block decoration
473
474
  var isActive = activeIndexPos && change.fromB === activeIndexPos.from && change.toB === activeIndexPos.to;
474
- var isAtomicInlineNodeFlag = (0, _expValEquals.expValEquals)('platform_editor_improve_inline_diffs', 'isEnabled', true);
475
+ var isAtomicInlineNodeFlag = (0, _deprecatedPlatformFeatureExperiments.isExperimentEnabled)('platform_editor_improve_inline_diffs', function () {
476
+ return (0, _expValEquals.expValEquals)('platform_editor_improve_inline_diffs', 'isEnabled', true);
477
+ });
475
478
  decorations.push.apply(decorations, (0, _toConsumableArray2.default)((0, _createInlineChangedDecoration.createInlineChangedDecoration)({
476
479
  change: change,
477
480
  colorScheme: colorScheme,
@@ -486,7 +489,9 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref4
486
489
  })));
487
490
  // If we have the original node position, also render the old node as a "deleted" widget
488
491
  // so the user can see what it looked like before the change.
489
- if (change.fromA !== undefined && change.toA !== undefined && (0, _expValEquals.expValEquals)('platform_editor_improve_inline_diffs', 'isEnabled', true)) {
492
+ if (change.fromA !== undefined && change.toA !== undefined && (0, _deprecatedPlatformFeatureExperiments.isExperimentEnabled)('platform_editor_improve_inline_diffs', function () {
493
+ return (0, _expValEquals.expValEquals)('platform_editor_improve_inline_diffs', 'isEnabled', true);
494
+ })) {
490
495
  decorations.push.apply(decorations, (0, _toConsumableArray2.default)((0, _createNodeChangedDecorationWidget.createNodeChangedDecorationWidget)({
491
496
  change: {
492
497
  fromA: change.fromA,
@@ -20,7 +20,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
20
20
  * that is not in the current document.
21
21
  */
22
22
  var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidget = function createNodeChangedDecorationWidget(_ref) {
23
- var _slice$content, _slice$content2, _slice$content3, _slice$content$firstC;
23
+ var _slice$content, _slice$content2, _slice$content3, _$safeInsertPos$nodeB, _slice$content$firstC;
24
24
  var change = _ref.change,
25
25
  doc = _ref.doc,
26
26
  nodeViewSerializer = _ref.nodeViewSerializer,
@@ -77,6 +77,14 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
77
77
 
78
78
  // For non-table content, use the existing span wrapper approach
79
79
  var dom = document.createElement('span');
80
+ var $safeInsertPos = newDoc.resolve(safeInsertPos);
81
+ var isTopLevelInsert = $safeInsertPos.depth === 0;
82
+ var hasPreviousBlock = ((_$safeInsertPos$nodeB = $safeInsertPos.nodeBefore) === null || _$safeInsertPos$nodeB === void 0 ? void 0 : _$safeInsertPos$nodeB.isBlock) === true;
83
+ if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType) && isTopLevelInsert && hasPreviousBlock) {
84
+ // Editor CSS removes the top margin from a block when it is its parent's first child.
85
+ // Keep the serialized block as a subsequent child so each block type retains its own margin.
86
+ dom.append(dom.ownerDocument.createElement('div'));
87
+ }
80
88
  // When mediaSingle nodes are rendered inside a widget decoration (e.g. as part of
81
89
  // a replaced panel), the centering CSS (margin-left: 50%; transform: translateX(-50%))
82
90
  // incorrectly applies because isNestedNode resolves to false (getPos returns 0).
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.stepIsValidAttrChange = exports.getAttrChangeRanges = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _steps = require("@atlaskit/adf-schema/steps");
10
+ var _deprecatedPlatformFeatureExperiments = require("@atlaskit/editor-common/deprecated-platform-feature-experiments");
10
11
  var _transform = require("@atlaskit/editor-prosemirror/transform");
11
12
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
12
13
  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; }
@@ -70,7 +71,9 @@ var getAttrChangeRanges = exports.getAttrChangeRanges = function getAttrChangeRa
70
71
  // date node: timestamp attribute change — highlight the date node itself (inline)
71
72
  if (stepAttrs.some(function (v) {
72
73
  return dateAttrs.includes(v);
73
- }) && (nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.type.name) === 'date' && !(0, _expValEquals.expValEquals)('platform_editor_improve_inline_diffs', 'isEnabled', true)) {
74
+ }) && (nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.type.name) === 'date' && !(0, _deprecatedPlatformFeatureExperiments.isExperimentEnabled)('platform_editor_improve_inline_diffs', function () {
75
+ return (0, _expValEquals.expValEquals)('platform_editor_improve_inline_diffs', 'isEnabled', true);
76
+ })) {
74
77
  return {
75
78
  fromB: step.pos,
76
79
  toB: step.pos + nodeAtPos.nodeSize,
@@ -82,7 +85,9 @@ var getAttrChangeRanges = exports.getAttrChangeRanges = function getAttrChangeRa
82
85
  // The following inline node attr changes are gated behind platform_editor_improve_inline_diffs.
83
86
  // The changeset path (createDecorationsForChange) handles the deletion widget via
84
87
  // prosemirror-changeset; we only need to add the inline insertion highlight here.
85
- if ((0, _expValEquals.expValEquals)('platform_editor_improve_inline_diffs', 'isEnabled', true) && nodeAtPos) {
88
+ if ((0, _deprecatedPlatformFeatureExperiments.isExperimentEnabled)('platform_editor_improve_inline_diffs', function () {
89
+ return (0, _expValEquals.expValEquals)('platform_editor_improve_inline_diffs', 'isEnabled', true);
90
+ }) && nodeAtPos) {
86
91
  var nodeName = nodeAtPos.type.name;
87
92
  if (isInlineAttrChangeNodeName(nodeName)) {
88
93
  var watchedAttrs = inlineNodeAttrMap[nodeName];
@@ -143,7 +148,9 @@ var getAttrChangeRanges = exports.getAttrChangeRanges = function getAttrChangeRa
143
148
  // Gated behind the same experiment as the inline node attr changes that introduced
144
149
  // the possibility of multiple ranges for the same node position.
145
150
  .filter(function (range, i, arr) {
146
- return !(0, _expValEquals.expValEquals)('platform_editor_improve_inline_diffs', 'isEnabled', true) || arr.findIndex(function (r) {
151
+ return !(0, _deprecatedPlatformFeatureExperiments.isExperimentEnabled)('platform_editor_improve_inline_diffs', function () {
152
+ return (0, _expValEquals.expValEquals)('platform_editor_improve_inline_diffs', 'isEnabled', true);
153
+ }) || arr.findIndex(function (r) {
147
154
  return r.fromB === range.fromB;
148
155
  }) === i;
149
156
  });
@@ -2,6 +2,7 @@
2
2
  import isEqual from 'lodash/isEqual';
3
3
  import memoizeOne from 'memoize-one';
4
4
  import { ChangeSet, simplifyChanges } from 'prosemirror-changeset';
5
+ import { isExperimentEnabled } from '@atlaskit/editor-common/deprecated-platform-feature-experiments';
5
6
  import { areNodesEqualIgnoreAttrs } from '@atlaskit/editor-common/utils/document';
6
7
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
8
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -434,7 +435,7 @@ const calculateDiffDecorationsInner = ({
434
435
  if (change.isInline) {
435
436
  // Inline nodes (e.g. date, emoji, mention, status) need an inline decoration rather than a block decoration
436
437
  const isActive = activeIndexPos && change.fromB === activeIndexPos.from && change.toB === activeIndexPos.to;
437
- const isAtomicInlineNodeFlag = expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true);
438
+ const isAtomicInlineNodeFlag = isExperimentEnabled('platform_editor_improve_inline_diffs', () => expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true));
438
439
  decorations.push(...createInlineChangedDecoration({
439
440
  change,
440
441
  colorScheme,
@@ -449,7 +450,7 @@ const calculateDiffDecorationsInner = ({
449
450
  }));
450
451
  // If we have the original node position, also render the old node as a "deleted" widget
451
452
  // so the user can see what it looked like before the change.
452
- if (change.fromA !== undefined && change.toA !== undefined && expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true)) {
453
+ if (change.fromA !== undefined && change.toA !== undefined && isExperimentEnabled('platform_editor_improve_inline_diffs', () => expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true))) {
453
454
  decorations.push(...createNodeChangedDecorationWidget({
454
455
  change: {
455
456
  fromA: change.fromA,
@@ -28,7 +28,7 @@ export const createNodeChangedDecorationWidget = ({
28
28
  diffType,
29
29
  hideAddedDiffsUnderline = false
30
30
  }) => {
31
- var _slice$content, _slice$content2, _slice$content2$first, _slice$content3, _slice$content3$first, _slice$content$firstC;
31
+ var _slice$content, _slice$content2, _slice$content2$first, _slice$content3, _slice$content3$first, _$safeInsertPos$nodeB, _slice$content$firstC;
32
32
  const slice = doc.slice(change.fromA, change.toA);
33
33
  const shouldSkipDeletedEmptyParagraphDecoration = !isInserted && (slice === null || slice === void 0 ? void 0 : (_slice$content = slice.content) === null || _slice$content === void 0 ? void 0 : _slice$content.childCount) === 1 && (slice === null || slice === void 0 ? void 0 : (_slice$content2 = slice.content) === null || _slice$content2 === void 0 ? void 0 : (_slice$content2$first = _slice$content2.firstChild) === null || _slice$content2$first === void 0 ? void 0 : _slice$content2$first.type.name) === 'paragraph' && (slice === null || slice === void 0 ? void 0 : (_slice$content3 = slice.content) === null || _slice$content3 === void 0 ? void 0 : (_slice$content3$first = _slice$content3.firstChild) === null || _slice$content3$first === void 0 ? void 0 : _slice$content3$first.content.size) === 0;
34
34
  // Widget decoration used for deletions as the content is not in the document
@@ -61,6 +61,14 @@ export const createNodeChangedDecorationWidget = ({
61
61
 
62
62
  // For non-table content, use the existing span wrapper approach
63
63
  const dom = document.createElement('span');
64
+ const $safeInsertPos = newDoc.resolve(safeInsertPos);
65
+ const isTopLevelInsert = $safeInsertPos.depth === 0;
66
+ const hasPreviousBlock = ((_$safeInsertPos$nodeB = $safeInsertPos.nodeBefore) === null || _$safeInsertPos$nodeB === void 0 ? void 0 : _$safeInsertPos$nodeB.isBlock) === true;
67
+ if (isExtendedEnabled(diffType) && isTopLevelInsert && hasPreviousBlock) {
68
+ // Editor CSS removes the top margin from a block when it is its parent's first child.
69
+ // Keep the serialized block as a subsequent child so each block type retains its own margin.
70
+ dom.append(dom.ownerDocument.createElement('div'));
71
+ }
64
72
  // When mediaSingle nodes are rendered inside a widget decoration (e.g. as part of
65
73
  // a replaced panel), the centering CSS (margin-left: 50%; transform: translateX(-50%))
66
74
  // incorrectly applies because isNestedNode resolves to false (getPos returns 0).
@@ -1,4 +1,5 @@
1
1
  import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
2
+ import { isExperimentEnabled } from '@atlaskit/editor-common/deprecated-platform-feature-experiments';
2
3
  import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
3
4
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  const filterUndefined = x => !!x;
@@ -54,7 +55,7 @@ export const getAttrChangeRanges = (doc, steps, originalDoc) => {
54
55
  const nodeAtPos = doc.nodeAt(step.pos);
55
56
 
56
57
  // date node: timestamp attribute change — highlight the date node itself (inline)
57
- if (stepAttrs.some(v => dateAttrs.includes(v)) && (nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.type.name) === 'date' && !expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true)) {
58
+ if (stepAttrs.some(v => dateAttrs.includes(v)) && (nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.type.name) === 'date' && !isExperimentEnabled('platform_editor_improve_inline_diffs', () => expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true))) {
58
59
  return {
59
60
  fromB: step.pos,
60
61
  toB: step.pos + nodeAtPos.nodeSize,
@@ -66,7 +67,7 @@ export const getAttrChangeRanges = (doc, steps, originalDoc) => {
66
67
  // The following inline node attr changes are gated behind platform_editor_improve_inline_diffs.
67
68
  // The changeset path (createDecorationsForChange) handles the deletion widget via
68
69
  // prosemirror-changeset; we only need to add the inline insertion highlight here.
69
- if (expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true) && nodeAtPos) {
70
+ if (isExperimentEnabled('platform_editor_improve_inline_diffs', () => expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true)) && nodeAtPos) {
70
71
  const nodeName = nodeAtPos.type.name;
71
72
  if (isInlineAttrChangeNodeName(nodeName)) {
72
73
  const watchedAttrs = inlineNodeAttrMap[nodeName];
@@ -119,7 +120,7 @@ export const getAttrChangeRanges = (doc, steps, originalDoc) => {
119
120
  // should produce only one decoration, not one per step.
120
121
  // Gated behind the same experiment as the inline node attr changes that introduced
121
122
  // the possibility of multiple ranges for the same node position.
122
- .filter((range, i, arr) => !expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true) || arr.findIndex(r => r.fromB === range.fromB) === i);
123
+ .filter((range, i, arr) => !isExperimentEnabled('platform_editor_improve_inline_diffs', () => expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true)) || arr.findIndex(r => r.fromB === range.fromB) === i);
123
124
  };
124
125
 
125
126
  /**
@@ -10,6 +10,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
10
10
  import isEqual from 'lodash/isEqual';
11
11
  import memoizeOne from 'memoize-one';
12
12
  import { ChangeSet, simplifyChanges } from 'prosemirror-changeset';
13
+ import { isExperimentEnabled } from '@atlaskit/editor-common/deprecated-platform-feature-experiments';
13
14
  import { areNodesEqualIgnoreAttrs } from '@atlaskit/editor-common/utils/document';
14
15
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
15
16
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -465,7 +466,9 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref4
465
466
  if (change.isInline) {
466
467
  // Inline nodes (e.g. date, emoji, mention, status) need an inline decoration rather than a block decoration
467
468
  var isActive = activeIndexPos && change.fromB === activeIndexPos.from && change.toB === activeIndexPos.to;
468
- var isAtomicInlineNodeFlag = expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true);
469
+ var isAtomicInlineNodeFlag = isExperimentEnabled('platform_editor_improve_inline_diffs', function () {
470
+ return expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true);
471
+ });
469
472
  decorations.push.apply(decorations, _toConsumableArray(createInlineChangedDecoration({
470
473
  change: change,
471
474
  colorScheme: colorScheme,
@@ -480,7 +483,9 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref4
480
483
  })));
481
484
  // If we have the original node position, also render the old node as a "deleted" widget
482
485
  // so the user can see what it looked like before the change.
483
- if (change.fromA !== undefined && change.toA !== undefined && expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true)) {
486
+ if (change.fromA !== undefined && change.toA !== undefined && isExperimentEnabled('platform_editor_improve_inline_diffs', function () {
487
+ return expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true);
488
+ })) {
484
489
  decorations.push.apply(decorations, _toConsumableArray(createNodeChangedDecorationWidget({
485
490
  change: {
486
491
  fromA: change.fromA,
@@ -14,7 +14,7 @@ import { wrapBlockNodeView, injectInnerWrapper, createContentWrapper } from './u
14
14
  * that is not in the current document.
15
15
  */
16
16
  export var createNodeChangedDecorationWidget = function createNodeChangedDecorationWidget(_ref) {
17
- var _slice$content, _slice$content2, _slice$content3, _slice$content$firstC;
17
+ var _slice$content, _slice$content2, _slice$content3, _$safeInsertPos$nodeB, _slice$content$firstC;
18
18
  var change = _ref.change,
19
19
  doc = _ref.doc,
20
20
  nodeViewSerializer = _ref.nodeViewSerializer,
@@ -71,6 +71,14 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
71
71
 
72
72
  // For non-table content, use the existing span wrapper approach
73
73
  var dom = document.createElement('span');
74
+ var $safeInsertPos = newDoc.resolve(safeInsertPos);
75
+ var isTopLevelInsert = $safeInsertPos.depth === 0;
76
+ var hasPreviousBlock = ((_$safeInsertPos$nodeB = $safeInsertPos.nodeBefore) === null || _$safeInsertPos$nodeB === void 0 ? void 0 : _$safeInsertPos$nodeB.isBlock) === true;
77
+ if (isExtendedEnabled(diffType) && isTopLevelInsert && hasPreviousBlock) {
78
+ // Editor CSS removes the top margin from a block when it is its parent's first child.
79
+ // Keep the serialized block as a subsequent child so each block type retains its own margin.
80
+ dom.append(dom.ownerDocument.createElement('div'));
81
+ }
74
82
  // When mediaSingle nodes are rendered inside a widget decoration (e.g. as part of
75
83
  // a replaced panel), the centering CSS (margin-left: 50%; transform: translateX(-50%))
76
84
  // incorrectly applies because isNestedNode resolves to false (getPos returns 0).
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  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; }
4
4
  import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
5
+ import { isExperimentEnabled } from '@atlaskit/editor-common/deprecated-platform-feature-experiments';
5
6
  import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
6
7
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
8
  var filterUndefined = function filterUndefined(x) {
@@ -63,7 +64,9 @@ export var getAttrChangeRanges = function getAttrChangeRanges(doc, steps, origin
63
64
  // date node: timestamp attribute change — highlight the date node itself (inline)
64
65
  if (stepAttrs.some(function (v) {
65
66
  return dateAttrs.includes(v);
66
- }) && (nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.type.name) === 'date' && !expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true)) {
67
+ }) && (nodeAtPos === null || nodeAtPos === void 0 ? void 0 : nodeAtPos.type.name) === 'date' && !isExperimentEnabled('platform_editor_improve_inline_diffs', function () {
68
+ return expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true);
69
+ })) {
67
70
  return {
68
71
  fromB: step.pos,
69
72
  toB: step.pos + nodeAtPos.nodeSize,
@@ -75,7 +78,9 @@ export var getAttrChangeRanges = function getAttrChangeRanges(doc, steps, origin
75
78
  // The following inline node attr changes are gated behind platform_editor_improve_inline_diffs.
76
79
  // The changeset path (createDecorationsForChange) handles the deletion widget via
77
80
  // prosemirror-changeset; we only need to add the inline insertion highlight here.
78
- if (expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true) && nodeAtPos) {
81
+ if (isExperimentEnabled('platform_editor_improve_inline_diffs', function () {
82
+ return expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true);
83
+ }) && nodeAtPos) {
79
84
  var nodeName = nodeAtPos.type.name;
80
85
  if (isInlineAttrChangeNodeName(nodeName)) {
81
86
  var watchedAttrs = inlineNodeAttrMap[nodeName];
@@ -136,7 +141,9 @@ export var getAttrChangeRanges = function getAttrChangeRanges(doc, steps, origin
136
141
  // Gated behind the same experiment as the inline node attr changes that introduced
137
142
  // the possibility of multiple ranges for the same node position.
138
143
  .filter(function (range, i, arr) {
139
- return !expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true) || arr.findIndex(function (r) {
144
+ return !isExperimentEnabled('platform_editor_improve_inline_diffs', function () {
145
+ return expValEquals('platform_editor_improve_inline_diffs', 'isEnabled', true);
146
+ }) || arr.findIndex(function (r) {
140
147
  return r.fromB === range.fromB;
141
148
  }) === i;
142
149
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "12.1.0",
3
+ "version": "12.1.2",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -53,7 +53,7 @@
53
53
  "react-intl": "^7.0.0"
54
54
  },
55
55
  "peerDependencies": {
56
- "@atlaskit/editor-common": "^118.4.0",
56
+ "@atlaskit/editor-common": "^118.5.0",
57
57
  "react": "^18.2.0 || ^19.2.0"
58
58
  },
59
59
  "techstack": {