slate 0.66.1 → 0.66.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 +12 -0
- package/dist/index.es.js +13 -2
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces/range.d.ts.map +1 -1
- package/dist/slate.js +13 -2
- package/dist/slate.min.js +1 -1
- package/dist/transforms/node.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4182,12 +4182,17 @@ var Range = {
|
|
|
4182
4182
|
var affinityFocus;
|
|
4183
4183
|
|
|
4184
4184
|
if (affinity === 'inward') {
|
|
4185
|
+
// If the range is collapsed, make sure to use the same affinity to
|
|
4186
|
+
// avoid the two points passing each other and expanding in the opposite
|
|
4187
|
+
// direction
|
|
4188
|
+
var isCollapsed = Range.isCollapsed(r);
|
|
4189
|
+
|
|
4185
4190
|
if (Range.isForward(r)) {
|
|
4186
4191
|
affinityAnchor = 'forward';
|
|
4187
|
-
affinityFocus = 'backward';
|
|
4192
|
+
affinityFocus = isCollapsed ? affinityAnchor : 'backward';
|
|
4188
4193
|
} else {
|
|
4189
4194
|
affinityAnchor = 'backward';
|
|
4190
|
-
affinityFocus = 'forward';
|
|
4195
|
+
affinityFocus = isCollapsed ? affinityAnchor : 'forward';
|
|
4191
4196
|
}
|
|
4192
4197
|
} else if (affinity === 'outward') {
|
|
4193
4198
|
if (Range.isForward(r)) {
|
|
@@ -5530,6 +5535,12 @@ var NodeTransforms = {
|
|
|
5530
5535
|
}
|
|
5531
5536
|
|
|
5532
5537
|
if (split && Range.isRange(at)) {
|
|
5538
|
+
if (Range.isCollapsed(at) && Editor.leaf(editor, at.anchor)[0].text.length > 0) {
|
|
5539
|
+
// If the range is collapsed in a non-empty node and 'split' is true, there's nothing to
|
|
5540
|
+
// set that won't get normalized away
|
|
5541
|
+
return;
|
|
5542
|
+
}
|
|
5543
|
+
|
|
5533
5544
|
var rangeRef = Editor.rangeRef(editor, at, {
|
|
5534
5545
|
affinity: 'inward'
|
|
5535
5546
|
});
|