@contentstack/utils
Version:
Contentstack utilities for Javascript
29 lines (28 loc) • 1.58 kB
TypeScript
import './extensions';
import { Option, RenderOption } from './options';
import { EntryEmbedable } from './Models/embedded-object';
/**
* Renders RTE (Rich Text Editor) content with embedded objects in-place.
* Mutates the entry/entries by replacing embedded item tags with HTML produced
* by the provided render options. Works with a single entry or an array of entries.
*
* @param option - Configuration for rendering.
* @param option.entry - Entry or array of entries containing RTE fields with embedded objects.
* @param option.renderOption - Optional render options (node/item handlers) to produce HTML for embedded content.
* @param option.paths - Optional key paths to specific RTE fields. If omitted, all RTE paths on the entry are rendered.
*/
export declare function render(option: {
entry: EntryEmbedable | EntryEmbedable[];
renderOption?: RenderOption;
paths?: string[];
}): void;
/**
* Renders a single RTE content string or array of strings by replacing embedded
* item tags with HTML. Uses the entry and renderOption from the given option to
* resolve embedded references and produce output.
*
* @param content - RTE content string or array of strings containing embedded item tags.
* @param option - Must include the entry (for resolving embedded items) and optionally renderOption.
* @returns The same shape as content: a string or array of strings with embedded tags replaced by rendered HTML.
*/
export declare function renderContent(content: (string | string[]), option: Option): (string | string[]);