Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function deserialize(value, type) {
return State.fromJSON(blockTools.blocksToSlateState(value, type))
}
function onPaste(event, data, change) {
if (data.type != 'html') {
return null
}
if (data.isShift) {
return null
}
const blockContentType = blockEditor.props.type
const blocks = blockTools.htmlToBlocks(data.html, {blockContentType})
const {document} = blockTools.blocksToSlateState(blocks, blockContentType)
return change.insertFragment(Document.fromJSON(document))
}