zent
Version:
一套前端设计语言和基于React的实现
25 lines (24 loc) • 978 B
TypeScript
export declare type TextMarkSearchWords = string | RegExp;
export interface ITextMarkChunk {
highlight: boolean;
start: number;
end: number;
}
export interface ITextMarkFindAllParameters {
autoEscape?: boolean;
caseSensitive?: boolean;
findChunks: TextMarkFindChunksFunction;
sanitize?: TextMarkSanitizeFunction;
searchWords: TextMarkSearchWords[];
textToHighlight: string;
}
export interface ITextMarkCombineChunksParameters {
chunks: ITextMarkChunk[];
}
export interface ITextMarkFillInChunksParameters {
chunksToHighlight: ITextMarkChunk[];
totalLength: number;
}
export declare type TextMarkFindChunksFunction = (options: Omit<ITextMarkFindAllParameters, 'findChunks'>) => ITextMarkChunk[];
export declare type TextMarkSanitizeFunction = (str: string) => string;
export declare function findAll({ autoEscape, caseSensitive, findChunks, sanitize, searchWords, textToHighlight, }: ITextMarkFindAllParameters): ITextMarkChunk[];