Skip to content

Migrating from v5 to v6

Before

import { NgxEditorModule } from 'ngx-editor';
NgxEditorModule.forRoot({
menu: {
toolbar: [],
colorPresets: [],
},
});

After

Menu is a seperate component, has to be included manually if required.

Component

export class AppComponent implements OnInit, OnDestroy {
isProdMode = environment.production;
editor: Editor;
toolbar: Toolbar = [['bold', 'italic']];
colorPresets = ['red', 'blue', 'green'];
ngOnInit(): void {
this.editor = new Editor();
}
ngOnDestroy(): void {
this.editor.destroy();
}
}

HTML

<ngx-editor-menu
[editor]="editor"
[toolbar]="toolbar"
[colorPresets]="colorPresets"
>
</ngx-editor-menu>

CustomMenu

Before

<ngx-editor [customMenuRef]="customMenu"> </ngx-editor>

After

<ngx-editor-menu [customMenuRef]="customMenu"> </ngx-editor-menu>

ProseMirror Configuration

Before

import { NgxEditorModule } from 'ngx-editor';
NgxEditorModule.forRoot({
plugins: [],
schema: {},
nodeViews: {},
});

After

import { Editor } from 'ngx-editor';
new Editor({
plugins: [],
schema: {},
nodeViews: {},
});