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:
committed by
Ian Storm Taylor
parent
317297469e
commit
a8c08581a5
@@ -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'
|
||||
}
|
||||
|
Reference in New Issue
Block a user