@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
24 lines (23 loc) • 1.3 kB
TypeScript
import type { Mark, MarkType, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
import type { EditorCommand } from '../types';
export declare function filterChildrenBetween(doc: PMNode, from: number, to: number, predicate: (node: PMNode, pos: number, parent: PMNode | null) => boolean | undefined): {
node: PMNode;
pos: number;
}[];
export declare function transformNonTextNodesToText(from: number, to: number, tr: Transaction): void;
export declare const applyMarkOnRange: (from: number, to: number, removeMark: boolean, mark: Mark, tr: Transaction) => Transaction;
export declare const entireSelectionContainsMark: (mark: Mark | MarkType, doc: PMNode, fromPos: number, toPos: number) => boolean;
/**
* A custom version of the ProseMirror toggleMark, where we only toggle marks
* on text nodes in the selection rather than all inline nodes.
* @param markType
* @param attrs
*/
export declare const toggleMark: (markType: MarkType, attrs?: {
[key: string]: any;
}) => EditorCommand;
/**
* A wrapper around ProseMirror removeMark and removeStoredMark, which handles mark removal in text, CellSelections and cursor stored marks.
*/
export declare const removeMark: (mark: MarkType | Mark) => EditorCommand;