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 EmbeddedEditorViewExtends: EmbeddedEditorView
Constructor
new WidgetEditorView()Constructor.
To extract the constructor type, use ExtractConstructor<Component>.
Properties
| Property | Type | Description | |
|---|---|---|---|
| _children | Component[] | Child Components attached to current component, will be unloaded on unloading parent component. (Inherited from EmbeddedEditorView) | |
| _events | EventRef[] | Events that are attached to the current component, will be detached on unloading parent component. (Inherited from EmbeddedEditorView) | |
| _loaded | boolean | Whether the component and its children are loaded. (Inherited from EmbeddedEditorView) | |
| after | string | Data after reference. | |
| app | App | Reference to the app. (Inherited from EmbeddedEditorView) | |
| before | string | Data before reference. | |
| containerEl | HTMLElement | Container element for the embedded view. (Inherited from EmbeddedEditorView) | |
| data | string | Full file contents. | |
| dirty | boolean | Whether the view is currently saving. (Inherited from EmbeddedEditorView) | |
| editable | boolean | Whether the editor may be edited. (Inherited from EmbeddedEditorView) | |
| editMode? | IFramedMarkdownEditor | undefined | Editor component of the view. (Inherited from EmbeddedEditorView) | |
| editorEl | HTMLElement | Container in which the editor is embedded. (Inherited from EmbeddedEditorView) | |
| file | null | TFile | File to which the view is attached. (Inherited from EmbeddedEditorView) | |
| fileBeingRenamed | null | TFile | File being currently renamed. | |
| heading | string | Current heading. | |
| hoverPopover | HoverPopover | null | Hover element container. (Inherited from EmbeddedEditorView) | |
| indent | string | Indent. | |
| inlineTitleEl | HTMLElement | Inline title element. | |
| lastSavedData | null | string | Full inline content string. | |
| previewEl | HTMLElement | Element containing the preview for the embedded markdown. (Inherited from EmbeddedEditorView) | |
| previewMode | MarkdownPreviewView | Preview component of the view. (Inherited from EmbeddedEditorView) | |
| saveAgain | boolean | Whether embedding should be saved twice on save. | |
| saving | boolean | Whether the widget is currently saving. | |
| state | unknown | Current state of the editor. (Inherited from EmbeddedEditorView) | |
| subpath | string | Subpath reference of the path. | |
| subpathNotFound | boolean | Whether the subpath was not found in the cache. | |
| text | string | Text contents being embedded. (Inherited from EmbeddedEditorView) | |
| useIframe | boolean | Whether the view renders contents using an iFrame. (Inherited from EmbeddedEditorView) |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| addChild(component) | T | Adds a child component, loading it if this component is loaded. (Inherited from EmbeddedEditorView) | |
| applyScope(scope) | void | Push/pop current scope. | |
| destroyEditor(save?) | void | Destroy edit component editor and save contents if specified. (Inherited from EmbeddedEditorView) | |
| getFoldInfo() | FoldInfo | null | Get the current folds of the editor. | |
| getMode() | 'preview' | 'source' | Gets currently active mode (editMode returns 'source'). (Inherited from EmbeddedEditorView) | |
| load() | void | Load this component and its children. (Inherited from EmbeddedEditorView) | |
| loadContents(data, cache) | void | Splice 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?) | void | Load file and check if data is different from last saved data, then loads contents. | |
| onFileChanged(file, data, cache) | void | Update representation on file finished updating. | |
| onFileRename(file, oldPath) | void | Update representation on file rename. | |
| onload() | void | On loading widget, register vault change and rename events. | |
| onMarkdownFold() | void | Save fold made in the editor to foldManager. | |
| onMarkdownScroll() | void | Trigger markdown scroll on workspace. (Inherited from EmbeddedEditorView) | |
| onTitleChange(element) | void | On change of editor title element. | |
| onTitleKeydown(event) | void | On keypress on editor title element. | |
| onTitlePaste(element, event) | void | On pasting on editor title element. | |
| onunload() | void | On unloading widget, unload component and remove scope. | |
| register(cb) | void | Registers a callback to be called when unloading. (Inherited from EmbeddedEditorView) | |
| registerDomEvent(el, type, callback, options?) | void | Registers a DOM event to be detached when unloading. (Inherited from EmbeddedEditorView) | |
| registerDomEvent(el, type, callback, options?) | void | Registers a DOM event to be detached when unloading (Inherited from EmbeddedEditorView) | |
| registerDomEvent(el, type, callback, options?) | void | Registers a DOM event to be detached when unloading (Inherited from EmbeddedEditorView) | |
| registerEvent(eventRef) | void | Registers an event to be detached when unloading. (Inherited from EmbeddedEditorView) | |
| registerInterval(id) | number | Registers 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) | void | Register a scope keymap event handler to be removed on unload. (Inherited from EmbeddedEditorView) | |
| removeChild(component) | T | Removes a child component, unloading it. (Inherited from EmbeddedEditorView) | |
| requestSave() | void | Debounced save of contents. (Inherited from EmbeddedEditorView) | |
| requestSaveFolds() | void | Debounced save of editor folds. (Inherited from EmbeddedEditorView) | |
| save(data, delayed?) | Promise<void> | Save changes made in editable widget. | |
| save(data, save?) | void | Set file contents. (Inherited from EmbeddedEditorView) | |
| saveTitle(element) | void | On blur widget, save title. | |
| set(data, clear) | void | Set the state of the editor. (Inherited from EmbeddedEditorView) | |
| showEditor() | void | Reveal the editor if editable widget and applies saved state. (Inherited from EmbeddedEditorView) | |
| showPreview(show?) | void | Show preview of widget. | |
| showPreview(save?) | void | Reveal preview mode and destroy editor, save if specified. (Inherited from EmbeddedEditorView) | |
| showSearch(replace?) | void | Reveal search component in file renderer component. (Inherited from EmbeddedEditorView) | |
| toggleMode() | void | Toggle between edit and preview mode. (Inherited from EmbeddedEditorView) | |
| unload() | void | Override this to unload your component. (Inherited from EmbeddedEditorView) |
Links to this page: