-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Media: Implement feature-flagged advanced media editing
- Loading branch information
Showing
14 changed files
with
154 additions
and
1 deletion.
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
38 changes: 38 additions & 0 deletions
38
client/components/tinymce/plugins/media/advanced/index.jsx
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,38 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React from 'react'; | ||
import ReactDomServer from 'react-dom/server'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import i18n from 'lib/mixins/i18n'; | ||
import config from 'config'; | ||
import { toggleEditorMediaAdvanced } from 'state/ui/editor/media/actions'; | ||
import Gridicon from 'components/gridicon'; | ||
|
||
export default function( editor ) { | ||
const store = editor.getParam( 'redux_store' ); | ||
if ( ! config.isEnabled( 'post-editor/media-advanced' ) || ! store ) { | ||
return; | ||
} | ||
|
||
editor.addButton( 'wp_img_advanced', { | ||
tooltip: i18n.translate( 'Edit', { context: 'verb' } ), | ||
|
||
classes: 'toolbar-segment-start', | ||
|
||
onPostRender() { | ||
this.innerHtml( ReactDomServer.renderToStaticMarkup( | ||
<button type="button" role="presentation" tabIndex="-1"> | ||
<Gridicon icon="pencil" size={ 18 } /> | ||
</button> | ||
) ); | ||
}, | ||
|
||
onClick() { | ||
store.dispatch( toggleEditorMediaAdvanced() ); | ||
} | ||
} ); | ||
} |
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,43 @@ | ||
/** | ||
* External depencencies | ||
*/ | ||
import React, { PropTypes } from 'react'; | ||
import { bindActionCreators } from 'redux'; | ||
import { connect } from 'react-redux'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { toggleEditorMediaAdvanced } from 'state/ui/editor/media/actions'; | ||
import Dialog from 'components/dialog'; | ||
|
||
function EditorMediaAdvanced( { visible, toggleVisible } ) { | ||
return ( | ||
<Dialog isVisible={ visible } onClose={ toggleVisible }> | ||
WIP | ||
</Dialog> | ||
); | ||
} | ||
|
||
EditorMediaAdvanced.propTypes = { | ||
visible: PropTypes.bool, | ||
toggleVisible: PropTypes.func | ||
}; | ||
|
||
EditorMediaAdvanced.defaultProps = { | ||
visible: false, | ||
toggleVisible: () => {} | ||
}; | ||
|
||
export default connect( | ||
( state ) => { | ||
return { | ||
visible: state.ui.editor.media.advanced | ||
}; | ||
}, | ||
( dispatch ) => { | ||
return bindActionCreators( { | ||
toggleVisible: toggleEditorMediaAdvanced | ||
}, dispatch ); | ||
} | ||
)( EditorMediaAdvanced ); |
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,10 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { EDITOR_MEDIA_ADVANCED_TOGGLE } from 'state/action-types'; | ||
|
||
export function toggleEditorMediaAdvanced() { | ||
return { | ||
type: EDITOR_MEDIA_ADVANCED_TOGGLE | ||
}; | ||
} |
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,23 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { combineReducers } from 'redux'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { EDITOR_MEDIA_ADVANCED_TOGGLE } from 'state/action-types'; | ||
|
||
function advanced( state = false, action ) { | ||
switch ( action.type ) { | ||
case EDITOR_MEDIA_ADVANCED_TOGGLE: | ||
state = ! state; | ||
break; | ||
} | ||
|
||
return state; | ||
} | ||
|
||
export default combineReducers( { | ||
advanced | ||
} ); |
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,13 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { combineReducers } from 'redux'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import media from './media/reducer'; | ||
|
||
export default combineReducers( { | ||
media | ||
} ); |
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