Repository navigation
Ckeditor component
msljivic edited this page May 15, 2023
·
6 revisions
Ckeditor component is a custom formly field type created for CKEditor 5.
In your Angular project install one of the CKEditor 5 predefined builds or create a custom one.
This tutorial assumes that you picked @ckeditor/ckeditor5-build-classic:
npm install --save @ckeditor/ckeditor5-build-classicAdd FormlyCkeditorModule to modules whose components will be using the ckeditor component in their templates and provide ENTRY_CKEDITOR_OPTIONS.
import { ENTRY_CKEDITOR_OPTIONS, FormlyCkeditorModule } from '@enigmatry/entry-form';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
@NgModule({
declarations: [
DemoComponent
],
imports: [
CommonModule,
FormlyCkeditorModule
],
providers: [
{
provide: ENTRY_CKEDITOR_OPTIONS,
useValue: {
build: ClassicEditor,
config: {
toolbar: ['bold', 'italic', 'bulletedList', 'numberedList', 'blockQuote', 'link']
}
}
}]
})
export class DemoModule { }import {FormlyCkeditorModule} from '@enigmatry/entry-form';const ENTRY_CKEDITOR_OPTIONS = new InjectionToken<EntryCkeditorOptions>('EntryCkeditorOptions');
interface EntryCkeditorOptions {
build: CKEditor5.EditorConstructor;
config?: CKEditor5.Config;
}EntryCkeditorOptions
| Name | Description |
|---|---|
| build: CKEditor5.EditorConstructor | CKEditor 5 predefined builds or create a custom one |
| config?: CKEditor5.Config | CKeditor 5 configuration |