@wordpress/block-library
Version:
Block library for the WordPress editor.
50 lines (49 loc) • 1.18 kB
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let _wordpress_blob = require("@wordpress/blob");
let _wordpress_blocks = require("@wordpress/blocks");
// packages/block-library/src/audio/transforms.js
const transforms = { from: [{
type: "files",
isMatch(files) {
return files.length === 1 && files[0].type.indexOf("audio/") === 0;
},
transform(files) {
const file = files[0];
return (0, _wordpress_blocks.createBlock)("core/audio", { blob: (0, _wordpress_blob.createBlobURL)(file) });
}
}, {
type: "shortcode",
tag: "audio",
attributes: {
src: {
type: "string",
shortcode: ({ named: { src, mp3, m4a, ogg, wav, wma } }) => {
return src || mp3 || m4a || ogg || wav || wma;
}
},
loop: {
type: "string",
shortcode: ({ named: { loop } }) => {
return loop;
}
},
autoplay: {
type: "string",
shortcode: ({ named: { autoplay } }) => {
return autoplay;
}
},
preload: {
type: "string",
shortcode: ({ named: { preload } }) => {
return preload;
}
}
}
}] };
exports.default = transforms;
//# sourceMappingURL=transforms.cjs.map