UNPKG

@gechiui/block-editor

Version:
43 lines (34 loc) 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useBlockDefaultClassName = useBlockDefaultClassName; var _data = require("@gechiui/data"); var _blocks = require("@gechiui/blocks"); var _store = require("../../../store"); /** * GeChiUI dependencies */ /** * Internal dependencies */ /** * Returns the default class name if the block is a light block and it supports * `className`. * * @param {string} clientId The block client ID. * * @return {string} The class name, e.g. `gc-block-paragraph`. */ function useBlockDefaultClassName(clientId) { return (0, _data.useSelect)(select => { const name = select(_store.store).getBlockName(clientId); const blockType = (0, _blocks.getBlockType)(name); const hasLightBlockWrapper = (blockType === null || blockType === void 0 ? void 0 : blockType.apiVersion) > 1; if (!hasLightBlockWrapper) { return; } return (0, _blocks.getBlockDefaultClassName)(name); }, [clientId]); } //# sourceMappingURL=use-block-default-class-name.js.map