1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-31 10:51:44 +02:00

got void components working

This commit is contained in:
Ian Storm Taylor
2016-06-30 10:43:24 -07:00
parent 27e71715a6
commit aba40a2aaf
10 changed files with 195 additions and 18 deletions

View File

@@ -152,9 +152,11 @@ class Images extends React.Component {
switch (node.type) {
case 'image': {
return (props) => {
const { data } = props.node
const { node, state } = props
const { data } = node
const isActive = state.blocks.includes(node)
const src = data.get('src')
return <img src={src} />
return <img src={src} data-active={isActive} />
}
}
case 'paragraph': {

View File

@@ -18,6 +18,7 @@
"kind": "block",
"type": "image",
"data": {
"isVoid": true,
"src": "https://img.washingtonpost.com/wp-apps/imrs.php?src=https://img.washingtonpost.com/news/speaking-of-science/wp-content/uploads/sites/36/2015/10/as12-49-7278-1024x1024.jpg&w=1484"
},
"nodes": [