1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-17 12:41:44 +02:00

fix inserting nodes in empty documents

This commit is contained in:
Ian Storm Taylor
2019-12-12 17:11:26 -05:00
parent c9ee503828
commit cf571d36bd
2 changed files with 8 additions and 3 deletions

View File

@@ -46,7 +46,14 @@ export const NodeTransforms = {
// no selection, insert at the end of the document since that is such a
// common use case when inserting from a non-selected state.
if (!at) {
at = selection || Editor.end(editor, []) || [editor.children.length]
if (editor.selection) {
at = editor.selection
} else if (editor.children.length > 0) {
at = Editor.end(editor, [])
} else {
at = [0]
}
select = true
}

View File

@@ -17,5 +17,3 @@ export const output = (
</block>
</editor>
)
export const skip = true