Completed
Push — master ( 3b8b0c...578b04 )
by Michael
02:39
created

script/plugins/Menu/MenuItems/BulletListMenuItemDispatcher.js   A

Complexity

Total Complexity 4
Complexity/F 2

Size

Lines of Code 21
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
eloc 14
c 0
b 0
f 0
nc 1
dl 0
loc 21
rs 10
wmc 4
mnd 1
bc 3
fnc 2
bpm 1.5
cpm 2
noi 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A BulletListMenuItemDispatcher.js ➔ isAvailable 0 3 1
A BulletListMenuItemDispatcher.js ➔ getMenuItem 0 10 2
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 BulletListMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.bullet_list;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            throw new Error('Bullet list not available in schema!');
14
        }
15
        return new MenuItem({
16
            icon: svgIcon('format-list-bulleted'),
17
            command: wrapInList(schema.nodes.bullet_list, {}),
18
            label: 'Wrap in bullet list',
19
        });
20
    }
21
}
22