1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-09-01 11:12:42 +02:00

Style pass on ternary indentation

This commit is contained in:
Soreine
2016-11-10 10:38:39 +01:00
parent 201123a63a
commit 6342c59936

View File

@@ -149,11 +149,11 @@ function joinNode(state, operation) {
// Update selection if we merged two texts together
if (deep || second.kind == 'text') {
const firstText = deep
? first.getLastText()
: first
? first.getLastText()
: first
const secondText = deep
? second.getFirstText()
: second
? second.getFirstText()
: second
const { anchorKey, anchorOffset, focusKey, focusOffset } = selection
// The final key is the `first` key
@@ -429,11 +429,11 @@ function splitNode(state, operation) {
const node = document.assertPath(path)
// The text node that was split
const splittedText = node.kind == 'text'
? node
: node.getTextAtOffset(offset)
? node
: node.getTextAtOffset(offset)
const textOffset = node.kind == 'text'
? offset
: offset - node.getOffset(splittedText.key)
? offset
: offset - node.getOffset(splittedText.key)
// Should we update the selection ?
const shouldUpdateAnchor = splittedText.key == anchorKey && textOffset <= anchorOffset