@wordpress/blocks
Version:
Block API for WordPress.
51 lines • 2.04 kB
TypeScript
import type { NodeFilterFunction } from './types';
export declare function getBlockContentSchemaFromTransforms(transforms: any[], context?: string): any;
/**
* Gets the block content schema, which is extracted and merged from all
* registered blocks with raw transforms.
*
* @param context Set to "paste" when in paste context, where the
* schema is more strict.
*
* @return A complete block content schema.
*/
export declare function getBlockContentSchema(context?: string): any;
/**
* Checks whether HTML can be considered plain text. That is, it does not contain
* any elements that are not line breaks, or it only contains a single non-semantic
* wrapper element (span) with no semantic child elements.
*
* @param HTML The HTML to check.
*
* @return Whether the HTML can be considered plain text.
*/
export declare function isPlain(HTML: string): boolean;
export type { NodeFilterFunction } from './types';
/**
* Given node filters, deeply filters and mutates a NodeList.
*
* @param nodeList The nodeList to filter.
* @param filters An array of functions that can mutate with the provided node.
* @param doc The document of the nodeList.
* @param schema The schema to use.
*/
export declare function deepFilterNodeList(nodeList: NodeList, filters: NodeFilterFunction[], doc: Document, schema?: Record<string, unknown>): void;
/**
* Given node filters, deeply filters HTML tags.
* Filters from the deepest nodes to the top.
*
* @param HTML The HTML to filter.
* @param filters An array of functions that can mutate with the provided node.
* @param schema The schema to use.
*
* @return The filtered HTML.
*/
export declare function deepFilterHTML(HTML: string, filters?: NodeFilterFunction[], schema?: Record<string, unknown>): string;
/**
* Gets a sibling within text-level context.
*
* @param node The subject node.
* @param which "next" or "previous".
*/
export declare function getSibling(node: Node, which: string): Node | undefined;
//# sourceMappingURL=utils.d.ts.map