@atlaskit/editor-plugin-show-diff 25.1.0 → 26.0.0

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,21 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 26.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b5f8a82f07fc6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b5f8a82f07fc6) -
8
+ Preserve spacing between panel replacement diffs at the start of a table cell or other container
9
+ behind platform_editor_ai_show_diff_patch_2.
10
+ - [`0f0ca74ca517a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0f0ca74ca517a) -
11
+ Add the `@atlaskit/editor-common/ai-xstate-migration` (`isAiXstateMigrationEnabled`) and
12
+ `@atlaskit/editor-common/ai-xstate-migration-no-exposure` (`isAiXstateMigrationEnabledNoExposure`)
13
+ entrypoints, which enable the AI xstate migration when either the Confluence
14
+ (`platform_editor_ai_xstate_migration`) or Jira (`platform_editor_ai_xstate_migration_jira`, a
15
+ platform feature experiment) experiment is on. Use the helper wherever the xstate migration is
16
+ checked.
17
+ - Updated dependencies
18
+
3
19
  ## 25.1.0
4
20
 
5
21
  ### Minor Changes
@@ -11,6 +11,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
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 _aiXstateMigrationNoExposure = require("@atlaskit/editor-common/ai-xstate-migration-no-exposure");
14
15
  var _areDocsEqualByBlockStructureAndText = require("@atlaskit/editor-common/utils/areDocsEqualByBlockStructureAndText");
15
16
  var _document = require("@atlaskit/editor-common/utils/document");
16
17
  var _transform = require("@atlaskit/editor-prosemirror/transform");
@@ -18,7 +19,6 @@ var _view = require("@atlaskit/editor-prosemirror/view");
18
19
  var _tableMap = require("@atlaskit/editor-tables/table-map");
19
20
  var _unsafeExpValNoExposure = require("@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure");
20
21
  var _fg = require("@atlaskit/platform-feature-flags/fg");
21
- var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
22
22
  var _attributions = require("../decorations/colorSchemes/attributions");
23
23
  var _createAnchorDecorationWidgets = require("../decorations/createAnchorDecorationWidgets");
24
24
  var _createBlockChangedDecoration = require("../decorations/createBlockChangedDecoration");
@@ -679,7 +679,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
679
679
  // For a large inserted table, skip the per-cell inline decorations that
680
680
  // freeze the browser on re-render. Only active when Review moment is
681
681
  // eligible (xstate + M1).
682
- var useCoarseTableDecoration = isSmartNodeLevel && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_ai_xstate_migration', 'isEnabled', true) && (0, _unsafeExpValNoExposure.UNSAFE_expValNoExposure)('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true && isLargeInsertedTableRange(tr.doc, change.fromB, change.toB);
682
+ var useCoarseTableDecoration = isSmartNodeLevel && (0, _aiXstateMigrationNoExposure.isAiXstateMigrationEnabledNoExposure)() && (0, _unsafeExpValNoExposure.UNSAFE_expValNoExposure)('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true && isLargeInsertedTableRange(tr.doc, change.fromB, change.toB);
683
683
  // Whether the deleted-content widget will actually be rendered for this
684
684
  // change. Used to decide if indicator anchor positions should be adjusted
685
685
  // inward — when the widget is present the anchor must stay at the block
@@ -939,7 +939,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
939
939
  })));
940
940
  // If the original node position is known (e.g. a panel type change), also render
941
941
  // the old block node as a "deleted" widget so the reviewer sees the before/after.
942
- var isSmartNodeLevelAttrChange = diffType === 'smart' && (0, _fg.fg)('platform_editor_ai_smart_diff') && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_ai_xstate_migration', 'isEnabled', true) && (0, _unsafeExpValNoExposure.UNSAFE_expValNoExposure)('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true;
942
+ var isSmartNodeLevelAttrChange = diffType === 'smart' && (0, _fg.fg)('platform_editor_ai_smart_diff') && (0, _aiXstateMigrationNoExposure.isAiXstateMigrationEnabledNoExposure)() && (0, _unsafeExpValNoExposure.UNSAFE_expValNoExposure)('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true;
943
943
  if (isSmartNodeLevelAttrChange && change.fromA !== undefined && change.toA !== undefined) {
944
944
  var placeBelow = deletedDiffPlacement === 'bottom';
945
945
  decorations.push.apply(decorations, (0, _toConsumableArray2.default)((0, _createNodeChangedDecorationWidget.createNodeChangedDecorationWidget)({
@@ -4,16 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createNodeShapedMarginSpacer = void 0;
7
+ var _panel = require("@atlaskit/editor-common/styles/panel");
8
+ var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
7
9
  /**
8
10
  * Node types that can safely be reduced to an empty shell.
9
11
  *
10
12
  * A shell only replicates a margin if it collapses to nothing itself, which needs zero height and
11
- * no vertical border or padding. Textblocks and lists qualify; nodes with intrinsic sizing (tables
12
- * are `display: table`, media has a measured height) or a painted box (a zero-height panel is a
13
- * visible stripe of background) do not, and are left alone.
13
+ * no vertical border or padding. Textblocks and lists qualify; panels need their painted box
14
+ * hidden and their flex layout removed. Nodes with intrinsic sizing (tables are `display: table`,
15
+ * media has a measured height) are left alone.
14
16
  */
15
17
  var isShapeableNode = function isShapeableNode(node) {
16
- return node.isTextblock || ['bulletList', 'orderedList'].includes(node.type.name);
18
+ return node.isTextblock || ['bulletList', 'orderedList'].includes(node.type.name) || (0, _nodeTypeUtils.getBaseNodeTypeName)(node.type) === 'panel';
17
19
  };
18
20
 
19
21
  /**
@@ -57,6 +59,13 @@ var createNodeShapedMarginSpacer = exports.createNodeShapedMarginSpacer = functi
57
59
  serialized.dataset.testid = testId;
58
60
  serialized.setAttribute('aria-hidden', 'true');
59
61
  serialized.contentEditable = 'false';
62
+ if ((0, _nodeTypeUtils.getBaseNodeTypeName)(node.type) === 'panel') {
63
+ // Schema serialization lacks the node view's class, which carries the panel's margin.
64
+ // Hide the painted shell and allow its margins to collapse through a zero-height block.
65
+ serialized.classList.add(_panel.PanelSharedCssClassName.prefix);
66
+ serialized.style.display = 'block';
67
+ serialized.style.visibility = 'hidden';
68
+ }
60
69
 
61
70
  // Zero height with no vertical border or padding keeps the spacer self-collapsing: its margins
62
71
  // stay adjoining, so they collapse with the neighbours into a single margin equal to the largest
@@ -1,6 +1,7 @@
1
1
  import isEqual from 'lodash/isEqual';
2
2
  import memoizeOne from 'memoize-one';
3
3
  import { ChangeSet, simplifyChanges } from 'prosemirror-changeset';
4
+ import { isAiXstateMigrationEnabledNoExposure } from '@atlaskit/editor-common/ai-xstate-migration-no-exposure';
4
5
  import { areDocsEqualByBlockStructureAndText } from '@atlaskit/editor-common/utils/areDocsEqualByBlockStructureAndText';
5
6
  import { areNodesEqualIgnoreAttrs } from '@atlaskit/editor-common/utils/document';
6
7
  import { Mapping } from '@atlaskit/editor-prosemirror/transform';
@@ -8,7 +9,6 @@ import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
9
  import { TableMap } from '@atlaskit/editor-tables/table-map';
9
10
  import { UNSAFE_expValNoExposure } from '@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure';
10
11
  import { fg } from '@atlaskit/platform-feature-flags/fg';
11
- import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
12
12
  import { createAttributionColorMap, getAttributionKey, getAttributionKeyForChange, getColorSchemeForChange, isAttributionColoringEnabled, isContributorTagsEnabled } from '../decorations/colorSchemes/attributions';
13
13
  import { createDocMarginAnchorWidget } from '../decorations/createAnchorDecorationWidgets';
14
14
  import { createBlockChangedDecoration } from '../decorations/createBlockChangedDecoration';
@@ -615,7 +615,7 @@ const calculateDiffDecorationsInner = ({
615
615
  // For a large inserted table, skip the per-cell inline decorations that
616
616
  // freeze the browser on re-render. Only active when Review moment is
617
617
  // eligible (xstate + M1).
618
- const useCoarseTableDecoration = isSmartNodeLevel && expValEqualsNoExposure('platform_editor_ai_xstate_migration', 'isEnabled', true) && UNSAFE_expValNoExposure('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true && isLargeInsertedTableRange(tr.doc, change.fromB, change.toB);
618
+ const useCoarseTableDecoration = isSmartNodeLevel && isAiXstateMigrationEnabledNoExposure() && UNSAFE_expValNoExposure('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true && isLargeInsertedTableRange(tr.doc, change.fromB, change.toB);
619
619
  // Whether the deleted-content widget will actually be rendered for this
620
620
  // change. Used to decide if indicator anchor positions should be adjusted
621
621
  // inward — when the widget is present the anchor must stay at the block
@@ -845,7 +845,7 @@ const calculateDiffDecorationsInner = ({
845
845
  }));
846
846
  // If the original node position is known (e.g. a panel type change), also render
847
847
  // the old block node as a "deleted" widget so the reviewer sees the before/after.
848
- const isSmartNodeLevelAttrChange = diffType === 'smart' && fg('platform_editor_ai_smart_diff') && expValEqualsNoExposure('platform_editor_ai_xstate_migration', 'isEnabled', true) && UNSAFE_expValNoExposure('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true;
848
+ const isSmartNodeLevelAttrChange = diffType === 'smart' && fg('platform_editor_ai_smart_diff') && isAiXstateMigrationEnabledNoExposure() && UNSAFE_expValNoExposure('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true;
849
849
  if (isSmartNodeLevelAttrChange && change.fromA !== undefined && change.toA !== undefined) {
850
850
  const placeBelow = deletedDiffPlacement === 'bottom';
851
851
  decorations.push(...createNodeChangedDecorationWidget({
@@ -1,12 +1,14 @@
1
+ import { PanelSharedCssClassName } from '@atlaskit/editor-common/styles/panel';
2
+ import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-utils';
1
3
  /**
2
4
  * Node types that can safely be reduced to an empty shell.
3
5
  *
4
6
  * A shell only replicates a margin if it collapses to nothing itself, which needs zero height and
5
- * no vertical border or padding. Textblocks and lists qualify; nodes with intrinsic sizing (tables
6
- * are `display: table`, media has a measured height) or a painted box (a zero-height panel is a
7
- * visible stripe of background) do not, and are left alone.
7
+ * no vertical border or padding. Textblocks and lists qualify; panels need their painted box
8
+ * hidden and their flex layout removed. Nodes with intrinsic sizing (tables are `display: table`,
9
+ * media has a measured height) are left alone.
8
10
  */
9
- const isShapeableNode = node => node.isTextblock || ['bulletList', 'orderedList'].includes(node.type.name);
11
+ const isShapeableNode = node => node.isTextblock || ['bulletList', 'orderedList'].includes(node.type.name) || getBaseNodeTypeName(node.type) === 'panel';
10
12
 
11
13
  /**
12
14
  * An invisible element shaped like `node`, used to supply the top margin `node` no longer gets.
@@ -50,6 +52,13 @@ export const createNodeShapedMarginSpacer = ({
50
52
  serialized.dataset.testid = testId;
51
53
  serialized.setAttribute('aria-hidden', 'true');
52
54
  serialized.contentEditable = 'false';
55
+ if (getBaseNodeTypeName(node.type) === 'panel') {
56
+ // Schema serialization lacks the node view's class, which carries the panel's margin.
57
+ // Hide the painted shell and allow its margins to collapse through a zero-height block.
58
+ serialized.classList.add(PanelSharedCssClassName.prefix);
59
+ serialized.style.display = 'block';
60
+ serialized.style.visibility = 'hidden';
61
+ }
53
62
 
54
63
  // Zero height with no vertical border or padding keeps the spacer self-collapsing: its margins
55
64
  // stay adjoining, so they collapse with the neighbours into a single margin equal to the largest
@@ -9,6 +9,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
9
9
  import isEqual from 'lodash/isEqual';
10
10
  import memoizeOne from 'memoize-one';
11
11
  import { ChangeSet, simplifyChanges } from 'prosemirror-changeset';
12
+ import { isAiXstateMigrationEnabledNoExposure } from '@atlaskit/editor-common/ai-xstate-migration-no-exposure';
12
13
  import { areDocsEqualByBlockStructureAndText } from '@atlaskit/editor-common/utils/areDocsEqualByBlockStructureAndText';
13
14
  import { areNodesEqualIgnoreAttrs } from '@atlaskit/editor-common/utils/document';
14
15
  import { Mapping } from '@atlaskit/editor-prosemirror/transform';
@@ -16,7 +17,6 @@ import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
16
17
  import { TableMap } from '@atlaskit/editor-tables/table-map';
17
18
  import { UNSAFE_expValNoExposure } from '@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure';
18
19
  import { fg } from '@atlaskit/platform-feature-flags/fg';
19
- import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
20
20
  import { createAttributionColorMap, getAttributionKey, getAttributionKeyForChange, getColorSchemeForChange, isAttributionColoringEnabled, isContributorTagsEnabled } from '../decorations/colorSchemes/attributions';
21
21
  import { createDocMarginAnchorWidget } from '../decorations/createAnchorDecorationWidgets';
22
22
  import { createBlockChangedDecoration } from '../decorations/createBlockChangedDecoration';
@@ -672,7 +672,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
672
672
  // For a large inserted table, skip the per-cell inline decorations that
673
673
  // freeze the browser on re-render. Only active when Review moment is
674
674
  // eligible (xstate + M1).
675
- var useCoarseTableDecoration = isSmartNodeLevel && expValEqualsNoExposure('platform_editor_ai_xstate_migration', 'isEnabled', true) && UNSAFE_expValNoExposure('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true && isLargeInsertedTableRange(tr.doc, change.fromB, change.toB);
675
+ var useCoarseTableDecoration = isSmartNodeLevel && isAiXstateMigrationEnabledNoExposure() && UNSAFE_expValNoExposure('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true && isLargeInsertedTableRange(tr.doc, change.fromB, change.toB);
676
676
  // Whether the deleted-content widget will actually be rendered for this
677
677
  // change. Used to decide if indicator anchor positions should be adjusted
678
678
  // inward — when the widget is present the anchor must stay at the block
@@ -932,7 +932,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
932
932
  })));
933
933
  // If the original node position is known (e.g. a panel type change), also render
934
934
  // the old block node as a "deleted" widget so the reviewer sees the before/after.
935
- var isSmartNodeLevelAttrChange = diffType === 'smart' && fg('platform_editor_ai_smart_diff') && expValEqualsNoExposure('platform_editor_ai_xstate_migration', 'isEnabled', true) && UNSAFE_expValNoExposure('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true;
935
+ var isSmartNodeLevelAttrChange = diffType === 'smart' && fg('platform_editor_ai_smart_diff') && isAiXstateMigrationEnabledNoExposure() && UNSAFE_expValNoExposure('platform_editor_ai_streaming_ux_experience_m1', 'isEnabled', false) === true;
936
936
  if (isSmartNodeLevelAttrChange && change.fromA !== undefined && change.toA !== undefined) {
937
937
  var placeBelow = deletedDiffPlacement === 'bottom';
938
938
  decorations.push.apply(decorations, _toConsumableArray(createNodeChangedDecorationWidget({
@@ -1,13 +1,15 @@
1
+ import { PanelSharedCssClassName } from '@atlaskit/editor-common/styles/panel';
2
+ import { getBaseNodeTypeName } from '@atlaskit/editor-common/utils/node-type-utils';
1
3
  /**
2
4
  * Node types that can safely be reduced to an empty shell.
3
5
  *
4
6
  * A shell only replicates a margin if it collapses to nothing itself, which needs zero height and
5
- * no vertical border or padding. Textblocks and lists qualify; nodes with intrinsic sizing (tables
6
- * are `display: table`, media has a measured height) or a painted box (a zero-height panel is a
7
- * visible stripe of background) do not, and are left alone.
7
+ * no vertical border or padding. Textblocks and lists qualify; panels need their painted box
8
+ * hidden and their flex layout removed. Nodes with intrinsic sizing (tables are `display: table`,
9
+ * media has a measured height) are left alone.
8
10
  */
9
11
  var isShapeableNode = function isShapeableNode(node) {
10
- return node.isTextblock || ['bulletList', 'orderedList'].includes(node.type.name);
12
+ return node.isTextblock || ['bulletList', 'orderedList'].includes(node.type.name) || getBaseNodeTypeName(node.type) === 'panel';
11
13
  };
12
14
 
13
15
  /**
@@ -51,6 +53,13 @@ export var createNodeShapedMarginSpacer = function createNodeShapedMarginSpacer(
51
53
  serialized.dataset.testid = testId;
52
54
  serialized.setAttribute('aria-hidden', 'true');
53
55
  serialized.contentEditable = 'false';
56
+ if (getBaseNodeTypeName(node.type) === 'panel') {
57
+ // Schema serialization lacks the node view's class, which carries the panel's margin.
58
+ // Hide the painted shell and allow its margins to collapse through a zero-height block.
59
+ serialized.classList.add(PanelSharedCssClassName.prefix);
60
+ serialized.style.display = 'block';
61
+ serialized.style.visibility = 'hidden';
62
+ }
54
63
 
55
64
  // Zero height with no vertical border or padding keeps the spacer self-collapsing: its margins
56
65
  // stay adjoining, so they collapse with the neighbours into a single margin equal to the largest
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "25.1.0",
3
+ "version": "26.0.0",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,10 +29,10 @@
29
29
  "@atlaskit/agent-color": "^1.0.0",
30
30
  "@atlaskit/avatar": "^30.0.0",
31
31
  "@atlaskit/custom-steps": "^1.1.0",
32
- "@atlaskit/editor-plugin-accessibility-utils": "^27.0.0",
33
- "@atlaskit/editor-plugin-analytics": "^27.0.0",
34
- "@atlaskit/editor-plugin-limited-mode": "^24.0.0",
35
- "@atlaskit/editor-plugin-user-intent": "^25.0.0",
32
+ "@atlaskit/editor-plugin-accessibility-utils": "^28.0.0",
33
+ "@atlaskit/editor-plugin-analytics": "^28.0.0",
34
+ "@atlaskit/editor-plugin-limited-mode": "^25.0.0",
35
+ "@atlaskit/editor-plugin-user-intent": "^26.0.0",
36
36
  "@atlaskit/editor-prosemirror": "^9.0.0",
37
37
  "@atlaskit/editor-shared-styles": "^4.5.0",
38
38
  "@atlaskit/editor-tables": "^3.2.0",
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/button": "^25.4.0",
54
54
  "@atlaskit/css": "^1.1.0",
55
55
  "@atlaskit/dropdown-menu": "^21.0.0",
56
- "@atlaskit/editor-core": "^237.0.0",
56
+ "@atlaskit/editor-core": "^238.0.0",
57
57
  "@atlaskit/editor-json-transformer": "^10.0.0",
58
58
  "@atlaskit/editor-plugins": "^16.2.0",
59
59
  "@atlaskit/form": "^18.2.0",
@@ -63,15 +63,15 @@
63
63
  "@atlaskit/util-data-test": "^19.1.0",
64
64
  "@atlassian/confluence-presets": "workspace:^",
65
65
  "@atlassian/content-reconciliation": "^0.1.3506",
66
- "@atlassian/editor-ai-injected-editors": "^41.0.0",
67
- "@atlassian/editor-plugin-ai": "^81.3.0",
66
+ "@atlassian/editor-ai-injected-editors": "^42.0.0",
67
+ "@atlassian/editor-plugin-ai": "^82.0.0",
68
68
  "@atlassian/structured-docs-types": "workspace:^",
69
69
  "react": "^19.2.0",
70
70
  "react-dom": "^19.2.0",
71
71
  "react-intl": "^7.0.0"
72
72
  },
73
73
  "peerDependencies": {
74
- "@atlaskit/editor-common": "^131.6.0",
74
+ "@atlaskit/editor-common": "^132.0.0",
75
75
  "react": "^18.2.0 || ^19.2.0",
76
76
  "react-dom": "^18.2.0 || ^19.2.0",
77
77
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"