@wordpress/block-library
Version:
Block library for the WordPress editor.
70 lines (67 loc) • 1.34 kB
JavaScript
import { createElement } from "@wordpress/element";
/**
* WordPress dependencies
*/
import { RichText } from '@wordpress/block-editor';
export default [{
attributes: {
src: {
type: 'string',
source: 'attribute',
selector: 'audio',
attribute: 'src'
},
caption: {
type: 'string',
source: 'html',
selector: 'figcaption'
},
id: {
type: 'number'
},
autoplay: {
type: 'boolean',
source: 'attribute',
selector: 'audio',
attribute: 'autoplay'
},
loop: {
type: 'boolean',
source: 'attribute',
selector: 'audio',
attribute: 'loop'
},
preload: {
type: 'string',
source: 'attribute',
selector: 'audio',
attribute: 'preload'
}
},
supports: {
align: true
},
save(_ref) {
let {
attributes
} = _ref;
const {
autoplay,
caption,
loop,
preload,
src
} = attributes;
return createElement("figure", null, createElement("audio", {
controls: "controls",
src: src,
autoPlay: autoplay,
loop: loop,
preload: preload
}), !RichText.isEmpty(caption) && createElement(RichText.Content, {
tagName: "figcaption",
value: caption
}));
}
}];
//# sourceMappingURL=deprecated.js.map