@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
19 lines • 863 B
JavaScript
export var getCellIndex = function getCellIndex(map, row, col) {
return row * map.width + col;
};
export function hasMergedColumns(map, row, col) {
var index = getCellIndex(map, row, col);
return col > 0 && map.map[index - 1] === map.map[index] || col < map.width - 1 && map.map[index + 1] === map.map[index];
}
export function hasMergedRows(map, row, col) {
var index = getCellIndex(map, row, col);
return row > 0 && map.map[index - map.width] !== map.map[index] || row < map.height - 1 && map.map[index + map.width] === map.map[index];
}
export function isRootRow(map, row, col) {
var index = getCellIndex(map, row, col);
return row > 0 ? map.map[index - map.width] !== map.map[index] : true;
}
export function isRootCol(map, row, col) {
var index = getCellIndex(map, row, col);
return row > 0 ? map.map[index - 1] !== map.map[index] : true;
}