@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
18 lines (17 loc) • 1.01 kB
TypeScript
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
/**
* Returns a NodeSelection for the node at `start`.
* Matches the `platform_editor_block_menu=true` path in block-controls:
* mediaGroup with a single child → select the child; all others → select the node.
* Returns false when no node exists at `start`.
*/
export declare const getNodeSelectionForPos: (doc: PMNode, start: number) => NodeSelection | false;
/** Applies a CellSelection to `tr` for the table node at `tableNodePos`. */
export declare const selectTableNodeAtPos: (tr: Transaction, tableNodePos: number) => Transaction;
/**
* Selects the node at `nodePos` without any plugin-API dependency.
* Tables use CellSelection; all other nodes use NodeSelection.
*/
export declare const selectNodeAtPos: (tr: Transaction, nodePos: number, nodeType: string) => Transaction;