Rich Text Editor
esa-rich-text-editor is a WYSIWYG field: a formatting toolbar above an editable content area, wired as a form control. The Angular source ships a dependency-free baseline (a contenteditable region driven by document.execCommand) and is explicitly designed to be upgraded to TinyMCE via @tinymce/tinymce-angular.
Overview
What it wraps
- Target library: TinyMCE (
tinymce+@tinymce/tinymce-angular). TheEsaEditorConfigfields are passed straight to TinyMCE'sinit. - Baseline: with no library installed, a
contenteditablediv plus a small toolbar (bold, italic, underline, bullet/numbered lists, link) provides a working editor. Swapping to TinyMCE keeps the same inputs and form-control contract. - Forms: implements Angular's
ControlValueAccessor, so the value is HTML and binds viangModel/ reactive forms. In the Astro hub this corresponds to a form-associated custom element.
API
Inputs
| Input | Type | Default | Purpose |
|---|---|---|---|
config | EsaEditorConfig | {} | Editor config, merged with ESA_EDITOR_DEFAULT_CONFIG. |
label | string | none | Label rendered above the editor. |
size | 'small' | 'medium' | 'large' | 'medium' | Controls min content height (120 / 200 / 300px). |
disabled | boolean | false | Dims and blocks interaction. |
required | boolean | false | Renders an asterisk on the label. |
EsaEditorConfig (TinyMCE init shape)
Key Type Default heightnumber300 menubarbooleanfalse pluginsstring[]['lists', 'link', 'paste', 'table', 'code'] toolbarstring'undo redo | formatselect | bold italic underline | bullist numlist | link table | code' placeholderstring'Start typing...' readonlybooleanunset
Anatomy & static mock
Site visit summary. Outfall flow within permitted range; sampling scheduled for next quarter.
- pH and turbidity nominal
- Signage replaced at the north gate
Empty / placeholder & sizes
Start typing… Read-only content. Tokens
- Shell:
--form-border-color → --color-border, --form-radius-medium → --radius-200; focus uses --form-border-color-focus → --color-primary + --form-focus-ring-width. - Toolbar:
--color-surface-sunken background, buttons --color-text-secondary hovering to --color-surface; dividers --color-border; gap --spacing-050. - Content:
--color-surface background, --color-text-primary text, padding --spacing-300; placeholder --color-text-muted. - Label / required:
--color-text-primary label, --color-danger asterisk. - Focus rings:
--focus-ring-width / --focus-ring-color on toolbar buttons.