Skip to content

restoreCodeBlockFocus

Puts the focus back on the element a CodeBlockFocusSnapshot describes.

Import:

import { restoreCodeBlockFocus } from '@mnaoumov/obsidian-lib/code-block-render-handoff';

Signature:

function restoreCodeBlockFocus(el: HTMLElement, focus: CodeBlockFocusSnapshot): Promise<boolean>

Parameters:

Parameter Type Description
el HTMLElement The new code block element.
focus CodeBlockFocusSnapshot The snapshot captured from the old render.

Returns: Promise<boolean> — Whether an element was focused.