chore(netlify-cms-core): upgrade react-frame-component to 4.x (#1925)

This commit is contained in:
Alexander Nanberg 2018-11-29 16:07:09 +01:00 committed by Shawn Erquhart
parent e940f4eeb6
commit e5ad6087af
3 changed files with 15 additions and 14 deletions

View File

@ -44,7 +44,7 @@
"react-dnd-html5-backend": "^7.0.0", "react-dnd-html5-backend": "^7.0.0",
"react-dom": "^16.0.0", "react-dom": "^16.0.0",
"react-emotion": "^9.2.5", "react-emotion": "^9.2.5",
"react-frame-component": "^2.0.0", "react-frame-component": "^4.0.2",
"react-hot-loader": "^4.0.0", "react-hot-loader": "^4.0.0",
"react-immutable-proptypes": "^2.1.0", "react-immutable-proptypes": "^2.1.0",
"react-is": "16.3.1", "react-is": "16.3.1",

View File

@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import { isElement } from 'react-is'; import { isElement } from 'react-is';
import { ScrollSyncPane } from 'react-scroll-sync'; import { ScrollSyncPane } from 'react-scroll-sync';
import { FrameContextConsumer } from 'react-frame-component';
/** /**
* We need to create a lightweight component here so that we can access the * We need to create a lightweight component here so that we can access the
@ -12,19 +13,19 @@ class PreviewContent extends React.Component {
render() { render() {
const { previewComponent, previewProps } = this.props; const { previewComponent, previewProps } = this.props;
return ( return (
<ScrollSyncPane attachTo={this.context.document.scrollingElement}> <FrameContextConsumer>
{isElement(previewComponent) {context => (
? React.cloneElement(previewComponent, previewProps) <ScrollSyncPane attachTo={context.document.scrollingElement}>
: React.createElement(previewComponent, previewProps)} {isElement(previewComponent)
</ScrollSyncPane> ? React.cloneElement(previewComponent, previewProps)
: React.createElement(previewComponent, previewProps)}
</ScrollSyncPane>
)}
</FrameContextConsumer>
); );
} }
} }
PreviewContent.contextTypes = {
document: PropTypes.any,
};
PreviewContent.propTypes = { PreviewContent.propTypes = {
previewComponent: PropTypes.func.isRequired, previewComponent: PropTypes.func.isRequired,
previewProps: PropTypes.object, previewProps: PropTypes.object,

View File

@ -9612,10 +9612,10 @@ react-emotion@^9.2.5:
babel-plugin-emotion "^9.2.6" babel-plugin-emotion "^9.2.6"
create-emotion-styled "^9.2.6" create-emotion-styled "^9.2.6"
react-frame-component@^2.0.0: react-frame-component@^4.0.2:
version "2.0.2" version "4.0.2"
resolved "https://registry.yarnpkg.com/react-frame-component/-/react-frame-component-2.0.2.tgz#e602a980e1d78f91f471531225b61cfdbf68e614" resolved "https://registry.yarnpkg.com/react-frame-component/-/react-frame-component-4.0.2.tgz#408f137ab4ba14cd13a5844b86ac972903dda021"
integrity sha1-5gKpgOHXj5H0cVMSJbYc/b9o5hQ= integrity sha512-846zt81ijEC0ul6sBWzxkI5EGIE39ft9EaNzQUcszV/WWWDnldFJ+tKU7Et2GhZ4OHT/cy1GHcjsLLsdiOXhBg==
react-hot-loader@^4.0.0: react-hot-loader@^4.0.0:
version "4.3.4" version "4.3.4"