import { default as React } from 'react'; import { CellRendererProps } from '../index.js'; /** * Renders `markdown` values as formatted GFM markdown (lazy-loaded, sanitized) * instead of the raw markup string. * * Markdown ONLY. `MarkdownContent` runs react-markdown with no `rehype-raw`, so * raw HTML in the string is not parsed and never reaches the DOM — that is this * renderer's trust boundary, not an oversight, and it must stay that way * (objectui#5452). `richtext` used to be routed here too and rendered as a * COMPLETELY EMPTY cell, because a richtext value is entirely HTML and this * pipeline drops all of it; see {@link HtmlCellRenderer}, which is where that * type belongs. Loosening this pipeline to pass raw HTML through would have * "fixed" one type by moving every `markdown` cell's trust boundary. */ export declare function MarkdownCellRenderer({ value }: CellRendererProps): React.ReactElement; /** * Renders an `html` value as sanitized, formatted HTML instead of raw markup. * * Also the renderer for `richtext` (objectui#5452). Both types store an HTML * string: the spec's `Field.richtext` is documented as "Formatted content with * HTML/WYSIWYG", the showcase seed's own specimen is * `

Rich text

`, and this repo's designer bridge already * maps `richtext` onto its `html` type. {@link sanitizeHtml} above removes * script/style/iframe/object/embed blocks, inline event handlers and * `javascript:` URLs, and touches nothing a rich-text editor legitimately * emits — headings, paragraphs, emphasis, lists, links, quotes all survive, so * routing `richtext` here restores the content rather than trading a blank cell * for a mangled one. */ export declare function HtmlCellRenderer({ value }: CellRendererProps): React.ReactElement; /** * Field type → display pipeline, for the three types `RichTextField` serves. * * THE table, singular. `getCellRenderer`'s standard map spreads it (so the * grid, kanban, gallery, related list, dashboard panel and detail read mode * resolve through these entries) and `RichTextField`'s readonly branch indexes * it (so a readonly form field renders through the very same component). A * change here moves every read surface at once; there is no second copy left * to forget. * * `richtext` reads through the HTML renderer — NOT the markdown one, which * drops raw HTML and therefore rendered every populated richtext value as a * blank cell (objectui#5452). */ export declare const RICH_TEXT_CELL_RENDERERS: { readonly markdown: typeof MarkdownCellRenderer; readonly html: typeof HtmlCellRenderer; readonly richtext: typeof HtmlCellRenderer; }; /** The rich-content field types, i.e. the keys of {@link RICH_TEXT_CELL_RENDERERS}. */ export type RichTextFieldType = keyof typeof RICH_TEXT_CELL_RENDERERS; /** * The SYNTAX a rich-content type stores, derived from the renderer that type * resolves to rather than declared a second time. * * This is what `RichTextField`'s editor header names ("Format: markdown"), and * deriving it from {@link RICH_TEXT_CELL_RENDERERS} is the point: the header * used to be computed as `field.format || 'markdown'`, and since `format` is * declared on no rich-content field type (only on `date`/`datetime`/`time`/ * `phone`/`auto_number`), it read `undefined` for every real field and labelled * an `html` field "Format: markdown" — a label pointing at a pipeline the value * does not go through. Derived, the label cannot disagree with the renderer. * * `undefined` for a type with no pipeline, rather than a guessed default: the * caller has to say what it does with "not a rich-content type" instead of * silently getting the markdown answer, which is the bug this replaces. */ export declare function richTextSyntax(fieldType: string): 'markdown' | 'html' | undefined; /** * The display pipeline a field type reads through, or `undefined` when the * type is not one of the three rich-content types. * * The lookup is a function rather than a raw index so the "not a rich-content * type" answer is in the RETURN TYPE. Indexing {@link RICH_TEXT_CELL_RENDERERS} * directly hands back a non-optional component for any key the caller casts, * so the miss becomes a runtime `undefined` the compiler has been told cannot * happen — and a caller that checks for it reads as dead code. */ export declare function richTextCellRenderer(fieldType: string): React.FC | undefined;