UNPKG

prism-react-editor

Version:

Lightweight, extensible code editor component for React apps

24 lines (23 loc) 797 B
import { PrismEditor } from '../types'; /** Postion of the cursor relative to the editors overlays. */ export type CursorPosition = { top: number; bottom: number; left: number; right: number; height: number; }; export interface Cursor { /** Gets the cursor position relative to the editor's overlays. */ getPosition(): CursorPosition; /** Scrolls the cursor into view. */ scrollIntoView(): void; } /** * Hook making it easier to calculate the position of the cursor and scroll it into view. * This is used by {@link useDefaultCommands} to keep the cursor in view while typing. * * The extension can be accessed from `editor.extensions.cursor` after layout effects * have been run. */ export declare const useCursorPosition: (editor: PrismEditor) => void;