Scope
Official
A scope receives keyboard events and binds callbacks to given hotkeys. Only one scope is active at a time, but scopes may define parent scopes (in the constructor) and inherit their hotkeys.
Import:
import { Scope } from 'obsidian';Signature:
export class ScopeConstructor
new Scope(parent?: Scope | undefined)Constructor.
To get the constructor instance, use getScopeConstructor from obsidian-typings/implementations.
Properties
| Property | Type | Description | |
|---|---|---|---|
| cb | (() => boolean) | undefined | Callback to execute when scope is matched | |
| keys | KeyScope[] | Overridden keys that exist in this scope. | |
| parent | Scope | undefined | obsidian#Scope that this scope is a child of | |
| tabFocusContainerEl | HTMLElement | null | Container element that constrains tab-key focus cycling. | |
| win | null | Window | The window this scope is bound to, or null when not bound to a specific window. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| handleKey(event, keypress) | unknown | Execute keypress within this scope. | |
| register(modifiers, key, func) | KeymapEventHandler | Add a keymap event handler to this scope. | |
| setTabFocusContainer(container) | void | Set the container element for constraining tab-key focus cycling. | |
| setTabFocusContainerEl(containerEl) | void | Sets the container element used for tab-focus handling. | |
| unregister(handler) | void | Remove an existing keymap event handler. |
Links to this page:
- AbstractInputSuggest
- AbstractSearchComponent
- AllPropertiesView
- App
- AppSetting
- BasesSearchMenu
- BookmarksView
- ConfirmationModal
- DeferredView
- EditorSearchComponent
- EditorSuggest
- EmptyView
- FileExplorerView
- FileSuggest
- getScopeConstructor
- GraphView
- IFramedMarkdownEditor
- ItemView
- Keymap
- KeymapEventHandler
- KeymapWindowStack
- KeyScope
- MarkdownScrollableEditView
- Menu
- Modal
- PopoverSuggest
- PropertyPropertyWidgetComponentComboBox
- ReleaseNotesView
- SearchView
- SuggestModal
- SyncView
- TableView
- TagView
- Tree
- UnknownView
- View
- WebviewerHistoryView
- WebviewerView
- Workspace