-
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.
Splitting Metabox iFrames into sidebar.
Splits metabox iframes into sidebar, and changes the partial page to handle different metabox locations.
- Loading branch information
1 parent
acda7be
commit 77df0d6
Showing
7 changed files
with
153 additions
and
36 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
( function( iFrameResize, $ ) { | ||
$( document ).ready( function() { | ||
iFrameResize( { resizeFrom: 'child', heightCalculationMethod: 'documentElementScroll' }, '#gutenberg-metabox-iframe' ); | ||
iFrameResize( { resizeFrom: 'child', heightCalculationMethod: 'documentElementScroll' }, '#gutenberg-metabox-iframe-sidebar' ); | ||
} ); | ||
} )( window.iFrameResize, jQuery ); |
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,60 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import classnames from 'classnames'; | ||
import { connect } from 'react-redux'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { Component } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import './style.scss'; | ||
import { setMetaboxReference } from '../actions'; | ||
|
||
class SidebarMetaboxes 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, id = 'gutenberg-metabox-iframe' } = this.props; | ||
const classes = classnames( { | ||
'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 )( SidebarMetaboxes ); |
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