mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-28 09:29:49 +02:00
when document is very big ,toArray
is very time-consuming (#2404)
* when document is very big ,`toArray` is very time-consuming * when document is very big ,`toArray` is very time-consuming
This commit is contained in:
@@ -361,7 +361,7 @@ function validateLast(node, rule) {
|
|||||||
function validateNodes(node, rule, rules = []) {
|
function validateNodes(node, rule, rules = []) {
|
||||||
if (node.nodes == null) return
|
if (node.nodes == null) return
|
||||||
|
|
||||||
const children = node.nodes.toArray()
|
const children = node.nodes
|
||||||
const defs = rule.nodes != null ? rule.nodes.slice() : []
|
const defs = rule.nodes != null ? rule.nodes.slice() : []
|
||||||
let count = 0
|
let count = 0
|
||||||
let lastCount = 0
|
let lastCount = 0
|
||||||
@@ -386,8 +386,8 @@ function validateNodes(node, rule, rules = []) {
|
|||||||
function nextChild() {
|
function nextChild() {
|
||||||
index += 1
|
index += 1
|
||||||
previous = child
|
previous = child
|
||||||
child = children[index]
|
child = children.get(index)
|
||||||
next = children[index + 1]
|
next = children.get(index + 1)
|
||||||
if (!child) return false
|
if (!child) return false
|
||||||
lastCount = count
|
lastCount = count
|
||||||
count += 1
|
count += 1
|
||||||
|
Reference in New Issue
Block a user