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 19 20 21 22 23 | 1x 1x 3x 2x | import { createHighlightHelper } from './utils/HighlightHelperImpl';
import { FindHighlightStyleKey, ReplaceHighlightStyleKey, ScrollMargin } from './utils/constants';
import type { FindReplaceContext } from './types/FindReplaceContext';
/**
* Creates a FindReplaceContext object with default values
* @param win The window object
* @param scrollMargin Margin size (in pixels) when scrolling to a highlighted item
* @returns
*/
export function createFindReplaceContext(scrollMargin: number = ScrollMargin): FindReplaceContext {
return {
text: null,
matchCase: false,
wholeWord: false,
ranges: [],
markedIndex: -1,
scrollMargin,
findHighlight: createHighlightHelper(FindHighlightStyleKey),
replaceHighlight: createHighlightHelper(ReplaceHighlightStyleKey),
};
}
|