@atlaskit/editor-plugin-collab-edit 16.0.3 → 16.0.5

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,25 @@
1
1
  # @atlaskit/editor-plugin-collab-edit
2
2
 
3
+ ## 16.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 16.0.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [`e2d9151b3bd46`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e2d9151b3bd46) -
14
+ Fix the agent edit shimmer/telepointer appearing on a panel (or other block) the agent did not
15
+ meaningfully change during backend streaming. The collab apply can stamp a same-size re-write on
16
+ an unrelated node (e.g. a `localId`/`breakout` re-stamp on a panel) whose StepMap still reports
17
+ new content, so the shimmer highlighted the whole block despite no visible change. The shimmer now
18
+ skips same-size steps whose before/after content is equal ignoring identity-only metadata
19
+ (`localId`) and layout-only marks (`breakout`), reusing the shared `slicesEqualIgnoringLocalId`
20
+ helper — matching the Review-moment segment producer's guard.
21
+ - Updated dependencies
22
+
3
23
  ## 16.0.3
4
24
 
5
25
  ### Patch Changes
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isPositionNeutralStep = exports.getAgentShimmerRanges = void 0;
7
+ var _collabAgentReviewSliceCompare = require("@atlaskit/editor-common/collab-agent-review-slice-compare");
7
8
  var _prosemirrorCollab = require("@atlaskit/prosemirror-collab");
8
9
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
9
10
  // When an agent step lands we cover the top-level block(s) it wrote with a skeleton-loader shimmer
@@ -120,6 +121,7 @@ var getAgentShimmerRanges = exports.getAgentShimmerRanges = function getAgentShi
120
121
 
121
122
  var infos = [];
122
123
  json.forEach(function (rawStep, index) {
124
+ var _tr$docs$index;
123
125
  if (typeof (rawStep === null || rawStep === void 0 ? void 0 : rawStep.agentType) !== 'string') {
124
126
  return;
125
127
  }
@@ -128,13 +130,33 @@ var getAgentShimmerRanges = exports.getAgentShimmerRanges = function getAgentShi
128
130
  if (typeof (pmStep === null || pmStep === void 0 ? void 0 : pmStep.getMap) !== 'function') {
129
131
  return;
130
132
  }
131
- pmStep.getMap().forEach(function (_oldStart, _oldEnd, newStart, newEnd) {
133
+ // The doc this step was applied to (its `old` coords resolve here). `tr.docs[index]` is the
134
+ // document state before step `index`; fall back to the batch's before-doc for the first step.
135
+ var beforeDoc = (_tr$docs$index = tr.docs[index]) !== null && _tr$docs$index !== void 0 ? _tr$docs$index : tr.before;
136
+ pmStep.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
132
137
  if (newEnd <= newStart) {
133
138
  return; // pure deletion / attribute-only — no new content to highlight
134
139
  }
140
+ var from = mapToFinalDoc(newStart, index, -1);
141
+ var to = mapToFinalDoc(newEnd, index, 1);
142
+ // Skip phantom same-size re-writes (e.g. a `localId`/breakout re-stamp on an untouched
143
+ // panel): their StepMap reports new content but nothing visibly changed. Drop only when
144
+ // before/after are equal ignoring `localId` and layout marks, so real same-size edits
145
+ // still shimmer. Mirrors the Review-moment segment producer's guard.
146
+ if (oldEnd - oldStart === newEnd - newStart) {
147
+ try {
148
+ var before = beforeDoc.slice(oldStart, oldEnd);
149
+ var after = tr.doc.slice(from, to);
150
+ if ((0, _collabAgentReviewSliceCompare.slicesEqualIgnoringLocalId)(before, after)) {
151
+ return;
152
+ }
153
+ } catch (_unused) {
154
+ // Comparison unsafe: keep the range; whole-block expansion still renders it.
155
+ }
156
+ }
135
157
  infos.push({
136
- from: mapToFinalDoc(newStart, index, -1),
137
- to: mapToFinalDoc(newEnd, index, 1)
158
+ from: from,
159
+ to: to
138
160
  });
139
161
  });
140
162
  });
@@ -1,3 +1,4 @@
1
+ import { slicesEqualIgnoringLocalId } from '@atlaskit/editor-common/collab-agent-review-slice-compare';
1
2
  import { getCollabState } from '@atlaskit/prosemirror-collab';
2
3
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
  // When an agent step lands we cover the top-level block(s) it wrote with a skeleton-loader shimmer
@@ -106,6 +107,7 @@ export const getAgentShimmerRanges = (json, steps, tr, view, shimmerDurationMs,
106
107
 
107
108
  const infos = [];
108
109
  json.forEach((rawStep, index) => {
110
+ var _tr$docs$index;
109
111
  if (typeof (rawStep === null || rawStep === void 0 ? void 0 : rawStep.agentType) !== 'string') {
110
112
  return;
111
113
  }
@@ -114,13 +116,33 @@ export const getAgentShimmerRanges = (json, steps, tr, view, shimmerDurationMs,
114
116
  if (typeof (pmStep === null || pmStep === void 0 ? void 0 : pmStep.getMap) !== 'function') {
115
117
  return;
116
118
  }
117
- pmStep.getMap().forEach((_oldStart, _oldEnd, newStart, newEnd) => {
119
+ // The doc this step was applied to (its `old` coords resolve here). `tr.docs[index]` is the
120
+ // document state before step `index`; fall back to the batch's before-doc for the first step.
121
+ const beforeDoc = (_tr$docs$index = tr.docs[index]) !== null && _tr$docs$index !== void 0 ? _tr$docs$index : tr.before;
122
+ pmStep.getMap().forEach((oldStart, oldEnd, newStart, newEnd) => {
118
123
  if (newEnd <= newStart) {
119
124
  return; // pure deletion / attribute-only — no new content to highlight
120
125
  }
126
+ const from = mapToFinalDoc(newStart, index, -1);
127
+ const to = mapToFinalDoc(newEnd, index, 1);
128
+ // Skip phantom same-size re-writes (e.g. a `localId`/breakout re-stamp on an untouched
129
+ // panel): their StepMap reports new content but nothing visibly changed. Drop only when
130
+ // before/after are equal ignoring `localId` and layout marks, so real same-size edits
131
+ // still shimmer. Mirrors the Review-moment segment producer's guard.
132
+ if (oldEnd - oldStart === newEnd - newStart) {
133
+ try {
134
+ const before = beforeDoc.slice(oldStart, oldEnd);
135
+ const after = tr.doc.slice(from, to);
136
+ if (slicesEqualIgnoringLocalId(before, after)) {
137
+ return;
138
+ }
139
+ } catch {
140
+ // Comparison unsafe: keep the range; whole-block expansion still renders it.
141
+ }
142
+ }
121
143
  infos.push({
122
- from: mapToFinalDoc(newStart, index, -1),
123
- to: mapToFinalDoc(newEnd, index, 1)
144
+ from,
145
+ to
124
146
  });
125
147
  });
126
148
  });
@@ -1,3 +1,4 @@
1
+ import { slicesEqualIgnoringLocalId } from '@atlaskit/editor-common/collab-agent-review-slice-compare';
1
2
  import { getCollabState } from '@atlaskit/prosemirror-collab';
2
3
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
  // When an agent step lands we cover the top-level block(s) it wrote with a skeleton-loader shimmer
@@ -114,6 +115,7 @@ export var getAgentShimmerRanges = function getAgentShimmerRanges(json, steps, t
114
115
 
115
116
  var infos = [];
116
117
  json.forEach(function (rawStep, index) {
118
+ var _tr$docs$index;
117
119
  if (typeof (rawStep === null || rawStep === void 0 ? void 0 : rawStep.agentType) !== 'string') {
118
120
  return;
119
121
  }
@@ -122,13 +124,33 @@ export var getAgentShimmerRanges = function getAgentShimmerRanges(json, steps, t
122
124
  if (typeof (pmStep === null || pmStep === void 0 ? void 0 : pmStep.getMap) !== 'function') {
123
125
  return;
124
126
  }
125
- pmStep.getMap().forEach(function (_oldStart, _oldEnd, newStart, newEnd) {
127
+ // The doc this step was applied to (its `old` coords resolve here). `tr.docs[index]` is the
128
+ // document state before step `index`; fall back to the batch's before-doc for the first step.
129
+ var beforeDoc = (_tr$docs$index = tr.docs[index]) !== null && _tr$docs$index !== void 0 ? _tr$docs$index : tr.before;
130
+ pmStep.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
126
131
  if (newEnd <= newStart) {
127
132
  return; // pure deletion / attribute-only — no new content to highlight
128
133
  }
134
+ var from = mapToFinalDoc(newStart, index, -1);
135
+ var to = mapToFinalDoc(newEnd, index, 1);
136
+ // Skip phantom same-size re-writes (e.g. a `localId`/breakout re-stamp on an untouched
137
+ // panel): their StepMap reports new content but nothing visibly changed. Drop only when
138
+ // before/after are equal ignoring `localId` and layout marks, so real same-size edits
139
+ // still shimmer. Mirrors the Review-moment segment producer's guard.
140
+ if (oldEnd - oldStart === newEnd - newStart) {
141
+ try {
142
+ var before = beforeDoc.slice(oldStart, oldEnd);
143
+ var after = tr.doc.slice(from, to);
144
+ if (slicesEqualIgnoringLocalId(before, after)) {
145
+ return;
146
+ }
147
+ } catch (_unused) {
148
+ // Comparison unsafe: keep the range; whole-block expansion still renders it.
149
+ }
150
+ }
129
151
  infos.push({
130
- from: mapToFinalDoc(newStart, index, -1),
131
- to: mapToFinalDoc(newEnd, index, 1)
152
+ from: from,
153
+ to: to
132
154
  });
133
155
  });
134
156
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "16.0.3",
3
+ "version": "16.0.5",
4
4
  "description": "Collab Edit plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,13 +32,13 @@
32
32
  "@atlaskit/platform-feature-experiments": "^0.3.0",
33
33
  "@atlaskit/platform-feature-flags": "^2.1.0",
34
34
  "@atlaskit/prosemirror-collab": "^1.0.0",
35
- "@atlaskit/tmp-editor-statsig": "^149.0.0",
35
+ "@atlaskit/tmp-editor-statsig": "^150.0.0",
36
36
  "@atlaskit/tokens": "^16.7.0",
37
37
  "@babel/runtime": "^7.0.0",
38
38
  "memoize-one": "^6.0.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@atlaskit/editor-common": "^119.7.0",
41
+ "@atlaskit/editor-common": "^119.9.0",
42
42
  "react": "^18.2.0 || ^19.2.0",
43
43
  "react-dom": "^18.2.0 || ^19.2.0"
44
44
  },