@octopusdeploy/design-system-components
Version:
The design systems component library.
31 lines (30 loc) • 1.12 kB
TypeScript
import type { ReactElement } from "react";
import type { PopoverBasicHelpProps } from "../../Popover";
export type MarkdownEditorHandle = {
focus: () => void;
insertAtCursor: (val: string) => void;
};
interface MarkdownEditorProps {
value: string | undefined;
onChange: (newValue: string) => void;
autoFocus?: boolean;
placeholder?: string;
disabled?: boolean;
label: string;
description?: string;
error?: string;
hideMarkdownToggle?: boolean;
controlsInitiallyVisible?: boolean;
hasRequiredMarker?: boolean;
hasOptionalMarker?: boolean;
popover?: ReactElement<PopoverBasicHelpProps>;
onValidate?(value: string): boolean;
}
/**
* A textarea with a markdown formatting toolbar and a toggle to show/hide it.
* The toolbar is rendered inside the field's border, above the textarea input.
*
* @param ref - Receives a {@link MarkdownEditorHandle} for imperative focus and cursor insertion.
*/
export declare const MarkdownEditor: import("react").ForwardRefExoticComponent<MarkdownEditorProps & import("react").RefAttributes<MarkdownEditorHandle>>;
export {};