@wordpress/blocks
Version:
Block API for WordPress.
27 lines • 1.48 kB
TypeScript
import type { BlockAttribute, BlockType } from '../../types';
/**
* Given an HTML string and an attribute schema, returns the specified attribute
* value from the root element in the markup.
*
* @param innerHTML Markup string from which to extract the attribute.
* @param dataAttribute The data attribute name to use as wrapper.
* @param attributeSchema The attribute schema configuration.
*
* @return The attribute value assigned to the root element.
*/
export declare function getHTMLRootElement(innerHTML: string, dataAttribute: string, attributeSchema: BlockAttribute): unknown;
/**
* Given a parsed set of block attributes, if the block supports the specified attribute
* and the attribute is found in the HTML, the attribute is assigned to the block attributes.
*
* @param blockAttributes Original block attributes.
* @param blockType Block type settings.
* @param innerHTML Original block markup.
* @param supportKey The block support key to check and attribute key to set.
* @param dataAttribute The data attribute name to use as wrapper.
* @param attributeSchema The attribute schema configuration.
*
* @return Filtered block attributes.
*/
export declare function fixGlobalAttribute(blockAttributes: Record<string, unknown>, blockType: BlockType, innerHTML: string, supportKey: string, dataAttribute: string, attributeSchema: BlockAttribute): Record<string, unknown>;
//# sourceMappingURL=fix-global-attribute.d.ts.map