mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-01 05:16:10 +01:00
Checks for nodes in isLeafBlock & isLeafInline (#2357)
These functions now check for `nodes` before running `nodes.first()`
This commit is contained in:
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'
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user