Releases: chrisgurney/obsidian-note-toolbar
v1.16-beta-13
New Features 🎉
Via the API for Note Toolbar, you can now open a prompt modal, or get content from the clipboard:
(BETA) Note Toolbar API: Open a prompt modal
NoteToolbarApi.prompt()
: Shows a prompt modal and returns the user's input.
- The parameters are the same as Templater's function that does the same thing, accepting:
prompt_text
: Text placed above the input field.default_value
: A default value for the input field.throw_on_cancel
: Throws an error if the prompt is canceled, instead of returning a null value.multiline
: If set to true, the input field will be a multiline textarea. Defaults to false.
- Returns the user's input.
(BETA) Note Toolbar API: Return clipboard contents
NoteToolbarApi.clipboard()
: Returns the clipboard's contents.
Improvements 🚀
- In toolbar settings, made the Custom classes field larger. Thanks @laktiv
- Reordered the toolbar's right-click menu, to put position/properties toggles at the top, and settings at the bottom.
Fixes
- The menu CSS class is now added to sub-menus, so CSS snippets can be applied to them as well.
- Custom styles/classes are now added to menus and sub-menus. Thanks @laktiv
Full Changelog: 1.16-beta-12...1.16-beta-13
v1.16-beta-12
New Feature 🎉
(BETA) Note Toolbar API: Open a Suggester modal
The first publicly available API for Note Toolbar allows you to open an Obsidian Suggester modal, enabling Dataview JS or JS Engine scripts to prompt the user for a selection.
- The parameters are the same as Templater's function that does the same thing, accepting:
text_items
: Array of strings representing the text that will be displayed for each item in the suggester prompt. This can also be a function that maps an item to its text representation.items
: Array containing the values of each item in the correct order.throw_on_cancel
: Throws an error if the prompt is canceled, instead of returning anull
value.placeholder
: Placeholder string of the prompt.limit
(optional): Limit the number of items rendered at once (useful to improve performance when displaying large lists).
- Returns the user's chosen item.
- The API will be considered BETA beyond this plugin beta release, until more functions are added in the future (e.g., manipulating toolbars, and other UI components) and I consider naming and organization of the methods available.
- Provide feedback on the release announcement.
- Huge thanks to Templater's code and documentation!
See an example below that works with both Dataview and JS Engine:
/**
* Opens a suggester to allow the user to make a selection.
* Uses the BETA Note Toolbar API.
*
* Usage:
* - Add a Dataview or JS Engine item to your toolbar and select "Execute JavaScript".
* - Add the path to this JavaScript file.
*/
const options = ["option 1", "option 2"];
const selection = await NoteToolbarApi.suggester((item) => item, options, false, "Select an option:");
console.log(selection);
Full Changelog: 1.16-beta-10...1.16-beta-12
v1.16-beta-10
Improvements 🚀
- Settings: Increased the size of the arguments and expressions fields for script items. Thanks @laktiv
Full Changelog: 1.16-beta-09...1.16-beta-10
v1.16-beta-09
Changes
- Removed
removeActiveToolbar()
calls for testing #198 - Documentation and example script updates.
Full Changelog: 1.16-beta-08...1.16-beta-09
v1.16-beta-08
New Feature 🎉
Using the new Custom styles section with a CSS snippet, you can now define custom classes that you can apply to one or more specific toolbars.
- Read more about it on the new Custom styling page.
- Thank you @Moyf for the idea!
Fixes
- Minimal theme: width of toolbar below props too wide #204
Full Changelog: 1.16-beta-07...1.16-beta-08
v1.16-beta-07
v1.16-beta-06
Install the beta via BRAT (instructions).
New Feature 🎉
Execute a command after creating a file from a template (Templater).
Notes:
- Depending on how this tests, this can be added easily to other script functions/types.
- Note that creating a file from template will now no longer focus the file explorer on the new file, but you now can explicitly do that by selecting the
Files: Reveal current file in navigation
command.- Though I couldn't get this command to work reliably in my own testing, while other commands seem to work fine. I'm open to getting help to figure out why. I'm wondering if I have to wait for the
file-open
event explicitly first, before execution.
- Though I couldn't get this command to work reliably in my own testing, while other commands seem to work fine. I'm open to getting help to figure out why. I'm wondering if I have to wait for the
- Thank you @pdelre for inspiring the idea for this one in #203
Full Changelog: 1.16-beta-05...1.16-beta-06
v1.16-beta-05
Install the beta via BRAT (instructions).
Improvement 🚀
Show/Hide note properties from the toolbar's right-click menu.
Fixes
- Toolbars showing twice in new notes created from the Create new note link.
Full Changelog: 1.16-beta-04...1.16-beta-05
v1.16-beta-04
Install the beta via BRAT (instructions).
Improvement 🚀
When right-clicking a toolbar you can now also choose positions, including floating button positions, via the Set position menu.
Fixes
- Quick Tools items with invalid item expressions showing multiple error messages.
- Settings: Preview tooltips with vars not using monospace font.
Full Changelog: 1.16-beta-02...1.16-beta-04
v1.16-beta-02
Install the beta via BRAT (instructions).
Fixes
- Export/Share: URIs with a Templater expression as a link were having extra brackets added.
- Export/Share: Link is cut off at first close bracket.
- Settings: Long expressions in previews pushing Edit button.
- Settings: Font size for expressions too large for item group previews.
- Added toolbar removal back in, to hopefully cut down on toolbar blinking issue. #198 Thanks @Moyf
Full Changelog: 1.16-beta-01...1.16-beta-02