| @@ 1-22 (lines=22) @@ | ||
| 1 | import { setCellAttr } from 'prosemirror-tables'; |
|
| 2 | import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher'; |
|
| 3 | import { svgIcon } from '../MDI'; |
|
| 4 | import MenuItem from '../MenuItem'; |
|
| 5 | ||
| 6 | export default class TCellAlignLeftMenuItemDispatcher 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: setCellAttr('align', 'left'), |
|
| 18 | icon: svgIcon('format-align-left'), |
|
| 19 | label: LANG.plugins.prosemirror['label:table-cell-align-left'], |
|
| 20 | }); |
|
| 21 | } |
|
| 22 | } |
|
| 23 | ||
| @@ 1-22 (lines=22) @@ | ||
| 1 | import { setCellAttr } from 'prosemirror-tables'; |
|
| 2 | import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher'; |
|
| 3 | import { svgIcon } from '../MDI'; |
|
| 4 | import MenuItem from '../MenuItem'; |
|
| 5 | ||
| 6 | export default class TCellAlignCenterMenuItemDispatcher 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: setCellAttr('align', 'center'), |
|
| 18 | icon: svgIcon('format-align-center'), |
|
| 19 | label: LANG.plugins.prosemirror['label:table-cell-align-center'], |
|
| 20 | }); |
|
| 21 | } |
|
| 22 | } |
|
| 23 | ||
| @@ 1-22 (lines=22) @@ | ||
| 1 | import { setCellAttr } from 'prosemirror-tables'; |
|
| 2 | import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher'; |
|
| 3 | import { svgIcon } from '../MDI'; |
|
| 4 | import MenuItem from '../MenuItem'; |
|
| 5 | ||
| 6 | export default class TCellAlignRightMenuItemDispatcher 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: setCellAttr('align', 'right'), |
|
| 18 | icon: svgIcon('format-align-right'), |
|
| 19 | label: LANG.plugins.prosemirror['label:table-cell-align-right'], |
|
| 20 | }); |
|
| 21 | } |
|
| 22 | } |
|
| 23 | ||