1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-21 22:45:18 +02:00

Remove weird if/then/else

This commit is contained in:
Soreine
2016-11-10 16:09:01 +01:00
parent 944adc27fe
commit 4a16a9be4a

View File

@@ -262,8 +262,9 @@ function removeNode(state, operation) {
.takeUntil(text => text.key == startKey) .takeUntil(text => text.key == startKey)
.filter(text => !getRemoved(text.key)) .filter(text => !getRemoved(text.key))
.last() .last()
if (!prevText) selection = selection.unset() selection = !prevText
else selection = selection.moveStartTo(prevText.key, prevText.length) ? selection.unset()
: selection.moveStartTo(prevText.key, prevText.length)
} }
if (endDesc) { if (endDesc) {
// The whole selection is inside the node, we collapse to the previous text node // The whole selection is inside the node, we collapse to the previous text node
@@ -276,8 +277,9 @@ function removeNode(state, operation) {
.filter(text => !getRemoved(text.key)) .filter(text => !getRemoved(text.key))
.first() .first()
if (!nextText) selection = selection.unset() selection = !nextText
else selection = selection.moveEndTo(nextText.key, 0) ? selection.unset()
: selection.moveEndTo(nextText.key, 0)
} }
} }