@wordpress/block-library
Version:
Block library for the WordPress editor.
49 lines (48 loc) • 1.65 kB
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let _wordpress_i18n = require("@wordpress/i18n");
let _wordpress_icons = require("@wordpress/icons");
// packages/block-library/src/query-title/variations.js
const variations = [
{
isDefault: true,
name: "archive-title",
title: (0, _wordpress_i18n.__)("Archive Title"),
description: (0, _wordpress_i18n.__)("Display the archive title based on the queried object."),
icon: _wordpress_icons.title,
attributes: { type: "archive" },
scope: ["inserter"]
},
{
isDefault: false,
name: "search-title",
title: (0, _wordpress_i18n.__)("Search Results Title"),
description: (0, _wordpress_i18n.__)("Display the search results title based on the queried object."),
icon: _wordpress_icons.title,
attributes: { type: "search" },
scope: ["inserter"]
},
{
isDefault: false,
name: "post-type-label",
title: (0, _wordpress_i18n.__)("Post Type Label"),
description: (0, _wordpress_i18n.__)("Display the post type label based on the queried object."),
icon: _wordpress_icons.title,
attributes: { type: "post-type" },
scope: ["inserter"]
}
];
/**
* Add `isActive` function to all `query-title` variations, if not defined.
* `isActive` function is used to find a variation match from a created
* Block by providing its attributes.
*/
variations.forEach((variation) => {
if (variation.isActive) return;
variation.isActive = (blockAttributes, variationAttributes) => blockAttributes.type === variationAttributes.type;
});
exports.default = variations;
//# sourceMappingURL=variations.cjs.map