diff --git a/index.html b/index.html index 7d1da536..95c965b7 100644 --- a/index.html +++ b/index.html @@ -99,7 +99,8 @@ inlineToolbar: true, shortcut: 'CMD+SHIFT+L', config: { - defaultStyle: 'checklist' + defaultStyle: 'checklist', + maxLevel: 4, } }, }, @@ -119,7 +120,6 @@ data: { style: 'ordered', start: 2, - maxLevel: 5, items: [ { content: "Canon", diff --git a/src/ListTabulator/index.ts b/src/ListTabulator/index.ts index bde034d9..53f0a192 100644 --- a/src/ListTabulator/index.ts +++ b/src/ListTabulator/index.ts @@ -959,13 +959,13 @@ export default class ListTabulator { /** * Check that maxLevel specified in config */ - if (this.data.maxLevel !== undefined) { + if (this.config?.maxLevel !== undefined) { const currentItemLevel = this.currentItemLevel; /** * Check that current item is not in the maximum nesting level */ - if (currentItemLevel !== null && currentItemLevel === this.data.maxLevel) { + if (currentItemLevel !== null && currentItemLevel === this.config.maxLevel) { return; } } diff --git a/src/types/ListParams.ts b/src/types/ListParams.ts index f7888f22..8461ca92 100644 --- a/src/types/ListParams.ts +++ b/src/types/ListParams.ts @@ -18,11 +18,6 @@ export interface ListData { * list of first-level elements */ items: ListItem[]; - /** - * Max level of the nesting in list - * If nesting is not needed, it could be set to 1 - */ - maxLevel?: number; /** * Start property used only in ordered list */ @@ -76,4 +71,9 @@ export interface NestedListConfig { * default is unordered */ defaultStyle?: ListDataStyle; + /** + * Max level of the nesting in list + * If nesting is not needed, it could be set to 1 + */ + maxLevel?: number; }