From ecf320eb662f819b708ee61871a740f4f1abdb3f Mon Sep 17 00:00:00 2001 From: Ian Storm Taylor Date: Tue, 29 Nov 2016 12:51:49 -0800 Subject: [PATCH] fix to avoid splitting for inline voids too --- src/plugins/core.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/core.js b/src/plugins/core.js index 361f0826e..269765b59 100644 --- a/src/plugins/core.js +++ b/src/plugins/core.js @@ -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