Files
Verso/services/web/frontend/js/features/review-panel/utils/is-selection-within-op.ts
T
DavidandCopybot 9fae8d4b5b Merge pull request #27728 from overleaf/dp-rename-review-panel
Rename `review-panel-new` to simply `review-panel`

GitOrigin-RevId: 7aad0406bce60602d272bdfae7a124ed4246bd1c
2025-08-12 08:06:31 +00:00

11 lines
337 B
TypeScript

import { AnyOperation } from '../../../../../types/change'
import { SelectionRange } from '@codemirror/state'
import { visibleTextLength } from '@/utils/operations'
export const isSelectionWithinOp = (
op: AnyOperation,
range: SelectionRange
): boolean => {
return range.to >= op.p && range.from <= op.p + visibleTextLength(op)
}