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-public-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

PropertyTypeDescription
_Record<string, EventsEntry[]>Internal storage of registered event handlers by event name.
(Inherited from Events)
appAppReference to the app.
bookmarkedViewsWeakMap<View, HTMLElement>Weak map tracking bookmarked views and their indicator elements.
bookmarkLookupRecord<string, BookmarkItem>Lookup table mapping paths to bookmark items.
defaultOntrueWhether this plugin is enabled by default.
descriptionstringHuman-readable description of this plugin.
(Inherited from InternalPluginInstance)
hasValidDatabooleanWhether the bookmark data has been successfully loaded and validated.
idstringUnique identifier for this plugin.
(Inherited from InternalPluginInstance)
itemsBookmarkItem[]List of all bookmark items.
namestringHuman-readable display name of this plugin.
(Inherited from InternalPluginInstance)
onItemsChangedDebouncer<[boolean], void>Debounced handler triggered when bookmark items change.
pluginBookmarksPluginReference to the bookmarks plugin registration.
urlBookmarkLookupRecord<string, BookmarkItem>Lookup table mapping URLs to bookmark items.

Methods

MethodReturnsDescription
_onItemsChanged(shouldSave)voidInternal handler called when bookmark items change.
addItem(item, instance?)voidAdd a bookmark item, optionally to a specific parent instance.
editItem(item)voidOpen the edit dialog for a bookmark item.
findBookmarkByView(view)BookmarkItem | null | undefinedFind the bookmark item associated with a given file view.
getBookmarks()BookmarkItem[]Get a flat list of all bookmark items.
getItemTitle(item)stringGet the display title for a bookmark item.
init(app, plugin)voidInitialize the plugin instance with app and plugin references.
(Inherited from InternalPluginInstance)
initLeaf()voidInitialize the bookmarks view leaf.
loadData()Promise<boolean>Load bookmark data from storage.
moveItem(item, instance, index)voidMove a bookmark item to a new position within the list.
off(name, callback)voidRemove an event listener.
(Inherited from Events)
offref(ref)voidRemove an event listener by reference.
(Inherited from Events)
on(name, callback, ctx?)EventRefAdd an event listener.
(Inherited from Events)
onDisable(app, plugin)voidCalled when the plugin is disabled.
(Inherited from InternalPluginInstance)
onEditorMenu(menu, editor, info)voidAdd 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?)voidAdd bookmark-related items to a file context menu.
onFileRename(file, oldPath)voidHandle a file rename and update affected bookmarks.
onFilesMenu(menu, files, source, leaf?)voidAdd bookmark-related items to a multi-file context menu.
onLeafMenu(menu, leaf)voidAdd bookmark-related items to a workspace leaf context menu.
onSearchResultsMenu(menu, search)voidAdd bookmark-related items to a search results context menu.
onTabGroupMenu(menu, tabsLeaf)voidAdd bookmark-related items to a tab group context menu.
onUserDisable(app)voidCalled when the user manually disables the plugin.
(Inherited from InternalPluginInstance)
onUserEnable()voidCalled when the user enables the plugin.
onUserEnable(app)voidCalled 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()voidRebuild the internal bookmark lookup caches.
removeItem(item)voidRemove a bookmark item from the list.
saveData()voidPersist the current bookmark data to storage.
trigger(name, data?)voidTrigger an event, executing all the listeners in order even if some of them throw an error.
(Inherited from Events)
tryTrigger(evt, args)voidTry to trigger an event, executing all the listeners in order even if some of them throw an error.
(Inherited from Events)
updateTabHeaders()voidUpdate bookmark indicator icons on tab headers.

Links to this page: