mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-01 05:16:10 +01:00
fix onClick when not finding a node
This commit is contained in:
parent
bf9b03e634
commit
af8432f639
@ -165,11 +165,18 @@ function AfterPlugin() {
|
||||
*/
|
||||
|
||||
function onClick(event, change, editor) {
|
||||
if (editor.props.readOnly) return true
|
||||
if (editor.props.readOnly) {
|
||||
return true
|
||||
}
|
||||
|
||||
const { value } = change
|
||||
const { document, schema } = value
|
||||
const node = findNode(event.target, value)
|
||||
|
||||
if (!node) {
|
||||
return
|
||||
}
|
||||
|
||||
const ancestors = document.getAncestors(node.key)
|
||||
const isVoid =
|
||||
node && (schema.isVoid(node) || ancestors.some(a => schema.isVoid(a)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user