From f4283866f2479ba7a57e397bc060f1fea7d4a1d5 Mon Sep 17 00:00:00 2001 From: themithy <11431578+themithy@users.noreply.github.com> Date: Thu, 22 Aug 2019 04:42:07 +0200 Subject: [PATCH] Fix range normalization in remove node. (#2971) --- packages/slate/src/models/value.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/slate/src/models/value.js b/packages/slate/src/models/value.js index 02884c3c5..bd2427ef2 100644 --- a/packages/slate/src/models/value.js +++ b/packages/slate/src/models/value.js @@ -622,18 +622,18 @@ class Value extends Record(DEFAULTS) { value = value.set('document', document) value = value.mapRanges(range => { - const { start, end } = range + const { anchor, focus } = range - if (node.hasNode(start.key)) { + if (node.hasNode(anchor.key)) { range = prev - ? range.moveStartTo(prev.key, prev.text.length) - : next ? range.moveStartTo(next.key, 0) : range.unset() + ? range.moveAnchorTo(prev.key, prev.text.length) + : next ? range.moveAnchorTo(next.key, 0) : range.unset() } - if (node.hasNode(end.key)) { + if (node.hasNode(focus.key)) { range = prev - ? range.moveEndTo(prev.key, prev.text.length) - : next ? range.moveEndTo(next.key, 0) : range.unset() + ? range.moveFocusTo(prev.key, prev.text.length) + : next ? range.moveFocusTo(next.key, 0) : range.unset() } range = range.updatePoints(point => point.setPath(null))