@wordpress/block-library
Version:
Block library for the WordPress editor.
51 lines (50 loc) • 1.4 kB
JavaScript
// packages/block-library/src/video/variations.js
import { __ } from "@wordpress/i18n";
import { video as videoIcon } from "@wordpress/icons";
var isGifVariation = ({
controls,
loop,
autoplay,
muted,
playsInline
} = {}) => !controls && !!loop && !!autoplay && !!muted && !!playsInline;
var variations = [
{
name: "video",
title: __("Video"),
description: __(
"A video with customizable playback and interaction controls."
),
icon: videoIcon,
attributes: { controls: true },
isActive: (blockAttributes) => !isGifVariation(blockAttributes),
// Not offered in the inserter; used to label a regular video and to
// switch a GIF back to a standard video.
scope: ["block", "transform"]
},
{
name: "gif",
title: __("GIF"),
description: __(
"A muted, looping video that plays automatically like an animated GIF."
),
icon: videoIcon,
keywords: [__("animated"), "gif"],
attributes: {
controls: false,
loop: true,
autoplay: true,
muted: true,
playsInline: true
},
isActive: (blockAttributes) => isGifVariation(blockAttributes),
// Created by converting an uploaded GIF, not inserted directly.
scope: ["block", "transform"]
}
];
var variations_default = variations;
export {
variations_default as default,
isGifVariation
};
//# sourceMappingURL=variations.mjs.map