rowAbove.js 609 B

12345678910111213141516171819202122
  1. import { getValidSelection } from './../utils';
  2. export var KEY = 'row_above';
  3. export default function rowAboveItem() {
  4. return {
  5. key: KEY,
  6. name: 'Insert row above',
  7. callback: function callback(key, selection) {
  8. this.alter('insert_row', selection.start.row, 1, 'ContextMenu.rowAbove');
  9. },
  10. disabled: function disabled() {
  11. var selected = getValidSelection(this);
  12. return !selected || this.selection.selectedHeader.cols || this.countRows() >= this.getSettings().maxRows;
  13. },
  14. hidden: function hidden() {
  15. return !this.getSettings().allowInsertRow;
  16. }
  17. };
  18. }