1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-20 06:01:24 +02:00

fix to avoid splitting for inline voids too

This commit is contained in:
Ian Storm Taylor
2016-11-29 12:51:49 -08:00
parent 155b1aad00
commit ecf320eb66

View File

@@ -371,11 +371,12 @@ function Plugin(options = {}) {
function onKeyDownEnter(e, data, state) {
debug('onKeyDownEnter', { data })
const { document, startKey, startBlock } = state
const { document, startKey } = state
const hasVoidParent = document.hasVoidParent(startKey)
// For void blocks, we don't want to split. Instead we just move to the
// start of the next text node if one exists.
if (startBlock && startBlock.isVoid) {
// For void nodes, we don't want to split. Instead we just move to the start
// of the next text node if one exists.
if (hasVoidParent) {
const text = document.getNextText(startKey)
if (!text) return
return state