@atlaskit/editor-plugin-show-diff 10.4.1 → 10.4.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,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 10.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a41c9b243974d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a41c9b243974d) -
|
|
8
|
+
Fix smart diff fabricating a phantom whole-block deletion when a new block is inserted at a
|
|
9
|
+
top-level boundary (e.g. a paragraph added immediately before a bulletList). topLevelBlocksInRange
|
|
10
|
+
now treats a zero-width insertion anchor sitting exactly on a top-level block boundary as touching
|
|
11
|
+
no block, so a pure insertion is no longer mis-paired with the following block and converted into
|
|
12
|
+
a whole-block replacement. This also lets pure whole-block deletions surface under smart diff.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 10.4.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -168,14 +168,24 @@ var topLevelBlocksInRange = function topLevelBlocksInRange(doc, from, to) {
|
|
|
168
168
|
var node = doc.child(i);
|
|
169
169
|
var blockFrom = offset;
|
|
170
170
|
var blockTo = offset + node.nodeSize;
|
|
171
|
-
//
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
171
|
+
// Non-empty range: standard half-open overlap test.
|
|
172
|
+
if (lo < hi) {
|
|
173
|
+
if (blockFrom < hi && blockTo > lo) {
|
|
174
|
+
refs.push({
|
|
175
|
+
node: node,
|
|
176
|
+
from: blockFrom,
|
|
177
|
+
to: blockTo
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
} else if (blockFrom < lo && lo < blockTo) {
|
|
181
|
+
// Zero-width range (an insertion anchor): only match a block whose INTERIOR strictly
|
|
182
|
+
// contains the point. A point sitting exactly on a top-level block boundary
|
|
183
|
+
// (`blockFrom === lo`, i.e. between two sibling blocks) is a pure insertion BETWEEN
|
|
184
|
+
// blocks — it must resolve to NO block, otherwise `groupByTopLevelBlock` pairs the
|
|
185
|
+
// insertion with the following block and `classifyBlockGroup` converts the insert into a
|
|
186
|
+
// whole-block replacement, fabricating a phantom deletion of that untouched block.
|
|
187
|
+
// Interior points (a nested insertion inside a container being edited) still resolve
|
|
188
|
+
// their container so the classifier can recurse into it.
|
|
179
189
|
refs.push({
|
|
180
190
|
node: node,
|
|
181
191
|
from: blockFrom,
|
|
@@ -141,14 +141,24 @@ const topLevelBlocksInRange = (doc, from, to) => {
|
|
|
141
141
|
const node = doc.child(i);
|
|
142
142
|
const blockFrom = offset;
|
|
143
143
|
const blockTo = offset + node.nodeSize;
|
|
144
|
-
//
|
|
145
|
-
if (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
144
|
+
// Non-empty range: standard half-open overlap test.
|
|
145
|
+
if (lo < hi) {
|
|
146
|
+
if (blockFrom < hi && blockTo > lo) {
|
|
147
|
+
refs.push({
|
|
148
|
+
node,
|
|
149
|
+
from: blockFrom,
|
|
150
|
+
to: blockTo
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
} else if (blockFrom < lo && lo < blockTo) {
|
|
154
|
+
// Zero-width range (an insertion anchor): only match a block whose INTERIOR strictly
|
|
155
|
+
// contains the point. A point sitting exactly on a top-level block boundary
|
|
156
|
+
// (`blockFrom === lo`, i.e. between two sibling blocks) is a pure insertion BETWEEN
|
|
157
|
+
// blocks — it must resolve to NO block, otherwise `groupByTopLevelBlock` pairs the
|
|
158
|
+
// insertion with the following block and `classifyBlockGroup` converts the insert into a
|
|
159
|
+
// whole-block replacement, fabricating a phantom deletion of that untouched block.
|
|
160
|
+
// Interior points (a nested insertion inside a container being edited) still resolve
|
|
161
|
+
// their container so the classifier can recurse into it.
|
|
152
162
|
refs.push({
|
|
153
163
|
node,
|
|
154
164
|
from: blockFrom,
|
|
@@ -161,14 +161,24 @@ var topLevelBlocksInRange = function topLevelBlocksInRange(doc, from, to) {
|
|
|
161
161
|
var node = doc.child(i);
|
|
162
162
|
var blockFrom = offset;
|
|
163
163
|
var blockTo = offset + node.nodeSize;
|
|
164
|
-
//
|
|
165
|
-
if (
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
164
|
+
// Non-empty range: standard half-open overlap test.
|
|
165
|
+
if (lo < hi) {
|
|
166
|
+
if (blockFrom < hi && blockTo > lo) {
|
|
167
|
+
refs.push({
|
|
168
|
+
node: node,
|
|
169
|
+
from: blockFrom,
|
|
170
|
+
to: blockTo
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
} else if (blockFrom < lo && lo < blockTo) {
|
|
174
|
+
// Zero-width range (an insertion anchor): only match a block whose INTERIOR strictly
|
|
175
|
+
// contains the point. A point sitting exactly on a top-level block boundary
|
|
176
|
+
// (`blockFrom === lo`, i.e. between two sibling blocks) is a pure insertion BETWEEN
|
|
177
|
+
// blocks — it must resolve to NO block, otherwise `groupByTopLevelBlock` pairs the
|
|
178
|
+
// insertion with the following block and `classifyBlockGroup` converts the insert into a
|
|
179
|
+
// whole-block replacement, fabricating a phantom deletion of that untouched block.
|
|
180
|
+
// Interior points (a nested insertion inside a container being edited) still resolve
|
|
181
|
+
// their container so the classifier can recurse into it.
|
|
172
182
|
refs.push({
|
|
173
183
|
node: node,
|
|
174
184
|
from: blockFrom,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.2",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
29
29
|
"@atlaskit/editor-tables": "^3.0.0",
|
|
30
30
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
31
|
-
"@atlaskit/tmp-editor-statsig": "^124.
|
|
31
|
+
"@atlaskit/tmp-editor-statsig": "^124.4.0",
|
|
32
32
|
"@atlaskit/tokens": "^15.7.0",
|
|
33
33
|
"@babel/runtime": "^7.0.0",
|
|
34
34
|
"@compiled/react": "^0.20.0",
|