diff --git a/src/lib/editor.component.html b/src/lib/editor.component.html
index 0ff42bd6..ec5d0f36 100644
--- a/src/lib/editor.component.html
+++ b/src/lib/editor.component.html
@@ -2,6 +2,7 @@
diff --git a/src/lib/editor.component.ts b/src/lib/editor.component.ts
index 339d1e2f..40ffcba3 100644
--- a/src/lib/editor.component.ts
+++ b/src/lib/editor.component.ts
@@ -51,7 +51,7 @@ export class NgxEditorComponent implements ControlValueAccessor, OnInit, OnDestr
}
get toolbar(): Toolbar {
- return this.config.menu.toolbar;
+ return this.config.menu?.toolbar;
}
writeValue(value: object | null): void {
diff --git a/src/lib/editor.service.ts b/src/lib/editor.service.ts
index 66bbd4d2..747a9630 100644
--- a/src/lib/editor.service.ts
+++ b/src/lib/editor.service.ts
@@ -102,18 +102,20 @@ export class NgxEditorService {
export const provideMyServiceOptions = (config?: NgxEditorConfig): NgxEditorServiceConfig => {
let menu: Menu;
- if (!config.menu) {
- menu = DEFAULT_MENU;
- } else if (Array.isArray(config.menu)) {
- menu = {
- ...DEFAULT_MENU,
- toolbar: config.menu,
- };
- } else {
- menu = {
- ...DEFAULT_MENU,
- ...config.menu,
- };
+ if (config.menu !== null) {
+ if (!config.menu) {
+ menu = DEFAULT_MENU;
+ } else if (Array.isArray(config.menu)) {
+ menu = {
+ ...DEFAULT_MENU,
+ toolbar: config.menu,
+ };
+ } else {
+ menu = {
+ ...DEFAULT_MENU,
+ ...config.menu,
+ };
+ }
}
return {
diff --git a/src/lib/types.ts b/src/lib/types.ts
index f2a0adb7..fc8bcdb5 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -40,6 +40,6 @@ export interface NgxEditorConfig {
schema?: Schema;
plugins?: Plugin[];
nodeViews?: NodeViews;
- menu?: Menu | Toolbar;
+ menu?: null | Menu | Toolbar;
locals?: Partial>;
}