@domternal/angular
Angular components for the Domternal rich text editor.
The standalone editor integrates with reactive forms and ngModel through
ControlValueAccessor. Toolbar, selection menu, insert menu, and picker components
use signals and OnPush change detection.
Install
In an Angular application:
pnpm add @domternal/angular @domternal/core @domternal/theme
The current build is compiled with Angular 21.2.20. We recommend matching
@angular/core, @angular/forms, and @angular/platform-browser packages at that
version or later. Applications should use the same or a newer compiler, as described
in Angular library compatibility.
The manifest still declares a broader >=17.1.0 peer range; this is not a guarantee
of compatibility with older Angular releases.
Requires @domternal/core >=1.8.0 <2.0.0. Use version 1.8.1 for all installed
Domternal Free packages. The package declares Node.js 22 or later for tooling; also follow
your Angular version's Node.js requirements.
Load the theme in your global stylesheet, such as styles.scss:
@use '@domternal/theme/scss';
Quick start
This standalone component binds the document to a form control and adds a toolbar:
import { Component, signal } from '@angular/core';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
import {
DomternalEditorComponent,
DomternalToolbarComponent,
} from '@domternal/angular';
import { StarterKit, type Editor } from '@domternal/core';
@Component({
selector: 'app-text-editor',
standalone: true,
imports: [ReactiveFormsModule, DomternalEditorComponent, DomternalToolbarComponent],
template: `
@if (editor(); as ed) {
<domternal-toolbar [editor]="ed" />
}
<domternal-editor
[extensions]="extensions"
[formControl]="content"
(editorCreated)="editor.set($event)"
/>
`,
})
export class TextEditorComponent {
readonly editor = signal<Editor | null>(null);
readonly extensions = [StarterKit];
readonly content = new FormControl('<p>Hello from Angular!</p>', { nonNullable: true });
}
The editor owns its lifecycle; editorCreated provides the instance for commands
and sibling UI components. The toolbar renders the controls your extensions
contribute. Subscribe to the form control's valueChanges to save content.
Forms and configuration
- Form values are HTML by default. Use
outputFormat="json"with a JSON content value for structured documents. Callingdisable()orenable()on the form control updates editability, and a control created disabled starts the editor read-only. Theeditableinput and the control decide in the order they change. - Without a form, pass HTML or JSON through
[content], handle(contentUpdated), and readevent.editor.getHTML()orgetJSON(). The component also exposeshtmlContent,jsonContent,isEmpty,isFocused, andisEditablesignals. - The wrapper includes
Document,Paragraph,Text,BaseKeymap, andHistory. For another undo manager, set[history]="false"and omit History from your extensions, including StarterKit's history. preset="notion"is read at creation. Thei18ninput updates UI translations when replaced, without recreating the editor or changing its form value.(contentError)reports invalid initial content.(contentDiagnostic)reports normalized values; initial reports arrive beforeeditorCreated. See content diagnostics.- Custom
iconsinputs contain raw SVG. Supply trusted, developer-authored constants.
The Angular guide covers inputs, outputs, form behavior, and the toolbar, bubble menu, floating menu, emoji picker, and Notion color picker components.
Office paste and custom list labels
Register PasteCleanup in your editor's
extensions to normalize supported Word and Google Docs clipboard HTML. It is
not enabled by the wrapper. In 1.5.0, formattingForPaste lets your application
choose Preserve or Adapt for each paste without recreating the editor.
Add the corresponding formatting, Table and Image extensions for content you
want to retain. Use ListLabels for
supported custom markers, with the same schema on every collaborative writer.