1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-16 12:14:14 +02:00

fix for normalizing selections in empty blocks

This commit is contained in:
Ian Storm Taylor
2016-12-01 15:14:22 -08:00
parent 77d6aa2ac5
commit 3a432a5d80

View File

@@ -17,8 +17,8 @@ function normalizeNodeAndOffset(node, offset) {
const index = isLast ? offset - 1 : offset
node = getNonComment(node, index, direction)
// If the node is not a text node, traverse until we have one.
while (node.nodeType != 3) {
// If the node is not a text or a <br> node, traverse until we have one.
while (node.nodeType == 1 && node.tagName != 'BR') {
const i = isLast ? node.childNodes.length - 1 : 0
node = getNonComment(node, i, direction)
}