Skip to content

Commit

Permalink
Blocks: Merge paragraph and cover text blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Aug 17, 2017
1 parent de51e24 commit d81b784
Show file tree
Hide file tree
Showing 19 changed files with 99 additions and 278 deletions.
2 changes: 1 addition & 1 deletion blocks/api/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export function createBlockWithFallback( name, rawContent, attributes ) {

// Convert 'core/text' blocks in existing content to the new
// 'core/paragraph'.
if ( name === 'core/text' ) {
if ( name === 'core/text' || name === 'core/cover-text' ) {
name = 'core/paragraph';
}

Expand Down
4 changes: 3 additions & 1 deletion blocks/editable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ export default class Editable extends Component {
style,
value,
focus,
wrapperClassname,
className,
inlineToolbar = false,
formattingControls,
Expand All @@ -563,7 +564,7 @@ export default class Editable extends Component {
// mount and initialize a new child element in its place.
const key = [ 'editor', Tagname ].join();
const isPlaceholderVisible = placeholder && ! focus && this.state.empty;
const classes = classnames( className, 'blocks-editable' );
const classes = classnames( wrapperClassname, 'blocks-editable' );

const formatToolbar = (
<FormatToolbar
Expand Down Expand Up @@ -595,6 +596,7 @@ export default class Editable extends Component {
defaultValue={ value }
isPlaceholderVisible={ isPlaceholderVisible }
label={ placeholder }
className={ className }
key={ key }
/>
{ isPlaceholderVisible &&
Expand Down
4 changes: 4 additions & 0 deletions blocks/editable/tinymce.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export default class TinyMCE extends Component {
if ( ! isEqual( this.props.style, nextProps.style ) ) {
Object.assign( this.editorNode.style, nextProps.style );
}

if ( ! isEqual( this.props.className, nextProps.className ) ) {
this.editorNode.className = classnames( nextProps.className, 'blocks-editable__tinymce' );
}
}

componentWillUnmount() {
Expand Down
10 changes: 8 additions & 2 deletions blocks/inspector-controls/range-control/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/**
* WordPress dependencies
*/
import { Dashicon, withInstanceId } from '@wordpress/components';
import { Dashicon, withInstanceId, Button } from '@wordpress/components';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import BaseControl from './../base-control';
import './style.scss';

function RangeControl( { label, value, instanceId, onChange, beforeIcon, afterIcon, ...props } ) {
function RangeControl( { label, value, instanceId, onChange, beforeIcon, afterIcon, allowReset, ...props } ) {
const id = 'inspector-range-control-' + instanceId;
const onChangeValue = ( event ) => onChange( Number( event.target.value ) );

Expand All @@ -31,6 +32,11 @@ function RangeControl( { label, value, instanceId, onChange, beforeIcon, afterIc
value={ value }
{ ...props }
/>
{ allowReset &&
<Button onClick={ () => onChange() } disabled={ value === undefined }>
{ __( 'Reset' ) }
</Button>
}
</BaseControl>
);
}
Expand Down
3 changes: 0 additions & 3 deletions blocks/library/cover-text/editor.scss

This file was deleted.

205 changes: 0 additions & 205 deletions blocks/library/cover-text/index.js

This file was deleted.

12 changes: 0 additions & 12 deletions blocks/library/cover-text/style.scss

This file was deleted.

1 change: 0 additions & 1 deletion blocks/library/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import './freeform';
import './latest-posts';
import './categories';
import './cover-image';
import './cover-text';
import './shortcode';
import './text-columns';
import './verse';
Expand Down
2 changes: 1 addition & 1 deletion blocks/library/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ registerBlockType( 'core/list', {
value={ values }
focus={ focus }
onFocus={ setFocus }
className="blocks-list"
wrapperClassname="blocks-list"
placeholder={ __( 'Write list…' ) }
onMerge={ mergeBlocks }
onSplit={ ( before, after, ...blocks ) => {
Expand Down
Loading

0 comments on commit d81b784

Please sign in to comment.