1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-30 18:39:51 +02:00
This commit is contained in:
Ian Storm Taylor
2016-07-12 21:14:21 -07:00
parent c1db9675b2
commit 510eb63d8d
5 changed files with 58 additions and 48 deletions

View File

@@ -142,11 +142,21 @@ class Images extends React.Component {
if (anchorBlock.text != '') {
if (selection.isAtEndOf(anchorBlock)) {
transform = transform.splitBlock()
} else if (selection.isAtStartOf(anchorBlock)) {
transform = transform.splitBlock().moveToStartOfPreviousBlock()
} else {
transform = transform.splitBlock().splitBlock().moveToStartOfPreviousBlock()
transform = transform
.splitBlock()
}
else if (selection.isAtStartOf(anchorBlock)) {
transform = transform
.splitBlock()
.collapseToStartOfPreviousBlock()
}
else {
transform = transform
.splitBlock()
.splitBlock()
.collapseToStartOfPreviousBlock()
}
}