1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-28 17:39:57 +02:00

Checks for nodes in isLeafBlock & isLeafInline (#2357)

These functions now check for `nodes` before running `nodes.first()`
This commit is contained in:
Slapbox
2018-10-31 17:15:38 -04:00
committed by Ian Storm Taylor
parent 317297469e
commit a8c08581a5

View File

@@ -1428,6 +1428,7 @@ class ElementInterface {
isLeafBlock() {
const { object, nodes } = this
if (!nodes.size) return true
const first = nodes.first()
return object === 'block' && first.object !== 'block'
}
@@ -1440,6 +1441,7 @@ class ElementInterface {
isLeafInline() {
const { object, nodes } = this
if (!nodes.size) return true
const first = nodes.first()
return object === 'inline' && first.object !== 'inline'
}