mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 12:41:44 +02:00
Fix drag and dropping a node "forward" in the document (#1621)
When drag and dropping a node to a position earlier in the document, the node is inserted and then removed right after. Regenerate the key to make sure the old node is removed instead of the new one.
This commit is contained in:
committed by
Ian Storm Taylor
parent
a17ea2cc21
commit
e3abba0a29
@@ -264,11 +264,11 @@ function AfterPlugin() {
|
||||
}
|
||||
|
||||
if (type == 'node' && Block.isBlock(node)) {
|
||||
change.insertBlock(node).removeNodeByKey(node.key)
|
||||
change.insertBlock(node.regenerateKey()).removeNodeByKey(node.key)
|
||||
}
|
||||
|
||||
if (type == 'node' && Inline.isInline(node)) {
|
||||
change.insertInline(node).removeNodeByKey(node.key)
|
||||
change.insertInline(node.regenerateKey()).removeNodeByKey(node.key)
|
||||
}
|
||||
|
||||
// COMPAT: React's onSelect event breaks after an onDrop event
|
||||
|
Reference in New Issue
Block a user