Code Duplication    Length = 22-22 lines in 10 locations

script/plugins/Menu/MenuItems/TRemoveMenuItemDispatcher.js 1 location

@@ 1-22 (lines=22) @@
1
import { deleteTable } from 'prosemirror-tables';
2
import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher';
3
import { svgIcon } from '../MDI';
4
import MenuItem from '../MenuItem';
5
6
export default class TRowDeleteMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.table;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            throw new Error('Table not available in schema!');
14
        }
15
16
        return new MenuItem({
17
            command: deleteTable,
18
            icon: svgIcon('table-remove'),
19
            label: LANG.plugins.prosemirror['label:table-delete'],
20
        });
21
    }
22
}
23

script/plugins/Menu/MenuItems/TCellSplitMenuItemDispatcher.js 1 location

@@ 1-22 (lines=22) @@
1
import { splitCell } from 'prosemirror-tables';
2
import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher';
3
import { svgIcon } from '../MDI';
4
import MenuItem from '../MenuItem';
5
6
export default class TCellSplitMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.table;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            throw new Error('Table not available in schema!');
14
        }
15
16
        return new MenuItem({
17
            command: splitCell,
18
            icon: svgIcon('arrow-split-vertical'),
19
            label: LANG.plugins.prosemirror['label:table-cell-split'],
20
        });
21
    }
22
}
23

script/plugins/Menu/MenuItems/TCellMergeMenuItemDispatcher.js 1 location

@@ 1-22 (lines=22) @@
1
import { mergeCells } from 'prosemirror-tables';
2
import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher';
3
import { svgIcon } from '../MDI';
4
import MenuItem from '../MenuItem';
5
6
export default class TCellMergeMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.table;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            throw new Error('Table not available in schema!');
14
        }
15
16
        return new MenuItem({
17
            command: mergeCells,
18
            icon: svgIcon('table-merge-cells'),
19
            label: LANG.plugins.prosemirror['label:table-cell-merge'],
20
        });
21
    }
22
}
23

script/plugins/Menu/MenuItems/TRowDeleteMenuItemDispatcher.js 1 location

@@ 1-22 (lines=22) @@
1
import { deleteRow } from 'prosemirror-tables';
2
import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher';
3
import { svgIcon } from '../MDI';
4
import MenuItem from '../MenuItem';
5
6
export default class TRowDeleteMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.table;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            throw new Error('Table not available in schema!');
14
        }
15
16
        return new MenuItem({
17
            command: deleteRow,
18
            icon: svgIcon('table-row-remove'),
19
            label: LANG.plugins.prosemirror['label:table-row-delete'],
20
        });
21
    }
22
}
23

script/plugins/Menu/MenuItems/TColumnAddBeforeMenuItemDispatcher.js 1 location

@@ 1-22 (lines=22) @@
1
import { addColumnBefore } from 'prosemirror-tables';
2
import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher';
3
import { svgIcon } from '../MDI';
4
import MenuItem from '../MenuItem';
5
6
export default class TColumnAddBeforeMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.table;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            throw new Error('Table not available in schema!');
14
        }
15
16
        return new MenuItem({
17
            command: addColumnBefore,
18
            icon: svgIcon('table-column-plus-before'),
19
            label: LANG.plugins.prosemirror['label:table-add-column-before'],
20
        });
21
    }
22
}
23

script/plugins/Menu/MenuItems/TRowAddBeforeMenuItemDispatcher.js 1 location

@@ 1-22 (lines=22) @@
1
import { addRowBefore } from 'prosemirror-tables';
2
import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher';
3
import { svgIcon } from '../MDI';
4
import MenuItem from '../MenuItem';
5
6
export default class TRowAddBeforeMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.table;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            throw new Error('Table not available in schema!');
14
        }
15
16
        return new MenuItem({
17
            command: addRowBefore,
18
            icon: svgIcon('table-row-plus-before'),
19
            label: LANG.plugins.prosemirror['label:table-add-row-before'],
20
        });
21
    }
22
}
23

script/plugins/Menu/MenuItems/TColumnDeleteMenuItemDispatcher.js 1 location

@@ 1-22 (lines=22) @@
1
import { deleteColumn } from 'prosemirror-tables';
2
import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher';
3
import { svgIcon } from '../MDI';
4
import MenuItem from '../MenuItem';
5
6
export default class TColumnDeleteMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.table;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            throw new Error('Table not available in schema!');
14
        }
15
16
        return new MenuItem({
17
            command: deleteColumn,
18
            icon: svgIcon('table-column-remove'),
19
            label: LANG.plugins.prosemirror['label:table-column-delete'],
20
        });
21
    }
22
}
23

script/plugins/Menu/MenuItems/TRowAddAfterMenuItemDispatcher.js 1 location

@@ 1-22 (lines=22) @@
1
import { addRowAfter } from 'prosemirror-tables';
2
import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher';
3
import { svgIcon } from '../MDI';
4
import MenuItem from '../MenuItem';
5
6
export default class TRowAddAfterMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.table;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            throw new Error('Table not available in schema!');
14
        }
15
16
        return new MenuItem({
17
            command: addRowAfter,
18
            icon: svgIcon('table-row-plus-after'),
19
            label: LANG.plugins.prosemirror['label:table-add-row-after'],
20
        });
21
    }
22
}
23

script/plugins/Menu/MenuItems/TCellHeaderMenuItemDispatcher.js 1 location

@@ 1-22 (lines=22) @@
1
import { toggleHeaderCell } from 'prosemirror-tables';
2
import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher';
3
import { svgIcon } from '../MDI';
4
import MenuItem from '../MenuItem';
5
6
export default class TCellHeaderMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.table;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            throw new Error('Table not available in schema!');
14
        }
15
16
        return new MenuItem({
17
            command: toggleHeaderCell,
18
            icon: svgIcon('table-border'),
19
            label: LANG.plugins.prosemirror['label:table-cell-header-toggle'],
20
        });
21
    }
22
}
23

script/plugins/Menu/MenuItems/TColumnAddAfterMenuItemDispatcher.js 1 location

@@ 1-22 (lines=22) @@
1
import { addColumnAfter } from 'prosemirror-tables';
2
import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher';
3
import { svgIcon } from '../MDI';
4
import MenuItem from '../MenuItem';
5
6
export default class TColumnAddAfterMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.table;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            throw new Error('Table not available in schema!');
14
        }
15
16
        return new MenuItem({
17
            command: addColumnAfter,
18
            icon: svgIcon('table-column-plus-after'),
19
            label: LANG.plugins.prosemirror['label:table-add-column-after'],
20
        });
21
    }
22
}
23