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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # slate
2
2
 
3
+ ## 0.66.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4552](https://github.com/ianstormtaylor/slate/pull/4552) [`37d60c58`](https://github.com/ianstormtaylor/slate/commit/37d60c58b8d4fb844f31888b518be6c2a01fb110) Thanks [@clauderic](https://github.com/clauderic)! - Only apply Firefox `toSlatePoint()` offset fix when the cloned contents end in `\n\n` instead of just `\n`.
8
+
9
+ ## 0.66.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#4523](https://github.com/ianstormtaylor/slate/pull/4523) [`0da12c17`](https://github.com/ianstormtaylor/slate/commit/0da12c17dc0484f065af2a270d352593a65c1577) Thanks [@steve-codaio](https://github.com/steve-codaio)! - Fix setNodes when called with 'split' and a collapsed range
14
+
3
15
  ## 0.66.1
4
16
 
5
17
  ### Patch Changes
package/dist/index.es.js CHANGED
@@ -3664,12 +3664,17 @@ var Range = {
3664
3664
  var affinityFocus;
3665
3665
 
3666
3666
  if (affinity === 'inward') {
3667
+ // If the range is collapsed, make sure to use the same affinity to
3668
+ // avoid the two points passing each other and expanding in the opposite
3669
+ // direction
3670
+ var isCollapsed = Range.isCollapsed(r);
3671
+
3667
3672
  if (Range.isForward(r)) {
3668
3673
  affinityAnchor = 'forward';
3669
- affinityFocus = 'backward';
3674
+ affinityFocus = isCollapsed ? affinityAnchor : 'backward';
3670
3675
  } else {
3671
3676
  affinityAnchor = 'backward';
3672
- affinityFocus = 'forward';
3677
+ affinityFocus = isCollapsed ? affinityAnchor : 'forward';
3673
3678
  }
3674
3679
  } else if (affinity === 'outward') {
3675
3680
  if (Range.isForward(r)) {
@@ -4815,6 +4820,12 @@ var NodeTransforms = {
4815
4820
  }
4816
4821
 
4817
4822
  if (split && Range.isRange(at)) {
4823
+ if (Range.isCollapsed(at) && Editor.leaf(editor, at.anchor)[0].text.length > 0) {
4824
+ // If the range is collapsed in a non-empty node and 'split' is true, there's nothing to
4825
+ // set that won't get normalized away
4826
+ return;
4827
+ }
4828
+
4818
4829
  var rangeRef = Editor.rangeRef(editor, at, {
4819
4830
  affinity: 'inward'
4820
4831
  });