-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix splitBlock bug with hanging selection (#1747)
* Fix splitBlock bug with hanging selection * Restore marks
- Loading branch information
1 parent
6e6e9cf
commit bbbf73f
Showing
4 changed files
with
90 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/slate/test/changes/at-current-range/split-block/with-delete-hanging-selection.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** @jsx h */ | ||
|
||
import h from '../../../helpers/h' | ||
|
||
export default function(change) { | ||
change.splitBlock() | ||
} | ||
|
||
export const input = ( | ||
<value> | ||
<document> | ||
<paragraph>zero</paragraph> | ||
<paragraph> | ||
<anchor />word | ||
</paragraph> | ||
<quote> | ||
<focus />cat is cute | ||
</quote> | ||
</document> | ||
</value> | ||
) | ||
|
||
export const output = ( | ||
<value> | ||
<document> | ||
<paragraph>zero</paragraph> | ||
<paragraph /> | ||
<quote> | ||
<cursor />cat is cute | ||
</quote> | ||
</document> | ||
</value> | ||
) |
38 changes: 38 additions & 0 deletions
38
packages/slate/test/changes/at-current-range/split-block/with-marks.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** @jsx h */ | ||
|
||
import h from '../../../helpers/h' | ||
|
||
export default function(change) { | ||
change | ||
.addMark('italic') | ||
.splitBlock() | ||
.insertText('cat is cute') | ||
} | ||
|
||
export const input = ( | ||
<value> | ||
<document> | ||
<paragraph> | ||
<b>word</b> | ||
<cursor /> | ||
</paragraph> | ||
</document> | ||
</value> | ||
) | ||
|
||
export const output = ( | ||
<value> | ||
<document> | ||
<paragraph> | ||
<b>word</b> | ||
<cursor /> | ||
</paragraph> | ||
<paragraph> | ||
<i> | ||
<b>cat is cute</b> | ||
</i> | ||
<cursor /> | ||
</paragraph> | ||
</document> | ||
</value> | ||
) |