Skip to content

Commit

Permalink
fix: filtering in multi with uppercase
Browse files Browse the repository at this point in the history
  • Loading branch information
danielo515 committed Sep 15, 2023
1 parent 101e972 commit fac67ea
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/suggesters/MultiSuggest.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { TextInputSuggest } from "./suggest";

export class MultiSuggest extends TextInputSuggest<string> {
content: Set<string>;
content: Set<string>;

constructor(input: HTMLInputElement, content: Set<string>, private onSelect: (value: string) => void) {
super(app, input);
this.content = content;
}
constructor(input: HTMLInputElement, content: Set<string>, private onSelect: (value: string) => void) {
super(app, input);
this.content = content;
}

getSuggestions(inputStr: string): string[] {
const lowerCaseInputStr = inputStr.toLowerCase();
return [...this.content].filter((content) =>
content.contains(lowerCaseInputStr)
);
}
getSuggestions(inputStr: string): string[] {
const lowerCaseInputStr = inputStr.toLocaleLowerCase();
return [...this.content].filter((content) =>
content.toLocaleLowerCase().contains(lowerCaseInputStr)
);
}

renderSuggestion(content: string, el: HTMLElement): void {
el.setText(content);
}
renderSuggestion(content: string, el: HTMLElement): void {
el.setText(content);
}

selectSuggestion(content: string): void {
this.onSelect(content);
this.inputEl.value = "";
// this.inputEl.trigger("blur");
this.inputEl.blur()
this.close();
}
selectSuggestion(content: string): void {
this.onSelect(content);
this.inputEl.value = "";
// this.inputEl.trigger("blur");
this.inputEl.blur()
this.close();
}
}

0 comments on commit fac67ea

Please sign in to comment.