Total Complexity | 4 |
Complexity/F | 2 |
Lines of Code | 21 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { wrapInList } from 'prosemirror-schema-list'; |
||
2 | import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher'; |
||
3 | import MenuItem from '../MenuItem'; |
||
4 | import { svgIcon } from '../MDI'; |
||
5 | |||
6 | export default class OderedListMenuItemDispatcher extends AbstractMenuItemDispatcher { |
||
7 | static isAvailable(schema) { |
||
8 | return !!schema.nodes.ordered_list; |
||
9 | } |
||
10 | |||
11 | static getMenuItem(schema) { |
||
12 | if (!this.isAvailable(schema)) { |
||
13 | throw new Error('Ordered list not available in schema!'); |
||
14 | } |
||
15 | return new MenuItem({ |
||
16 | icon: svgIcon('format-list-numbers'), |
||
17 | command: wrapInList(schema.nodes.ordered_list, {}), |
||
18 | label: 'Wrap in ordered list', |
||
19 | }); |
||
20 | } |
||
21 | } |
||
22 |