mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-23 15:32:59 +02:00
Update Placeholder to be compatible with older versions of React (#2491)
* Make `placeholder` element compatible with older versions of React `React.Fragment` is only available in react >= 16.2, which does not meet the dependency requirements specified by the package (react >= 0.14.0). Updates from `React.Fragment` -> `span` to provide coverage for older versions of react. * Update `slate-react` placeholder test case
This commit is contained in:
committed by
Ian Storm Taylor
parent
c2a3609a09
commit
2ad73d73e5
@@ -70,12 +70,12 @@ function SlateReactPlaceholder(options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<span>
|
||||||
<span contentEditable={false} style={style}>
|
<span contentEditable={false} style={style}>
|
||||||
{placeholder}
|
{placeholder}
|
||||||
</span>
|
</span>
|
||||||
{children}
|
{children}
|
||||||
</React.Fragment>
|
</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,6 +21,7 @@ export const output = `
|
|||||||
<div style="position:relative">
|
<div style="position:relative">
|
||||||
<span>
|
<span>
|
||||||
<span data-slate-leaf="true">
|
<span data-slate-leaf="true">
|
||||||
|
<span>
|
||||||
<span contenteditable="false" style="pointer-events:none;display:inline-block;width:0;max-width:100%;white-space:nowrap;opacity:0.333">
|
<span contenteditable="false" style="pointer-events:none;display:inline-block;width:0;max-width:100%;white-space:nowrap;opacity:0.333">
|
||||||
placeholder text
|
placeholder text
|
||||||
</span>
|
</span>
|
||||||
@@ -29,6 +30,7 @@ export const output = `
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
|
Reference in New Issue
Block a user