AbstractInputSuggest<T>
Official
Attach to an <input> element or a <div contentEditable> to add type-ahead support.
Import:
import { AbstractInputSuggest } from 'obsidian';Signature:
export class AbstractInputSuggest<T> extends PopoverSuggest<T>Extends: PopoverSuggest<T>
Constructor
new AbstractInputSuggest(app: App, textInputEl: HTMLDivElement | HTMLInputElement)Constructor.
To extract the constructor type, use ExtractConstructor<AbstractInputSuggest>.
Properties
| Property | Type | Description | |
|---|---|---|---|
| app | App | The Obsidian app instance. (Inherited from PopoverSuggest) | |
| isOpen | boolean | Whether the suggestion popup is currently open and visible. (Inherited from PopoverSuggest) | |
| lastRect | DOMRect | The last bounding rectangle used for positioning the suggestion popover. | |
| limit | number | Limit to the number of elements rendered at once. Set to 0 to disable. | |
| scope | Scope | The scope for the keymaps. (Inherited from PopoverSuggest) | |
| suggestEl | HTMLDivElement | Suggestion container element. (Inherited from PopoverSuggest) | |
| suggestInnerEl | HTMLElement | The inner element holding the rendered suggestions. (Inherited from PopoverSuggest) | |
| suggestions | SuggestionContainer<T> | Handles selection and rendering of the suggestions. (Inherited from PopoverSuggest) | |
| textInputEl | HTMLDivElement | HTMLInputElement | The text input element this suggest is attached to. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| attachDom() | void | Attaches the suggestion popover to the document with an open animation. (Inherited from PopoverSuggest) | |
| autoDestroy() | void | Automatically destroy the popover when its associated element is removed. (Inherited from PopoverSuggest) | |
| autoReposition() | void | Automatically reposition the suggestion popover based on the input element. | |
| close() | void | Closes the popover. (Inherited from PopoverSuggest) | |
| detachDom() | void | Detaches the suggestion popover from the document. (Inherited from PopoverSuggest) | |
| getSuggestions(query) | Promise<T[]> | T[] | Gets the suggestions for the input element. | |
| getValue() | string | Gets the value from the input element. | |
| onEscapeKey() | void | Handle the escape key to close the popover. (Inherited from PopoverSuggest) | |
| onInputChange() | void | Handle changes to the input element's value. | |
| onInputFocus() | void | Handle the input element receiving focus. | |
| onSelect(callback) | this | Registers a callback to handle when a suggestion is selected by the user. | |
| open() | void | Opens the popover. (Inherited from PopoverSuggest) | |
| renderSuggestion(value, el) | void | Render the suggestion. (Inherited from PopoverSuggest) | |
| reposition(rect, textDirection?) | void | Reposition the popover relative to the given bounding rectangle. (Inherited from PopoverSuggest) | |
| selectCb(value, evt) | unknown | Callback for selecting a suggestion. | |
| selectSuggestion(value, evt) | void | Select a suggestion. | |
| setAutoDestroy(el) | void | Set the element that triggers automatic destruction of the popover when removed. (Inherited from PopoverSuggest) | |
| setValue(value) | void | Sets the value into the input element. | |
| showSuggestions(suggestions) | void | Display the given search results as suggestions. |