Skip to content

Commit

Permalink
[preview] Don't toggle visiblity for 'inline' and 'block' previews (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
skogsmaskin committed Jul 5, 2019
1 parent e31055b commit 1960879
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/@sanity/preview/src/components/PreviewSubscriber.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export default class PreviewSubscriber extends React.Component {
fields: PropTypes.arrayOf(PropTypes.oneOf(['title', 'description', 'imageUrl'])),
value: PropTypes.any.isRequired,
ordering: PropTypes.object,
children: PropTypes.func
children: PropTypes.func,
layout: PropTypes.string
}

renderChild = isVisible => {
Expand Down Expand Up @@ -40,6 +41,12 @@ export default class PreviewSubscriber extends React.Component {
}

render() {
// Disable visibility for 'inline' and 'block' types which is used in the block editor (for now)
// This led to strange side effects inside the block editor, and needs to be disabled for now.
// https://github.com/sanity-io/sanity/pull/1411
if (['inline', 'block'].includes(this.props.layout)) {
return this.renderChild(true)
}
return <WithVisibility hideDelay={HIDE_DELAY}>{this.renderChild}</WithVisibility>
}
}

0 comments on commit 1960879

Please sign in to comment.