From 8e69c8eb0ead118fccff354d5e9a30a494fa53cd Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Wed, 27 Jun 2018 12:59:49 -0700 Subject: [PATCH 1/5] Support 'preload' attribute for Audio Block --- core-blocks/audio/edit.js | 40 +++++++++++++++++++++++++++++++++++++- core-blocks/audio/index.js | 10 ++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/core-blocks/audio/edit.js b/core-blocks/audio/edit.js index 9bbc8cf67e08df..7217e0e7578a34 100644 --- a/core-blocks/audio/edit.js +++ b/core-blocks/audio/edit.js @@ -1,8 +1,15 @@ +/** + * External dependencies + */ +import { map } from 'lodash'; + /** * WordPress dependencies */ import { __ } from '@wordpress/i18n'; import { + Button, + ButtonGroup, IconButton, PanelBody, Toolbar, @@ -41,7 +48,7 @@ class AudioEdit extends Component { } render() { - const { autoplay, caption, loop, src } = this.props.attributes; + const { autoplay, caption, loop, preload, src } = this.props.attributes; const { setAttributes, isSelected, className, noticeOperations, noticeUI } = this.props; const { editing } = this.state; const switchToEditing = () => { @@ -102,6 +109,37 @@ class AudioEdit extends Component { + + + { map( [ + { + name: __( 'Auto' ), + key: 'auto', + attributeValue: 'auto', + }, + { + name: __( 'Metadata' ), + key: 'metadata', + attributeValue: 'metadata', + }, + { + name: __( 'None' ), + key: 'none', + attributeValue: undefined, + }, + ], ( { name, key, attributeValue } ) => ( + + ) ) } + + -