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) {
|
function onKeyDownEnter(e, data, state) {
|
||||||
debug('onKeyDownEnter', { data })
|
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
|
// For void nodes, we don't want to split. Instead we just move to the start
|
||||||
// start of the next text node if one exists.
|
// of the next text node if one exists.
|
||||||
if (startBlock && startBlock.isVoid) {
|
if (hasVoidParent) {
|
||||||
const text = document.getNextText(startKey)
|
const text = document.getNextText(startKey)
|
||||||
if (!text) return
|
if (!text) return
|
||||||
return state
|
return state
|
||||||
|
Reference in New Issue
Block a user