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

fix void blocks to node be inline-block, closes #1210

This commit is contained in:
Ian Storm Taylor 2017-10-12 14:24:38 -07:00
parent e0d7122881
commit c36362a425

View File

@ -138,18 +138,7 @@ class Void extends React.Component {
render() { render() {
const { props } = this const { props } = this
const { children, node } = props const { children, node } = props
let Tag, style const Tag = node.kind == 'block' ? 'div' : 'span'
if (node.kind === 'block') {
Tag = 'div'
style = {
display: 'inline-block',
verticalAlign: 'top',
width: '100%'
}
} else {
Tag = 'span'
}
this.debug('render', { props }) this.debug('render', { props })
@ -162,7 +151,7 @@ class Void extends React.Component {
onDrop={this.onDrop} onDrop={this.onDrop}
> >
{this.renderSpacer()} {this.renderSpacer()}
<Tag contentEditable={this.state.editable} style={style}> <Tag contentEditable={this.state.editable}>
{children} {children}
</Tag> </Tag>
</Tag> </Tag>
@ -187,6 +176,7 @@ class Void extends React.Component {
display: 'inline-block', display: 'inline-block',
verticalAlign: 'top', verticalAlign: 'top',
width: '0', width: '0',
height: '0',
color: 'transparent' color: 'transparent'
} }
} else { } else {