Migrating from v7 to v8
Rename Editor.onContentChange -> Editor.valueChanges
Before
const editor = new Editor();editor.onContentChange.subscribe(() => {});
After
const editor = new Editor();editor.valueChanges.subscribe(() => {});
Rename Editor.onUpdate -> Editor.update
Before
const editor = new Editor();editor.onUpdate.subscribe(() => {});
After
const editor = new Editor();editor.update.subscribe(() => {});
Make sure to call editor.destory manually during onDestory.
class AppComponent implements OnInit, OnDestroy { editor: Editor;
ngOnInit() { this.editor = new Editor(); }
ngOnDestroy() { this.editor.destroy(); }}
Image plugin is included by default.
Image plugin is included by default. No need to manually add it.
import { image } from 'ngx-editor';
new Editor({ plugins: [ image(), // remove ],});
Removed Editor.focus and Editor.blur events
const editor = new Editor();
editor.focus.subscribe(() => {}); // no longer exposededitor.blur.subscribe(() => {}); // no longer exposed
Alternatively you can use the props on the editor component for the same
<ngx-editor [editor]="editor" focusOut="onBlur()" focusIn="onFocus()"></ngx-editor>
Remvoed Editor.enable and Editor.disable methods
Before:
const editor = new Editor({});
editor.enable(); // enable edititngeditor.disable(); // disable editing
After:
Set the enabled prop to true
or false
to enable/disable the editor.
<ngx-editor [editor]="editor" enabled="true"></ngx-editor>
Miscellaneous
- Some CSS Bug fixes might affect existing components