Skip to content

MetadataEditor

Defined in: src/obsidian/internals/MetadataEditor.d.ts:11

Extends

Properties

_children

_children: Component[]

Defined in: src/obsidian/augmentations/Components/Component.d.ts:9

Child Components attached to current component, will be unloaded on unloading parent component

Inherited from

Component._children


_events

_events: EventRef[]

Defined in: src/obsidian/augmentations/Components/Component.d.ts:13

Events that are attached to the current component, will be detached on unloading parent component

Inherited from

Component._events


_loaded

_loaded: boolean

Defined in: src/obsidian/augmentations/Components/Component.d.ts:17

Whether the component and its children are loaded

Inherited from

Component._loaded


addPropertyButtonEl

addPropertyButtonEl: HTMLButtonElement

Defined in: src/obsidian/internals/MetadataEditor.d.ts:15

Button element for adding a new property


app

app: App

Defined in: src/obsidian/internals/MetadataEditor.d.ts:19

Reference to the app


collapsed

collapsed: boolean

Defined in: src/obsidian/internals/MetadataEditor.d.ts:23

Whether the frontmatter editor is collapsed


containerEl

containerEl: HTMLElement

Defined in: src/obsidian/internals/MetadataEditor.d.ts:27

Container element for the metadata editor


contentEl

contentEl: HTMLElement

Defined in: src/obsidian/internals/MetadataEditor.d.ts:31

Element containing metadata table and addPropertyButton


focusedLine

focusedLine: null | MetadataEditorProperty

Defined in: src/obsidian/internals/MetadataEditor.d.ts:35

The currently focused property


foldEl

foldEl: HTMLElement

Defined in: src/obsidian/internals/MetadataEditor.d.ts:39

Fold button for folding away the frontmatter editor on hovering over headingEl


headingEl

headingEl: HTMLElement

Defined in: src/obsidian/internals/MetadataEditor.d.ts:43

Heading element for the metadata editor


hoverPopover

hoverPopover: null | HoverPopover

Defined in: src/obsidian/internals/MetadataEditor.d.ts:47

Hover element container


owner

owner: MarkdownView

Defined in: src/obsidian/internals/MetadataEditor.d.ts:51

Owner of the metadata editor


properties

properties: PropertyEntryData<unknown>[]

Defined in: src/obsidian/internals/MetadataEditor.d.ts:55

All properties existing in the metadata editor


propertyListEl

propertyListEl: HTMLElement

Defined in: src/obsidian/internals/MetadataEditor.d.ts:59

Element containing all property elements


rendered

rendered: MetadataEditorProperty[]

Defined in: src/obsidian/internals/MetadataEditor.d.ts:63

List of all property field editors


selectedLines

selectedLines: Set<MetadataEditorProperty>

Defined in: src/obsidian/internals/MetadataEditor.d.ts:67

Set of all selected property editors

Methods

_copyToClipboard()

_copyToClipboard(event, properties): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:72

Convert given properties to a serialized object and store in clipboard as obsidian/properties

Parameters

event

ClipboardEvent

properties

MetadataEditorProperty[]

Returns

void


addChild()

addChild<T>(component): T

Defined in: obsidian.d.ts:887

Adds a child component, loading it if this component is loaded

Type Parameters

T extends Component

Parameters

component

T

Returns

T

Inherited from

Component.addChild


addProperty()

addProperty(): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:76

Uncollapse editor if collapsed and create a new property row

Returns

void


clear()

clear(): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:80

Clear all properties

Returns

void


clearSelection()

clearSelection(): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:84

Unselect all lines

Returns

void


focusKey()

focusKey(key): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:88

Focus on property field with given key

Parameters

key

string

Returns

void


focusProperty()

focusProperty(property): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:92

Focus on property

Parameters

property

MetadataEditorProperty

Returns

void


focusPropertyAtIndex()

focusPropertyAtIndex(index): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:96

Focus on property at specified index

Parameters

index

number

Returns

void


focusValue()

focusValue(value, which): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:100

Focus on property with value

Parameters

value

string

which

"both" | "end" | "start"

Returns

void


handleCopy()

handleCopy(event): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:104

Handle copy event on selection and serialize properties

Parameters

event

ClipboardEvent

Returns

void


handleCut()

handleCut(event): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:108

Handle cut event and serialize and remove properties

Parameters

event

ClipboardEvent

Returns

void


handleItemSelection()

handleItemSelection(event, property): boolean

Defined in: src/obsidian/internals/MetadataEditor.d.ts:112

Handle selection of item for drag handling

Parameters

event

PointerEvent

property

MetadataEditorProperty

Returns

boolean


handleKeypress()

handleKeypress(event): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:116

Handle key press event for controlling selection or movement of property up/down

Parameters

event

KeyboardEvent

Returns

void


handlePaste()

handlePaste(event): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:120

Handle paste event of properties into metadata editor

Parameters

event

ClipboardEvent

Returns

void


hasFocus()

hasFocus(): boolean

Defined in: src/obsidian/internals/MetadataEditor.d.ts:124

Whether the editor has focus

Returns

boolean


hasPropertyFocused()

hasPropertyFocused(): boolean

Defined in: src/obsidian/internals/MetadataEditor.d.ts:128

Whether there is a property that is focused

Returns

boolean


insertProperties()

insertProperties(properties): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:132

Add new properties to the metadata editor and save

Parameters

properties

Record<string, any>

Returns

void


load()

load(): void

Defined in: obsidian.d.ts:865

Load this component and its children

Returns

void

Inherited from

Component.load


onload()

onload(): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:136

On loading of the metadata editor, register on metadata type change event

Returns

void

Overrides

Component.onload


onMetadataTypeChange()

onMetadataTypeChange(property): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:140

On vault metadata update, update property render

Parameters

property

MetadataEditorProperty

Returns

void


onunload()

onunload(): void

Defined in: obsidian.d.ts:882

Override this to unload your component

Returns

void

Inherited from

Component.onunload


register()

register(cb): void

Defined in: obsidian.d.ts:897

Registers a callback to be called when unloading

Parameters

cb

() => any

Returns

void

Inherited from

Component.register


registerDomEvent()

Call Signature

registerDomEvent<K>(el, type, callback, options?): void

Defined in: obsidian.d.ts:907

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof WindowEventMap

Parameters
el

Window

type

K

callback

(this, ev) => any

options?

boolean | AddEventListenerOptions

Returns

void

Inherited from

Component.registerDomEvent

Call Signature

registerDomEvent<K>(el, type, callback, options?): void

Defined in: obsidian.d.ts:912

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof DocumentEventMap

Parameters
el

Document

type

K

callback

(this, ev) => any

options?

boolean | AddEventListenerOptions

Returns

void

Inherited from

Component.registerDomEvent

Call Signature

registerDomEvent<K>(el, type, callback, options?): void

Defined in: obsidian.d.ts:917

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof HTMLElementEventMap

Parameters
el

HTMLElement

type

K

callback

(this, ev) => any

options?

boolean | AddEventListenerOptions

Returns

void

Inherited from

Component.registerDomEvent


registerEvent()

registerEvent(eventRef): void

Defined in: obsidian.d.ts:902

Registers an event to be detached when unloading

Parameters

eventRef

EventRef

Returns

void

Inherited from

Component.registerEvent


registerInterval()

registerInterval(id): number

Defined in: obsidian.d.ts:924

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

id

number

Returns

number

Inherited from

Component.registerInterval


registerScopeEvent()

registerScopeEvent(keymapEventHandler): void

Defined in: src/obsidian/augmentations/Components/Component.d.ts:19

Parameters

keymapEventHandler

KeymapEventHandler

Returns

void

Inherited from

Component.registerScopeEvent


removeChild()

removeChild<T>(component): T

Defined in: obsidian.d.ts:892

Removes a child component, unloading it

Type Parameters

T extends Component

Parameters

component

T

Returns

T

Inherited from

Component.removeChild


removeProperties()

removeProperties(properties, reset_focus?): unknown

Defined in: src/obsidian/internals/MetadataEditor.d.ts:144

Remove specified properties from the metadata editor and save, and reset focus if specified

Parameters

properties

MetadataEditorProperty[]

reset_focus?

boolean

Returns

unknown


reorderKey()

reorderKey(entry, index): unknown

Defined in: src/obsidian/internals/MetadataEditor.d.ts:148

Reorder the entry to specified index position and save

Parameters

entry

PropertyEntryData<unknown>

index

number

Returns

unknown


save()

save(): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:152

Serialize the properties and save frontmatter

Returns

void


selectAll()

selectAll(): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:156

Select all property fields

Returns

void


selectProperty()

selectProperty(property, select): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:160

Mark specified property as selected

Parameters

property

undefined | MetadataEditorProperty

select

boolean

Returns

void


serialize()

serialize(): Record<string, any>

Defined in: src/obsidian/internals/MetadataEditor.d.ts:164

Convert properties to a serialized object

Returns

Record<string, any>


setCollapse()

setCollapse(collapsed, x): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:168

Sets frontmatter as collapsed or uncollapsed

Parameters

collapsed

boolean

x

boolean

Returns

void


showPropertiesMenu()

showPropertiesMenu(event): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:172

On context menu event on header element, show property menu

Parameters

event

MouseEvent

Returns

void


synchronize()

synchronize(data): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:176

Synchronize data with given properties and re-render them

Parameters

data

Record<string, any>

Returns

void


toggleCollapse()

toggleCollapse(): void

Defined in: src/obsidian/internals/MetadataEditor.d.ts:180

Toggle collapsed state of the metadata editor

Returns

void


unload()

unload(): void

Defined in: obsidian.d.ts:876

Unload this component and its children

Returns

void

Inherited from

Component.unload