generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
205 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,45 @@ | ||
## QuickAdd API | ||
# QuickAdd API | ||
### `inputPrompt(header: string, placeholder?: string, value?: string): string` | ||
Opens a prompt that asks for an input. Returns a string with the input. | ||
|
||
This function is asynchronous. You should ``await`` it. | ||
|
||
### `yesNoPrompt: (header: string, text?: string): boolean` | ||
Opens a prompt asking for confirmation. Returns `true` or `false` based on answer. | ||
|
||
### `suggester: (displayItems: string[], actualItems: string[])` | ||
This function is asynchronous. You should ``await`` it. | ||
|
||
### `suggester: (displayItems: string[] | ((value: string, index?: number, arr?: string[]) => string[]), actualItems: string[])` | ||
Opens a suggester. Displays the `displayItems`, but you map these the other values with `actualItems`. | ||
|
||
The ``displayItems`` can either be an array of strings, or a map function that will be executed on the actual items. | ||
|
||
This means that the following syntax is possible: | ||
````js | ||
const pickedFile = await params.quickAddApi.suggester( | ||
(file) => file.basename, | ||
params.app.vault.getMarkdownFiles() | ||
); | ||
```` | ||
|
||
Returns the selected value. | ||
|
||
This function is asynchronous. You should ``await`` it. | ||
|
||
### `checkboxPrompt: (items: string[], selectedItems: string[])` | ||
Opens a checkbox prompt with the items given. Items in the `selectedItems` array will be selected by default. | ||
|
||
Returns an array of the selected items. | ||
|
||
This function is asynchronous. You should ``await`` it. | ||
|
||
## Utility module | ||
### ``getClipboard()`` | ||
Returns the contents of your clipboard. | ||
|
||
This function is asynchronous. You should ``await`` it. | ||
|
||
### ``setClipboard(text: string)`` | ||
Sets the contents of your clipboard to the given input. | ||
|
||
This function is asynchronous. You should ``await`` it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.