1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-09-02 19:52:32 +02:00

change void blocks to not be added automatically, and to handle focus

This commit is contained in:
Ian Storm Taylor
2016-07-22 13:24:22 -07:00
parent b2f7349432
commit 03393dabfb
5 changed files with 43 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
import { Editor, Mark, Raw } from '../..'
import { Editor, Mark, Raw, Void } from '../..'
import React from 'react'
import ReactDOM from 'react-dom'
import initialState from './state.json'
@@ -19,7 +19,11 @@ const NODES = {
const { data } = node
const isActive = state.isFocused && state.blocks.includes(node)
const src = data.get('src')
return <img {...props.attributes} src={src} data-active={isActive} />
return (
<Void {...props} className="image-block">
<img {...props.attributes} src={src} data-active={isActive} />
</Void>
)
}
}