import React from 'react'; import { type IToolbarExtensionKey } from './internal/Toolbar'; /** Props received by the injected HTML Source view (see the `./html` subpath export). */ export interface IWuHtmlSourceProps { /** Initial raw HTML to populate the source view. */ defaultValue?: string; /** Fires on every keystroke with the current raw HTML. */ onUpdate?: (content: string) => void; /** When `true`, the textarea is disabled. */ readonly?: boolean; } /** A selectable entry in the mention suggestion list. */ export interface IWuMentionItem { /** Stable identifier, persisted as `data-id` on the rendered mention. */ id: string; /** Display text, rendered in the document after the trigger character. */ label: string; } /** Describes what the user has typed after the trigger character. */ export interface IWuMentionQuery { /** Text typed after the trigger, excluding the trigger itself. */ query: string; /** Aborted when a newer query supersedes this one. Pass it to `fetch` to cancel in flight. */ signal: AbortSignal; } /** Arguments passed to `renderItem` for one row of the suggestion list. */ export interface IWuMentionRenderItemArgs { /** The item being rendered. */ item: IWuMentionItem; /** The current query, for highlighting the matched part of the label. */ query: string; /** Whether this row is the active one. */ active: boolean; } /** Mention configuration. */ export interface IWuMentionConfig { /** * The items to offer. Pass an array and the editor filters it by label, ignoring case and * whitespace, so `@rossgeller` and `@Ross Gel` both reach `Ross Geller`. Pass a function to * resolve and match them yourself; it may return a promise. */ items: IWuMentionItem[] | ((query: IWuMentionQuery) => IWuMentionItem[] | Promise); /** Custom content for one row. Defaults to the item's label. */ renderItem?: (args: IWuMentionRenderItemArgs) => React.ReactNode; } /** Default formatting values applied when no explicit selection overrides them. */ export interface IWuEditorDefaults { /** Default text color (CSS color string, e.g. `'#545E6B'`). */ color?: string; /** Default background/highlight color (CSS color string). */ bgColor?: string; /** Default font size in px (e.g. `16`). */ fontSize?: number; /** Default font family name (must be one of the available fonts). */ fontFamily?: string; } export interface IWuContentEditorProps extends React.HTMLAttributes { /** Initial HTML content (auto-sanitized on mount). */ defaultValue?: string; /** Fires on every editor change with the sanitized HTML output. */ onUpdate?: (content: string) => void; /** Extra font-family names appended to the font-family picker. */ customFonts?: string[]; /** Sticky toolbar placement relative to the content area. @default 'top' */ toolbarPosition?: 'top' | 'bottom'; /** Additional React nodes appended inside the toolbar. */ customToolbarChildren?: React.ReactNode; /** Subset of toolbar items to render; defaults to all items except `textSlot`, which is opt-in. */ toolbarItems?: IToolbarExtensionKey[]; /** Hides the toolbar entirely. */ hideToolbar?: boolean; /** Disables editing; content is display-only. */ readonly?: boolean; /** Moves focus into the editor on mount. */ autoFocus?: boolean; /** Default formatting values (color, bgColor, fontSize, fontFamily). */ defaultValues?: IWuEditorDefaults; /** * HTML Source view component, e.g. `WuHtmlSource` from * `@npm-questionpro/wick-ui-editor/html`. When omitted, HTML Source Mode * and its toolbar button are disabled. */ htmlSource?: React.ComponentType; /** * Enables mention suggestions. Typing `@` opens the list; a committed mention * persists as ``. * When omitted, no suggestion list opens — mentions already present in * `defaultValue` still render. */ mention?: IWuMentionConfig; /** Controlled HTML Source Mode state. Only meaningful when `htmlSource` is provided. */ isHtml?: boolean; /** Setter for controlled `isHtml`. Only meaningful when `htmlSource` is provided. */ setIsHtml?: (isHtml: boolean) => void; } /** * Rich-text editing surface with a configurable toolbar, backed by TipTap. * * @summary content creation — reach for this when users need to compose or edit formatted HTML content */ export declare function WuContentEditor({ defaultValue, onUpdate, className, toolbarPosition, customToolbarChildren, toolbarItems, hideToolbar, readonly, autoFocus, customFonts, htmlSource: HtmlSourceView, isHtml: isHtmlProp, setIsHtml: setIsHtmlProp, defaultValues, mention, ...props }: IWuContentEditorProps): React.JSX.Element;