MetadataEditor
Defined in: src/obsidian/internals/MetadataEditor.d.ts:15
Extends
Section titled “Extends”Properties
Section titled “Properties”_children
Section titled “_children”_children:
Component
[]
Defined in: src/obsidian/augmentations/Components/Component.d.ts:13
Child Components attached to current component, will be unloaded on unloading parent component.
Inherited from
Section titled “Inherited from”_events
Section titled “_events”_events:
EventRef
[]
Defined in: src/obsidian/augmentations/Components/Component.d.ts:20
Events that are attached to the current component, will be detached on unloading parent component.
Inherited from
Section titled “Inherited from”_loaded
Section titled “_loaded”_loaded:
boolean
Defined in: src/obsidian/augmentations/Components/Component.d.ts:27
Whether the component and its children are loaded.
Inherited from
Section titled “Inherited from”addPropertyButtonEl
Section titled “addPropertyButtonEl”addPropertyButtonEl:
HTMLButtonElement
Defined in: src/obsidian/internals/MetadataEditor.d.ts:19
Button element for adding a new property.
app:
App
Defined in: src/obsidian/internals/MetadataEditor.d.ts:24
Reference to the app.
collapsed
Section titled “collapsed”collapsed:
boolean
Defined in: src/obsidian/internals/MetadataEditor.d.ts:29
Whether the frontmatter editor is collapsed.
containerEl
Section titled “containerEl”containerEl:
HTMLElement
Defined in: src/obsidian/internals/MetadataEditor.d.ts:34
Container element for the metadata editor.
contentEl
Section titled “contentEl”contentEl:
HTMLElement
Defined in: src/obsidian/internals/MetadataEditor.d.ts:39
Element containing metadata table and addPropertyButton.
focusedLine
Section titled “focusedLine”focusedLine:
null
|MetadataEditorProperty
Defined in: src/obsidian/internals/MetadataEditor.d.ts:44
The currently focused property.
foldEl
Section titled “foldEl”foldEl:
HTMLElement
Defined in: src/obsidian/internals/MetadataEditor.d.ts:49
Fold button for folding away the frontmatter editor on hovering over headingEl.
headingEl
Section titled “headingEl”headingEl:
HTMLElement
Defined in: src/obsidian/internals/MetadataEditor.d.ts:54
Heading element for the metadata editor.
hoverPopover
Section titled “hoverPopover”hoverPopover:
null
|HoverPopover
Defined in: src/obsidian/internals/MetadataEditor.d.ts:59
Hover element container.
owner:
MarkdownView
Defined in: src/obsidian/internals/MetadataEditor.d.ts:64
Owner of the metadata editor.
properties
Section titled “properties”properties:
PropertyEntryData
<unknown
>[]
Defined in: src/obsidian/internals/MetadataEditor.d.ts:69
All properties existing in the metadata editor.
propertyListEl
Section titled “propertyListEl”propertyListEl:
HTMLElement
Defined in: src/obsidian/internals/MetadataEditor.d.ts:74
Element containing all property elements.
rendered
Section titled “rendered”rendered:
MetadataEditorProperty
[]
Defined in: src/obsidian/internals/MetadataEditor.d.ts:79
List of all property field editors.
selectedLines
Section titled “selectedLines”selectedLines:
Set
<MetadataEditorProperty
>
Defined in: src/obsidian/internals/MetadataEditor.d.ts:84
Set of all selected property editors.
Methods
Section titled “Methods”_copyToClipboard()
Section titled “_copyToClipboard()”_copyToClipboard(
event
,properties
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:89
Convert given properties to a serialized object and store in clipboard as obsidian/properties.
Parameters
Section titled “Parameters”properties
Section titled “properties”Returns
Section titled “Returns”void
addChild()
Section titled “addChild()”Call Signature
Section titled “Call Signature”addChild<
T
>(component
):T
Defined in: obsidian.d.ts:911
Adds a child component, loading it if this component is loaded
Type Parameters
Section titled “Type Parameters”T
extends Component
Parameters
Section titled “Parameters”component
Section titled “component”T
Returns
Section titled “Returns”T
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”addChild<
T
>(component
):T
Defined in: src/obsidian/augmentations/Components/Component.d.ts:41
Adds a child component, loading it if this component is loaded.
Type Parameters
Section titled “Type Parameters”T
extends Component
The type of the component to add.
Parameters
Section titled “Parameters”component
Section titled “component”T
The component to add.
Returns
Section titled “Returns”T
The added component.
Example
Section titled “Example”component.addChild(childComponent);
Inherited from
Section titled “Inherited from”addProperty()
Section titled “addProperty()”addProperty():
void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:94
Uncollapse editor if collapsed and create a new property row.
Returns
Section titled “Returns”void
clear()
Section titled “clear()”clear():
void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:99
Clear all properties.
Returns
Section titled “Returns”void
clearSelection()
Section titled “clearSelection()”clearSelection():
void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:104
Unselect all lines.
Returns
Section titled “Returns”void
focusKey()
Section titled “focusKey()”focusKey(
key
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:109
Focus on property field with given key.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
focusProperty()
Section titled “focusProperty()”focusProperty(
property
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:114
Focus on property.
Parameters
Section titled “Parameters”property
Section titled “property”Returns
Section titled “Returns”void
focusPropertyAtIndex()
Section titled “focusPropertyAtIndex()”focusPropertyAtIndex(
index
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:119
Focus on property at specified index.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
focusValue()
Section titled “focusValue()”focusValue(
value
,which
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:124
Focus on property with value.
Parameters
Section titled “Parameters”string
"both"
| "end"
| "start"
Returns
Section titled “Returns”void
handleCopy()
Section titled “handleCopy()”handleCopy(
event
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:129
Handle copy event on selection and serialize properties.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
handleCut()
Section titled “handleCut()”handleCut(
event
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:134
Handle cut event and serialize and remove properties.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
handleItemSelection()
Section titled “handleItemSelection()”handleItemSelection(
event
,property
):boolean
Defined in: src/obsidian/internals/MetadataEditor.d.ts:139
Handle selection of item for drag handling.
Parameters
Section titled “Parameters”property
Section titled “property”Returns
Section titled “Returns”boolean
handleKeypress()
Section titled “handleKeypress()”handleKeypress(
event
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:144
Handle key press event for controlling selection or movement of property up/down.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
handlePaste()
Section titled “handlePaste()”handlePaste(
event
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:149
Handle paste event of properties into metadata editor.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
hasFocus()
Section titled “hasFocus()”hasFocus():
boolean
Defined in: src/obsidian/internals/MetadataEditor.d.ts:154
Whether the editor has focus.
Returns
Section titled “Returns”boolean
hasPropertyFocused()
Section titled “hasPropertyFocused()”hasPropertyFocused():
boolean
Defined in: src/obsidian/internals/MetadataEditor.d.ts:159
Whether there is a property that is focused.
Returns
Section titled “Returns”boolean
insertProperties()
Section titled “insertProperties()”insertProperties(
properties
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:164
Add new properties to the metadata editor and save.
Parameters
Section titled “Parameters”properties
Section titled “properties”Record
<string
, any
>
Returns
Section titled “Returns”void
load()
Section titled “load()”Call Signature
Section titled “Call Signature”load():
void
Defined in: obsidian.d.ts:889
Load this component and its children
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”load():
void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:48
Load this component and its children.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”onload()
Section titled “onload()”onload():
void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:169
On loading of the metadata editor, register on metadata type change event.
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”onMetadataTypeChange()
Section titled “onMetadataTypeChange()”onMetadataTypeChange(
property
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:174
On vault metadata update, update property render.
Parameters
Section titled “Parameters”property
Section titled “property”Returns
Section titled “Returns”void
onunload()
Section titled “onunload()”onunload():
void
Defined in: obsidian.d.ts:906
Override this to unload your component
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”register()
Section titled “register()”Call Signature
Section titled “Call Signature”register(
cb
):void
Defined in: obsidian.d.ts:921
Registers a callback to be called when unloading
Parameters
Section titled “Parameters”() => any
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”register(
cb
):void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:78
Registers a callback to be called when unloading.
Parameters
Section titled “Parameters”() => any
The callback to be called when unloading.
Returns
Section titled “Returns”void
Example
Section titled “Example”component.register(() => { console.log('MyComponent unloaded');});
Inherited from
Section titled “Inherited from”registerDomEvent()
Section titled “registerDomEvent()”Call Signature
Section titled “Call Signature”registerDomEvent<
K
>(el
,type
,callback
,options?
):void
Defined in: obsidian.d.ts:931
Registers an DOM event to be detached when unloading
Type Parameters
Section titled “Type Parameters”K
extends keyof WindowEventMap
Parameters
Section titled “Parameters”K
callback
Section titled “callback”(this
, ev
) => any
options?
Section titled “options?”boolean
| AddEventListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerDomEvent<
K
>(el
,type
,callback
,options?
):void
Defined in: obsidian.d.ts:936
Registers an DOM event to be detached when unloading
Type Parameters
Section titled “Type Parameters”K
extends keyof DocumentEventMap
Parameters
Section titled “Parameters”K
callback
Section titled “callback”(this
, ev
) => any
options?
Section titled “options?”boolean
| AddEventListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerDomEvent<
K
>(el
,type
,callback
,options?
):void
Defined in: obsidian.d.ts:941
Registers an DOM event to be detached when unloading
Type Parameters
Section titled “Type Parameters”K
extends keyof HTMLElementEventMap
Parameters
Section titled “Parameters”K
callback
Section titled “callback”(this
, ev
) => any
options?
Section titled “options?”boolean
| AddEventListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerDomEvent<
K
>(el
,type
,callback
,options?
):void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:96
Registers an DOM event to be detached when unloading.
Type Parameters
Section titled “Type Parameters”K
extends keyof DocumentEventMap
The type of the event to register.
Parameters
Section titled “Parameters”The element to register the event on.
K
The type of the event to register.
callback
Section titled “callback”(this
, ev
) => any
The callback to be called when the event is triggered.
options?
Section titled “options?”The options for the event.
boolean
| AddEventListenerOptions
Returns
Section titled “Returns”void
Example
Section titled “Example”component.registerDomEvent(document, 'click', () => { console.log('Document clicked');});
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerDomEvent<
K
>(el
,type
,callback
,options?
):void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:119
Registers an DOM event to be detached when unloading.
Type Parameters
Section titled “Type Parameters”K
extends keyof HTMLElementEventMap
The type of the event to register.
Parameters
Section titled “Parameters”The element to register the event on.
K
The type of the event to register.
callback
Section titled “callback”(this
, ev
) => any
The callback to be called when the event is triggered.
options?
Section titled “options?”The options for the event.
boolean
| AddEventListenerOptions
Returns
Section titled “Returns”void
Example
Section titled “Example”component.registerDomEvent(document.body, 'click', () => { console.log('Body clicked');});
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerDomEvent<
K
>(el
,type
,callback
,options?
):void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:142
Registers an DOM event to be detached when unloading.
Type Parameters
Section titled “Type Parameters”K
extends keyof WindowEventMap
The type of the event to register.
Parameters
Section titled “Parameters”The element to register the event on.
K
The type of the event to register.
callback
Section titled “callback”(this
, ev
) => any
The callback to be called when the event is triggered.
options?
Section titled “options?”The options for the event.
boolean
| AddEventListenerOptions
Returns
Section titled “Returns”void
Example
Section titled “Example”component.registerDomEvent(window, 'click', () => { console.log('Window clicked');});
Inherited from
Section titled “Inherited from”registerEvent()
Section titled “registerEvent()”Call Signature
Section titled “Call Signature”registerEvent(
eventRef
):void
Defined in: obsidian.d.ts:926
Registers an event to be detached when unloading
Parameters
Section titled “Parameters”eventRef
Section titled “eventRef”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerEvent(
eventRef
):void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:159
Registers an event to be detached when unloading.
Parameters
Section titled “Parameters”eventRef
Section titled “eventRef”The event to be registered.
Returns
Section titled “Returns”void
Example
Section titled “Example”component.registerEvent(eventRef);
Inherited from
Section titled “Inherited from”registerInterval()
Section titled “registerInterval()”Call Signature
Section titled “Call Signature”registerInterval(
id
):number
Defined in: obsidian.d.ts:948
Registers an interval (from setInterval) to be cancelled when unloading Use setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerInterval(
id
):number
Defined in: src/obsidian/augmentations/Components/Component.d.ts:175
Registers an interval (from setInterval) to be cancelled when unloading. Use setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API
Parameters
Section titled “Parameters”number
The id of the interval to register.
Returns
Section titled “Returns”number
The id of the interval.
Example
Section titled “Example”component.registerInterval(window.setInterval(() => { console.log('Interval');}, 1000));
Inherited from
Section titled “Inherited from”registerScopeEvent()
Section titled “registerScopeEvent()”registerScopeEvent(
keymapEventHandler
):void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:181
Parameters
Section titled “Parameters”keymapEventHandler
Section titled “keymapEventHandler”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”removeChild()
Section titled “removeChild()”Call Signature
Section titled “Call Signature”removeChild<
T
>(component
):T
Defined in: obsidian.d.ts:916
Removes a child component, unloading it
Type Parameters
Section titled “Type Parameters”T
extends Component
Parameters
Section titled “Parameters”component
Section titled “component”T
Returns
Section titled “Returns”T
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”removeChild<
T
>(component
):T
Defined in: src/obsidian/augmentations/Components/Component.d.ts:195
Removes a child component, unloading it.
Type Parameters
Section titled “Type Parameters”T
extends Component
The type of the component to remove.
Parameters
Section titled “Parameters”component
Section titled “component”T
The component to remove.
Returns
Section titled “Returns”T
The removed component.
Example
Section titled “Example”component.removeChild(childComponent);
Inherited from
Section titled “Inherited from”removeProperties()
Section titled “removeProperties()”removeProperties(
properties
,reset_focus?
):unknown
Defined in: src/obsidian/internals/MetadataEditor.d.ts:179
Remove specified properties from the metadata editor and save, and reset focus if specified.
Parameters
Section titled “Parameters”properties
Section titled “properties”reset_focus?
Section titled “reset_focus?”boolean
Returns
Section titled “Returns”unknown
reorderKey()
Section titled “reorderKey()”reorderKey(
entry
,index
):unknown
Defined in: src/obsidian/internals/MetadataEditor.d.ts:184
Reorder the entry to specified index position and save.
Parameters
Section titled “Parameters”PropertyEntryData
<unknown
>
number
Returns
Section titled “Returns”unknown
save()
Section titled “save()”save():
void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:189
Serialize the properties and save frontmatter.
Returns
Section titled “Returns”void
selectAll()
Section titled “selectAll()”selectAll():
void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:194
Select all property fields.
Returns
Section titled “Returns”void
selectProperty()
Section titled “selectProperty()”selectProperty(
property
,select
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:199
Mark specified property as selected.
Parameters
Section titled “Parameters”property
Section titled “property”undefined
| MetadataEditorProperty
select
Section titled “select”boolean
Returns
Section titled “Returns”void
serialize()
Section titled “serialize()”serialize():
Record
<string
,any
>
Defined in: src/obsidian/internals/MetadataEditor.d.ts:204
Convert properties to a serialized object.
Returns
Section titled “Returns”Record
<string
, any
>
setCollapse()
Section titled “setCollapse()”setCollapse(
collapsed
,x
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:209
Sets frontmatter as collapsed or uncollapsed.
Parameters
Section titled “Parameters”collapsed
Section titled “collapsed”boolean
boolean
Returns
Section titled “Returns”void
showPropertiesMenu()
Section titled “showPropertiesMenu()”showPropertiesMenu(
event
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:214
On context menu event on header element, show property menu.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
synchronize()
Section titled “synchronize()”synchronize(
data
):void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:219
Synchronize data with given properties and re-render them.
Parameters
Section titled “Parameters”Record
<string
, any
>
Returns
Section titled “Returns”void
toggleCollapse()
Section titled “toggleCollapse()”toggleCollapse():
void
Defined in: src/obsidian/internals/MetadataEditor.d.ts:224
Toggle collapsed state of the metadata editor.
Returns
Section titled “Returns”void
unload()
Section titled “unload()”Call Signature
Section titled “Call Signature”unload():
void
Defined in: obsidian.d.ts:900
Unload this component and its children
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”unload():
void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:211
Override this to unload your component.
Returns
Section titled “Returns”void
Example
Section titled “Example”class MyComponent extends Component { public override onunload(): void { console.log('MyComponent unloaded'); }}