Total Complexity | 3 |
Complexity/F | 1.5 |
Lines of Code | 21 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher'; |
||
2 | import { svgIcon } from '../MDI'; |
||
3 | import { setBlockTypeNoAttrCheck } from '../../../customCommands'; |
||
4 | import MenuItem from '../MenuItem'; |
||
5 | |||
6 | export default class CodeMenuItemDispatcher extends AbstractMenuItemDispatcher { |
||
7 | static isAvailable(schema) { |
||
8 | return !!schema.nodes.code_block; |
||
9 | } |
||
10 | |||
11 | static getMenuItem(schema) { |
||
12 | if (!this.isAvailable(schema)) { |
||
13 | throw new Error('Code blocks not available in this Schmea!'); |
||
14 | } |
||
15 | return new MenuItem({ |
||
16 | command: setBlockTypeNoAttrCheck(schema.nodes.code_block), |
||
17 | icon: svgIcon('code-braces'), |
||
18 | label: LANG.plugins.prosemirror['label:code'], |
||
|
|||
19 | }); |
||
20 | } |
||
21 | } |
||
22 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.