13 lines
295 B
TypeScript
13 lines
295 B
TypeScript
export const highlightPattern = (
|
|
text: string,
|
|
widthHeight: string,
|
|
pos: string[],
|
|
posFocus: string[],
|
|
) => {
|
|
if (posFocus.includes(widthHeight)) {
|
|
return `<mark style="background-color: orange;">${text}</mark>`;
|
|
}
|
|
|
|
return pos.includes(widthHeight) ? `<mark>${text}</mark>` : text;
|
|
};
|