1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-06 14:32:48 +02:00

Fix condition in core rule to add test around all inlines

This commit is contained in:
Samy Pessé 2016-12-02 17:53:12 +01:00
parent bfc05b587a
commit 8738b0a48d

View File

@ -178,11 +178,11 @@ const rules = [
},
validate: (node) => {
const invalids = node.nodes.reduce((list, child, index) => {
if (child.kind == 'block') return list
if (!child.isVoid) return list
if (child.kind !== 'inline') return list
const prev = index > 0 ? node.nodes.get(index - 1) : null
const next = node.nodes.get(index + 1)
// We don't test if "prev" is inline, since it has already been processed in the loop
const insertBefore = !prev
const insertAfter = !next || (next.kind == 'inline')