From 7ff43d6187f0ca5c50fb9cbccdb043ad9c3541af Mon Sep 17 00:00:00 2001 From: Chris Gurney Date: Wed, 3 Apr 2024 10:33:14 -0400 Subject: [PATCH] chore: removed unused class; replaced with IconSuggestModal --- src/Settings/Suggesters/IconSuggester.ts | 40 ------------------------ 1 file changed, 40 deletions(-) delete mode 100644 src/Settings/Suggesters/IconSuggester.ts diff --git a/src/Settings/Suggesters/IconSuggester.ts b/src/Settings/Suggesters/IconSuggester.ts deleted file mode 100644 index adf6e85d..00000000 --- a/src/Settings/Suggesters/IconSuggester.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { AbstractInputSuggest, App, IconName, getIconIds, setIcon } from "obsidian"; - -export class IconSuggester extends AbstractInputSuggest { - - private inputEl: HTMLInputElement; - - constructor(app: App, inputEl: HTMLInputElement) { - super(app, inputEl); - inputEl.addClass("note-toolbar-icon-input"); - this.inputEl = inputEl; - } - - getSuggestions(inputStr: string): IconName[] { - const iconIds = getIconIds(); - const iconSuggestions: IconName[] = []; - const lowerCaseInputStr = inputStr.toLowerCase(); - - iconIds.forEach((icon: IconName) => { - if (icon.toLowerCase().contains(lowerCaseInputStr)) { - iconSuggestions.push(icon); - } - }); - - return iconSuggestions; - } - - renderSuggestion(icon: IconName, el: HTMLElement): void { - el.addClass("note-toolbar-icon-suggestion"); - let iconName = el.createSpan(); - iconName.setText(icon.startsWith("lucide-") ? icon.substring(7) : icon); - let iconGlyph = el.createSpan(); - setIcon(iconGlyph, icon); - } - - selectSuggestion(icon: IconName): void { - this.inputEl.value = icon; - this.inputEl.trigger("input"); - this.close(); - } -} \ No newline at end of file