1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-19 13:41:19 +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)
.filter(text => !getRemoved(text.key))
.last()
if (!prevText) selection = selection.unset()
else selection = selection.moveStartTo(prevText.key, prevText.length)
selection = !prevText
? selection.unset()
: selection.moveStartTo(prevText.key, prevText.length)
}
if (endDesc) {
// 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))
.first()
if (!nextText) selection = selection.unset()
else selection = selection.moveEndTo(nextText.key, 0)
selection = !nextText
? selection.unset()
: selection.moveEndTo(nextText.key, 0)
}
}