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:
parent
caedc1f108
commit
02ba0591f8
@ -158,8 +158,6 @@ Commands.insertFragment = (editor, fragment) => {
|
|||||||
editor.moveToEndOfNode(newText)
|
editor.moveToEndOfNode(newText)
|
||||||
} else if (newText) {
|
} else if (newText) {
|
||||||
editor.moveToStartOfNode(newText).moveForward(lastBlock.text.length)
|
editor.moveToStartOfNode(newText).moveForward(lastBlock.text.length)
|
||||||
} else {
|
|
||||||
editor.moveToStart().moveForward(lastBlock.text.length)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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>
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user