Skip to content

WidgetEditorView

Unofficial

Editable widget view for embedded file sections (headings, blocks) within the editor.

Import:

import type { WidgetEditorView } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface WidgetEditorView extends EmbeddedEditorView

Extends: EmbeddedEditorView

Constructor

new WidgetEditorView()

Constructor.

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

Properties

PropertyTypeDescription
_childrenComponent[]Child Components attached to current component, will be unloaded on unloading parent component.
(Inherited from EmbeddedEditorView)
_eventsEventRef[]Events that are attached to the current component, will be detached on unloading parent component.
(Inherited from EmbeddedEditorView)
_loadedbooleanWhether the component and its children are loaded.
(Inherited from EmbeddedEditorView)
afterstringData after reference.
appAppReference to the app.
(Inherited from EmbeddedEditorView)
beforestringData before reference.
containerElHTMLElementContainer element for the embedded view.
(Inherited from EmbeddedEditorView)
datastringFull file contents.
dirtybooleanWhether the view is currently saving.
(Inherited from EmbeddedEditorView)
editablebooleanWhether the editor may be edited.
(Inherited from EmbeddedEditorView)
editMode?IFramedMarkdownEditor | undefinedEditor component of the view.
(Inherited from EmbeddedEditorView)
editorElHTMLElementContainer in which the editor is embedded.
(Inherited from EmbeddedEditorView)
filenull | TFileFile to which the view is attached.
(Inherited from EmbeddedEditorView)
fileBeingRenamednull | TFileFile being currently renamed.
headingstringCurrent heading.
hoverPopoverHoverPopover | nullHover element container.
(Inherited from EmbeddedEditorView)
indentstringIndent.
inlineTitleElHTMLElementInline title element.
lastSavedDatanull | stringFull inline content string.
previewElHTMLElementElement containing the preview for the embedded markdown.
(Inherited from EmbeddedEditorView)
previewModeMarkdownPreviewViewPreview component of the view.
(Inherited from EmbeddedEditorView)
saveAgainbooleanWhether embedding should be saved twice on save.
savingbooleanWhether the widget is currently saving.
stateunknownCurrent state of the editor.
(Inherited from EmbeddedEditorView)
subpathstringSubpath reference of the path.
subpathNotFoundbooleanWhether the subpath was not found in the cache.
textstringText contents being embedded.
(Inherited from EmbeddedEditorView)
useIframebooleanWhether the view renders contents using an iFrame.
(Inherited from EmbeddedEditorView)

Methods

MethodReturnsDescription
addChild(component)TAdds a child component, loading it if this component is loaded.
(Inherited from EmbeddedEditorView)
applyScope(scope)voidPush/pop current scope.
destroyEditor(save?)voidDestroy edit component editor and save contents if specified.
(Inherited from EmbeddedEditorView)
getFoldInfo()FoldInfo | nullGet the current folds of the editor.
getMode()'preview' | 'source'Gets currently active mode (editMode returns 'source').
(Inherited from EmbeddedEditorView)
load()voidLoad this component and its children.
(Inherited from EmbeddedEditorView)
loadContents(data, cache)voidSplice incoming data at according to subpath for correct reference, then update heading and render.
loadFile()Promise<void>Load file from cache based on stored path.
loadFileInternal(data, cache?)voidLoad file and check if data is different from last saved data, then loads contents.
onFileChanged(file, data, cache)voidUpdate representation on file finished updating.
onFileRename(file, oldPath)voidUpdate representation on file rename.
onload()voidOn loading widget, register vault change and rename events.
onMarkdownFold()voidSave fold made in the editor to foldManager.
onMarkdownScroll()voidTrigger markdown scroll on workspace.
(Inherited from EmbeddedEditorView)
onTitleChange(element)voidOn change of editor title element.
onTitleKeydown(event)voidOn keypress on editor title element.
onTitlePaste(element, event)voidOn pasting on editor title element.
onunload()voidOn unloading widget, unload component and remove scope.
register(cb)voidRegisters a callback to be called when unloading.
(Inherited from EmbeddedEditorView)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading.
(Inherited from EmbeddedEditorView)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading
(Inherited from EmbeddedEditorView)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading
(Inherited from EmbeddedEditorView)
registerEvent(eventRef)voidRegisters an event to be detached when unloading.
(Inherited from EmbeddedEditorView)
registerInterval(id)numberRegisters an interval (from setInterval) to be cancelled when unloading. Use window.setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API
(Inherited from EmbeddedEditorView)
registerScopeEvent(keymapEventHandler)voidRegister a scope keymap event handler to be removed on unload.
(Inherited from EmbeddedEditorView)
removeChild(component)TRemoves a child component, unloading it.
(Inherited from EmbeddedEditorView)
requestSave()voidDebounced save of contents.
(Inherited from EmbeddedEditorView)
requestSaveFolds()voidDebounced save of editor folds.
(Inherited from EmbeddedEditorView)
save(data, delayed?)Promise<void>Save changes made in editable widget.
save(data, save?)voidSet file contents.
(Inherited from EmbeddedEditorView)
saveTitle(element)voidOn blur widget, save title.
set(data, clear)voidSet the state of the editor.
(Inherited from EmbeddedEditorView)
showEditor()voidReveal the editor if editable widget and applies saved state.
(Inherited from EmbeddedEditorView)
showPreview(show?)voidShow preview of widget.
showPreview(save?)voidReveal preview mode and destroy editor, save if specified.
(Inherited from EmbeddedEditorView)
showSearch(replace?)voidReveal search component in file renderer component.
(Inherited from EmbeddedEditorView)
toggleMode()voidToggle between edit and preview mode.
(Inherited from EmbeddedEditorView)
unload()voidOverride this to unload your component.
(Inherited from EmbeddedEditorView)

Links to this page: