mirror of
https://github.com/obsqrbtz/goose-highlighter.git
synced 2026-04-09 04:29:09 +03:00
fix: highlight colors when multiple list have different configurations
This commit is contained in:
@@ -41,7 +41,7 @@ export class HighlightEngine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateWordStyles(activeWords: ActiveWord[]): void {
|
private updateWordStyles(activeWords: ActiveWord[], matchCase: boolean): void {
|
||||||
this.initializeStyleSheet();
|
this.initializeStyleSheet();
|
||||||
|
|
||||||
while (this.styleSheet!.cssRules.length > 0) {
|
while (this.styleSheet!.cssRules.length > 0) {
|
||||||
@@ -61,7 +61,7 @@ export class HighlightEngine {
|
|||||||
this.styleSheet!.insertRule(rule, this.styleSheet!.cssRules.length);
|
this.styleSheet!.insertRule(rule, this.styleSheet!.cssRules.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
const lookup = word.text;
|
const lookup = matchCase ? word.text : word.text.toLowerCase();
|
||||||
this.wordStyleMap.set(lookup, uniqueStyles.get(styleKey)!);
|
this.wordStyleMap.set(lookup, uniqueStyles.get(styleKey)!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ export class HighlightEngine {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateWordStyles(activeWords);
|
this.updateWordStyles(activeWords, matchCase);
|
||||||
|
|
||||||
const wordMap = new Map<string, ActiveWord>();
|
const wordMap = new Map<string, ActiveWord>();
|
||||||
for (const word of activeWords) {
|
for (const word of activeWords) {
|
||||||
|
|||||||
Reference in New Issue
Block a user