@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
16 lines (15 loc) • 705 B
TypeScript
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
/**
* This function creates a new transaction that wraps the current selection
* in the specified node type if it results in a valid transaction.
* If not valid, it performs a safe insert operation.
*
* Example of when wrapping might not be valid is when attempting to wrap
* content that is already inside a panel with another panel
*/
export declare function createWrapSelectionTransaction({ state, type, nodeAttributes, }: {
state: EditorState;
type: NodeType;
nodeAttributes?: Record<string, any>;
}): import("prosemirror-state").Transaction;