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:
@@ -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
|
||||
|
Reference in New Issue
Block a user