Skip to content

BookmarksPluginInstance

Unofficial

Plugin instance for bookmarks, managing bookmarked files, folders, URLs, searches, and graphs.

Import:

import type { BookmarksPluginInstance } from '@obsidian-typings/obsidian-catalyst-latest';

Signature:

export interface BookmarksPluginInstance extends InternalPluginInstance<BookmarksPlugin>, Events

Extends: InternalPluginInstance<BookmarksPlugin>, Events

Constructor

new BookmarksPluginInstance()

Constructor.

To extract the constructor type, use ExtractConstructor<Events>.

Properties

Property Type Description
_ Record<string, EventsEntry[]> Internal storage of registered event handlers by event name.
(Inherited from Events)
app App Reference to the app.
bookmarkedViews WeakMap<View, HTMLElement> Weak map tracking bookmarked views and their indicator elements.
bookmarkLookup Record<string, BookmarkItem> Lookup table mapping paths to bookmark items.
defaultOn true Whether this plugin is enabled by default.
description string Human-readable description of this plugin.
(Inherited from InternalPluginInstance)
hasValidData boolean Whether the bookmark data has been successfully loaded and validated.
id string Unique identifier for this plugin.
(Inherited from InternalPluginInstance)
items BookmarkItem[] List of all bookmark items.
name string Human-readable display name of this plugin.
(Inherited from InternalPluginInstance)
onItemsChanged Debouncer<[boolean], void> Debounced handler triggered when bookmark items change.
plugin BookmarksPlugin Reference to the bookmarks plugin registration.
urlBookmarkLookup Record<string, BookmarkItem> Lookup table mapping URLs to bookmark items.

Methods

Method Returns Description
_onItemsChanged(shouldSave) void Internal handler called when bookmark items change.
addItem(item, instance?) void Add a bookmark item, optionally to a specific parent instance.
editItem(item) void Open the edit dialog for a bookmark item.
findBookmarkByView(view) BookmarkItem | null | undefined Find the bookmark item associated with a given file view.
getBookmarks() BookmarkItem[] Get a flat list of all bookmark items.
getItemTitle(item) string Get the display title for a bookmark item.
init(app, plugin) void Initialize the plugin instance with app and plugin references.
(Inherited from InternalPluginInstance)
initLeaf() void Initialize the bookmarks view leaf.
loadData() Promise<boolean> Load bookmark data from storage.
moveItem(item, instance, index) void Move a bookmark item to a new position within the list.
off(name, callback) void Remove an event listener.
(Inherited from Events)
offref(ref) void Remove an event listener by reference.
(Inherited from Events)
on(name, callback, ctx?) EventRef Add an event listener.
(Inherited from Events)
onDisable(app, plugin) void Called when the plugin is disabled.
(Inherited from InternalPluginInstance)
onEditorMenu(menu, editor, info) void Add bookmark-related items to the editor context menu.
onEnable(app, plugin) Promise<void> Called when the plugin is enabled.
onEnable(app, plugin) Promise<void> Called when the plugin is enabled.
(Inherited from InternalPluginInstance)
onExternalSettingsChange() Promise<void> Handle external settings file changes and reload configuration.
onFileMenu(menu, files, source, leaf?) void Add bookmark-related items to a file context menu.
onFileRename(file, oldPath) void Handle a file rename and update affected bookmarks.
onFilesMenu(menu, files, source, leaf?) void Add bookmark-related items to a multi-file context menu.
onLeafMenu(menu, leaf) void Add bookmark-related items to a workspace leaf context menu.
onSearchResultsMenu(menu, search) void Add bookmark-related items to a search results context menu.
onTabGroupMenu(menu, tabsLeaf) void Add bookmark-related items to a tab group context menu.
onUserDisable(app) void Called when the user manually disables the plugin.
(Inherited from InternalPluginInstance)
onUserEnable() void Called when the user enables the plugin.
onUserEnable(app) void Called when the user manually enables the plugin.
(Inherited from InternalPluginInstance)
openBookmark(item, newLeaf, newLeaf2?) Promise<void> Open a bookmark item in a new or existing leaf.
openBookmarkInLeaf(item, leaf, newLeaf?) Promise<void> Open a bookmark item in a specific workspace leaf.
openBookmarks(items, newLeaf?) Promise<void> Open multiple bookmark items at once.
rebuildBookmarkCache() void Rebuild the internal bookmark lookup caches.
removeItem(item) void Remove a bookmark item from the list.
saveData() void Persist the current bookmark data to storage.
trigger(name, data?) void Trigger an event, executing all the listeners in order even if some of them throw an error.
(Inherited from Events)
tryTrigger(evt, args) void Try to trigger an event, executing all the listeners in order even if some of them throw an error.
(Inherited from Events)
updateTabHeaders() void Update bookmark indicator icons on tab headers.

Links to this page: