Skip to content

Releases: chrisgurney/obsidian-note-toolbar

v1.17.3

01 Feb 13:44
Compare
Choose a tag to compare

Don't miss all the new features in 1.17.0.

API Beta

Fixes


Full Changelog: 1.17.2...1.17.3

v1.17.2

01 Feb 12:43
Compare
Choose a tag to compare

Don't miss all the new features in 1.17.0.

Improvements 🚀

  • Allow DV + JS scripts to execute even if a file/note is not currently open.

API Beta

Improvements 🚀

  • Add focus effect for links in modal() when tabbing between them.

Fixes

  • Set keyboard focus in modal() content area. Thanks @FelipeRearden Fixed in 1.17.3

Full Changelog: 1.17.1...1.17.2

v1.17.1

31 Jan 14:50
Compare
Choose a tag to compare

Don't miss all the new features in 1.17.0.

API Beta: New Feature 🎉

Modal component

Adds ntb.modal() which displays a modal with the provided string content, or file contents. Thanks @FelipeRearden for the suggestion!

// shows a modal with the provided string
await ntb.modal("_Hello_ world!");
// shows a modal with the content of a file
const filename = "Welcome.md";
const file = app.vault.getAbstractFileByPath(filename);
if (file) {
  await ntb.modal(file, {
    title: `**${file.basename}**`
  });
}
else {
  new Notice(`File not found: ${filename}`);
}

See the documentation and examples folder (NtbModal.js), or learn more about the Note Toolbar API.


Full Changelog: 1.17.0...1.17.1

v1.17.0

30 Jan 15:02
Compare
Choose a tag to compare

What's new in Note Toolbar v1.17?

New Features 🎉

Bottom toolbar position

By popular demand, there is now a Bottom toolbar position, which floats the toolbar at the bottom of your note.

Change to this position using right-click → Set position → Bottom, or via the toolbar's settings.

Styling notes:

  • If the border style is enabled, the border surrounds the toolbar.
  • Adjust distance from the bottom, left/right padding, and border radius using Style Settings.

Limitations / Known issues:

  1. Toolbars with breaks have a gap on the right side (equivalent to the size of the wrapped items).
  2. Bottom toolbars + Floating buttons: On mobile, the built-in toolbar disappearing makes it hard to use certain toolbar items (e.g., select text → bold).
    • As a bit of a workaround, consider adding the new Note Toolbar: Open Quick Tools (for current toolbar) to the editor toolbar: Settings → Toolbar → scroll to the bottom of Manage toolbar options → Add global command

💬 Let me know how well it works for you in the discussion thread, or use the Google feedback form ↗.

Quickly access styles from the toolbar's context menu

Get to the Style section of settings for the active toolbar by right-clicking on it (or long-press on mobile) and select Style...

New command: Access Quick Tools for the current toolbar

Use the new Note Toolbar: Open Quick Tools (for current toolbar) command to open a Quick Tools window that shows the items in the toolbar associated with the current note.

💡 Tip: On mobile, consider adding this command to the editor toolbar: Settings → Toolbar → scroll to the bottom of Manage toolbar options → Add global command

Improvements 🚀

  • New plugin setting: Show toolbar for the linked note in the File menu, under Note Toolbar Settings → Other, which is defaulted to off. Allows you to selectively enable this feature, which was introduced in 1.13. Thanks @Moyf and @FelipeRearden
  • Floating buttons: Support for the autohide and border styles.
    • The border color defaults to the button's icon color, but can be overridden with Style Settings.
  • Additional Style Settings:
    • Override the autohide style opacity for toolbars and buttons separately.
    • Inactive opacity settings for mobile and desktop are now separate.

Fixes

  • Toolbars in split views are now updated on leaf change, if its config was updated.

Changes

  • Updated Ukranian tranlations thanks to @laktiv

API Beta: Updates

Thanks @FelipeRearden for feedback and testing!

New Features 🎉

  • Added ntb.modal(). See 1.17.1

Improvements 🚀

  • Prompt: All options are now passed via an optional options object parameter, with defaults for each:
    let result = await ntb.prompt(options?: {
      default?: string,      // Optional default value for text field; if not provided, no default value is set
      label?: string,        // Optional text shown above the text field, rendered as markdown; default none
      large?: boolean,       // Set true if text box should be larger; if not provided, defaults to false
      placeholder?: string,  // Optional text inside text field; defaults to preset message
    });
  • Suggester: Made function easier to use with optional keys (if not provided, returned value is the selected option), also via an optional options parameter:
    let result = await ntb.suggester(
      values: string[] | ((value: T) => string),  // 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. Rendered as markdown.
      keys?: T[],  // Optional array containing the keys of each item in the correct order. If not provided, values are returned on selection.
      options?: {
        placeholder?: string,  // shown in the input field; defaults to message
        limit?: number         // Optional limit of the number of items rendered at once (useful to improve performance when displaying large lists). Defaults to no limit.
      });
  • Suggester values and Prompt label (options.label) are now rendered as markdown, so they can include markdown and things like Iconize icons.
  • Prompt: Reduced size of modal when using the simple prompt, including on mobile.
  • Prompt: When using the large option, a modifier key (e.g., cmd) and enter now submits.

Changes

See the updated documentation in the User Guide to learn more.

v1.17-beta-18

28 Jan 17:47
Compare
Choose a tag to compare
v1.17-beta-18 Pre-release
Pre-release

Fixes

  • On mobile, in What's New, a single code line was not wrapping, pushing out the overall width.

Beta API Improvements 🚀

  • The API class name has now been shortened from NoteToolbar to ntb.
  • Fix: Suggester: The bottom border radius was missing on mobile.

Full Changelog: 1.17-beta-17...1.17-beta-18

v1.17-beta-17

28 Jan 15:59
Compare
Choose a tag to compare
v1.17-beta-17 Pre-release
Pre-release

Changes

  • Moved bottom toolbar position up slightly on mobile (was overlapping the touch bar on iPad).

Beta API Improvements 🚀

  • Prompt: Large text field submits on enter + a modifier key (e.g., cmd). Thanks @FelipeRearden
  • Prompt: Made height smaller on mobile.

Full Changelog: 1.17-beta-16...1.17-beta-17

v1.17-beta-16

28 Jan 14:37
Compare
Choose a tag to compare
v1.17-beta-16 Pre-release
Pre-release

Beta API Improvements 🚀

  • (To test) API UI prompt() large text field now submits on enter + modifier. Working in beta-17
  • Shortened API prompt() option parameter names:
let result = await prompt(options?: {
  default?: string,      // default value for text field; default none
  label?: string,        // shown above the text field, rendered as markdown; default none
  large?: boolean,       // set true if text box should be larger; default false
  placeholder?: string,  // text inside text field; defaults to message
});

Full Changelog: 1.17-beta-15...1.17-beta-16

v1.17-beta-15

26 Jan 21:26
Compare
Choose a tag to compare
v1.17-beta-15 Pre-release
Pre-release

Improvements 🚀

API UI components updates

Prompt: All options are now passed via an optional options object parameter, with defaults for each:

prompt(options?: {
  label?: string,  // shown above the text field, rendered as markdown; default none
  large?: boolean,  // set true if text box should be larger; default false
  placeholder?: string,  // text inside text field; defaults to message
  default?: string // default value for text field; default none
})

Suggester: Made function easier to use with optional keys (if not provided, returned value is the selected option), also via an optional options parameter:

suggester(
    values: string[] | ((value: T) => string), // renamed from text_items; rendered as markdown
    keys?: T[], // renamed from items; if not provided, values are returned on selection
    options?: {
      placeholder?: string, // shown in the input field; defaults to message
      limit?: number        // how many options to show; defaults to no limit 
    })

Also:

Other improvements

  • Code examples in What's New are now horizontally scrollable.

Fixes

  • Using the Create new note link was creating a note but with duplicate toolbars. (This may have been a 1.8.x issue, with the metadata event firing on note creation.)

Full Changelog: 1.17-beta-14...1.17-beta-15

v1.17-beta-14

25 Jan 19:32
Compare
Choose a tag to compare
v1.17-beta-14 Pre-release
Pre-release

Changes

Beta API UI components: Suggester:

  • Fix: Returns value from text_items array if items parameter is provided. Thanks @FelipeRearden
  • Makes keys (items parameter) optional. If not provided, value from the text_items array is returned.
const keys = ["key1", "key2"];
// mix in Obsidian and plugin markdown (e.g., Iconize) to have it rendered in the suggester
const values = [":LiHome: value1", ":LiActivity: value2"];
    
// all of these work:
const selected1 = await NoteToolbar.suggester(values); // returns value of selection
const selected2 = await NoteToolbar.suggester(values, keys); // returns key corresponding to selection
const selected3 = await NoteToolbar.suggester(values, keys, "Placeholder"); // sets placeholder text
const selected4 = await NoteToolbar.suggester(values, null, "Placeholder"); // sets placeholder text without keys

Full Changelog: 1.17-beta-13...1.17-beta-14

v1.17-beta-13

25 Jan 11:45
Compare
Choose a tag to compare
v1.17-beta-13 Pre-release
Pre-release

Improvements 🚀

  • New plugin setting: Show toolbar for the linked note in the File menu, under Note Toolbar Settings → Other, which is defaulted to off. Allows you to selectively enable this feature, which was introduced in v1.13. Thanks @Moyf and @FelipeRearden
  • Bottom toolbars: Style Settings: Adjust the Y position separately on desktop and mobile.
  • Beta API UI components:
    • Suggester: Options are now rendered as markdown, so they can include markdown and things like Iconize icons. Thanks @FelipeRearden
    • Prompt: Now accepts an optional input placeholder text parameter: Thanks @FelipeRearden
      • suggester(text_items: string[] | ((item: T) => string), items: T[], placeholder?: string, limit?: number)
    • Prompt: Made function easier to use with optional params and more sensible defaults:
      • prompt(prompt_text: string, multiline?: boolean, placeholder?: string, default_value?: string)
    • Examples folder in repo has been updated to use the updated functions.

Full Changelog: 1.17-beta-11...1.17-beta-13