@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
28 lines (27 loc) • 1.35 kB
TypeScript
import type { JSONNode } from '@atlaskit/editor-json-transformer';
import { Fragment } from '@atlaskit/editor-prosemirror/model';
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
import type { Selection } from '@atlaskit/editor-prosemirror/state';
export declare const selectionCoversAllListItems: ($from: ResolvedPos, $to: ResolvedPos) => boolean;
/**
* Get the slice of the document corresponding to the selection.
* This is similar to the prosemirror `selection.content()` - but
* does not include the parents (unless the result is inline)
*
* @param selection The selection to get the slice for.
* @returns The slice of the document corresponding to the selection.
*/
export declare const getSliceFromSelection: (selection: Selection) => Fragment;
/**
* Get the fragments from the selection.
* @param selection The selection to get the fragments from.
* @param schema The schema to use to convert the nodes to JSON.
* @returns The fragments as an array of JSON nodes.
*/
export declare const getFragmentsFromSelection: (selection?: Selection) => JSONNode[] | null;
/**
* Get the local IDs from the selection.
* @param selection The selection to get the local IDs from.
* @returns The local IDs as an array of strings.
*/
export declare const getLocalIdsFromSelection: (selection?: Selection) => string[] | null;