@wordpress/block-library
Version:
Block library for the WordPress editor.
19 lines • 924 B
TypeScript
/**
* Resolves a link against a base URL, the way a browser resolves an `href`.
*
* @param url The link, as stored in a block's attributes.
* @param baseUrl The URL that relative links and hash links resolve against.
* @return The absolute URL, or `undefined` when the link can't be resolved,
* such as a relative link with no base URL.
*/
export declare function getResolvedUrl(url?: string, baseUrl?: string): string | undefined;
/**
* Resolves a link against the site's home URL. A page-relative link, such as
* `#faq` or `./about`, depends on the page it's rendered on, which a block
* doesn't know, so the home page stands in for it.
*
* @param url The link, as stored in a block's attributes.
* @return The absolute URL, or `undefined` when the link can't be resolved.
*/
export declare function useResolvedUrl(url?: string): string | undefined;
//# sourceMappingURL=use-resolved-url.d.ts.map