-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Brings iframes into React, updates of the post now trigger submission of the iframe forms. Fixed linting errors, and added tests for new JS functionality.
- Loading branch information
1 parent
dab0948
commit 500dfea
Showing
16 changed files
with
329 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ build | |
coverage | ||
vendor | ||
node_modules | ||
/assets/js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import classnames from 'classnames'; | ||
import { connect } from 'react-redux'; | ||
// @TODO Should this be React or WordPress elements? | ||
import { Component } from 'react'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import './style.scss'; | ||
import { setMetaboxReference } from '../actions'; | ||
|
||
class Metaboxes extends Component { | ||
constructor() { | ||
super(); | ||
|
||
this.state = { | ||
cool: 'yeah', | ||
}; | ||
} | ||
|
||
componentDidMount() { | ||
// Sets a React Node Reference into the store. | ||
this.props.setReference( this.props.location, this.node ); | ||
} | ||
|
||
render() { | ||
const { location, isSidebarOpened, id = 'gutenberg-metabox-iframe' } = this.props; | ||
const classes = classnames( { | ||
'sidebar-open': isSidebarOpened, | ||
'gutenberg-metabox-iframe': true, | ||
} ); | ||
|
||
return ( | ||
<iframe | ||
ref={ ( node ) => { | ||
this.node = node; | ||
} } | ||
title={ __( 'Extended Settings' ) } | ||
key="metabox" | ||
id={ id } | ||
className={ classes } | ||
src={ `${ window._wpMetaboxUrl }&metabox=${ location }` } /> | ||
); | ||
} | ||
} | ||
|
||
function mapDispatchToProps( dispatch ) { | ||
return { | ||
// Used to set the reference to the Metabox in redux, fired when the component mounts. | ||
setReference: ( location, node ) => dispatch( setMetaboxReference( location, node ) ), | ||
}; | ||
} | ||
|
||
export default connect( null, mapDispatchToProps )( Metaboxes ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.gutenberg-metabox-iframe { | ||
width: 100%; | ||
|
||
&.sidebar-open { | ||
padding: 0 $sidebar-width 0 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.