1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 09:59:48 +02:00

fix block void node handling, closes #358

This commit is contained in:
Ian Storm Taylor
2016-09-26 21:42:25 -07:00
parent e63a6b36ce
commit 071d7292b8

View File

@@ -67,8 +67,7 @@ class Void extends React.Component {
// Make the outer wrapper relative, so the spacer can overlay it.
const style = {
position: 'relative',
lineHeight: '0px'
position: 'relative'
}
return (
@@ -91,12 +90,34 @@ class Void extends React.Component {
*/
renderSpacer = () => {
const style = {
const { node } = this.props
let style
if (node.kind == 'block') {
style = IS_FIREFOX
? {
pointerEvents: 'none',
width: '0px',
height: '0px',
lineHeight: '0px',
visibility: 'hidden'
}
: {
position: 'absolute',
top: '0px',
left: '-9999px',
textIndent: '-9999px'
}
} else {
style = {
position: 'relative',
top: '0px',
left: '-9999px',
height: '0px',
width: '0px',
textIndent: '-9999px',
}
}
return (
<span style={style}>{this.renderLeaf()}</span>