UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

27 lines (26 loc) 1.33 kB
import type { NodeType } from '@atlaskit/editor-prosemirror/model'; import { Fragment, Node } from '@atlaskit/editor-prosemirror/model'; import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state'; export type InsertableContent = Node | Fragment; export declare enum LookDirection { Before = "before", After = "after" } export declare const normaliseNestedLayout: ({ selection, doc }: EditorState | Transaction, node: Node) => Node; export declare const safeInsert: (content: InsertableContent, position?: number) => (tr: Transaction) => Transaction | null; /** * Method extracted from typeahead plugin to be shared with the element browser on handling element insertion. */ export declare const insertSelectedItem: (maybeNode?: Node | Object | string | Fragment, opts?: { selectInlineNode?: boolean; }) => (state: EditorState, tr: Transaction, start: number) => Transaction; /** * ED-14584: Util to check if the destination node is a paragraph & the * content being inserted is a valid child of the grandparent node. * In this case, the destination node should split */ export declare const shouldSplitSelectedNodeOnNodeInsertion: ({ parentNodeType, grandParentNodeType, content, }: { parentNodeType: NodeType; grandParentNodeType: NodeType; content: Node; }) => boolean;