fix slate mark rendering

This commit is contained in:
Shawn Erquhart 2017-12-03 12:52:52 -05:00
parent 2533b69bcd
commit 9b2e51d75d

View File

@ -44,8 +44,7 @@ const Link = props => {
const title = data.get('title'); const title = data.get('title');
const link = <a href={url} title={title} {...props.attributes}>{props.children}</a>; const link = <a href={url} title={title} {...props.attributes}>{props.children}</a>;
const result = !marks ? link : marks.reduce((acc, mark) => { const result = !marks ? link : marks.reduce((acc, mark) => {
const MarkComponent = MARK_COMPONENTS[mark.type]; return renderMark({ mark, children: acc });
return <MarkComponent>{acc}</MarkComponent>;
}, link); }, link);
return result; return result;
}; };
@ -57,8 +56,7 @@ const Image = props => {
const alt = data.get('alt'); const alt = data.get('alt');
const image = <img src={url} title={title} alt={alt} {...props.attributes}/>; const image = <img src={url} title={title} alt={alt} {...props.attributes}/>;
const result = !marks ? image : marks.reduce((acc, mark) => { const result = !marks ? image : marks.reduce((acc, mark) => {
const MarkComponent = MARK_COMPONENTS[mark.type]; return renderMark({ mark, children: acc });
return <MarkComponent>{acc}</MarkComponent>;
}, image); }, image);
return result; return result;
}; };