Make images selectable on editor

This commit is contained in:
Cássio Zen 2016-08-11 10:57:24 -03:00
parent 5a4fe3c214
commit 2e40e12f18

View File

@ -33,10 +33,12 @@ export const NODES = {
return <a {...props.attributes} href={href}>{props.children}</a>; return <a {...props.attributes} href={href}>{props.children}</a>;
}, },
'image': (props) => { 'image': (props) => {
const { node } = props; const { node, state } = props;
const isFocused = state.selection.hasEdgeIn(node);
const className = isFocused ? styles.active : null;
const src = node.data.get('src'); const src = node.data.get('src');
return ( return (
<img {...props.attributes} src={src} /> <img {...props.attributes} src={src} className={className} />
); );
} }
}; };