mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-31 19:01:54 +02:00
Fix when clear search text, all text split by blank (#3072)
in search-highlighting example, when search text is empty, no need to split text and addAnnotation
This commit is contained in:
@@ -185,6 +185,7 @@ class SearchHighlighting extends React.Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (string) {
|
||||||
for (const [node, path] of document.texts()) {
|
for (const [node, path] of document.texts()) {
|
||||||
const { key, text } = node
|
const { key, text } = node
|
||||||
const parts = text.split(string)
|
const parts = text.split(string)
|
||||||
@@ -203,6 +204,7 @@ class SearchHighlighting extends React.Component {
|
|||||||
offset = offset + part.length + string.length
|
offset = offset + part.length + string.length
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user