1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-09-01 03:11:44 +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 // Update selection if we merged two texts together
if (deep || second.kind == 'text') { if (deep || second.kind == 'text') {
const firstText = deep const firstText = deep
? first.getLastText() ? first.getLastText()
: first : first
const secondText = deep const secondText = deep
? second.getFirstText() ? second.getFirstText()
: second : second
const { anchorKey, anchorOffset, focusKey, focusOffset } = selection const { anchorKey, anchorOffset, focusKey, focusOffset } = selection
// The final key is the `first` key // The final key is the `first` key
@@ -429,11 +429,11 @@ function splitNode(state, operation) {
const node = document.assertPath(path) const node = document.assertPath(path)
// The text node that was split // The text node that was split
const splittedText = node.kind == 'text' const splittedText = node.kind == 'text'
? node ? node
: node.getTextAtOffset(offset) : node.getTextAtOffset(offset)
const textOffset = node.kind == 'text' const textOffset = node.kind == 'text'
? offset ? offset
: offset - node.getOffset(splittedText.key) : offset - node.getOffset(splittedText.key)
// Should we update the selection ? // Should we update the selection ?
const shouldUpdateAnchor = splittedText.key == anchorKey && textOffset <= anchorOffset const shouldUpdateAnchor = splittedText.key == anchorKey && textOffset <= anchorOffset