Skip to content

createAnchorFromSelection

Anchors a popover at the caret — used by a command invoked from the keyboard, with the cursor already at the place being edited.

Import:

import { createAnchorFromSelection } from '@mnaoumov/obsidian-lib/popovers/popover-anchor';

Signature:

function createAnchorFromSelection(doc: Document): PopoverAnchor

Parameters:

Parameter Type Description
doc Document The document holding the selection.

Returns: PopoverAnchor — The anchor, or a centered one when there is no caret to read.