UNPKG

@wordpress/block-editor

Version:
47 lines (38 loc) 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = useDisplayBlockControls; var _data = require("@wordpress/data"); var _context = require("../block-edit/context"); var _store = require("../../store"); /** * WordPress dependencies */ /** * Internal dependencies */ function useDisplayBlockControls() { const { isSelected, clientId, name } = (0, _context.useBlockEditContext)(); const isFirstAndSameTypeMultiSelected = (0, _data.useSelect)(select => { // Don't bother checking, see OR statement below. if (isSelected) { return; } const { getBlockName, isFirstMultiSelectedBlock, getMultiSelectedBlockClientIds } = select(_store.store); if (!isFirstMultiSelectedBlock(clientId)) { return false; } return getMultiSelectedBlockClientIds().every(id => getBlockName(id) === name); }, [clientId, isSelected, name]); return isSelected || isFirstAndSameTypeMultiSelected; } //# sourceMappingURL=index.js.map