1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-13 11:44:55 +01:00

cleanup void, fix void selections in safari

This commit is contained in:
Ian Storm Taylor 2017-10-25 15:33:34 -07:00
parent fe0d7fd1ce
commit d620141efe

View File

@ -66,8 +66,9 @@ class Void extends React.Component {
const style = { const style = {
height: '0', height: '0',
color: 'transparent', color: 'transparent',
outline: 'none' outline: 'none',
} }
const spacer = ( const spacer = (
<Tag <Tag
contentEditable contentEditable
@ -79,19 +80,22 @@ class Void extends React.Component {
</Tag> </Tag>
) )
const content = (
<Tag draggable={readOnly ? null : true}>
{children}
</Tag>
)
this.debug('render', { props }) this.debug('render', { props })
return ( return (
<Tag <Tag
data-slate-void data-slate-void
data-key={node.key} data-key={node.key}
draggable={readOnly ? null : true}
contentEditable={readOnly ? null : false} contentEditable={readOnly ? null : false}
> >
{readOnly ? null : spacer } {readOnly ? null : spacer}
<Tag> {content}
{children}
</Tag>
</Tag> </Tag>
) )
} }