@codemirror/state#SelectionRange TypeScript Examples
The following examples show how to use
@codemirror/state#SelectionRange.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: util.ts From obsidian-admonition with MIT License | 7 votes |
rangesInclude = (
ranges: readonly SelectionRange[],
from: number,
to: number
) => {
for (const range of ranges) {
const { from: rFrom, to: rTo } = range;
if (rFrom >= from && rFrom <= to) return true;
if (rTo >= from && rTo <= to) return true;
if (rFrom < from && rTo > to) return true;
}
return false;
}