all files / packages/table/ Table.js

87.5% Statements 7/8
75% Branches 3/4
100% Functions 3/3
87.5% Lines 7/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32                                                 
import { BlockNode } from '../../model'
 
class Table extends BlockNode {
 
  getRowCount() {
    return this.cells.length
  }
 
  getColCount() {
    Eif (this.cells.length > 0) {
      return this.cells[0].length
    } else {
      return 0
    }
  }
 
  getCellAt(row, col) {
    let cellId = this.cells[row][col]
    if (cellId) {
      return this.document.get(cellId)
    }
  }
 
}
 
Table.schema = {
  type: 'table',
  cells: { type: ['array', 'array', 'id'], default: [], owned: true }
}
 
export default Table