RichTextField
Abstract
An abstract base class for integrating third-party rich text editors (such as TinyMCE, CKEditor, or Quill) as Bryntum form fields. This field renders a <div> as the input target which the editor library attaches to. Subclass this class and implement the onPaint method to initialize your chosen editor. The field's value is managed via the inherited value config and can be used as a cell editor in a Grid.
export default class TinyMceField extends RichTextField {
static $name = 'TinyMceField';
static type = 'tinymcefield';
onPaint() {
globalThis.tinymce.init({
target : this.input,
inline : true,
setup : editor => editor.on('NodeChange',
() => this.richText = editor.getContent())
}).then(() => this.input.focus());
}
owns(target) {
return super.owns(target) || target?.closest('.tox-tinymce');
}
}
TinyMceField.initClass();
Useful configs and properties
| Config | Description |
|---|---|
| value | Current HTML content of the rich text editor |
| label | Field label displayed beside the field |
See also
- TextAreaField - Plain multiline text field
- Field - Base field class
No results
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of RichTextField class, or subclass thereof.
-
Use this property to update this field“s value silently while the rich text contents of this field is being edited. Otherwise, it would reset caret position and completely overwrite the context.
-
Identifies an object as an instance of RichTextField class, or subclass thereof.
type: richtextfield