1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-01 05:16:10 +01:00

fix insertFragment selection

This commit is contained in:
Ian Storm Taylor 2018-10-31 10:24:32 -07:00
parent caedc1f108
commit 02ba0591f8
2 changed files with 36 additions and 2 deletions

View File

@ -158,8 +158,6 @@ Commands.insertFragment = (editor, fragment) => {
editor.moveToEndOfNode(newText)
} else if (newText) {
editor.moveToStartOfNode(newText).moveForward(lastBlock.text.length)
} else {
editor.moveToStart().moveForward(lastBlock.text.length)
}
}

View File

@ -0,0 +1,36 @@
/** @jsx h */
import h from '../../../helpers/h'
export default function(editor) {
editor.insertFragment(
<document>
<paragraph>
<text>one</text>
<text>two</text>
</paragraph>
</document>
)
}
export const input = (
<value>
<document>
<paragraph>
word<cursor />
</paragraph>
<paragraph>another</paragraph>
</document>
</value>
)
export const output = (
<value>
<document>
<paragraph>
wordonetwo<cursor />
</paragraph>
<paragraph>another</paragraph>
</document>
</value>
)