diff --git a/core-blocks/audio/edit.js b/core-blocks/audio/edit.js index 9bbc8cf67e08df..e418a878a16bb5 100644 --- a/core-blocks/audio/edit.js +++ b/core-blocks/audio/edit.js @@ -5,6 +5,7 @@ import { __ } from '@wordpress/i18n'; import { IconButton, PanelBody, + SelectControl, Toolbar, ToggleControl, withNotices, @@ -41,7 +42,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,7 +103,7 @@ class AudioEdit extends Component { - + + setAttributes( { preload: ( 'none' !== value ) ? value : undefined } ) } + options={ [ + { value: 'auto', label: __( 'Auto' ) }, + { value: 'metadata', label: __( 'Metadata' ) }, + { value: 'none', label: __( 'None' ) }, + ] } + />
diff --git a/core-blocks/audio/index.js b/core-blocks/audio/index.js index b3983c300ca288..ca4582727da17f 100644 --- a/core-blocks/audio/index.js +++ b/core-blocks/audio/index.js @@ -48,6 +48,12 @@ export const settings = { selector: 'audio', attribute: 'loop', }, + preload: { + type: 'string', + source: 'attribute', + selector: 'audio', + attribute: 'preload', + }, }, supports: { @@ -57,10 +63,10 @@ export const settings = { edit, save( { attributes } ) { - const { autoplay, caption, loop, src } = attributes; + const { autoplay, caption, loop, preload, src } = attributes; return (
-
);