@gechiui/block-editor
Version:
38 lines (29 loc) • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isClientIdSelected = exports.getBlockPositionDescription = void 0;
var _lodash = require("lodash");
var _i18n = require("@gechiui/i18n");
/**
* External dependencies
*/
/**
* GeChiUI dependencies
*/
const getBlockPositionDescription = (position, siblingCount, level) => (0, _i18n.sprintf)(
/* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */
(0, _i18n.__)('位于第%3$d层、第%1$d位的区块,区块总数为%2$d'), position, siblingCount, level);
/**
* Returns true if the client ID occurs within the block selection or multi-selection,
* or false otherwise.
*
* @param {string} clientId Block client ID.
* @param {string|string[]} selectedBlockClientIds Selected block client ID, or an array of multi-selected blocks client IDs.
*
* @return {boolean} Whether the block is in multi-selection set.
*/
exports.getBlockPositionDescription = getBlockPositionDescription;
const isClientIdSelected = (clientId, selectedBlockClientIds) => (0, _lodash.isArray)(selectedBlockClientIds) && selectedBlockClientIds.length ? selectedBlockClientIds.indexOf(clientId) !== -1 : selectedBlockClientIds === clientId;
exports.isClientIdSelected = isClientIdSelected;
//# sourceMappingURL=utils.js.map