Bridge Training
Rich Text

types

Exported TypeScript types for editor configuration and handles.

The types export provides TypeScript types for working with editor components.

import type {
  RichEditorConfig,
  RichEditorHandle,
  LocalizedEditorHandle,
  LocalizedEditorOptions,
  AvailableLocale,
  LocalePickerLabels,
  EditorMode,
} from '@workspace/rich-text/types';

Editor Types

RichEditorConfig

Configuration passed to RichEditor.Root and LocalizedEditor.Editor.

type RichEditorConfig = {
  mode?: EditorMode;  // 'default' | 'petit-bridge'
  lists?: boolean;    // default: true
};

RichEditorHandle

Imperative ref handle for RichEditor.Root.

type RichEditorHandle = {
  getValue(): RichText;
  setValue(value: RichText): void;
  hasContent(): boolean;
  focus(): void;
  setMode(mode: EditorMode): void;
};

EditorMode

type EditorMode = 'default' | 'petit-bridge';

Localized Editor Types

LocalizedEditorHandle

Imperative ref handle for LocalizedEditor.Root.

type LocalizedEditorHandle = {
  getValue(): LocalizedRichText;
  setValue(value: LocalizedRichText): void;
};

LocalizedEditorOptions

type LocalizedEditorOptions = {
  defaultLocale: string;
  availableLocales: AvailableLocale[];
  localePickerLabels?: Partial<LocalePickerLabels>;
};

AvailableLocale

type AvailableLocale = {
  code: string;   // e.g. 'en', 'fr'
  label: string;  // e.g. 'English', 'French'
};

LocalePickerLabels

Labels for the locale picker UI. All have English defaults.

type LocalePickerLabels = {
  active: string;            // "Active"
  add: string;               // "Add"
  searchPlaceholder: string; // "Search language..."
  noResults: string;         // "No language found."
};

On this page