import { App , SuggestModal } from "obsidian" ; export class GeneralModal extends SuggestModal < string > { list : string [ ] ; resolve : ( ( value : string | PromiseLike < string > ) => void ) | null = null ; constructor ( app , remotes , placeholder ) { super ( app ) ; this . list = remotes ; this . setPlaceholder ( placeholder ) ; } open ( ) { super . open ( ) ; return new Promise ( ( resolve ) => { this . resolve = resolve ; } ) ; } selectSuggestion ( value , evt ) { if ( this . resolve ) this . resolve ( value ) ; super . selectSuggestion ( value , evt ) ; } onClose ( ) { if ( this . resolve ) this . resolve ( undefined ) ; } getSuggestions ( query ) { return [ query . length > 0 ? query : "..." , ... this . list ] ; } renderSuggestion ( value , el ) { el . innerText = value ; } onChooseSuggestion ( item , _ ) { } }