All files / roosterjs-content-model-dom/lib/modelApi/selection hasSelectionInBlockGroup.ts

100% Statements 7/7
100% Branches 6/6
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 191x             1x 638x 197x     441x 11x     430x    
import { hasSelectionInBlock } from './hasSelectionInBlock';
import type { ReadonlyContentModelBlockGroup } from 'roosterjs-content-model-types';
 
/**
 * Check if there is selection within the given block
 * @param block The block to check
 */
export function hasSelectionInBlockGroup(group: ReadonlyContentModelBlockGroup): boolean {
    if (group.blockGroupType == 'TableCell' && group.isSelected) {
        return true;
    }
 
    if (group.blocks.some(hasSelectionInBlock)) {
        return true;
    }
 
    return false;
}