From 3957907ad3f13c9e7127d9a96f040c8376179ca7 Mon Sep 17 00:00:00 2001 From: "Michael P. Pfeiffer" Date: Thu, 14 Mar 2019 16:14:12 -0500 Subject: [PATCH 01/13] Add image fill option to Media & Text block --- .../src/media-text/deprecated.js | 193 ++++++++++++++++++ packages/block-library/src/media-text/edit.js | 22 +- .../block-library/src/media-text/editor.scss | 5 + .../block-library/src/media-text/index.js | 69 ++----- .../src/media-text/media-container.js | 26 ++- .../block-library/src/media-text/style.scss | 11 + 6 files changed, 271 insertions(+), 55 deletions(-) create mode 100644 packages/block-library/src/media-text/deprecated.js diff --git a/packages/block-library/src/media-text/deprecated.js b/packages/block-library/src/media-text/deprecated.js new file mode 100644 index 0000000000000..ce5056af6dd72 --- /dev/null +++ b/packages/block-library/src/media-text/deprecated.js @@ -0,0 +1,193 @@ +/** + * External dependencies + */ +import classnames from 'classnames'; +import { noop } from 'lodash'; + +/** + * WordPress dependencies + */ +import { + InnerBlocks, + getColorClassName, +} from '@wordpress/block-editor'; + +/** + * Internal dependencies + */ +import { DEFAULT_MEDIA_WIDTH } from './index'; + +export default [ + { + attributes: { + align: { + type: 'string', + default: 'wide', + }, + backgroundColor: { + type: 'string', + }, + customBackgroundColor: { + type: 'string', + }, + mediaAlt: { + type: 'string', + source: 'attribute', + selector: 'figure img', + attribute: 'alt', + default: '', + }, + mediaPosition: { + type: 'string', + default: 'left', + }, + mediaId: { + type: 'number', + }, + mediaUrl: { + type: 'string', + source: 'attribute', + selector: 'figure video,figure img', + attribute: 'src', + }, + mediaType: { + type: 'string', + }, + mediaWidth: { + type: 'number', + default: 50, + }, + isStackedOnMobile: { + type: 'boolean', + default: false, + }, + }, + save( { attributes } ) { + const { + backgroundColor, + customBackgroundColor, + isStackedOnMobile, + mediaAlt, + mediaPosition, + mediaType, + mediaUrl, + mediaWidth, + mediaId, + } = attributes; + const mediaTypeRenders = { + image: () => {, + video: () =>