runtime/AstroComponentProxy
Esta página aún no está disponible en tu idioma.
Functions
Section titled “Functions”createComponentProxy()
Section titled “createComponentProxy()”function createComponentProxy(result: SSRResult, _components: Record<string, any>): Record<string, any>
Defined in: studiocms/packages/studiocms/src/runtime/AstroComponentProxy.ts:19
Creates a proxy for components that can either be strings or functions. If the component is a string, it is directly assigned to the proxy. If the component is a function, it is wrapped in an async function that processes the props and children before rendering.
Parameters
Section titled “Parameters”result
Section titled “result”SSRResult
The result object used for rendering JSX.
_components
Section titled “_components”Record
<string
, any
> = {}
An optional record of components to be proxied. Defaults to an empty object.
Returns
Section titled “Returns”Record
<string
, any
>
A record of proxied components.
dedent()
Section titled “dedent()”function dedent(str: string): string
Defined in: studiocms/packages/studiocms/src/runtime/AstroComponentProxy.ts:67
Removes leading indentation from a multi-line string.
Parameters
Section titled “Parameters”string
The string from which to remove leading indentation.
Returns
Section titled “Returns”string
The dedented string.
transformHTML()
Section titled “transformHTML()”function transformHTML( html: string, components: Record<string, any>,sanitizeOpts?: SanitizeOptions): Promise<string>
Defined in: studiocms/packages/studiocms/src/runtime/AstroComponentProxy.ts:87
Transforms the provided HTML string by applying sanitization and component swapping.
Parameters
Section titled “Parameters”string
The HTML string to be transformed.
components
Section titled “components”Record
<string
, any
>
A record of components to be swapped within the HTML. The keys are component names and the values are the corresponding component implementations.
sanitizeOpts?
Section titled “sanitizeOpts?”SanitizeOptions
Optional sanitization options to be applied to the HTML.
Returns
Section titled “Returns”Promise
<string
>
A promise that resolves to the transformed HTML string.