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

tweak void styles, fix tests

This commit is contained in:
Ian Storm Taylor
2017-10-13 18:05:05 -07:00
parent 5c1d43e3f9
commit 576fb5a133
3 changed files with 10 additions and 13 deletions

View File

@@ -128,20 +128,13 @@ class Void extends React.Component {
const Tag = node.kind == 'block' ? 'div' : 'span' const Tag = node.kind == 'block' ? 'div' : 'span'
let style let style
if (!readOnly && node.kind == 'block') { if (!readOnly) {
style = { style = {
display: 'block',
height: '0', height: '0',
color: 'transparent' color: 'transparent'
} }
} }
if (!readOnly && node.kind == 'inline') {
style = {
color: 'transparent'
}
}
this.debug('render', { props }) this.debug('render', { props })
return ( return (

View File

@@ -24,9 +24,11 @@ export const state = (
export const output = ` export const output = `
<div data-slate-editor="true" contenteditable="true" role="textbox"> <div data-slate-editor="true" contenteditable="true" role="textbox">
<div data-slate-void="true"> <div data-slate-void="true">
<span style="display:inline-block;vertical-align:top;width:0;height:0;color:transparent"> <div style="height:0;color:transparent">
<span>
<span></span> <span></span>
</span> </span>
</div>
<div contenteditable="false"> <div contenteditable="false">
<img src="https://example.com/image.png"> <img src="https://example.com/image.png">
</div> </div>

View File

@@ -32,9 +32,11 @@ export const output = `
</span> </span>
</span> </span>
<span data-slate-void="true"> <span data-slate-void="true">
<span style="color:transparent"> <span style="height:0;color:transparent">
<span>
<span></span> <span></span>
</span> </span>
</span>
<span contenteditable="false"> <span contenteditable="false">
<img> <img>
</span> </span>