mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-30 18:39:51 +02:00
add helpful error to findDOMNode util, closes #147
This commit is contained in:
@@ -7,7 +7,15 @@
|
||||
*/
|
||||
|
||||
function findDOMNode(node) {
|
||||
return window.document.querySelector(`[data-key="${node.key}"]`)
|
||||
const el = window.document.querySelector(`[data-key="${node.key}"]`)
|
||||
|
||||
if (!el) {
|
||||
throw new Error(`Unable to find a dom node for "${node.key}". This is
|
||||
often because of forgetting to add \`props.attributes\` to a component
|
||||
returned from \`renderNode\`.`)
|
||||
}
|
||||
|
||||
return el
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user