@wordpress/block-library
Version:
Block library for the WordPress editor.
44 lines (43 loc) • 1.53 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/post-navigation-link/variations.js
const variations = [{
name: "post-previous",
title: (0, _wordpress_i18n.__)("Previous Post"),
description: (0, _wordpress_i18n.__)("Displays the post link that precedes the current post."),
icon: _wordpress_icons.previous,
attributes: { type: "previous" },
scope: ["inserter", "transform"],
example: { attributes: {
label: (0, _wordpress_i18n.__)("Previous post"),
arrow: "arrow"
} }
}, {
isDefault: true,
name: "post-next",
title: (0, _wordpress_i18n.__)("Next Post"),
description: (0, _wordpress_i18n.__)("Displays the post link that follows the current post."),
icon: _wordpress_icons.next,
attributes: { type: "next" },
scope: ["inserter", "transform"],
example: { attributes: {
label: (0, _wordpress_i18n.__)("Next post"),
arrow: "arrow"
} }
}];
/**
* Add `isActive` function to all `post-navigation-link` 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