diff --git a/blocks/api/parser.js b/blocks/api/parser.js
index c908414a77597..6d4771c80d3c4 100644
--- a/blocks/api/parser.js
+++ b/blocks/api/parser.js
@@ -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';
}
diff --git a/blocks/editable/index.js b/blocks/editable/index.js
index f869025a84c83..51e4d030058af 100644
--- a/blocks/editable/index.js
+++ b/blocks/editable/index.js
@@ -551,6 +551,7 @@ export default class Editable extends Component {
style,
value,
focus,
+ wrapperClassname,
className,
inlineToolbar = false,
formattingControls,
@@ -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 = (
{ isPlaceholderVisible &&
diff --git a/blocks/editable/tinymce.js b/blocks/editable/tinymce.js
index fe1ba297bfed1..2cf65393b6f8b 100644
--- a/blocks/editable/tinymce.js
+++ b/blocks/editable/tinymce.js
@@ -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() {
diff --git a/blocks/inspector-controls/range-control/index.js b/blocks/inspector-controls/range-control/index.js
index d0fedad9e65da..6d356f2b93f51 100644
--- a/blocks/inspector-controls/range-control/index.js
+++ b/blocks/inspector-controls/range-control/index.js
@@ -1,7 +1,8 @@
/**
* WordPress dependencies
*/
-import { Dashicon, withInstanceId } from '@wordpress/components';
+import { Dashicon, withInstanceId, Button } from '@wordpress/components';
+import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
@@ -9,7 +10,7 @@ import { Dashicon, withInstanceId } from '@wordpress/components';
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 ) );
@@ -31,6 +32,11 @@ function RangeControl( { label, value, instanceId, onChange, beforeIcon, afterIc
value={ value }
{ ...props }
/>
+ { allowReset &&
+
+ }
);
}
diff --git a/blocks/library/cover-text/editor.scss b/blocks/library/cover-text/editor.scss
deleted file mode 100644
index fe5ab068ff7ec..0000000000000
--- a/blocks/library/cover-text/editor.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-.wp-block-cover-text p.blocks-editable__tinymce {
- font-size: inherit;
-}
diff --git a/blocks/library/cover-text/index.js b/blocks/library/cover-text/index.js
deleted file mode 100644
index 5db7359fbbdda..0000000000000
--- a/blocks/library/cover-text/index.js
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- * External dependencies
- */
-import classnames from 'classnames';
-
-/**
- * WordPress dependencies
- */
-import { __ } from '@wordpress/i18n';
-import { concatChildren } from '@wordpress/element';
-
-/**
- * Internal dependencies
- */
-import './style.scss';
-import './editor.scss';
-import { registerBlockType, source } from '../../api';
-import AlignmentToolbar from '../../alignment-toolbar';
-import BlockControls from '../../block-controls';
-import BlockAlignmentToolbar from '../../block-alignment-toolbar';
-import ColorPalette from '../../color-palette';
-import Editable from '../../editable';
-import InspectorControls from '../../inspector-controls';
-import RangeControl from '../../inspector-controls/range-control';
-import ToggleControl from '../../inspector-controls/toggle-control';
-import BlockDescription from '../../block-description';
-
-const { children, query } = source;
-
-registerBlockType( 'core/cover-text', {
- title: __( 'Cover Text' ),
-
- icon: 'admin-customizer',
-
- category: 'formatting',
-
- keywords: [ __( 'colors' ) ],
-
- attributes: {
- align: {
- type: 'string',
- },
- width: {
- type: 'string',
- },
- content: {
- type: 'array',
- source: query( 'p', children() ),
- },
- dropCap: {
- type: 'boolean',
- default: false,
- },
- placeholder: {
- type: 'string',
- },
- textColor: {
- type: 'string',
- },
- backgroundColor: {
- type: 'string',
- },
- fontSize: {
- type: 'number',
- },
- },
-
- getEditWrapperProps( attributes ) {
- const { width } = attributes;
- if ( 'wide' === width || 'full' === width ) {
- return { 'data-align': width };
- }
- },
-
- merge( attributes, attributesToMerge ) {
- return {
- content: concatChildren( attributes.content, attributesToMerge.content ),
- };
- },
-
- edit( { attributes, setAttributes, className, focus, setFocus, mergeBlocks } ) {
- const {
- align,
- width,
- content,
- dropCap,
- placeholder,
- textColor,
- backgroundColor,
- fontSize,
- } = attributes;
-
- const toggleDropCap = () => setAttributes( { dropCap: ! dropCap } );
-
- return [
- focus && (
-
- setAttributes( { width: nextWidth } ) }
- controls={ [ 'center', 'wide', 'full' ] }
- />
- setAttributes( { align: nextAlign } ) }
- />
-
- ),
- focus && (
-
-
- { __( 'Text. Great things start here.' ) }
-
- { __( 'Text Settings' ) }
-
- setAttributes( { fontSize: value } ) }
- min={ 10 }
- max={ 200 }
- beforeIcon="editor-textcolor"
- />
- { __( 'Background Color' ) }
- setAttributes( { backgroundColor: colorValue.hex } ) }
- withTransparentOption
- />
- { __( 'Text Color' ) }
- setAttributes( { textColor: colorValue.hex } ) }
- />
-
- ),
-
- {
- setAttributes( {
- content: nextContent,
- } );
- } }
- focus={ focus }
- onFocus={ setFocus }
- onMerge={ mergeBlocks }
- style={ { textAlign: align } }
- className={ dropCap ? 'has-drop-cap' : null }
- placeholder={ placeholder || __( 'New Paragraph' ) }
- />
-
,
- ];
- },
-
- save( { attributes } ) {
- const { width, align, content, dropCap, backgroundColor, textColor, fontSize } = attributes;
- const className = dropCap ? 'has-drop-cap' : null;
- const wrapperClassName = classnames( className, {
- [ `align${ width }` ]: width,
- 'has-background': backgroundColor,
- } );
- const styles = {
- backgroundColor: backgroundColor,
- color: textColor,
- fontSize: fontSize,
- };
-
- if ( ! align ) {
- return (
-
- );
- }
-
- return (
-
- );
- },
-} );
diff --git a/blocks/library/cover-text/style.scss b/blocks/library/cover-text/style.scss
deleted file mode 100644
index 1ca35052b4037..0000000000000
--- a/blocks/library/cover-text/style.scss
+++ /dev/null
@@ -1,12 +0,0 @@
-.wp-block-cover-text {
-
- &.has-background {
- padding: 20px 30px;
- }
-
- p {
- font-size: inherit !important;
- max-width: $visual-editor-max-width - ( $block-mover-padding-visible );
- margin: 0 auto;
- }
-}
diff --git a/blocks/library/index.js b/blocks/library/index.js
index ead7508fcef47..8ae8ce98543f2 100644
--- a/blocks/library/index.js
+++ b/blocks/library/index.js
@@ -17,7 +17,6 @@ import './freeform';
import './latest-posts';
import './categories';
import './cover-image';
-import './cover-text';
import './shortcode';
import './text-columns';
import './verse';
diff --git a/blocks/library/list/index.js b/blocks/library/list/index.js
index bbdb512680ed1..76475ba440f11 100644
--- a/blocks/library/list/index.js
+++ b/blocks/library/list/index.js
@@ -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 ) => {
diff --git a/blocks/library/paragraph/index.js b/blocks/library/paragraph/index.js
index 1061d81e7f425..e99f553d37f31 100644
--- a/blocks/library/paragraph/index.js
+++ b/blocks/library/paragraph/index.js
@@ -3,6 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import { concatChildren } from '@wordpress/element';
+import classnames from 'classnames';
/**
* Internal dependencies
@@ -10,10 +11,13 @@ import { concatChildren } from '@wordpress/element';
import './style.scss';
import { registerBlockType, createBlock, source, setDefaultBlock } from '../../api';
import AlignmentToolbar from '../../alignment-toolbar';
+import BlockAlignmentToolbar from '../../block-alignment-toolbar';
import BlockControls from '../../block-controls';
import Editable from '../../editable';
import InspectorControls from '../../inspector-controls';
import ToggleControl from '../../inspector-controls/toggle-control';
+import RangeControl from '../../inspector-controls/range-control';
+import ColorPalette from '../../color-palette';
import BlockDescription from '../../block-description';
const { children } = source;
@@ -44,6 +48,18 @@ registerBlockType( 'core/paragraph', {
placeholder: {
type: 'string',
},
+ width: {
+ type: 'string',
+ },
+ textColor: {
+ type: 'string',
+ },
+ backgroundColor: {
+ type: 'string',
+ },
+ fontSize: {
+ type: 'number',
+ },
},
transforms: {
@@ -65,12 +81,26 @@ registerBlockType( 'core/paragraph', {
};
},
+ getEditWrapperProps( attributes ) {
+ const { width } = attributes;
+ if ( 'wide' === width || 'full' === width ) {
+ return { 'data-align': width };
+ }
+ },
+
edit( { attributes, setAttributes, insertBlocksAfter, focus, setFocus, mergeBlocks, onReplace } ) {
- const { align, content, dropCap, placeholder } = attributes;
+ const { align, content, dropCap, placeholder, fontSize, backgroundColor, textColor, width } = attributes;
const toggleDropCap = () => setAttributes( { dropCap: ! dropCap } );
+ const className = dropCap ? 'has-drop-cap' : null;
+
return [
focus && (
+ setAttributes( { width: nextWidth } ) }
+ controls={ [ 'wide', 'full' ] }
+ />
{
@@ -90,10 +120,40 @@ registerBlockType( 'core/paragraph', {
checked={ !! dropCap }
onChange={ toggleDropCap }
/>
+ setAttributes( { fontSize: value } ) }
+ min={ 10 }
+ max={ 200 }
+ beforeIcon="editor-textcolor"
+ allowReset
+ />
+ { __( 'Background Color' ) }
+ setAttributes( { backgroundColor: colorValue.hex } ) }
+ withTransparentOption
+ />
+ { __( 'Text Color' ) }
+ setAttributes( { textColor: colorValue.hex } ) }
+ />
),
{
@@ -112,22 +172,26 @@ registerBlockType( 'core/paragraph', {
} }
onMerge={ mergeBlocks }
onReplace={ onReplace }
- style={ { textAlign: align } }
- className={ dropCap ? 'has-drop-cap' : null }
placeholder={ placeholder || __( 'New Paragraph' ) }
/>,
];
},
save( { attributes } ) {
- const { align, content, dropCap } = attributes;
- const className = dropCap ? 'has-drop-cap' : null;
-
- if ( ! align ) {
- return { content }
;
- }
+ const { width, align, content, dropCap, backgroundColor, textColor, fontSize } = attributes;
+ const className = classnames( {
+ [ `align${ width }` ]: width,
+ 'has-background': backgroundColor,
+ 'has-drop-cap': dropCap,
+ } );
+ const styles = {
+ backgroundColor: backgroundColor,
+ color: textColor,
+ fontSize: fontSize,
+ textAlign: align,
+ };
- return { content }
;
+ return { content }
;
},
} );
diff --git a/blocks/library/paragraph/style.scss b/blocks/library/paragraph/style.scss
index 1cc6bd7b2ff4d..ba590421b23b9 100644
--- a/blocks/library/paragraph/style.scss
+++ b/blocks/library/paragraph/style.scss
@@ -14,3 +14,7 @@ p.has-drop-cap {
p.has-drop-cap:not( :focus ) {
overflow: hidden;
}
+
+p.has-background {
+ padding: 20px 30px;
+}
diff --git a/blocks/library/preformatted/index.js b/blocks/library/preformatted/index.js
index a0c8dc0d36ada..7151ba8412986 100644
--- a/blocks/library/preformatted/index.js
+++ b/blocks/library/preformatted/index.js
@@ -70,7 +70,7 @@ registerBlockType( 'core/preformatted', {
focus={ focus }
onFocus={ setFocus }
placeholder={ __( 'Write preformatted text…' ) }
- className={ className }
+ wrapperClassname={ className }
/>
);
},
diff --git a/blocks/library/pullquote/index.js b/blocks/library/pullquote/index.js
index a4223575338e2..46795be9f2f64 100644
--- a/blocks/library/pullquote/index.js
+++ b/blocks/library/pullquote/index.js
@@ -70,7 +70,7 @@ registerBlockType( 'core/pullquote', {
placeholder={ __( 'Write quote…' ) }
focus={ focus && focus.editable === 'value' ? focus : null }
onFocus={ ( props ) => setFocus( { ...props, editable: 'value' } ) }
- className="blocks-pullquote__content"
+ wrapperClassname="blocks-pullquote__content"
/>
{ ( citation || !! focus ) && (
( {
...settings,
plugins: ( settings.plugins || [] ).concat( 'table' ),
diff --git a/blocks/library/verse/index.js b/blocks/library/verse/index.js
index 37ccce66f3013..65a4f9d40fd15 100644
--- a/blocks/library/verse/index.js
+++ b/blocks/library/verse/index.js
@@ -72,7 +72,7 @@ registerBlockType( 'core/verse', {
focus={ focus }
onFocus={ setFocus }
placeholder={ __( 'Write…' ) }
- className={ className }
+ wrapperClassname={ className }
formattingControls={ [ 'bold', 'italic', 'strikethrough' ] }
/>,
];
diff --git a/blocks/test/fixtures/core__cover-text.html b/blocks/test/fixtures/core__cover-text.html
deleted file mode 100644
index f5597afcebeb2..0000000000000
--- a/blocks/test/fixtures/core__cover-text.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/blocks/test/fixtures/core__cover-text.json b/blocks/test/fixtures/core__cover-text.json
deleted file mode 100644
index 37f86cd34441d..0000000000000
--- a/blocks/test/fixtures/core__cover-text.json
+++ /dev/null
@@ -1,17 +0,0 @@
-[
- {
- "uid": "_uid_0",
- "name": "core/cover-text",
- "isValid": false,
- "attributes": {
- "content": [
- [
- "Text with color."
- ]
- ],
- "dropCap": false,
- "backgroundColor": "#fcb900"
- },
- "originalContent": ""
- }
-]
diff --git a/blocks/test/fixtures/core__cover-text.parsed.json b/blocks/test/fixtures/core__cover-text.parsed.json
deleted file mode 100644
index 1ec53cb343478..0000000000000
--- a/blocks/test/fixtures/core__cover-text.parsed.json
+++ /dev/null
@@ -1,13 +0,0 @@
-[
- {
- "blockName": "core/cover-text",
- "attrs": {
- "backgroundColor": "#fcb900"
- },
- "rawContent": "\n\n"
- },
- {
- "attrs": {},
- "rawContent": "\n"
- }
-]
diff --git a/blocks/test/fixtures/core__cover-text.serialized.html b/blocks/test/fixtures/core__cover-text.serialized.html
deleted file mode 100644
index bfacf834d8fe8..0000000000000
--- a/blocks/test/fixtures/core__cover-text.serialized.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-