@atlaskit/editor-plugin-show-diff 11.0.5 → 11.0.6

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,30 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 11.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d1b5e85073e48`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d1b5e85073e48) -
8
+ [ED-7926] Fix block controls hover jitter when viewing an AI Suggested Edits diff.
9
+
10
+ While a diff is on screen the block controls UI is hidden, but the hover handlers kept running:
11
+ `handleMouseOver` dispatched `showDragHandleAt` (flip-flopping the active node between
12
+ neighbouring blocks) and the right-side hover-side tracker kept dispatching
13
+ `setHoverSide`/`mouseEnter`, both causing visible jitter. Block controls now suppress both hover
14
+ paths (and hide the drag handle) while a diff is displayed, detected via the show-diff plugin's
15
+ `isDisplayingChanges` shared state (plus the `reviewing` user intent for AI suggestions with no
16
+ diff decorations), gated behind `platform_editor_diff_plugin_extended`.
17
+
18
+ To let block controls read that state without forming a circular project reference
19
+ (`block-controls -> show-diff -> expand -> block-controls`), the `toggleExpandRange` command and
20
+ `TOGGLE_EXPAND_RANGE_META_KEY` were moved from `@atlaskit/editor-plugin-expand` into
21
+ `@atlaskit/editor-common` (re-exported from expand for backwards compatibility).
22
+ `@atlaskit/editor-plugin-show-diff` no longer depends on `@atlaskit/editor-plugin-expand`, and
23
+ `@atlaskit/editor-plugin-block-controls` now takes an optional dependency on
24
+ `@atlaskit/editor-plugin-show-diff`.
25
+
26
+ - Updated dependencies
27
+
3
28
  ## 11.0.5
4
29
 
5
30
  ### Patch Changes
@@ -26,9 +26,6 @@
26
26
  {
27
27
  "path": "../../editor-plugin-analytics/afm-cc/tsconfig.json"
28
28
  },
29
- {
30
- "path": "../../editor-plugin-expand/afm-cc/tsconfig.json"
31
- },
32
29
  {
33
30
  "path": "../../editor-plugin-user-intent/afm-cc/tsconfig.json"
34
31
  },
@@ -26,9 +26,6 @@
26
26
  {
27
27
  "path": "../../editor-plugin-analytics/afm-products/tsconfig.json"
28
28
  },
29
- {
30
- "path": "../../editor-plugin-expand/afm-products/tsconfig.json"
31
- },
32
29
  {
33
30
  "path": "../../editor-plugin-user-intent/afm-products/tsconfig.json"
34
31
  },
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.showDiffPluginKey = exports.createPlugin = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _expand = require("@atlaskit/editor-common/expand");
9
10
  var _processRawValue = require("@atlaskit/editor-common/process-raw-value");
10
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
12
  var _state2 = require("@atlaskit/editor-prosemirror/state");
@@ -197,12 +198,14 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
197
198
  var activeIndexChanged = (pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && pluginState.activeIndex !== previousActiveIndex;
198
199
  previousActiveIndex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex;
199
200
  if ((pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && activeIndexChanged) {
200
- var _cancelPendingScrollT2, _api$expand;
201
+ var _cancelPendingScrollT2;
201
202
  (_cancelPendingScrollT2 = cancelPendingScrollToDecoration) === null || _cancelPendingScrollT2 === void 0 || _cancelPendingScrollT2();
202
203
  var scrollableDecorations = (0, _getScrollableDecorations.getScrollableDecorations)(pluginState.decorations, view.state.doc, pluginState === null || pluginState === void 0 ? void 0 : pluginState.diffType);
203
204
  var activeDecoration = scrollableDecorations[pluginState.activeIndex];
204
- if (activeDecoration && api !== null && api !== void 0 && (_api$expand = api.expand) !== null && _api$expand !== void 0 && (_api$expand = _api$expand.commands) !== null && _api$expand !== void 0 && _api$expand.toggleExpandRange) {
205
- api === null || api === void 0 || api.core.actions.execute(api.expand.commands.toggleExpandRange(activeDecoration.from, activeDecoration.to, true));
205
+ if (activeDecoration) {
206
+ // EDITOR-7926: use editor-common's command instead of the expand plugin API to
207
+ // avoid a circular dependency; expand picks up the meta if loaded (no-op if not).
208
+ api === null || api === void 0 || api.core.actions.execute((0, _expand.toggleExpandRange)(activeDecoration.from, activeDecoration.to, true));
206
209
  }
207
210
  cancelPendingScrollToDecoration = (0, _scrollToDiff.scrollToActiveDecoration)(view, scrollableDecorations, pluginState.activeIndex);
208
211
  }
@@ -1,3 +1,4 @@
1
+ import { toggleExpandRange } from '@atlaskit/editor-common/expand';
1
2
  import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
2
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
@@ -204,12 +205,14 @@ export const createPlugin = (config, getIntl, api) => {
204
205
  const activeIndexChanged = (pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && pluginState.activeIndex !== previousActiveIndex;
205
206
  previousActiveIndex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex;
206
207
  if ((pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && activeIndexChanged) {
207
- var _cancelPendingScrollT2, _api$expand, _api$expand$commands;
208
+ var _cancelPendingScrollT2;
208
209
  (_cancelPendingScrollT2 = cancelPendingScrollToDecoration) === null || _cancelPendingScrollT2 === void 0 ? void 0 : _cancelPendingScrollT2();
209
210
  const scrollableDecorations = getScrollableDecorations(pluginState.decorations, view.state.doc, pluginState === null || pluginState === void 0 ? void 0 : pluginState.diffType);
210
211
  const activeDecoration = scrollableDecorations[pluginState.activeIndex];
211
- if (activeDecoration && api !== null && api !== void 0 && (_api$expand = api.expand) !== null && _api$expand !== void 0 && (_api$expand$commands = _api$expand.commands) !== null && _api$expand$commands !== void 0 && _api$expand$commands.toggleExpandRange) {
212
- api === null || api === void 0 ? void 0 : api.core.actions.execute(api.expand.commands.toggleExpandRange(activeDecoration.from, activeDecoration.to, true));
212
+ if (activeDecoration) {
213
+ // EDITOR-7926: use editor-common's command instead of the expand plugin API to
214
+ // avoid a circular dependency; expand picks up the meta if loaded (no-op if not).
215
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(toggleExpandRange(activeDecoration.from, activeDecoration.to, true));
213
216
  }
214
217
  cancelPendingScrollToDecoration = scrollToActiveDecoration(view, scrollableDecorations, pluginState.activeIndex);
215
218
  }
@@ -1,6 +1,7 @@
1
1
  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
+ import { toggleExpandRange } from '@atlaskit/editor-common/expand';
4
5
  import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
5
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
7
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
@@ -190,12 +191,14 @@ export var createPlugin = function createPlugin(config, getIntl, api) {
190
191
  var activeIndexChanged = (pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && pluginState.activeIndex !== previousActiveIndex;
191
192
  previousActiveIndex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex;
192
193
  if ((pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && activeIndexChanged) {
193
- var _cancelPendingScrollT2, _api$expand;
194
+ var _cancelPendingScrollT2;
194
195
  (_cancelPendingScrollT2 = cancelPendingScrollToDecoration) === null || _cancelPendingScrollT2 === void 0 || _cancelPendingScrollT2();
195
196
  var scrollableDecorations = getScrollableDecorations(pluginState.decorations, view.state.doc, pluginState === null || pluginState === void 0 ? void 0 : pluginState.diffType);
196
197
  var activeDecoration = scrollableDecorations[pluginState.activeIndex];
197
- if (activeDecoration && api !== null && api !== void 0 && (_api$expand = api.expand) !== null && _api$expand !== void 0 && (_api$expand = _api$expand.commands) !== null && _api$expand !== void 0 && _api$expand.toggleExpandRange) {
198
- api === null || api === void 0 || api.core.actions.execute(api.expand.commands.toggleExpandRange(activeDecoration.from, activeDecoration.to, true));
198
+ if (activeDecoration) {
199
+ // EDITOR-7926: use editor-common's command instead of the expand plugin API to
200
+ // avoid a circular dependency; expand picks up the meta if loaded (no-op if not).
201
+ api === null || api === void 0 || api.core.actions.execute(toggleExpandRange(activeDecoration.from, activeDecoration.to, true));
199
202
  }
200
203
  cancelPendingScrollToDecoration = scrollToActiveDecoration(view, scrollableDecorations, pluginState.activeIndex);
201
204
  }
@@ -2,7 +2,6 @@ import type { StepJson } from '@atlaskit/editor-common/collab';
2
2
  import type { NextEditorPlugin, EditorCommand, OptionalPlugin } from '@atlaskit/editor-common/types';
3
3
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
4
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
- import type { ExpandPlugin } from '@atlaskit/editor-plugin-expand';
6
5
  import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
7
6
  import type { Node } from '@atlaskit/editor-prosemirror/model';
8
7
  import type { Step } from '@atlaskit/editor-prosemirror/transform';
@@ -93,11 +92,7 @@ export type ShowDiffPlugin = NextEditorPlugin<'showDiff', {
93
92
  scrollToPrevious: EditorCommand;
94
93
  showDiff: (config: PMDiffParams) => EditorCommand;
95
94
  };
96
- dependencies: [
97
- OptionalPlugin<AnalyticsPlugin>,
98
- OptionalPlugin<ExpandPlugin>,
99
- OptionalPlugin<UserIntentPlugin>
100
- ];
95
+ dependencies: [OptionalPlugin<AnalyticsPlugin>, OptionalPlugin<UserIntentPlugin>];
101
96
  pluginConfiguration: DiffParams | undefined;
102
97
  sharedState: {
103
98
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "11.0.5",
3
+ "version": "11.0.6",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -23,7 +23,6 @@
23
23
  "@atlaskit/adf-schema": "^56.6.0",
24
24
  "@atlaskit/custom-steps": "^1.0.0",
25
25
  "@atlaskit/editor-plugin-analytics": "^13.0.0",
26
- "@atlaskit/editor-plugin-expand": "^14.0.0",
27
26
  "@atlaskit/editor-plugin-user-intent": "^11.0.0",
28
27
  "@atlaskit/editor-prosemirror": "^8.0.0",
29
28
  "@atlaskit/editor-tables": "^3.0.0",
@@ -54,7 +53,7 @@
54
53
  "react-intl": "^7.0.0"
55
54
  },
56
55
  "peerDependencies": {
57
- "@atlaskit/editor-common": "^117.5.0",
56
+ "@atlaskit/editor-common": "^117.6.0",
58
57
  "react": "^18.2.0 || ^19.2.0"
59
58
  },
60
59
  "techstack": {